slepc-3.4.2.dfsg.orig/0000755000175000017500000000000012214143515013433 5ustar gladkgladkslepc-3.4.2.dfsg.orig/configure0000755000175000017500000000052412211062077015343 0ustar gladkgladk#!/usr/bin/env python import sys if not type(sys.version_info) is tuple and sys.version_info.major > 2: print('Configure does not support Python 3 yet, please run as') print(' python2 ' + ' '.join(["'" + a + "'" for a in sys.argv])) sys.exit(1) import os execfile(os.path.join(os.path.dirname(__file__), 'config', 'configure.py')) slepc-3.4.2.dfsg.orig/src/0000755000175000017500000000000012214143515014222 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/0000755000175000017500000000000012214143515015004 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/examples/0000755000175000017500000000000012214143515016622 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/0000755000175000017500000000000012211062077020650 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/ex21.c0000644000175000017500000003377312211062077021610 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Simple 1-D nonlinear eigenproblem (matrix-free version, sequential).\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions\n\n"; /* Solve 1-D PDE -u'' = lambda*u on [0,1] subject to u(0)=0, u'(1)=u(1)*lambda*kappa/(kappa-lambda) */ #include /* User-defined routines */ PetscErrorCode FormInitialGuess(Vec); PetscErrorCode FormFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*); PetscErrorCode FormJacobian(NEP,PetscScalar,Mat*,MatStructure*,void*); /* Matrix operations and context */ PetscErrorCode MatMult_Fun(Mat,Vec,Vec); PetscErrorCode MatGetDiagonal_Fun(Mat,Vec); PetscErrorCode MatDestroy_Fun(Mat); PetscErrorCode MatDuplicate_Fun(Mat,MatDuplicateOption,Mat*); PetscErrorCode MatMult_Jac(Mat,Vec,Vec); PetscErrorCode MatDestroy_Jac(Mat); typedef struct { PetscScalar lambda,kappa; PetscReal h; } MatCtx; /* User-defined application context */ typedef struct { PetscScalar kappa; /* ratio between stiffness of spring and attached mass */ PetscReal h; /* mesh spacing */ } ApplicationCtx; #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { NEP nep; /* nonlinear eigensolver context */ PetscScalar lambda; /* eigenvalue */ Mat F,J; /* Function and Jacobian matrices */ ApplicationCtx ctx; /* user-defined context */ MatCtx *ctxF,*ctxJ; /* contexts for shell matrices */ NEPType type; PetscInt n=128,nev,i,its,nconv; KSP ksp; PC pc; PetscMPIInt size; PetscReal re,im,norm; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr); if (size != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"This is a uniprocessor example only!"); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Nonlinear Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); ctx.h = 1.0/(PetscReal)n; ctx.kappa = 1.0; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create nonlinear eigensolver context - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPCreate(PETSC_COMM_WORLD,&nep);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create matrix data structure; set Function evaluation routine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscNew(MatCtx,&ctxF);CHKERRQ(ierr); ctxF->h = ctx.h; ctxF->kappa = ctx.kappa; ierr = MatCreateShell(PETSC_COMM_WORLD,n,n,n,n,(void*)ctxF,&F);CHKERRQ(ierr); ierr = MatShellSetOperation(F,MATOP_MULT,(void(*)())MatMult_Fun);CHKERRQ(ierr); ierr = MatShellSetOperation(F,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Fun);CHKERRQ(ierr); ierr = MatShellSetOperation(F,MATOP_DESTROY,(void(*)())MatDestroy_Fun);CHKERRQ(ierr); ierr = MatShellSetOperation(F,MATOP_DUPLICATE,(void(*)())MatDuplicate_Fun);CHKERRQ(ierr); /* Set Function matrix data structure and default Function evaluation routine */ ierr = NEPSetFunction(nep,F,F,FormFunction,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create matrix data structure; set Jacobian evaluation routine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscNew(MatCtx,&ctxJ);CHKERRQ(ierr); ctxJ->h = ctx.h; ctxJ->kappa = ctx.kappa; ierr = MatCreateShell(PETSC_COMM_WORLD,n,n,n,n,(void*)ctxJ,&J);CHKERRQ(ierr); ierr = MatShellSetOperation(J,MATOP_MULT,(void(*)())MatMult_Jac);CHKERRQ(ierr); ierr = MatShellSetOperation(J,MATOP_DESTROY,(void(*)())MatDestroy_Jac);CHKERRQ(ierr); /* Set Jacobian matrix data structure and default Jacobian evaluation routine */ ierr = NEPSetJacobian(nep,J,FormJacobian,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Customize nonlinear solver; set runtime options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPGetKSP(nep,&ksp);CHKERRQ(ierr); ierr = KSPSetType(ksp,KSPBCGS);CHKERRQ(ierr); ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = NEPSetFromOptions(nep);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPSolve(nep);CHKERRQ(ierr); ierr = NEPGetIterationNumber(nep,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of NEP iterations = %D\n\n",its);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = NEPGetType(nep,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n",type);CHKERRQ(ierr); ierr = NEPGetDimensions(nep,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Get number of converged approximate eigenpairs */ ierr = NEPGetConverged(nep,&nconv);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);CHKERRQ(ierr); if (nconv>0) { /* Display eigenvalues and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " k ||T(k)x||\n" " ----------------- ------------------\n");CHKERRQ(ierr); for (i=0;ilambda = lambda; PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "FormJacobian" /* FormJacobian - Computes Jacobian matrix T'(lambda) Input Parameters: . nep - the NEP context . lambda - real part of the scalar argument . ctx - optional user-defined context, as set by NEPSetJacobian() Output Parameters: . jac - Jacobian matrix . B - optionally different preconditioning matrix . flg - flag indicating matrix structure */ PetscErrorCode FormJacobian(NEP nep,PetscScalar lambda,Mat *jac,MatStructure *flg,void *ctx) { PetscErrorCode ierr; MatCtx *ctxJ; PetscFunctionBeginUser; ierr = MatShellGetContext(*jac,(void**)&ctxJ);CHKERRQ(ierr); ctxJ->lambda = lambda; PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Fun" PetscErrorCode MatMult_Fun(Mat A,Vec x,Vec y) { PetscErrorCode ierr; MatCtx *ctx; PetscInt i,n; const PetscScalar *px; PetscScalar *py,c,d,de,oe; PetscReal h; PetscFunctionBeginUser; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecGetSize(x,&n);CHKERRQ(ierr); h = ctx->h; c = ctx->kappa/(ctx->lambda-ctx->kappa); d = n; de = 2.0*(d-ctx->lambda*h/3.0); /* diagonal entry */ oe = -d-ctx->lambda*h/6.0; /* offdiagonal entry */ py[0] = de*px[0] + oe*px[1]; for (i=1;ilambda*h/3.0+ctx->lambda*c; /* diagonal entry of last row */ py[n-1] = oe*px[n-2] + de*px[n-1]; ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Fun" PetscErrorCode MatGetDiagonal_Fun(Mat A,Vec diag) { PetscErrorCode ierr; MatCtx *ctx; PetscInt n; PetscScalar *pd,c,d; PetscReal h; PetscFunctionBeginUser; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); h = ctx->h; c = ctx->kappa/(ctx->lambda-ctx->kappa); d = n; ierr = VecSet(diag,2.0*(d-ctx->lambda*h/3.0));CHKERRQ(ierr); ierr = VecGetSize(diag,&n);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); pd[n-1] = d-ctx->lambda*h/3.0+ctx->lambda*c; ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "MatDestroy_Fun" PetscErrorCode MatDestroy_Fun(Mat A) { MatCtx *ctx; PetscErrorCode ierr; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = PetscFree(ctx);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "MatDuplicate_Fun" PetscErrorCode MatDuplicate_Fun(Mat A,MatDuplicateOption op,Mat *B) { MatCtx *actx,*bctx; PetscInt n; MPI_Comm comm; PetscErrorCode ierr; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&actx);CHKERRQ(ierr); ierr = MatGetSize(A,&n,NULL);CHKERRQ(ierr); ierr = PetscNew(MatCtx,&bctx);CHKERRQ(ierr); bctx->h = actx->h; bctx->kappa = actx->kappa; bctx->lambda = actx->lambda; ierr = PetscObjectGetComm((PetscObject)A,&comm);CHKERRQ(ierr); ierr = MatCreateShell(comm,n,n,n,n,(void*)bctx,B);CHKERRQ(ierr); ierr = MatShellSetOperation(*B,MATOP_MULT,(void(*)())MatMult_Fun);CHKERRQ(ierr); ierr = MatShellSetOperation(*B,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Fun);CHKERRQ(ierr); ierr = MatShellSetOperation(*B,MATOP_DESTROY,(void(*)())MatDestroy_Fun);CHKERRQ(ierr); ierr = MatShellSetOperation(*B,MATOP_DUPLICATE,(void(*)())MatDuplicate_Fun);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Jac" PetscErrorCode MatMult_Jac(Mat A,Vec x,Vec y) { PetscErrorCode ierr; MatCtx *ctx; PetscInt i,n; const PetscScalar *px; PetscScalar *py,c,de,oe; PetscReal h; PetscFunctionBeginUser; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecGetSize(x,&n);CHKERRQ(ierr); h = ctx->h; c = ctx->kappa/(ctx->lambda-ctx->kappa); de = -2.0*h/3.0; /* diagonal entry */ oe = -h/6.0; /* offdiagonal entry */ py[0] = de*px[0] + oe*px[1]; for (i=1;iActual source code: ex20.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Simple 1-D nonlinear eigenproblem.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions.\n"
 25:   "  -draw_sol, to draw the computed solution.\n\n";

 27: /*
 28:    Solve 1-D PDE
 29:             -u'' = lambda*u
 30:    on [0,1] subject to
 31:             u(0)=0, u'(1)=u(1)*lambda*kappa/(kappa-lambda)
 32: */

 34: #include <slepcnep.h>

 36: /*
 37:    User-defined routines
 38: */
 39: PetscErrorCode FormInitialGuess(Vec);
 40: PetscErrorCode FormFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*);
 41: PetscErrorCode FormJacobian(NEP,PetscScalar,Mat*,MatStructure*,void*);
 42: PetscErrorCode CheckSolution(PetscScalar,Vec,PetscReal*,void*);
 43: PetscErrorCode FixSign(Vec);

 45: /*
 46:    User-defined application context
 47: */
 48: typedef struct {
 49:   PetscScalar kappa;   /* ratio between stiffness of spring and attached mass */
 50:   PetscReal   h;       /* mesh spacing */
 51: } ApplicationCtx;

 55: int main(int argc,char **argv)
 56: {
 57:   NEP            nep;             /* nonlinear eigensolver context */
 58:   Vec            x;               /* eigenvector */
 59:   PetscScalar    lambda;          /* eigenvalue */
 60:   Mat            F,J;             /* Function and Jacobian matrices */
 61:   ApplicationCtx ctx;             /* user-defined context */
 62:   NEPType        type;
 63:   PetscInt       n=128,nev,i,its,maxit,maxf,nconv;
 64:   PetscReal      re,im,abstol,rtol,stol,norm,error;
 65:   PetscBool      draw_sol;

 68:   SlepcInitialize(&argc,&argv,(char*)0,help);
 69:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 70:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Nonlinear Eigenproblem, n=%D\n\n",n);
 71:   ctx.h = 1.0/(PetscReal)n;
 72:   ctx.kappa = 1.0;
 73:   PetscOptionsHasName(NULL,"-draw_sol",&draw_sol);

 75:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 76:      Create nonlinear eigensolver context
 77:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 79:   NEPCreate(PETSC_COMM_WORLD,&nep);

 81:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 82:      Create matrix data structure; set Function evaluation routine
 83:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 85:   MatCreate(PETSC_COMM_WORLD,&F);
 86:   MatSetSizes(F,PETSC_DECIDE,PETSC_DECIDE,n,n);
 87:   MatSetFromOptions(F);
 88:   MatSeqAIJSetPreallocation(F,3,NULL);
 89:   MatMPIAIJSetPreallocation(F,3,NULL,1,NULL);
 90:   MatSetUp(F);

 92:   /*
 93:      Set Function matrix data structure and default Function evaluation
 94:      routine
 95:   */
 96:   NEPSetFunction(nep,F,F,FormFunction,&ctx);

 98:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 99:      Create matrix data structure; set Jacobian evaluation routine
100:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

102:   MatCreate(PETSC_COMM_WORLD,&J);
103:   MatSetSizes(J,PETSC_DECIDE,PETSC_DECIDE,n,n);
104:   MatSetFromOptions(J);
105:   MatSeqAIJSetPreallocation(J,3,NULL);
106:   MatMPIAIJSetPreallocation(F,3,NULL,1,NULL);
107:   MatSetUp(J);

109:   /*
110:      Set Jacobian matrix data structure and default Jacobian evaluation
111:      routine
112:   */
113:   NEPSetJacobian(nep,J,FormJacobian,&ctx);

115:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116:      Customize nonlinear solver; set runtime options
117:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

119:   NEPSetTolerances(nep,0,1e-9,0,0,0);
120:   NEPSetDimensions(nep,1,0,0);
121:   NEPSetLagPreconditioner(nep,0);

123:   /*
124:      Set solver parameters at runtime
125:   */
126:   NEPSetFromOptions(nep);

128:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
129:                       Initialize application
130:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

132:   /*
133:      Evaluate initial guess
134:   */
135:   MatGetVecs(F,&x,NULL);
136:   FormInitialGuess(x);
137:   NEPSetInitialSpace(nep,1,&x);

139:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
140:                       Solve the eigensystem
141:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

143:   NEPSolve(nep);
144:   NEPGetIterationNumber(nep,&its);
145:   PetscPrintf(PETSC_COMM_WORLD," Number of NEP iterations = %D\n\n",its);

147:   /*
148:      Optional: Get some information from the solver and display it
149:   */
150:   NEPGetType(nep,&type);
151:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n",type);
152:   NEPGetDimensions(nep,&nev,NULL,NULL);
153:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
154:   NEPGetTolerances(nep,&abstol,&rtol,&stol,&maxit,&maxf);
155:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: atol=%G, rtol=%G, stol=%G, maxit=%D, maxf=%D\n",abstol,rtol,stol,maxit,maxf);

157:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
158:                     Display solution and clean up
159:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

161:   /*
162:      Get number of converged approximate eigenpairs
163:   */
164:   NEPGetConverged(nep,&nconv);
165:   PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);

167:   if (nconv>0) {
168:     /*
169:        Display eigenvalues and relative errors
170:     */
171:     PetscPrintf(PETSC_COMM_WORLD,
172:          "           k              ||T(k)x||           error\n"
173:          "   ----------------- ------------------ ------------------\n");
174:     for (i=0;i<nconv;i++) {
175:       /*
176:         Get converged eigenpairs (in this example they are always real)
177:       */
178:       NEPGetEigenpair(nep,i,&lambda,x);
179:       FixSign(x);
180:       /*
181:          Compute residual norm and error
182:       */
183:       NEPComputeRelativeError(nep,i,&norm);
184:       CheckSolution(lambda,x,&error,&ctx);

186: #if defined(PETSC_USE_COMPLEX)
187:       re = PetscRealPart(lambda);
188:       im = PetscImaginaryPart(lambda);
189: #else
190:       re = lambda;
191:       im = 0.0;
192: #endif
193:       if (im!=0.0) {
194:         PetscPrintf(PETSC_COMM_WORLD," %9F%+9F j %12G     %12G\n",re,im,norm,error);
195:       } else {
196:         PetscPrintf(PETSC_COMM_WORLD,"   %12F         %12G     %12G\n",re,norm,error);
197:       }
198:       if (draw_sol) {
199:         PetscViewerDrawSetPause(PETSC_VIEWER_DRAW_WORLD,-1);
200:         VecView(x,PETSC_VIEWER_DRAW_WORLD);
201:       }
202:     }
203:     PetscPrintf(PETSC_COMM_WORLD,"\n");
204:   }

206:   NEPDestroy(&nep);
207:   MatDestroy(&F);
208:   MatDestroy(&J);
209:   VecDestroy(&x);
210:   SlepcFinalize();
211:   return 0;
212: }

214: /* ------------------------------------------------------------------- */
217: /*
218:    FormInitialGuess - Computes initial guess.

220:    Input/Output Parameter:
221: .  x - the solution vector
222: */
223: PetscErrorCode FormInitialGuess(Vec x)
224: {

228:   VecSet(x,1.0);
229:   return(0);
230: }

232: /* ------------------------------------------------------------------- */
235: /*
236:    FormFunction - Computes Function matrix  T(lambda)

238:    Input Parameters:
239: .  nep    - the NEP context
240: .  lambda - the scalar argument
241: .  ctx    - optional user-defined context, as set by NEPSetJacobian()

243:    Output Parameters:
244: .  fun - Function matrix
245: .  B   - optionally different preconditioning matrix
246: .  flg - flag indicating matrix structure
247: */
248: PetscErrorCode FormFunction(NEP nep,PetscScalar lambda,Mat *fun,Mat *B,MatStructure *flg,void *ctx)
249: {
251:   ApplicationCtx *user = (ApplicationCtx*)ctx;
252:   PetscScalar    A[3],c,d;
253:   PetscReal      h;
254:   PetscInt       i,n,j[3],Istart,Iend;
255:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

258:   /*
259:      Compute Function entries and insert into matrix
260:   */
261:   MatGetSize(*fun,&n,NULL);
262:   MatGetOwnershipRange(*fun,&Istart,&Iend);
263:   if (Istart==0) FirstBlock=PETSC_TRUE;
264:   if (Iend==n) LastBlock=PETSC_TRUE;
265:   h = user->h;
266:   c = user->kappa/(lambda-user->kappa);
267:   d = n;

269:   /*
270:      Interior grid points
271:   */
272:   for (i=(FirstBlock? Istart+1: Istart);i<(LastBlock? Iend-1: Iend);i++) {
273:     j[0] = i-1; j[1] = i; j[2] = i+1;
274:     A[0] = A[2] = -d-lambda*h/6.0; A[1] = 2.0*(d-lambda*h/3.0);
275:     MatSetValues(*fun,1,&i,3,j,A,INSERT_VALUES);
276:   }

278:   /*
279:      Boundary points
280:   */
281:   if (FirstBlock) {
282:     i = 0;
283:     j[0] = 0; j[1] = 1;
284:     A[0] = 2.0*(d-lambda*h/3.0); A[1] = -d-lambda*h/6.0;
285:     MatSetValues(*fun,1,&i,2,j,A,INSERT_VALUES);
286:   }

288:   if (LastBlock) {
289:     i = n-1;
290:     j[0] = n-2; j[1] = n-1;
291:     A[0] = -d-lambda*h/6.0; A[1] = d-lambda*h/3.0+lambda*c;
292:     MatSetValues(*fun,1,&i,2,j,A,INSERT_VALUES);
293:   }

295:   /*
296:      Assemble matrix
297:   */
298:   MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);
299:   MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);
300:   if (*fun != *B) {
301:     MatAssemblyBegin(*fun,MAT_FINAL_ASSEMBLY);
302:     MatAssemblyEnd(*fun,MAT_FINAL_ASSEMBLY);
303:   }
304:   return(0);
305: }

307: /* ------------------------------------------------------------------- */
310: /*
311:    FormJacobian - Computes Jacobian matrix  T'(lambda)

313:    Input Parameters:
314: .  nep    - the NEP context
315: .  lambda - the scalar argument
316: .  ctx    - optional user-defined context, as set by NEPSetJacobian()

318:    Output Parameters:
319: .  jac - Jacobian matrix
320: .  B   - optionally different preconditioning matrix
321: .  flg - flag indicating matrix structure
322: */
323: PetscErrorCode FormJacobian(NEP nep,PetscScalar lambda,Mat *jac,MatStructure *flg,void *ctx)
324: {
326:   ApplicationCtx *user = (ApplicationCtx*)ctx;
327:   PetscScalar    A[3],c;
328:   PetscReal      h;
329:   PetscInt       i,n,j[3],Istart,Iend;
330:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

333:   /*
334:      Compute Jacobian entries and insert into matrix
335:   */
336:   MatGetSize(*jac,&n,NULL);
337:   MatGetOwnershipRange(*jac,&Istart,&Iend);
338:   if (Istart==0) FirstBlock=PETSC_TRUE;
339:   if (Iend==n) LastBlock=PETSC_TRUE;
340:   h = user->h;
341:   c = user->kappa/(lambda-user->kappa);

343:   /*
344:      Interior grid points
345:   */
346:   for (i=(FirstBlock? Istart+1: Istart);i<(LastBlock? Iend-1: Iend);i++) {
347:     j[0] = i-1; j[1] = i; j[2] = i+1;
348:     A[0] = A[2] = -h/6.0; A[1] = -2.0*h/3.0;
349:     MatSetValues(*jac,1,&i,3,j,A,INSERT_VALUES);
350:   }

352:   /*
353:      Boundary points
354:   */
355:   if (FirstBlock) {
356:     i = 0;
357:     j[0] = 0; j[1] = 1;
358:     A[0] = -2.0*h/3.0; A[1] = -h/6.0;
359:     MatSetValues(*jac,1,&i,2,j,A,INSERT_VALUES);
360:   }

362:   if (LastBlock) {
363:     i = n-1;
364:     j[0] = n-2; j[1] = n-1;
365:     A[0] = -h/6.0; A[1] = -h/3.0-c*c;
366:     MatSetValues(*jac,1,&i,2,j,A,INSERT_VALUES);
367:   }

369:   /*
370:      Assemble matrix
371:   */
372:   MatAssemblyBegin(*jac,MAT_FINAL_ASSEMBLY);
373:   MatAssemblyEnd(*jac,MAT_FINAL_ASSEMBLY);
374:   return(0);
375: }

377: /* ------------------------------------------------------------------- */
380: /*
381:    CheckSolution - Given a computed solution (lambda,x) check if it
382:    satisfies the analytic solution.

384:    Input Parameters:
385: +  lambda - the computed eigenvalue
386: -  y      - the computed eigenvector

388:    Output Parameter:
389: .  error - norm of difference between the computed and exact eigenvector
390: */
391: PetscErrorCode CheckSolution(PetscScalar lambda,Vec y,PetscReal *error,void *ctx)
392: {
394:   PetscScalar    nu,*uu;
395:   PetscInt       i,n,Istart,Iend;
396:   PetscReal      x;
397:   Vec            u;
398:   ApplicationCtx *user = (ApplicationCtx*)ctx;

401:   nu = PetscSqrtScalar(lambda);
402:   VecDuplicate(y,&u);
403:   VecGetSize(u,&n);
404:   VecGetOwnershipRange(y,&Istart,&Iend);
405:   VecGetArray(u,&uu);
406:   for (i=Istart;i<Iend;i++) {
407:     x = (i+1)*user->h;
408:     uu[i-Istart] = sin(nu*x);
409:   }
410:   VecRestoreArray(u,&uu);
411:   VecNormalize(u,NULL);
412:   VecAXPY(u,-1.0,y);
413:   VecNorm(u,NORM_2,error);
414:   VecDestroy(&u);
415:   return(0);
416: }

418: /* ------------------------------------------------------------------- */
421: /*
422:    FixSign - Force the eigenfunction to be real and positive, since
423:    some eigensolvers may return the eigenvector multiplied by a
424:    complex number of modulus one.

426:    Input/Output Parameter:
427: .  x - the computed vector
428: */
429: PetscErrorCode FixSign(Vec x)
430: {
432:   PetscMPIInt    rank;
433:   PetscScalar    sign,*xx;

436:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
437:   if (!rank) {
438:     VecGetArray(x,&xx);
439:     sign = *xx/PetscAbsScalar(*xx);
440:     VecRestoreArray(x,&xx);
441:   }
442:   MPI_Bcast(&sign,1,MPIU_SCALAR,0,PETSC_COMM_WORLD);
443:   VecScale(x,1.0/sign);
444:   return(0);
445: }

slepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/makefile0000644000175000017500000000436512211062077022360 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/nep/examples/tutorials/ EXAMPLESC = ex20.c ex21.c ex22.c EXAMPLESF = MANSEC = NEP TESTEXAMPLES_C = ex20.PETSc runex20_1 ex20.rm \ ex21.PETSc runex21_1 ex21.rm \ ex22.PETSc runex22_1 ex22.rm TESTEXAMPLES_C_NOCOMPLEX = TESTEXAMPLES_F90 = include ${SLEPC_DIR}/conf/slepc_common ex20: ex20.o chkopts -${CLINKER} -o ex20 ex20.o ${SLEPC_LIB} ${RM} ex20.o ex21: ex21.o chkopts -${CLINKER} -o ex21 ex21.o ${SLEPC_LIB} ${RM} ex21.o ex22: ex22.o chkopts -${CLINKER} -o ex22 ex22.o ${SLEPC_LIB} ${RM} ex22.o #------------------------------------------------------------------------------------ runex20_1: -@${MPIEXEC} -np 1 ./ex20 > ex20_1.tmp 2>&1; \ if (${DIFF} output/ex20_1.out ex20_1.tmp) then true; \ else echo "Possible problem with ex20_1, diffs above"; fi; \ ${RM} -f ex20_1.tmp runex21_1: -@${MPIEXEC} -np 1 ./ex21 > ex21_1.tmp 2>&1; \ if (${DIFF} output/ex21_1.out ex21_1.tmp) then true; \ else echo "Possible problem with ex21_1, diffs above"; fi; \ ${RM} -f ex21_1.tmp runex22_1: -@${MPIEXEC} -np 1 ./ex22 > ex22_1.tmp 2>&1; \ if (${DIFF} output/ex22_1.out ex22_1.tmp) then true; \ else echo "Possible problem with ex22_1, diffs above"; fi; \ ${RM} -f ex22_1.tmp slepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/ex22.c.html0000644000175000017500000004472612211062077022554 0ustar gladkgladk
Actual source code: ex22.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Delay differential equation.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions.\n"
 25:   "  -tau <tau>, where <tau> is the delay parameter.\n\n";

 27: /*
 28:    Solve parabolic partial differential equation with time delay tau

 30:             u_t = u_xx + a*u(t) + b*u(t-tau)
 31:             u(0,t) = u(pi,t) = 0

 33:    with a = 20 and b(x) = -4.1+x*(1-exp(x-pi)).

 35:    Discretization leads to a DDE of dimension n

 37:             -u' = A*u(t) + B*u(t-tau)

 39:    which results in the nonlinear eigenproblem

 41:             (-lambda*I + A + exp(-tau*lambda)*B)*u = 0
 42: */

 44: #include <slepcnep.h>

 48: int main(int argc,char **argv)
 49: {
 50:   NEP            nep;             /* nonlinear eigensolver context */
 51:   PetscScalar    lambda;          /* eigenvalue */
 52:   Mat            Id,A,B;          /* problem matrices */
 53:   FN             f1,f2,f3;        /* functions to define the nonlinear operator */
 54:   Mat            mats[3];
 55:   FN             funs[3];
 56:   NEPType        type;
 57:   PetscScalar    value[3],coeffs[2],b;
 58:   PetscInt       n=128,nev,Istart,Iend,col[3],i,its,nconv;
 59:   PetscReal      tau=0.001,h,a=20,xi,re,im,norm;
 60:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

 63:   SlepcInitialize(&argc,&argv,(char*)0,help);
 64:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 65:   PetscOptionsGetReal(NULL,"-tau",&tau,NULL);
 66:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Delay Eigenproblem, n=%D, tau=%G\n\n",n,tau);
 67:   h = PETSC_PI/(PetscReal)(n+1);

 69:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 70:      Create nonlinear eigensolver context
 71:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 73:   NEPCreate(PETSC_COMM_WORLD,&nep);

 75:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 76:      Create problem matrices and coefficient functions. Pass them to NEP
 77:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 79:   /*
 80:      Identity matrix
 81:   */
 82:   MatCreate(PETSC_COMM_WORLD,&Id);
 83:   MatSetSizes(Id,PETSC_DECIDE,PETSC_DECIDE,n,n);
 84:   MatSetFromOptions(Id);
 85:   MatSetUp(Id);
 86:   MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);
 87:   MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);
 88:   MatShift(Id,1.0);
 89:   MatSetOption(Id,MAT_HERMITIAN,PETSC_TRUE);

 91:   /*
 92:      A = 1/h^2*tridiag(1,-2,1) + a*I
 93:   */
 94:   MatCreate(PETSC_COMM_WORLD,&A);
 95:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 96:   MatSetFromOptions(A);
 97:   MatSetUp(A);
 98:   MatGetOwnershipRange(A,&Istart,&Iend);
 99:   if (Istart==0) FirstBlock=PETSC_TRUE;
100:   if (Iend==n) LastBlock=PETSC_TRUE;
101:   value[0]=1.0/(h*h); value[1]=-2.0/(h*h)+a; value[2]=1.0/(h*h);
102:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
103:     col[0]=i-1; col[1]=i; col[2]=i+1;
104:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
105:   }
106:   if (LastBlock) {
107:     i=n-1; col[0]=n-2; col[1]=n-1;
108:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
109:   }
110:   if (FirstBlock) {
111:     i=0; col[0]=0; col[1]=1; value[0]=-2.0/(h*h)+a; value[1]=1.0/(h*h);
112:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
113:   }
114:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
115:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
116:   MatSetOption(A,MAT_HERMITIAN,PETSC_TRUE);

118:   /*
119:      B = diag(b(xi))
120:   */
121:   MatCreate(PETSC_COMM_WORLD,&B);
122:   MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,n,n);
123:   MatSetFromOptions(B);
124:   MatSetUp(B);
125:   MatGetOwnershipRange(B,&Istart,&Iend);
126:   for (i=Istart;i<Iend;i++) {
127:     xi = (i+1)*h;
128:     b = -4.1+xi*(1.0-PetscExpReal(xi-PETSC_PI));
129:     MatSetValues(B,1,&i,1,&i,&b,INSERT_VALUES);
130:   }
131:   MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);
132:   MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);
133:   MatSetOption(B,MAT_HERMITIAN,PETSC_TRUE);

135:   /*
136:      Functions: f1=-lambda, f2=1.0, f3=exp(-tau*lambda)
137:   */
138:   FNCreate(PETSC_COMM_WORLD,&f1);
139:   FNSetType(f1,FNRATIONAL);
140:   coeffs[0] = -1.0; coeffs[1] = 0.0;
141:   FNSetParameters(f1,2,coeffs,0,NULL);

143:   FNCreate(PETSC_COMM_WORLD,&f2);
144:   FNSetType(f2,FNRATIONAL);
145:   coeffs[0] = 1.0;
146:   FNSetParameters(f2,1,coeffs,0,NULL);

148:   FNCreate(PETSC_COMM_WORLD,&f3);
149:   FNSetType(f3,FNEXP);
150:   coeffs[0] = -tau;
151:   FNSetParameters(f3,1,coeffs,0,NULL);

153:   /*
154:      Set the split operator. Note that A is passed first so that
155:      SUBSET_NONZERO_PATTERN can be used
156:   */
157:   mats[0] = A;  funs[0] = f2;
158:   mats[1] = Id; funs[1] = f1;
159:   mats[2] = B;  funs[2] = f3;
160:   NEPSetSplitOperator(nep,3,mats,funs,SUBSET_NONZERO_PATTERN);

162:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
163:              Customize nonlinear solver; set runtime options
164:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

166:   NEPSetTolerances(nep,0,1e-9,0,0,0);
167:   NEPSetDimensions(nep,1,0,0);
168:   NEPSetLagPreconditioner(nep,0);

170:   /*
171:      Set solver parameters at runtime
172:   */
173:   NEPSetFromOptions(nep);

175:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
176:                       Solve the eigensystem
177:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

179:   NEPSolve(nep);
180:   NEPGetIterationNumber(nep,&its);
181:   PetscPrintf(PETSC_COMM_WORLD," Number of NEP iterations = %D\n\n",its);

183:   /*
184:      Optional: Get some information from the solver and display it
185:   */
186:   NEPGetType(nep,&type);
187:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n",type);
188:   NEPGetDimensions(nep,&nev,NULL,NULL);
189:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

191:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
192:                     Display solution and clean up
193:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

195:   /*
196:      Get number of converged approximate eigenpairs
197:   */
198:   NEPGetConverged(nep,&nconv);
199:   PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);

201:   if (nconv>0) {
202:     /*
203:        Display eigenvalues and relative errors
204:     */
205:     PetscPrintf(PETSC_COMM_WORLD,
206:          "           k              ||T(k)x||\n"
207:          "   ----------------- ------------------\n");
208:     for (i=0;i<nconv;i++) {
209:       NEPGetEigenpair(nep,i,&lambda,NULL);
210:       NEPComputeRelativeError(nep,i,&norm);
211: #if defined(PETSC_USE_COMPLEX)
212:       re = PetscRealPart(lambda);
213:       im = PetscImaginaryPart(lambda);
214: #else
215:       re = lambda;
216:       im = 0.0;
217: #endif
218:       if (im!=0.0) {
219:         PetscPrintf(PETSC_COMM_WORLD," %9F%+9F j %12G\n",re,im,norm);
220:       } else {
221:         PetscPrintf(PETSC_COMM_WORLD,"   %12F         %12G\n",re,norm);
222:       }
223:     }
224:     PetscPrintf(PETSC_COMM_WORLD,"\n");
225:   }

227:   NEPDestroy(&nep);
228:   MatDestroy(&Id);
229:   MatDestroy(&A);
230:   MatDestroy(&B);
231:   FNDestroy(&f1);
232:   FNDestroy(&f2);
233:   FNDestroy(&f3);
234:   SlepcFinalize();
235:   return 0;
236: }

slepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/makefile.html0000644000175000017500000000722712211062077023323 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/nep/examples/tutorials/
EXAMPLESC  = ex20.c ex21.c ex22.c
EXAMPLESF  =
MANSEC     = NEP

TESTEXAMPLES_C           = ex20.PETSc runex20_1 ex20.rm \
                           ex21.PETSc runex21_1 ex21.rm \
                           ex22.PETSc runex22_1 ex22.rm
TESTEXAMPLES_C_NOCOMPLEX =
TESTEXAMPLES_F90         =

include ${SLEPC_DIR}/conf/slepc_common

ex20: ex20.o chkopts
	-${CLINKER} -o ex20 ex20.o ${SLEPC_LIB}
	${RM} ex20.o

ex21: ex21.o chkopts
	-${CLINKER} -o ex21 ex21.o ${SLEPC_LIB}
	${RM} ex21.o

ex22: ex22.o chkopts
	-${CLINKER} -o ex22 ex22.o ${SLEPC_LIB}
	${RM} ex22.o

#------------------------------------------------------------------------------------

runex20_1:
	-@${MPIEXEC} -np 1 ./ex20 > ex20_1.tmp 2>&1; \
	   if (${DIFF} output/ex20_1.out ex20_1.tmp) then true; \
	   else echo "Possible problem with ex20_1, diffs above"; fi; \
	   ${RM} -f ex20_1.tmp

runex21_1:
	-@${MPIEXEC} -np 1 ./ex21 > ex21_1.tmp 2>&1; \
	   if (${DIFF} output/ex21_1.out ex21_1.tmp) then true; \
	   else echo "Possible problem with ex21_1, diffs above"; fi; \
	   ${RM} -f ex21_1.tmp

runex22_1:
	-@${MPIEXEC} -np 1 ./ex22 > ex22_1.tmp 2>&1; \
	   if (${DIFF} output/ex22_1.out ex22_1.tmp) then true; \
	   else echo "Possible problem with ex22_1, diffs above"; fi; \
	   ${RM} -f ex22_1.tmp

slepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/index.html0000644000175000017500000000237512211062077022654 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

ex20.c: Simple 1-D nonlinear eigenproblem
ex21.c: Simple 1-D nonlinear eigenproblem (matrix-free version, sequential)
ex22.c: Delay differential equation
makefile
slepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/ex21.c.html0000644000175000017500000007072412211062077022550 0ustar gladkgladk

Actual source code: ex21.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Simple 1-D nonlinear eigenproblem (matrix-free version, sequential).\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions\n\n";

 26: /*
 27:    Solve 1-D PDE
 28:             -u'' = lambda*u
 29:    on [0,1] subject to
 30:             u(0)=0, u'(1)=u(1)*lambda*kappa/(kappa-lambda)
 31: */

 33: #include <slepcnep.h>

 35: /*
 36:    User-defined routines
 37: */
 38: PetscErrorCode FormInitialGuess(Vec);
 39: PetscErrorCode FormFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*);
 40: PetscErrorCode FormJacobian(NEP,PetscScalar,Mat*,MatStructure*,void*);

 42: /*
 43:    Matrix operations and context
 44: */
 45: PetscErrorCode MatMult_Fun(Mat,Vec,Vec);
 46: PetscErrorCode MatGetDiagonal_Fun(Mat,Vec);
 47: PetscErrorCode MatDestroy_Fun(Mat);
 48: PetscErrorCode MatDuplicate_Fun(Mat,MatDuplicateOption,Mat*);
 49: PetscErrorCode MatMult_Jac(Mat,Vec,Vec);
 50: PetscErrorCode MatDestroy_Jac(Mat);

 52: typedef struct {
 53:   PetscScalar lambda,kappa;
 54:   PetscReal   h;
 55: } MatCtx;

 57: /*
 58:    User-defined application context
 59: */
 60: typedef struct {
 61:   PetscScalar kappa;   /* ratio between stiffness of spring and attached mass */
 62:   PetscReal   h;       /* mesh spacing */
 63: } ApplicationCtx;

 67: int main(int argc,char **argv)
 68: {
 69:   NEP            nep;             /* nonlinear eigensolver context */
 70:   PetscScalar    lambda;          /* eigenvalue */
 71:   Mat            F,J;             /* Function and Jacobian matrices */
 72:   ApplicationCtx ctx;             /* user-defined context */
 73:   MatCtx         *ctxF,*ctxJ;     /* contexts for shell matrices */
 74:   NEPType        type;
 75:   PetscInt       n=128,nev,i,its,nconv;
 76:   KSP            ksp;
 77:   PC             pc;
 78:   PetscMPIInt    size;
 79:   PetscReal      re,im,norm;

 82:   SlepcInitialize(&argc,&argv,(char*)0,help);
 83:   MPI_Comm_size(PETSC_COMM_WORLD,&size);
 84:   if (size != 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"This is a uniprocessor example only!");
 85:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 86:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Nonlinear Eigenproblem, n=%D\n\n",n);
 87:   ctx.h = 1.0/(PetscReal)n;
 88:   ctx.kappa = 1.0;

 90:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 91:      Create nonlinear eigensolver context
 92:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 94:   NEPCreate(PETSC_COMM_WORLD,&nep);

 96:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 97:      Create matrix data structure; set Function evaluation routine
 98:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

100:   PetscNew(MatCtx,&ctxF);
101:   ctxF->h = ctx.h;
102:   ctxF->kappa = ctx.kappa;

104:   MatCreateShell(PETSC_COMM_WORLD,n,n,n,n,(void*)ctxF,&F);
105:   MatShellSetOperation(F,MATOP_MULT,(void(*)())MatMult_Fun);
106:   MatShellSetOperation(F,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Fun);
107:   MatShellSetOperation(F,MATOP_DESTROY,(void(*)())MatDestroy_Fun);
108:   MatShellSetOperation(F,MATOP_DUPLICATE,(void(*)())MatDuplicate_Fun);

110:   /*
111:      Set Function matrix data structure and default Function evaluation
112:      routine
113:   */
114:   NEPSetFunction(nep,F,F,FormFunction,NULL);

116:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117:      Create matrix data structure; set Jacobian evaluation routine
118:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

120:   PetscNew(MatCtx,&ctxJ);
121:   ctxJ->h = ctx.h;
122:   ctxJ->kappa = ctx.kappa;

124:   MatCreateShell(PETSC_COMM_WORLD,n,n,n,n,(void*)ctxJ,&J);
125:   MatShellSetOperation(J,MATOP_MULT,(void(*)())MatMult_Jac);
126:   MatShellSetOperation(J,MATOP_DESTROY,(void(*)())MatDestroy_Jac);

128:   /*
129:      Set Jacobian matrix data structure and default Jacobian evaluation
130:      routine
131:   */
132:   NEPSetJacobian(nep,J,FormJacobian,NULL);

134:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135:      Customize nonlinear solver; set runtime options
136:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

138:   NEPGetKSP(nep,&ksp);
139:   KSPSetType(ksp,KSPBCGS);
140:   KSPGetPC(ksp,&pc);
141:   PCSetType(pc,PCJACOBI);

143:   /*
144:      Set solver parameters at runtime
145:   */
146:   NEPSetFromOptions(nep);

148:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
149:                       Solve the eigensystem
150:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

152:   NEPSolve(nep);
153:   NEPGetIterationNumber(nep,&its);
154:   PetscPrintf(PETSC_COMM_WORLD," Number of NEP iterations = %D\n\n",its);

156:   /*
157:      Optional: Get some information from the solver and display it
158:   */
159:   NEPGetType(nep,&type);
160:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n",type);
161:   NEPGetDimensions(nep,&nev,NULL,NULL);
162:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

164:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
165:                     Display solution and clean up
166:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

168:   /*
169:      Get number of converged approximate eigenpairs
170:   */
171:   NEPGetConverged(nep,&nconv);
172:   PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);

174:   if (nconv>0) {
175:     /*
176:        Display eigenvalues and relative errors
177:     */
178:     PetscPrintf(PETSC_COMM_WORLD,
179:          "           k              ||T(k)x||\n"
180:          "   ----------------- ------------------\n");
181:     for (i=0;i<nconv;i++) {
182:       /*
183:         Get converged eigenpairs (in this example they are always real)
184:       */
185:       NEPGetEigenpair(nep,i,&lambda,NULL);
186:       /*
187:          Compute residual norm
188:       */
189:       NEPComputeRelativeError(nep,i,&norm);

191: #if defined(PETSC_USE_COMPLEX)
192:       re = PetscRealPart(lambda);
193:       im = PetscImaginaryPart(lambda);
194: #else
195:       re = lambda;
196:       im = 0.0;
197: #endif
198:       if (im!=0.0) {
199:         PetscPrintf(PETSC_COMM_WORLD," %9F%+9F j %12G\n",re,im,norm);
200:       } else {
201:         PetscPrintf(PETSC_COMM_WORLD,"   %12F         %12G\n",re,norm);
202:       }
203:     }
204:     PetscPrintf(PETSC_COMM_WORLD,"\n");
205:   }

207:   NEPDestroy(&nep);
208:   MatDestroy(&F);
209:   MatDestroy(&J);
210:   SlepcFinalize();
211:   return 0;
212: }

214: /* ------------------------------------------------------------------- */
217: /*
218:    FormInitialGuess - Computes initial guess.

220:    Input/Output Parameter:
221: .  x - the solution vector
222: */
223: PetscErrorCode FormInitialGuess(Vec x)
224: {

228:   VecSet(x,1.0);
229:   return(0);
230: }

232: /* ------------------------------------------------------------------- */
235: /*
236:    FormFunction - Computes Function matrix  T(lambda)

238:    Input Parameters:
239: .  nep    - the NEP context
240: .  lambda - real part of the scalar argument
241: .  ctx    - optional user-defined context, as set by NEPSetJacobian()

243:    Output Parameters:
244: .  fun - Function matrix
245: .  B   - optionally different preconditioning matrix
246: .  flg - flag indicating matrix structure
247: */
248: PetscErrorCode FormFunction(NEP nep,PetscScalar lambda,Mat *fun,Mat *B,MatStructure *flg,void *ctx)
249: {
251:   MatCtx         *ctxF;

254:   MatShellGetContext(*fun,(void**)&ctxF);
255:   ctxF->lambda = lambda;
256:   return(0);
257: }

259: /* ------------------------------------------------------------------- */
262: /*
263:    FormJacobian - Computes Jacobian matrix  T'(lambda)

265:    Input Parameters:
266: .  nep    - the NEP context
267: .  lambda - real part of the scalar argument
268: .  ctx    - optional user-defined context, as set by NEPSetJacobian()

270:    Output Parameters:
271: .  jac - Jacobian matrix
272: .  B   - optionally different preconditioning matrix
273: .  flg - flag indicating matrix structure
274: */
275: PetscErrorCode FormJacobian(NEP nep,PetscScalar lambda,Mat *jac,MatStructure *flg,void *ctx)
276: {
278:   MatCtx         *ctxJ;

281:   MatShellGetContext(*jac,(void**)&ctxJ);
282:   ctxJ->lambda = lambda;
283:   return(0);
284: }

286: /* ------------------------------------------------------------------- */
289: PetscErrorCode MatMult_Fun(Mat A,Vec x,Vec y)
290: {
291:   PetscErrorCode    ierr;
292:   MatCtx            *ctx;
293:   PetscInt          i,n;
294:   const PetscScalar *px;
295:   PetscScalar       *py,c,d,de,oe;
296:   PetscReal         h;

299:   MatShellGetContext(A,(void**)&ctx);
300:   VecGetArrayRead(x,&px);
301:   VecGetArray(y,&py);

303:   VecGetSize(x,&n);
304:   h = ctx->h;
305:   c = ctx->kappa/(ctx->lambda-ctx->kappa);
306:   d = n;
307:   de = 2.0*(d-ctx->lambda*h/3.0);   /* diagonal entry */
308:   oe = -d-ctx->lambda*h/6.0;        /* offdiagonal entry */
309:   py[0] = de*px[0] + oe*px[1];
310:   for (i=1;i<n-1;i++) py[i] = oe*px[i-1] +de*px[i] + oe*px[i+1];
311:   de = d-ctx->lambda*h/3.0+ctx->lambda*c;   /* diagonal entry of last row */
312:   py[n-1] = oe*px[n-2] + de*px[n-1];

314:   VecRestoreArrayRead(x,&px);
315:   VecRestoreArray(y,&py);
316:   return(0);
317: }

319: /* ------------------------------------------------------------------- */
322: PetscErrorCode MatGetDiagonal_Fun(Mat A,Vec diag)
323: {
324:   PetscErrorCode    ierr;
325:   MatCtx            *ctx;
326:   PetscInt          n;
327:   PetscScalar       *pd,c,d;
328:   PetscReal         h;

331:   MatShellGetContext(A,(void**)&ctx);
332:   h = ctx->h;
333:   c = ctx->kappa/(ctx->lambda-ctx->kappa);
334:   d = n;
335:   VecSet(diag,2.0*(d-ctx->lambda*h/3.0));
336:   VecGetSize(diag,&n);
337:   VecGetArray(diag,&pd);
338:   pd[n-1] = d-ctx->lambda*h/3.0+ctx->lambda*c;
339:   VecRestoreArray(diag,&pd);
340:   return(0);
341: }

343: /* ------------------------------------------------------------------- */
346: PetscErrorCode MatDestroy_Fun(Mat A)
347: {
348:   MatCtx         *ctx;

352:   MatShellGetContext(A,(void**)&ctx);
353:   PetscFree(ctx);
354:   return(0);
355: }

357: /* ------------------------------------------------------------------- */
360: PetscErrorCode MatDuplicate_Fun(Mat A,MatDuplicateOption op,Mat *B)
361: {
362:   MatCtx         *actx,*bctx;
363:   PetscInt       n;
364:   MPI_Comm       comm;

368:   MatShellGetContext(A,(void**)&actx);
369:   MatGetSize(A,&n,NULL);

371:   PetscNew(MatCtx,&bctx);
372:   bctx->h      = actx->h;
373:   bctx->kappa  = actx->kappa;
374:   bctx->lambda = actx->lambda;

376:   PetscObjectGetComm((PetscObject)A,&comm);
377:   MatCreateShell(comm,n,n,n,n,(void*)bctx,B);
378:   MatShellSetOperation(*B,MATOP_MULT,(void(*)())MatMult_Fun);
379:   MatShellSetOperation(*B,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Fun);
380:   MatShellSetOperation(*B,MATOP_DESTROY,(void(*)())MatDestroy_Fun);
381:   MatShellSetOperation(*B,MATOP_DUPLICATE,(void(*)())MatDuplicate_Fun);
382:   return(0);
383: }

385: /* ------------------------------------------------------------------- */
388: PetscErrorCode MatMult_Jac(Mat A,Vec x,Vec y)
389: {
390:   PetscErrorCode    ierr;
391:   MatCtx            *ctx;
392:   PetscInt          i,n;
393:   const PetscScalar *px;
394:   PetscScalar       *py,c,de,oe;
395:   PetscReal         h;

398:   MatShellGetContext(A,(void**)&ctx);
399:   VecGetArrayRead(x,&px);
400:   VecGetArray(y,&py);

402:   VecGetSize(x,&n);
403:   h = ctx->h;
404:   c = ctx->kappa/(ctx->lambda-ctx->kappa);
405:   de = -2.0*h/3.0;    /* diagonal entry */
406:   oe = -h/6.0;        /* offdiagonal entry */
407:   py[0] = de*px[0] + oe*px[1];
408:   for (i=1;i<n-1;i++) py[i] = oe*px[i-1] +de*px[i] + oe*px[i+1];
409:   de = -h/3.0-c*c;    /* diagonal entry of last row */
410:   py[n-1] = oe*px[n-2] + de*px[n-1];

412:   VecRestoreArrayRead(x,&px);
413:   VecRestoreArray(y,&py);
414:   return(0);
415: }

417: /* ------------------------------------------------------------------- */
420: PetscErrorCode MatDestroy_Jac(Mat A)
421: {
422:   MatCtx         *ctx;

426:   MatShellGetContext(A,(void**)&ctx);
427:   PetscFree(ctx);
428:   return(0);
429: }

slepc-3.4.2.dfsg.orig/src/nep/examples/tutorials/ex22.c0000644000175000017500000002144612211062077021603 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Delay differential equation.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions.\n" " -tau , where is the delay parameter.\n\n"; /* Solve parabolic partial differential equation with time delay tau u_t = u_xx + a*u(t) + b*u(t-tau) u(0,t) = u(pi,t) = 0 with a = 20 and b(x) = -4.1+x*(1-exp(x-pi)). Discretization leads to a DDE of dimension n -u' = A*u(t) + B*u(t-tau) which results in the nonlinear eigenproblem (-lambda*I + A + exp(-tau*lambda)*B)*u = 0 */ #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { NEP nep; /* nonlinear eigensolver context */ PetscScalar lambda; /* eigenvalue */ Mat Id,A,B; /* problem matrices */ FN f1,f2,f3; /* functions to define the nonlinear operator */ Mat mats[3]; FN funs[3]; NEPType type; PetscScalar value[3],coeffs[2],b; PetscInt n=128,nev,Istart,Iend,col[3],i,its,nconv; PetscReal tau=0.001,h,a=20,xi,re,im,norm; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,"-tau",&tau,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Delay Eigenproblem, n=%D, tau=%G\n\n",n,tau);CHKERRQ(ierr); h = PETSC_PI/(PetscReal)(n+1); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create nonlinear eigensolver context - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPCreate(PETSC_COMM_WORLD,&nep);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create problem matrices and coefficient functions. Pass them to NEP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Identity matrix */ ierr = MatCreate(PETSC_COMM_WORLD,&Id);CHKERRQ(ierr); ierr = MatSetSizes(Id,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(Id);CHKERRQ(ierr); ierr = MatSetUp(Id);CHKERRQ(ierr); ierr = MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatShift(Id,1.0);CHKERRQ(ierr); ierr = MatSetOption(Id,MAT_HERMITIAN,PETSC_TRUE);CHKERRQ(ierr); /* A = 1/h^2*tridiag(1,-2,1) + a*I */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=1.0/(h*h); value[1]=-2.0/(h*h)+a; value[2]=1.0/(h*h); for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=-2.0/(h*h)+a; value[1]=1.0/(h*h); ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatSetOption(A,MAT_HERMITIAN,PETSC_TRUE);CHKERRQ(ierr); /* B = diag(b(xi)) */ ierr = MatCreate(PETSC_COMM_WORLD,&B);CHKERRQ(ierr); ierr = MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(B);CHKERRQ(ierr); ierr = MatSetUp(B);CHKERRQ(ierr); ierr = MatGetOwnershipRange(B,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i0) { /* Display eigenvalues and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " k ||T(k)x||\n" " ----------------- ------------------\n");CHKERRQ(ierr); for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Simple 1-D nonlinear eigenproblem.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions.\n" " -draw_sol, to draw the computed solution.\n\n"; /* Solve 1-D PDE -u'' = lambda*u on [0,1] subject to u(0)=0, u'(1)=u(1)*lambda*kappa/(kappa-lambda) */ #include /* User-defined routines */ PetscErrorCode FormInitialGuess(Vec); PetscErrorCode FormFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*); PetscErrorCode FormJacobian(NEP,PetscScalar,Mat*,MatStructure*,void*); PetscErrorCode CheckSolution(PetscScalar,Vec,PetscReal*,void*); PetscErrorCode FixSign(Vec); /* User-defined application context */ typedef struct { PetscScalar kappa; /* ratio between stiffness of spring and attached mass */ PetscReal h; /* mesh spacing */ } ApplicationCtx; #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { NEP nep; /* nonlinear eigensolver context */ Vec x; /* eigenvector */ PetscScalar lambda; /* eigenvalue */ Mat F,J; /* Function and Jacobian matrices */ ApplicationCtx ctx; /* user-defined context */ NEPType type; PetscInt n=128,nev,i,its,maxit,maxf,nconv; PetscReal re,im,abstol,rtol,stol,norm,error; PetscBool draw_sol; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Nonlinear Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); ctx.h = 1.0/(PetscReal)n; ctx.kappa = 1.0; ierr = PetscOptionsHasName(NULL,"-draw_sol",&draw_sol);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create nonlinear eigensolver context - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPCreate(PETSC_COMM_WORLD,&nep);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create matrix data structure; set Function evaluation routine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&F);CHKERRQ(ierr); ierr = MatSetSizes(F,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(F);CHKERRQ(ierr); ierr = MatSeqAIJSetPreallocation(F,3,NULL);CHKERRQ(ierr); ierr = MatMPIAIJSetPreallocation(F,3,NULL,1,NULL);CHKERRQ(ierr); ierr = MatSetUp(F);CHKERRQ(ierr); /* Set Function matrix data structure and default Function evaluation routine */ ierr = NEPSetFunction(nep,F,F,FormFunction,&ctx);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create matrix data structure; set Jacobian evaluation routine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&J);CHKERRQ(ierr); ierr = MatSetSizes(J,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(J);CHKERRQ(ierr); ierr = MatSeqAIJSetPreallocation(J,3,NULL);CHKERRQ(ierr); ierr = MatMPIAIJSetPreallocation(F,3,NULL,1,NULL);CHKERRQ(ierr); ierr = MatSetUp(J);CHKERRQ(ierr); /* Set Jacobian matrix data structure and default Jacobian evaluation routine */ ierr = NEPSetJacobian(nep,J,FormJacobian,&ctx);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Customize nonlinear solver; set runtime options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPSetTolerances(nep,0,1e-9,0,0,0);CHKERRQ(ierr); ierr = NEPSetDimensions(nep,1,0,0);CHKERRQ(ierr); ierr = NEPSetLagPreconditioner(nep,0);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = NEPSetFromOptions(nep);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Initialize application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Evaluate initial guess */ ierr = MatGetVecs(F,&x,NULL);CHKERRQ(ierr); ierr = FormInitialGuess(x);CHKERRQ(ierr); ierr = NEPSetInitialSpace(nep,1,&x);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = NEPSolve(nep);CHKERRQ(ierr); ierr = NEPGetIterationNumber(nep,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of NEP iterations = %D\n\n",its);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = NEPGetType(nep,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n",type);CHKERRQ(ierr); ierr = NEPGetDimensions(nep,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); ierr = NEPGetTolerances(nep,&abstol,&rtol,&stol,&maxit,&maxf);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: atol=%G, rtol=%G, stol=%G, maxit=%D, maxf=%D\n",abstol,rtol,stol,maxit,maxf);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Get number of converged approximate eigenpairs */ ierr = NEPGetConverged(nep,&nconv);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);CHKERRQ(ierr); if (nconv>0) { /* Display eigenvalues and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " k ||T(k)x|| error\n" " ----------------- ------------------ ------------------\n");CHKERRQ(ierr); for (i=0;ih; c = user->kappa/(lambda-user->kappa); d = n; /* Interior grid points */ for (i=(FirstBlock? Istart+1: Istart);i<(LastBlock? Iend-1: Iend);i++) { j[0] = i-1; j[1] = i; j[2] = i+1; A[0] = A[2] = -d-lambda*h/6.0; A[1] = 2.0*(d-lambda*h/3.0); ierr = MatSetValues(*fun,1,&i,3,j,A,INSERT_VALUES);CHKERRQ(ierr); } /* Boundary points */ if (FirstBlock) { i = 0; j[0] = 0; j[1] = 1; A[0] = 2.0*(d-lambda*h/3.0); A[1] = -d-lambda*h/6.0; ierr = MatSetValues(*fun,1,&i,2,j,A,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i = n-1; j[0] = n-2; j[1] = n-1; A[0] = -d-lambda*h/6.0; A[1] = d-lambda*h/3.0+lambda*c; ierr = MatSetValues(*fun,1,&i,2,j,A,INSERT_VALUES);CHKERRQ(ierr); } /* Assemble matrix */ ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); if (*fun != *B) { ierr = MatAssemblyBegin(*fun,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(*fun,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); } PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "FormJacobian" /* FormJacobian - Computes Jacobian matrix T'(lambda) Input Parameters: . nep - the NEP context . lambda - the scalar argument . ctx - optional user-defined context, as set by NEPSetJacobian() Output Parameters: . jac - Jacobian matrix . B - optionally different preconditioning matrix . flg - flag indicating matrix structure */ PetscErrorCode FormJacobian(NEP nep,PetscScalar lambda,Mat *jac,MatStructure *flg,void *ctx) { PetscErrorCode ierr; ApplicationCtx *user = (ApplicationCtx*)ctx; PetscScalar A[3],c; PetscReal h; PetscInt i,n,j[3],Istart,Iend; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscFunctionBeginUser; /* Compute Jacobian entries and insert into matrix */ ierr = MatGetSize(*jac,&n,NULL);CHKERRQ(ierr); ierr = MatGetOwnershipRange(*jac,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; h = user->h; c = user->kappa/(lambda-user->kappa); /* Interior grid points */ for (i=(FirstBlock? Istart+1: Istart);i<(LastBlock? Iend-1: Iend);i++) { j[0] = i-1; j[1] = i; j[2] = i+1; A[0] = A[2] = -h/6.0; A[1] = -2.0*h/3.0; ierr = MatSetValues(*jac,1,&i,3,j,A,INSERT_VALUES);CHKERRQ(ierr); } /* Boundary points */ if (FirstBlock) { i = 0; j[0] = 0; j[1] = 1; A[0] = -2.0*h/3.0; A[1] = -h/6.0; ierr = MatSetValues(*jac,1,&i,2,j,A,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i = n-1; j[0] = n-2; j[1] = n-1; A[0] = -h/6.0; A[1] = -h/3.0-c*c; ierr = MatSetValues(*jac,1,&i,2,j,A,INSERT_VALUES);CHKERRQ(ierr); } /* Assemble matrix */ ierr = MatAssemblyBegin(*jac,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(*jac,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "CheckSolution" /* CheckSolution - Given a computed solution (lambda,x) check if it satisfies the analytic solution. Input Parameters: + lambda - the computed eigenvalue - y - the computed eigenvector Output Parameter: . error - norm of difference between the computed and exact eigenvector */ PetscErrorCode CheckSolution(PetscScalar lambda,Vec y,PetscReal *error,void *ctx) { PetscErrorCode ierr; PetscScalar nu,*uu; PetscInt i,n,Istart,Iend; PetscReal x; Vec u; ApplicationCtx *user = (ApplicationCtx*)ctx; PetscFunctionBeginUser; nu = PetscSqrtScalar(lambda); ierr = VecDuplicate(y,&u);CHKERRQ(ierr); ierr = VecGetSize(u,&n);CHKERRQ(ierr); ierr = VecGetOwnershipRange(y,&Istart,&Iend);CHKERRQ(ierr); ierr = VecGetArray(u,&uu);CHKERRQ(ierr); for (i=Istart;ih; uu[i-Istart] = sin(nu*x); } ierr = VecRestoreArray(u,&uu);CHKERRQ(ierr); ierr = VecNormalize(u,NULL);CHKERRQ(ierr); ierr = VecAXPY(u,-1.0,y);CHKERRQ(ierr); ierr = VecNorm(u,NORM_2,error);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "FixSign" /* FixSign - Force the eigenfunction to be real and positive, since some eigensolvers may return the eigenvector multiplied by a complex number of modulus one. Input/Output Parameter: . x - the computed vector */ PetscErrorCode FixSign(Vec x) { PetscErrorCode ierr; PetscMPIInt rank; PetscScalar sign,*xx; PetscFunctionBeginUser; ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr); if (!rank) { ierr = VecGetArray(x,&xx);CHKERRQ(ierr); sign = *xx/PetscAbsScalar(*xx); ierr = VecRestoreArray(x,&xx);CHKERRQ(ierr); } ierr = MPI_Bcast(&sign,1,MPIU_SCALAR,0,PETSC_COMM_WORLD);CHKERRQ(ierr); ierr = VecScale(x,1.0/sign);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/examples/makefile0000644000175000017500000000200512211062077020317 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/nep/examples/ DIRS = tests tutorials include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/examples/makefile.html0000644000175000017500000000351412211062077021270 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/nep/examples/
DIRS     = tests tutorials

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/nep/examples/tests/0000755000175000017500000000000012214143515017764 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/examples/tests/makefile0000644000175000017500000000230612211062077021465 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/nep/examples/tests/ EXAMPLESC = EXAMPLESF = MANSEC = NEP TESTS = TESTEXAMPLES_C = include ${SLEPC_DIR}/conf/slepc_common #------------------------------------------------------------------------------------ slepc-3.4.2.dfsg.orig/src/nep/examples/tests/makefile.html0000644000175000017500000000406112211062077022430 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/nep/examples/tests/
EXAMPLESC  =
EXAMPLESF  =
MANSEC     = NEP
TESTS      =

TESTEXAMPLES_C       =

include ${SLEPC_DIR}/conf/slepc_common

#------------------------------------------------------------------------------------
slepc-3.4.2.dfsg.orig/src/nep/examples/tests/index.html0000644000175000017500000000201312211062077021755 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

makefile
slepc-3.4.2.dfsg.orig/src/nep/examples/index.html0000644000175000017500000000040012211062077020611 0ustar gladkgladk Generic SLEPc Manual Pages

tests/
tutorials/
makefile
slepc-3.4.2.dfsg.orig/src/nep/impls/0000755000175000017500000000000012214143515016130 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/impls/rii/0000755000175000017500000000000012214143515016713 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/impls/rii/rii.c.html0000644000175000017500000003054012211062077020607 0ustar gladkgladk

Actual source code: rii.c

  1: /*

  3:    SLEPc nonlinear eigensolver: "rii"

  5:    Method: Residual inverse iteration

  7:    Algorithm:

  9:        Simple residual inverse iteration with varying shift.

 11:    References:

 13:        [1] A. Neumaier, "Residual inverse iteration for the nonlinear
 14:            eigenvalue problem", SIAM J. Numer. Anal. 22(5):914-923, 1985.

 16:    Last update: Feb 2013

 18:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 20:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 22:    This file is part of SLEPc.

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

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

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

 38: #include <slepc-private/nepimpl.h>         /*I "slepcnep.h" I*/

 42: PetscErrorCode NEPSetUp_RII(NEP nep)
 43: {

 47:   if (nep->ncv) { /* ncv set */
 48:     if (nep->ncv<nep->nev) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must be at least nev");
 49:   } else if (nep->mpd) { /* mpd set */
 50:     nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd);
 51:   } else { /* neither set: defaults depend on nev being small or large */
 52:     if (nep->nev<500) nep->ncv = PetscMin(nep->n,PetscMax(2*nep->nev,nep->nev+15));
 53:     else {
 54:       nep->mpd = 500;
 55:       nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd);
 56:     }
 57:   }
 58:   if (!nep->mpd) nep->mpd = nep->ncv;
 59:   if (nep->ncv>nep->nev+nep->mpd) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must not be larger than nev+mpd");
 60:   if (nep->nev>1) { PetscInfo(nep,"Warning: requested more than one eigenpair but RII can only compute one\n"); }
 61:   if (!nep->max_it) nep->max_it = PetscMax(5000,2*nep->n/nep->ncv);
 62:   if (!nep->max_funcs) nep->max_funcs = nep->max_it;

 64:   NEPAllocateSolution(nep);
 65:   NEPSetWorkVecs(nep,2);
 66:   return(0);
 67: }

 71: PetscErrorCode NEPSolve_RII(NEP nep)
 72: {
 73:   PetscErrorCode     ierr;
 74:   Mat                T=nep->function,Tp=nep->jacobian,Tsigma;
 75:   Vec                u=nep->V[0],r=nep->work[0],delta=nep->work[1];
 76:   PetscScalar        lambda,a1,a2;
 77:   PetscReal          relerr;
 78:   PetscBool          hascopy;
 79:   MatStructure       mats;
 80:   KSPConvergedReason kspreason;

 83:   /* get initial approximation of eigenvalue and eigenvector */
 84:   NEPGetDefaultShift(nep,&lambda);
 85:   if (!nep->nini) {
 86:     SlepcVecSetRandom(u,nep->rand);
 87:   }

 89:   /* correct eigenvalue approximation: lambda = lambda - (u'*T*u)/(u'*Tp*u) */
 90:   NEPComputeFunction(nep,lambda,&T,&T,&mats);
 91:   MatMult(T,u,r);
 92:   VecDot(u,r,&a1);
 93:   NEPApplyJacobian(nep,lambda,u,delta,r,&Tp,&mats);
 94:   VecDot(u,r,&a2);
 95:   lambda = lambda - a1/a2;

 97:   /* prepare linear solver */
 98:   MatDuplicate(T,MAT_COPY_VALUES,&Tsigma);
 99:   KSPSetOperators(nep->ksp,Tsigma,Tsigma,DIFFERENT_NONZERO_PATTERN);

101:   /* Restart loop */
102:   while (nep->reason == NEP_CONVERGED_ITERATING) {
103:     nep->its++;

105:     /* update preconditioner and set adaptive tolerance */
106:     if (nep->lag && !(nep->its%nep->lag) && nep->its>2*nep->lag && relerr<1e-2) {
107:       MatHasOperation(T,MATOP_COPY,&hascopy);
108:       if (hascopy) {
109:         MatCopy(T,Tsigma,mats);
110:       } else {
111:         MatDestroy(&Tsigma);
112:         MatDuplicate(T,MAT_COPY_VALUES,&Tsigma);
113:       }
114:       KSPSetOperators(nep->ksp,Tsigma,Tsigma,mats);
115:     }
116:     if (!nep->cctol) {
117:       nep->ktol = PetscMax(nep->ktol/2.0,PETSC_MACHINE_EPSILON*10.0);
118:       KSPSetTolerances(nep->ksp,nep->ktol,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);
119:     }

121:     /* form residual,  r = T(lambda)*u */
122:     NEPApplyFunction(nep,lambda,u,delta,r,&T,&T,&mats);

124:     /* convergence test */
125:     VecNorm(r,NORM_2,&relerr);
126:     nep->errest[nep->nconv] = relerr;
127:     nep->eig[nep->nconv] = lambda;
128:     if (relerr<=nep->rtol) {
129:       nep->nconv = nep->nconv + 1;
130:       nep->reason = NEP_CONVERGED_FNORM_RELATIVE;
131:     }
132:     NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,1);

134:     if (!nep->nconv) {
135:       /* eigenvector correction: delta = T(sigma)\r */
136:       NEP_KSPSolve(nep,r,delta);
137:       KSPGetConvergedReason(nep->ksp,&kspreason);
138:       if (kspreason<0) {
139:         PetscInfo1(nep,"iter=%D, linear solve failed, stopping solve\n",nep->its);
140:         nep->reason = NEP_DIVERGED_LINEAR_SOLVE;
141:         break;
142:       }

144:       /* update eigenvector: u = u - delta */
145:       VecAXPY(u,-1.0,delta);

147:       /* normalize eigenvector */
148:       VecNormalize(u,NULL);

150:       /* correct eigenvalue: lambda = lambda - (u'*T*u)/(u'*Tp*u) */
151:       NEPApplyFunction(nep,lambda,u,delta,r,&T,&T,&mats);
152:       VecDot(u,r,&a1);
153:       NEPApplyJacobian(nep,lambda,u,delta,r,&Tp,&mats);
154:       VecDot(u,r,&a2);
155:       lambda = lambda - a1/a2;
156:     }
157:     if (nep->its >= nep->max_it) nep->reason = NEP_DIVERGED_MAX_IT;
158:   }
159:   MatDestroy(&Tsigma);
160:   return(0);
161: }

165: PETSC_EXTERN PetscErrorCode NEPCreate_RII(NEP nep)
166: {
168:   nep->ops->solve        = NEPSolve_RII;
169:   nep->ops->setup        = NEPSetUp_RII;
170:   nep->ops->reset        = NEPReset_Default;
171:   return(0);
172: }

slepc-3.4.2.dfsg.orig/src/nep/impls/rii/makefile0000644000175000017500000000213312211062077020412 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = rii.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = NEP LOCDIR = src/nep/impls/rii/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/impls/rii/makefile.html0000644000175000017500000000372712211062077021367 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = rii.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = NEP
LOCDIR   = src/nep/impls/rii/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/nep/impls/rii/index.html0000644000175000017500000000205612211062077020713 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

rii.c
makefile
slepc-3.4.2.dfsg.orig/src/nep/impls/rii/rii.c0000644000175000017500000001426212211062077017647 0ustar gladkgladk/* SLEPc nonlinear eigensolver: "rii" Method: Residual inverse iteration Algorithm: Simple residual inverse iteration with varying shift. References: [1] A. Neumaier, "Residual inverse iteration for the nonlinear eigenvalue problem", SIAM J. Numer. Anal. 22(5):914-923, 1985. Last update: Feb 2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #undef __FUNCT__ #define __FUNCT__ "NEPSetUp_RII" PetscErrorCode NEPSetUp_RII(NEP nep) { PetscErrorCode ierr; PetscFunctionBegin; if (nep->ncv) { /* ncv set */ if (nep->ncvnev) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must be at least nev"); } else if (nep->mpd) { /* mpd set */ nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (nep->nev<500) nep->ncv = PetscMin(nep->n,PetscMax(2*nep->nev,nep->nev+15)); else { nep->mpd = 500; nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd); } } if (!nep->mpd) nep->mpd = nep->ncv; if (nep->ncv>nep->nev+nep->mpd) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must not be larger than nev+mpd"); if (nep->nev>1) { ierr = PetscInfo(nep,"Warning: requested more than one eigenpair but RII can only compute one\n");CHKERRQ(ierr); } if (!nep->max_it) nep->max_it = PetscMax(5000,2*nep->n/nep->ncv); if (!nep->max_funcs) nep->max_funcs = nep->max_it; ierr = NEPAllocateSolution(nep);CHKERRQ(ierr); ierr = NEPSetWorkVecs(nep,2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSolve_RII" PetscErrorCode NEPSolve_RII(NEP nep) { PetscErrorCode ierr; Mat T=nep->function,Tp=nep->jacobian,Tsigma; Vec u=nep->V[0],r=nep->work[0],delta=nep->work[1]; PetscScalar lambda,a1,a2; PetscReal relerr; PetscBool hascopy; MatStructure mats; KSPConvergedReason kspreason; PetscFunctionBegin; /* get initial approximation of eigenvalue and eigenvector */ ierr = NEPGetDefaultShift(nep,&lambda);CHKERRQ(ierr); if (!nep->nini) { ierr = SlepcVecSetRandom(u,nep->rand);CHKERRQ(ierr); } /* correct eigenvalue approximation: lambda = lambda - (u'*T*u)/(u'*Tp*u) */ ierr = NEPComputeFunction(nep,lambda,&T,&T,&mats);CHKERRQ(ierr); ierr = MatMult(T,u,r);CHKERRQ(ierr); ierr = VecDot(u,r,&a1);CHKERRQ(ierr); ierr = NEPApplyJacobian(nep,lambda,u,delta,r,&Tp,&mats);CHKERRQ(ierr); ierr = VecDot(u,r,&a2);CHKERRQ(ierr); lambda = lambda - a1/a2; /* prepare linear solver */ ierr = MatDuplicate(T,MAT_COPY_VALUES,&Tsigma);CHKERRQ(ierr); ierr = KSPSetOperators(nep->ksp,Tsigma,Tsigma,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); /* Restart loop */ while (nep->reason == NEP_CONVERGED_ITERATING) { nep->its++; /* update preconditioner and set adaptive tolerance */ if (nep->lag && !(nep->its%nep->lag) && nep->its>2*nep->lag && relerr<1e-2) { ierr = MatHasOperation(T,MATOP_COPY,&hascopy);CHKERRQ(ierr); if (hascopy) { ierr = MatCopy(T,Tsigma,mats);CHKERRQ(ierr); } else { ierr = MatDestroy(&Tsigma);CHKERRQ(ierr); ierr = MatDuplicate(T,MAT_COPY_VALUES,&Tsigma);CHKERRQ(ierr); } ierr = KSPSetOperators(nep->ksp,Tsigma,Tsigma,mats);CHKERRQ(ierr); } if (!nep->cctol) { nep->ktol = PetscMax(nep->ktol/2.0,PETSC_MACHINE_EPSILON*10.0); ierr = KSPSetTolerances(nep->ksp,nep->ktol,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);CHKERRQ(ierr); } /* form residual, r = T(lambda)*u */ ierr = NEPApplyFunction(nep,lambda,u,delta,r,&T,&T,&mats);CHKERRQ(ierr); /* convergence test */ ierr = VecNorm(r,NORM_2,&relerr);CHKERRQ(ierr); nep->errest[nep->nconv] = relerr; nep->eig[nep->nconv] = lambda; if (relerr<=nep->rtol) { nep->nconv = nep->nconv + 1; nep->reason = NEP_CONVERGED_FNORM_RELATIVE; } ierr = NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,1);CHKERRQ(ierr); if (!nep->nconv) { /* eigenvector correction: delta = T(sigma)\r */ ierr = NEP_KSPSolve(nep,r,delta);CHKERRQ(ierr); ierr = KSPGetConvergedReason(nep->ksp,&kspreason);CHKERRQ(ierr); if (kspreason<0) { ierr = PetscInfo1(nep,"iter=%D, linear solve failed, stopping solve\n",nep->its);CHKERRQ(ierr); nep->reason = NEP_DIVERGED_LINEAR_SOLVE; break; } /* update eigenvector: u = u - delta */ ierr = VecAXPY(u,-1.0,delta);CHKERRQ(ierr); /* normalize eigenvector */ ierr = VecNormalize(u,NULL);CHKERRQ(ierr); /* correct eigenvalue: lambda = lambda - (u'*T*u)/(u'*Tp*u) */ ierr = NEPApplyFunction(nep,lambda,u,delta,r,&T,&T,&mats);CHKERRQ(ierr); ierr = VecDot(u,r,&a1);CHKERRQ(ierr); ierr = NEPApplyJacobian(nep,lambda,u,delta,r,&Tp,&mats);CHKERRQ(ierr); ierr = VecDot(u,r,&a2);CHKERRQ(ierr); lambda = lambda - a1/a2; } if (nep->its >= nep->max_it) nep->reason = NEP_DIVERGED_MAX_IT; } ierr = MatDestroy(&Tsigma);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPCreate_RII" PETSC_EXTERN PetscErrorCode NEPCreate_RII(NEP nep) { PetscFunctionBegin; nep->ops->solve = NEPSolve_RII; nep->ops->setup = NEPSetUp_RII; nep->ops->reset = NEPReset_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/impls/makefile0000644000175000017500000000205312211062077017630 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = rii slp narnoldi LOCDIR = src/nep/impls/ MANSEC = NEP include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/impls/makefile.html0000644000175000017500000000364712211062077020605 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = rii slp narnoldi
LOCDIR   = src/nep/impls/
MANSEC   = NEP

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/nep/impls/index.html0000644000175000017500000000215112211062077020124 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

rii/
slp/
narnoldi/
makefile
slepc-3.4.2.dfsg.orig/src/nep/impls/slp/0000755000175000017500000000000012211062077016726 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/impls/slp/slp.c.html0000644000175000017500000005465212211062077020647 0ustar gladkgladk

Actual source code: slp.c

  1: /*

  3:    SLEPc nonlinear eigensolver: "slp"

  5:    Method: Succesive linear problems

  7:    Algorithm:

  9:        Newton-type iteration based on first order Taylor approximation.

 11:    References:

 13:        [1] A. Ruhe, "Algorithms for the nonlinear eigenvalue problem", SIAM J.
 14:            Numer. Anal. 10(4):674-689, 1973.

 16:    Last update: Feb 2013

 18:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 20:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 22:    This file is part of SLEPc.

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

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

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

 38: #include <slepc-private/nepimpl.h>         /*I "slepcnep.h" I*/
 39: #include <slepc-private/epsimpl.h>         /*I "slepceps.h" I*/

 41: typedef struct {
 42:   EPS       eps;             /* linear eigensolver for T*z = mu*Tp*z */
 43:   PetscBool setfromoptionscalled;
 44: } NEP_SLP;

 48: PetscErrorCode NEPSetUp_SLP(NEP nep)
 49: {
 51:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;
 52:   ST             st;

 55:   if (nep->ncv) { /* ncv set */
 56:     if (nep->ncv<nep->nev) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must be at least nev");
 57:   } else if (nep->mpd) { /* mpd set */
 58:     nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd);
 59:   } else { /* neither set: defaults depend on nev being small or large */
 60:     if (nep->nev<500) nep->ncv = PetscMin(nep->n,PetscMax(2*nep->nev,nep->nev+15));
 61:     else {
 62:       nep->mpd = 500;
 63:       nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd);
 64:     }
 65:   }
 66:   if (!nep->mpd) nep->mpd = nep->ncv;
 67:   if (nep->ncv>nep->nev+nep->mpd) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must not be larger than nev+mpd");
 68:   if (nep->nev>1) { PetscInfo(nep,"Warning: requested more than one eigenpair but SLP can only compute one\n"); }
 69:   if (!nep->max_it) nep->max_it = PetscMax(5000,2*nep->n/nep->ncv);
 70:   if (!nep->max_funcs) nep->max_funcs = nep->max_it;

 72:   if (!ctx->eps) { NEPSLPGetEPS(nep,&ctx->eps); }
 73:   EPSSetWhichEigenpairs(ctx->eps,EPS_TARGET_MAGNITUDE);
 74:   EPSSetTarget(ctx->eps,0.0);
 75:   EPSGetST(ctx->eps,&st);
 76:   STSetType(st,STSINVERT);
 77:   EPSSetDimensions(ctx->eps,1,nep->ncv,nep->mpd);
 78:   EPSSetTolerances(ctx->eps,nep->rtol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL/10.0:nep->rtol/10.0,nep->max_it);
 79:   if (ctx->setfromoptionscalled) {
 80:     EPSSetFromOptions(ctx->eps);
 81:     ctx->setfromoptionscalled = PETSC_FALSE;
 82:   }

 84:   NEPAllocateSolution(nep);
 85:   NEPSetWorkVecs(nep,1);
 86:   return(0);
 87: }

 91: PetscErrorCode NEPSolve_SLP(NEP nep)
 92: {
 94:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;
 95:   Mat            T=nep->function,Tp=nep->jacobian;
 96:   Vec            u=nep->V[0],r=nep->work[0];
 97:   PetscScalar    lambda,mu,im;
 98:   PetscReal      relerr;
 99:   PetscInt       nconv;
100:   MatStructure   mats;

103:   /* get initial approximation of eigenvalue and eigenvector */
104:   NEPGetDefaultShift(nep,&lambda);
105:   if (!nep->nini) {
106:     SlepcVecSetRandom(u,nep->rand);
107:   }

109:   /* Restart loop */
110:   while (nep->reason == NEP_CONVERGED_ITERATING) {
111:     nep->its++;

113:     /* evaluate T(lambda) and T'(lambda) */
114:     NEPComputeFunction(nep,lambda,&T,&T,&mats);
115:     NEPComputeJacobian(nep,lambda,&Tp,&mats);

117:     /* form residual,  r = T(lambda)*u (used in convergence test only) */
118:     MatMult(T,u,r);

120:     /* convergence test */
121:     VecNorm(r,NORM_2,&relerr);
122:     nep->errest[nep->nconv] = relerr;
123:     nep->eig[nep->nconv] = lambda;
124:     if (relerr<=nep->rtol) {
125:       nep->nconv = nep->nconv + 1;
126:       nep->reason = NEP_CONVERGED_FNORM_RELATIVE;
127:     }
128:     NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,1);

130:     if (!nep->nconv) {
131:       /* compute eigenvalue correction mu and eigenvector approximation u */
132:       EPSSetOperators(ctx->eps,T,Tp);
133:       EPSSetInitialSpace(ctx->eps,1,&u);
134:       EPSSolve(ctx->eps);
135:       EPSGetConverged(ctx->eps,&nconv);
136:       if (!nconv) {
137:         PetscInfo1(nep,"iter=%D, inner iteration failed, stopping solve\n",nep->its);
138:         nep->reason = NEP_DIVERGED_LINEAR_SOLVE;
139:         break;
140:       }
141:       EPSGetEigenpair(ctx->eps,0,&mu,&im,u,NULL);
142:       if (PetscAbsScalar(im)>PETSC_MACHINE_EPSILON) SETERRQ(PetscObjectComm((PetscObject)nep),1,"Complex eigenvalue approximation - not implemented in real scalars");

144:       /* correct eigenvalue */
145:       lambda = lambda - mu;
146:     }
147:     if (nep->its >= nep->max_it) nep->reason = NEP_DIVERGED_MAX_IT;
148:   }
149:   return(0);
150: }

154: PetscErrorCode NEPSetFromOptions_SLP(NEP nep)
155: {
156:   NEP_SLP *ctx = (NEP_SLP*)nep->data;

159:   ctx->setfromoptionscalled = PETSC_TRUE;
160:   return(0);
161: }

165: static PetscErrorCode NEPSLPSetEPS_SLP(NEP nep,EPS eps)
166: {
168:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;

171:   PetscObjectReference((PetscObject)eps);
172:   EPSDestroy(&ctx->eps);
173:   ctx->eps = eps;
174:   PetscLogObjectParent(nep,ctx->eps);
175:   nep->setupcalled = 0;
176:   return(0);
177: }

181: /*@
182:    NEPSLPSetEPS - Associate a linear eigensolver object (EPS) to the
183:    nonlinear eigenvalue solver.

185:    Collective on NEP

187:    Input Parameters:
188: +  nep - nonlinear eigenvalue solver
189: -  eps - the eigensolver object

191:    Level: advanced

193: .seealso: NEPSLPGetEPS()
194: @*/
195: PetscErrorCode NEPSLPSetEPS(NEP nep,EPS eps)
196: {

203:   PetscTryMethod(nep,"NEPSLPSetEPS_C",(NEP,EPS),(nep,eps));
204:   return(0);
205: }

209: static PetscErrorCode NEPSLPGetEPS_SLP(NEP nep,EPS *eps)
210: {
212:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;

215:   if (!ctx->eps) {
216:     EPSCreate(PetscObjectComm((PetscObject)nep),&ctx->eps);
217:     EPSSetOptionsPrefix(ctx->eps,((PetscObject)nep)->prefix);
218:     EPSAppendOptionsPrefix(ctx->eps,"nep_");
219:     STSetOptionsPrefix(ctx->eps->st,((PetscObject)ctx->eps)->prefix);
220:     PetscObjectIncrementTabLevel((PetscObject)ctx->eps,(PetscObject)nep,1);
221:     PetscLogObjectParent(nep,ctx->eps);
222:     if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
223:     EPSSetIP(ctx->eps,nep->ip);
224:   }
225:   *eps = ctx->eps;
226:   return(0);
227: }

231: /*@
232:    NEPSLPGetEPS - Retrieve the linear eigensolver object (EPS) associated
233:    to the nonlinear eigenvalue solver.

235:    Not Collective

237:    Input Parameter:
238: .  nep - nonlinear eigenvalue solver

240:    Output Parameter:
241: .  eps - the eigensolver object

243:    Level: advanced

245: .seealso: NEPSLPSetEPS()
246: @*/
247: PetscErrorCode NEPSLPGetEPS(NEP nep,EPS *eps)
248: {

254:   PetscTryMethod(nep,"NEPSLPGetEPS_C",(NEP,EPS*),(nep,eps));
255:   return(0);
256: }

260: PetscErrorCode NEPView_SLP(NEP nep,PetscViewer viewer)
261: {
263:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;

266:   if (!ctx->eps) { NEPSLPGetEPS(nep,&ctx->eps); }
267:   PetscViewerASCIIPushTab(viewer);
268:   EPSView(ctx->eps,viewer);
269:   PetscViewerASCIIPopTab(viewer);
270:   return(0);
271: }

275: PetscErrorCode NEPReset_SLP(NEP nep)
276: {
278:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;

281:   if (!ctx->eps) { EPSReset(ctx->eps); }
282:   NEPReset_Default(nep);
283:   return(0);
284: }

288: PetscErrorCode NEPDestroy_SLP(NEP nep)
289: {
291:   NEP_SLP        *ctx = (NEP_SLP*)nep->data;

294:   EPSDestroy(&ctx->eps);
295:   PetscFree(nep->data);
296:   PetscObjectComposeFunction((PetscObject)nep,"NEPSLPSetEPS_C",NULL);
297:   PetscObjectComposeFunction((PetscObject)nep,"NEPSLPGetEPS_C",NULL);
298:   return(0);
299: }

303: PETSC_EXTERN PetscErrorCode NEPCreate_SLP(NEP nep)
304: {
306:   NEP_SLP        *ctx;

309:   PetscNewLog(nep,NEP_SLP,&ctx);
310:   nep->data                = (void*)ctx;
311:   nep->ops->solve          = NEPSolve_SLP;
312:   nep->ops->setup          = NEPSetUp_SLP;
313:   nep->ops->setfromoptions = NEPSetFromOptions_SLP;
314:   nep->ops->reset          = NEPReset_SLP;
315:   nep->ops->destroy        = NEPDestroy_SLP;
316:   nep->ops->view           = NEPView_SLP;
317:   PetscObjectComposeFunction((PetscObject)nep,"NEPSLPSetEPS_C",NEPSLPSetEPS_SLP);
318:   PetscObjectComposeFunction((PetscObject)nep,"NEPSLPGetEPS_C",NEPSLPGetEPS_SLP);
319:   return(0);
320: }

slepc-3.4.2.dfsg.orig/src/nep/impls/slp/makefile0000644000175000017500000000213312211062077020425 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = slp.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = NEP LOCDIR = src/nep/impls/slp/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/impls/slp/makefile.html0000644000175000017500000000372712211062077021402 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = slp.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = NEP
LOCDIR   = src/nep/impls/slp/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/nep/impls/slp/slp.c0000644000175000017500000002442112211062077017673 0ustar gladkgladk/* SLEPc nonlinear eigensolver: "slp" Method: Succesive linear problems Algorithm: Newton-type iteration based on first order Taylor approximation. References: [1] A. Ruhe, "Algorithms for the nonlinear eigenvalue problem", SIAM J. Numer. Anal. 10(4):674-689, 1973. Last update: Feb 2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #include /*I "slepceps.h" I*/ typedef struct { EPS eps; /* linear eigensolver for T*z = mu*Tp*z */ PetscBool setfromoptionscalled; } NEP_SLP; #undef __FUNCT__ #define __FUNCT__ "NEPSetUp_SLP" PetscErrorCode NEPSetUp_SLP(NEP nep) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; ST st; PetscFunctionBegin; if (nep->ncv) { /* ncv set */ if (nep->ncvnev) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must be at least nev"); } else if (nep->mpd) { /* mpd set */ nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (nep->nev<500) nep->ncv = PetscMin(nep->n,PetscMax(2*nep->nev,nep->nev+15)); else { nep->mpd = 500; nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd); } } if (!nep->mpd) nep->mpd = nep->ncv; if (nep->ncv>nep->nev+nep->mpd) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must not be larger than nev+mpd"); if (nep->nev>1) { ierr = PetscInfo(nep,"Warning: requested more than one eigenpair but SLP can only compute one\n");CHKERRQ(ierr); } if (!nep->max_it) nep->max_it = PetscMax(5000,2*nep->n/nep->ncv); if (!nep->max_funcs) nep->max_funcs = nep->max_it; if (!ctx->eps) { ierr = NEPSLPGetEPS(nep,&ctx->eps);CHKERRQ(ierr); } ierr = EPSSetWhichEigenpairs(ctx->eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr); ierr = EPSSetTarget(ctx->eps,0.0);CHKERRQ(ierr); ierr = EPSGetST(ctx->eps,&st);CHKERRQ(ierr); ierr = STSetType(st,STSINVERT);CHKERRQ(ierr); ierr = EPSSetDimensions(ctx->eps,1,nep->ncv,nep->mpd);CHKERRQ(ierr); ierr = EPSSetTolerances(ctx->eps,nep->rtol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL/10.0:nep->rtol/10.0,nep->max_it);CHKERRQ(ierr); if (ctx->setfromoptionscalled) { ierr = EPSSetFromOptions(ctx->eps);CHKERRQ(ierr); ctx->setfromoptionscalled = PETSC_FALSE; } ierr = NEPAllocateSolution(nep);CHKERRQ(ierr); ierr = NEPSetWorkVecs(nep,1);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSolve_SLP" PetscErrorCode NEPSolve_SLP(NEP nep) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; Mat T=nep->function,Tp=nep->jacobian; Vec u=nep->V[0],r=nep->work[0]; PetscScalar lambda,mu,im; PetscReal relerr; PetscInt nconv; MatStructure mats; PetscFunctionBegin; /* get initial approximation of eigenvalue and eigenvector */ ierr = NEPGetDefaultShift(nep,&lambda);CHKERRQ(ierr); if (!nep->nini) { ierr = SlepcVecSetRandom(u,nep->rand);CHKERRQ(ierr); } /* Restart loop */ while (nep->reason == NEP_CONVERGED_ITERATING) { nep->its++; /* evaluate T(lambda) and T'(lambda) */ ierr = NEPComputeFunction(nep,lambda,&T,&T,&mats);CHKERRQ(ierr); ierr = NEPComputeJacobian(nep,lambda,&Tp,&mats);CHKERRQ(ierr); /* form residual, r = T(lambda)*u (used in convergence test only) */ ierr = MatMult(T,u,r);CHKERRQ(ierr); /* convergence test */ ierr = VecNorm(r,NORM_2,&relerr);CHKERRQ(ierr); nep->errest[nep->nconv] = relerr; nep->eig[nep->nconv] = lambda; if (relerr<=nep->rtol) { nep->nconv = nep->nconv + 1; nep->reason = NEP_CONVERGED_FNORM_RELATIVE; } ierr = NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,1);CHKERRQ(ierr); if (!nep->nconv) { /* compute eigenvalue correction mu and eigenvector approximation u */ ierr = EPSSetOperators(ctx->eps,T,Tp);CHKERRQ(ierr); ierr = EPSSetInitialSpace(ctx->eps,1,&u);CHKERRQ(ierr); ierr = EPSSolve(ctx->eps);CHKERRQ(ierr); ierr = EPSGetConverged(ctx->eps,&nconv);CHKERRQ(ierr); if (!nconv) { ierr = PetscInfo1(nep,"iter=%D, inner iteration failed, stopping solve\n",nep->its);CHKERRQ(ierr); nep->reason = NEP_DIVERGED_LINEAR_SOLVE; break; } ierr = EPSGetEigenpair(ctx->eps,0,&mu,&im,u,NULL);CHKERRQ(ierr); if (PetscAbsScalar(im)>PETSC_MACHINE_EPSILON) SETERRQ(PetscObjectComm((PetscObject)nep),1,"Complex eigenvalue approximation - not implemented in real scalars"); /* correct eigenvalue */ lambda = lambda - mu; } if (nep->its >= nep->max_it) nep->reason = NEP_DIVERGED_MAX_IT; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetFromOptions_SLP" PetscErrorCode NEPSetFromOptions_SLP(NEP nep) { NEP_SLP *ctx = (NEP_SLP*)nep->data; PetscFunctionBegin; ctx->setfromoptionscalled = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSLPSetEPS_SLP" static PetscErrorCode NEPSLPSetEPS_SLP(NEP nep,EPS eps) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; PetscFunctionBegin; ierr = PetscObjectReference((PetscObject)eps);CHKERRQ(ierr); ierr = EPSDestroy(&ctx->eps);CHKERRQ(ierr); ctx->eps = eps; ierr = PetscLogObjectParent(nep,ctx->eps);CHKERRQ(ierr); nep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSLPSetEPS" /*@ NEPSLPSetEPS - Associate a linear eigensolver object (EPS) to the nonlinear eigenvalue solver. Collective on NEP Input Parameters: + nep - nonlinear eigenvalue solver - eps - the eigensolver object Level: advanced .seealso: NEPSLPGetEPS() @*/ PetscErrorCode NEPSLPSetEPS(NEP nep,EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidHeaderSpecific(eps,EPS_CLASSID,2); PetscCheckSameComm(nep,1,eps,2); ierr = PetscTryMethod(nep,"NEPSLPSetEPS_C",(NEP,EPS),(nep,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSLPGetEPS_SLP" static PetscErrorCode NEPSLPGetEPS_SLP(NEP nep,EPS *eps) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; PetscFunctionBegin; if (!ctx->eps) { ierr = EPSCreate(PetscObjectComm((PetscObject)nep),&ctx->eps);CHKERRQ(ierr); ierr = EPSSetOptionsPrefix(ctx->eps,((PetscObject)nep)->prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(ctx->eps,"nep_");CHKERRQ(ierr); ierr = STSetOptionsPrefix(ctx->eps->st,((PetscObject)ctx->eps)->prefix);CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)ctx->eps,(PetscObject)nep,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,ctx->eps);CHKERRQ(ierr); if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } ierr = EPSSetIP(ctx->eps,nep->ip);CHKERRQ(ierr); } *eps = ctx->eps; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSLPGetEPS" /*@ NEPSLPGetEPS - Retrieve the linear eigensolver object (EPS) associated to the nonlinear eigenvalue solver. Not Collective Input Parameter: . nep - nonlinear eigenvalue solver Output Parameter: . eps - the eigensolver object Level: advanced .seealso: NEPSLPSetEPS() @*/ PetscErrorCode NEPSLPGetEPS(NEP nep,EPS *eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(eps,2); ierr = PetscTryMethod(nep,"NEPSLPGetEPS_C",(NEP,EPS*),(nep,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPView_SLP" PetscErrorCode NEPView_SLP(NEP nep,PetscViewer viewer) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; PetscFunctionBegin; if (!ctx->eps) { ierr = NEPSLPGetEPS(nep,&ctx->eps);CHKERRQ(ierr); } ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = EPSView(ctx->eps,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPReset_SLP" PetscErrorCode NEPReset_SLP(NEP nep) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; PetscFunctionBegin; if (!ctx->eps) { ierr = EPSReset(ctx->eps);CHKERRQ(ierr); } ierr = NEPReset_Default(nep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPDestroy_SLP" PetscErrorCode NEPDestroy_SLP(NEP nep) { PetscErrorCode ierr; NEP_SLP *ctx = (NEP_SLP*)nep->data; PetscFunctionBegin; ierr = EPSDestroy(&ctx->eps);CHKERRQ(ierr); ierr = PetscFree(nep->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)nep,"NEPSLPSetEPS_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)nep,"NEPSLPGetEPS_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPCreate_SLP" PETSC_EXTERN PetscErrorCode NEPCreate_SLP(NEP nep) { PetscErrorCode ierr; NEP_SLP *ctx; PetscFunctionBegin; ierr = PetscNewLog(nep,NEP_SLP,&ctx);CHKERRQ(ierr); nep->data = (void*)ctx; nep->ops->solve = NEPSolve_SLP; nep->ops->setup = NEPSetUp_SLP; nep->ops->setfromoptions = NEPSetFromOptions_SLP; nep->ops->reset = NEPReset_SLP; nep->ops->destroy = NEPDestroy_SLP; nep->ops->view = NEPView_SLP; ierr = PetscObjectComposeFunction((PetscObject)nep,"NEPSLPSetEPS_C",NEPSLPSetEPS_SLP);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)nep,"NEPSLPGetEPS_C",NEPSLPGetEPS_SLP);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/impls/slp/index.html0000644000175000017500000000205612211062077020726 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

slp.c
makefile
slepc-3.4.2.dfsg.orig/src/nep/impls/slp/ftn-auto/0000755000175000017500000000000012214143515020463 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/impls/slp/ftn-auto/slpf.c0000644000175000017500000000250412211062077021574 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* slp.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepslpseteps_ NEPSLPSETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepslpseteps_ nepslpseteps #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepslpgeteps_ NEPSLPGETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepslpgeteps_ nepslpgeteps #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepslpseteps_(NEP *nep,EPS *eps, int *__ierr ){ *__ierr = NEPSLPSetEPS(*nep,*eps); } void PETSC_STDCALL nepslpgeteps_(NEP *nep,EPS *eps, int *__ierr ){ *__ierr = NEPSLPGetEPS(*nep, (EPS* )PetscToPointer((eps) )); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/impls/slp/ftn-auto/makefile0000644000175000017500000000033612211062077022165 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = slpf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/nep/impls/slp/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/impls/narnoldi/0000755000175000017500000000000012214143515017736 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/impls/narnoldi/narnoldi.c.html0000644000175000017500000003163712211062077022665 0ustar gladkgladk

Actual source code: narnoldi.c

  1: /*

  3:    SLEPc nonlinear eigensolver: "narnoldi"

  5:    Method: Nonlinear Arnoldi

  7:    Algorithm:

  9:        Arnoldi for nonlinear eigenproblems.

 11:    References:

 13:        [1] H. Voss, "An Arnoldi method for nonlinear eigenvalue problems",
 14:            BIT 44:387-401, 2004.

 16:    Last update: Mar 2013

 18:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 20:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 22:    This file is part of SLEPc.

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

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

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

 38: #include <slepc-private/nepimpl.h>         /*I "slepcnep.h" I*/

 42: PetscErrorCode NEPSetUp_NARNOLDI(NEP nep)
 43: {

 47:   if (nep->ncv) { /* ncv set */
 48:     if (nep->ncv<nep->nev) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must be at least nev");
 49:   } else if (nep->mpd) { /* mpd set */
 50:     nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd);
 51:   } else { /* neither set: defaults depend on nev being small or large */
 52:     if (nep->nev<500) nep->ncv = PetscMin(nep->n,PetscMax(2*nep->nev,nep->nev+15));
 53:     else {
 54:       nep->mpd = 500;
 55:       nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd);
 56:     }
 57:   }
 58:   if (!nep->mpd) nep->mpd = nep->ncv;
 59:   if (nep->ncv>nep->nev+nep->mpd) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must not be larger than nev+mpd");
 60:   if (!nep->max_it) nep->max_it = PetscMax(5000,2*nep->n/nep->ncv);
 61:   if (!nep->max_funcs) nep->max_funcs = nep->max_it;
 62:   if (!nep->split) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_SUP,"NARNOLDI only available for split operator");

 64:   NEPAllocateSolution(nep);
 65:   NEPSetWorkVecs(nep,3);

 67:   /* set-up DS and transfer split operator functions */
 68:   DSSetType(nep->ds,DSNEP);
 69:   DSSetFN(nep->ds,nep->nt,nep->f);
 70:   DSAllocate(nep->ds,nep->ncv);
 71:   return(0);
 72: }

 76: PetscErrorCode NEPSolve_NARNOLDI(NEP nep)
 77: {
 78:   PetscErrorCode     ierr;
 79:   Mat                T=nep->function,Tsigma;
 80:   Vec                f,u=nep->V[0],r=nep->work[0],x=nep->work[1],w=nep->work[2];
 81:   PetscScalar        *X,lambda;
 82:   PetscReal          beta,resnorm=0.0;
 83:   PetscInt           n;
 84:   PetscBool          breakdown;
 85:   MatStructure       mats;
 86:   KSPConvergedReason kspreason;

 89:   /* get initial space and shift */
 90:   NEPGetDefaultShift(nep,&lambda);
 91:   if (!nep->nini) {
 92:     SlepcVecSetRandom(u,nep->rand);
 93:     VecNormalize(u,NULL);
 94:     n = 1;
 95:   } else n = nep->nini;

 97:   /* build projected matrices for initial space */
 98:   NEPProjectOperator(nep,0,n,r);

100:   /* prepare linear solver */
101:   NEPComputeFunction(nep,lambda,&T,&T,&mats);
102:   MatDuplicate(T,MAT_COPY_VALUES,&Tsigma);
103:   KSPSetOperators(nep->ksp,Tsigma,Tsigma,DIFFERENT_NONZERO_PATTERN);

105:   /* Restart loop */
106:   while (nep->reason == NEP_CONVERGED_ITERATING) {
107:     nep->its++;

109:     /* solve projected problem */
110:     DSSetDimensions(nep->ds,n,0,0,0);
111:     DSSetState(nep->ds,DS_STATE_RAW);
112:     DSSolve(nep->ds,nep->eig,NULL);
113:     lambda = nep->eig[0];

115:     /* compute Ritz vector, x = V*s */
116:     DSGetArray(nep->ds,DS_MAT_X,&X);
117:     SlepcVecMAXPBY(x,0.0,1.0,n,X,nep->V);
118:     DSRestoreArray(nep->ds,DS_MAT_X,&X);

120:     /* compute the residual, r = T(lambda)*x */
121:     NEPApplyFunction(nep,lambda,x,w,r,NULL,NULL,NULL);

123:     /* convergence test */
124:     VecNorm(r,NORM_2,&resnorm);
125:     nep->errest[nep->nconv] = resnorm;
126:     if (resnorm<=nep->rtol) {
127:       VecCopy(x,nep->V[nep->nconv]);
128:       nep->nconv = nep->nconv + 1;
129:       nep->reason = NEP_CONVERGED_FNORM_RELATIVE;
130:     }
131:     NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,1);

133:     if (nep->reason == NEP_CONVERGED_ITERATING) {

135:       /* continuation vector: f = T(sigma)\r */
136:       f = nep->V[n];
137:       NEP_KSPSolve(nep,r,f);
138:       KSPGetConvergedReason(nep->ksp,&kspreason);
139:       if (kspreason<0) {
140:         PetscInfo1(nep,"iter=%D, linear solve failed, stopping solve\n",nep->its);
141:         nep->reason = NEP_DIVERGED_LINEAR_SOLVE;
142:         break;
143:       }

145:       /* orthonormalize */
146:       IPOrthogonalize(nep->ip,0,NULL,n,NULL,nep->V,f,NULL,&beta,&breakdown);
147:       if (breakdown || beta==0.0) {
148:         PetscInfo1(nep,"iter=%D, orthogonalization failed, stopping solve\n",nep->its);
149:         nep->reason = NEP_DIVERGED_BREAKDOWN;
150:         break;
151:       }
152:       VecScale(f,1.0/beta);

154:       /* update projected matrices */
155:       NEPProjectOperator(nep,n,n+1,r);
156:       n++;
157:     }
158:     if (nep->its >= nep->max_it) nep->reason = NEP_DIVERGED_MAX_IT;
159:   }
160:   MatDestroy(&Tsigma);
161:   return(0);
162: }

166: PETSC_EXTERN PetscErrorCode NEPCreate_NARNOLDI(NEP nep)
167: {
169:   nep->ops->solve          = NEPSolve_NARNOLDI;
170:   nep->ops->setup          = NEPSetUp_NARNOLDI;
171:   nep->ops->reset          = NEPReset_Default;
172:   return(0);
173: }

slepc-3.4.2.dfsg.orig/src/nep/impls/narnoldi/makefile0000644000175000017500000000215612211062077021442 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = narnoldi.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = NEP LOCDIR = src/nep/impls/narnoldi/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/impls/narnoldi/makefile.html0000644000175000017500000000375212211062077022410 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#     
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = narnoldi.c
SOURCEF  = 
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = NEP
LOCDIR   = src/nep/impls/narnoldi/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/nep/impls/narnoldi/index.html0000644000175000017500000000207012211062077021732 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

narnoldi.c
makefile
slepc-3.4.2.dfsg.orig/src/nep/impls/narnoldi/narnoldi.c0000644000175000017500000001405512211062077021715 0ustar gladkgladk/* SLEPc nonlinear eigensolver: "narnoldi" Method: Nonlinear Arnoldi Algorithm: Arnoldi for nonlinear eigenproblems. References: [1] H. Voss, "An Arnoldi method for nonlinear eigenvalue problems", BIT 44:387-401, 2004. Last update: Mar 2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #undef __FUNCT__ #define __FUNCT__ "NEPSetUp_NARNOLDI" PetscErrorCode NEPSetUp_NARNOLDI(NEP nep) { PetscErrorCode ierr; PetscFunctionBegin; if (nep->ncv) { /* ncv set */ if (nep->ncvnev) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must be at least nev"); } else if (nep->mpd) { /* mpd set */ nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (nep->nev<500) nep->ncv = PetscMin(nep->n,PetscMax(2*nep->nev,nep->nev+15)); else { nep->mpd = 500; nep->ncv = PetscMin(nep->n,nep->nev+nep->mpd); } } if (!nep->mpd) nep->mpd = nep->ncv; if (nep->ncv>nep->nev+nep->mpd) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The value of ncv must not be larger than nev+mpd"); if (!nep->max_it) nep->max_it = PetscMax(5000,2*nep->n/nep->ncv); if (!nep->max_funcs) nep->max_funcs = nep->max_it; if (!nep->split) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_SUP,"NARNOLDI only available for split operator"); ierr = NEPAllocateSolution(nep);CHKERRQ(ierr); ierr = NEPSetWorkVecs(nep,3);CHKERRQ(ierr); /* set-up DS and transfer split operator functions */ ierr = DSSetType(nep->ds,DSNEP);CHKERRQ(ierr); ierr = DSSetFN(nep->ds,nep->nt,nep->f);CHKERRQ(ierr); ierr = DSAllocate(nep->ds,nep->ncv);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSolve_NARNOLDI" PetscErrorCode NEPSolve_NARNOLDI(NEP nep) { PetscErrorCode ierr; Mat T=nep->function,Tsigma; Vec f,u=nep->V[0],r=nep->work[0],x=nep->work[1],w=nep->work[2]; PetscScalar *X,lambda; PetscReal beta,resnorm=0.0; PetscInt n; PetscBool breakdown; MatStructure mats; KSPConvergedReason kspreason; PetscFunctionBegin; /* get initial space and shift */ ierr = NEPGetDefaultShift(nep,&lambda);CHKERRQ(ierr); if (!nep->nini) { ierr = SlepcVecSetRandom(u,nep->rand);CHKERRQ(ierr); ierr = VecNormalize(u,NULL);CHKERRQ(ierr); n = 1; } else n = nep->nini; /* build projected matrices for initial space */ ierr = NEPProjectOperator(nep,0,n,r);CHKERRQ(ierr); /* prepare linear solver */ ierr = NEPComputeFunction(nep,lambda,&T,&T,&mats);CHKERRQ(ierr); ierr = MatDuplicate(T,MAT_COPY_VALUES,&Tsigma);CHKERRQ(ierr); ierr = KSPSetOperators(nep->ksp,Tsigma,Tsigma,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); /* Restart loop */ while (nep->reason == NEP_CONVERGED_ITERATING) { nep->its++; /* solve projected problem */ ierr = DSSetDimensions(nep->ds,n,0,0,0);CHKERRQ(ierr); ierr = DSSetState(nep->ds,DS_STATE_RAW);CHKERRQ(ierr); ierr = DSSolve(nep->ds,nep->eig,NULL);CHKERRQ(ierr); lambda = nep->eig[0]; /* compute Ritz vector, x = V*s */ ierr = DSGetArray(nep->ds,DS_MAT_X,&X);CHKERRQ(ierr); ierr = SlepcVecMAXPBY(x,0.0,1.0,n,X,nep->V);CHKERRQ(ierr); ierr = DSRestoreArray(nep->ds,DS_MAT_X,&X);CHKERRQ(ierr); /* compute the residual, r = T(lambda)*x */ ierr = NEPApplyFunction(nep,lambda,x,w,r,NULL,NULL,NULL);CHKERRQ(ierr); /* convergence test */ ierr = VecNorm(r,NORM_2,&resnorm);CHKERRQ(ierr); nep->errest[nep->nconv] = resnorm; if (resnorm<=nep->rtol) { ierr = VecCopy(x,nep->V[nep->nconv]);CHKERRQ(ierr); nep->nconv = nep->nconv + 1; nep->reason = NEP_CONVERGED_FNORM_RELATIVE; } ierr = NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,1);CHKERRQ(ierr); if (nep->reason == NEP_CONVERGED_ITERATING) { /* continuation vector: f = T(sigma)\r */ f = nep->V[n]; ierr = NEP_KSPSolve(nep,r,f);CHKERRQ(ierr); ierr = KSPGetConvergedReason(nep->ksp,&kspreason);CHKERRQ(ierr); if (kspreason<0) { ierr = PetscInfo1(nep,"iter=%D, linear solve failed, stopping solve\n",nep->its);CHKERRQ(ierr); nep->reason = NEP_DIVERGED_LINEAR_SOLVE; break; } /* orthonormalize */ ierr = IPOrthogonalize(nep->ip,0,NULL,n,NULL,nep->V,f,NULL,&beta,&breakdown);CHKERRQ(ierr); if (breakdown || beta==0.0) { ierr = PetscInfo1(nep,"iter=%D, orthogonalization failed, stopping solve\n",nep->its);CHKERRQ(ierr); nep->reason = NEP_DIVERGED_BREAKDOWN; break; } ierr = VecScale(f,1.0/beta);CHKERRQ(ierr); /* update projected matrices */ ierr = NEPProjectOperator(nep,n,n+1,r);CHKERRQ(ierr); n++; } if (nep->its >= nep->max_it) nep->reason = NEP_DIVERGED_MAX_IT; } ierr = MatDestroy(&Tsigma);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPCreate_NARNOLDI" PETSC_EXTERN PetscErrorCode NEPCreate_NARNOLDI(NEP nep) { PetscFunctionBegin; nep->ops->solve = NEPSolve_NARNOLDI; nep->ops->setup = NEPSetUp_NARNOLDI; nep->ops->reset = NEPReset_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/makefile0000644000175000017500000000214312211062077016504 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/nepimpl.h ../../include/slepcnep.h DIRS = interface impls examples LOCDIR = src/nep/ MANSEC = NEP include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/makefile.html0000644000175000017500000000373712211062077017461 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/nepimpl.h ../../include/slepcnep.h
DIRS     = interface impls examples
LOCDIR   = src/nep/
MANSEC   = NEP

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/nep/interface/0000755000175000017500000000000012214143515016744 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/interface/nepmon.c0000644000175000017500000003161312211062077020410 0ustar gladkgladk/* NEP routines related to monitors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "NEPMonitor" /* Runs the user provided monitor routines, if any. */ PetscErrorCode NEPMonitor(NEP nep,PetscInt it,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest) { PetscErrorCode ierr; PetscInt i,n = nep->numbermonitors; PetscFunctionBegin; for (i=0;imonitor[i])(nep,it,nconv,eig,errest,nest,nep->monitorcontext[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorSet" /*@C NEPMonitorSet - Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair. Logically Collective on NEP Input Parameters: + nep - eigensolver context obtained from NEPCreate() . monitor - pointer to function (if this is NULL, it turns off monitoring) . mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired) - monitordestroy - [optional] routine that frees monitor context (may be NULL) Calling Sequence of monitor: $ monitor (NEP nep, int its, int nconv, PetscScalar *eig, PetscReal* errest, int nest, void *mctx) + nep - nonlinear eigensolver context obtained from NEPCreate() . its - iteration number . nconv - number of converged eigenpairs . eig - eigenvalues . errest - error estimates for each eigenpair . nest - number of error estimates - mctx - optional monitoring context, as set by NEPMonitorSet() Options Database Keys: + -nep_monitor - print only the first error estimate . -nep_monitor_all - print error estimates at each iteration . -nep_monitor_conv - print the eigenvalue approximations only when convergence has been reached . -nep_monitor_lg - sets line graph monitor for the first unconverged approximate eigenvalue . -nep_monitor_lg_all - sets line graph monitor for all unconverged approximate eigenvalues - -nep_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to NEPMonitorSet(), but does not cancel those set via the options database. Notes: Several different monitoring routines may be set by calling NEPMonitorSet() multiple times; all will be called in the order in which they were set. Level: intermediate .seealso: NEPMonitorFirst(), NEPMonitorAll(), NEPMonitorCancel() @*/ PetscErrorCode NEPMonitorSet(NEP nep,PetscErrorCode (*monitor)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**)) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (nep->numbermonitors >= MAXNEPMONITORS) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Too many NEP monitors set"); nep->monitor[nep->numbermonitors] = monitor; nep->monitorcontext[nep->numbermonitors] = (void*)mctx; nep->monitordestroy[nep->numbermonitors++] = monitordestroy; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorCancel" /*@ NEPMonitorCancel - Clears all monitors for a NEP object. Logically Collective on NEP Input Parameters: . nep - eigensolver context obtained from NEPCreate() Options Database Key: . -nep_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to NEPMonitorSet(), but does not cancel those set via the options database. Level: intermediate .seealso: NEPMonitorSet() @*/ PetscErrorCode NEPMonitorCancel(NEP nep) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); for (i=0; inumbermonitors; i++) { if (nep->monitordestroy[i]) { ierr = (*nep->monitordestroy[i])(&nep->monitorcontext[i]);CHKERRQ(ierr); } } nep->numbermonitors = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetMonitorContext" /*@C NEPGetMonitorContext - Gets the monitor context, as set by NEPMonitorSet() for the FIRST monitor only. Not Collective Input Parameter: . nep - eigensolver context obtained from NEPCreate() Output Parameter: . ctx - monitor context Level: intermediate .seealso: NEPMonitorSet(), NEPDefaultMonitor() @*/ PetscErrorCode NEPGetMonitorContext(NEP nep,void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); *ctx = nep->monitorcontext[0]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorAll" /*@C NEPMonitorAll - Print the current approximate values and error estimates at each iteration of the nonlinear eigensolver. Collective on NEP Input Parameters: + nep - nonlinear eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eig - eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: NEPMonitorSet(), NEPMonitorFirst(), NEPMonitorConverged() @*/ PetscErrorCode NEPMonitorAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep)); PetscFunctionBegin; if (its) { ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)nep)->tablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D NEP nconv=%D Values (Errors)",its,nconv);CHKERRQ(ierr); for (i=0;itablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorFirst" /*@C NEPMonitorFirst - Print the first unconverged approximate value and error estimate at each iteration of the nonlinear eigensolver. Collective on NEP Input Parameters: + nep - nonlinear eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eig - eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: NEPMonitorSet(), NEPMonitorAll(), NEPMonitorConverged() @*/ PetscErrorCode NEPMonitorFirst(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep)); PetscFunctionBegin; if (its && nconvtablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D NEP nconv=%D first unconverged value (error)",its,nconv);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eig[nconv]),PetscImaginaryPart(eig[nconv]));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",eig[nconv]);CHKERRQ(ierr); #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[nconv]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)nep)->tablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorConverged" /*@C NEPMonitorConverged - Print the approximate values and error estimates as they converge. Collective on NEP Input Parameters: + nep - nonlinear eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eig - eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context Level: intermediate Note: The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT. .seealso: NEPMonitorSet(), NEPMonitorFirst(), NEPMonitorAll() @*/ PetscErrorCode NEPMonitorConverged(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscViewer viewer; SlepcConvMonitor ctx = (SlepcConvMonitor)monctx; PetscFunctionBegin; if (!monctx) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_WRONG,"Must provide a context for NEPMonitorConverged"); if (!its) { ctx->oldnconv = 0; } else { viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep)); for (i=ctx->oldnconv;itablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D NEP converged value (error) #%D",its,i);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eig[i]),PetscImaginaryPart(eig[i]));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",eig[i]);CHKERRQ(ierr); #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)nep)->tablevel);CHKERRQ(ierr); } ctx->oldnconv = nconv; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorLG" PetscErrorCode NEPMonitorLG(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw; PetscDrawLG lg; PetscErrorCode ierr; PetscReal x,y; PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)nep)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(nep->rtol)-2,0.0);CHKERRQ(ierr); } x = (PetscReal)its; if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0; ierr = PetscDrawLGAddPoint(lg,&x,&y);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPMonitorLGAll" PetscErrorCode NEPMonitorLGAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw; PetscDrawLG lg; PetscErrorCode ierr; PetscReal *x,*y; PetscInt i,n = PetscMin(nep->nev,255); PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)nep)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,n);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(nep->rtol)-2,0.0);CHKERRQ(ierr); } ierr = PetscMalloc(sizeof(PetscReal)*n,&x);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscReal)*n,&y);CHKERRQ(ierr); for (i=0;i 0.0) y[i] = log10(errest[i]); else y[i] = 0.0; } ierr = PetscDrawLGAddPoint(lg,x,y);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); ierr = PetscFree(x);CHKERRQ(ierr); ierr = PetscFree(y);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/nepsetup.c.html0000644000175000017500000004547712211062077021737 0ustar gladkgladk
Actual source code: nepsetup.c

  1: /*
  2:       NEP routines related to problem setup.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/nepimpl.h>       /*I "slepcnep.h" I*/
 25: #include <slepc-private/ipimpl.h>

 29: /*@
 30:    NEPSetUp - Sets up all the internal data structures necessary for the
 31:    execution of the NEP solver.

 33:    Collective on NEP

 35:    Input Parameter:
 36: .  nep   - solver context

 38:    Notes:
 39:    This function need not be called explicitly in most cases, since NEPSolve()
 40:    calls it. It can be useful when one wants to measure the set-up time
 41:    separately from the solve time.

 43:    Level: advanced

 45: .seealso: NEPCreate(), NEPSolve(), NEPDestroy()
 46: @*/
 47: PetscErrorCode NEPSetUp(NEP nep)
 48: {
 50:   Mat            T;

 54:   if (nep->setupcalled) return(0);
 55:   PetscLogEventBegin(NEP_SetUp,nep,0,0,0);

 57:   /* reset the convergence flag from the previous solves */
 58:   nep->reason = NEP_CONVERGED_ITERATING;

 60:   /* Set default solver type (NEPSetFromOptions was not called) */
 61:   if (!((PetscObject)nep)->type_name) {
 62:     NEPSetType(nep,NEPRII);
 63:   }
 64:   if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
 65:   if (!((PetscObject)nep->ip)->type_name) {
 66:     IPSetType_Default(nep->ip);
 67:   }
 68:   if (!nep->ds) { NEPGetDS(nep,&nep->ds); }
 69:   DSReset(nep->ds);
 70:   if (!((PetscObject)nep->rand)->type_name) {
 71:     PetscRandomSetFromOptions(nep->rand);
 72:   }
 73:   if (!nep->ksp) {
 74:     NEPGetKSP(nep,&nep->ksp);
 75:   }

 77:   /* by default, compute eigenvalues close to target */
 78:   /* nep->target should contain the initial guess for the eigenvalue */
 79:   if (!nep->which) nep->which = NEP_TARGET_MAGNITUDE;

 81:   /* set problem dimensions */
 82:   VecDestroy(&nep->t);
 83:   if (nep->split) {
 84:     MatDuplicate(nep->A[0],MAT_DO_NOT_COPY_VALUES,&nep->function);
 85:     MatDuplicate(nep->A[0],MAT_DO_NOT_COPY_VALUES,&nep->jacobian);
 86:     PetscLogObjectParent(nep,nep->function);
 87:     PetscLogObjectParent(nep,nep->jacobian);
 88:     SlepcMatGetVecsTemplate(nep->A[0],&nep->t,NULL);
 89:   } else {
 90:     NEPGetFunction(nep,&T,NULL,NULL,NULL);
 91:     SlepcMatGetVecsTemplate(T,&nep->t,NULL);
 92:   }
 93:   PetscLogObjectParent(nep,nep->t);
 94:   VecGetSize(nep->t,&nep->n);
 95:   VecGetLocalSize(nep->t,&nep->nloc);

 97:   /* call specific solver setup */
 98:   (*nep->ops->setup)(nep);

100:   /* set tolerances if not yet set */
101:   if (nep->abstol==PETSC_DEFAULT) nep->abstol = 1e-50;
102:   if (nep->rtol==PETSC_DEFAULT) nep->rtol = 100*SLEPC_DEFAULT_TOL;
103:   if (nep->stol==PETSC_DEFAULT) nep->stol = SLEPC_DEFAULT_TOL;
104:   nep->ktol   = 0.1;
105:   nep->nfuncs = 0;
106:   nep->linits = 0;

108:   /* set eigenvalue comparison */
109:   switch (nep->which) {
110:     case NEP_LARGEST_MAGNITUDE:
111:       nep->comparison    = SlepcCompareLargestMagnitude;
112:       nep->comparisonctx = NULL;
113:       break;
114:     case NEP_SMALLEST_MAGNITUDE:
115:       nep->comparison    = SlepcCompareSmallestMagnitude;
116:       nep->comparisonctx = NULL;
117:       break;
118:     case NEP_LARGEST_REAL:
119:       nep->comparison    = SlepcCompareLargestReal;
120:       nep->comparisonctx = NULL;
121:       break;
122:     case NEP_SMALLEST_REAL:
123:       nep->comparison    = SlepcCompareSmallestReal;
124:       nep->comparisonctx = NULL;
125:       break;
126:     case NEP_LARGEST_IMAGINARY:
127:       nep->comparison    = SlepcCompareLargestImaginary;
128:       nep->comparisonctx = NULL;
129:       break;
130:     case NEP_SMALLEST_IMAGINARY:
131:       nep->comparison    = SlepcCompareSmallestImaginary;
132:       nep->comparisonctx = NULL;
133:       break;
134:     case NEP_TARGET_MAGNITUDE:
135:       nep->comparison    = SlepcCompareTargetMagnitude;
136:       nep->comparisonctx = &nep->target;
137:       break;
138:     case NEP_TARGET_REAL:
139:       nep->comparison    = SlepcCompareTargetReal;
140:       nep->comparisonctx = &nep->target;
141:       break;
142:     case NEP_TARGET_IMAGINARY:
143:       nep->comparison    = SlepcCompareTargetImaginary;
144:       nep->comparisonctx = &nep->target;
145:       break;
146:   }

148:   if (nep->ncv > 2*nep->n) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"ncv must be twice the problem size at most");
149:   if (nep->nev > nep->ncv) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"nev bigger than ncv");

151:   /* process initial vectors */
152:   if (nep->nini<0) {
153:     nep->nini = -nep->nini;
154:     if (nep->nini>nep->ncv) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The number of initial vectors is larger than ncv");
155:     IPOrthonormalizeBasis_Private(nep->ip,&nep->nini,&nep->IS,nep->V);
156:   }
157:   PetscLogEventEnd(NEP_SetUp,nep,0,0,0);
158:   nep->setupcalled = 1;
159:   return(0);
160: }

164: /*@
165:    NEPSetInitialSpace - Specify a basis of vectors that constitute the initial
166:    space, that is, the subspace from which the solver starts to iterate.

168:    Collective on NEP and Vec

170:    Input Parameter:
171: +  nep   - the nonlinear eigensolver context
172: .  n     - number of vectors
173: -  is    - set of basis vectors of the initial space

175:    Notes:
176:    Some solvers start to iterate on a single vector (initial vector). In that case,
177:    the other vectors are ignored.

179:    These vectors do not persist from one NEPSolve() call to the other, so the
180:    initial space should be set every time.

182:    The vectors do not need to be mutually orthonormal, since they are explicitly
183:    orthonormalized internally.

185:    Common usage of this function is when the user can provide a rough approximation
186:    of the wanted eigenspace. Then, convergence may be faster.

188:    Level: intermediate
189: @*/
190: PetscErrorCode NEPSetInitialSpace(NEP nep,PetscInt n,Vec *is)
191: {

197:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
198:   SlepcBasisReference_Private(n,is,&nep->nini,&nep->IS);
199:   if (n>0) nep->setupcalled = 0;
200:   return(0);
201: }

205: /*
206:   NEPAllocateSolution - Allocate memory storage for common variables such
207:   as eigenvalues and eigenvectors. All vectors in V (and W) share a
208:   contiguous chunk of memory.
209: */
210: PetscErrorCode NEPAllocateSolution(NEP nep)
211: {
213:   PetscInt       newc,cnt;

216:   if (nep->allocated_ncv != nep->ncv) {
217:     newc = PetscMax(0,nep->ncv-nep->allocated_ncv);
218:     NEPFreeSolution(nep);
219:     cnt = 0;
220:     PetscMalloc(nep->ncv*sizeof(PetscScalar),&nep->eig);
221:     cnt += 2*newc*sizeof(PetscScalar);
222:     PetscMalloc(nep->ncv*sizeof(PetscReal),&nep->errest);
223:     PetscMalloc(nep->ncv*sizeof(PetscInt),&nep->perm);
224:     cnt += 2*newc*sizeof(PetscReal);
225:     PetscLogObjectMemory(nep,cnt);
226:     VecDuplicateVecs(nep->t,nep->ncv,&nep->V);
227:     PetscLogObjectParents(nep,nep->ncv,nep->V);
228:     nep->allocated_ncv = nep->ncv;
229:   }
230:   return(0);
231: }

235: /*
236:   NEPFreeSolution - Free memory storage. This routine is related to
237:   NEPAllocateSolution().
238: */
239: PetscErrorCode NEPFreeSolution(NEP nep)
240: {

244:   if (nep->allocated_ncv > 0) {
245:     PetscFree(nep->eig);
246:     PetscFree(nep->errest);
247:     PetscFree(nep->perm);
248:     VecDestroyVecs(nep->allocated_ncv,&nep->V);
249:     nep->allocated_ncv = 0;
250:   }
251:   return(0);
252: }

slepc-3.4.2.dfsg.orig/src/nep/interface/nepopts.c0000644000175000017500000007435112211062077020612 0ustar gladkgladk/* NEP routines related to options that can be set via the command-line or procedurally. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #undef __FUNCT__ #define __FUNCT__ "NEPSetFromOptions" /*@ NEPSetFromOptions - Sets NEP options from the options database. This routine must be called before NEPSetUp() if the user is to be allowed to set the solver type. Collective on NEP Input Parameters: . nep - the nonlinear eigensolver context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode NEPSetFromOptions(NEP nep) { PetscErrorCode ierr; char type[256],monfilename[PETSC_MAX_PATH_LEN]; PetscBool flg; PetscReal r1,r2,r3; PetscScalar s; PetscInt i,j,k; PetscViewer monviewer; SlepcConvMonitor ctx; MatStructure matflag; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (!NEPRegisterAllCalled) { ierr = NEPRegisterAll();CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)nep);CHKERRQ(ierr); ierr = PetscOptionsList("-nep_type","Nonlinear Eigenvalue Problem method","NEPSetType",NEPList,(char*)(((PetscObject)nep)->type_name?((PetscObject)nep)->type_name:NEPRII),type,256,&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetType(nep,type);CHKERRQ(ierr); } else if (!((PetscObject)nep)->type_name) { ierr = NEPSetType(nep,NEPRII);CHKERRQ(ierr); } r1 = r2 = r3 = i = j = 0; ierr = PetscOptionsInt("-nep_max_it","Maximum number of iterations","NEPSetTolerances",nep->max_it,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-nep_max_funcs","Maximum number of function evaluations","NEPSetTolerances",nep->max_funcs,&j,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-nep_atol","Absolute tolerance for residual norm","NEPSetTolerances",nep->abstol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:nep->abstol,&r1,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-nep_rtol","Relative tolerance for residual norm","NEPSetTolerances",nep->rtol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:nep->rtol,&r2,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-nep_stol","Relative tolerance for step length","NEPSetTolerances",nep->stol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:nep->stol,&r3,NULL);CHKERRQ(ierr); ierr = NEPSetTolerances(nep,r1,r2,r3,i,j);CHKERRQ(ierr); flg = PETSC_FALSE; ierr = PetscOptionsBool("-nep_convergence_default","Default (relative error) convergence test","NEPSetConvergenceTest",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = NEPSetConvergenceTest(nep,NEPConvergedDefault,NULL,NULL);CHKERRQ(ierr); } i = j = k = 0; ierr = PetscOptionsInt("-nep_nev","Number of eigenvalues to compute","NEPSetDimensions",nep->nev,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-nep_ncv","Number of basis vectors","NEPSetDimensions",nep->ncv,&j,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-nep_mpd","Maximum dimension of projected problem","NEPSetDimensions",nep->mpd,&k,NULL);CHKERRQ(ierr); ierr = NEPSetDimensions(nep,i,j,k);CHKERRQ(ierr); i = 0; ierr = PetscOptionsInt("-nep_lag_preconditioner","Interval to rebuild preconditioner","NEPSetLagPreconditioner",nep->lag,&i,&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetLagPreconditioner(nep,i);CHKERRQ(ierr); } ierr = PetscOptionsBool("-nep_const_correction_tol","Constant correction tolerance for the linear solver","NEPSetConstCorrectionTol",nep->cctol,&nep->cctol,NULL);CHKERRQ(ierr); ierr = PetscOptionsScalar("-nep_target","Value of the target","NEPSetTarget",nep->target,&s,&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_TARGET_MAGNITUDE);CHKERRQ(ierr); ierr = NEPSetTarget(nep,s);CHKERRQ(ierr); } /* -----------------------------------------------------------------------*/ /* Cancels all monitors hardwired into code before call to NEPSetFromOptions() */ flg = PETSC_FALSE; ierr = PetscOptionsBool("-nep_monitor_cancel","Remove any hardwired monitor routines","NEPMonitorCancel",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = NEPMonitorCancel(nep);CHKERRQ(ierr); } /* Prints approximate eigenvalues and error estimates at each iteration */ ierr = PetscOptionsString("-nep_monitor","Monitor first unconverged approximate eigenvalue and error estimate","NEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)nep),monfilename,&monviewer);CHKERRQ(ierr); ierr = NEPMonitorSet(nep,NEPMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-nep_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","NEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);CHKERRQ(ierr); ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)nep),monfilename,&ctx->viewer);CHKERRQ(ierr); ierr = NEPMonitorSet(nep,NEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-nep_monitor_all","Monitor approximate eigenvalues and error estimates","NEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)nep),monfilename,&monviewer);CHKERRQ(ierr); ierr = NEPMonitorSet(nep,NEPMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); ierr = NEPSetTrackAll(nep,PETSC_TRUE);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-nep_monitor_lg","Monitor first unconverged approximate error estimate graphically","NEPMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = NEPMonitorSet(nep,NEPMonitorLG,NULL,NULL);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-nep_monitor_lg_all","Monitor error estimates graphically","NEPMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = NEPMonitorSet(nep,NEPMonitorLGAll,NULL,NULL);CHKERRQ(ierr); ierr = NEPSetTrackAll(nep,PETSC_TRUE);CHKERRQ(ierr); } /* -----------------------------------------------------------------------*/ ierr = PetscOptionsBoolGroupBegin("-nep_largest_magnitude","compute largest eigenvalues in magnitude","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_LARGEST_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_smallest_magnitude","compute smallest eigenvalues in magnitude","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_SMALLEST_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_largest_real","compute largest real parts","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_LARGEST_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_smallest_real","compute smallest real parts","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_SMALLEST_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_largest_imaginary","compute largest imaginary parts","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_LARGEST_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_smallest_imaginary","compute smallest imaginary parts","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_SMALLEST_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_target_magnitude","compute nearest eigenvalues to target","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_TARGET_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-nep_target_real","compute eigenvalues with real parts close to target","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_TARGET_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-nep_target_imaginary","compute eigenvalues with imaginary parts close to target","NEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = NEPSetWhichEigenpairs(nep,NEP_TARGET_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsName("-nep_view","Print detailed information on solver used","NEPView",0);CHKERRQ(ierr); ierr = PetscOptionsName("-nep_plot_eigs","Make a plot of the computed eigenvalues","NEPSolve",0);CHKERRQ(ierr); if (nep->ops->setfromoptions) { ierr = (*nep->ops->setfromoptions)(nep);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)nep);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } ierr = IPSetFromOptions(nep->ip);CHKERRQ(ierr); if (!nep->ds) { ierr = NEPGetDS(nep,&nep->ds);CHKERRQ(ierr); } ierr = DSSetFromOptions(nep->ds);CHKERRQ(ierr); if (!nep->ksp) { ierr = NEPGetKSP(nep,&nep->ksp);CHKERRQ(ierr); } ierr = KSPGetOperators(nep->ksp,NULL,NULL,&matflag);CHKERRQ(ierr); ierr = KSPSetOperators(nep->ksp,nep->function,nep->function_pre,matflag);CHKERRQ(ierr); ierr = KSPSetFromOptions(nep->ksp);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(nep->rand);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetTolerances" /*@ NEPGetTolerances - Gets the tolerance and maximum iteration count used by the NEP convergence tests. Not Collective Input Parameter: . nep - the nonlinear eigensolver context Output Parameters: + abstol - absolute convergence tolerance . rtol - relative convergence tolerance . stol - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x || . maxit - maximum number of iterations - maxf - maximum number of function evaluations Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: NEPSetTolerances() @*/ PetscErrorCode NEPGetTolerances(NEP nep,PetscReal *abstol,PetscReal *rtol,PetscReal *stol,PetscInt *maxit,PetscInt *maxf) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (abstol) *abstol = nep->abstol; if (rtol) *rtol = nep->rtol; if (stol) *stol = nep->stol; if (maxit) *maxit = nep->max_it; if (maxf) *maxf = nep->max_funcs; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetTolerances" /*@ NEPSetTolerances - Sets various parameters used in convergence tests. Logically Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context . abstol - absolute convergence tolerance . rtol - relative convergence tolerance . stol - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x || . maxit - maximum number of iterations - maxf - maximum number of function evaluations Options Database Keys: + -nep_atol - Sets abstol . -nep_rtol - Sets rtol . -nep_stol - Sets stol . -nep_max_it - Sets maxit - -nep_max_funcs - Sets maxf Notes: Pass 0 for an argument that need not be changed. Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method. Level: intermediate .seealso: NEPGetTolerances() @*/ PetscErrorCode NEPSetTolerances(NEP nep,PetscReal abstol,PetscReal rtol,PetscReal stol,PetscInt maxit,PetscInt maxf) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveReal(nep,abstol,2); PetscValidLogicalCollectiveReal(nep,rtol,3); PetscValidLogicalCollectiveReal(nep,stol,4); PetscValidLogicalCollectiveInt(nep,maxit,5); PetscValidLogicalCollectiveInt(nep,maxf,6); if (abstol) { if (abstol == PETSC_DEFAULT) { nep->abstol = PETSC_DEFAULT; } else { if (abstol < 0.0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Absolute tolerance %G must be non-negative",abstol); nep->abstol = abstol; } } if (rtol) { if (rtol == PETSC_DEFAULT) { nep->rtol = PETSC_DEFAULT; } else { if (rtol < 0.0 || 1.0 <= rtol) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Relative tolerance %G must be non-negative and less than 1.0",rtol); nep->rtol = rtol; } } if (stol) { if (stol == PETSC_DEFAULT) { nep->stol = PETSC_DEFAULT; } else { if (stol < 0.0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Step tolerance %G must be non-negative",stol); nep->stol = stol; } } if (maxit) { if (maxit == PETSC_DEFAULT || maxit == PETSC_DECIDE) { nep->max_it = 0; nep->setupcalled = 0; } else { if (maxit < 0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Maximum number of iterations %D must be non-negative",maxit); nep->max_it = maxit; } } if (maxf) { if (maxf == PETSC_DEFAULT || maxf == PETSC_DECIDE) { nep->max_it = 0; nep->setupcalled = 0; } else { if (maxf < 0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Maximum number of function evaluations %D must be non-negative",maxf); nep->max_funcs = maxf; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetDimensions" /*@ NEPGetDimensions - Gets the number of eigenvalues to compute and the dimension of the subspace. Not Collective Input Parameter: . nep - the nonlinear eigensolver context Output Parameters: + nev - number of eigenvalues to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: NEPSetDimensions() @*/ PetscErrorCode NEPGetDimensions(NEP nep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (nev) *nev = nep->nev; if (ncv) *ncv = nep->ncv; if (mpd) *mpd = nep->mpd; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetDimensions" /*@ NEPSetDimensions - Sets the number of eigenvalues to compute and the dimension of the subspace. Logically Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context . nev - number of eigenvalues to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Options Database Keys: + -nep_nev - Sets the number of eigenvalues . -nep_ncv - Sets the dimension of the subspace - -nep_mpd - Sets the maximum projected dimension Notes: Pass 0 to retain the previous value of any parameter. Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method. The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and (b) in cases where nev is large, the user sets mpd. The value of ncv should always be between nev and (nev+mpd), typically ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise a smaller value should be used. Level: intermediate .seealso: NEPGetDimensions() @*/ PetscErrorCode NEPSetDimensions(NEP nep,PetscInt nev,PetscInt ncv,PetscInt mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,nev,2); PetscValidLogicalCollectiveInt(nep,ncv,3); PetscValidLogicalCollectiveInt(nep,mpd,4); if (nev) { if (nev<1) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0"); nep->nev = nev; nep->setupcalled = 0; } if (ncv) { if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) { nep->ncv = 0; } else { if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0"); nep->ncv = ncv; } nep->setupcalled = 0; } if (mpd) { if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) { nep->mpd = 0; } else { if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0"); nep->mpd = mpd; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetWhichEigenpairs" /*@ NEPSetWhichEigenpairs - Specifies which portion of the spectrum is to be sought. Logically Collective on NEP Input Parameters: + nep - eigensolver context obtained from NEPCreate() - which - the portion of the spectrum to be sought Possible values: The parameter 'which' can have one of these values + NEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default) . NEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude . NEP_LARGEST_REAL - largest real parts . NEP_SMALLEST_REAL - smallest real parts . NEP_LARGEST_IMAGINARY - largest imaginary parts . NEP_SMALLEST_IMAGINARY - smallest imaginary parts . NEP_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude) . NEP_TARGET_REAL - eigenvalues with real part closest to target - NEP_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target Options Database Keys: + -nep_largest_magnitude - Sets largest eigenvalues in magnitude . -nep_smallest_magnitude - Sets smallest eigenvalues in magnitude . -nep_largest_real - Sets largest real parts . -nep_smallest_real - Sets smallest real parts . -nep_largest_imaginary - Sets largest imaginary parts . -nep_smallest_imaginary - Sets smallest imaginary parts . -nep_target_magnitude - Sets eigenvalues closest to target . -nep_target_real - Sets real parts closest to target - -nep_target_imaginary - Sets imaginary parts closest to target Notes: Not all eigensolvers implemented in NEP account for all the possible values stated above. If SLEPc is compiled for real numbers NEP_LARGEST_IMAGINARY and NEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection. Level: intermediate .seealso: NEPGetWhichEigenpairs(), NEPWhich @*/ PetscErrorCode NEPSetWhichEigenpairs(NEP nep,NEPWhich which) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveEnum(nep,which,2); if (which) { if (which==PETSC_DECIDE || which==PETSC_DEFAULT) nep->which = (NEPWhich)0; else switch (which) { case NEP_LARGEST_MAGNITUDE: case NEP_SMALLEST_MAGNITUDE: case NEP_LARGEST_REAL: case NEP_SMALLEST_REAL: case NEP_LARGEST_IMAGINARY: case NEP_SMALLEST_IMAGINARY: case NEP_TARGET_MAGNITUDE: case NEP_TARGET_REAL: #if defined(PETSC_USE_COMPLEX) case NEP_TARGET_IMAGINARY: #endif if (nep->which != which) { nep->setupcalled = 0; nep->which = which; } break; default: SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value"); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetWhichEigenpairs" /*@C NEPGetWhichEigenpairs - Returns which portion of the spectrum is to be sought. Not Collective Input Parameter: . nep - eigensolver context obtained from NEPCreate() Output Parameter: . which - the portion of the spectrum to be sought Notes: See NEPSetWhichEigenpairs() for possible values of 'which'. Level: intermediate .seealso: NEPSetWhichEigenpairs(), NEPWhich @*/ PetscErrorCode NEPGetWhichEigenpairs(NEP nep,NEPWhich *which) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(which,2); *which = nep->which; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetLagPreconditioner" /*@ NEPSetLagPreconditioner - Determines when the preconditioner is rebuilt in the nonlinear solve. Logically Collective on NEP Input Parameters: + nep - the NEP context - lag - 0 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within the nonlinear iteration, 2 means every second time the Jacobian is built, etc. Options Database Keys: . -nep_lag_preconditioner Notes: The default is 1. The preconditioner is ALWAYS built in the first iteration of a nonlinear solve. Level: intermediate .seealso: NEPGetLagPreconditioner() @*/ PetscErrorCode NEPSetLagPreconditioner(NEP nep,PetscInt lag) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,lag,2); if (lag<0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Lag must be non-negative"); nep->lag = lag; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetLagPreconditioner" /*@ NEPGetLagPreconditioner - Indicates how often the preconditioner is rebuilt. Not Collective Input Parameter: . nep - the NEP context Output Parameter: . lag - the lag parameter Level: intermediate .seealso: NEPSetLagPreconditioner() @*/ PetscErrorCode NEPGetLagPreconditioner(NEP nep,PetscInt *lag) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(lag,2); *lag = nep->lag; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetConstCorrectionTol" /*@ NEPSetConstCorrectionTol - Sets a flag to keep the tolerance used in the linear solver constant. Logically Collective on NEP Input Parameters: + nep - the NEP context - cct - a boolean value Options Database Keys: . -nep_const_correction_tol Notes: By default, an exponentially decreasing tolerance is set in the KSP used within the nonlinear iteration, so that each Newton iteration requests better accuracy than the previous one. The constant correction tolerance flag stops this behaviour. Level: intermediate .seealso: NEPGetConstCorrectionTol() @*/ PetscErrorCode NEPSetConstCorrectionTol(NEP nep,PetscBool cct) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveBool(nep,cct,2); nep->cctol = cct; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetConstCorrectionTol" /*@ NEPGetConstCorrectionTol - Returns the constant tolerance flag. Not Collective Input Parameter: . nep - the NEP context Output Parameter: . cct - the value of the constant tolerance flag Level: intermediate .seealso: NEPSetConstCorrectionTol() @*/ PetscErrorCode NEPGetConstCorrectionTol(NEP nep,PetscBool *cct) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(cct,2); *cct = nep->cctol; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetConvergenceTest" /*@C NEPSetConvergenceTest - Sets the function to be used to test convergence of the nonlinear iterative solution. Logically Collective on NEP Input Parameters: + nep - the NEP context . func - a pointer to the convergence test function . ctx - [optional] context for private data for the convergence routine (may be NULL) - destroy - [optional] destructor for the context (may be NULL; PETSC_NULL_FUNCTION in Fortran) Calling Sequence of func: $ func(NEP nep,PetscInt it,PetscReal xnorm,PetscReal snorm,PetscReal fnorm,NEPConvergedReason reason*,void *fctx) + nep - the NEP context . it - iteration number . xnorm - norm of the current solution . snorm - norm of the step (difference between two consecutive solutions) . fnorm - norm of the function (residual) . reason - (output) result of the convergence test - fctx - optional context, as set by NEPSetConvergenceTest() Level: advanced .seealso: NEPSetTolerances() @*/ PetscErrorCode NEPSetConvergenceTest(NEP nep,PetscErrorCode (*func)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void* ctx,PetscErrorCode (*destroy)(void*)) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (nep->convergeddestroy) { ierr = (*nep->convergeddestroy)(nep->convergedctx);CHKERRQ(ierr); } nep->converged = func; nep->convergeddestroy = destroy; nep->convergedctx = ctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetTrackAll" /*@ NEPSetTrackAll - Specifies if the solver must compute the residual of all approximate eigenpairs or not. Logically Collective on NEP Input Parameters: + nep - the eigensolver context - trackall - whether compute all residuals or not Notes: If the user sets trackall=PETSC_TRUE then the solver explicitly computes the residual for each eigenpair approximation. Computing the residual is usually an expensive operation and solvers commonly compute the associated residual to the first unconverged eigenpair. The options '-nep_monitor_all' and '-nep_monitor_lg_all' automatically activate this option. Level: intermediate .seealso: NEPGetTrackAll() @*/ PetscErrorCode NEPSetTrackAll(NEP nep,PetscBool trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveBool(nep,trackall,2); nep->trackall = trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetTrackAll" /*@ NEPGetTrackAll - Returns the flag indicating whether all residual norms must be computed or not. Not Collective Input Parameter: . nep - the eigensolver context Output Parameter: . trackall - the returned flag Level: intermediate .seealso: NEPSetTrackAll() @*/ PetscErrorCode NEPGetTrackAll(NEP nep,PetscBool *trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(trackall,2); *trackall = nep->trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetOptionsPrefix" /*@C NEPSetOptionsPrefix - Sets the prefix used for searching for all NEP options in the database. Logically Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context - prefix - the prefix string to prepend to all NEP option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different NEP contexts, one could call .vb NEPSetOptionsPrefix(nep1,"neig1_") NEPSetOptionsPrefix(nep2,"neig2_") .ve Level: advanced .seealso: NEPAppendOptionsPrefix(), NEPGetOptionsPrefix() @*/ PetscErrorCode NEPSetOptionsPrefix(NEP nep,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(nep->ip,prefix);CHKERRQ(ierr); if (!nep->ds) { ierr = NEPGetDS(nep,&nep->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(nep->ds,prefix);CHKERRQ(ierr); if (!nep->ksp) { ierr = NEPGetKSP(nep,&nep->ksp);CHKERRQ(ierr); } ierr = KSPSetOptionsPrefix(nep->ksp,prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(nep->ksp,"nep_");CHKERRQ(ierr); ierr = PetscObjectSetOptionsPrefix((PetscObject)nep,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPAppendOptionsPrefix" /*@C NEPAppendOptionsPrefix - Appends to the prefix used for searching for all NEP options in the database. Logically Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context - prefix - the prefix string to prepend to all NEP option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: NEPSetOptionsPrefix(), NEPGetOptionsPrefix() @*/ PetscErrorCode NEPAppendOptionsPrefix(NEP nep,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(nep->ip,prefix);CHKERRQ(ierr); if (!nep->ds) { ierr = NEPGetDS(nep,&nep->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(nep->ds,prefix);CHKERRQ(ierr); if (!nep->ksp) { ierr = NEPGetKSP(nep,&nep->ksp);CHKERRQ(ierr); } ierr = KSPSetOptionsPrefix(nep->ksp,prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(nep->ksp,"nep_");CHKERRQ(ierr); ierr = PetscObjectAppendOptionsPrefix((PetscObject)nep,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetOptionsPrefix" /*@C NEPGetOptionsPrefix - Gets the prefix used for searching for all NEP options in the database. Not Collective Input Parameters: . nep - the nonlinear eigensolver context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: NEPSetOptionsPrefix(), NEPAppendOptionsPrefix() @*/ PetscErrorCode NEPGetOptionsPrefix(NEP nep,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)nep,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/nepsolve.c0000644000175000017500000006320012211062077020744 0ustar gladkgladk/* NEP routines related to the solution process. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "NEPSolve" /*@ NEPSolve - Solves the nonlinear eigensystem. Collective on NEP Input Parameter: . nep - eigensolver context obtained from NEPCreate() Options Database Keys: + -nep_view - print information about the solver used - -nep_plot_eigs - plot computed eigenvalues Level: beginner .seealso: NEPCreate(), NEPSetUp(), NEPDestroy(), NEPSetTolerances() @*/ PetscErrorCode NEPSolve(NEP nep) { PetscErrorCode ierr; PetscInt i; PetscReal re,im; PetscBool flg; PetscViewer viewer; PetscViewerFormat format; PetscDraw draw; PetscDrawSP drawsp; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); ierr = PetscLogEventBegin(NEP_Solve,nep,0,0,0);CHKERRQ(ierr); /* call setup */ ierr = NEPSetUp(nep);CHKERRQ(ierr); nep->nconv = 0; nep->its = 0; for (i=0;incv;i++) { nep->eig[i] = 0.0; nep->errest[i] = 0.0; } nep->ktol = 0.1; ierr = NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,nep->ncv);CHKERRQ(ierr); ierr = DSSetEigenvalueComparison(nep->ds,nep->comparison,nep->comparisonctx);CHKERRQ(ierr); ierr = (*nep->ops->solve)(nep);CHKERRQ(ierr); if (!nep->reason) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason"); /* sort eigenvalues according to nep->which parameter */ ierr = NEPSortEigenvalues(nep,nep->nconv,nep->eig,nep->perm);CHKERRQ(ierr); ierr = PetscLogEventEnd(NEP_Solve,nep,0,0,0);CHKERRQ(ierr); /* various viewers */ ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)nep),((PetscObject)nep)->prefix,"-nep_view",&viewer,&format,&flg);CHKERRQ(ierr); if (flg && !PetscPreLoadingOn) { ierr = PetscViewerPushFormat(viewer,format);CHKERRQ(ierr); ierr = NEPView(nep,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsGetBool(((PetscObject)nep)->prefix,"-nep_plot_eigs",&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);CHKERRQ(ierr); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscDrawSPCreate(draw,1,&drawsp);CHKERRQ(ierr); for (i=0;inconv;i++) { re = PetscRealPart(nep->eig[i]); im = PetscImaginaryPart(nep->eig[i]); ierr = PetscDrawSPAddPoint(drawsp,&re,&im);CHKERRQ(ierr); } ierr = PetscDrawSPDraw(drawsp,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscDrawSPDestroy(&drawsp);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } /* Remove the initial subspace */ nep->nini = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEP_KSPSolve" PetscErrorCode NEP_KSPSolve(NEP nep,Vec b,Vec x) { PetscErrorCode ierr; PetscInt lits; PetscFunctionBegin; ierr = KSPSolve(nep->ksp,b,x);CHKERRQ(ierr); ierr = KSPGetIterationNumber(nep->ksp,&lits);CHKERRQ(ierr); nep->linits += lits; ierr = PetscInfo2(nep,"iter=%D, linear solve iterations=%D\n",nep->its,lits);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPProjectOperator" /*@ NEPProjectOperator - Computes the projection of the nonlinear operator. Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context . j0 - initial index . j1 - final index - f - workspace vector Notes: This is available for split operator only. The nonlinear operator T(lambda) is projected onto span(V), where V is an orthonormal basis built internally by the solver. The projected operator is equal to sum_i V'*A_i*V*f_i(lambda), so this function computes all matrices Ei = V'*A_i*V, and stores them in the extra matrices inside DS. Only rows/columns in the range [j0,j1-1] are computed, the previous ones are assumed to be available already. Level: developer .seealso: NEPSetSplitOperator() @*/ PetscErrorCode NEPProjectOperator(NEP nep,PetscInt j0,PetscInt j1,Vec f) { PetscErrorCode ierr; PetscInt i,j,k,ld; PetscScalar *G,val; Vec *V = nep->V; PetscBool isherm,set,flg; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,j0,2); PetscValidLogicalCollectiveInt(nep,j1,3); PetscValidHeaderSpecific(f,VEC_CLASSID,4); if (!nep->split) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_WRONGSTATE,"This solver requires a split operator"); ierr = DSGetLeadingDimension(nep->ds,&ld);CHKERRQ(ierr); for (k=0;knt;k++) { ierr = DSGetArray(nep->ds,DSMatExtra[k],&G);CHKERRQ(ierr); ierr = MatIsHermitianKnown(nep->A[k],&set,&flg);CHKERRQ(ierr); isherm = set? flg: PETSC_FALSE; for (j=j0;j0) { ierr = MatMultHermitianTranspose(nep->A[k],V[j],f);CHKERRQ(ierr); } ierr = VecMDot(f,j,V,G+j*ld);CHKERRQ(ierr); for (i=0;iA[k],V[j],f);CHKERRQ(ierr); ierr = VecDot(f,V[j],&val);CHKERRQ(ierr); G[j+j*ld] = val; ierr = VecMDot(f,j,V,G+j*ld);CHKERRQ(ierr); if (isherm) { for (i=0;ids,DSMatExtra[k],&G);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPApplyFunction" /*@ NEPApplyFunction - Applies the nonlinear function T(lambda) to a given vector. Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context . lambda - scalar argument . x - vector to be multiplied against - v - workspace vector Output Parameters: + y - result vector . A - Function matrix . B - optional preconditioning matrix - flg - flag indicating matrix structure (see MatStructure enum) Note: If the nonlinear operator is represented in split form, the result y = T(lambda)*x is computed without building T(lambda) explicitly. In that case, parameters A, B and flg are not used. Otherwise, the matrix T(lambda) is built and the effect is the same as a call to NEPComputeFunction() followed by a MatMult(). Level: developer .seealso: NEPSetSplitOperator(), NEPComputeFunction() @*/ PetscErrorCode NEPApplyFunction(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,Mat *B,MatStructure *flg) { PetscErrorCode ierr; PetscInt i; PetscScalar alpha; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveScalar(nep,lambda,2); PetscValidHeaderSpecific(x,VEC_CLASSID,3); PetscValidHeaderSpecific(y,VEC_CLASSID,4); PetscValidHeaderSpecific(y,VEC_CLASSID,5); if (nep->split) { ierr = VecZeroEntries(y);CHKERRQ(ierr); for (i=0;int;i++) { ierr = FNEvaluateFunction(nep->f[i],lambda,&alpha);CHKERRQ(ierr); ierr = MatMult(nep->A[i],x,v);CHKERRQ(ierr); ierr = VecAXPY(y,alpha,v);CHKERRQ(ierr); } } else { ierr = NEPComputeFunction(nep,lambda,A,B,flg);CHKERRQ(ierr); ierr = MatMult(*A,x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPApplyJacobian" /*@ NEPApplyJacobian - Applies the nonlinear Jacobian T'(lambda) to a given vector. Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context . lambda - scalar argument . x - vector to be multiplied against - v - workspace vector Output Parameters: + y - result vector . A - Jacobian matrix - flg - flag indicating matrix structure (see MatStructure enum) Note: If the nonlinear operator is represented in split form, the result y = T'(lambda)*x is computed without building T'(lambda) explicitly. In that case, parameters A and flg are not used. Otherwise, the matrix T'(lambda) is built and the effect is the same as a call to NEPComputeJacobian() followed by a MatMult(). Level: developer .seealso: NEPSetSplitOperator(), NEPComputeJacobian() @*/ PetscErrorCode NEPApplyJacobian(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,MatStructure *flg) { PetscErrorCode ierr; PetscInt i; PetscScalar alpha; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveScalar(nep,lambda,2); PetscValidHeaderSpecific(x,VEC_CLASSID,3); PetscValidHeaderSpecific(y,VEC_CLASSID,4); PetscValidHeaderSpecific(y,VEC_CLASSID,5); if (nep->split) { ierr = VecZeroEntries(y);CHKERRQ(ierr); for (i=0;int;i++) { ierr = FNEvaluateDerivative(nep->f[i],lambda,&alpha);CHKERRQ(ierr); ierr = MatMult(nep->A[i],x,v);CHKERRQ(ierr); ierr = VecAXPY(y,alpha,v);CHKERRQ(ierr); } } else { ierr = NEPComputeJacobian(nep,lambda,A,flg);CHKERRQ(ierr); ierr = MatMult(*A,x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetIterationNumber" /*@ NEPGetIterationNumber - Gets the current iteration number. If the call to NEPSolve() is complete, then it returns the number of iterations carried out by the solution method. Not Collective Input Parameter: . nep - the nonlinear eigensolver context Output Parameter: . its - number of iterations Level: intermediate Note: During the i-th iteration this call returns i-1. If NEPSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call NEPGetConvergedReason() to determine if the solver converged or failed and why. .seealso: NEPGetConvergedReason(), NEPSetTolerances() @*/ PetscErrorCode NEPGetIterationNumber(NEP nep,PetscInt *its) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidIntPointer(its,2); *its = nep->its; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetConverged" /*@ NEPGetConverged - Gets the number of converged eigenpairs. Not Collective Input Parameter: . nep - the nonlinear eigensolver context Output Parameter: . nconv - number of converged eigenpairs Note: This function should be called after NEPSolve() has finished. Level: beginner .seealso: NEPSetDimensions(), NEPSolve() @*/ PetscErrorCode NEPGetConverged(NEP nep,PetscInt *nconv) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidIntPointer(nconv,2); *nconv = nep->nconv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetConvergedReason" /*@C NEPGetConvergedReason - Gets the reason why the NEPSolve() iteration was stopped. Not Collective Input Parameter: . nep - the nonlinear eigensolver context Output Parameter: . reason - negative value indicates diverged, positive value converged Possible values for reason: + NEP_CONVERGED_FNORM_ABS - function norm satisfied absolute tolerance . NEP_CONVERGED_FNORM_RELATIVE - function norm satisfied relative tolerance . NEP_CONVERGED_SNORM_RELATIVE - step norm satisfied relative tolerance . NEP_DIVERGED_LINEAR_SOLVE - inner linear solve failed . NEP_DIVERGED_FUNCTION_COUNT - reached maximum allowed function evaluations . NEP_DIVERGED_MAX_IT - required more than its to reach convergence . NEP_DIVERGED_BREAKDOWN - generic breakdown in method - NEP_DIVERGED_FNORM_NAN - Inf or NaN detected in function evaluation Note: Can only be called after the call to NEPSolve() is complete. Level: intermediate .seealso: NEPSetTolerances(), NEPSolve(), NEPConvergedReason @*/ PetscErrorCode NEPGetConvergedReason(NEP nep,NEPConvergedReason *reason) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(reason,2); *reason = nep->reason; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetEigenpair" /*@ NEPGetEigenpair - Gets the i-th solution of the eigenproblem as computed by NEPSolve(). The solution consists in both the eigenvalue and the eigenvector. Logically Collective on NEP Input Parameters: + nep - nonlinear eigensolver context - i - index of the solution Output Parameters: + eig - eigenvalue - V - eigenvector Notes: If PETSc is configured with real scalars, then complex eigenpairs cannot be obtained. Users should use a complex-scalar configuration. This behaviour is different to other SLEPc solvers such as EPS. The index i should be a value between 0 and nconv-1 (see NEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with NEPSetWhichEigenpairs(). Level: beginner .seealso: NEPSolve(), NEPGetConverged(), NEPSetWhichEigenpairs() @*/ PetscErrorCode NEPGetEigenpair(NEP nep,PetscInt i,PetscScalar *eig,Vec V) { PetscInt k; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,i,2); if (V) { PetscValidHeaderSpecific(V,VEC_CLASSID,4); PetscCheckSameComm(nep,1,V,4); } if (!nep->eig || !nep->V) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_WRONGSTATE,"NEPSolve must be called first"); if (i<0 || i>=nep->nconv) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (!nep->perm) k = i; else k = nep->perm[i]; if (eig) *eig = nep->eig[k]; if (V) { ierr = VecCopy(nep->V[k],V);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetErrorEstimate" /*@ NEPGetErrorEstimate - Returns the error estimate associated to the i-th computed eigenpair. Not Collective Input Parameter: + nep - nonlinear eigensolver context - i - index of eigenpair Output Parameter: . errest - the error estimate Notes: This is the error estimate used internally by the eigensolver. The actual error bound can be computed with NEPComputeRelativeError(). Level: advanced .seealso: NEPComputeRelativeError() @*/ PetscErrorCode NEPGetErrorEstimate(NEP nep,PetscInt i,PetscReal *errest) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(errest,3); if (!nep->eig) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"NEPSolve must be called first"); if (i<0 || i>=nep->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (nep->perm) i = nep->perm[i]; if (errest) *errest = nep->errest[i]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPComputeResidualNorm_Private" /* NEPComputeResidualNorm_Private - Computes the norm of the residual vector associated with an eigenpair. */ PetscErrorCode NEPComputeResidualNorm_Private(NEP nep,PetscScalar lambda,Vec x,PetscReal *norm) { PetscErrorCode ierr; Vec u; Mat T=nep->function; MatStructure mats; PetscFunctionBegin; ierr = VecDuplicate(nep->V[0],&u);CHKERRQ(ierr); ierr = NEPComputeFunction(nep,lambda,&T,&T,&mats);CHKERRQ(ierr); ierr = MatMult(T,x,u);CHKERRQ(ierr); ierr = VecNorm(u,NORM_2,norm);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPComputeResidualNorm" /*@ NEPComputeResidualNorm - Computes the norm of the residual vector associated with the i-th computed eigenpair. Collective on NEP Input Parameter: + nep - the nonlinear eigensolver context - i - the solution index Output Parameter: . norm - the residual norm, computed as ||T(lambda)x||_2 where lambda is the eigenvalue and x is the eigenvector. Notes: The index i should be a value between 0 and nconv-1 (see NEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with NEPSetWhichEigenpairs(). Level: beginner .seealso: NEPSolve(), NEPGetConverged(), NEPSetWhichEigenpairs() @*/ PetscErrorCode NEPComputeResidualNorm(NEP nep,PetscInt i,PetscReal *norm) { PetscErrorCode ierr; Vec x; PetscScalar lambda; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,i,2); PetscValidPointer(norm,3); ierr = VecDuplicate(nep->V[0],&x);CHKERRQ(ierr); ierr = NEPGetEigenpair(nep,i,&lambda,x);CHKERRQ(ierr); ierr = NEPComputeResidualNorm_Private(nep,lambda,x,norm);CHKERRQ(ierr); ierr = VecDestroy(&x);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPComputeRelativeError_Private" /* NEPComputeRelativeError_Private - Computes the relative error bound associated with an eigenpair. */ PetscErrorCode NEPComputeRelativeError_Private(NEP nep,PetscScalar lambda,Vec x,PetscReal *error) { PetscErrorCode ierr; PetscReal norm,er; PetscFunctionBegin; ierr = NEPComputeResidualNorm_Private(nep,lambda,x,&norm);CHKERRQ(ierr); ierr = VecNorm(x,NORM_2,&er);CHKERRQ(ierr); if (PetscAbsScalar(lambda) > norm) { *error = norm/(PetscAbsScalar(lambda)*er); } else { *error = norm/er; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPComputeRelativeError" /*@ NEPComputeRelativeError - Computes the relative error bound associated with the i-th computed eigenpair. Collective on NEP Input Parameter: + nep - the nonlinear eigensolver context - i - the solution index Output Parameter: . error - the relative error bound, computed as ||T(lambda)x||_2/||lambda*x||_2 where lambda is the eigenvalue and x is the eigenvector. If lambda=0 the relative error is computed as ||T(lambda)x||_2/||x||_2. Level: beginner .seealso: NEPSolve(), NEPComputeResidualNorm(), NEPGetErrorEstimate() @*/ PetscErrorCode NEPComputeRelativeError(NEP nep,PetscInt i,PetscReal *error) { PetscErrorCode ierr; Vec x; PetscScalar lambda; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,i,2); PetscValidPointer(error,3); ierr = VecDuplicate(nep->V[0],&x);CHKERRQ(ierr); ierr = NEPGetEigenpair(nep,i,&lambda,x);CHKERRQ(ierr); ierr = NEPComputeRelativeError_Private(nep,lambda,x,error);CHKERRQ(ierr); ierr = VecDestroy(&x);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSortEigenvalues" /*@ NEPSortEigenvalues - Sorts a list of eigenvalues according to the criterion specified via NEPSetWhichEigenpairs(). Not Collective Input Parameters: + nep - the nonlinear eigensolver context . n - number of eigenvalues in the list - eig - pointer to the array containing the eigenvalues Output Parameter: . perm - resulting permutation Note: The result is a list of indices in the original eigenvalue array corresponding to the first nev eigenvalues sorted in the specified criterion. Level: developer .seealso: NEPSetWhichEigenpairs() @*/ PetscErrorCode NEPSortEigenvalues(NEP nep,PetscInt n,PetscScalar *eig,PetscInt *perm) { PetscErrorCode ierr; PetscInt i,j,result,tmp; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidScalarPointer(eig,3); PetscValidIntPointer(perm,4); for (i=0;i=0;i--) { j = i + 1; while (jcomparison) SETERRQ(PETSC_COMM_SELF,1,"Undefined eigenvalue comparison function"); ierr = (*nep->comparison)(a,0.0,b,0.0,result,nep->comparisonctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetOperationCounters" /*@ NEPGetOperationCounters - Gets the total number of function evaluations, dot products, and linear solve iterations used by the NEP object during the last NEPSolve() call. Not Collective Input Parameter: . nep - nonlinear eigensolver context Output Parameter: + nfuncs - number of function evaluations . dots - number of dot product operations - lits - number of linear iterations Notes: These counters are reset to zero at each successive call to NEPSolve(). Level: intermediate @*/ PetscErrorCode NEPGetOperationCounters(NEP nep,PetscInt* nfuncs,PetscInt* dots,PetscInt* lits) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (nfuncs) *nfuncs = nep->nfuncs; if (dots) { if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } ierr = IPGetOperationCounters(nep->ip,dots);CHKERRQ(ierr); } if (lits) *lits = nep->linits; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPComputeFunction" /*@ NEPComputeFunction - Computes the function matrix T(lambda) that has been set with NEPSetFunction(). Collective on NEP and Mat Input Parameters: + nep - the NEP context - lambda - the scalar argument Output Parameters: + A - Function matrix . B - optional preconditioning matrix - flg - flag indicating matrix structure (see MatStructure enum) Notes: NEPComputeFunction() is typically used within nonlinear eigensolvers implementations, so most users would not generally call this routine themselves. Level: developer .seealso: NEPSetFunction(), NEPGetFunction() @*/ PetscErrorCode NEPComputeFunction(NEP nep,PetscScalar lambda,Mat *A,Mat *B,MatStructure *flg) { PetscErrorCode ierr; PetscInt i; PetscScalar alpha; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(flg,5); if (nep->split) { ierr = MatZeroEntries(*A);CHKERRQ(ierr); for (i=0;int;i++) { ierr = FNEvaluateFunction(nep->f[i],lambda,&alpha);CHKERRQ(ierr); ierr = MatAXPY(*A,alpha,nep->A[i],nep->mstr);CHKERRQ(ierr); } if (*A != *B) SETERRQ(PetscObjectComm((PetscObject)nep),1,"Not implemented"); } else { if (!nep->computefunction) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_USER,"Must call NEPSetFunction() first"); *flg = DIFFERENT_NONZERO_PATTERN; ierr = PetscLogEventBegin(NEP_FunctionEval,nep,*A,*B,0);CHKERRQ(ierr); PetscStackPush("NEP user Function function"); ierr = (*nep->computefunction)(nep,lambda,A,B,flg,nep->functionctx);CHKERRQ(ierr); PetscStackPop; ierr = PetscLogEventEnd(NEP_FunctionEval,nep,*A,*B,0);CHKERRQ(ierr); nep->nfuncs++; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPComputeJacobian" /*@ NEPComputeJacobian - Computes the Jacobian matrix T'(lambda) that has been set with NEPSetJacobian(). Collective on NEP and Mat Input Parameters: + nep - the NEP context - lambda - the scalar argument Output Parameters: + A - Jacobian matrix - flg - flag indicating matrix structure (see MatStructure enum) Notes: Most users should not need to explicitly call this routine, as it is used internally within the nonlinear eigensolvers. Level: developer .seealso: NEPSetJacobian(), NEPGetJacobian() @*/ PetscErrorCode NEPComputeJacobian(NEP nep,PetscScalar lambda,Mat *A,MatStructure *flg) { PetscErrorCode ierr; PetscInt i; PetscScalar alpha; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(flg,4); if (nep->split) { ierr = MatZeroEntries(*A);CHKERRQ(ierr); for (i=0;int;i++) { ierr = FNEvaluateDerivative(nep->f[i],lambda,&alpha);CHKERRQ(ierr); ierr = MatAXPY(*A,alpha,nep->A[i],nep->mstr);CHKERRQ(ierr); } } else { if (!nep->computejacobian) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_USER,"Must call NEPSetJacobian() first"); *flg = DIFFERENT_NONZERO_PATTERN; ierr = PetscLogEventBegin(NEP_JacobianEval,nep,*A,0,0);CHKERRQ(ierr); PetscStackPush("NEP user Jacobian function"); ierr = (*nep->computejacobian)(nep,lambda,A,flg,nep->jacobianctx);CHKERRQ(ierr); PetscStackPop; ierr = PetscLogEventEnd(NEP_JacobianEval,nep,*A,0,0);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/nepopts.c.html0000644000175000017500000022243712211062077021555 0ustar gladkgladk
Actual source code: nepopts.c

  1: /*
  2:       NEP routines related to options that can be set via the command-line
  3:       or procedurally.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/nepimpl.h>       /*I "slepcnep.h" I*/

 29: /*@
 30:    NEPSetFromOptions - Sets NEP options from the options database.
 31:    This routine must be called before NEPSetUp() if the user is to be
 32:    allowed to set the solver type.

 34:    Collective on NEP

 36:    Input Parameters:
 37: .  nep - the nonlinear eigensolver context

 39:    Notes:
 40:    To see all options, run your program with the -help option.

 42:    Level: beginner
 43: @*/
 44: PetscErrorCode NEPSetFromOptions(NEP nep)
 45: {
 46:   PetscErrorCode   ierr;
 47:   char             type[256],monfilename[PETSC_MAX_PATH_LEN];
 48:   PetscBool        flg;
 49:   PetscReal        r1,r2,r3;
 50:   PetscScalar      s;
 51:   PetscInt         i,j,k;
 52:   PetscViewer      monviewer;
 53:   SlepcConvMonitor ctx;
 54:   MatStructure     matflag;

 58:   if (!NEPRegisterAllCalled) { NEPRegisterAll(); }
 59:   PetscObjectOptionsBegin((PetscObject)nep);
 60:     PetscOptionsList("-nep_type","Nonlinear Eigenvalue Problem method","NEPSetType",NEPList,(char*)(((PetscObject)nep)->type_name?((PetscObject)nep)->type_name:NEPRII),type,256,&flg);
 61:     if (flg) {
 62:       NEPSetType(nep,type);
 63:     } else if (!((PetscObject)nep)->type_name) {
 64:       NEPSetType(nep,NEPRII);
 65:     }

 67:     r1 = r2 = r3 = i = j = 0;
 68:     PetscOptionsInt("-nep_max_it","Maximum number of iterations","NEPSetTolerances",nep->max_it,&i,NULL);
 69:     PetscOptionsInt("-nep_max_funcs","Maximum number of function evaluations","NEPSetTolerances",nep->max_funcs,&j,NULL);
 70:     PetscOptionsReal("-nep_atol","Absolute tolerance for residual norm","NEPSetTolerances",nep->abstol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:nep->abstol,&r1,NULL);
 71:     PetscOptionsReal("-nep_rtol","Relative tolerance for residual norm","NEPSetTolerances",nep->rtol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:nep->rtol,&r2,NULL);
 72:     PetscOptionsReal("-nep_stol","Relative tolerance for step length","NEPSetTolerances",nep->stol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:nep->stol,&r3,NULL);
 73:     NEPSetTolerances(nep,r1,r2,r3,i,j);
 74:     flg  = PETSC_FALSE;
 75:     PetscOptionsBool("-nep_convergence_default","Default (relative error) convergence test","NEPSetConvergenceTest",flg,&flg,NULL);
 76:     if (flg) { NEPSetConvergenceTest(nep,NEPConvergedDefault,NULL,NULL); }

 78:     i = j = k = 0;
 79:     PetscOptionsInt("-nep_nev","Number of eigenvalues to compute","NEPSetDimensions",nep->nev,&i,NULL);
 80:     PetscOptionsInt("-nep_ncv","Number of basis vectors","NEPSetDimensions",nep->ncv,&j,NULL);
 81:     PetscOptionsInt("-nep_mpd","Maximum dimension of projected problem","NEPSetDimensions",nep->mpd,&k,NULL);
 82:     NEPSetDimensions(nep,i,j,k);

 84:     i = 0;
 85:     PetscOptionsInt("-nep_lag_preconditioner","Interval to rebuild preconditioner","NEPSetLagPreconditioner",nep->lag,&i,&flg);
 86:     if (flg) { NEPSetLagPreconditioner(nep,i); }

 88:     PetscOptionsBool("-nep_const_correction_tol","Constant correction tolerance for the linear solver","NEPSetConstCorrectionTol",nep->cctol,&nep->cctol,NULL);

 90:     PetscOptionsScalar("-nep_target","Value of the target","NEPSetTarget",nep->target,&s,&flg);
 91:     if (flg) {
 92:       NEPSetWhichEigenpairs(nep,NEP_TARGET_MAGNITUDE);
 93:       NEPSetTarget(nep,s);
 94:     }

 96:     /* -----------------------------------------------------------------------*/
 97:     /*
 98:       Cancels all monitors hardwired into code before call to NEPSetFromOptions()
 99:     */
100:     flg  = PETSC_FALSE;
101:     PetscOptionsBool("-nep_monitor_cancel","Remove any hardwired monitor routines","NEPMonitorCancel",flg,&flg,NULL);
102:     if (flg) {
103:       NEPMonitorCancel(nep);
104:     }
105:     /*
106:       Prints approximate eigenvalues and error estimates at each iteration
107:     */
108:     PetscOptionsString("-nep_monitor","Monitor first unconverged approximate eigenvalue and error estimate","NEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
109:     if (flg) {
110:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)nep),monfilename,&monviewer);
111:       NEPMonitorSet(nep,NEPMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
112:     }
113:     PetscOptionsString("-nep_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","NEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
114:     if (flg) {
115:       PetscNew(struct _n_SlepcConvMonitor,&ctx);
116:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)nep),monfilename,&ctx->viewer);
117:       NEPMonitorSet(nep,NEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
118:     }
119:     PetscOptionsString("-nep_monitor_all","Monitor approximate eigenvalues and error estimates","NEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
120:     if (flg) {
121:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)nep),monfilename,&monviewer);
122:       NEPMonitorSet(nep,NEPMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
123:       NEPSetTrackAll(nep,PETSC_TRUE);
124:     }
125:     flg = PETSC_FALSE;
126:     PetscOptionsBool("-nep_monitor_lg","Monitor first unconverged approximate error estimate graphically","NEPMonitorSet",flg,&flg,NULL);
127:     if (flg) {
128:       NEPMonitorSet(nep,NEPMonitorLG,NULL,NULL);
129:     }
130:     flg = PETSC_FALSE;
131:     PetscOptionsBool("-nep_monitor_lg_all","Monitor error estimates graphically","NEPMonitorSet",flg,&flg,NULL);
132:     if (flg) {
133:       NEPMonitorSet(nep,NEPMonitorLGAll,NULL,NULL);
134:       NEPSetTrackAll(nep,PETSC_TRUE);
135:     }
136:   /* -----------------------------------------------------------------------*/

138:     PetscOptionsBoolGroupBegin("-nep_largest_magnitude","compute largest eigenvalues in magnitude","NEPSetWhichEigenpairs",&flg);
139:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_LARGEST_MAGNITUDE); }
140:     PetscOptionsBoolGroup("-nep_smallest_magnitude","compute smallest eigenvalues in magnitude","NEPSetWhichEigenpairs",&flg);
141:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_SMALLEST_MAGNITUDE); }
142:     PetscOptionsBoolGroup("-nep_largest_real","compute largest real parts","NEPSetWhichEigenpairs",&flg);
143:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_LARGEST_REAL); }
144:     PetscOptionsBoolGroup("-nep_smallest_real","compute smallest real parts","NEPSetWhichEigenpairs",&flg);
145:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_SMALLEST_REAL); }
146:     PetscOptionsBoolGroup("-nep_largest_imaginary","compute largest imaginary parts","NEPSetWhichEigenpairs",&flg);
147:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_LARGEST_IMAGINARY); }
148:     PetscOptionsBoolGroup("-nep_smallest_imaginary","compute smallest imaginary parts","NEPSetWhichEigenpairs",&flg);
149:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_SMALLEST_IMAGINARY); }
150:     PetscOptionsBoolGroup("-nep_target_magnitude","compute nearest eigenvalues to target","NEPSetWhichEigenpairs",&flg);
151:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_TARGET_MAGNITUDE); }
152:     PetscOptionsBoolGroup("-nep_target_real","compute eigenvalues with real parts close to target","NEPSetWhichEigenpairs",&flg);
153:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_TARGET_REAL); }
154:     PetscOptionsBoolGroupEnd("-nep_target_imaginary","compute eigenvalues with imaginary parts close to target","NEPSetWhichEigenpairs",&flg);
155:     if (flg) { NEPSetWhichEigenpairs(nep,NEP_TARGET_IMAGINARY); }

157:     PetscOptionsName("-nep_view","Print detailed information on solver used","NEPView",0);
158:     PetscOptionsName("-nep_plot_eigs","Make a plot of the computed eigenvalues","NEPSolve",0);

160:     if (nep->ops->setfromoptions) {
161:       (*nep->ops->setfromoptions)(nep);
162:     }
163:     PetscObjectProcessOptionsHandlers((PetscObject)nep);
164:   PetscOptionsEnd();

166:   if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
167:   IPSetFromOptions(nep->ip);
168:   if (!nep->ds) { NEPGetDS(nep,&nep->ds); }
169:   DSSetFromOptions(nep->ds);
170:   if (!nep->ksp) { NEPGetKSP(nep,&nep->ksp); }
171:   KSPGetOperators(nep->ksp,NULL,NULL,&matflag);
172:   KSPSetOperators(nep->ksp,nep->function,nep->function_pre,matflag);
173:   KSPSetFromOptions(nep->ksp);
174:   PetscRandomSetFromOptions(nep->rand);
175:   return(0);
176: }

180: /*@
181:    NEPGetTolerances - Gets the tolerance and maximum iteration count used
182:    by the NEP convergence tests.

184:    Not Collective

186:    Input Parameter:
187: .  nep - the nonlinear eigensolver context

189:    Output Parameters:
190: +  abstol - absolute convergence tolerance
191: .  rtol   - relative convergence tolerance
192: .  stol   - convergence tolerance in terms of the norm of the change in the
193:            solution between steps, || delta x || < stol*|| x ||
194: .  maxit  - maximum number of iterations
195: -  maxf   - maximum number of function evaluations

197:    Notes:
198:    The user can specify NULL for any parameter that is not needed.

200:    Level: intermediate

202: .seealso: NEPSetTolerances()
203: @*/
204: PetscErrorCode NEPGetTolerances(NEP nep,PetscReal *abstol,PetscReal *rtol,PetscReal *stol,PetscInt *maxit,PetscInt *maxf)
205: {
208:   if (abstol) *abstol = nep->abstol;
209:   if (rtol)   *rtol   = nep->rtol;
210:   if (stol)   *stol   = nep->stol;
211:   if (maxit)  *maxit  = nep->max_it;
212:   if (maxf)   *maxf   = nep->max_funcs;
213:   return(0);
214: }

218: /*@
219:    NEPSetTolerances - Sets various parameters used in convergence tests.

221:    Logically Collective on NEP

223:    Input Parameters:
224: +  nep    - the nonlinear eigensolver context
225: .  abstol - absolute convergence tolerance
226: .  rtol   - relative convergence tolerance
227: .  stol   - convergence tolerance in terms of the norm of the change in the
228:             solution between steps, || delta x || < stol*|| x ||
229: .  maxit  - maximum number of iterations
230: -  maxf   - maximum number of function evaluations

232:    Options Database Keys:
233: +    -nep_atol <abstol> - Sets abstol
234: .    -nep_rtol <rtol> - Sets rtol
235: .    -nep_stol <stol> - Sets stol
236: .    -nep_max_it <maxit> - Sets maxit
237: -    -nep_max_funcs <maxf> - Sets maxf

239:    Notes:
240:    Pass 0 for an argument that need not be changed.

242:    Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
243:    dependent on the solution method.

245:    Level: intermediate

247: .seealso: NEPGetTolerances()
248: @*/
249: PetscErrorCode NEPSetTolerances(NEP nep,PetscReal abstol,PetscReal rtol,PetscReal stol,PetscInt maxit,PetscInt maxf)
250: {
258:   if (abstol) {
259:     if (abstol == PETSC_DEFAULT) {
260:       nep->abstol = PETSC_DEFAULT;
261:     } else {
262:       if (abstol < 0.0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Absolute tolerance %G must be non-negative",abstol);
263:       nep->abstol = abstol;
264:     }
265:   }
266:   if (rtol) {
267:     if (rtol == PETSC_DEFAULT) {
268:       nep->rtol = PETSC_DEFAULT;
269:     } else {
270:       if (rtol < 0.0 || 1.0 <= rtol) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Relative tolerance %G must be non-negative and less than 1.0",rtol);
271:       nep->rtol = rtol;
272:     }
273:   }
274:   if (stol) {
275:     if (stol == PETSC_DEFAULT) {
276:       nep->stol = PETSC_DEFAULT;
277:     } else {
278:       if (stol < 0.0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Step tolerance %G must be non-negative",stol);
279:       nep->stol = stol;
280:     }
281:   }
282:   if (maxit) {
283:     if (maxit == PETSC_DEFAULT || maxit == PETSC_DECIDE) {
284:       nep->max_it = 0;
285:       nep->setupcalled = 0;
286:     } else {
287:       if (maxit < 0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Maximum number of iterations %D must be non-negative",maxit);
288:       nep->max_it = maxit;
289:     }
290:   }
291:   if (maxf) {
292:     if (maxf == PETSC_DEFAULT || maxf == PETSC_DECIDE) {
293:       nep->max_it = 0;
294:       nep->setupcalled = 0;
295:     } else {
296:       if (maxf < 0) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Maximum number of function evaluations %D must be non-negative",maxf);
297:       nep->max_funcs = maxf;
298:     }
299:   }
300:   return(0);
301: }

305: /*@
306:    NEPGetDimensions - Gets the number of eigenvalues to compute
307:    and the dimension of the subspace.

309:    Not Collective

311:    Input Parameter:
312: .  nep - the nonlinear eigensolver context

314:    Output Parameters:
315: +  nev - number of eigenvalues to compute
316: .  ncv - the maximum dimension of the subspace to be used by the solver
317: -  mpd - the maximum dimension allowed for the projected problem

319:    Notes:
320:    The user can specify NULL for any parameter that is not needed.

322:    Level: intermediate

324: .seealso: NEPSetDimensions()
325: @*/
326: PetscErrorCode NEPGetDimensions(NEP nep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
327: {
330:   if (nev) *nev = nep->nev;
331:   if (ncv) *ncv = nep->ncv;
332:   if (mpd) *mpd = nep->mpd;
333:   return(0);
334: }

338: /*@
339:    NEPSetDimensions - Sets the number of eigenvalues to compute
340:    and the dimension of the subspace.

342:    Logically Collective on NEP

344:    Input Parameters:
345: +  nep - the nonlinear eigensolver context
346: .  nev - number of eigenvalues to compute
347: .  ncv - the maximum dimension of the subspace to be used by the solver
348: -  mpd - the maximum dimension allowed for the projected problem

350:    Options Database Keys:
351: +  -nep_nev <nev> - Sets the number of eigenvalues
352: .  -nep_ncv <ncv> - Sets the dimension of the subspace
353: -  -nep_mpd <mpd> - Sets the maximum projected dimension

355:    Notes:
356:    Pass 0 to retain the previous value of any parameter.

358:    Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
359:    dependent on the solution method.

361:    The parameters ncv and mpd are intimately related, so that the user is advised
362:    to set one of them at most. Normal usage is that
363:    (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and
364:    (b) in cases where nev is large, the user sets mpd.

366:    The value of ncv should always be between nev and (nev+mpd), typically
367:    ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise
368:    a smaller value should be used.

370:    Level: intermediate

372: .seealso: NEPGetDimensions()
373: @*/
374: PetscErrorCode NEPSetDimensions(NEP nep,PetscInt nev,PetscInt ncv,PetscInt mpd)
375: {
381:   if (nev) {
382:     if (nev<1) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0");
383:     nep->nev = nev;
384:     nep->setupcalled = 0;
385:   }
386:   if (ncv) {
387:     if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
388:       nep->ncv = 0;
389:     } else {
390:       if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
391:       nep->ncv = ncv;
392:     }
393:     nep->setupcalled = 0;
394:   }
395:   if (mpd) {
396:     if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
397:       nep->mpd = 0;
398:     } else {
399:       if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
400:       nep->mpd = mpd;
401:     }
402:   }
403:   return(0);
404: }

408: /*@
409:     NEPSetWhichEigenpairs - Specifies which portion of the spectrum is
410:     to be sought.

412:     Logically Collective on NEP

414:     Input Parameters:
415: +   nep   - eigensolver context obtained from NEPCreate()
416: -   which - the portion of the spectrum to be sought

418:     Possible values:
419:     The parameter 'which' can have one of these values

421: +     NEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
422: .     NEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
423: .     NEP_LARGEST_REAL - largest real parts
424: .     NEP_SMALLEST_REAL - smallest real parts
425: .     NEP_LARGEST_IMAGINARY - largest imaginary parts
426: .     NEP_SMALLEST_IMAGINARY - smallest imaginary parts
427: .     NEP_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
428: .     NEP_TARGET_REAL - eigenvalues with real part closest to target
429: -     NEP_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target

431:     Options Database Keys:
432: +   -nep_largest_magnitude - Sets largest eigenvalues in magnitude
433: .   -nep_smallest_magnitude - Sets smallest eigenvalues in magnitude
434: .   -nep_largest_real - Sets largest real parts
435: .   -nep_smallest_real - Sets smallest real parts
436: .   -nep_largest_imaginary - Sets largest imaginary parts
437: .   -nep_smallest_imaginary - Sets smallest imaginary parts
438: .   -nep_target_magnitude - Sets eigenvalues closest to target
439: .   -nep_target_real - Sets real parts closest to target
440: -   -nep_target_imaginary - Sets imaginary parts closest to target

442:     Notes:
443:     Not all eigensolvers implemented in NEP account for all the possible values
444:     stated above. If SLEPc is compiled for real numbers NEP_LARGEST_IMAGINARY
445:     and NEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part
446:     for eigenvalue selection.

448:     Level: intermediate

450: .seealso: NEPGetWhichEigenpairs(), NEPWhich
451: @*/
452: PetscErrorCode NEPSetWhichEigenpairs(NEP nep,NEPWhich which)
453: {
457:   if (which) {
458:     if (which==PETSC_DECIDE || which==PETSC_DEFAULT) nep->which = (NEPWhich)0;
459:     else switch (which) {
460:       case NEP_LARGEST_MAGNITUDE:
461:       case NEP_SMALLEST_MAGNITUDE:
462:       case NEP_LARGEST_REAL:
463:       case NEP_SMALLEST_REAL:
464:       case NEP_LARGEST_IMAGINARY:
465:       case NEP_SMALLEST_IMAGINARY:
466:       case NEP_TARGET_MAGNITUDE:
467:       case NEP_TARGET_REAL:
468: #if defined(PETSC_USE_COMPLEX)
469:       case NEP_TARGET_IMAGINARY:
470: #endif
471:         if (nep->which != which) {
472:           nep->setupcalled = 0;
473:           nep->which = which;
474:         }
475:         break;
476:       default:
477:         SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value");
478:     }
479:   }
480:   return(0);
481: }

485: /*@C
486:     NEPGetWhichEigenpairs - Returns which portion of the spectrum is to be
487:     sought.

489:     Not Collective

491:     Input Parameter:
492: .   nep - eigensolver context obtained from NEPCreate()

494:     Output Parameter:
495: .   which - the portion of the spectrum to be sought

497:     Notes:
498:     See NEPSetWhichEigenpairs() for possible values of 'which'.

500:     Level: intermediate

502: .seealso: NEPSetWhichEigenpairs(), NEPWhich
503: @*/
504: PetscErrorCode NEPGetWhichEigenpairs(NEP nep,NEPWhich *which)
505: {
509:   *which = nep->which;
510:   return(0);
511: }

515: /*@
516:     NEPSetLagPreconditioner - Determines when the preconditioner is rebuilt in the
517:     nonlinear solve.

519:     Logically Collective on NEP

521:     Input Parameters:
522: +   nep - the NEP context
523: -   lag - 0 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is
524:           computed within the nonlinear iteration, 2 means every second time
525:           the Jacobian is built, etc.

527:     Options Database Keys:
528: .   -nep_lag_preconditioner <lag>

530:     Notes:
531:     The default is 1.
532:     The preconditioner is ALWAYS built in the first iteration of a nonlinear solve.

534:     Level: intermediate

536: .seealso: NEPGetLagPreconditioner()
537: @*/
538: PetscErrorCode NEPSetLagPreconditioner(NEP nep,PetscInt lag)
539: {
543:   if (lag<0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Lag must be non-negative");
544:   nep->lag = lag;
545:   return(0);
546: }

550: /*@
551:     NEPGetLagPreconditioner - Indicates how often the preconditioner is rebuilt.

553:     Not Collective

555:     Input Parameter:
556: .   nep - the NEP context

558:     Output Parameter:
559: .   lag - the lag parameter

561:     Level: intermediate

563: .seealso: NEPSetLagPreconditioner()
564: @*/
565: PetscErrorCode NEPGetLagPreconditioner(NEP nep,PetscInt *lag)
566: {
570:   *lag = nep->lag;
571:   return(0);
572: }

576: /*@
577:     NEPSetConstCorrectionTol - Sets a flag to keep the tolerance used
578:     in the linear solver constant.

580:     Logically Collective on NEP

582:     Input Parameters:
583: +   nep - the NEP context
584: -   cct - a boolean value

586:     Options Database Keys:
587: .   -nep_const_correction_tol <cct>

589:     Notes:
590:     By default, an exponentially decreasing tolerance is set in the KSP used
591:     within the nonlinear iteration, so that each Newton iteration requests
592:     better accuracy than the previous one. The constant correction tolerance
593:     flag stops this behaviour.

595:     Level: intermediate

597: .seealso: NEPGetConstCorrectionTol()
598: @*/
599: PetscErrorCode NEPSetConstCorrectionTol(NEP nep,PetscBool cct)
600: {
604:   nep->cctol = cct;
605:   return(0);
606: }

610: /*@
611:     NEPGetConstCorrectionTol - Returns the constant tolerance flag.

613:     Not Collective

615:     Input Parameter:
616: .   nep - the NEP context

618:     Output Parameter:
619: .   cct - the value of the constant tolerance flag

621:     Level: intermediate

623: .seealso: NEPSetConstCorrectionTol()
624: @*/
625: PetscErrorCode NEPGetConstCorrectionTol(NEP nep,PetscBool *cct)
626: {
630:   *cct = nep->cctol;
631:   return(0);
632: }

636: /*@C
637:     NEPSetConvergenceTest - Sets the function to be used to test convergence
638:     of the nonlinear iterative solution.

640:     Logically Collective on NEP

642:     Input Parameters:
643: +   nep     - the NEP context
644: .   func    - a pointer to the convergence test function
645: .   ctx     - [optional] context for private data for the convergence routine
646:               (may be NULL)
647: -   destroy - [optional] destructor for the context (may be NULL;
648:               PETSC_NULL_FUNCTION in Fortran)

650:     Calling Sequence of func:
651: $   func(NEP nep,PetscInt it,PetscReal xnorm,PetscReal snorm,PetscReal fnorm,NEPConvergedReason reason*,void *fctx)

653: +   nep    - the NEP context
654: .   it     - iteration number
655: .   xnorm  - norm of the current solution
656: .   snorm  - norm of the step (difference between two consecutive solutions)
657: .   fnorm  - norm of the function (residual)
658: .   reason - (output) result of the convergence test
659: -   fctx   - optional context, as set by NEPSetConvergenceTest()

661:     Level: advanced

663: .seealso: NEPSetTolerances()
664: @*/
665: PetscErrorCode NEPSetConvergenceTest(NEP nep,PetscErrorCode (*func)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void* ctx,PetscErrorCode (*destroy)(void*))
666: {

671:   if (nep->convergeddestroy) {
672:     (*nep->convergeddestroy)(nep->convergedctx);
673:   }
674:   nep->converged        = func;
675:   nep->convergeddestroy = destroy;
676:   nep->convergedctx     = ctx;
677:   return(0);
678: }

682: /*@
683:    NEPSetTrackAll - Specifies if the solver must compute the residual of all
684:    approximate eigenpairs or not.

686:    Logically Collective on NEP

688:    Input Parameters:
689: +  nep      - the eigensolver context
690: -  trackall - whether compute all residuals or not

692:    Notes:
693:    If the user sets trackall=PETSC_TRUE then the solver explicitly computes
694:    the residual for each eigenpair approximation. Computing the residual is
695:    usually an expensive operation and solvers commonly compute the associated
696:    residual to the first unconverged eigenpair.
697:    The options '-nep_monitor_all' and '-nep_monitor_lg_all' automatically
698:    activate this option.

700:    Level: intermediate

702: .seealso: NEPGetTrackAll()
703: @*/
704: PetscErrorCode NEPSetTrackAll(NEP nep,PetscBool trackall)
705: {
709:   nep->trackall = trackall;
710:   return(0);
711: }

715: /*@
716:    NEPGetTrackAll - Returns the flag indicating whether all residual norms must
717:    be computed or not.

719:    Not Collective

721:    Input Parameter:
722: .  nep - the eigensolver context

724:    Output Parameter:
725: .  trackall - the returned flag

727:    Level: intermediate

729: .seealso: NEPSetTrackAll()
730: @*/
731: PetscErrorCode NEPGetTrackAll(NEP nep,PetscBool *trackall)
732: {
736:   *trackall = nep->trackall;
737:   return(0);
738: }

742: /*@C
743:    NEPSetOptionsPrefix - Sets the prefix used for searching for all
744:    NEP options in the database.

746:    Logically Collective on NEP

748:    Input Parameters:
749: +  nep - the nonlinear eigensolver context
750: -  prefix - the prefix string to prepend to all NEP option requests

752:    Notes:
753:    A hyphen (-) must NOT be given at the beginning of the prefix name.
754:    The first character of all runtime options is AUTOMATICALLY the
755:    hyphen.

757:    For example, to distinguish between the runtime options for two
758:    different NEP contexts, one could call
759: .vb
760:       NEPSetOptionsPrefix(nep1,"neig1_")
761:       NEPSetOptionsPrefix(nep2,"neig2_")
762: .ve

764:    Level: advanced

766: .seealso: NEPAppendOptionsPrefix(), NEPGetOptionsPrefix()
767: @*/
768: PetscErrorCode NEPSetOptionsPrefix(NEP nep,const char *prefix)
769: {

774:   if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
775:   IPSetOptionsPrefix(nep->ip,prefix);
776:   if (!nep->ds) { NEPGetDS(nep,&nep->ds); }
777:   DSSetOptionsPrefix(nep->ds,prefix);
778:   if (!nep->ksp) { NEPGetKSP(nep,&nep->ksp); }
779:   KSPSetOptionsPrefix(nep->ksp,prefix);
780:   KSPAppendOptionsPrefix(nep->ksp,"nep_");
781:   PetscObjectSetOptionsPrefix((PetscObject)nep,prefix);
782:   return(0);
783: }

787: /*@C
788:    NEPAppendOptionsPrefix - Appends to the prefix used for searching for all
789:    NEP options in the database.

791:    Logically Collective on NEP

793:    Input Parameters:
794: +  nep - the nonlinear eigensolver context
795: -  prefix - the prefix string to prepend to all NEP option requests

797:    Notes:
798:    A hyphen (-) must NOT be given at the beginning of the prefix name.
799:    The first character of all runtime options is AUTOMATICALLY the hyphen.

801:    Level: advanced

803: .seealso: NEPSetOptionsPrefix(), NEPGetOptionsPrefix()
804: @*/
805: PetscErrorCode NEPAppendOptionsPrefix(NEP nep,const char *prefix)
806: {

811:   if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
812:   IPSetOptionsPrefix(nep->ip,prefix);
813:   if (!nep->ds) { NEPGetDS(nep,&nep->ds); }
814:   DSSetOptionsPrefix(nep->ds,prefix);
815:   if (!nep->ksp) { NEPGetKSP(nep,&nep->ksp); }
816:   KSPSetOptionsPrefix(nep->ksp,prefix);
817:   KSPAppendOptionsPrefix(nep->ksp,"nep_");
818:   PetscObjectAppendOptionsPrefix((PetscObject)nep,prefix);
819:   return(0);
820: }

824: /*@C
825:    NEPGetOptionsPrefix - Gets the prefix used for searching for all
826:    NEP options in the database.

828:    Not Collective

830:    Input Parameters:
831: .  nep - the nonlinear eigensolver context

833:    Output Parameters:
834: .  prefix - pointer to the prefix string used is returned

836:    Notes: On the fortran side, the user should pass in a string 'prefix' of
837:    sufficient length to hold the prefix.

839:    Level: advanced

841: .seealso: NEPSetOptionsPrefix(), NEPAppendOptionsPrefix()
842: @*/
843: PetscErrorCode NEPGetOptionsPrefix(NEP nep,const char *prefix[])
844: {

850:   PetscObjectGetOptionsPrefix((PetscObject)nep,prefix);
851:   return(0);
852: }
slepc-3.4.2.dfsg.orig/src/nep/interface/nepbasic.c0000644000175000017500000010104112211062077020671 0ustar gladkgladk/* Basic NEP routines, Create, View, etc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ PetscFunctionList NEPList = 0; PetscBool NEPRegisterAllCalled = PETSC_FALSE; PetscClassId NEP_CLASSID = 0; PetscLogEvent NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0; static PetscBool NEPPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "NEPFinalizePackage" /*@C NEPFinalizePackage - This function destroys everything in the Slepc interface to the NEP package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode NEPFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&NEPList);CHKERRQ(ierr); NEPPackageInitialized = PETSC_FALSE; NEPRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPInitializePackage" /*@C NEPInitializePackage - This function initializes everything in the NEP package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to NEPCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode NEPInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (NEPPackageInitialized) PetscFunctionReturn(0); NEPPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Nonlinear Eigenvalue Problem solver",&NEP_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = NEPRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp);CHKERRQ(ierr); ierr = PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve);CHKERRQ(ierr); ierr = PetscLogEventRegister("NEPDense",NEP_CLASSID,&NEP_Dense);CHKERRQ(ierr); ierr = PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval);CHKERRQ(ierr); ierr = PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"nep",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(NEP_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"nep",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(NEP_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(NEPFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPView" /*@C NEPView - Prints the NEP data structure. Collective on NEP Input Parameters: + nep - the nonlinear eigenproblem solver context - viewer - optional visualization context Options Database Key: . -nep_view - Calls NEPView() at end of NEPSolve() Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode NEPView(NEP nep,PetscViewer viewer) { PetscErrorCode ierr; char str[50]; PetscBool isascii,isslp; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(nep,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)nep,viewer,"NEP Object");CHKERRQ(ierr); if (nep->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*nep->ops->view)(nep,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } if (nep->split) { ierr = PetscViewerASCIIPrintf(viewer," nonlinear operator in split form\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," nonlinear operator from user callbacks\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: ");CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,nep->target,PETSC_FALSE);CHKERRQ(ierr); if (!nep->which) { ierr = PetscViewerASCIIPrintf(viewer,"not yet set\n");CHKERRQ(ierr); } else switch (nep->which) { case NEP_TARGET_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (in magnitude)\n",str);CHKERRQ(ierr); break; case NEP_TARGET_REAL: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the real axis)\n",str);CHKERRQ(ierr); break; case NEP_TARGET_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the imaginary axis)\n",str);CHKERRQ(ierr); break; case NEP_LARGEST_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");CHKERRQ(ierr); break; case NEP_SMALLEST_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");CHKERRQ(ierr); break; case NEP_LARGEST_REAL: ierr = PetscViewerASCIIPrintf(viewer,"largest real parts\n");CHKERRQ(ierr); break; case NEP_SMALLEST_REAL: ierr = PetscViewerASCIIPrintf(viewer,"smallest real parts\n");CHKERRQ(ierr); break; case NEP_LARGEST_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");CHKERRQ(ierr); break; case NEP_SMALLEST_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)nep),1,"Wrong value of nep->which"); } ierr = PetscViewerASCIIPrintf(viewer," number of eigenvalues (nev): %D\n",nep->nev);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %D\n",nep->ncv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum dimension of projected problem (mpd): %D\n",nep->mpd);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %D\n",nep->max_it);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum number of function evaluations: %D\n",nep->max_funcs);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," tolerances: relative=%G, absolute=%G, solution=%G\n",nep->rtol,nep->abstol,nep->stol);CHKERRQ(ierr); if (nep->lag) { ierr = PetscViewerASCIIPrintf(viewer," updating the preconditioner every %D iterations\n",nep->lag);CHKERRQ(ierr); } if (nep->cctol) { ierr = PetscViewerASCIIPrintf(viewer," using a constant tolerance for the linear solver\n");CHKERRQ(ierr); } if (nep->nini) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial space: %D\n",PetscAbs(nep->nini));CHKERRQ(ierr); } } else { if (nep->ops->view) { ierr = (*nep->ops->view)(nep,viewer);CHKERRQ(ierr); } } if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } ierr = IPView(nep->ip,viewer);CHKERRQ(ierr); if (!nep->ds) { ierr = NEPGetDS(nep,&nep->ds);CHKERRQ(ierr); } ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr); ierr = DSView(nep->ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)nep,NEPSLP,&isslp);CHKERRQ(ierr); if (!isslp) { if (!nep->ksp) { ierr = NEPGetKSP(nep,&nep->ksp);CHKERRQ(ierr); } ierr = KSPView(nep->ksp,viewer);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPCreate" /*@C NEPCreate - Creates the default NEP context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . nep - location to put the NEP context Level: beginner .seealso: NEPSetUp(), NEPSolve(), NEPDestroy(), NEP @*/ PetscErrorCode NEPCreate(MPI_Comm comm,NEP *outnep) { PetscErrorCode ierr; NEP nep; PetscFunctionBegin; PetscValidPointer(outnep,2); *outnep = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = NEPInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(nep,_p_NEP,struct _NEPOps,NEP_CLASSID,"NEP","Nonlinear Eigenvalue Problem","NEP",comm,NEPDestroy,NEPView);CHKERRQ(ierr); nep->max_it = 0; nep->max_funcs = 0; nep->nev = 1; nep->ncv = 0; nep->mpd = 0; nep->lag = 1; nep->nini = 0; nep->allocated_ncv = 0; nep->ip = 0; nep->ds = 0; nep->function = 0; nep->function_pre = 0; nep->jacobian = 0; nep->abstol = PETSC_DEFAULT; nep->rtol = PETSC_DEFAULT; nep->stol = PETSC_DEFAULT; nep->ktol = 0.1; nep->cctol = PETSC_FALSE; nep->ttol = 0.0; nep->which = (NEPWhich)0; nep->computefunction = NULL; nep->computejacobian = NULL; nep->comparison = NULL; nep->converged = NEPConvergedDefault; nep->convergeddestroy= NULL; nep->comparisonctx = NULL; nep->convergedctx = NULL; nep->functionctx = NULL; nep->jacobianctx = NULL; nep->V = NULL; nep->IS = NULL; nep->eig = NULL; nep->errest = NULL; nep->data = NULL; nep->t = NULL; nep->split = PETSC_FALSE; nep->nt = 0; nep->mstr = DIFFERENT_NONZERO_PATTERN; nep->A = NULL; nep->f = NULL; nep->nconv = 0; nep->its = 0; nep->perm = NULL; nep->nfuncs = 0; nep->linits = 0; nep->nwork = 0; nep->work = NULL; nep->setupcalled = 0; nep->reason = NEP_CONVERGED_ITERATING; nep->numbermonitors = 0; nep->trackall = PETSC_FALSE; nep->rand = 0; ierr = PetscRandomCreate(comm,&nep->rand);CHKERRQ(ierr); ierr = PetscRandomSetSeed(nep->rand,0x12345678);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,nep->rand);CHKERRQ(ierr); *outnep = nep; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetType" /*@C NEPSetType - Selects the particular solver to be used in the NEP object. Logically Collective on NEP Input Parameters: + nep - the nonlinear eigensolver context - type - a known method Options Database Key: . -nep_type - Sets the method; use -help for a list of available methods Notes: See "slepc/include/slepcnep.h" for available methods. Normally, it is best to use the NEPSetFromOptions() command and then set the NEP type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The NEPSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database. Level: intermediate .seealso: NEPType @*/ PetscErrorCode NEPSetType(NEP nep,NEPType type) { PetscErrorCode ierr,(*r)(NEP); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)nep,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(NEPList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown NEP type given: %s",type); if (nep->ops->destroy) { ierr = (*nep->ops->destroy)(nep);CHKERRQ(ierr); } ierr = PetscMemzero(nep->ops,sizeof(struct _NEPOps));CHKERRQ(ierr); nep->setupcalled = 0; ierr = PetscObjectChangeTypeName((PetscObject)nep,type);CHKERRQ(ierr); ierr = (*r)(nep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetType" /*@C NEPGetType - Gets the NEP type as a string from the NEP object. Not Collective Input Parameter: . nep - the eigensolver context Output Parameter: . name - name of NEP method Level: intermediate .seealso: NEPSetType() @*/ PetscErrorCode NEPGetType(NEP nep,NEPType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)nep)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPRegister" /*@C NEPRegister - Adds a method to the quadratic eigenproblem solver package. Not Collective Input Parameters: + name - name of a new user-defined solver - function - routine to create the solver context Notes: NEPRegister() may be called multiple times to add several user-defined solvers. Sample usage: .vb NEPRegister("my_solver",MySolverCreate); .ve Then, your solver can be chosen with the procedural interface via $ NEPSetType(qep,"my_solver") or at runtime via the option $ -qep_type my_solver Level: advanced .seealso: NEPRegisterAll() @*/ PetscErrorCode NEPRegister(const char *name,PetscErrorCode (*function)(NEP)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&NEPList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPReset" /*@ NEPReset - Resets the NEP context to the setupcalled=0 state and removes any allocated objects. Collective on NEP Input Parameter: . nep - eigensolver context obtained from NEPCreate() Level: advanced .seealso: NEPDestroy() @*/ PetscErrorCode NEPReset(NEP nep) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (nep->ops->reset) { ierr = (nep->ops->reset)(nep);CHKERRQ(ierr); } if (nep->ip) { ierr = IPReset(nep->ip);CHKERRQ(ierr); } if (nep->ds) { ierr = DSReset(nep->ds);CHKERRQ(ierr); } ierr = VecDestroy(&nep->t);CHKERRQ(ierr); ierr = NEPFreeSolution(nep);CHKERRQ(ierr); nep->nfuncs = 0; nep->linits = 0; nep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPDestroy" /*@C NEPDestroy - Destroys the NEP context. Collective on NEP Input Parameter: . nep - eigensolver context obtained from NEPCreate() Level: beginner .seealso: NEPCreate(), NEPSetUp(), NEPSolve() @*/ PetscErrorCode NEPDestroy(NEP *nep) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; if (!*nep) PetscFunctionReturn(0); PetscValidHeaderSpecific(*nep,NEP_CLASSID,1); if (--((PetscObject)(*nep))->refct > 0) { *nep = 0; PetscFunctionReturn(0); } ierr = NEPReset(*nep);CHKERRQ(ierr); if ((*nep)->ops->destroy) { ierr = (*(*nep)->ops->destroy)(*nep);CHKERRQ(ierr); } ierr = KSPDestroy(&(*nep)->ksp);CHKERRQ(ierr); ierr = IPDestroy(&(*nep)->ip);CHKERRQ(ierr); ierr = DSDestroy(&(*nep)->ds);CHKERRQ(ierr); ierr = MatDestroy(&(*nep)->function);CHKERRQ(ierr); ierr = MatDestroy(&(*nep)->function_pre);CHKERRQ(ierr); ierr = MatDestroy(&(*nep)->jacobian);CHKERRQ(ierr); if ((*nep)->split) { ierr = MatDestroyMatrices((*nep)->nt,&(*nep)->A);CHKERRQ(ierr); for (i=0;i<(*nep)->nt;i++) { ierr = FNDestroy(&(*nep)->f[i]);CHKERRQ(ierr); } ierr = PetscFree((*nep)->f);CHKERRQ(ierr); } ierr = PetscRandomDestroy(&(*nep)->rand);CHKERRQ(ierr); /* just in case the initial vectors have not been used */ ierr = SlepcBasisDestroy_Private(&(*nep)->nini,&(*nep)->IS);CHKERRQ(ierr); ierr = NEPMonitorCancel(*nep);CHKERRQ(ierr); ierr = PetscHeaderDestroy(nep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetIP" /*@ NEPSetIP - Associates an inner product object to the nonlinear eigensolver. Collective on NEP Input Parameters: + nep - eigensolver context obtained from NEPCreate() - ip - the inner product object Note: Use NEPGetIP() to retrieve the inner product context (for example, to free it at the end of the computations). Level: advanced .seealso: NEPGetIP() @*/ PetscErrorCode NEPSetIP(NEP nep,IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidHeaderSpecific(ip,IP_CLASSID,2); PetscCheckSameComm(nep,1,ip,2); ierr = PetscObjectReference((PetscObject)ip);CHKERRQ(ierr); ierr = IPDestroy(&nep->ip);CHKERRQ(ierr); nep->ip = ip; ierr = PetscLogObjectParent(nep,nep->ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetIP" /*@C NEPGetIP - Obtain the inner product object associated to the nonlinear eigensolver object. Not Collective Input Parameters: . nep - eigensolver context obtained from NEPCreate() Output Parameter: . ip - inner product context Level: advanced .seealso: NEPSetIP() @*/ PetscErrorCode NEPGetIP(NEP nep,IP *ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(ip,2); if (!nep->ip) { ierr = IPCreate(PetscObjectComm((PetscObject)nep),&nep->ip);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,nep->ip);CHKERRQ(ierr); } *ip = nep->ip; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetDS" /*@ NEPSetDS - Associates a direct solver object to the nonlinear eigensolver. Collective on NEP Input Parameters: + nep - eigensolver context obtained from NEPCreate() - ds - the direct solver object Note: Use NEPGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations). Level: advanced .seealso: NEPGetDS() @*/ PetscErrorCode NEPSetDS(NEP nep,DS ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidHeaderSpecific(ds,DS_CLASSID,2); PetscCheckSameComm(nep,1,ds,2); ierr = PetscObjectReference((PetscObject)ds);CHKERRQ(ierr); ierr = DSDestroy(&nep->ds);CHKERRQ(ierr); nep->ds = ds; ierr = PetscLogObjectParent(nep,nep->ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetDS" /*@C NEPGetDS - Obtain the direct solver object associated to the nonlinear eigensolver object. Not Collective Input Parameters: . nep - eigensolver context obtained from NEPCreate() Output Parameter: . ds - direct solver context Level: advanced .seealso: NEPSetDS() @*/ PetscErrorCode NEPGetDS(NEP nep,DS *ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(ds,2); if (!nep->ds) { ierr = DSCreate(PetscObjectComm((PetscObject)nep),&nep->ds);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,nep->ds);CHKERRQ(ierr); } *ds = nep->ds; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetKSP" /*@ NEPSetKSP - Associates a linear solver object to the nonlinear eigensolver. Collective on NEP Input Parameters: + nep - eigensolver context obtained from NEPCreate() - ksp - the linear solver object Note: Use NEPGetKSP() to retrieve the linear solver context (for example, to free it at the end of the computations). Level: developer .seealso: NEPGetKSP() @*/ PetscErrorCode NEPSetKSP(NEP nep,KSP ksp) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidHeaderSpecific(ksp,KSP_CLASSID,2); PetscCheckSameComm(nep,1,ksp,2); ierr = PetscObjectReference((PetscObject)ksp);CHKERRQ(ierr); ierr = KSPDestroy(&nep->ksp);CHKERRQ(ierr); nep->ksp = ksp; ierr = PetscLogObjectParent(nep,nep->ksp);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetKSP" /*@C NEPGetKSP - Obtain the linear solver (KSP) object associated to the eigensolver object. Not Collective Input Parameters: . nep - eigensolver context obtained from NEPCreate() Output Parameter: . ksp - linear solver context Level: beginner .seealso: NEPSetKSP() @*/ PetscErrorCode NEPGetKSP(NEP nep,KSP *ksp) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(ksp,2); if (!nep->ksp) { ierr = KSPCreate(PetscObjectComm((PetscObject)nep),&nep->ksp);CHKERRQ(ierr); ierr = KSPSetOptionsPrefix(nep->ksp,((PetscObject)nep)->prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(nep->ksp,"nep_");CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)nep->ksp,(PetscObject)nep,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,nep->ksp);CHKERRQ(ierr); } *ksp = nep->ksp; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetTarget" /*@ NEPSetTarget - Sets the value of the target. Logically Collective on NEP Input Parameters: + nep - eigensolver context - target - the value of the target Notes: The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with NEPSetWhichEigenpairs(). Level: beginner .seealso: NEPGetTarget(), NEPSetWhichEigenpairs() @*/ PetscErrorCode NEPSetTarget(NEP nep,PetscScalar target) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveScalar(nep,target,2); nep->target = target; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetTarget" /*@ NEPGetTarget - Gets the value of the target. Not Collective Input Parameter: . nep - eigensolver context Output Parameter: . target - the value of the target Level: beginner Note: If the target was not set by the user, then zero is returned. .seealso: NEPSetTarget() @*/ PetscErrorCode NEPGetTarget(NEP nep,PetscScalar* target) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidScalarPointer(target,2); *target = nep->target; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetFunction" /*@C NEPSetFunction - Sets the function to compute the nonlinear Function T(lambda) as well as the location to store the matrix. Logically Collective on NEP and Mat Input Parameters: + nep - the NEP context . A - Function matrix . B - preconditioner matrix (usually same as the Function) . fun - Function evaluation routine (if NULL then NEP retains any previously set value) - ctx - [optional] user-defined context for private data for the Function evaluation routine (may be NULL) (if NULL then NEP retains any previously set value) Notes: The routine fun() takes Mat* as the matrix arguments rather than Mat. This allows the Function evaluation routine to replace A and/or B with a completely new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations. Level: beginner .seealso: NEPGetFunction(), NEPSetJacobian() @*/ PetscErrorCode NEPSetFunction(NEP nep,Mat A,Mat B,PetscErrorCode (*fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void *ctx) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (A) PetscValidHeaderSpecific(A,MAT_CLASSID,2); if (B) PetscValidHeaderSpecific(B,MAT_CLASSID,3); if (A) PetscCheckSameComm(nep,1,A,2); if (B) PetscCheckSameComm(nep,1,B,3); if (fun) nep->computefunction = fun; if (ctx) nep->functionctx = ctx; if (A) { ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr); ierr = MatDestroy(&nep->function);CHKERRQ(ierr); nep->function = A; } if (B) { ierr = PetscObjectReference((PetscObject)B);CHKERRQ(ierr); ierr = MatDestroy(&nep->function_pre);CHKERRQ(ierr); nep->function_pre = B; } nep->split = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetFunction" /*@C NEPGetFunction - Returns the Function matrix and optionally the user provided context for evaluating the Function. Not Collective, but Mat object will be parallel if NEP object is Input Parameter: . nep - the nonlinear eigensolver context Output Parameters: + A - location to stash Function matrix (or NULL) . B - location to stash preconditioner matrix (or NULL) . fun - location to put Function function (or NULL) - ctx - location to stash Function context (or NULL) Level: advanced .seealso: NEPSetFunction() @*/ PetscErrorCode NEPGetFunction(NEP nep,Mat *A,Mat *B,PetscErrorCode (**fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (A) *A = nep->function; if (B) *B = nep->function_pre; if (fun) *fun = nep->computefunction; if (ctx) *ctx = nep->functionctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetJacobian" /*@C NEPSetJacobian - Sets the function to compute Jacobian T'(lambda) as well as the location to store the matrix. Logically Collective on NEP and Mat Input Parameters: + nep - the NEP context . A - Jacobian matrix . jac - Jacobian evaluation routine (if NULL then NEP retains any previously set value) - ctx - [optional] user-defined context for private data for the Jacobian evaluation routine (may be NULL) (if NULL then NEP retains any previously set value) Notes: The routine jac() takes Mat* as the matrix arguments rather than Mat. This allows the Jacobian evaluation routine to replace A with a completely new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations. Level: beginner .seealso: NEPSetFunction(), NEPGetJacobian() @*/ PetscErrorCode NEPSetJacobian(NEP nep,Mat A,PetscErrorCode (*jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void *ctx) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (A) PetscValidHeaderSpecific(A,MAT_CLASSID,2); if (A) PetscCheckSameComm(nep,1,A,2); if (jac) nep->computejacobian = jac; if (ctx) nep->jacobianctx = ctx; if (A) { ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr); ierr = MatDestroy(&nep->jacobian);CHKERRQ(ierr); nep->jacobian = A; } nep->split = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetJacobian" /*@C NEPGetJacobian - Returns the Jacobian matrix and optionally the user provided context for evaluating the Jacobian. Not Collective, but Mat object will be parallel if NEP object is Input Parameter: . nep - the nonlinear eigensolver context Output Parameters: + A - location to stash Jacobian matrix (or NULL) . jac - location to put Jacobian function (or NULL) - ctx - location to stash Jacobian context (or NULL) Level: advanced .seealso: NEPSetJacobian() @*/ PetscErrorCode NEPGetJacobian(NEP nep,Mat *A,PetscErrorCode (**jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (A) *A = nep->jacobian; if (jac) *jac = nep->computejacobian; if (ctx) *ctx = nep->jacobianctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetSplitOperator" /*@ NEPSetSplitOperator - Sets the operator of the nonlinear eigenvalue problem in split form. Collective on NEP, Mat and FN Input Parameters: + nep - the nonlinear eigensolver context . n - number of terms in the split form . A - array of matrices . f - array of functions - str - structure flag for matrices Notes: The nonlinear operator is written as T(lambda) = sum_i A_i*f_i(lambda), for i=1,...,n. The derivative T'(lambda) can be obtained using the derivatives of f_i. The structure flag provides information about A_i's nonzero pattern (see MatStructure enum). If all matrices have the same pattern, then use SAME_NONZERO_PATTERN. If the patterns are different but contained in the pattern of the first one, then use SUBSET_NONZERO_PATTERN. Otherwise use DIFFERENT_NONZERO_PATTERN. This function must be called before NEPSetUp(). If it is called again after NEPSetUp() then the NEP object is reset. Level: intermediate .seealso: NEPGetSplitOperatorTerm(), NEPGetSplitOperatorInfo() @*/ PetscErrorCode NEPSetSplitOperator(NEP nep,PetscInt n,Mat A[],FN f[],MatStructure str) { PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,n,2); if (n <= 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Must have one or more terms, you have %D",n); PetscValidPointer(A,3); PetscCheckSameComm(nep,1,*A,3); PetscValidPointer(f,4); PetscCheckSameComm(nep,1,*f,4); if (nep->setupcalled) { ierr = NEPReset(nep);CHKERRQ(ierr); } /* clean previously stored information */ ierr = MatDestroy(&nep->function);CHKERRQ(ierr); ierr = MatDestroy(&nep->function_pre);CHKERRQ(ierr); ierr = MatDestroy(&nep->jacobian);CHKERRQ(ierr); if (nep->split) { ierr = MatDestroyMatrices(nep->nt,&nep->A);CHKERRQ(ierr); for (i=0;int;i++) { ierr = FNDestroy(&nep->f[i]);CHKERRQ(ierr); } ierr = PetscFree(nep->f);CHKERRQ(ierr); } /* allocate space and copy matrices and functions */ ierr = PetscMalloc(n*sizeof(Mat),&nep->A);CHKERRQ(ierr); ierr = PetscLogObjectMemory(nep,n*sizeof(Mat));CHKERRQ(ierr); for (i=0;iA[i] = A[i]; } ierr = PetscMalloc(n*sizeof(FN),&nep->f);CHKERRQ(ierr); ierr = PetscLogObjectMemory(nep,n*sizeof(FN));CHKERRQ(ierr); for (i=0;if[i] = f[i]; } nep->nt = n; nep->mstr = str; nep->split = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetSplitOperatorTerm" /*@ NEPGetSplitOperatorTerm - Gets the matrices and functions associated with the nonlinear operator in split form. Not collective, though parallel Mats and FNs are returned if the NEP is parallel Input Parameter: + nep - the nonlinear eigensolver context - k - the index of the requested term (starting in 0) Output Parameters: + A - the matrix of the requested term - f - the function of the requested term Level: intermediate .seealso: NEPSetSplitOperator(), NEPGetSplitOperatorInfo() @*/ PetscErrorCode NEPGetSplitOperatorTerm(NEP nep,PetscInt k,Mat *A,FN *f) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (k<0 || k>=nep->nt) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",nep->nt-1); if (A) *A = nep->A[k]; if (f) *f = nep->f[k]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetSplitOperatorInfo" /*@ NEPGetSplitOperatorInfo - Returns the number of terms of the split form of the nonlinear operator, as well as the structure flag for matrices. Not collective Input Parameter: . nep - the nonlinear eigensolver context Output Parameters: + n - the number of terms passed in NEPSetSplitOperator() - str - the matrix structure flag passed in NEPSetSplitOperator() Level: intermediate .seealso: NEPSetSplitOperator(), NEPGetSplitOperatorTerm() @*/ PetscErrorCode NEPGetSplitOperatorInfo(NEP nep,PetscInt *n,MatStructure *str) { PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (n) *n = nep->nt; if (str) *str = nep->mstr; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/makefile0000644000175000017500000000224112211062077020443 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = nepmon.c nepbasic.c nepdefault.c nepregis.c nepopts.c nepsetup.c nepsolve.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = NEP LOCDIR = src/nep/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/interface/makefile.html0000644000175000017500000000403512211062077021411 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = nepmon.c nepbasic.c nepdefault.c nepregis.c nepopts.c nepsetup.c nepsolve.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = NEP
LOCDIR   = src/nep/interface/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/nep/interface/index.html0000644000175000017500000000250412211062077020742 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

nepmon.c
nepbasic.c
nepdefault.c
nepregis.c
nepopts.c
nepsetup.c
nepsolve.c
makefile
slepc-3.4.2.dfsg.orig/src/nep/interface/nepdefault.c0000644000175000017500000001107512211062077021243 0ustar gladkgladk/* This file contains some simple default routines for common NEP operations. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "NEPReset_Default" PetscErrorCode NEPReset_Default(NEP nep) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDestroyVecs(nep->nwork,&nep->work);CHKERRQ(ierr); nep->nwork = 0; ierr = NEPFreeSolution(nep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetWorkVecs" /*@ NEPSetWorkVecs - Sets a number of work vectors into a NEP object Collective on NEP Input Parameters: + nep - nonlinear eigensolver context - nw - number of work vectors to allocate Developers Note: This is PETSC_EXTERN because it may be required by user plugin NEP implementations. Level: developer @*/ PetscErrorCode NEPSetWorkVecs(NEP nep,PetscInt nw) { PetscErrorCode ierr; PetscFunctionBegin; if (nep->nwork != nw) { ierr = VecDestroyVecs(nep->nwork,&nep->work);CHKERRQ(ierr); nep->nwork = nw; ierr = VecDuplicateVecs(nep->t,nw,&nep->work);CHKERRQ(ierr); ierr = PetscLogObjectParents(nep,nw,nep->work);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPGetDefaultShift" /* NEPGetDefaultShift - Return the value of sigma to start the nonlinear iteration. */ PetscErrorCode NEPGetDefaultShift(NEP nep,PetscScalar *sigma) { PetscFunctionBegin; PetscValidPointer(sigma,2); switch (nep->which) { case NEP_LARGEST_MAGNITUDE: case NEP_LARGEST_IMAGINARY: *sigma = 1.0; /* arbitrary value */ break; case NEP_SMALLEST_MAGNITUDE: case NEP_SMALLEST_IMAGINARY: *sigma = 0.0; break; case NEP_LARGEST_REAL: *sigma = PETSC_MAX_REAL; break; case NEP_SMALLEST_REAL: *sigma = PETSC_MIN_REAL; break; case NEP_TARGET_MAGNITUDE: case NEP_TARGET_REAL: case NEP_TARGET_IMAGINARY: *sigma = nep->target; break; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPConvergedDefault" /* NEPConvergedDefault - Checks convergence of the nonlinear eigensolver. */ PetscErrorCode NEPConvergedDefault(NEP nep,PetscInt it,PetscReal xnorm,PetscReal snorm,PetscReal fnorm,NEPConvergedReason *reason,void *ctx) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidPointer(reason,6); *reason = NEP_CONVERGED_ITERATING; if (!it) { /* set parameter for default relative tolerance convergence test */ nep->ttol = fnorm*nep->rtol; } if (PetscIsInfOrNanReal(fnorm)) { ierr = PetscInfo(nep,"Failed to converged, function norm is NaN\n");CHKERRQ(ierr); *reason = NEP_DIVERGED_FNORM_NAN; } else if (fnorm < nep->abstol) { ierr = PetscInfo2(nep,"Converged due to function norm %14.12e < %14.12e\n",(double)fnorm,(double)nep->abstol);CHKERRQ(ierr); *reason = NEP_CONVERGED_FNORM_ABS; } else if (nep->nfuncs >= nep->max_funcs) { ierr = PetscInfo2(nep,"Exceeded maximum number of function evaluations: %D > %D\n",nep->nfuncs,nep->max_funcs);CHKERRQ(ierr); *reason = NEP_DIVERGED_FUNCTION_COUNT; } if (it && !*reason) { if (fnorm <= nep->ttol) { ierr = PetscInfo2(nep,"Converged due to function norm %14.12e < %14.12e (relative tolerance)\n",(double)fnorm,(double)nep->ttol);CHKERRQ(ierr); *reason = NEP_CONVERGED_FNORM_RELATIVE; } else if (snorm < nep->stol*xnorm) { ierr = PetscInfo3(nep,"Converged due to small update length: %14.12e < %14.12e * %14.12e\n",(double)snorm,(double)nep->stol,(double)xnorm);CHKERRQ(ierr); *reason = NEP_CONVERGED_SNORM_RELATIVE; } } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/nepdefault.c.html0000644000175000017500000002407512211062077022212 0ustar gladkgladk

Actual source code: nepdefault.c

  1: /*
  2:      This file contains some simple default routines for common NEP operations.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/nepimpl.h>     /*I "slepcnep.h" I*/
 25: #include <slepcblaslapack.h>

 29: PetscErrorCode NEPReset_Default(NEP nep)
 30: {

 34:   VecDestroyVecs(nep->nwork,&nep->work);
 35:   nep->nwork = 0;
 36:   NEPFreeSolution(nep);
 37:   return(0);
 38: }

 42: /*@
 43:    NEPSetWorkVecs - Sets a number of work vectors into a NEP object

 45:    Collective on NEP

 47:    Input Parameters:
 48: +  nep - nonlinear eigensolver context
 49: -  nw  - number of work vectors to allocate

 51:    Developers Note:
 52:    This is PETSC_EXTERN because it may be required by user plugin NEP
 53:    implementations.

 55:    Level: developer
 56: @*/
 57: PetscErrorCode NEPSetWorkVecs(NEP nep,PetscInt nw)
 58: {

 62:   if (nep->nwork != nw) {
 63:     VecDestroyVecs(nep->nwork,&nep->work);
 64:     nep->nwork = nw;
 65:     VecDuplicateVecs(nep->t,nw,&nep->work);
 66:     PetscLogObjectParents(nep,nw,nep->work);
 67:   }
 68:   return(0);
 69: }

 73: /*
 74:   NEPGetDefaultShift - Return the value of sigma to start the nonlinear iteration.
 75:  */
 76: PetscErrorCode NEPGetDefaultShift(NEP nep,PetscScalar *sigma)
 77: {
 80:   switch (nep->which) {
 81:     case NEP_LARGEST_MAGNITUDE:
 82:     case NEP_LARGEST_IMAGINARY:
 83:       *sigma = 1.0;   /* arbitrary value */
 84:       break;
 85:     case NEP_SMALLEST_MAGNITUDE:
 86:     case NEP_SMALLEST_IMAGINARY:
 87:       *sigma = 0.0;
 88:       break;
 89:     case NEP_LARGEST_REAL:
 90:       *sigma = PETSC_MAX_REAL;
 91:       break;
 92:     case NEP_SMALLEST_REAL:
 93:       *sigma = PETSC_MIN_REAL;
 94:       break;
 95:     case NEP_TARGET_MAGNITUDE:
 96:     case NEP_TARGET_REAL:
 97:     case NEP_TARGET_IMAGINARY:
 98:       *sigma = nep->target;
 99:       break;
100:   }
101:   return(0);
102: }

106: /*
107:   NEPConvergedDefault - Checks convergence of the nonlinear eigensolver.
108: */
109: PetscErrorCode NEPConvergedDefault(NEP nep,PetscInt it,PetscReal xnorm,PetscReal snorm,PetscReal fnorm,NEPConvergedReason *reason,void *ctx)
110: {


117:   *reason = NEP_CONVERGED_ITERATING;

119:   if (!it) {
120:     /* set parameter for default relative tolerance convergence test */
121:     nep->ttol = fnorm*nep->rtol;
122:   }
123:   if (PetscIsInfOrNanReal(fnorm)) {
124:     PetscInfo(nep,"Failed to converged, function norm is NaN\n");
125:     *reason = NEP_DIVERGED_FNORM_NAN;
126:   } else if (fnorm < nep->abstol) {
127:     PetscInfo2(nep,"Converged due to function norm %14.12e < %14.12e\n",(double)fnorm,(double)nep->abstol);
128:     *reason = NEP_CONVERGED_FNORM_ABS;
129:   } else if (nep->nfuncs >= nep->max_funcs) {
130:     PetscInfo2(nep,"Exceeded maximum number of function evaluations: %D > %D\n",nep->nfuncs,nep->max_funcs);
131:     *reason = NEP_DIVERGED_FUNCTION_COUNT;
132:   }

134:   if (it && !*reason) {
135:     if (fnorm <= nep->ttol) {
136:       PetscInfo2(nep,"Converged due to function norm %14.12e < %14.12e (relative tolerance)\n",(double)fnorm,(double)nep->ttol);
137:       *reason = NEP_CONVERGED_FNORM_RELATIVE;
138:     } else if (snorm < nep->stol*xnorm) {
139:       PetscInfo3(nep,"Converged due to small update length: %14.12e < %14.12e * %14.12e\n",(double)snorm,(double)nep->stol,(double)xnorm);
140:       *reason = NEP_CONVERGED_SNORM_RELATIVE;
141:     }
142:   }
143:   return(0);
144: }

slepc-3.4.2.dfsg.orig/src/nep/interface/nepregis.c0000644000175000017500000000317512211062077020732 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ PETSC_EXTERN PetscErrorCode NEPCreate_RII(NEP); PETSC_EXTERN PetscErrorCode NEPCreate_SLP(NEP); PETSC_EXTERN PetscErrorCode NEPCreate_NARNOLDI(NEP); #undef __FUNCT__ #define __FUNCT__ "NEPRegisterAll" /*@C NEPRegisterAll - Registers all the solvers in the NEP package. Not Collective Level: advanced .seealso: NEPRegister() @*/ PetscErrorCode NEPRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; NEPRegisterAllCalled = PETSC_TRUE; ierr = NEPRegister(NEPRII,NEPCreate_RII);CHKERRQ(ierr); ierr = NEPRegister(NEPSLP,NEPCreate_SLP);CHKERRQ(ierr); ierr = NEPRegister(NEPNARNOLDI,NEPCreate_NARNOLDI);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/nepmon.c.html0000644000175000017500000007142412211062077021357 0ustar gladkgladk
Actual source code: nepmon.c

  1: /*
  2:       NEP routines related to monitors.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/nepimpl.h>      /*I "slepcnep.h" I*/
 25: #include <petscdraw.h>

 29: /*
 30:    Runs the user provided monitor routines, if any.
 31: */
 32: PetscErrorCode NEPMonitor(NEP nep,PetscInt it,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest)
 33: {
 35:   PetscInt       i,n = nep->numbermonitors;

 38:   for (i=0;i<n;i++) {
 39:     (*nep->monitor[i])(nep,it,nconv,eig,errest,nest,nep->monitorcontext[i]);
 40:   }
 41:   return(0);
 42: }

 46: /*@C
 47:    NEPMonitorSet - Sets an ADDITIONAL function to be called at every
 48:    iteration to monitor the error estimates for each requested eigenpair.

 50:    Logically Collective on NEP

 52:    Input Parameters:
 53: +  nep     - eigensolver context obtained from NEPCreate()
 54: .  monitor - pointer to function (if this is NULL, it turns off monitoring)
 55: .  mctx    - [optional] context for private data for the
 56:              monitor routine (use NULL if no context is desired)
 57: -  monitordestroy - [optional] routine that frees monitor context
 58:              (may be NULL)

 60:    Calling Sequence of monitor:
 61: $     monitor (NEP nep, int its, int nconv, PetscScalar *eig, PetscReal* errest, int nest, void *mctx)

 63: +  nep    - nonlinear eigensolver context obtained from NEPCreate()
 64: .  its    - iteration number
 65: .  nconv  - number of converged eigenpairs
 66: .  eig    - eigenvalues
 67: .  errest - error estimates for each eigenpair
 68: .  nest   - number of error estimates
 69: -  mctx   - optional monitoring context, as set by NEPMonitorSet()

 71:    Options Database Keys:
 72: +    -nep_monitor        - print only the first error estimate
 73: .    -nep_monitor_all    - print error estimates at each iteration
 74: .    -nep_monitor_conv   - print the eigenvalue approximations only when
 75:       convergence has been reached
 76: .    -nep_monitor_lg     - sets line graph monitor for the first unconverged
 77:       approximate eigenvalue
 78: .    -nep_monitor_lg_all - sets line graph monitor for all unconverged
 79:       approximate eigenvalues
 80: -    -nep_monitor_cancel - cancels all monitors that have been hardwired into
 81:       a code by calls to NEPMonitorSet(), but does not cancel those set via
 82:       the options database.

 84:    Notes:
 85:    Several different monitoring routines may be set by calling
 86:    NEPMonitorSet() multiple times; all will be called in the
 87:    order in which they were set.

 89:    Level: intermediate

 91: .seealso: NEPMonitorFirst(), NEPMonitorAll(), NEPMonitorCancel()
 92: @*/
 93: PetscErrorCode NEPMonitorSet(NEP nep,PetscErrorCode (*monitor)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
 94: {
 97:   if (nep->numbermonitors >= MAXNEPMONITORS) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Too many NEP monitors set");
 98:   nep->monitor[nep->numbermonitors]           = monitor;
 99:   nep->monitorcontext[nep->numbermonitors]    = (void*)mctx;
100:   nep->monitordestroy[nep->numbermonitors++]  = monitordestroy;
101:   return(0);
102: }

106: /*@
107:    NEPMonitorCancel - Clears all monitors for a NEP object.

109:    Logically Collective on NEP

111:    Input Parameters:
112: .  nep - eigensolver context obtained from NEPCreate()

114:    Options Database Key:
115: .    -nep_monitor_cancel - Cancels all monitors that have been hardwired
116:       into a code by calls to NEPMonitorSet(),
117:       but does not cancel those set via the options database.

119:    Level: intermediate

121: .seealso: NEPMonitorSet()
122: @*/
123: PetscErrorCode NEPMonitorCancel(NEP nep)
124: {
126:   PetscInt       i;

130:   for (i=0; i<nep->numbermonitors; i++) {
131:     if (nep->monitordestroy[i]) {
132:       (*nep->monitordestroy[i])(&nep->monitorcontext[i]);
133:     }
134:   }
135:   nep->numbermonitors = 0;
136:   return(0);
137: }

141: /*@C
142:    NEPGetMonitorContext - Gets the monitor context, as set by
143:    NEPMonitorSet() for the FIRST monitor only.

145:    Not Collective

147:    Input Parameter:
148: .  nep - eigensolver context obtained from NEPCreate()

150:    Output Parameter:
151: .  ctx - monitor context

153:    Level: intermediate

155: .seealso: NEPMonitorSet(), NEPDefaultMonitor()
156: @*/
157: PetscErrorCode NEPGetMonitorContext(NEP nep,void **ctx)
158: {
161:   *ctx = nep->monitorcontext[0];
162:   return(0);
163: }

167: /*@C
168:    NEPMonitorAll - Print the current approximate values and
169:    error estimates at each iteration of the nonlinear eigensolver.

171:    Collective on NEP

173:    Input Parameters:
174: +  nep    - nonlinear eigensolver context
175: .  its    - iteration number
176: .  nconv  - number of converged eigenpairs so far
177: .  eig    - eigenvalues
178: .  errest - error estimates
179: .  nest   - number of error estimates to display
180: -  monctx - monitor context (contains viewer, can be NULL)

182:    Level: intermediate

184: .seealso: NEPMonitorSet(), NEPMonitorFirst(), NEPMonitorConverged()
185: @*/
186: PetscErrorCode NEPMonitorAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
187: {
189:   PetscInt       i;
190:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep));

193:   if (its) {
194:     PetscViewerASCIIAddTab(viewer,((PetscObject)nep)->tablevel);
195:     PetscViewerASCIIPrintf(viewer,"%3D NEP nconv=%D Values (Errors)",its,nconv);
196:     for (i=0;i<nest;i++) {
197: #if defined(PETSC_USE_COMPLEX)
198:       PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eig[i]),PetscImaginaryPart(eig[i]));
199: #else
200:       PetscViewerASCIIPrintf(viewer," %G",eig[i]);
201: #endif
202:       PetscViewerASCIIPrintf(viewer," (%10.8e)",(double)errest[i]);
203:     }
204:     PetscViewerASCIIPrintf(viewer,"\n");
205:     PetscViewerASCIISubtractTab(viewer,((PetscObject)nep)->tablevel);
206:   }
207:   return(0);
208: }

212: /*@C
213:    NEPMonitorFirst - Print the first unconverged approximate value and
214:    error estimate at each iteration of the nonlinear eigensolver.

216:    Collective on NEP

218:    Input Parameters:
219: +  nep    - nonlinear eigensolver context
220: .  its    - iteration number
221: .  nconv  - number of converged eigenpairs so far
222: .  eig    - eigenvalues
223: .  errest - error estimates
224: .  nest   - number of error estimates to display
225: -  monctx - monitor context (contains viewer, can be NULL)

227:    Level: intermediate

229: .seealso: NEPMonitorSet(), NEPMonitorAll(), NEPMonitorConverged()
230: @*/
231: PetscErrorCode NEPMonitorFirst(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
232: {
234:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep));

237:   if (its && nconv<nest) {
238:     PetscViewerASCIIAddTab(viewer,((PetscObject)nep)->tablevel);
239:     PetscViewerASCIIPrintf(viewer,"%3D NEP nconv=%D first unconverged value (error)",its,nconv);
240: #if defined(PETSC_USE_COMPLEX)
241:     PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eig[nconv]),PetscImaginaryPart(eig[nconv]));
242: #else
243:     PetscViewerASCIIPrintf(viewer," %G",eig[nconv]);
244: #endif
245:     PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[nconv]);
246:     PetscViewerASCIISubtractTab(viewer,((PetscObject)nep)->tablevel);
247:   }
248:   return(0);
249: }

253: /*@C
254:    NEPMonitorConverged - Print the approximate values and
255:    error estimates as they converge.

257:    Collective on NEP

259:    Input Parameters:
260: +  nep    - nonlinear eigensolver context
261: .  its    - iteration number
262: .  nconv  - number of converged eigenpairs so far
263: .  eig    - eigenvalues
264: .  errest - error estimates
265: .  nest   - number of error estimates to display
266: -  monctx - monitor context

268:    Level: intermediate

270:    Note:
271:    The monitor context must contain a struct with a PetscViewer and a
272:    PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

274: .seealso: NEPMonitorSet(), NEPMonitorFirst(), NEPMonitorAll()
275: @*/
276: PetscErrorCode NEPMonitorConverged(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
277: {
278:   PetscErrorCode   ierr;
279:   PetscInt         i;
280:   PetscViewer      viewer;
281:   SlepcConvMonitor ctx = (SlepcConvMonitor)monctx;

284:   if (!monctx) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_WRONG,"Must provide a context for NEPMonitorConverged");
285:   if (!its) {
286:     ctx->oldnconv = 0;
287:   } else {
288:     viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep));
289:     for (i=ctx->oldnconv;i<nconv;i++) {
290:       PetscViewerASCIIAddTab(viewer,((PetscObject)nep)->tablevel);
291:       PetscViewerASCIIPrintf(viewer,"%3D NEP converged value (error) #%D",its,i);
292: #if defined(PETSC_USE_COMPLEX)
293:       PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eig[i]),PetscImaginaryPart(eig[i]));
294: #else
295:       PetscViewerASCIIPrintf(viewer," %G",eig[i]);
296: #endif
297:       PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);
298:       PetscViewerASCIISubtractTab(viewer,((PetscObject)nep)->tablevel);
299:     }
300:     ctx->oldnconv = nconv;
301:   }
302:   return(0);
303: }

307: PetscErrorCode NEPMonitorLG(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
308: {
309:   PetscViewer    viewer = (PetscViewer)monctx;
310:   PetscDraw      draw;
311:   PetscDrawLG    lg;
313:   PetscReal      x,y;

316:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)nep));
317:   PetscViewerDrawGetDraw(viewer,0,&draw);
318:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
319:   if (!its) {
320:     PetscDrawSetTitle(draw,"Error estimates");
321:     PetscDrawSetDoubleBuffer(draw);
322:     PetscDrawLGSetDimension(lg,1);
323:     PetscDrawLGReset(lg);
324:     PetscDrawLGSetLimits(lg,0,1.0,log10(nep->rtol)-2,0.0);
325:   }

327:   x = (PetscReal)its;
328:   if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0;
329:   PetscDrawLGAddPoint(lg,&x,&y);

331:   PetscDrawLGDraw(lg);
332:   return(0);
333: }

337: PetscErrorCode NEPMonitorLGAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
338: {
339:   PetscViewer    viewer = (PetscViewer)monctx;
340:   PetscDraw      draw;
341:   PetscDrawLG    lg;
343:   PetscReal      *x,*y;
344:   PetscInt       i,n = PetscMin(nep->nev,255);

347:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)nep));
348:   PetscViewerDrawGetDraw(viewer,0,&draw);
349:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
350:   if (!its) {
351:     PetscDrawSetTitle(draw,"Error estimates");
352:     PetscDrawSetDoubleBuffer(draw);
353:     PetscDrawLGSetDimension(lg,n);
354:     PetscDrawLGReset(lg);
355:     PetscDrawLGSetLimits(lg,0,1.0,log10(nep->rtol)-2,0.0);
356:   }

358:   PetscMalloc(sizeof(PetscReal)*n,&x);
359:   PetscMalloc(sizeof(PetscReal)*n,&y);
360:   for (i=0;i<n;i++) {
361:     x[i] = (PetscReal)its;
362:     if (i < nest && errest[i] > 0.0) y[i] = log10(errest[i]);
363:     else y[i] = 0.0;
364:   }
365:   PetscDrawLGAddPoint(lg,x,y);

367:   PetscDrawLGDraw(lg);
368:   PetscFree(x);
369:   PetscFree(y);
370:   return(0);
371: }

slepc-3.4.2.dfsg.orig/src/nep/interface/nepsetup.c0000644000175000017500000002120212211062077020750 0ustar gladkgladk/* NEP routines related to problem setup. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcnep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "NEPSetUp" /*@ NEPSetUp - Sets up all the internal data structures necessary for the execution of the NEP solver. Collective on NEP Input Parameter: . nep - solver context Notes: This function need not be called explicitly in most cases, since NEPSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time. Level: advanced .seealso: NEPCreate(), NEPSolve(), NEPDestroy() @*/ PetscErrorCode NEPSetUp(NEP nep) { PetscErrorCode ierr; Mat T; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); if (nep->setupcalled) PetscFunctionReturn(0); ierr = PetscLogEventBegin(NEP_SetUp,nep,0,0,0);CHKERRQ(ierr); /* reset the convergence flag from the previous solves */ nep->reason = NEP_CONVERGED_ITERATING; /* Set default solver type (NEPSetFromOptions was not called) */ if (!((PetscObject)nep)->type_name) { ierr = NEPSetType(nep,NEPRII);CHKERRQ(ierr); } if (!nep->ip) { ierr = NEPGetIP(nep,&nep->ip);CHKERRQ(ierr); } if (!((PetscObject)nep->ip)->type_name) { ierr = IPSetType_Default(nep->ip);CHKERRQ(ierr); } if (!nep->ds) { ierr = NEPGetDS(nep,&nep->ds);CHKERRQ(ierr); } ierr = DSReset(nep->ds);CHKERRQ(ierr); if (!((PetscObject)nep->rand)->type_name) { ierr = PetscRandomSetFromOptions(nep->rand);CHKERRQ(ierr); } if (!nep->ksp) { ierr = NEPGetKSP(nep,&nep->ksp);CHKERRQ(ierr); } /* by default, compute eigenvalues close to target */ /* nep->target should contain the initial guess for the eigenvalue */ if (!nep->which) nep->which = NEP_TARGET_MAGNITUDE; /* set problem dimensions */ ierr = VecDestroy(&nep->t);CHKERRQ(ierr); if (nep->split) { ierr = MatDuplicate(nep->A[0],MAT_DO_NOT_COPY_VALUES,&nep->function);CHKERRQ(ierr); ierr = MatDuplicate(nep->A[0],MAT_DO_NOT_COPY_VALUES,&nep->jacobian);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,nep->function);CHKERRQ(ierr); ierr = PetscLogObjectParent(nep,nep->jacobian);CHKERRQ(ierr); ierr = SlepcMatGetVecsTemplate(nep->A[0],&nep->t,NULL);CHKERRQ(ierr); } else { ierr = NEPGetFunction(nep,&T,NULL,NULL,NULL);CHKERRQ(ierr); ierr = SlepcMatGetVecsTemplate(T,&nep->t,NULL);CHKERRQ(ierr); } ierr = PetscLogObjectParent(nep,nep->t);CHKERRQ(ierr); ierr = VecGetSize(nep->t,&nep->n);CHKERRQ(ierr); ierr = VecGetLocalSize(nep->t,&nep->nloc);CHKERRQ(ierr); /* call specific solver setup */ ierr = (*nep->ops->setup)(nep);CHKERRQ(ierr); /* set tolerances if not yet set */ if (nep->abstol==PETSC_DEFAULT) nep->abstol = 1e-50; if (nep->rtol==PETSC_DEFAULT) nep->rtol = 100*SLEPC_DEFAULT_TOL; if (nep->stol==PETSC_DEFAULT) nep->stol = SLEPC_DEFAULT_TOL; nep->ktol = 0.1; nep->nfuncs = 0; nep->linits = 0; /* set eigenvalue comparison */ switch (nep->which) { case NEP_LARGEST_MAGNITUDE: nep->comparison = SlepcCompareLargestMagnitude; nep->comparisonctx = NULL; break; case NEP_SMALLEST_MAGNITUDE: nep->comparison = SlepcCompareSmallestMagnitude; nep->comparisonctx = NULL; break; case NEP_LARGEST_REAL: nep->comparison = SlepcCompareLargestReal; nep->comparisonctx = NULL; break; case NEP_SMALLEST_REAL: nep->comparison = SlepcCompareSmallestReal; nep->comparisonctx = NULL; break; case NEP_LARGEST_IMAGINARY: nep->comparison = SlepcCompareLargestImaginary; nep->comparisonctx = NULL; break; case NEP_SMALLEST_IMAGINARY: nep->comparison = SlepcCompareSmallestImaginary; nep->comparisonctx = NULL; break; case NEP_TARGET_MAGNITUDE: nep->comparison = SlepcCompareTargetMagnitude; nep->comparisonctx = &nep->target; break; case NEP_TARGET_REAL: nep->comparison = SlepcCompareTargetReal; nep->comparisonctx = &nep->target; break; case NEP_TARGET_IMAGINARY: nep->comparison = SlepcCompareTargetImaginary; nep->comparisonctx = &nep->target; break; } if (nep->ncv > 2*nep->n) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"ncv must be twice the problem size at most"); if (nep->nev > nep->ncv) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"nev bigger than ncv"); /* process initial vectors */ if (nep->nini<0) { nep->nini = -nep->nini; if (nep->nini>nep->ncv) SETERRQ(PetscObjectComm((PetscObject)nep),1,"The number of initial vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(nep->ip,&nep->nini,&nep->IS,nep->V);CHKERRQ(ierr); } ierr = PetscLogEventEnd(NEP_SetUp,nep,0,0,0);CHKERRQ(ierr); nep->setupcalled = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPSetInitialSpace" /*@ NEPSetInitialSpace - Specify a basis of vectors that constitute the initial space, that is, the subspace from which the solver starts to iterate. Collective on NEP and Vec Input Parameter: + nep - the nonlinear eigensolver context . n - number of vectors - is - set of basis vectors of the initial space Notes: Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored. These vectors do not persist from one NEPSolve() call to the other, so the initial space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster. Level: intermediate @*/ PetscErrorCode NEPSetInitialSpace(NEP nep,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(nep,NEP_CLASSID,1); PetscValidLogicalCollectiveInt(nep,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&nep->nini,&nep->IS);CHKERRQ(ierr); if (n>0) nep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPAllocateSolution" /* NEPAllocateSolution - Allocate memory storage for common variables such as eigenvalues and eigenvectors. All vectors in V (and W) share a contiguous chunk of memory. */ PetscErrorCode NEPAllocateSolution(NEP nep) { PetscErrorCode ierr; PetscInt newc,cnt; PetscFunctionBegin; if (nep->allocated_ncv != nep->ncv) { newc = PetscMax(0,nep->ncv-nep->allocated_ncv); ierr = NEPFreeSolution(nep);CHKERRQ(ierr); cnt = 0; ierr = PetscMalloc(nep->ncv*sizeof(PetscScalar),&nep->eig);CHKERRQ(ierr); cnt += 2*newc*sizeof(PetscScalar); ierr = PetscMalloc(nep->ncv*sizeof(PetscReal),&nep->errest);CHKERRQ(ierr); ierr = PetscMalloc(nep->ncv*sizeof(PetscInt),&nep->perm);CHKERRQ(ierr); cnt += 2*newc*sizeof(PetscReal); ierr = PetscLogObjectMemory(nep,cnt);CHKERRQ(ierr); ierr = VecDuplicateVecs(nep->t,nep->ncv,&nep->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(nep,nep->ncv,nep->V);CHKERRQ(ierr); nep->allocated_ncv = nep->ncv; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "NEPFreeSolution" /* NEPFreeSolution - Free memory storage. This routine is related to NEPAllocateSolution(). */ PetscErrorCode NEPFreeSolution(NEP nep) { PetscErrorCode ierr; PetscFunctionBegin; if (nep->allocated_ncv > 0) { ierr = PetscFree(nep->eig);CHKERRQ(ierr); ierr = PetscFree(nep->errest);CHKERRQ(ierr); ierr = PetscFree(nep->perm);CHKERRQ(ierr); ierr = VecDestroyVecs(nep->allocated_ncv,&nep->V);CHKERRQ(ierr); nep->allocated_ncv = 0; } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/nep/interface/nepsolve.c.html0000644000175000017500000017007012211062077021713 0ustar gladkgladk
Actual source code: nepsolve.c

  1: /*
  2:       NEP routines related to the solution process.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/nepimpl.h>       /*I "slepcnep.h" I*/
 25: #include <petscdraw.h>

 29: /*@
 30:    NEPSolve - Solves the nonlinear eigensystem.

 32:    Collective on NEP

 34:    Input Parameter:
 35: .  nep - eigensolver context obtained from NEPCreate()

 37:    Options Database Keys:
 38: +  -nep_view - print information about the solver used
 39: -  -nep_plot_eigs - plot computed eigenvalues

 41:    Level: beginner

 43: .seealso: NEPCreate(), NEPSetUp(), NEPDestroy(), NEPSetTolerances()
 44: @*/
 45: PetscErrorCode NEPSolve(NEP nep)
 46: {
 47:   PetscErrorCode    ierr;
 48:   PetscInt          i;
 49:   PetscReal         re,im;
 50:   PetscBool         flg;
 51:   PetscViewer       viewer;
 52:   PetscViewerFormat format;
 53:   PetscDraw         draw;
 54:   PetscDrawSP       drawsp;

 58:   PetscLogEventBegin(NEP_Solve,nep,0,0,0);

 60:   /* call setup */
 61:   NEPSetUp(nep);
 62:   nep->nconv = 0;
 63:   nep->its = 0;
 64:   for (i=0;i<nep->ncv;i++) {
 65:     nep->eig[i]   = 0.0;
 66:     nep->errest[i] = 0.0;
 67:   }
 68:   nep->ktol = 0.1;
 69:   NEPMonitor(nep,nep->its,nep->nconv,nep->eig,nep->errest,nep->ncv);

 71:   DSSetEigenvalueComparison(nep->ds,nep->comparison,nep->comparisonctx);

 73:   (*nep->ops->solve)(nep);

 75:   if (!nep->reason) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason");

 77:   /* sort eigenvalues according to nep->which parameter */
 78:   NEPSortEigenvalues(nep,nep->nconv,nep->eig,nep->perm);

 80:   PetscLogEventEnd(NEP_Solve,nep,0,0,0);

 82:   /* various viewers */
 83:   PetscOptionsGetViewer(PetscObjectComm((PetscObject)nep),((PetscObject)nep)->prefix,"-nep_view",&viewer,&format,&flg);
 84:   if (flg && !PetscPreLoadingOn) {
 85:     PetscViewerPushFormat(viewer,format);
 86:     NEPView(nep,viewer);
 87:     PetscViewerPopFormat(viewer);
 88:     PetscViewerDestroy(&viewer);
 89:   }

 91:   flg = PETSC_FALSE;
 92:   PetscOptionsGetBool(((PetscObject)nep)->prefix,"-nep_plot_eigs",&flg,NULL);
 93:   if (flg) {
 94:     PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);
 95:     PetscViewerDrawGetDraw(viewer,0,&draw);
 96:     PetscDrawSPCreate(draw,1,&drawsp);
 97:     for (i=0;i<nep->nconv;i++) {
 98:       re = PetscRealPart(nep->eig[i]);
 99:       im = PetscImaginaryPart(nep->eig[i]);
100:       PetscDrawSPAddPoint(drawsp,&re,&im);
101:     }
102:     PetscDrawSPDraw(drawsp,PETSC_TRUE);
103:     PetscDrawSPDestroy(&drawsp);
104:     PetscViewerDestroy(&viewer);
105:   }

107:   /* Remove the initial subspace */
108:   nep->nini = 0;
109:   return(0);
110: }

114: PetscErrorCode NEP_KSPSolve(NEP nep,Vec b,Vec x)
115: {
117:   PetscInt       lits;

120:   KSPSolve(nep->ksp,b,x);
121:   KSPGetIterationNumber(nep->ksp,&lits);
122:   nep->linits += lits;
123:   PetscInfo2(nep,"iter=%D, linear solve iterations=%D\n",nep->its,lits);
124:   return(0);
125: }

129: /*@
130:    NEPProjectOperator - Computes the projection of the nonlinear operator.

132:    Collective on NEP

134:    Input Parameters:
135: +  nep - the nonlinear eigensolver context
136: .  j0  - initial index
137: .  j1  - final index
138: -  f   - workspace vector

140:    Notes:
141:    This is available for split operator only.

143:    The nonlinear operator T(lambda) is projected onto span(V), where V is
144:    an orthonormal basis built internally by the solver. The projected
145:    operator is equal to sum_i V'*A_i*V*f_i(lambda), so this function
146:    computes all matrices Ei = V'*A_i*V, and stores them in the extra
147:    matrices inside DS. Only rows/columns in the range [j0,j1-1] are computed,
148:    the previous ones are assumed to be available already.

150:    Level: developer

152: .seealso: NEPSetSplitOperator()
153: @*/
154: PetscErrorCode NEPProjectOperator(NEP nep,PetscInt j0,PetscInt j1,Vec f)
155: {
157:   PetscInt       i,j,k,ld;
158:   PetscScalar    *G,val;
159:   Vec            *V = nep->V;
160:   PetscBool      isherm,set,flg;

167:   if (!nep->split) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_WRONGSTATE,"This solver requires a split operator");
168:   DSGetLeadingDimension(nep->ds,&ld);
169:   for (k=0;k<nep->nt;k++) {
170:     DSGetArray(nep->ds,DSMatExtra[k],&G);
171:     MatIsHermitianKnown(nep->A[k],&set,&flg);
172:     isherm = set? flg: PETSC_FALSE;
173:     for (j=j0;j<j1;j++) {
174:       if (!isherm) {
175:         if (j>0) { MatMultHermitianTranspose(nep->A[k],V[j],f); }
176:         VecMDot(f,j,V,G+j*ld);
177:         for (i=0;i<j;i++)
178:           G[j+i*ld] = PetscConj(G[i+j*ld]);
179:       }
180:       MatMult(nep->A[k],V[j],f);
181:       VecDot(f,V[j],&val);
182:       G[j+j*ld] = val;
183:       VecMDot(f,j,V,G+j*ld);
184:       if (isherm) {
185:         for (i=0;i<j;i++)
186:           G[j+i*ld] = PetscConj(G[i+j*ld]);
187:       }
188:     }
189:     DSRestoreArray(nep->ds,DSMatExtra[k],&G);
190:   }
191:   return(0);
192: }

196: /*@
197:    NEPApplyFunction - Applies the nonlinear function T(lambda) to a given vector.

199:    Collective on NEP

201:    Input Parameters:
202: +  nep    - the nonlinear eigensolver context
203: .  lambda - scalar argument
204: .  x      - vector to be multiplied against
205: -  v      - workspace vector

207:    Output Parameters:
208: +  y   - result vector
209: .  A   - Function matrix
210: .  B   - optional preconditioning matrix
211: -  flg - flag indicating matrix structure (see MatStructure enum)

213:    Note:
214:    If the nonlinear operator is represented in split form, the result 
215:    y = T(lambda)*x is computed without building T(lambda) explicitly. In
216:    that case, parameters A, B and flg are not used. Otherwise, the matrix
217:    T(lambda) is built and the effect is the same as a call to
218:    NEPComputeFunction() followed by a MatMult().

220:    Level: developer

222: .seealso: NEPSetSplitOperator(), NEPComputeFunction()
223: @*/
224: PetscErrorCode NEPApplyFunction(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,Mat *B,MatStructure *flg)
225: {
227:   PetscInt       i;
228:   PetscScalar    alpha;

236:   if (nep->split) {
237:     VecZeroEntries(y);
238:     for (i=0;i<nep->nt;i++) {
239:       FNEvaluateFunction(nep->f[i],lambda,&alpha);
240:       MatMult(nep->A[i],x,v);
241:       VecAXPY(y,alpha,v);
242:     }
243:   } else {
244:     NEPComputeFunction(nep,lambda,A,B,flg);
245:     MatMult(*A,x,y);
246:   }
247:   return(0);
248: }

252: /*@
253:    NEPApplyJacobian - Applies the nonlinear Jacobian T'(lambda) to a given vector.

255:    Collective on NEP

257:    Input Parameters:
258: +  nep    - the nonlinear eigensolver context
259: .  lambda - scalar argument
260: .  x      - vector to be multiplied against
261: -  v      - workspace vector

263:    Output Parameters:
264: +  y   - result vector
265: .  A   - Jacobian matrix
266: -  flg - flag indicating matrix structure (see MatStructure enum)

268:    Note:
269:    If the nonlinear operator is represented in split form, the result 
270:    y = T'(lambda)*x is computed without building T'(lambda) explicitly. In
271:    that case, parameters A and flg are not used. Otherwise, the matrix
272:    T'(lambda) is built and the effect is the same as a call to
273:    NEPComputeJacobian() followed by a MatMult().

275:    Level: developer

277: .seealso: NEPSetSplitOperator(), NEPComputeJacobian()
278: @*/
279: PetscErrorCode NEPApplyJacobian(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,MatStructure *flg)
280: {
282:   PetscInt       i;
283:   PetscScalar    alpha;

291:   if (nep->split) {
292:     VecZeroEntries(y);
293:     for (i=0;i<nep->nt;i++) {
294:       FNEvaluateDerivative(nep->f[i],lambda,&alpha);
295:       MatMult(nep->A[i],x,v);
296:       VecAXPY(y,alpha,v);
297:     }
298:   } else {
299:     NEPComputeJacobian(nep,lambda,A,flg);
300:     MatMult(*A,x,y);
301:   }
302:   return(0);
303: }

307: /*@
308:    NEPGetIterationNumber - Gets the current iteration number. If the
309:    call to NEPSolve() is complete, then it returns the number of iterations
310:    carried out by the solution method.

312:    Not Collective

314:    Input Parameter:
315: .  nep - the nonlinear eigensolver context

317:    Output Parameter:
318: .  its - number of iterations

320:    Level: intermediate

322:    Note:
323:    During the i-th iteration this call returns i-1. If NEPSolve() is
324:    complete, then parameter "its" contains either the iteration number at
325:    which convergence was successfully reached, or failure was detected.
326:    Call NEPGetConvergedReason() to determine if the solver converged or
327:    failed and why.

329: .seealso: NEPGetConvergedReason(), NEPSetTolerances()
330: @*/
331: PetscErrorCode NEPGetIterationNumber(NEP nep,PetscInt *its)
332: {
336:   *its = nep->its;
337:   return(0);
338: }

342: /*@
343:    NEPGetConverged - Gets the number of converged eigenpairs.

345:    Not Collective

347:    Input Parameter:
348: .  nep - the nonlinear eigensolver context

350:    Output Parameter:
351: .  nconv - number of converged eigenpairs

353:    Note:
354:    This function should be called after NEPSolve() has finished.

356:    Level: beginner

358: .seealso: NEPSetDimensions(), NEPSolve()
359: @*/
360: PetscErrorCode NEPGetConverged(NEP nep,PetscInt *nconv)
361: {
365:   *nconv = nep->nconv;
366:   return(0);
367: }

371: /*@C
372:    NEPGetConvergedReason - Gets the reason why the NEPSolve() iteration was
373:    stopped.

375:    Not Collective

377:    Input Parameter:
378: .  nep - the nonlinear eigensolver context

380:    Output Parameter:
381: .  reason - negative value indicates diverged, positive value converged

383:    Possible values for reason:
384: +  NEP_CONVERGED_FNORM_ABS - function norm satisfied absolute tolerance
385: .  NEP_CONVERGED_FNORM_RELATIVE - function norm satisfied relative tolerance
386: .  NEP_CONVERGED_SNORM_RELATIVE - step norm satisfied relative tolerance
387: .  NEP_DIVERGED_LINEAR_SOLVE - inner linear solve failed
388: .  NEP_DIVERGED_FUNCTION_COUNT - reached maximum allowed function evaluations
389: .  NEP_DIVERGED_MAX_IT - required more than its to reach convergence
390: .  NEP_DIVERGED_BREAKDOWN - generic breakdown in method
391: -  NEP_DIVERGED_FNORM_NAN - Inf or NaN detected in function evaluation

393:    Note:
394:    Can only be called after the call to NEPSolve() is complete.

396:    Level: intermediate

398: .seealso: NEPSetTolerances(), NEPSolve(), NEPConvergedReason
399: @*/
400: PetscErrorCode NEPGetConvergedReason(NEP nep,NEPConvergedReason *reason)
401: {
405:   *reason = nep->reason;
406:   return(0);
407: }

411: /*@
412:    NEPGetEigenpair - Gets the i-th solution of the eigenproblem as computed by
413:    NEPSolve(). The solution consists in both the eigenvalue and the eigenvector.

415:    Logically Collective on NEP

417:    Input Parameters:
418: +  nep - nonlinear eigensolver context
419: -  i   - index of the solution

421:    Output Parameters:
422: +  eig - eigenvalue
423: -  V   - eigenvector

425:    Notes:
426:    If PETSc is configured with real scalars, then complex eigenpairs cannot
427:    be obtained. Users should use a complex-scalar configuration. This
428:    behaviour is different to other SLEPc solvers such as EPS.

430:    The index i should be a value between 0 and nconv-1 (see NEPGetConverged()).
431:    Eigenpairs are indexed according to the ordering criterion established
432:    with NEPSetWhichEigenpairs().

434:    Level: beginner

436: .seealso: NEPSolve(), NEPGetConverged(), NEPSetWhichEigenpairs()
437: @*/
438: PetscErrorCode NEPGetEigenpair(NEP nep,PetscInt i,PetscScalar *eig,Vec V)
439: {
440:   PetscInt       k;

447:   if (!nep->eig || !nep->V) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_WRONGSTATE,"NEPSolve must be called first");
448:   if (i<0 || i>=nep->nconv) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");

450:   if (!nep->perm) k = i;
451:   else k = nep->perm[i];

453:   if (eig) *eig = nep->eig[k];
454:   if (V) { VecCopy(nep->V[k],V); }
455:   return(0);
456: }

460: /*@
461:    NEPGetErrorEstimate - Returns the error estimate associated to the i-th
462:    computed eigenpair.

464:    Not Collective

466:    Input Parameter:
467: +  nep - nonlinear eigensolver context
468: -  i   - index of eigenpair

470:    Output Parameter:
471: .  errest - the error estimate

473:    Notes:
474:    This is the error estimate used internally by the eigensolver. The actual
475:    error bound can be computed with NEPComputeRelativeError().

477:    Level: advanced

479: .seealso: NEPComputeRelativeError()
480: @*/
481: PetscErrorCode NEPGetErrorEstimate(NEP nep,PetscInt i,PetscReal *errest)
482: {
486:   if (!nep->eig) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"NEPSolve must be called first");
487:   if (i<0 || i>=nep->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
488:   if (nep->perm) i = nep->perm[i];
489:   if (errest) *errest = nep->errest[i];
490:   return(0);
491: }

495: /*
496:    NEPComputeResidualNorm_Private - Computes the norm of the residual vector
497:    associated with an eigenpair.
498: */
499: PetscErrorCode NEPComputeResidualNorm_Private(NEP nep,PetscScalar lambda,Vec x,PetscReal *norm)
500: {
502:   Vec            u;
503:   Mat            T=nep->function;
504:   MatStructure   mats;

507:   VecDuplicate(nep->V[0],&u);
508:   NEPComputeFunction(nep,lambda,&T,&T,&mats);
509:   MatMult(T,x,u);
510:   VecNorm(u,NORM_2,norm);
511:   VecDestroy(&u);
512:   return(0);
513: }

517: /*@
518:    NEPComputeResidualNorm - Computes the norm of the residual vector associated with
519:    the i-th computed eigenpair.

521:    Collective on NEP

523:    Input Parameter:
524: +  nep - the nonlinear eigensolver context
525: -  i   - the solution index

527:    Output Parameter:
528: .  norm - the residual norm, computed as ||T(lambda)x||_2 where lambda is the
529:    eigenvalue and x is the eigenvector.

531:    Notes:
532:    The index i should be a value between 0 and nconv-1 (see NEPGetConverged()).
533:    Eigenpairs are indexed according to the ordering criterion established
534:    with NEPSetWhichEigenpairs().

536:    Level: beginner

538: .seealso: NEPSolve(), NEPGetConverged(), NEPSetWhichEigenpairs()
539: @*/
540: PetscErrorCode NEPComputeResidualNorm(NEP nep,PetscInt i,PetscReal *norm)
541: {
543:   Vec            x;
544:   PetscScalar    lambda;

550:   VecDuplicate(nep->V[0],&x);
551:   NEPGetEigenpair(nep,i,&lambda,x);
552:   NEPComputeResidualNorm_Private(nep,lambda,x,norm);
553:   VecDestroy(&x);
554:   return(0);
555: }

559: /*
560:    NEPComputeRelativeError_Private - Computes the relative error bound
561:    associated with an eigenpair.
562: */
563: PetscErrorCode NEPComputeRelativeError_Private(NEP nep,PetscScalar lambda,Vec x,PetscReal *error)
564: {
566:   PetscReal      norm,er;

569:   NEPComputeResidualNorm_Private(nep,lambda,x,&norm);
570:   VecNorm(x,NORM_2,&er);
571:   if (PetscAbsScalar(lambda) > norm) {
572:     *error = norm/(PetscAbsScalar(lambda)*er);
573:   } else {
574:     *error = norm/er;
575:   }
576:   return(0);
577: }

581: /*@
582:    NEPComputeRelativeError - Computes the relative error bound associated
583:    with the i-th computed eigenpair.

585:    Collective on NEP

587:    Input Parameter:
588: +  nep - the nonlinear eigensolver context
589: -  i   - the solution index

591:    Output Parameter:
592: .  error - the relative error bound, computed as ||T(lambda)x||_2/||lambda*x||_2
593:    where lambda is the eigenvalue and x is the eigenvector.
594:    If lambda=0 the relative error is computed as ||T(lambda)x||_2/||x||_2.

596:    Level: beginner

598: .seealso: NEPSolve(), NEPComputeResidualNorm(), NEPGetErrorEstimate()
599: @*/
600: PetscErrorCode NEPComputeRelativeError(NEP nep,PetscInt i,PetscReal *error)
601: {
603:   Vec            x;
604:   PetscScalar    lambda;

610:   VecDuplicate(nep->V[0],&x);
611:   NEPGetEigenpair(nep,i,&lambda,x);
612:   NEPComputeRelativeError_Private(nep,lambda,x,error);
613:   VecDestroy(&x);
614:   return(0);
615: }

619: /*@
620:    NEPSortEigenvalues - Sorts a list of eigenvalues according to the criterion
621:    specified via NEPSetWhichEigenpairs().

623:    Not Collective

625:    Input Parameters:
626: +  nep - the nonlinear eigensolver context
627: .  n   - number of eigenvalues in the list
628: -  eig - pointer to the array containing the eigenvalues

630:    Output Parameter:
631: .  perm - resulting permutation

633:    Note:
634:    The result is a list of indices in the original eigenvalue array
635:    corresponding to the first nev eigenvalues sorted in the specified
636:    criterion.

638:    Level: developer

640: .seealso: NEPSetWhichEigenpairs()
641: @*/
642: PetscErrorCode NEPSortEigenvalues(NEP nep,PetscInt n,PetscScalar *eig,PetscInt *perm)
643: {
645:   PetscInt       i,j,result,tmp;

651:   for (i=0;i<n;i++) perm[i] = i;
652:   /* insertion sort */
653:   for (i=n-1;i>=0;i--) {
654:     j = i + 1;
655:     while (j<n) {
656:       NEPCompareEigenvalues(nep,eig[perm[i]],eig[perm[j]],&result);
657:       if (result < 0) break;
658:       tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = tmp;
659:       j++;
660:     }
661:   }
662:   return(0);
663: }

667: /*@
668:    NEPCompareEigenvalues - Compares two eigenvalues according to a certain criterion.

670:    Not Collective

672:    Input Parameters:
673: +  nep - the nonlinear eigensolver context
674: .  a   - the 1st eigenvalue
675: -  b   - the 2nd eigenvalue

677:    Output Parameter:
678: .  res - result of comparison

680:    Notes:
681:    Returns an integer less than, equal to, or greater than zero if the first
682:    eigenvalue is considered to be respectively less than, equal to, or greater
683:    than the second one.

685:    The criterion of comparison is related to the 'which' parameter set with
686:    NEPSetWhichEigenpairs().

688:    Level: developer

690: .seealso: NEPSortEigenvalues(), NEPSetWhichEigenpairs()
691: @*/
692: PetscErrorCode NEPCompareEigenvalues(NEP nep,PetscScalar a,PetscScalar b,PetscInt *result)
693: {

699:   if (!nep->comparison) SETERRQ(PETSC_COMM_SELF,1,"Undefined eigenvalue comparison function");
700:   (*nep->comparison)(a,0.0,b,0.0,result,nep->comparisonctx);
701:   return(0);
702: }

706: /*@
707:    NEPGetOperationCounters - Gets the total number of function evaluations, dot
708:    products, and linear solve iterations used by the NEP object during the last
709:    NEPSolve() call.

711:    Not Collective

713:    Input Parameter:
714: .  nep - nonlinear eigensolver context

716:    Output Parameter:
717: +  nfuncs - number of function evaluations
718: .  dots   - number of dot product operations
719: -  lits   - number of linear iterations

721:    Notes:
722:    These counters are reset to zero at each successive call to NEPSolve().

724:    Level: intermediate

726: @*/
727: PetscErrorCode NEPGetOperationCounters(NEP nep,PetscInt* nfuncs,PetscInt* dots,PetscInt* lits)
728: {

733:   if (nfuncs) *nfuncs = nep->nfuncs;
734:   if (dots) {
735:     if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
736:     IPGetOperationCounters(nep->ip,dots);
737:   }
738:   if (lits) *lits = nep->linits;
739:   return(0);
740: }

744: /*@
745:    NEPComputeFunction - Computes the function matrix T(lambda) that has been
746:    set with NEPSetFunction().

748:    Collective on NEP and Mat

750:    Input Parameters:
751: +  nep    - the NEP context
752: -  lambda - the scalar argument

754:    Output Parameters:
755: +  A   - Function matrix
756: .  B   - optional preconditioning matrix
757: -  flg - flag indicating matrix structure (see MatStructure enum)

759:    Notes:
760:    NEPComputeFunction() is typically used within nonlinear eigensolvers
761:    implementations, so most users would not generally call this routine
762:    themselves.

764:    Level: developer

766: .seealso: NEPSetFunction(), NEPGetFunction()
767: @*/
768: PetscErrorCode NEPComputeFunction(NEP nep,PetscScalar lambda,Mat *A,Mat *B,MatStructure *flg)
769: {
771:   PetscInt       i;
772:   PetscScalar    alpha;


778:   if (nep->split) {

780:     MatZeroEntries(*A);
781:     for (i=0;i<nep->nt;i++) {
782:       FNEvaluateFunction(nep->f[i],lambda,&alpha);
783:       MatAXPY(*A,alpha,nep->A[i],nep->mstr);
784:     }
785:     if (*A != *B) SETERRQ(PetscObjectComm((PetscObject)nep),1,"Not implemented");

787:   } else {

789:     if (!nep->computefunction) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_USER,"Must call NEPSetFunction() first");

791:     *flg = DIFFERENT_NONZERO_PATTERN;
792:     PetscLogEventBegin(NEP_FunctionEval,nep,*A,*B,0);

794:     PetscStackPush("NEP user Function function");
795:     (*nep->computefunction)(nep,lambda,A,B,flg,nep->functionctx);
796:     PetscStackPop;

798:     PetscLogEventEnd(NEP_FunctionEval,nep,*A,*B,0);
799:     nep->nfuncs++;

801:   }
802:   return(0);
803: }

807: /*@
808:    NEPComputeJacobian - Computes the Jacobian matrix T'(lambda) that has been
809:    set with NEPSetJacobian().

811:    Collective on NEP and Mat

813:    Input Parameters:
814: +  nep    - the NEP context
815: -  lambda - the scalar argument

817:    Output Parameters:
818: +  A   - Jacobian matrix
819: -  flg - flag indicating matrix structure (see MatStructure enum)

821:    Notes:
822:    Most users should not need to explicitly call this routine, as it
823:    is used internally within the nonlinear eigensolvers.

825:    Level: developer

827: .seealso: NEPSetJacobian(), NEPGetJacobian()
828: @*/
829: PetscErrorCode NEPComputeJacobian(NEP nep,PetscScalar lambda,Mat *A,MatStructure *flg)
830: {
832:   PetscInt       i;
833:   PetscScalar    alpha;


839:   if (nep->split) {

841:     MatZeroEntries(*A);
842:     for (i=0;i<nep->nt;i++) {
843:       FNEvaluateDerivative(nep->f[i],lambda,&alpha);
844:       MatAXPY(*A,alpha,nep->A[i],nep->mstr);
845:     }

847:   } else {

849:     if (!nep->computejacobian) SETERRQ(PetscObjectComm((PetscObject)nep),PETSC_ERR_USER,"Must call NEPSetJacobian() first");

851:     *flg = DIFFERENT_NONZERO_PATTERN;
852:     PetscLogEventBegin(NEP_JacobianEval,nep,*A,0,0);

854:     PetscStackPush("NEP user Jacobian function");
855:     (*nep->computejacobian)(nep,lambda,A,flg,nep->jacobianctx);
856:     PetscStackPop;

858:     PetscLogEventEnd(NEP_JacobianEval,nep,*A,0,0);

860:   }
861:   return(0);
862: }

slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-custom/0000755000175000017500000000000012214143515021043 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/interface/ftn-custom/znepf.c0000644000175000017500000002231112211062077022330 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define nepdestroy_ NEPDESTROY #define nepview_ NEPVIEW #define nepsetoptionsprefix_ NEPSETOPTIONSPREFIX #define nepappendoptionsprefix_ NEPAPPENDOPTIONSPREFIX #define nepgetoptionsprefix_ NEPGETOPTIONSPREFIX #define nepcreate_ NEPCREATE #define nepsettype_ NEPSETTYPE #define nepgettype_ NEPGETTYPE #define nepmonitorall_ NEPMONITORALL #define nepmonitorlg_ NEPMONITORLG #define nepmonitorlgall_ NEPMONITORLGALL #define nepmonitorset_ NEPMONITORSET #define nepmonitorconverged_ NEPMONITORCONVERGED #define nepmonitorfirst_ NEPMONITORFIRST #define nepgetip_ NEPGETIP #define nepgetds_ NEPGETDS #define nepgetksp NEPGETKSP #define nepgetwhicheigenpairs_ NEPGETWHICHEIGENPAIRS #define nepgetconvergedreason_ NEPGETCONVERGEDREASON #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define nepdestroy_ nepdestroy #define nepview_ nepview #define nepsetoptionsprefix_ nepsetoptionsprefix #define nepappendoptionsprefix_ nepappendoptionsprefix #define nepgetoptionsprefix_ nepgetoptionsprefix #define nepcreate_ nepcreate #define nepsettype_ nepsettype #define nepgettype_ nepgettype #define nepmonitorall_ nepmonitorall #define nepmonitorlg_ nepmonitorlg #define nepmonitorlgall_ nepmonitorlgall #define nepmonitorset_ nepmonitorset #define nepmonitorconverged_ nepmonitorconverged #define nepmonitorfirst_ nepmonitorfirst #define nepgetip_ nepgetip #define nepgetds_ nepgetds #define nepgetksp_ nepgetksp #define nepgetwhicheigenpairs_ nepgetwhicheigenpairs #define nepgetconvergedreason_ nepgetconvergedreason #endif /* These are not usually called from Fortran but allow Fortran users to transparently set these monitors from .F code, hence no STDCALL */ PETSC_EXTERN void nepmonitorall_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = NEPMonitorAll(*nep,*it,*nconv,eig,errest,*nest,ctx); } PETSC_EXTERN void nepmonitorlg_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = NEPMonitorLG(*nep,*it,*nconv,eig,errest,*nest,ctx); } PETSC_EXTERN void nepmonitorlgall_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = NEPMonitorLGAll(*nep,*it,*nconv,eig,errest,*nest,ctx); } PETSC_EXTERN void nepmonitorconverged_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = NEPMonitorConverged(*nep,*it,*nconv,eig,errest,*nest,ctx); } PETSC_EXTERN void nepmonitorfirst_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = NEPMonitorFirst(*nep,*it,*nconv,eig,errest,*nest,ctx); } static struct { PetscFortranCallbackId monitor; PetscFortranCallbackId monitordestroy; } _cb; /* These are not extern C because they are passed into non-extern C user level functions */ #undef __FUNCT__ #define __FUNCT__ "ourmonitor" static PetscErrorCode ourmonitor(NEP nep,PetscInt i,PetscInt nc,PetscScalar *eig,PetscReal *d,PetscInt l,void* ctx) { PetscObjectUseFortranCallback(nep,_cb.monitor,(NEP*,PetscInt*,PetscInt*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),(&nep,&i,&nc,eig,d,&l,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourdestroy" static PetscErrorCode ourdestroy(void** ctx) { NEP nep = (NEP)*ctx; PetscObjectUseFortranCallback(nep,_cb.monitordestroy,(void*,PetscErrorCode*),(_ctx,&ierr)); return 0; } PETSC_EXTERN void PETSC_STDCALL nepdestroy_(NEP *nep,PetscErrorCode *ierr) { *ierr = NEPDestroy(nep); } PETSC_EXTERN void PETSC_STDCALL nepview_(NEP *nep,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = NEPView(*nep,v); } PETSC_EXTERN void PETSC_STDCALL nepsettype_(NEP *nep,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(type,len,t); *ierr = NEPSetType(*nep,t); FREECHAR(type,t); } PETSC_EXTERN void PETSC_STDCALL nepgettype_(NEP *nep,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { NEPType tname; *ierr = NEPGetType(*nep,&tname);if (*ierr) return; *ierr = PetscStrncpy(name,tname,len); FIXRETURNCHAR(PETSC_TRUE,name,len); } PETSC_EXTERN void PETSC_STDCALL nepsetoptionsprefix_(NEP *nep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = NEPSetOptionsPrefix(*nep,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL nepappendoptionsprefix_(NEP *nep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = NEPAppendOptionsPrefix(*nep,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL nepcreate_(MPI_Fint *comm,NEP *nep,PetscErrorCode *ierr) { *ierr = NEPCreate(MPI_Comm_f2c(*(comm)),nep); } PETSC_EXTERN void PETSC_STDCALL nepgetoptionsprefix_(NEP *nep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = NEPGetOptionsPrefix(*nep,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL nepmonitorset_(NEP *nep,void (PETSC_STDCALL *monitor)(NEP*,PetscInt*,PetscInt*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr) { SlepcConvMonitor ctx; CHKFORTRANNULLOBJECT(mctx); CHKFORTRANNULLFUNCTION(monitordestroy); if ((PetscVoidFunction)monitor == (PetscVoidFunction)nepmonitorall_) { *ierr = NEPMonitorSet(*nep,NEPMonitorAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)nepmonitorlg_) { *ierr = NEPMonitorSet(*nep,NEPMonitorLG,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)nepmonitorlgall_) { *ierr = NEPMonitorSet(*nep,NEPMonitorLGAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)nepmonitorconverged_) { if (!FORTRANNULLOBJECT(mctx)) { PetscError(PetscObjectComm((PetscObject)*nep),__LINE__,"nepmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to NEPMonitorSet"); *ierr = 1; return; } *ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx); if (*ierr) return; ctx->viewer = NULL; *ierr = NEPMonitorSet(*nep,NEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)nepmonitorfirst_) { *ierr = NEPMonitorSet(*nep,NEPMonitorFirst,0,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*nep,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)monitor,mctx); if (*ierr) return; if (!monitordestroy) { *ierr = NEPMonitorSet(*nep,ourmonitor,*nep,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*nep,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitordestroy,(PetscVoidFunction)monitordestroy,mctx); if (*ierr) return; *ierr = NEPMonitorSet(*nep,ourmonitor,*nep,ourdestroy); } } } PETSC_EXTERN void PETSC_STDCALL nepgetip_(NEP *nep,IP *ip,PetscErrorCode *ierr) { *ierr = NEPGetIP(*nep,ip); } PETSC_EXTERN void PETSC_STDCALL nepgetds_(NEP *nep,DS *ds,PetscErrorCode *ierr) { *ierr = NEPGetDS(*nep,ds); } PETSC_EXTERN void PETSC_STDCALL nepgetksp_(NEP *nep,KSP *ksp,PetscErrorCode *ierr) { *ierr = NEPGetKSP(*nep,ksp); } PETSC_EXTERN void PETSC_STDCALL nepgetwhicheigenpairs_(NEP *nep,NEPWhich *which,PetscErrorCode *ierr) { *ierr = NEPGetWhichEigenpairs(*nep,which); } PETSC_EXTERN void PETSC_STDCALL nepgetconvergedreason_(NEP *nep,NEPConvergedReason *reason,PetscErrorCode *ierr) { *ierr = NEPGetConvergedReason(*nep,reason); } slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-custom/makefile0000644000175000017500000000217412211062077022547 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = znepf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/nep/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/interface/nepregis.c.html0000644000175000017500000001032212211062077021665 0ustar gladkgladk
Actual source code: nepregis.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/nepimpl.h>      /*I "slepcnep.h" I*/

 24: PETSC_EXTERN PetscErrorCode NEPCreate_RII(NEP);
 25: PETSC_EXTERN PetscErrorCode NEPCreate_SLP(NEP);
 26: PETSC_EXTERN PetscErrorCode NEPCreate_NARNOLDI(NEP);

 30: /*@C
 31:    NEPRegisterAll - Registers all the solvers in the NEP package.

 33:    Not Collective

 35:    Level: advanced

 37: .seealso:  NEPRegister()
 38: @*/
 39: PetscErrorCode NEPRegisterAll(void)
 40: {

 44:   NEPRegisterAllCalled = PETSC_TRUE;
 45:   NEPRegister(NEPRII,NEPCreate_RII);
 46:   NEPRegister(NEPSLP,NEPCreate_SLP);
 47:   NEPRegister(NEPNARNOLDI,NEPCreate_NARNOLDI);
 48:   return(0);
 49: }
slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/0000755000175000017500000000000012214143515020501 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/nepsetupf.c0000644000175000017500000000244212211062077022660 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* nepsetup.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetup_ NEPSETUP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetup_ nepsetup #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetinitialspace_ NEPSETINITIALSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetinitialspace_ nepsetinitialspace #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepsetup_(NEP *nep, int *__ierr ){ *__ierr = NEPSetUp(*nep); } void PETSC_STDCALL nepsetinitialspace_(NEP *nep,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = NEPSetInitialSpace(*nep,*n,is); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/nepoptsf.c0000644000175000017500000001171312211062077022506 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* nepopts.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetfromoptions_ NEPSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetfromoptions_ nepsetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgettolerances_ NEPGETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgettolerances_ nepgettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsettolerances_ NEPSETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsettolerances_ nepsettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetdimensions_ NEPGETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetdimensions_ nepgetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetdimensions_ NEPSETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetdimensions_ nepsetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetwhicheigenpairs_ NEPSETWHICHEIGENPAIRS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetwhicheigenpairs_ nepsetwhicheigenpairs #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetlagpreconditioner_ NEPSETLAGPRECONDITIONER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetlagpreconditioner_ nepsetlagpreconditioner #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetlagpreconditioner_ NEPGETLAGPRECONDITIONER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetlagpreconditioner_ nepgetlagpreconditioner #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetconstcorrectiontol_ NEPSETCONSTCORRECTIONTOL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetconstcorrectiontol_ nepsetconstcorrectiontol #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetconstcorrectiontol_ NEPGETCONSTCORRECTIONTOL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetconstcorrectiontol_ nepgetconstcorrectiontol #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsettrackall_ NEPSETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsettrackall_ nepsettrackall #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgettrackall_ NEPGETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgettrackall_ nepgettrackall #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepsetfromoptions_(NEP *nep, int *__ierr ){ *__ierr = NEPSetFromOptions(*nep); } void PETSC_STDCALL nepgettolerances_(NEP *nep,PetscReal *abstol,PetscReal *rtol,PetscReal *stol,PetscInt *maxit,PetscInt *maxf, int *__ierr ){ *__ierr = NEPGetTolerances(*nep,abstol,rtol,stol,maxit,maxf); } void PETSC_STDCALL nepsettolerances_(NEP *nep,PetscReal *abstol,PetscReal *rtol,PetscReal *stol,PetscInt *maxit,PetscInt *maxf, int *__ierr ){ *__ierr = NEPSetTolerances(*nep,*abstol,*rtol,*stol,*maxit,*maxf); } void PETSC_STDCALL nepgetdimensions_(NEP *nep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = NEPGetDimensions(*nep,nev,ncv,mpd); } void PETSC_STDCALL nepsetdimensions_(NEP *nep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = NEPSetDimensions(*nep,*nev,*ncv,*mpd); } void PETSC_STDCALL nepsetwhicheigenpairs_(NEP *nep,NEPWhich *which, int *__ierr ){ *__ierr = NEPSetWhichEigenpairs(*nep,*which); } void PETSC_STDCALL nepsetlagpreconditioner_(NEP *nep,PetscInt *lag, int *__ierr ){ *__ierr = NEPSetLagPreconditioner(*nep,*lag); } void PETSC_STDCALL nepgetlagpreconditioner_(NEP *nep,PetscInt *lag, int *__ierr ){ *__ierr = NEPGetLagPreconditioner(*nep,lag); } void PETSC_STDCALL nepsetconstcorrectiontol_(NEP *nep,PetscBool *cct, int *__ierr ){ *__ierr = NEPSetConstCorrectionTol(*nep,*cct); } void PETSC_STDCALL nepgetconstcorrectiontol_(NEP *nep,PetscBool *cct, int *__ierr ){ *__ierr = NEPGetConstCorrectionTol(*nep,cct); } void PETSC_STDCALL nepsettrackall_(NEP *nep,PetscBool *trackall, int *__ierr ){ *__ierr = NEPSetTrackAll(*nep,*trackall); } void PETSC_STDCALL nepgettrackall_(NEP *nep,PetscBool *trackall, int *__ierr ){ *__ierr = NEPGetTrackAll(*nep,trackall); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/nepdefaultf.c0000644000175000017500000000200112211062077023133 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* nepdefault.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetworkvecs_ NEPSETWORKVECS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetworkvecs_ nepsetworkvecs #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepsetworkvecs_(NEP *nep,PetscInt *nw, int *__ierr ){ *__ierr = NEPSetWorkVecs(*nep,*nw); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/makefile0000644000175000017500000000043612211062077022204 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = nepbasicf.c nepdefaultf.c nepmonf.c nepoptsf.c nepsetupf.c nepsolvef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/nep/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/nepmonf.c0000644000175000017500000000177012211062077022314 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* nepmon.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepmonitorcancel_ NEPMONITORCANCEL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepmonitorcancel_ nepmonitorcancel #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepmonitorcancel_(NEP *nep, int *__ierr ){ *__ierr = NEPMonitorCancel(*nep); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/nepbasicf.c0000644000175000017500000000705412211062077022605 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* nepbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepreset_ NEPRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepreset_ nepreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetip_ NEPSETIP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetip_ nepsetip #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetds_ NEPSETDS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetds_ nepsetds #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetksp_ NEPSETKSP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetksp_ nepsetksp #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsettarget_ NEPSETTARGET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsettarget_ nepsettarget #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgettarget_ NEPGETTARGET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgettarget_ nepgettarget #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsetsplitoperator_ NEPSETSPLITOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsetsplitoperator_ nepsetsplitoperator #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetsplitoperatorterm_ NEPGETSPLITOPERATORTERM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetsplitoperatorterm_ nepgetsplitoperatorterm #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetsplitoperatorinfo_ NEPGETSPLITOPERATORINFO #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetsplitoperatorinfo_ nepgetsplitoperatorinfo #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepreset_(NEP *nep, int *__ierr ){ *__ierr = NEPReset(*nep); } void PETSC_STDCALL nepsetip_(NEP *nep,IP *ip, int *__ierr ){ *__ierr = NEPSetIP(*nep,*ip); } void PETSC_STDCALL nepsetds_(NEP *nep,DS *ds, int *__ierr ){ *__ierr = NEPSetDS(*nep,*ds); } void PETSC_STDCALL nepsetksp_(NEP *nep,KSP ksp, int *__ierr ){ *__ierr = NEPSetKSP(*nep, (KSP)PetscToPointer((ksp) )); } void PETSC_STDCALL nepsettarget_(NEP *nep,PetscScalar *target, int *__ierr ){ *__ierr = NEPSetTarget(*nep,*target); } void PETSC_STDCALL nepgettarget_(NEP *nep,PetscScalar* target, int *__ierr ){ *__ierr = NEPGetTarget(*nep,target); } void PETSC_STDCALL nepsetsplitoperator_(NEP *nep,PetscInt *n,Mat A[],FN f[],MatStructure *str, int *__ierr ){ *__ierr = NEPSetSplitOperator(*nep,*n,A, (FN* )PetscToPointer((f) ),*str); } void PETSC_STDCALL nepgetsplitoperatorterm_(NEP *nep,PetscInt *k,Mat *A,FN *f, int *__ierr ){ *__ierr = NEPGetSplitOperatorTerm(*nep,*k,A, (FN* )PetscToPointer((f) )); } void PETSC_STDCALL nepgetsplitoperatorinfo_(NEP *nep,PetscInt *n,MatStructure *str, int *__ierr ){ *__ierr = NEPGetSplitOperatorInfo(*nep,n,str); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/interface/ftn-auto/nepsolvef.c0000644000175000017500000001442212211062077022651 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* nepsolve.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcnep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsolve_ NEPSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsolve_ nepsolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepprojectoperator_ NEPPROJECTOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepprojectoperator_ nepprojectoperator #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepapplyfunction_ NEPAPPLYFUNCTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepapplyfunction_ nepapplyfunction #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepapplyjacobian_ NEPAPPLYJACOBIAN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepapplyjacobian_ nepapplyjacobian #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetiterationnumber_ NEPGETITERATIONNUMBER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetiterationnumber_ nepgetiterationnumber #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetconverged_ NEPGETCONVERGED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetconverged_ nepgetconverged #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgeteigenpair_ NEPGETEIGENPAIR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgeteigenpair_ nepgeteigenpair #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgeterrorestimate_ NEPGETERRORESTIMATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgeterrorestimate_ nepgeterrorestimate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepcomputeresidualnorm_ NEPCOMPUTERESIDUALNORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepcomputeresidualnorm_ nepcomputeresidualnorm #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepcomputerelativeerror_ NEPCOMPUTERELATIVEERROR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepcomputerelativeerror_ nepcomputerelativeerror #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepsorteigenvalues_ NEPSORTEIGENVALUES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepsorteigenvalues_ nepsorteigenvalues #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepcompareeigenvalues_ NEPCOMPAREEIGENVALUES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepcompareeigenvalues_ nepcompareeigenvalues #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepgetoperationcounters_ NEPGETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepgetoperationcounters_ nepgetoperationcounters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepcomputefunction_ NEPCOMPUTEFUNCTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepcomputefunction_ nepcomputefunction #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define nepcomputejacobian_ NEPCOMPUTEJACOBIAN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define nepcomputejacobian_ nepcomputejacobian #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL nepsolve_(NEP *nep, int *__ierr ){ *__ierr = NEPSolve(*nep); } void PETSC_STDCALL nepprojectoperator_(NEP *nep,PetscInt *j0,PetscInt *j1,Vec f, int *__ierr ){ *__ierr = NEPProjectOperator(*nep,*j0,*j1, (Vec)PetscToPointer((f) )); } void PETSC_STDCALL nepapplyfunction_(NEP *nep,PetscScalar *lambda,Vec x,Vec v,Vec y,Mat *A,Mat *B,MatStructure *flg, int *__ierr ){ *__ierr = NEPApplyFunction(*nep,*lambda, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((v) ), (Vec)PetscToPointer((y) ),A,B,flg); } void PETSC_STDCALL nepapplyjacobian_(NEP *nep,PetscScalar *lambda,Vec x,Vec v,Vec y,Mat *A,MatStructure *flg, int *__ierr ){ *__ierr = NEPApplyJacobian(*nep,*lambda, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((v) ), (Vec)PetscToPointer((y) ),A,flg); } void PETSC_STDCALL nepgetiterationnumber_(NEP *nep,PetscInt *its, int *__ierr ){ *__ierr = NEPGetIterationNumber(*nep,its); } void PETSC_STDCALL nepgetconverged_(NEP *nep,PetscInt *nconv, int *__ierr ){ *__ierr = NEPGetConverged(*nep,nconv); } void PETSC_STDCALL nepgeteigenpair_(NEP *nep,PetscInt *i,PetscScalar *eig,Vec V, int *__ierr ){ *__ierr = NEPGetEigenpair(*nep,*i,eig, (Vec)PetscToPointer((V) )); } void PETSC_STDCALL nepgeterrorestimate_(NEP *nep,PetscInt *i,PetscReal *errest, int *__ierr ){ *__ierr = NEPGetErrorEstimate(*nep,*i,errest); } void PETSC_STDCALL nepcomputeresidualnorm_(NEP *nep,PetscInt *i,PetscReal *norm, int *__ierr ){ *__ierr = NEPComputeResidualNorm(*nep,*i,norm); } void PETSC_STDCALL nepcomputerelativeerror_(NEP *nep,PetscInt *i,PetscReal *error, int *__ierr ){ *__ierr = NEPComputeRelativeError(*nep,*i,error); } void PETSC_STDCALL nepsorteigenvalues_(NEP *nep,PetscInt *n,PetscScalar *eig,PetscInt *perm, int *__ierr ){ *__ierr = NEPSortEigenvalues(*nep,*n,eig,perm); } void PETSC_STDCALL nepcompareeigenvalues_(NEP *nep,PetscScalar *a,PetscScalar *b,PetscInt *result, int *__ierr ){ *__ierr = NEPCompareEigenvalues(*nep,*a,*b,result); } void PETSC_STDCALL nepgetoperationcounters_(NEP *nep,PetscInt* nfuncs,PetscInt* dots,PetscInt* lits, int *__ierr ){ *__ierr = NEPGetOperationCounters(*nep,nfuncs,dots,lits); } void PETSC_STDCALL nepcomputefunction_(NEP *nep,PetscScalar *lambda,Mat *A,Mat *B,MatStructure *flg, int *__ierr ){ *__ierr = NEPComputeFunction(*nep,*lambda,A,B,flg); } void PETSC_STDCALL nepcomputejacobian_(NEP *nep,PetscScalar *lambda,Mat *A,MatStructure *flg, int *__ierr ){ *__ierr = NEPComputeJacobian(*nep,*lambda,A,flg); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/nep/interface/nepbasic.c.html0000644000175000017500000023145312211062077021647 0ustar gladkgladk
Actual source code: nepbasic.c

  1: /*
  2:    Basic NEP routines, Create, View, etc.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/nepimpl.h>      /*I "slepcnep.h" I*/

 26: PetscFunctionList NEPList = 0;
 27: PetscBool         NEPRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      NEP_CLASSID = 0;
 29: PetscLogEvent     NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0;
 30: static PetscBool  NEPPackageInitialized = PETSC_FALSE;

 34: /*@C
 35:    NEPFinalizePackage - This function destroys everything in the Slepc interface
 36:    to the NEP package. It is called from SlepcFinalize().

 38:    Level: developer

 40: .seealso: SlepcFinalize()
 41: @*/
 42: PetscErrorCode NEPFinalizePackage(void)
 43: {

 47:   PetscFunctionListDestroy(&NEPList);
 48:   NEPPackageInitialized = PETSC_FALSE;
 49:   NEPRegisterAllCalled  = PETSC_FALSE;
 50:   return(0);
 51: }

 55: /*@C
 56:    NEPInitializePackage - This function initializes everything in the NEP package. It is called
 57:    from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to NEPCreate()
 58:    when using static libraries.

 60:    Level: developer

 62: .seealso: SlepcInitialize()
 63: @*/
 64: PetscErrorCode NEPInitializePackage(void)
 65: {
 66:   char           logList[256];
 67:   char           *className;
 68:   PetscBool      opt;

 72:   if (NEPPackageInitialized) return(0);
 73:   NEPPackageInitialized = PETSC_TRUE;
 74:   /* Register Classes */
 75:   PetscClassIdRegister("Nonlinear Eigenvalue Problem solver",&NEP_CLASSID);
 76:   /* Register Constructors */
 77:   NEPRegisterAll();
 78:   /* Register Events */
 79:   PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp);
 80:   PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve);
 81:   PetscLogEventRegister("NEPDense",NEP_CLASSID,&NEP_Dense);
 82:   PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval);
 83:   PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval);
 84:   /* Process info exclusions */
 85:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 86:   if (opt) {
 87:     PetscStrstr(logList,"nep",&className);
 88:     if (className) {
 89:       PetscInfoDeactivateClass(NEP_CLASSID);
 90:     }
 91:   }
 92:   /* Process summary exclusions */
 93:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 94:   if (opt) {
 95:     PetscStrstr(logList,"nep",&className);
 96:     if (className) {
 97:       PetscLogEventDeactivateClass(NEP_CLASSID);
 98:     }
 99:   }
100:   PetscRegisterFinalize(NEPFinalizePackage);
101:   return(0);
102: }

106: /*@C
107:    NEPView - Prints the NEP data structure.

109:    Collective on NEP

111:    Input Parameters:
112: +  nep - the nonlinear eigenproblem solver context
113: -  viewer - optional visualization context

115:    Options Database Key:
116: .  -nep_view -  Calls NEPView() at end of NEPSolve()

118:    Note:
119:    The available visualization contexts include
120: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
121: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
122:          output where only the first processor opens
123:          the file.  All other processors send their
124:          data to the first processor to print.

126:    The user can open an alternative visualization context with
127:    PetscViewerASCIIOpen() - output to a specified file.

129:    Level: beginner

131: .seealso: PetscViewerASCIIOpen()
132: @*/
133: PetscErrorCode NEPView(NEP nep,PetscViewer viewer)
134: {
136:   char           str[50];
137:   PetscBool      isascii,isslp;

141:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)nep));

145:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
146:   if (isascii) {
147:     PetscObjectPrintClassNamePrefixType((PetscObject)nep,viewer,"NEP Object");
148:     if (nep->ops->view) {
149:       PetscViewerASCIIPushTab(viewer);
150:       (*nep->ops->view)(nep,viewer);
151:       PetscViewerASCIIPopTab(viewer);
152:     }
153:     if (nep->split) {
154:       PetscViewerASCIIPrintf(viewer,"  nonlinear operator in split form\n");
155:     } else {
156:       PetscViewerASCIIPrintf(viewer,"  nonlinear operator from user callbacks\n");
157:     }
158:     PetscViewerASCIIPrintf(viewer,"  selected portion of the spectrum: ");
159:     SlepcSNPrintfScalar(str,50,nep->target,PETSC_FALSE);
160:     if (!nep->which) {
161:       PetscViewerASCIIPrintf(viewer,"not yet set\n");
162:     } else switch (nep->which) {
163:       case NEP_TARGET_MAGNITUDE:
164:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (in magnitude)\n",str);
165:         break;
166:       case NEP_TARGET_REAL:
167:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the real axis)\n",str);
168:         break;
169:       case NEP_TARGET_IMAGINARY:
170:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the imaginary axis)\n",str);
171:         break;
172:       case NEP_LARGEST_MAGNITUDE:
173:         PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");
174:         break;
175:       case NEP_SMALLEST_MAGNITUDE:
176:         PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");
177:         break;
178:       case NEP_LARGEST_REAL:
179:         PetscViewerASCIIPrintf(viewer,"largest real parts\n");
180:         break;
181:       case NEP_SMALLEST_REAL:
182:         PetscViewerASCIIPrintf(viewer,"smallest real parts\n");
183:         break;
184:       case NEP_LARGEST_IMAGINARY:
185:         PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");
186:         break;
187:       case NEP_SMALLEST_IMAGINARY:
188:         PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");
189:         break;
190:       default: SETERRQ(PetscObjectComm((PetscObject)nep),1,"Wrong value of nep->which");
191:     }
192:     PetscViewerASCIIPrintf(viewer,"  number of eigenvalues (nev): %D\n",nep->nev);
193:     PetscViewerASCIIPrintf(viewer,"  number of column vectors (ncv): %D\n",nep->ncv);
194:     PetscViewerASCIIPrintf(viewer,"  maximum dimension of projected problem (mpd): %D\n",nep->mpd);
195:     PetscViewerASCIIPrintf(viewer,"  maximum number of iterations: %D\n",nep->max_it);
196:     PetscViewerASCIIPrintf(viewer,"  maximum number of function evaluations: %D\n",nep->max_funcs);
197:     PetscViewerASCIIPrintf(viewer,"  tolerances: relative=%G, absolute=%G, solution=%G\n",nep->rtol,nep->abstol,nep->stol);
198:     if (nep->lag) {
199:       PetscViewerASCIIPrintf(viewer,"  updating the preconditioner every %D iterations\n",nep->lag);
200:     }
201:     if (nep->cctol) {
202:       PetscViewerASCIIPrintf(viewer,"  using a constant tolerance for the linear solver\n");
203:     }
204:     if (nep->nini) {
205:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial space: %D\n",PetscAbs(nep->nini));
206:     }
207:   } else {
208:     if (nep->ops->view) {
209:       (*nep->ops->view)(nep,viewer);
210:     }
211:   }
212:   if (!nep->ip) { NEPGetIP(nep,&nep->ip); }
213:   IPView(nep->ip,viewer);
214:   if (!nep->ds) { NEPGetDS(nep,&nep->ds); }
215:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);
216:   DSView(nep->ds,viewer);
217:   PetscViewerPopFormat(viewer);
218:   PetscObjectTypeCompare((PetscObject)nep,NEPSLP,&isslp);
219:   if (!isslp) {
220:     if (!nep->ksp) { NEPGetKSP(nep,&nep->ksp); }
221:     KSPView(nep->ksp,viewer);
222:   }
223:   return(0);
224: }

228: /*@C
229:    NEPCreate - Creates the default NEP context.

231:    Collective on MPI_Comm

233:    Input Parameter:
234: .  comm - MPI communicator

236:    Output Parameter:
237: .  nep - location to put the NEP context

239:    Level: beginner

241: .seealso: NEPSetUp(), NEPSolve(), NEPDestroy(), NEP
242: @*/
243: PetscErrorCode NEPCreate(MPI_Comm comm,NEP *outnep)
244: {
246:   NEP            nep;

250:   *outnep = 0;
251: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
252:   NEPInitializePackage();
253: #endif

255:   SlepcHeaderCreate(nep,_p_NEP,struct _NEPOps,NEP_CLASSID,"NEP","Nonlinear Eigenvalue Problem","NEP",comm,NEPDestroy,NEPView);

257:   nep->max_it          = 0;
258:   nep->max_funcs       = 0;
259:   nep->nev             = 1;
260:   nep->ncv             = 0;
261:   nep->mpd             = 0;
262:   nep->lag             = 1;
263:   nep->nini            = 0;
264:   nep->allocated_ncv   = 0;
265:   nep->ip              = 0;
266:   nep->ds              = 0;
267:   nep->function        = 0;
268:   nep->function_pre    = 0;
269:   nep->jacobian        = 0;
270:   nep->abstol          = PETSC_DEFAULT;
271:   nep->rtol            = PETSC_DEFAULT;
272:   nep->stol            = PETSC_DEFAULT;
273:   nep->ktol            = 0.1;
274:   nep->cctol           = PETSC_FALSE;
275:   nep->ttol            = 0.0;
276:   nep->which           = (NEPWhich)0;
277:   nep->computefunction = NULL;
278:   nep->computejacobian = NULL;
279:   nep->comparison      = NULL;
280:   nep->converged       = NEPConvergedDefault;
281:   nep->convergeddestroy= NULL;
282:   nep->comparisonctx   = NULL;
283:   nep->convergedctx    = NULL;
284:   nep->functionctx     = NULL;
285:   nep->jacobianctx     = NULL;
286:   nep->V               = NULL;
287:   nep->IS              = NULL;
288:   nep->eig             = NULL;
289:   nep->errest          = NULL;
290:   nep->data            = NULL;
291:   nep->t               = NULL;
292:   nep->split           = PETSC_FALSE;
293:   nep->nt              = 0;
294:   nep->mstr            = DIFFERENT_NONZERO_PATTERN;
295:   nep->A               = NULL;
296:   nep->f               = NULL;
297:   nep->nconv           = 0;
298:   nep->its             = 0;
299:   nep->perm            = NULL;
300:   nep->nfuncs          = 0;
301:   nep->linits          = 0;
302:   nep->nwork           = 0;
303:   nep->work            = NULL;
304:   nep->setupcalled     = 0;
305:   nep->reason          = NEP_CONVERGED_ITERATING;
306:   nep->numbermonitors  = 0;
307:   nep->trackall        = PETSC_FALSE;
308:   nep->rand            = 0;

310:   PetscRandomCreate(comm,&nep->rand);
311:   PetscRandomSetSeed(nep->rand,0x12345678);
312:   PetscLogObjectParent(nep,nep->rand);
313:   *outnep = nep;
314:   return(0);
315: }

319: /*@C
320:    NEPSetType - Selects the particular solver to be used in the NEP object.

322:    Logically Collective on NEP

324:    Input Parameters:
325: +  nep      - the nonlinear eigensolver context
326: -  type     - a known method

328:    Options Database Key:
329: .  -nep_type <method> - Sets the method; use -help for a list
330:     of available methods

332:    Notes:
333:    See "slepc/include/slepcnep.h" for available methods.

335:    Normally, it is best to use the NEPSetFromOptions() command and
336:    then set the NEP type from the options database rather than by using
337:    this routine.  Using the options database provides the user with
338:    maximum flexibility in evaluating the different available methods.
339:    The NEPSetType() routine is provided for those situations where it
340:    is necessary to set the iterative solver independently of the command
341:    line or options database.

343:    Level: intermediate

345: .seealso: NEPType
346: @*/
347: PetscErrorCode NEPSetType(NEP nep,NEPType type)
348: {
349:   PetscErrorCode ierr,(*r)(NEP);
350:   PetscBool      match;


356:   PetscObjectTypeCompare((PetscObject)nep,type,&match);
357:   if (match) return(0);

359:   PetscFunctionListFind(NEPList,type,&r);
360:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)nep),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown NEP type given: %s",type);

362:   if (nep->ops->destroy) { (*nep->ops->destroy)(nep); }
363:   PetscMemzero(nep->ops,sizeof(struct _NEPOps));

365:   nep->setupcalled = 0;
366:   PetscObjectChangeTypeName((PetscObject)nep,type);
367:   (*r)(nep);
368:   return(0);
369: }

373: /*@C
374:    NEPGetType - Gets the NEP type as a string from the NEP object.

376:    Not Collective

378:    Input Parameter:
379: .  nep - the eigensolver context

381:    Output Parameter:
382: .  name - name of NEP method

384:    Level: intermediate

386: .seealso: NEPSetType()
387: @*/
388: PetscErrorCode NEPGetType(NEP nep,NEPType *type)
389: {
393:   *type = ((PetscObject)nep)->type_name;
394:   return(0);
395: }

399: /*@C
400:    NEPRegister - Adds a method to the quadratic eigenproblem solver package.

402:    Not Collective

404:    Input Parameters:
405: +  name - name of a new user-defined solver
406: -  function - routine to create the solver context

408:    Notes:
409:    NEPRegister() may be called multiple times to add several user-defined solvers.

411:    Sample usage:
412: .vb
413:    NEPRegister("my_solver",MySolverCreate);
414: .ve

416:    Then, your solver can be chosen with the procedural interface via
417: $     NEPSetType(qep,"my_solver")
418:    or at runtime via the option
419: $     -qep_type my_solver

421:    Level: advanced

423: .seealso: NEPRegisterAll()
424: @*/
425: PetscErrorCode NEPRegister(const char *name,PetscErrorCode (*function)(NEP))
426: {

430:   PetscFunctionListAdd(&NEPList,name,function);
431:   return(0);
432: }

436: /*@
437:    NEPReset - Resets the NEP context to the setupcalled=0 state and removes any
438:    allocated objects.

440:    Collective on NEP

442:    Input Parameter:
443: .  nep - eigensolver context obtained from NEPCreate()

445:    Level: advanced

447: .seealso: NEPDestroy()
448: @*/
449: PetscErrorCode NEPReset(NEP nep)
450: {

455:   if (nep->ops->reset) { (nep->ops->reset)(nep); }
456:   if (nep->ip) { IPReset(nep->ip); }
457:   if (nep->ds) { DSReset(nep->ds); }
458:   VecDestroy(&nep->t);
459:   NEPFreeSolution(nep);
460:   nep->nfuncs      = 0;
461:   nep->linits      = 0;
462:   nep->setupcalled = 0;
463:   return(0);
464: }

468: /*@C
469:    NEPDestroy - Destroys the NEP context.

471:    Collective on NEP

473:    Input Parameter:
474: .  nep - eigensolver context obtained from NEPCreate()

476:    Level: beginner

478: .seealso: NEPCreate(), NEPSetUp(), NEPSolve()
479: @*/
480: PetscErrorCode NEPDestroy(NEP *nep)
481: {
483:   PetscInt       i;

486:   if (!*nep) return(0);
488:   if (--((PetscObject)(*nep))->refct > 0) { *nep = 0; return(0); }
489:   NEPReset(*nep);
490:   if ((*nep)->ops->destroy) { (*(*nep)->ops->destroy)(*nep); }
491:   KSPDestroy(&(*nep)->ksp);
492:   IPDestroy(&(*nep)->ip);
493:   DSDestroy(&(*nep)->ds);
494:   MatDestroy(&(*nep)->function);
495:   MatDestroy(&(*nep)->function_pre);
496:   MatDestroy(&(*nep)->jacobian);
497:   if ((*nep)->split) {
498:     MatDestroyMatrices((*nep)->nt,&(*nep)->A);
499:     for (i=0;i<(*nep)->nt;i++) {
500:       FNDestroy(&(*nep)->f[i]);
501:     }
502:     PetscFree((*nep)->f);
503:   }
504:   PetscRandomDestroy(&(*nep)->rand);
505:   /* just in case the initial vectors have not been used */
506:   SlepcBasisDestroy_Private(&(*nep)->nini,&(*nep)->IS);
507:   NEPMonitorCancel(*nep);
508:   PetscHeaderDestroy(nep);
509:   return(0);
510: }

514: /*@
515:    NEPSetIP - Associates an inner product object to the nonlinear eigensolver.

517:    Collective on NEP

519:    Input Parameters:
520: +  nep - eigensolver context obtained from NEPCreate()
521: -  ip  - the inner product object

523:    Note:
524:    Use NEPGetIP() to retrieve the inner product context (for example,
525:    to free it at the end of the computations).

527:    Level: advanced

529: .seealso: NEPGetIP()
530: @*/
531: PetscErrorCode NEPSetIP(NEP nep,IP ip)
532: {

539:   PetscObjectReference((PetscObject)ip);
540:   IPDestroy(&nep->ip);
541:   nep->ip = ip;
542:   PetscLogObjectParent(nep,nep->ip);
543:   return(0);
544: }

548: /*@C
549:    NEPGetIP - Obtain the inner product object associated
550:    to the nonlinear eigensolver object.

552:    Not Collective

554:    Input Parameters:
555: .  nep - eigensolver context obtained from NEPCreate()

557:    Output Parameter:
558: .  ip - inner product context

560:    Level: advanced

562: .seealso: NEPSetIP()
563: @*/
564: PetscErrorCode NEPGetIP(NEP nep,IP *ip)
565: {

571:   if (!nep->ip) {
572:     IPCreate(PetscObjectComm((PetscObject)nep),&nep->ip);
573:     PetscLogObjectParent(nep,nep->ip);
574:   }
575:   *ip = nep->ip;
576:   return(0);
577: }

581: /*@
582:    NEPSetDS - Associates a direct solver object to the nonlinear eigensolver.

584:    Collective on NEP

586:    Input Parameters:
587: +  nep - eigensolver context obtained from NEPCreate()
588: -  ds  - the direct solver object

590:    Note:
591:    Use NEPGetDS() to retrieve the direct solver context (for example,
592:    to free it at the end of the computations).

594:    Level: advanced

596: .seealso: NEPGetDS()
597: @*/
598: PetscErrorCode NEPSetDS(NEP nep,DS ds)
599: {

606:   PetscObjectReference((PetscObject)ds);
607:   DSDestroy(&nep->ds);
608:   nep->ds = ds;
609:   PetscLogObjectParent(nep,nep->ds);
610:   return(0);
611: }

615: /*@C
616:    NEPGetDS - Obtain the direct solver object associated to the
617:    nonlinear eigensolver object.

619:    Not Collective

621:    Input Parameters:
622: .  nep - eigensolver context obtained from NEPCreate()

624:    Output Parameter:
625: .  ds - direct solver context

627:    Level: advanced

629: .seealso: NEPSetDS()
630: @*/
631: PetscErrorCode NEPGetDS(NEP nep,DS *ds)
632: {

638:   if (!nep->ds) {
639:     DSCreate(PetscObjectComm((PetscObject)nep),&nep->ds);
640:     PetscLogObjectParent(nep,nep->ds);
641:   }
642:   *ds = nep->ds;
643:   return(0);
644: }

648: /*@
649:    NEPSetKSP - Associates a linear solver object to the nonlinear eigensolver.

651:    Collective on NEP

653:    Input Parameters:
654: +  nep - eigensolver context obtained from NEPCreate()
655: -  ksp - the linear solver object

657:    Note:
658:    Use NEPGetKSP() to retrieve the linear solver context (for example,
659:    to free it at the end of the computations).

661:    Level: developer

663: .seealso: NEPGetKSP()
664: @*/
665: PetscErrorCode NEPSetKSP(NEP nep,KSP ksp)
666: {

673:   PetscObjectReference((PetscObject)ksp);
674:   KSPDestroy(&nep->ksp);
675:   nep->ksp = ksp;
676:   PetscLogObjectParent(nep,nep->ksp);
677:   return(0);
678: }

682: /*@C
683:    NEPGetKSP - Obtain the linear solver (KSP) object associated
684:    to the eigensolver object.

686:    Not Collective

688:    Input Parameters:
689: .  nep - eigensolver context obtained from NEPCreate()

691:    Output Parameter:
692: .  ksp - linear solver context

694:    Level: beginner

696: .seealso: NEPSetKSP()
697: @*/
698: PetscErrorCode NEPGetKSP(NEP nep,KSP *ksp)
699: {

705:   if (!nep->ksp) {
706:     KSPCreate(PetscObjectComm((PetscObject)nep),&nep->ksp);
707:     KSPSetOptionsPrefix(nep->ksp,((PetscObject)nep)->prefix);
708:     KSPAppendOptionsPrefix(nep->ksp,"nep_");
709:     PetscObjectIncrementTabLevel((PetscObject)nep->ksp,(PetscObject)nep,1);
710:     PetscLogObjectParent(nep,nep->ksp);
711:   }
712:   *ksp = nep->ksp;
713:   return(0);
714: }

718: /*@
719:    NEPSetTarget - Sets the value of the target.

721:    Logically Collective on NEP

723:    Input Parameters:
724: +  nep    - eigensolver context
725: -  target - the value of the target

727:    Notes:
728:    The target is a scalar value used to determine the portion of the spectrum
729:    of interest. It is used in combination with NEPSetWhichEigenpairs().

731:    Level: beginner

733: .seealso: NEPGetTarget(), NEPSetWhichEigenpairs()
734: @*/
735: PetscErrorCode NEPSetTarget(NEP nep,PetscScalar target)
736: {
740:   nep->target = target;
741:   return(0);
742: }

746: /*@
747:    NEPGetTarget - Gets the value of the target.

749:    Not Collective

751:    Input Parameter:
752: .  nep - eigensolver context

754:    Output Parameter:
755: .  target - the value of the target

757:    Level: beginner

759:    Note:
760:    If the target was not set by the user, then zero is returned.

762: .seealso: NEPSetTarget()
763: @*/
764: PetscErrorCode NEPGetTarget(NEP nep,PetscScalar* target)
765: {
769:   *target = nep->target;
770:   return(0);
771: }

775: /*@C
776:    NEPSetFunction - Sets the function to compute the nonlinear Function T(lambda)
777:    as well as the location to store the matrix.

779:    Logically Collective on NEP and Mat

781:    Input Parameters:
782: +  nep - the NEP context
783: .  A   - Function matrix
784: .  B   - preconditioner matrix (usually same as the Function)
785: .  fun - Function evaluation routine (if NULL then NEP retains any
786:          previously set value)
787: -  ctx - [optional] user-defined context for private data for the Function
788:          evaluation routine (may be NULL) (if NULL then NEP retains any
789:          previously set value)

791:    Notes:
792:    The routine fun() takes Mat* as the matrix arguments rather than Mat.
793:    This allows the Function evaluation routine to replace A and/or B with a
794:    completely new matrix structure (not just different matrix elements)
795:    when appropriate, for instance, if the nonzero structure is changing
796:    throughout the global iterations.

798:    Level: beginner

800: .seealso: NEPGetFunction(), NEPSetJacobian()
801: @*/
802: PetscErrorCode NEPSetFunction(NEP nep,Mat A,Mat B,PetscErrorCode (*fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void *ctx)
803: {

812:   if (fun) nep->computefunction = fun;
813:   if (ctx) nep->functionctx     = ctx;
814:   if (A) {
815:     PetscObjectReference((PetscObject)A);
816:     MatDestroy(&nep->function);
817:     nep->function = A;
818:   }
819:   if (B) {
820:     PetscObjectReference((PetscObject)B);
821:     MatDestroy(&nep->function_pre);
822:     nep->function_pre = B;
823:   }
824:   nep->split = PETSC_FALSE;
825:   return(0);
826: }

830: /*@C
831:    NEPGetFunction - Returns the Function matrix and optionally the user
832:    provided context for evaluating the Function.

834:    Not Collective, but Mat object will be parallel if NEP object is

836:    Input Parameter:
837: .  nep - the nonlinear eigensolver context

839:    Output Parameters:
840: +  A   - location to stash Function matrix (or NULL)
841: .  B   - location to stash preconditioner matrix (or NULL)
842: .  fun - location to put Function function (or NULL)
843: -  ctx - location to stash Function context (or NULL)

845:    Level: advanced

847: .seealso: NEPSetFunction()
848: @*/
849: PetscErrorCode NEPGetFunction(NEP nep,Mat *A,Mat *B,PetscErrorCode (**fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void **ctx)
850: {
853:   if (A)   *A   = nep->function;
854:   if (B)   *B   = nep->function_pre;
855:   if (fun) *fun = nep->computefunction;
856:   if (ctx) *ctx = nep->functionctx;
857:   return(0);
858: }

862: /*@C
863:    NEPSetJacobian - Sets the function to compute Jacobian T'(lambda) as well
864:    as the location to store the matrix.

866:    Logically Collective on NEP and Mat

868:    Input Parameters:
869: +  nep - the NEP context
870: .  A   - Jacobian matrix
871: .  jac - Jacobian evaluation routine (if NULL then NEP retains any
872:          previously set value)
873: -  ctx - [optional] user-defined context for private data for the Jacobian
874:          evaluation routine (may be NULL) (if NULL then NEP retains any
875:          previously set value)

877:    Notes:
878:    The routine jac() takes Mat* as the matrix arguments rather than Mat.
879:    This allows the Jacobian evaluation routine to replace A with a
880:    completely new matrix structure (not just different matrix elements)
881:    when appropriate, for instance, if the nonzero structure is changing
882:    throughout the global iterations.

884:    Level: beginner

886: .seealso: NEPSetFunction(), NEPGetJacobian()
887: @*/
888: PetscErrorCode NEPSetJacobian(NEP nep,Mat A,PetscErrorCode (*jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void *ctx)
889: {

896:   if (jac) nep->computejacobian = jac;
897:   if (ctx) nep->jacobianctx     = ctx;
898:   if (A) {
899:     PetscObjectReference((PetscObject)A);
900:     MatDestroy(&nep->jacobian);
901:     nep->jacobian = A;
902:   }
903:   nep->split = PETSC_FALSE;
904:   return(0);
905: }

909: /*@C
910:    NEPGetJacobian - Returns the Jacobian matrix and optionally the user
911:    provided context for evaluating the Jacobian.

913:    Not Collective, but Mat object will be parallel if NEP object is

915:    Input Parameter:
916: .  nep - the nonlinear eigensolver context

918:    Output Parameters:
919: +  A   - location to stash Jacobian matrix (or NULL)
920: .  jac - location to put Jacobian function (or NULL)
921: -  ctx - location to stash Jacobian context (or NULL)

923:    Level: advanced

925: .seealso: NEPSetJacobian()
926: @*/
927: PetscErrorCode NEPGetJacobian(NEP nep,Mat *A,PetscErrorCode (**jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void **ctx)
928: {
931:   if (A)   *A   = nep->jacobian;
932:   if (jac) *jac = nep->computejacobian;
933:   if (ctx) *ctx = nep->jacobianctx;
934:   return(0);
935: }

939: /*@
940:    NEPSetSplitOperator - Sets the operator of the nonlinear eigenvalue problem
941:    in split form.

943:    Collective on NEP, Mat and FN

945:    Input Parameters:
946: +  nep - the nonlinear eigensolver context
947: .  n   - number of terms in the split form
948: .  A   - array of matrices
949: .  f   - array of functions
950: -  str - structure flag for matrices

952:    Notes:
953:    The nonlinear operator is written as T(lambda) = sum_i A_i*f_i(lambda),
954:    for i=1,...,n. The derivative T'(lambda) can be obtained using the
955:    derivatives of f_i.

957:    The structure flag provides information about A_i's nonzero pattern
958:    (see MatStructure enum). If all matrices have the same pattern, then
959:    use SAME_NONZERO_PATTERN. If the patterns are different but contained
960:    in the pattern of the first one, then use SUBSET_NONZERO_PATTERN.
961:    Otherwise use DIFFERENT_NONZERO_PATTERN.

963:    This function must be called before NEPSetUp(). If it is called again
964:    after NEPSetUp() then the NEP object is reset.

966:    Level: intermediate

968: .seealso: NEPGetSplitOperatorTerm(), NEPGetSplitOperatorInfo()
969:  @*/
970: PetscErrorCode NEPSetSplitOperator(NEP nep,PetscInt n,Mat A[],FN f[],MatStructure str)
971: {
972:   PetscInt       i;

978:   if (n <= 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Must have one or more terms, you have %D",n);
983:   if (nep->setupcalled) { NEPReset(nep); }
984:   /* clean previously stored information */
985:   MatDestroy(&nep->function);
986:   MatDestroy(&nep->function_pre);
987:   MatDestroy(&nep->jacobian);
988:   if (nep->split) {
989:     MatDestroyMatrices(nep->nt,&nep->A);
990:     for (i=0;i<nep->nt;i++) {
991:       FNDestroy(&nep->f[i]);
992:     }
993:     PetscFree(nep->f);
994:   }
995:   /* allocate space and copy matrices and functions */
996:   PetscMalloc(n*sizeof(Mat),&nep->A);
997:   PetscLogObjectMemory(nep,n*sizeof(Mat));
998:   for (i=0;i<n;i++) {
1000:     PetscObjectReference((PetscObject)A[i]);
1001:     nep->A[i] = A[i];
1002:   }
1003:   PetscMalloc(n*sizeof(FN),&nep->f);
1004:   PetscLogObjectMemory(nep,n*sizeof(FN));
1005:   for (i=0;i<n;i++) {
1007:     PetscObjectReference((PetscObject)f[i]);
1008:     nep->f[i] = f[i];
1009:   }
1010:   nep->nt    = n;
1011:   nep->mstr  = str;
1012:   nep->split = PETSC_TRUE;
1013:   return(0);
1014: }

1018: /*@
1019:    NEPGetSplitOperatorTerm - Gets the matrices and functions associated with
1020:    the nonlinear operator in split form.

1022:    Not collective, though parallel Mats and FNs are returned if the NEP is parallel

1024:    Input Parameter:
1025: +  nep - the nonlinear eigensolver context
1026: -  k   - the index of the requested term (starting in 0)

1028:    Output Parameters:
1029: +  A - the matrix of the requested term
1030: -  f - the function of the requested term

1032:    Level: intermediate

1034: .seealso: NEPSetSplitOperator(), NEPGetSplitOperatorInfo()
1035: @*/
1036: PetscErrorCode NEPGetSplitOperatorTerm(NEP nep,PetscInt k,Mat *A,FN *f)
1037: {
1040:   if (k<0 || k>=nep->nt) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",nep->nt-1);
1041:   if (A) *A = nep->A[k];
1042:   if (f) *f = nep->f[k];
1043:   return(0);
1044: }

1048: /*@
1049:    NEPGetSplitOperatorInfo - Returns the number of terms of the split form of
1050:    the nonlinear operator, as well as the structure flag for matrices.

1052:    Not collective

1054:    Input Parameter:
1055: .  nep - the nonlinear eigensolver context

1057:    Output Parameters:
1058: +  n   - the number of terms passed in NEPSetSplitOperator()
1059: -  str - the matrix structure flag passed in NEPSetSplitOperator()

1061:    Level: intermediate

1063: .seealso: NEPSetSplitOperator(), NEPGetSplitOperatorTerm()
1064: @*/
1065: PetscErrorCode NEPGetSplitOperatorInfo(NEP nep,PetscInt *n,MatStructure *str)
1066: {
1069:   if (n) *n = nep->nt;
1070:   if (str) *str = nep->mstr;
1071:   return(0);
1072: }

slepc-3.4.2.dfsg.orig/src/nep/index.html0000644000175000017500000000244512211062077017006 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

interface/
impls/
examples/
../../include/slepc-private/nepimpl.h
../../include/slepcnep.h
makefile
slepc-3.4.2.dfsg.orig/src/fn/0000755000175000017500000000000012214143515014625 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/fn/fnexp.c.html0000644000175000017500000001546712211062077017071 0ustar gladkgladk

Actual source code: fnexp.c

  1: /*
  2:    Exponential function  f(x) = beta*exp(alpha*x).

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/fnimpl.h>      /*I "slepcfn.h" I*/

 28: PetscErrorCode FNEvaluateFunction_Exp(FN fn,PetscScalar x,PetscScalar *y)
 29: {
 30:   PetscScalar arg;

 33:   if (!fn->na) arg = x;
 34:   else arg = fn->alpha[0]*x;
 35:   if (!fn->nb) *y = PetscExpScalar(arg);
 36:   else *y = fn->beta[0]*PetscExpScalar(arg);
 37:   return(0);
 38: }

 42: PetscErrorCode FNEvaluateDerivative_Exp(FN fn,PetscScalar x,PetscScalar *yp)
 43: {
 44:   PetscScalar arg,scal;

 47:   if (!fn->na) {
 48:     arg = x;
 49:     scal = 1.0;
 50:   } else {
 51:     arg = fn->alpha[0]*x;
 52:     scal = fn->alpha[0];
 53:   }
 54:   if (fn->nb) scal *= fn->beta[0];
 55:   *yp = scal*PetscExpScalar(arg);
 56:   return(0);
 57: }

 61: PetscErrorCode FNView_Exp(FN fn,PetscViewer viewer)
 62: {
 64:   PetscBool      isascii;
 65:   char           str[50];

 68:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
 69:   if (isascii) {
 70:     if (!fn->nb) {
 71:       if (!fn->na) {
 72:         PetscViewerASCIIPrintf(viewer,"  Exponential: exp(x)\n");
 73:       } else {
 74:         SlepcSNPrintfScalar(str,50,fn->alpha[0],PETSC_TRUE);
 75:         PetscViewerASCIIPrintf(viewer,"  Exponential: exp(%s*x)\n",str);
 76:       }
 77:     } else {
 78:       SlepcSNPrintfScalar(str,50,fn->beta[0],PETSC_TRUE);
 79:       if (!fn->na) {
 80:         PetscViewerASCIIPrintf(viewer,"  Exponential: %s*exp(x)\n",str);
 81:       } else {
 82:         PetscViewerASCIIPrintf(viewer,"  Exponential: %s",str);
 83:         SlepcSNPrintfScalar(str,50,fn->alpha[0],PETSC_TRUE);
 84:         PetscViewerASCIIPrintf(viewer,"*exp(%s*x)\n",str);
 85:       }
 86:     }
 87:   }
 88:   return(0);
 89: }

 93: PETSC_EXTERN PetscErrorCode FNCreate_Exp(FN fn)
 94: {
 96:   fn->ops->evaluatefunction   = FNEvaluateFunction_Exp;
 97:   fn->ops->evaluatederivative = FNEvaluateDerivative_Exp;
 98:   fn->ops->view               = FNView_Exp;
 99:   return(0);
100: }

slepc-3.4.2.dfsg.orig/src/fn/examples/0000755000175000017500000000000012214143515016443 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/fn/examples/makefile0000644000175000017500000000177212211062077020152 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/fn/examples/ DIRS = tests include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/fn/examples/tests/0000755000175000017500000000000012211062077017605 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/fn/examples/tests/output/0000755000175000017500000000000012214143515021145 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/fn/examples/tests/output/test2_1.out0000644000175000017500000000032312211062077023155 0ustar gladkgladkFN Object: 1 MPI processes type: exp Exponential: exp(x) f(2.2)=9.02501 f'(2.2)=9.02501 FN Object: 1 MPI processes type: exp Exponential: +1.3 *exp(-0.2*x) f(2.2)=0.837247 f'(2.2)=-0.167449 slepc-3.4.2.dfsg.orig/src/fn/examples/tests/output/test1_1.out0000644000175000017500000000100012211062077023145 0ustar gladkgladkFN Object: 1 MPI processes type: rational Polynomial: -3.1*x^4 +1.1*x^3 +1*x^2 -2*x^1 +3.5 f(2.2)=-56.9666 f'(2.2)=-113.663 FN Object: 1 MPI processes type: rational Inverse polinomial: 1 / ( -3.1*x^2 +1.1*x^1 +1) f(2.2)=-0.086326 f'(2.2)=0.0934502 FN Object: 1 MPI processes type: rational Rational function: ( -3.1*x^1 +1.1) / ( +1*x^2 -2*x^1 +3.5) f(2.2)=-1.45178 f'(2.2)=0.0975289 FN Object: 1 MPI processes type: rational Constant: 5 f(2.2)=5 f'(2.2)=0 slepc-3.4.2.dfsg.orig/src/fn/examples/tests/makefile0000644000175000017500000000360612211062077021312 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/fn/examples/tests/ EXAMPLESC = test1.c test2.c EXAMPLESF = MANSEC = FN TESTS = test1 test2 TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \ = test2.PETSc runtest2_1 test2.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o #------------------------------------------------------------------------------------ runtest1_1: -@${MPIEXEC} -np 1 ./test1 > test1_1.tmp 2>&1; \ if (${DIFF} output/test1_1.out test1_1.tmp) then true; \ else echo "Possible problem with test1_1, diffs above"; fi; \ ${RM} -f test1_1.tmp runtest2_1: -@${MPIEXEC} -np 1 ./test2 > test2_1.tmp 2>&1; \ if (${DIFF} output/test2_1.out test2_1.tmp) then true; \ else echo "Possible problem with test2_1, diffs above"; fi; \ ${RM} -f test2_1.tmp slepc-3.4.2.dfsg.orig/src/fn/examples/tests/test1.c0000644000175000017500000000752512211062077021022 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test rational function.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; FN fn; PetscInt na,nb; PetscScalar x,y,yp,p[10],q[10],five=5.0; char str[50]; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = FNCreate(PETSC_COMM_WORLD,&fn);CHKERRQ(ierr); /* polynomial p(x) */ na = 5; p[0] = -3.1; p[1] = 1.1; p[2] = 1.0; p[3] = -2.0; p[4] = 3.5; ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); ierr = FNSetParameters(fn,na,p,0,NULL);CHKERRQ(ierr); ierr = FNView(fn,NULL);CHKERRQ(ierr); x = 2.2; ierr = FNEvaluateFunction(fn,x,&y);CHKERRQ(ierr); ierr = FNEvaluateDerivative(fn,x,&yp);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,y,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,yp,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f'(%3.1F)=%s\n",x,str);CHKERRQ(ierr); /* inverse of polynomial 1/q(x) */ nb = 3; q[0] = -3.1; q[1] = 1.1; q[2] = 1.0; ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); ierr = FNSetParameters(fn,0,NULL,nb,q);CHKERRQ(ierr); ierr = FNView(fn,NULL);CHKERRQ(ierr); x = 2.2; ierr = FNEvaluateFunction(fn,x,&y);CHKERRQ(ierr); ierr = FNEvaluateDerivative(fn,x,&yp);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,y,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,yp,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f'(%3.1F)=%s\n",x,str);CHKERRQ(ierr); /* rational p(x)/q(x) */ na = 2; nb = 3; p[0] = -3.1; p[1] = 1.1; q[0] = 1.0; q[1] = -2.0; q[2] = 3.5; ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); ierr = FNSetParameters(fn,na,p,nb,q);CHKERRQ(ierr); ierr = FNView(fn,NULL);CHKERRQ(ierr); x = 2.2; ierr = FNEvaluateFunction(fn,x,&y);CHKERRQ(ierr); ierr = FNEvaluateDerivative(fn,x,&yp);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,y,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,yp,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f'(%3.1F)=%s\n",x,str);CHKERRQ(ierr); /* constant */ ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); ierr = FNSetParameters(fn,1,&five,0,NULL);CHKERRQ(ierr); ierr = FNView(fn,NULL);CHKERRQ(ierr); x = 2.2; ierr = FNEvaluateFunction(fn,x,&y);CHKERRQ(ierr); ierr = FNEvaluateDerivative(fn,x,&yp);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,y,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,yp,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f'(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = FNDestroy(&fn);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/fn/examples/tests/test2.c0000644000175000017500000000473212211062077021020 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test exponential function.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; FN fn; PetscScalar x,y,yp,tau,eta; char str[50]; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = FNCreate(PETSC_COMM_WORLD,&fn);CHKERRQ(ierr); /* plain exponential exp(x) */ ierr = FNSetType(fn,FNEXP);CHKERRQ(ierr); ierr = FNView(fn,NULL);CHKERRQ(ierr); x = 2.2; ierr = FNEvaluateFunction(fn,x,&y);CHKERRQ(ierr); ierr = FNEvaluateDerivative(fn,x,&yp);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,y,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,yp,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f'(%3.1F)=%s\n",x,str);CHKERRQ(ierr); /* exponential with scaling factors eta*exp(tau*x) */ ierr = FNSetType(fn,FNEXP);CHKERRQ(ierr); tau = -0.2; eta = 1.3; ierr = FNSetParameters(fn,1,&tau,1,&eta);CHKERRQ(ierr); ierr = FNView(fn,NULL);CHKERRQ(ierr); x = 2.2; ierr = FNEvaluateFunction(fn,x,&y);CHKERRQ(ierr); ierr = FNEvaluateDerivative(fn,x,&yp);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,y,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,yp,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," f'(%3.1F)=%s\n",x,str);CHKERRQ(ierr); ierr = FNDestroy(&fn);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/fn/fnrational.c.html0000644000175000017500000002522412211062077020076 0ustar gladkgladk
Actual source code: fnrational.c

  1: /*
  2:    Rational function  r(x) = p(x)/q(x), where p(x) is a polynomial of
  3:    degree na and q(x) is a polynomial of degree nb (can be 0).

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/fnimpl.h>      /*I "slepcfn.h" I*/

 29: PetscErrorCode FNEvaluateFunction_Rational(FN fn,PetscScalar x,PetscScalar *y)
 30: {
 31:   PetscInt    i;
 32:   PetscScalar p,q;

 35:   if (!fn->na) p = 1.0;
 36:   else {
 37:     p = fn->alpha[0];
 38:     for (i=1;i<fn->na;i++)
 39:       p = fn->alpha[i]+x*p;
 40:   }
 41:   if (!fn->nb) *y = p;
 42:   else {
 43:     q = fn->beta[0];
 44:     for (i=1;i<fn->nb;i++)
 45:       q = fn->beta[i]+x*q;
 46:     *y = p/q;
 47:   }
 48:   return(0);
 49: }

 53: PetscErrorCode FNEvaluateDerivative_Rational(FN fn,PetscScalar x,PetscScalar *yp)
 54: {
 55:   PetscInt    i;
 56:   PetscScalar p,q,pp,qp;

 59:   if (!fn->na) {
 60:     p = 1.0;
 61:     pp = 0.0;
 62:   } else {
 63:     p = fn->alpha[0];
 64:     pp = 0.0;
 65:     for (i=1;i<fn->na;i++) {
 66:       pp = p+x*pp;
 67:       p = fn->alpha[i]+x*p;
 68:     }
 69:   }
 70:   if (!fn->nb) *yp = pp;
 71:   else {
 72:     q = fn->beta[0];
 73:     qp = 0.0;
 74:     for (i=1;i<fn->nb;i++) {
 75:       qp = q+x*qp;
 76:       q = fn->beta[i]+x*q;
 77:     }
 78:     *yp = (pp*q-p*qp)/(q*q);
 79:   }
 80:   return(0);
 81: }

 85: PetscErrorCode FNView_Rational(FN fn,PetscViewer viewer)
 86: {
 88:   PetscBool      isascii;
 89:   PetscInt       i;
 90:   char           str[50];

 93:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
 94:   if (isascii) {
 95:     if (!fn->nb) {
 96:       if (!fn->na) {
 97:         PetscViewerASCIIPrintf(viewer,"  Constant: 1.0\n");
 98:       } else if (fn->na==1) {
 99:         SlepcSNPrintfScalar(str,50,fn->alpha[0],PETSC_FALSE);
100:         PetscViewerASCIIPrintf(viewer,"  Constant: %s\n",str);
101:       } else {
102:         PetscViewerASCIIPrintf(viewer,"  Polynomial: ");
103:         for (i=0;i<fn->na-1;i++) {
104:           SlepcSNPrintfScalar(str,50,fn->alpha[i],PETSC_TRUE);
105:           PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->na-i-1);
106:         }
107:         SlepcSNPrintfScalar(str,50,fn->alpha[fn->na-1],PETSC_TRUE);
108:         PetscViewerASCIIPrintf(viewer,"%s\n",str);
109:       }
110:     } else if (!fn->na) {
111:       PetscViewerASCIIPrintf(viewer,"  Inverse polinomial: 1 / (");
112:       for (i=0;i<fn->nb-1;i++) {
113:         SlepcSNPrintfScalar(str,50,fn->beta[i],PETSC_TRUE);
114:         PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->nb-i-1);
115:       }
116:       SlepcSNPrintfScalar(str,50,fn->beta[fn->nb-1],PETSC_TRUE);
117:       PetscViewerASCIIPrintf(viewer,"%s)\n",str);
118:     } else {
119:       PetscViewerASCIIPrintf(viewer,"  Rational function: (");
120:       for (i=0;i<fn->na-1;i++) {
121:         SlepcSNPrintfScalar(str,50,fn->alpha[i],PETSC_TRUE);
122:         PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->na-i-1);
123:       }
124:         SlepcSNPrintfScalar(str,50,fn->alpha[fn->na-1],PETSC_TRUE);
125:       PetscViewerASCIIPrintf(viewer,"%s) / (",str);
126:       for (i=0;i<fn->nb-1;i++) {
127:         SlepcSNPrintfScalar(str,50,fn->beta[i],PETSC_TRUE);
128:         PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->nb-i-1);
129:       }
130:       SlepcSNPrintfScalar(str,50,fn->beta[fn->nb-1],PETSC_TRUE);
131:       PetscViewerASCIIPrintf(viewer,"%s)\n",str);
132:     }
133:   }
134:   return(0);
135: }

139: PETSC_EXTERN PetscErrorCode FNCreate_Rational(FN fn)
140: {
142:   fn->ops->evaluatefunction   = FNEvaluateFunction_Rational;
143:   fn->ops->evaluatederivative = FNEvaluateDerivative_Rational;
144:   fn->ops->view               = FNView_Rational;
145:   return(0);
146: }

slepc-3.4.2.dfsg.orig/src/fn/fnbasic.c.html0000644000175000017500000011771012211062077017350 0ustar gladkgladk
Actual source code: fnbasic.c

  1: /*
  2:      Basic routines

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/fnimpl.h>      /*I "slepcfn.h" I*/

 26: PetscFunctionList FNList = 0;
 27: PetscBool         FNRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      FN_CLASSID = 0;
 29: static PetscBool  FNPackageInitialized = PETSC_FALSE;

 33: /*@C
 34:    FNFinalizePackage - This function destroys everything in the Slepc interface
 35:    to the FN package. It is called from SlepcFinalize().

 37:    Level: developer

 39: .seealso: SlepcFinalize()
 40: @*/
 41: PetscErrorCode FNFinalizePackage(void)
 42: {

 46:   PetscFunctionListDestroy(&FNList);
 47:   FNPackageInitialized = PETSC_FALSE;
 48:   FNRegisterAllCalled  = PETSC_FALSE;
 49:   return(0);
 50: }

 54: /*@C
 55:   FNInitializePackage - This function initializes everything in the FN package. It is called
 56:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to FNCreate()
 57:   when using static libraries.

 59:   Level: developer

 61: .seealso: SlepcInitialize()
 62: @*/
 63: PetscErrorCode FNInitializePackage(void)
 64: {
 65:   char             logList[256];
 66:   char             *className;
 67:   PetscBool        opt;
 68:   PetscErrorCode   ierr;

 71:   if (FNPackageInitialized) return(0);
 72:   FNPackageInitialized = PETSC_TRUE;
 73:   /* Register Classes */
 74:   PetscClassIdRegister("Math function",&FN_CLASSID);
 75:   /* Register Constructors */
 76:   FNRegisterAll();
 77:   /* Process info exclusions */
 78:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 79:   if (opt) {
 80:     PetscStrstr(logList,"fn",&className);
 81:     if (className) {
 82:       PetscInfoDeactivateClass(FN_CLASSID);
 83:     }
 84:   }
 85:   /* Process summary exclusions */
 86:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 87:   if (opt) {
 88:     PetscStrstr(logList,"fn",&className);
 89:     if (className) {
 90:       PetscLogEventDeactivateClass(FN_CLASSID);
 91:     }
 92:   }
 93:   PetscRegisterFinalize(FNFinalizePackage);
 94:   return(0);
 95: }

 99: /*@C
100:    FNCreate - Creates an FN context.

102:    Collective on MPI_Comm

104:    Input Parameter:
105: .  comm - MPI communicator

107:    Output Parameter:
108: .  newfn - location to put the FN context

110:    Level: beginner

112: .seealso: FNDestroy(), FN
113: @*/
114: PetscErrorCode FNCreate(MPI_Comm comm,FN *newfn)
115: {
116:   FN             fn;

121:   *newfn = 0;
122: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
123:   FNInitializePackage();
124: #endif

126:   SlepcHeaderCreate(fn,_p_FN,struct _FNOps,FN_CLASSID,"FN","Math Function","FN",comm,FNDestroy,FNView);
127:   fn->na       = 0;
128:   fn->alpha    = NULL;
129:   fn->nb       = 0;
130:   fn->beta     = NULL;

132:   *newfn = fn;
133:   return(0);
134: }

138: /*@C
139:    FNSetOptionsPrefix - Sets the prefix used for searching for all
140:    FN options in the database.

142:    Logically Collective on FN

144:    Input Parameters:
145: +  fn - the math function context
146: -  prefix - the prefix string to prepend to all FN option requests

148:    Notes:
149:    A hyphen (-) must NOT be given at the beginning of the prefix name.
150:    The first character of all runtime options is AUTOMATICALLY the
151:    hyphen.

153:    Level: advanced

155: .seealso: FNAppendOptionsPrefix()
156: @*/
157: PetscErrorCode FNSetOptionsPrefix(FN fn,const char *prefix)
158: {

163:   PetscObjectSetOptionsPrefix((PetscObject)fn,prefix);
164:   return(0);
165: }

169: /*@C
170:    FNAppendOptionsPrefix - Appends to the prefix used for searching for all
171:    FN options in the database.

173:    Logically Collective on FN

175:    Input Parameters:
176: +  fn - the math function context
177: -  prefix - the prefix string to prepend to all FN option requests

179:    Notes:
180:    A hyphen (-) must NOT be given at the beginning of the prefix name.
181:    The first character of all runtime options is AUTOMATICALLY the hyphen.

183:    Level: advanced

185: .seealso: FNSetOptionsPrefix()
186: @*/
187: PetscErrorCode FNAppendOptionsPrefix(FN fn,const char *prefix)
188: {

193:   PetscObjectAppendOptionsPrefix((PetscObject)fn,prefix);
194:   return(0);
195: }

199: /*@C
200:    FNGetOptionsPrefix - Gets the prefix used for searching for all
201:    FN options in the database.

203:    Not Collective

205:    Input Parameters:
206: .  fn - the math function context

208:    Output Parameters:
209: .  prefix - pointer to the prefix string used is returned

211:    Notes: On the fortran side, the user should pass in a string 'prefix' of
212:    sufficient length to hold the prefix.

214:    Level: advanced

216: .seealso: FNSetOptionsPrefix(), FNAppendOptionsPrefix()
217: @*/
218: PetscErrorCode FNGetOptionsPrefix(FN fn,const char *prefix[])
219: {

225:   PetscObjectGetOptionsPrefix((PetscObject)fn,prefix);
226:   return(0);
227: }

231: /*@C
232:    FNSetType - Selects the type for the FN object.

234:    Logically Collective on FN

236:    Input Parameter:
237: +  fn   - the math function context
238: -  type - a known type

240:    Notes:
241:    The default is FNRATIONAL, which includes polynomials as a particular
242:    case as well as simple functions such as f(x)=x and f(x)=constant.

244:    Level: intermediate

246: .seealso: FNGetType()
247: @*/
248: PetscErrorCode FNSetType(FN fn,FNType type)
249: {
250:   PetscErrorCode ierr,(*r)(FN);
251:   PetscBool      match;


257:   PetscObjectTypeCompare((PetscObject)fn,type,&match);
258:   if (match) return(0);

260:    PetscFunctionListFind(FNList,type,&r);
261:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)fn),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested FN type %s",type);

263:   PetscMemzero(fn->ops,sizeof(struct _FNOps));

265:   PetscObjectChangeTypeName((PetscObject)fn,type);
266:   (*r)(fn);
267:   return(0);
268: }

272: /*@C
273:    FNGetType - Gets the FN type name (as a string) from the FN context.

275:    Not Collective

277:    Input Parameter:
278: .  fn - the math function context

280:    Output Parameter:
281: .  name - name of the math function

283:    Level: intermediate

285: .seealso: FNSetType()
286: @*/
287: PetscErrorCode FNGetType(FN fn,FNType *type)
288: {
292:   *type = ((PetscObject)fn)->type_name;
293:   return(0);
294: }

298: /*@
299:    FNSetParameters - Sets the parameters that define the matematical function.

301:    Logically Collective on FN

303:    Input Parameters:
304: +  fn    - the math function context
305: .  na    - number of parameters in the first group
306: .  alpha - first group of parameters (array of scalar values)
307: .  nb    - number of parameters in the second group
308: -  beta  - second group of parameters (array of scalar values)

310:    Notes:
311:    In a rational function r(x) = p(x)/q(x), where p(x) and q(x) are polynomials,
312:    the parameters alpha and beta represent the coefficients of p(x) and q(x),
313:    respectively. Hence, p(x) is of degree na-1 and q(x) of degree nb-1.
314:    If nb is zero, then the function is assumed to be polynomial, r(x) = p(x).

316:    In other functions the parameters have other meanings.

318:    In polynomials, high order coefficients are stored in the first positions
319:    of the array, e.g. to represent x^2-3 use {1,0,-3}.

321:    Level: intermediate

323: .seealso: FNGetParameters()
324: @*/
325: PetscErrorCode FNSetParameters(FN fn,PetscInt na,PetscScalar *alpha,PetscInt nb,PetscScalar *beta)
326: {
328:   PetscInt       i;

333:   if (na<0) SETERRQ(PetscObjectComm((PetscObject)fn),PETSC_ERR_ARG_OUTOFRANGE,"Argument na cannot be negative");
336:   if (nb<0) SETERRQ(PetscObjectComm((PetscObject)fn),PETSC_ERR_ARG_OUTOFRANGE,"Argument nb cannot be negative");
338:   fn->na = na;
339:   PetscFree(fn->alpha);
340:   if (na) {
341:     PetscMalloc(na*sizeof(PetscScalar),&fn->alpha);
342:     PetscLogObjectMemory(fn,na*sizeof(PetscScalar));
343:     for (i=0;i<na;i++) fn->alpha[i] = alpha[i];
344:   }
345:   fn->nb = nb;
346:   PetscFree(fn->beta);
347:   if (nb) {
348:     PetscMalloc(nb*sizeof(PetscScalar),&fn->beta);
349:     PetscLogObjectMemory(fn,nb*sizeof(PetscScalar));
350:     for (i=0;i<nb;i++) fn->beta[i] = beta[i];
351:   }
352:   return(0);
353: }

357: /*@
358:    FNGetParameters - Returns the parameters that define the matematical function.

360:    Not Collective

362:    Input Parameter:
363: .  fn    - the math function context

365:    Output Parameters:
366: +  na    - number of parameters in the first group
367: .  alpha - first group of parameters (array of scalar values)
368: .  nb    - number of parameters in the second group
369: -  beta  - second group of parameters (array of scalar values)

371:    Level: intermediate

373: .seealso: FNSetParameters()
374: @*/
375: PetscErrorCode FNGetParameters(FN fn,PetscInt *na,PetscScalar *alpha[],PetscInt *nb,PetscScalar *beta[])
376: {
379:   if (na)    *na = fn->na;
380:   if (alpha) *alpha = fn->alpha;
381:   if (nb)    *nb = fn->nb;
382:   if (beta)  *beta = fn->beta;
383:   return(0);
384: }

388: /*@
389:    FNEvaluateFunction - Computes the value of the function f(x) for a given x.

391:    Logically Collective on FN

393:    Input Parameters:
394: +  fn - the math function context
395: -  x  - the value where the function must be evaluated

397:    Output Parameter:
398: .  y  - the result of f(x)

400:    Level: intermediate

402: .seealso: FNEvaluateDerivative()
403: @*/
404: PetscErrorCode FNEvaluateFunction(FN fn,PetscScalar x,PetscScalar *y)
405: {

412:   if (!((PetscObject)fn)->type_name) {
413:     FNSetType(fn,FNRATIONAL);
414:   }
415:   (*fn->ops->evaluatefunction)(fn,x,y);
416:   return(0);
417: }

421: /*@
422:    FNEvaluateDerivative - Computes the value of the derivative f'(x) for a given x.

424:    Logically Collective on FN

426:    Input Parameters:
427: +  fn - the math function context
428: -  x  - the value where the derivative must be evaluated

430:    Output Parameter:
431: .  y  - the result of f'(x)

433:    Level: intermediate

435: .seealso: FNEvaluateFunction()
436: @*/
437: PetscErrorCode FNEvaluateDerivative(FN fn,PetscScalar x,PetscScalar *y)
438: {

445:   if (!((PetscObject)fn)->type_name) {
446:     FNSetType(fn,FNRATIONAL);
447:   }
448:   (*fn->ops->evaluatederivative)(fn,x,y);
449:   return(0);
450: }

454: /*@
455:    FNSetFromOptions - Sets FN options from the options database.

457:    Collective on FN

459:    Input Parameters:
460: .  fn - the math function context

462:    Notes:
463:    To see all options, run your program with the -help option.

465:    Level: beginner
466: @*/
467: PetscErrorCode FNSetFromOptions(FN fn)
468: {

473:   if (!FNRegisterAllCalled) { FNRegisterAll(); }
474:   /* Set default type (we do not allow changing it with -fn_type) */
475:   if (!((PetscObject)fn)->type_name) {
476:     FNSetType(fn,FNRATIONAL);
477:   }
478:   PetscObjectOptionsBegin((PetscObject)fn);
479:     PetscObjectProcessOptionsHandlers((PetscObject)fn);
480:   PetscOptionsEnd();
481:   return(0);
482: }

486: /*@C
487:    FNView - Prints the FN data structure.

489:    Collective on FN

491:    Input Parameters:
492: +  fn - the math function context
493: -  viewer - optional visualization context

495:    Note:
496:    The available visualization contexts include
497: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
498: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
499:          output where only the first processor opens
500:          the file.  All other processors send their
501:          data to the first processor to print.

503:    The user can open an alternative visualization context with
504:    PetscViewerASCIIOpen() - output to a specified file.

506:    Level: beginner
507: @*/
508: PetscErrorCode FNView(FN fn,PetscViewer viewer)
509: {
510:   PetscBool      isascii;

515:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)fn));
518:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
519:   if (isascii) {
520:     PetscObjectPrintClassNamePrefixType((PetscObject)fn,viewer,"FN Object");
521:     if (fn->ops->view) {
522:       PetscViewerASCIIPushTab(viewer);
523:       (*fn->ops->view)(fn,viewer);
524:       PetscViewerASCIIPopTab(viewer);
525:     }
526:   }
527:   return(0);
528: }

532: /*@C
533:    FNDestroy - Destroys FN context that was created with FNCreate().

535:    Collective on FN

537:    Input Parameter:
538: .  fn - the math function context

540:    Level: beginner

542: .seealso: FNCreate()
543: @*/
544: PetscErrorCode FNDestroy(FN *fn)
545: {

549:   if (!*fn) return(0);
551:   if (--((PetscObject)(*fn))->refct > 0) { *fn = 0; return(0); }
552:   PetscFree((*fn)->alpha);
553:   PetscFree((*fn)->beta);
554:   PetscHeaderDestroy(fn);
555:   return(0);
556: }

560: /*@C
561:    FNRegister - See Adds a mathematical function to the FN package.

563:    Not collective

565:    Input Parameters:
566: +  name - name of a new user-defined FN
567: -  function - routine to create context

569:    Notes:
570:    FNRegister() may be called multiple times to add several user-defined inner products.

572:    Level: advanced

574: .seealso: FNRegisterAll()
575: @*/
576: PetscErrorCode FNRegister(const char *name,PetscErrorCode (*function)(FN))
577: {

581:   PetscFunctionListAdd(&FNList,name,function);
582:   return(0);
583: }

585: PETSC_EXTERN PetscErrorCode FNCreate_Rational(FN);
586: PETSC_EXTERN PetscErrorCode FNCreate_Exp(FN);

590: /*@C
591:    FNRegisterAll - Registers all of the math functions in the FN package.

593:    Not Collective

595:    Level: advanced
596: @*/
597: PetscErrorCode FNRegisterAll(void)
598: {

602:   FNRegisterAllCalled = PETSC_TRUE;
603:   FNRegister(FNRATIONAL,FNCreate_Rational);
604:   FNRegister(FNEXP,FNCreate_Exp);
605:   return(0);
606: }

slepc-3.4.2.dfsg.orig/src/fn/makefile0000644000175000017500000000224312211062077016326 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = fnbasic.c fnrational.c fnexp.c SOURCEF = SOURCEH = ../../include/slepc-private/fnimpl.h ../../include/slepcfn.h LIBBASE = libslepc DIRS = MANSEC = FN LOCDIR = src/fn/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/fn/makefile.html0000644000175000017500000000403412211062077017271 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = fnbasic.c fnrational.c fnexp.c
SOURCEF  =
SOURCEH  = ../../include/slepc-private/fnimpl.h ../../include/slepcfn.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = FN
LOCDIR   = src/fn/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/fn/index.html0000644000175000017500000000144512211062077016626 0ustar gladkgladk Mathematical Function - FN

Mathematical Function - FN

The FN package provides the functionality to represent a simple mathematical function such as an exponential, a polynomial or a rational function. This is used as a building block for defining the function associated to the nonlinear eigenproblem.

../../include/slepc-private/fnimpl.h
../../include/slepcfn.h
fnbasic.c
fnrational.c
fnexp.c
makefile
slepc-3.4.2.dfsg.orig/src/fn/fnexp.c0000644000175000017500000000625212211062077016116 0ustar gladkgladk/* Exponential function f(x) = beta*exp(alpha*x). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcfn.h" I*/ #undef __FUNCT__ #define __FUNCT__ "FNEvaluateFunction_Exp" PetscErrorCode FNEvaluateFunction_Exp(FN fn,PetscScalar x,PetscScalar *y) { PetscScalar arg; PetscFunctionBegin; if (!fn->na) arg = x; else arg = fn->alpha[0]*x; if (!fn->nb) *y = PetscExpScalar(arg); else *y = fn->beta[0]*PetscExpScalar(arg); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNEvaluateDerivative_Exp" PetscErrorCode FNEvaluateDerivative_Exp(FN fn,PetscScalar x,PetscScalar *yp) { PetscScalar arg,scal; PetscFunctionBegin; if (!fn->na) { arg = x; scal = 1.0; } else { arg = fn->alpha[0]*x; scal = fn->alpha[0]; } if (fn->nb) scal *= fn->beta[0]; *yp = scal*PetscExpScalar(arg); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNView_Exp" PetscErrorCode FNView_Exp(FN fn,PetscViewer viewer) { PetscErrorCode ierr; PetscBool isascii; char str[50]; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { if (!fn->nb) { if (!fn->na) { ierr = PetscViewerASCIIPrintf(viewer," Exponential: exp(x)\n");CHKERRQ(ierr); } else { ierr = SlepcSNPrintfScalar(str,50,fn->alpha[0],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Exponential: exp(%s*x)\n",str);CHKERRQ(ierr); } } else { ierr = SlepcSNPrintfScalar(str,50,fn->beta[0],PETSC_TRUE);CHKERRQ(ierr); if (!fn->na) { ierr = PetscViewerASCIIPrintf(viewer," Exponential: %s*exp(x)\n",str);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Exponential: %s",str);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,fn->alpha[0],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"*exp(%s*x)\n",str);CHKERRQ(ierr); } } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNCreate_Exp" PETSC_EXTERN PetscErrorCode FNCreate_Exp(FN fn) { PetscFunctionBegin; fn->ops->evaluatefunction = FNEvaluateFunction_Exp; fn->ops->evaluatederivative = FNEvaluateDerivative_Exp; fn->ops->view = FNView_Exp; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/fn/fnbasic.c0000644000175000017500000004063012211062077016401 0ustar gladkgladk/* Basic routines - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcfn.h" I*/ PetscFunctionList FNList = 0; PetscBool FNRegisterAllCalled = PETSC_FALSE; PetscClassId FN_CLASSID = 0; static PetscBool FNPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "FNFinalizePackage" /*@C FNFinalizePackage - This function destroys everything in the Slepc interface to the FN package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode FNFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&FNList);CHKERRQ(ierr); FNPackageInitialized = PETSC_FALSE; FNRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNInitializePackage" /*@C FNInitializePackage - This function initializes everything in the FN package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to FNCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode FNInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (FNPackageInitialized) PetscFunctionReturn(0); FNPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Math function",&FN_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = FNRegisterAll();CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"fn",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(FN_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"fn",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(FN_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(FNFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNCreate" /*@C FNCreate - Creates an FN context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . newfn - location to put the FN context Level: beginner .seealso: FNDestroy(), FN @*/ PetscErrorCode FNCreate(MPI_Comm comm,FN *newfn) { FN fn; PetscErrorCode ierr; PetscFunctionBegin; PetscValidPointer(newfn,2); *newfn = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = FNInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(fn,_p_FN,struct _FNOps,FN_CLASSID,"FN","Math Function","FN",comm,FNDestroy,FNView);CHKERRQ(ierr); fn->na = 0; fn->alpha = NULL; fn->nb = 0; fn->beta = NULL; *newfn = fn; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNSetOptionsPrefix" /*@C FNSetOptionsPrefix - Sets the prefix used for searching for all FN options in the database. Logically Collective on FN Input Parameters: + fn - the math function context - prefix - the prefix string to prepend to all FN option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: FNAppendOptionsPrefix() @*/ PetscErrorCode FNSetOptionsPrefix(FN fn,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); ierr = PetscObjectSetOptionsPrefix((PetscObject)fn,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNAppendOptionsPrefix" /*@C FNAppendOptionsPrefix - Appends to the prefix used for searching for all FN options in the database. Logically Collective on FN Input Parameters: + fn - the math function context - prefix - the prefix string to prepend to all FN option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: FNSetOptionsPrefix() @*/ PetscErrorCode FNAppendOptionsPrefix(FN fn,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); ierr = PetscObjectAppendOptionsPrefix((PetscObject)fn,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNGetOptionsPrefix" /*@C FNGetOptionsPrefix - Gets the prefix used for searching for all FN options in the database. Not Collective Input Parameters: . fn - the math function context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: FNSetOptionsPrefix(), FNAppendOptionsPrefix() @*/ PetscErrorCode FNGetOptionsPrefix(FN fn,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)fn,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNSetType" /*@C FNSetType - Selects the type for the FN object. Logically Collective on FN Input Parameter: + fn - the math function context - type - a known type Notes: The default is FNRATIONAL, which includes polynomials as a particular case as well as simple functions such as f(x)=x and f(x)=constant. Level: intermediate .seealso: FNGetType() @*/ PetscErrorCode FNSetType(FN fn,FNType type) { PetscErrorCode ierr,(*r)(FN); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)fn,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(FNList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)fn),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested FN type %s",type); ierr = PetscMemzero(fn->ops,sizeof(struct _FNOps));CHKERRQ(ierr); ierr = PetscObjectChangeTypeName((PetscObject)fn,type);CHKERRQ(ierr); ierr = (*r)(fn);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNGetType" /*@C FNGetType - Gets the FN type name (as a string) from the FN context. Not Collective Input Parameter: . fn - the math function context Output Parameter: . name - name of the math function Level: intermediate .seealso: FNSetType() @*/ PetscErrorCode FNGetType(FN fn,FNType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)fn)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNSetParameters" /*@ FNSetParameters - Sets the parameters that define the matematical function. Logically Collective on FN Input Parameters: + fn - the math function context . na - number of parameters in the first group . alpha - first group of parameters (array of scalar values) . nb - number of parameters in the second group - beta - second group of parameters (array of scalar values) Notes: In a rational function r(x) = p(x)/q(x), where p(x) and q(x) are polynomials, the parameters alpha and beta represent the coefficients of p(x) and q(x), respectively. Hence, p(x) is of degree na-1 and q(x) of degree nb-1. If nb is zero, then the function is assumed to be polynomial, r(x) = p(x). In other functions the parameters have other meanings. In polynomials, high order coefficients are stored in the first positions of the array, e.g. to represent x^2-3 use {1,0,-3}. Level: intermediate .seealso: FNGetParameters() @*/ PetscErrorCode FNSetParameters(FN fn,PetscInt na,PetscScalar *alpha,PetscInt nb,PetscScalar *beta) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); PetscValidLogicalCollectiveInt(fn,na,2); if (na<0) SETERRQ(PetscObjectComm((PetscObject)fn),PETSC_ERR_ARG_OUTOFRANGE,"Argument na cannot be negative"); if (na) PetscValidPointer(alpha,3); PetscValidLogicalCollectiveInt(fn,nb,4); if (nb<0) SETERRQ(PetscObjectComm((PetscObject)fn),PETSC_ERR_ARG_OUTOFRANGE,"Argument nb cannot be negative"); if (nb) PetscValidPointer(beta,5); fn->na = na; ierr = PetscFree(fn->alpha);CHKERRQ(ierr); if (na) { ierr = PetscMalloc(na*sizeof(PetscScalar),&fn->alpha);CHKERRQ(ierr); ierr = PetscLogObjectMemory(fn,na*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;ialpha[i] = alpha[i]; } fn->nb = nb; ierr = PetscFree(fn->beta);CHKERRQ(ierr); if (nb) { ierr = PetscMalloc(nb*sizeof(PetscScalar),&fn->beta);CHKERRQ(ierr); ierr = PetscLogObjectMemory(fn,nb*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;ibeta[i] = beta[i]; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNGetParameters" /*@ FNGetParameters - Returns the parameters that define the matematical function. Not Collective Input Parameter: . fn - the math function context Output Parameters: + na - number of parameters in the first group . alpha - first group of parameters (array of scalar values) . nb - number of parameters in the second group - beta - second group of parameters (array of scalar values) Level: intermediate .seealso: FNSetParameters() @*/ PetscErrorCode FNGetParameters(FN fn,PetscInt *na,PetscScalar *alpha[],PetscInt *nb,PetscScalar *beta[]) { PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); if (na) *na = fn->na; if (alpha) *alpha = fn->alpha; if (nb) *nb = fn->nb; if (beta) *beta = fn->beta; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNEvaluateFunction" /*@ FNEvaluateFunction - Computes the value of the function f(x) for a given x. Logically Collective on FN Input Parameters: + fn - the math function context - x - the value where the function must be evaluated Output Parameter: . y - the result of f(x) Level: intermediate .seealso: FNEvaluateDerivative() @*/ PetscErrorCode FNEvaluateFunction(FN fn,PetscScalar x,PetscScalar *y) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); PetscValidLogicalCollectiveScalar(fn,x,2); PetscValidPointer(y,3); if (!((PetscObject)fn)->type_name) { ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); } ierr = (*fn->ops->evaluatefunction)(fn,x,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNEvaluateDerivative" /*@ FNEvaluateDerivative - Computes the value of the derivative f'(x) for a given x. Logically Collective on FN Input Parameters: + fn - the math function context - x - the value where the derivative must be evaluated Output Parameter: . y - the result of f'(x) Level: intermediate .seealso: FNEvaluateFunction() @*/ PetscErrorCode FNEvaluateDerivative(FN fn,PetscScalar x,PetscScalar *y) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); PetscValidLogicalCollectiveScalar(fn,x,2); PetscValidPointer(y,3); if (!((PetscObject)fn)->type_name) { ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); } ierr = (*fn->ops->evaluatederivative)(fn,x,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNSetFromOptions" /*@ FNSetFromOptions - Sets FN options from the options database. Collective on FN Input Parameters: . fn - the math function context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode FNSetFromOptions(FN fn) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); if (!FNRegisterAllCalled) { ierr = FNRegisterAll();CHKERRQ(ierr); } /* Set default type (we do not allow changing it with -fn_type) */ if (!((PetscObject)fn)->type_name) { ierr = FNSetType(fn,FNRATIONAL);CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)fn);CHKERRQ(ierr); ierr = PetscObjectProcessOptionsHandlers((PetscObject)fn);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNView" /*@C FNView - Prints the FN data structure. Collective on FN Input Parameters: + fn - the math function context - viewer - optional visualization context Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner @*/ PetscErrorCode FNView(FN fn,PetscViewer viewer) { PetscBool isascii; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(fn,FN_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)fn)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(fn,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)fn,viewer,"FN Object");CHKERRQ(ierr); if (fn->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*fn->ops->view)(fn,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNDestroy" /*@C FNDestroy - Destroys FN context that was created with FNCreate(). Collective on FN Input Parameter: . fn - the math function context Level: beginner .seealso: FNCreate() @*/ PetscErrorCode FNDestroy(FN *fn) { PetscErrorCode ierr; PetscFunctionBegin; if (!*fn) PetscFunctionReturn(0); PetscValidHeaderSpecific(*fn,FN_CLASSID,1); if (--((PetscObject)(*fn))->refct > 0) { *fn = 0; PetscFunctionReturn(0); } ierr = PetscFree((*fn)->alpha);CHKERRQ(ierr); ierr = PetscFree((*fn)->beta);CHKERRQ(ierr); ierr = PetscHeaderDestroy(fn);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNRegister" /*@C FNRegister - See Adds a mathematical function to the FN package. Not collective Input Parameters: + name - name of a new user-defined FN - function - routine to create context Notes: FNRegister() may be called multiple times to add several user-defined inner products. Level: advanced .seealso: FNRegisterAll() @*/ PetscErrorCode FNRegister(const char *name,PetscErrorCode (*function)(FN)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&FNList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } PETSC_EXTERN PetscErrorCode FNCreate_Rational(FN); PETSC_EXTERN PetscErrorCode FNCreate_Exp(FN); #undef __FUNCT__ #define __FUNCT__ "FNRegisterAll" /*@C FNRegisterAll - Registers all of the math functions in the FN package. Not Collective Level: advanced @*/ PetscErrorCode FNRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; FNRegisterAllCalled = PETSC_TRUE; ierr = FNRegister(FNRATIONAL,FNCreate_Rational);CHKERRQ(ierr); ierr = FNRegister(FNEXP,FNCreate_Exp);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/fn/fnrational.c0000644000175000017500000001164012211062077017130 0ustar gladkgladk/* Rational function r(x) = p(x)/q(x), where p(x) is a polynomial of degree na and q(x) is a polynomial of degree nb (can be 0). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcfn.h" I*/ #undef __FUNCT__ #define __FUNCT__ "FNEvaluateFunction_Rational" PetscErrorCode FNEvaluateFunction_Rational(FN fn,PetscScalar x,PetscScalar *y) { PetscInt i; PetscScalar p,q; PetscFunctionBegin; if (!fn->na) p = 1.0; else { p = fn->alpha[0]; for (i=1;ina;i++) p = fn->alpha[i]+x*p; } if (!fn->nb) *y = p; else { q = fn->beta[0]; for (i=1;inb;i++) q = fn->beta[i]+x*q; *y = p/q; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNEvaluateDerivative_Rational" PetscErrorCode FNEvaluateDerivative_Rational(FN fn,PetscScalar x,PetscScalar *yp) { PetscInt i; PetscScalar p,q,pp,qp; PetscFunctionBegin; if (!fn->na) { p = 1.0; pp = 0.0; } else { p = fn->alpha[0]; pp = 0.0; for (i=1;ina;i++) { pp = p+x*pp; p = fn->alpha[i]+x*p; } } if (!fn->nb) *yp = pp; else { q = fn->beta[0]; qp = 0.0; for (i=1;inb;i++) { qp = q+x*qp; q = fn->beta[i]+x*q; } *yp = (pp*q-p*qp)/(q*q); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNView_Rational" PetscErrorCode FNView_Rational(FN fn,PetscViewer viewer) { PetscErrorCode ierr; PetscBool isascii; PetscInt i; char str[50]; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { if (!fn->nb) { if (!fn->na) { ierr = PetscViewerASCIIPrintf(viewer," Constant: 1.0\n");CHKERRQ(ierr); } else if (fn->na==1) { ierr = SlepcSNPrintfScalar(str,50,fn->alpha[0],PETSC_FALSE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Constant: %s\n",str);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Polynomial: ");CHKERRQ(ierr); for (i=0;ina-1;i++) { ierr = SlepcSNPrintfScalar(str,50,fn->alpha[i],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->na-i-1);CHKERRQ(ierr); } ierr = SlepcSNPrintfScalar(str,50,fn->alpha[fn->na-1],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s\n",str);CHKERRQ(ierr); } } else if (!fn->na) { ierr = PetscViewerASCIIPrintf(viewer," Inverse polinomial: 1 / (");CHKERRQ(ierr); for (i=0;inb-1;i++) { ierr = SlepcSNPrintfScalar(str,50,fn->beta[i],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->nb-i-1);CHKERRQ(ierr); } ierr = SlepcSNPrintfScalar(str,50,fn->beta[fn->nb-1],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s)\n",str);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Rational function: (");CHKERRQ(ierr); for (i=0;ina-1;i++) { ierr = SlepcSNPrintfScalar(str,50,fn->alpha[i],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->na-i-1);CHKERRQ(ierr); } ierr = SlepcSNPrintfScalar(str,50,fn->alpha[fn->na-1],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s) / (",str);CHKERRQ(ierr); for (i=0;inb-1;i++) { ierr = SlepcSNPrintfScalar(str,50,fn->beta[i],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s*x^%1D",str,fn->nb-i-1);CHKERRQ(ierr); } ierr = SlepcSNPrintfScalar(str,50,fn->beta[fn->nb-1],PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s)\n",str);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "FNCreate_Rational" PETSC_EXTERN PetscErrorCode FNCreate_Rational(FN fn) { PetscFunctionBegin; fn->ops->evaluatefunction = FNEvaluateFunction_Rational; fn->ops->evaluatederivative = FNEvaluateDerivative_Rational; fn->ops->view = FNView_Rational; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/fn/ftn-auto/0000755000175000017500000000000012214143515016362 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/fn/ftn-auto/fnbasicf.c0000644000175000017500000000466512211062077020314 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* fnbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcfn.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define fnsetparameters_ FNSETPARAMETERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define fnsetparameters_ fnsetparameters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define fngetparameters_ FNGETPARAMETERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define fngetparameters_ fngetparameters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define fnevaluatefunction_ FNEVALUATEFUNCTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define fnevaluatefunction_ fnevaluatefunction #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define fnevaluatederivative_ FNEVALUATEDERIVATIVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define fnevaluatederivative_ fnevaluatederivative #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define fnsetfromoptions_ FNSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define fnsetfromoptions_ fnsetfromoptions #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL fnsetparameters_(FN *fn,PetscInt *na,PetscScalar *alpha,PetscInt *nb,PetscScalar *beta, int *__ierr ){ *__ierr = FNSetParameters(*fn,*na,alpha,*nb,beta); } void PETSC_STDCALL fngetparameters_(FN *fn,PetscInt *na,PetscScalar *alpha[],PetscInt *nb,PetscScalar *beta[], int *__ierr ){ *__ierr = FNGetParameters(*fn,na,alpha,nb,beta); } void PETSC_STDCALL fnevaluatefunction_(FN *fn,PetscScalar *x,PetscScalar *y, int *__ierr ){ *__ierr = FNEvaluateFunction(*fn,*x,y); } void PETSC_STDCALL fnevaluatederivative_(FN *fn,PetscScalar *x,PetscScalar *y, int *__ierr ){ *__ierr = FNEvaluateDerivative(*fn,*x,y); } void PETSC_STDCALL fnsetfromoptions_(FN *fn, int *__ierr ){ *__ierr = FNSetFromOptions(*fn); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/fn/ftn-auto/makefile0000644000175000017500000000032712211062077020064 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = fnbasicf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/fn/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/0000755000175000017500000000000012214143515015011 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/examples/0000755000175000017500000000000012214143515016627 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/0000755000175000017500000000000012211062077020655 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex11.c.html0000644000175000017500000002550512211062077022551 0ustar gladkgladk

Actual source code: ex11.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Computes the smallest nonzero eigenvalue of the Laplacian of a graph.\n\n"
 23:   "This example illustrates EPSSetDeflationSpace(). The example graph corresponds to a "
 24:   "2-D regular mesh. The command line options are:\n"
 25:   "  -n <n>, where <n> = number of grid subdivisions in x dimension.\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in y dimension.\n\n";

 28: #include <slepceps.h>

 32: int main (int argc,char **argv)
 33: {
 34:   EPS            eps;             /* eigenproblem solver context */
 35:   Mat            A;               /* operator matrix */
 36:   Vec            x;
 37:   EPSType        type;
 38:   PetscInt       N,n=10,m,i,j,II,Istart,Iend,nev;
 39:   PetscScalar    w;
 40:   PetscBool      flag;

 43:   SlepcInitialize(&argc,&argv,(char*)0,help);

 45:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 46:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 47:   if (!flag) m=n;
 48:   N = n*m;
 49:   PetscPrintf(PETSC_COMM_WORLD,"\nFiedler vector of a 2-D regular mesh, N=%D (%Dx%D grid)\n\n",N,n,m);

 51:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 52:      Compute the operator matrix that defines the eigensystem, Ax=kx
 53:      In this example, A = L(G), where L is the Laplacian of graph G, i.e.
 54:      Lii = degree of node i, Lij = -1 if edge (i,j) exists in G
 55:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 57:   MatCreate(PETSC_COMM_WORLD,&A);
 58:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 59:   MatSetFromOptions(A);
 60:   MatSetUp(A);

 62:   MatGetOwnershipRange(A,&Istart,&Iend);
 63:   for (II=Istart;II<Iend;II++) {
 64:     i = II/n; j = II-i*n;
 65:     w = 0.0;
 66:     if (i>0) { MatSetValue(A,II,II-n,-1.0,INSERT_VALUES); w=w+1.0; }
 67:     if (i<m-1) { MatSetValue(A,II,II+n,-1.0,INSERT_VALUES); w=w+1.0; }
 68:     if (j>0) { MatSetValue(A,II,II-1,-1.0,INSERT_VALUES); w=w+1.0; }
 69:     if (j<n-1) { MatSetValue(A,II,II+1,-1.0,INSERT_VALUES); w=w+1.0; }
 70:     MatSetValue(A,II,II,w,INSERT_VALUES);
 71:   }

 73:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 74:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 76:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 77:                 Create the eigensolver and set various options
 78:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 80:   /*
 81:      Create eigensolver context
 82:   */
 83:   EPSCreate(PETSC_COMM_WORLD,&eps);

 85:   /*
 86:      Set operators. In this case, it is a standard eigenvalue problem
 87:   */
 88:   EPSSetOperators(eps,A,NULL);
 89:   EPSSetProblemType(eps,EPS_HEP);

 91:   /*
 92:      Select portion of spectrum
 93:   */
 94:   EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);

 96:   /*
 97:      Set solver parameters at runtime
 98:   */
 99:   EPSSetFromOptions(eps);

101:   /*
102:      Attach deflation space: in this case, the matrix has a constant
103:      nullspace, [1 1 ... 1]^T is the eigenvector of the zero eigenvalue
104:   */
105:   MatGetVecs(A,&x,NULL);
106:   VecSet(x,1.0);
107:   EPSSetDeflationSpace(eps,1,&x);
108:   VecDestroy(&x);

110:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
111:                       Solve the eigensystem
112:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

114:   EPSSolve(eps);

116:   /*
117:      Optional: Get some information from the solver and display it
118:   */
119:   EPSGetType(eps,&type);
120:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
121:   EPSGetDimensions(eps,&nev,NULL,NULL);
122:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

124:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
125:                     Display solution and clean up
126:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

128:   EPSPrintSolution(eps,NULL);
129:   EPSDestroy(&eps);
130:   MatDestroy(&A);
131:   SlepcFinalize();
132:   return 0;
133: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex6f.F0000644000175000017500000002312012211062077021632 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n ex6f [-help] [-m ] [all SLEPc options] ! ! Description: This example solves the eigensystem arising in the Ising ! model for ferromagnetic materials. The file mvmisg.f must be linked ! together. Information about the model can be found at the following ! site http://math.nist.gov/MatrixMarket/data/NEP ! ! The command line options are: ! -m , where is the number of 2x2 blocks, i.e. matrix size N=2*m ! ! ---------------------------------------------------------------------- ! program main implicit none #include #include #include #include #include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! A operator matrix ! eps eigenproblem solver context Mat A EPS eps EPSType tname PetscReal tol PetscInt N, m PetscInt nev, maxit, its PetscMPIInt sz, rank PetscErrorCode ierr PetscBool flg ! This is the routine to use for matrix-free approach ! external MatIsing_Mult ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) #if defined(PETSC_USE_COMPLEX) write(*,*) 'This example requires real numbers.' goto 999 #endif call MPI_Comm_size(PETSC_COMM_WORLD,sz,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) if (sz .ne. 1) then if (rank .eq. 0) then write(*,*) 'This is a uniprocessor example only!' endif SETERRQ(PETSC_COMM_WORLD,1,' ',ierr) endif m = 30 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-m',m,flg,ierr) N = 2*m if (rank .eq. 0) then write(*,*) write(*,'(A,I6,A)') 'Ising Model Eigenproblem, m=',m,', (N=2*m)' write(*,*) endif ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Register the matrix-vector subroutine for the operator that defines ! the eigensystem, Ax=kx ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call MatCreateShell(PETSC_COMM_WORLD,N,N,N,N,PETSC_NULL_OBJECT, & & A,ierr) call MatShellSetOperation(A,MATOP_MULT,MatIsing_Mult,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the eigensolver and display info ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create eigensolver context call EPSCreate(PETSC_COMM_WORLD,eps,ierr) ! ** Set operators. In this case, it is a standard eigenvalue problem call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr) call EPSSetProblemType(eps,EPS_NHEP,ierr) ! ** Set solver parameters at runtime call EPSSetFromOptions(eps,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the eigensystem ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSSolve(eps,ierr) call EPSGetIterationNumber(eps,its,ierr) if (rank .eq. 0) then write(*,'(A,I4)') ' Number of iterations of the method: ', its endif ! ** Optional: Get some information from the solver and display it call EPSGetType(eps,tname,ierr) if (rank .eq. 0) then write(*,'(A,A)') ' Solution method: ', tname endif call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,'(A,I2)') ' Number of requested eigenvalues:', nev endif call EPSGetTolerances(eps,tol,maxit,ierr) if (rank .eq. 0) then write(*,'(A,1PE10.4,A,I6)') ' Stopping condition: tol=', tol, & & ', maxit=', maxit endif ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr) call EPSDestroy(eps,ierr) call MatDestroy(A,ierr) #if defined(PETSC_USE_COMPLEX) 999 continue #endif call SlepcFinalize(ierr) end ! ------------------------------------------------------------------- ! ! MatIsing_Mult - user provided matrix-vector multiply ! ! Input Parameters: ! A - matrix ! x - input vector ! ! Output Parameter: ! y - output vector ! subroutine MatIsing_Mult(A,x,y,ierr) implicit none #include #include #include Mat A Vec x,y PetscInt trans,one,N PetscScalar x_array(1),y_array(1) PetscOffset i_x,i_y PetscErrorCode ierr ! The actual routine for the matrix-vector product external mvmisg call MatGetSize(A,N,PETSC_NULL_INTEGER,ierr) call VecGetArray(x,x_array,i_x,ierr) call VecGetArray(y,y_array,i_y,ierr) trans = 0 one = 1 call mvmisg(trans,N,one,x_array(i_x+1),N,y_array(i_y+1),N) call VecRestoreArray(x,x_array,i_x,ierr) call VecRestoreArray(y,y_array,i_y,ierr) return end ! ------------------------------------------------------------------- ! The actual routine for the matrix-vector product ! See http://math.nist.gov/MatrixMarket/data/NEP/mvmisg/mvmisg.html SUBROUTINE MVMISG( TRANS, N, M, X, LDX, Y, LDY ) ! .. ! .. Scalar Arguments .. PetscInt LDY, LDX, M, N, TRANS ! .. ! .. Array Arguments .. PetscScalar Y( LDY, * ), X( LDX, * ) ! .. ! ! Purpose ! ======= ! ! Compute ! ! Y(:,1:M) = op(A)*X(:,1:M) ! ! where op(A) is A or A' (the transpose of A). The A is the Ising ! matrix. ! ! Arguments ! ========= ! ! TRANS (input) INTEGER ! If TRANS = 0, compute Y(:,1:M) = A*X(:,1:M) ! If TRANS = 1, compute Y(:,1:M) = A'*X(:,1:M) ! ! N (input) INTEGER ! The order of the matrix A. N has to be an even number. ! ! M (input) INTEGER ! The number of columns of X to multiply. ! ! X (input) DOUBLE PRECISION array, dimension ( LDX, M ) ! X contains the matrix (vectors) X. ! ! LDX (input) INTEGER ! The leading dimension of array X, LDX >= max( 1, N ) ! ! Y (output) DOUBLE PRECISION array, dimension (LDX, M ) ! contains the product of the matrix op(A) with X. ! ! LDY (input) INTEGER ! The leading dimension of array Y, LDY >= max( 1, N ) ! ! =================================================================== ! ! ! .. PARAMETERS .. PetscReal PI PARAMETER ( PI = 3.141592653589793D+00 ) PetscReal ALPHA, BETA PARAMETER ( ALPHA = PI/4, BETA = PI/4 ) ! ! .. Local Variables .. PetscInt I, K PetscReal COSA, COSB, SINA PetscReal SINB, TEMP, TEMP1 ! ! .. Intrinsic functions .. INTRINSIC COS, SIN ! COSA = COS( ALPHA ) SINA = SIN( ALPHA ) COSB = COS( BETA ) SINB = SIN( BETA ) ! IF ( TRANS.EQ.0 ) THEN ! ! Compute Y(:,1:M) = A*X(:,1:M) DO 30 K = 1, M ! Y( 1, K ) = COSB*X( 1, K ) - SINB*X( N, K ) DO 10 I = 2, N-1, 2 Y( I, K ) = COSB*X( I, K ) + SINB*X( I+1, K ) Y( I+1, K ) = -SINB*X( I, K ) + COSB*X( I+1, K ) 10 CONTINUE Y( N, K ) = SINB*X( 1, K ) + COSB*X( N, K ) ! DO 20 I = 1, N, 2 TEMP = COSA*Y( I, K ) + SINA*Y( I+1, K ) Y( I+1, K ) = -SINA*Y( I, K ) + COSA*Y( I+1, K ) Y( I, K ) = TEMP 20 CONTINUE ! 30 CONTINUE ! ELSE IF ( TRANS.EQ.1 ) THEN ! ! Compute Y(:1:M) = A'*X(:,1:M) ! DO 60 K = 1, M ! DO 40 I = 1, N, 2 Y( I, K ) = COSA*X( I, K ) - SINA*X( I+1, K ) Y( I+1, K ) = SINA*X( I, K ) + COSA*X( I+1, K ) 40 CONTINUE TEMP = COSB*Y(1,K) + SINB*Y(N,K) DO 50 I = 2, N-1, 2 TEMP1 = COSB*Y( I, K ) - SINB*Y( I+1, K ) Y( I+1, K ) = SINB*Y( I, K ) + COSB*Y( I+1, K ) Y( I, K ) = TEMP1 50 CONTINUE Y( N, K ) = -SINB*Y( 1, K ) + COSB*Y( N, K ) Y( 1, K ) = TEMP ! 60 CONTINUE ! END IF ! RETURN ! ! END OF MVMISG END slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex1.c.html0000644000175000017500000003240512211062077022465 0ustar gladkgladk
Actual source code: ex1.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Standard symmetric eigenproblem corresponding to the Laplacian operator in 1 dimension.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions = matrix dimension.\n\n";

 26: #include <slepceps.h>

 30: int main(int argc,char **argv)
 31: {
 32:   Mat            A;           /* problem matrix */
 33:   EPS            eps;         /* eigenproblem solver context */
 34:   EPSType        type;
 35:   PetscReal      error,tol,re,im;
 36:   PetscScalar    kr,ki,value[3];
 37:   Vec            xr,xi;
 38:   PetscInt       n=30,i,Istart,Iend,col[3],nev,maxit,its,nconv;
 39:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

 42:   SlepcInitialize(&argc,&argv,(char*)0,help);

 44:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 45:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);

 47:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 48:      Compute the operator matrix that defines the eigensystem, Ax=kx
 49:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 51:   MatCreate(PETSC_COMM_WORLD,&A);
 52:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 53:   MatSetFromOptions(A);
 54:   MatSetUp(A);

 56:   MatGetOwnershipRange(A,&Istart,&Iend);
 57:   if (Istart==0) FirstBlock=PETSC_TRUE;
 58:   if (Iend==n) LastBlock=PETSC_TRUE;
 59:   value[0]=-1.0; value[1]=2.0; value[2]=-1.0;
 60:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 61:     col[0]=i-1; col[1]=i; col[2]=i+1;
 62:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 63:   }
 64:   if (LastBlock) {
 65:     i=n-1; col[0]=n-2; col[1]=n-1;
 66:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 67:   }
 68:   if (FirstBlock) {
 69:     i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0;
 70:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 71:   }

 73:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 74:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 76:   MatGetVecs(A,NULL,&xr);
 77:   MatGetVecs(A,NULL,&xi);

 79:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 80:                 Create the eigensolver and set various options
 81:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 82:   /*
 83:      Create eigensolver context
 84:   */
 85:   EPSCreate(PETSC_COMM_WORLD,&eps);

 87:   /*
 88:      Set operators. In this case, it is a standard eigenvalue problem
 89:   */
 90:   EPSSetOperators(eps,A,NULL);
 91:   EPSSetProblemType(eps,EPS_HEP);

 93:   /*
 94:      Set solver parameters at runtime
 95:   */
 96:   EPSSetFromOptions(eps);

 98:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 99:                       Solve the eigensystem
100:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

102:   EPSSolve(eps);
103:   /*
104:      Optional: Get some information from the solver and display it
105:   */
106:   EPSGetIterationNumber(eps,&its);
107:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);
108:   EPSGetType(eps,&type);
109:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
110:   EPSGetDimensions(eps,&nev,NULL,NULL);
111:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
112:   EPSGetTolerances(eps,&tol,&maxit);
113:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

115:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116:                     Display solution and clean up
117:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
118:   /*
119:      Get number of converged approximate eigenpairs
120:   */
121:   EPSGetConverged(eps,&nconv);
122:   PetscPrintf(PETSC_COMM_WORLD," Number of converged eigenpairs: %D\n\n",nconv);

124:   if (nconv>0) {
125:     /*
126:        Display eigenvalues and relative errors
127:     */
128:     PetscPrintf(PETSC_COMM_WORLD,
129:          "           k          ||Ax-kx||/||kx||\n"
130:          "   ----------------- ------------------\n");

132:     for (i=0;i<nconv;i++) {
133:       /*
134:         Get converged eigenpairs: i-th eigenvalue is stored in kr (real part) and
135:         ki (imaginary part)
136:       */
137:       EPSGetEigenpair(eps,i,&kr,&ki,xr,xi);
138:       /*
139:          Compute the relative error associated to each eigenpair
140:       */
141:       EPSComputeRelativeError(eps,i,&error);

143: #if defined(PETSC_USE_COMPLEX)
144:       re = PetscRealPart(kr);
145:       im = PetscImaginaryPart(kr);
146: #else
147:       re = kr;
148:       im = ki;
149: #endif
150:       if (im!=0.0) {
151:         PetscPrintf(PETSC_COMM_WORLD," %9F%+9F j %12G\n",re,im,error);
152:       } else {
153:         PetscPrintf(PETSC_COMM_WORLD,"   %12F       %12G\n",re,error);
154:       }
155:     }
156:     PetscPrintf(PETSC_COMM_WORLD,"\n");
157:   }

159:   /*
160:      Free work space
161:   */
162:   EPSDestroy(&eps);
163:   MatDestroy(&A);
164:   VecDestroy(&xr);
165:   VecDestroy(&xi);
166:   SlepcFinalize();
167:   return 0;
168: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/0000755000175000017500000000000012211062077022215 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex6f_1.out0000644000175000017500000000064012211062077024036 0ustar gladkgladk Ising Model Eigenproblem, m= 30, (N=2*m) Number of iterations of the method: 12 Solution method: krylovschur Number of requested eigenvalues: 4 Stopping condition: tol=1.0000E-05, maxit= 1000 All requested eigenvalues computed up to the required tolerance: 0.00000+1.00000i, 0.00000-1.00000i, 0.01093+0.99994i, 0.01093-0.99994i slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex9_1.out0000644000175000017500000000036312211062077023675 0ustar gladkgladk Brusselator wave model, n=30 Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.00019+2.13938i, 0.00019-2.13938i, -0.67192+2.52712i, -0.67192-2.52712i slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex1_1.out0000644000175000017500000000051612211062077023665 0ustar gladkgladk 1-D Laplacian Eigenproblem, n=30 Number of iterations of the method: 4 Solution method: krylovschur Number of requested eigenvalues: 1 Stopping condition: tol=1e-08, maxit=100 Number of converged eigenpairs: 1 k ||Ax-kx||/||kx|| ----------------- ------------------ 3.989739 4.72989e-09 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex18_1.out0000644000175000017500000000037612211062077023761 0ustar gladkgladk Markov Model, N=120 (m=15) Searching closest eigenvalues to the right of 0.5. Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.57028, 0.57143, 0.63056, 0.70232 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex1f90_1.out0000644000175000017500000000044312211062077024203 0ustar gladkgladk 1-D Laplacian Eigenproblem, n = 30 (Fortran) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex4_1.out0000644000175000017500000000052112211062077023664 0ustar gladkgladk Eigenproblem stored in file. Reading REAL matrix from a binary file... Number of iterations of the method: 5 Solution method: krylovschur Number of requested eigenvalues: 4 Stopping condition: tol=1e-08, maxit=100 All requested eigenvalues computed up to the required tolerance: -35.00752, -34.10419, -33.20131, -32.68111 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex3_1.out0000644000175000017500000000036512211062077023671 0ustar gladkgladk 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.36501, 7.22871 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex13_1.out0000644000175000017500000000036212211062077023747 0ustar gladkgladk Generalized Symmetric Eigenproblem, N=100 (10x10 grid), null(B)=0 Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.04051, 0.09963, 0.15875, 0.19282 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex12_1.out0000644000175000017500000000117412211062077023750 0ustar gladkgladk Markov Model, N=120 (m=15) Number of iterations of the method: 775 Solution method: power Number of requested eigenvalues: 2 Stopping condition: tol=1e-08, maxit=12000 Number of converged approximate eigenpairs: 2 k ||Ax-kx||/||kx|| ||y'A-ky'||/||ky|| ----------------- ------------------ -------------------- 1.000000 1.19735e-08 9.5169e-11 0.971367 2.41471e-09 4.05933e-08 Bi-orthogonality --------------------------------------------------------- 1 -5.66583e-09 -9.03744e-08 1 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex11_1.out0000644000175000017500000000035112211062077023743 0ustar gladkgladk Fiedler vector of a 2-D regular mesh, N=100 (10x10 grid) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.09789, 0.19577, 0.38197, 0.47985 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex2_1.out0000644000175000017500000000033712211062077023667 0ustar gladkgladk 2-D Laplacian Eigenproblem, N=100 (10x10 grid) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.36501, 7.22871 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex1f_1.out0000644000175000017500000000064412211062077024035 0ustar gladkgladk 1-D Laplacian Eigenproblem, n = 30 (Fortran) Number of iterations of the method: 4 Solution method: krylovschur Number of requested eigenvalues: 1 Stopping condition: tol=1.0000E-08, maxit= 100 Number of converged eigenpairs: 1 k ||Ax-kx||/||kx|| ----------------- ------------------ 3.9897E+00 4.7299E-09 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex19_1.out0000644000175000017500000000207612211062077023761 0ustar gladkgladk 3-D Laplacian Eigenproblem Grid partitioning: 1 1 1 Number of iterations of the method: 6 Solution method: krylovschur Number of requested eigenvalues: 8 Stopping condition: tol=1e-08, maxit=100 Number of converged approximate eigenpairs: 13 k ||Ax-kx||/||kx|| Eigenvalue Error ----------------- ------------------ ------------------ 0.243042 3.34915e-14 4.16334e-16 0.479521 5.58182e-13 4.21885e-15 0.479521 1.74895e-10 1.11022e-15 0.479521 3.70078e-12 1.88738e-15 0.716 1.699e-14 1.9984e-15 0.716 7.07904e-09 2.88658e-15 0.716 1.06562e-11 3.66374e-15 0.852307 1.37067e-10 2.10942e-15 0.852307 9.35032e-15 1.55431e-15 0.852307 1.34629e-12 3.21965e-15 0.952479 9.9195e-15 1.55431e-15 1.08879 8.90745e-13 2.44249e-15 1.08879 1.18168e-09 6.66134e-16 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex7_1.out0000644000175000017500000000066512211062077023700 0ustar gladkgladk Generalized eigenproblem stored in file. Reading REAL matrices from binary files... Number of iterations of the method: 4 Number of linear iterations of the method: 46 Solution method: krylovschur Number of requested eigenvalues: 4 Stopping condition: tol=1e-08, maxit=100 All requested eigenvalues computed up to the required tolerance: -243874.97870+6999.66927i, -243874.97870-6999.66927i, -212991.49278, -199807.74659 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/output/ex5_1.out0000644000175000017500000000031512211062077023666 0ustar gladkgladk Markov Model, N=120 (m=15) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 1.00000, -1.00000, -0.90423, 0.90423 slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex3.c.html0000644000175000017500000003245412211062077022473 0ustar gladkgladk
Actual source code: ex3.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves the same eigenproblem as in example ex2, but using a shell matrix. "
 23:   "The problem is a standard symmetric eigenproblem corresponding to the 2-D Laplacian operator.\n\n"
 24:   "The command line options are:\n"
 25:   "  -n <n>, where <n> = number of grid subdivisions in both x and y dimensions.\n\n";

 27: #include <slepceps.h>
 28: #include <petscblaslapack.h>

 30: /*
 31:    User-defined routines
 32: */
 33: PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y);
 34: PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag);

 38: int main(int argc,char **argv)
 39: {
 40:   Mat            A;               /* operator matrix */
 41:   EPS            eps;             /* eigenproblem solver context */
 42:   EPSType        type;
 43:   PetscMPIInt    size;
 44:   PetscInt       N,n=10,nev;

 47:   SlepcInitialize(&argc,&argv,(char*)0,help);
 48:   MPI_Comm_size(PETSC_COMM_WORLD,&size);
 49:   if (size != 1) SETERRQ(PETSC_COMM_WORLD,1,"This is a uniprocessor example only");

 51:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 52:   N = n*n;
 53:   PetscPrintf(PETSC_COMM_WORLD,"\n2-D Laplacian Eigenproblem (matrix-free version), N=%D (%Dx%D grid)\n\n",N,n,n);

 55:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 56:      Compute the operator matrix that defines the eigensystem, Ax=kx
 57:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 59:   MatCreateShell(PETSC_COMM_WORLD,N,N,N,N,&n,&A);
 60:   MatSetFromOptions(A);
 61:   MatShellSetOperation(A,MATOP_MULT,(void(*)())MatMult_Laplacian2D);
 62:   MatShellSetOperation(A,MATOP_MULT_TRANSPOSE,(void(*)())MatMult_Laplacian2D);
 63:   MatShellSetOperation(A,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Laplacian2D);

 65:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 66:                 Create the eigensolver and set various options
 67:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 69:   /*
 70:      Create eigensolver context
 71:   */
 72:   EPSCreate(PETSC_COMM_WORLD,&eps);

 74:   /*
 75:      Set operators. In this case, it is a standard eigenvalue problem
 76:   */
 77:   EPSSetOperators(eps,A,NULL);
 78:   EPSSetProblemType(eps,EPS_HEP);

 80:   /*
 81:      Set solver parameters at runtime
 82:   */
 83:   EPSSetFromOptions(eps);

 85:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 86:                       Solve the eigensystem
 87:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 89:   EPSSolve(eps);

 91:   /*
 92:      Optional: Get some information from the solver and display it
 93:   */
 94:   EPSGetType(eps,&type);
 95:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
 96:   EPSGetDimensions(eps,&nev,NULL,NULL);
 97:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

 99:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100:                     Display solution and clean up
101:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

103:   EPSPrintSolution(eps,NULL);
104:   EPSDestroy(&eps);
105:   MatDestroy(&A);
106:   SlepcFinalize();
107:   return 0;
108: }

110: /*
111:     Compute the matrix vector multiplication y<---T*x where T is a nx by nx
112:     tridiagonal matrix with DD on the diagonal, DL on the subdiagonal, and
113:     DU on the superdiagonal.
114:  */
115: static void tv(int nx,const PetscScalar *x,PetscScalar *y)
116: {
117:   PetscScalar dd,dl,du;
118:   int         j;

120:   dd  = 4.0;
121:   dl  = -1.0;
122:   du  = -1.0;

124:   y[0] =  dd*x[0] + du*x[1];
125:   for (j=1;j<nx-1;j++)
126:     y[j] = dl*x[j-1] + dd*x[j] + du*x[j+1];
127:   y[nx-1] = dl*x[nx-2] + dd*x[nx-1];
128: }

132: /*
133:     Matrix-vector product subroutine for the 2D Laplacian.

135:     The matrix used is the 2 dimensional discrete Laplacian on unit square with
136:     zero Dirichlet boundary condition.

138:     Computes y <-- A*x, where A is the block tridiagonal matrix

140:                  | T -I          |
141:                  |-I  T -I       |
142:              A = |   -I  T       |
143:                  |        ...  -I|
144:                  |           -I T|

146:     The subroutine TV is called to compute y<--T*x.
147:  */
148: PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y)
149: {
150:   void              *ctx;
151:   int               nx,lo,i,j;
152:   const PetscScalar *px;
153:   PetscScalar       *py;
154:   PetscErrorCode    ierr;

157:   MatShellGetContext(A,&ctx);
158:   nx = *(int*)ctx;
159:   VecGetArrayRead(x,&px);
160:   VecGetArray(y,&py);

162:   tv(nx,&px[0],&py[0]);
163:   for (i=0;i<nx;i++) py[i] -= px[nx+i];

165:   for (j=2;j<nx;j++) {
166:     lo = (j-1)*nx;
167:     tv(nx,&px[lo],&py[lo]);
168:     for (i=0;i<nx;i++) py[lo+i] -= px[lo-nx+i] + px[lo+nx+i];
169:   }

171:   lo = (nx-1)*nx;
172:   tv(nx,&px[lo],&py[lo]);
173:   for (i=0;i<nx;i++) py[lo+i] -= px[lo-nx+i];

175:   VecRestoreArrayRead(x,&px);
176:   VecRestoreArray(y,&py);
177:   return(0);
178: }

182: PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag)
183: {

187:   VecSet(diag,4.0);
188:   return(0);
189: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex6f.F.html0000644000175000017500000004710112211062077022602 0ustar gladkgladk
Actual source code: ex6f.F

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n ex6f [-help] [-m <m>] [all SLEPc options]
 21: !
 22: !  Description: This example solves the eigensystem arising in the Ising
 23: !  model for ferromagnetic materials. The file mvmisg.f must be linked
 24: !  together. Information about the model can be found at the following
 25: !  site http://math.nist.gov/MatrixMarket/data/NEP
 26: !
 27: !  The command line options are:
 28: !    -m <m>, where <m> is the number of 2x2 blocks, i.e. matrix size N=2*m
 29: !
 30: ! ----------------------------------------------------------------------
 31: !
 32:       program main
 33:       implicit none

 35: #include <finclude/petscsys.h>
 36: #include <finclude/petscvec.h>
 37: #include <finclude/petscmat.h>
 38: #include <finclude/slepcsys.h>
 39: #include <finclude/slepceps.h>

 41: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 42: !     Declarations
 43: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 44: !
 45: !  Variables:
 46: !     A     operator matrix
 47: !     eps   eigenproblem solver context

 49:       Mat            A
 50:       EPS            eps
 51:       EPSType        tname
 52:       PetscReal      tol
 53:       PetscInt       N, m
 54:       PetscInt       nev, maxit, its
 55:       PetscMPIInt    sz, rank
 56:       PetscErrorCode ierr
 57:       PetscBool      flg

 59: !     This is the routine to use for matrix-free approach
 60: !
 61:       external MatIsing_Mult

 63: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 64: !     Beginning of program
 65: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 67:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 68: #if defined(PETSC_USE_COMPLEX)
 69:       write(*,*) 'This example requires real numbers.'
 70:       goto 999
 71: #endif
 72:       call MPI_Comm_size(PETSC_COMM_WORLD,sz,ierr)
 73:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 74:       if (sz .ne. 1) then
 75:          if (rank .eq. 0) then
 76:             write(*,*) 'This is a uniprocessor example only!'
 77:          endif
 78:          SETERRQ(PETSC_COMM_WORLD,1,' ',ierr)
 79:       endif
 80:       m = 30
 81:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-m',m,flg,ierr)
 82:       N = 2*m

 84:       if (rank .eq. 0) then
 85:         write(*,*)
 86:         write(*,'(A,I6,A)') 'Ising Model Eigenproblem, m=',m,', (N=2*m)'
 87:         write(*,*)
 88:       endif

 90: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 91: !     Register the matrix-vector subroutine for the operator that defines
 92: !     the eigensystem, Ax=kx
 93: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 95:       call MatCreateShell(PETSC_COMM_WORLD,N,N,N,N,PETSC_NULL_OBJECT,   &
 96:      &                    A,ierr)
 97:       call MatShellSetOperation(A,MATOP_MULT,MatIsing_Mult,ierr)

 99: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100: !     Create the eigensolver and display info
101: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

103: !     ** Create eigensolver context
104:       call EPSCreate(PETSC_COMM_WORLD,eps,ierr)

106: !     ** Set operators. In this case, it is a standard eigenvalue problem
107:       call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr)
108:       call EPSSetProblemType(eps,EPS_NHEP,ierr)

110: !     ** Set solver parameters at runtime
111:       call EPSSetFromOptions(eps,ierr)

113: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
114: !     Solve the eigensystem
115: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

117:       call EPSSolve(eps,ierr)
118:       call EPSGetIterationNumber(eps,its,ierr)
119:       if (rank .eq. 0) then
120:         write(*,'(A,I4)') ' Number of iterations of the method: ', its
121:       endif

123: !     ** Optional: Get some information from the solver and display it
124:       call EPSGetType(eps,tname,ierr)
125:       if (rank .eq. 0) then
126:         write(*,'(A,A)') ' Solution method: ', tname
127:       endif
128:       call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER,                 &
129:      &                      PETSC_NULL_INTEGER,ierr)
130:       if (rank .eq. 0) then
131:         write(*,'(A,I2)') ' Number of requested eigenvalues:', nev
132:       endif
133:       call EPSGetTolerances(eps,tol,maxit,ierr)
134:       if (rank .eq. 0) then
135:         write(*,'(A,1PE10.4,A,I6)') ' Stopping condition: tol=', tol,   &
136:      &                              ', maxit=', maxit
137:       endif

139: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
140: !     Display solution and clean up
141: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

143:       call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr)
144:       call EPSDestroy(eps,ierr)
145:       call MatDestroy(A,ierr)

147: #if defined(PETSC_USE_COMPLEX)
148:  999  continue
149: #endif
150:       call SlepcFinalize(ierr)
151:       end

153: ! -------------------------------------------------------------------
154: !
155: !   MatIsing_Mult - user provided matrix-vector multiply
156: !
157: !   Input Parameters:
158: !   A - matrix
159: !   x - input vector
160: !
161: !   Output Parameter:
162: !   y - output vector
163: !
164:       subroutine MatIsing_Mult(A,x,y,ierr)
165:       implicit none

167: #include <finclude/petscsys.h>
168: #include <finclude/petscvec.h>
169: #include <finclude/petscmat.h>

171:       Mat            A
172:       Vec            x,y
173:       PetscInt       trans,one,N
174:       PetscScalar    x_array(1),y_array(1)
175:       PetscOffset    i_x,i_y
176:       PetscErrorCode ierr

178: !     The actual routine for the matrix-vector product
179:       external mvmisg

181:       call MatGetSize(A,N,PETSC_NULL_INTEGER,ierr)
182:       call VecGetArray(x,x_array,i_x,ierr)
183:       call VecGetArray(y,y_array,i_y,ierr)

185:       trans = 0
186:       one = 1
187:       call mvmisg(trans,N,one,x_array(i_x+1),N,y_array(i_y+1),N)

189:       call VecRestoreArray(x,x_array,i_x,ierr)
190:       call VecRestoreArray(y,y_array,i_y,ierr)

192:       return
193:       end

195: ! -------------------------------------------------------------------
196: !     The actual routine for the matrix-vector product
197: !     See http://math.nist.gov/MatrixMarket/data/NEP/mvmisg/mvmisg.html

199:       SUBROUTINE MVMISG( TRANS, N, M, X, LDX, Y, LDY )
200: !     ..
201: !     .. Scalar Arguments ..
202:       PetscInt     LDY, LDX, M, N, TRANS
203: !     ..
204: !     .. Array Arguments ..
205:       PetscScalar  Y( LDY, * ), X( LDX, * )
206: !     ..
207: !
208: !  Purpose
209: !  =======
210: !
211: !  Compute
212: !
213: !               Y(:,1:M) = op(A)*X(:,1:M)
214: !
215: !  where op(A) is A or A' (the transpose of A). The A is the Ising
216: !  matrix.
217: !
218: !  Arguments
219: !  =========
220: !
221: !  TRANS   (input) INTEGER
222: !          If TRANS = 0, compute Y(:,1:M) = A*X(:,1:M)
223: !          If TRANS = 1, compute Y(:,1:M) = A'*X(:,1:M)
224: !
225: !  N       (input) INTEGER
226: !          The order of the matrix A. N has to be an even number.
227: !
228: !  M       (input) INTEGER
229: !          The number of columns of X to multiply.
230: !
231: !  X       (input) DOUBLE PRECISION array, dimension ( LDX, M )
232: !          X contains the matrix (vectors) X.
233: !
234: !  LDX     (input) INTEGER
235: !          The leading dimension of array X, LDX >= max( 1, N )
236: !
237: !  Y       (output) DOUBLE PRECISION array, dimension (LDX, M )
238: !          contains the product of the matrix op(A) with X.
239: !
240: !  LDY     (input) INTEGER
241: !          The leading dimension of array Y, LDY >= max( 1, N )
242: !
243: !  ===================================================================
244: !
245: !
246: !     .. PARAMETERS ..
247:       PetscReal   PI
248:       PARAMETER   ( PI = 3.141592653589793D+00 )
249:       PetscReal   ALPHA, BETA
250:       PARAMETER   ( ALPHA = PI/4, BETA = PI/4 )
251: !
252: !     .. Local Variables ..
253:       PetscInt    I, K
254:       PetscReal   COSA, COSB, SINA
255:       PetscReal   SINB, TEMP, TEMP1
256: !
257: !     .. Intrinsic functions ..
258:       INTRINSIC   COS, SIN
259: !
260:       COSA = COS( ALPHA )
261:       SINA = SIN( ALPHA )
262:       COSB = COS( BETA )
263:       SINB = SIN( BETA )
264: !
265:       IF ( TRANS.EQ.0 ) THEN
266: !
267: !     Compute Y(:,1:M) = A*X(:,1:M)

269:          DO 30 K = 1, M
270: !
271:             Y( 1, K ) = COSB*X( 1, K ) - SINB*X( N, K )
272:             DO 10 I = 2, N-1, 2
273:                Y( I, K )   =  COSB*X( I, K ) + SINB*X( I+1, K )
274:                Y( I+1, K ) = -SINB*X( I, K ) + COSB*X( I+1, K )
275:    10       CONTINUE
276:             Y( N, K ) = SINB*X( 1, K ) + COSB*X( N, K )
277: !
278:             DO 20 I = 1, N, 2
279:                TEMP        =  COSA*Y( I, K ) + SINA*Y( I+1, K )
280:                Y( I+1, K ) = -SINA*Y( I, K ) + COSA*Y( I+1, K )
281:                Y( I, K )   = TEMP
282:    20       CONTINUE
283: !
284:    30    CONTINUE
285: !
286:       ELSE IF ( TRANS.EQ.1 ) THEN
287: !
288: !        Compute Y(:1:M) = A'*X(:,1:M)
289: !
290:          DO 60 K = 1, M
291: !
292:             DO 40 I = 1, N, 2
293:                Y( I, K )   =  COSA*X( I, K ) - SINA*X( I+1, K )
294:                Y( I+1, K ) =  SINA*X( I, K ) + COSA*X( I+1, K )
295:    40       CONTINUE
296:             TEMP  = COSB*Y(1,K) + SINB*Y(N,K)
297:             DO 50 I = 2, N-1, 2
298:                TEMP1       =  COSB*Y( I, K ) - SINB*Y( I+1, K )
299:                Y( I+1, K ) =  SINB*Y( I, K ) + COSB*Y( I+1, K )
300:                Y( I, K )   =  TEMP1
301:    50       CONTINUE
302:             Y( N, K ) = -SINB*Y( 1, K ) + COSB*Y( N, K )
303:             Y( 1, K ) = TEMP
304: !
305:    60    CONTINUE
306: !
307:       END IF
308: !
309:       RETURN
310: !
311: !     END OF MVMISG
312:       END
slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex1f.F.html0000644000175000017500000003370212211062077022577 0ustar gladkgladk
Actual source code: ex1f.F

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n ex1f [-help] [-n <n>] [all SLEPc options]
 21: !
 22: !  Description: Simple example that solves an eigensystem with the EPS object.
 23: !  The standard symmetric eigenvalue problem to be solved corresponds to the
 24: !  Laplacian operator in 1 dimension.
 25: !
 26: !  The command line options are:
 27: !    -n <n>, where <n> = number of grid points = matrix size
 28: !
 29: ! ----------------------------------------------------------------------
 30: !
 31:       program main
 32:       implicit none

 34: #include <finclude/petscsys.h>
 35: #include <finclude/petscvec.h>
 36: #include <finclude/petscmat.h>
 37: #include <finclude/slepcsys.h>
 38: #include <finclude/slepceps.h>

 40: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 41: !     Declarations
 42: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 43: !
 44: !  Variables:
 45: !     A     operator matrix
 46: !     eps   eigenproblem solver context

 48:       Mat            A
 49:       EPS            eps
 50:       EPSType        tname
 51:       PetscReal      tol, error
 52:       PetscScalar    kr, ki
 53:       PetscInt       n, i, Istart, Iend
 54:       PetscInt       nev, maxit, its, nconv
 55:       PetscInt       col(3)
 56:       PetscInt       i1,i2,i3
 57:       PetscMPIInt    rank
 58:       PetscErrorCode ierr
 59:       PetscBool      flg
 60:       PetscScalar    value(3)

 62: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 63: !     Beginning of program
 64: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 66:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 67:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 68:       n = 30
 69:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)

 71:       if (rank .eq. 0) then
 72:         write(*,100) n
 73:       endif
 74:  100  format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')

 76: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 77: !     Compute the operator matrix that defines the eigensystem, Ax=kx
 78: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 80:       call MatCreate(PETSC_COMM_WORLD,A,ierr)
 81:       call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr)
 82:       call MatSetFromOptions(A,ierr)
 83:       call MatSetUp(A,ierr)

 85:       i1 = 1
 86:       i2 = 2
 87:       i3 = 3
 88:       call MatGetOwnershipRange(A,Istart,Iend,ierr)
 89:       if (Istart .eq. 0) then
 90:         i = 0
 91:         col(1) = 0
 92:         col(2) = 1
 93:         value(1) =  2.0
 94:         value(2) = -1.0
 95:         call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr)
 96:         Istart = Istart+1
 97:       endif
 98:       if (Iend .eq. n) then
 99:         i = n-1
100:         col(1) = n-2
101:         col(2) = n-1
102:         value(1) = -1.0
103:         value(2) =  2.0
104:         call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr)
105:         Iend = Iend-1
106:       endif
107:       value(1) = -1.0
108:       value(2) =  2.0
109:       value(3) = -1.0
110:       do i=Istart,Iend-1
111:         col(1) = i-1
112:         col(2) = i
113:         col(3) = i+1
114:         call MatSetValues(A,i1,i,i3,col,value,INSERT_VALUES,ierr)
115:       enddo

117:       call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)
118:       call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)

120: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
121: !     Create the eigensolver and display info
122: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

124: !     ** Create eigensolver context
125:       call EPSCreate(PETSC_COMM_WORLD,eps,ierr)

127: !     ** Set operators. In this case, it is a standard eigenvalue problem
128:       call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr)
129:       call EPSSetProblemType(eps,EPS_HEP,ierr)

131: !     ** Set solver parameters at runtime
132:       call EPSSetFromOptions(eps,ierr)

134: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135: !     Solve the eigensystem
136: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

138:       call EPSSolve(eps,ierr)
139:       call EPSGetIterationNumber(eps,its,ierr)
140:       if (rank .eq. 0) then
141:         write(*,110) its
142:       endif
143:  110  format (/' Number of iterations of the method:',I4)

145: !     ** Optional: Get some information from the solver and display it
146:       call EPSGetType(eps,tname,ierr)
147:       if (rank .eq. 0) then
148:         write(*,120) tname
149:       endif
150:  120  format (' Solution method: ',A)
151:       call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER,                 &
152:      &                      PETSC_NULL_INTEGER,ierr)
153:       if (rank .eq. 0) then
154:         write(*,130) nev
155:       endif
156:  130  format (' Number of requested eigenvalues:',I2)
157:       call EPSGetTolerances(eps,tol,maxit,ierr)
158:       if (rank .eq. 0) then
159:         write(*,140) tol, maxit
160:       endif
161:  140  format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)

163: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
164: !     Display solution and clean up
165: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

167: !     ** Get number of converged eigenpairs
168:       call EPSGetConverged(eps,nconv,ierr)
169:       if (rank .eq. 0) then
170:         write(*,150) nconv
171:       endif
172:  150  format (' Number of converged eigenpairs:',I2/)

174: !     ** Display eigenvalues and relative errors
175:       if (nconv.gt.0) then
176:         if (rank .eq. 0) then
177:           write(*,*) '         k          ||Ax-kx||/||kx||'
178:           write(*,*) ' ----------------- ------------------'
179:         endif
180:         do i=0,nconv-1
181: !         ** Get converged eigenpairs: i-th eigenvalue is stored in kr
182: !         ** (real part) and ki (imaginary part)
183:           call EPSGetEigenpair(eps,i,kr,ki,PETSC_NULL_OBJECT,           &
184:      &                         PETSC_NULL_OBJECT,ierr)

186: !         ** Compute the relative error associated to each eigenpair
187:           call EPSComputeRelativeError(eps,i,error,ierr)
188:           if (rank .eq. 0) then
189:             write(*,160) PetscRealPart(kr), error
190:           endif
191:  160      format (1P,'   ',E12.4,'       ',E12.4)

193:         enddo
194:         if (rank .eq. 0) then
195:           write(*,*)
196:         endif
197:       endif

199: !     ** Free work space
200:       call EPSDestroy(eps,ierr)
201:       call MatDestroy(A,ierr)

203:       call SlepcFinalize(ierr)
204:       end

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex1.c0000644000175000017500000001434112211062077021521 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Standard symmetric eigenproblem corresponding to the Laplacian operator in 1 dimension.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions = matrix dimension.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* problem matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal error,tol,re,im; PetscScalar kr,ki,value[3]; Vec xr,xi; PetscInt n=30,i,Istart,Iend,col[3],nev,maxit,its,nconv; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatGetVecs(A,NULL,&xr);CHKERRQ(ierr); ierr = MatGetVecs(A,NULL,&xi);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetIterationNumber(eps,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);CHKERRQ(ierr); ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); ierr = EPSGetTolerances(eps,&tol,&maxit);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Get number of converged approximate eigenpairs */ ierr = EPSGetConverged(eps,&nconv);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of converged eigenpairs: %D\n\n",nconv);CHKERRQ(ierr); if (nconv>0) { /* Display eigenvalues and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " k ||Ax-kx||/||kx||\n" " ----------------- ------------------\n");CHKERRQ(ierr); for (i=0;i. ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n ex1f90 [-help] [-n ] [all SLEPc options] ! ! Description: Simple example that solves an eigensystem with the EPS object. ! The standard symmetric eigenvalue problem to be solved corresponds to the ! Laplacian operator in 1 dimension. ! ! The command line options are: ! -n , where = number of grid points = matrix size ! ! ---------------------------------------------------------------------- ! program main #include use slepceps implicit none ! For usage without modules, uncomment the following lines and remove ! the previous lines between 'program main' and 'implicit none' ! !#include !#include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! A operator matrix ! solver eigenproblem solver context #if defined(PETSC_USE_FORTRAN_DATATYPES) type(Mat) A type(EPS) solver #else Mat A EPS solver #endif EPSType tname PetscInt n, i, Istart, Iend, one, two, three PetscInt nev PetscInt row(1), col(3) PetscMPIInt rank PetscErrorCode ierr PetscBool flg PetscScalar value(3) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - one = 1 two = 2 three = 3 call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) n = 30 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr) if (rank .eq. 0) then write(*,100) n endif 100 format (/'1-D Laplacian Eigenproblem, n =',I4,' (Fortran)') ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Compute the operator matrix that defines the eigensystem, Ax=kx ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call MatCreate(PETSC_COMM_WORLD,A,ierr) call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr) call MatSetFromOptions(A,ierr) call MatSetUp(A,ierr) call MatGetOwnershipRange(A,Istart,Iend,ierr) if (Istart .eq. 0) then row(1) = 0 col(1) = 0 col(2) = 1 value(1) = 2.0 value(2) = -1.0 call MatSetValues(A,one,row,two,col,value,INSERT_VALUES,ierr) Istart = Istart+1 endif if (Iend .eq. n) then row(1) = n-1 col(1) = n-2 col(2) = n-1 value(1) = -1.0 value(2) = 2.0 call MatSetValues(A,one,row,two,col,value,INSERT_VALUES,ierr) Iend = Iend-1 endif value(1) = -1.0 value(2) = 2.0 value(3) = -1.0 do i=Istart,Iend-1 row(1) = i col(1) = i-1 col(2) = i col(3) = i+1 call MatSetValues(A,one,row,three,col,value,INSERT_VALUES,ierr) enddo call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the eigensolver and display info ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create eigensolver context call EPSCreate(PETSC_COMM_WORLD,solver,ierr) ! ** Set operators. In this case, it is a standard eigenvalue problem call EPSSetOperators(solver,A,PETSC_NULL_OBJECT,ierr) call EPSSetProblemType(solver,EPS_HEP,ierr) ! ** Set solver parameters at runtime call EPSSetFromOptions(solver,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the eigensystem ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSSolve(solver,ierr) ! ** Optional: Get some information from the solver and display it call EPSGetType(solver,tname,ierr) if (rank .eq. 0) then write(*,120) tname endif 120 format (' Solution method: ',A) call EPSGetDimensions(solver,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,130) nev endif 130 format (' Number of requested eigenvalues:',I4) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSPrintSolution(solver,PETSC_NULL_OBJECT,ierr) call EPSDestroy(solver,ierr) call MatDestroy(A,ierr) call SlepcFinalize(ierr) end slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex3.c0000644000175000017500000001437412211062077021531 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves the same eigenproblem as in example ex2, but using a shell matrix. " "The problem is a standard symmetric eigenproblem corresponding to the 2-D Laplacian operator.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions in both x and y dimensions.\n\n"; #include #include /* User-defined routines */ PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y); PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscMPIInt size; PetscInt N,n=10,nev; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr); if (size != 1) SETERRQ(PETSC_COMM_WORLD,1,"This is a uniprocessor example only"); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); N = n*n; ierr = PetscPrintf(PETSC_COMM_WORLD,"\n2-D Laplacian Eigenproblem (matrix-free version), N=%D (%Dx%D grid)\n\n",N,n,n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreateShell(PETSC_COMM_WORLD,N,N,N,N,&n,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_MULT,(void(*)())MatMult_Laplacian2D);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_MULT_TRANSPOSE,(void(*)())MatMult_Laplacian2D);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Laplacian2D);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } /* Compute the matrix vector multiplication y<---T*x where T is a nx by nx tridiagonal matrix with DD on the diagonal, DL on the subdiagonal, and DU on the superdiagonal. */ static void tv(int nx,const PetscScalar *x,PetscScalar *y) { PetscScalar dd,dl,du; int j; dd = 4.0; dl = -1.0; du = -1.0; y[0] = dd*x[0] + du*x[1]; for (j=1;j. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves a standard eigensystem Ax=kx with the matrix loaded from a file.\n" "This example works for both real and complex numbers.\n\n" "The command line options are:\n" " -file , where = matrix file in PETSc binary form.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal tol; PetscInt nev,maxit,its; char filename[PETSC_MAX_PATH_LEN]; PetscViewer viewer; PetscBool flg; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Load the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscPrintf(PETSC_COMM_WORLD,"\nEigenproblem stored in file.\n\n");CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-file",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name with the -file option"); #if defined(PETSC_USE_COMPLEX) ierr = PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrix from a binary file...\n");CHKERRQ(ierr); #else ierr = PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrix from a binary file...\n");CHKERRQ(ierr); #endif ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatLoad(A,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = EPSGetIterationNumber(eps,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); ierr = EPSGetTolerances(eps,&tol,&maxit);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex1f90.F90.html0000644000175000017500000002650312211062077023122 0ustar gladkgladk
Actual source code: ex1f90.F90

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n ex1f90 [-help] [-n <n>] [all SLEPc options]
 21: !
 22: !  Description: Simple example that solves an eigensystem with the EPS object.
 23: !  The standard symmetric eigenvalue problem to be solved corresponds to the
 24: !  Laplacian operator in 1 dimension.
 25: !
 26: !  The command line options are:
 27: !    -n <n>, where <n> = number of grid points = matrix size
 28: !
 29: ! ----------------------------------------------------------------------
 30: !
 31:       program main

 33: #include <finclude/slepcepsdef.h>
 34:       use slepceps

 36:       implicit none

 38: ! For usage without modules, uncomment the following lines and remove
 39: ! the previous lines between 'program main' and 'implicit none'
 40: !
 41: !#include <finclude/petsc.h>
 42: !#include <finclude/slepc.h>

 44: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 45: !     Declarations
 46: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 47: !
 48: !  Variables:
 49: !     A      operator matrix
 50: !     solver eigenproblem solver context

 52: #if defined(PETSC_USE_FORTRAN_DATATYPES)
 53:       type(Mat)      A
 54:       type(EPS)      solver
 55: #else
 56:       Mat            A
 57:       EPS            solver
 58: #endif
 59:       EPSType        tname
 60:       PetscInt       n, i, Istart, Iend, one, two, three
 61:       PetscInt       nev
 62:       PetscInt       row(1), col(3)
 63:       PetscMPIInt    rank
 64:       PetscErrorCode ierr
 65:       PetscBool      flg
 66:       PetscScalar    value(3)

 68: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 69: !     Beginning of program
 70: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 72:       one = 1
 73:       two = 2
 74:       three = 3
 75:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 76:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 77:       n = 30
 78:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)

 80:       if (rank .eq. 0) then
 81:         write(*,100) n
 82:       endif
 83:  100  format (/'1-D Laplacian Eigenproblem, n =',I4,' (Fortran)')

 85: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 86: !     Compute the operator matrix that defines the eigensystem, Ax=kx
 87: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 89:       call MatCreate(PETSC_COMM_WORLD,A,ierr)
 90:       call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr)
 91:       call MatSetFromOptions(A,ierr)
 92:       call MatSetUp(A,ierr)

 94:       call MatGetOwnershipRange(A,Istart,Iend,ierr)
 95:       if (Istart .eq. 0) then
 96:         row(1) = 0
 97:         col(1) = 0
 98:         col(2) = 1
 99:         value(1) =  2.0
100:         value(2) = -1.0
101:         call MatSetValues(A,one,row,two,col,value,INSERT_VALUES,ierr)
102:         Istart = Istart+1
103:       endif
104:       if (Iend .eq. n) then
105:         row(1) = n-1
106:         col(1) = n-2
107:         col(2) = n-1
108:         value(1) = -1.0
109:         value(2) =  2.0
110:         call MatSetValues(A,one,row,two,col,value,INSERT_VALUES,ierr)
111:         Iend = Iend-1
112:       endif
113:       value(1) = -1.0
114:       value(2) =  2.0
115:       value(3) = -1.0
116:       do i=Istart,Iend-1
117:         row(1) = i
118:         col(1) = i-1
119:         col(2) = i
120:         col(3) = i+1
121:         call MatSetValues(A,one,row,three,col,value,INSERT_VALUES,ierr)
122:       enddo

124:       call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)
125:       call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)

127: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
128: !     Create the eigensolver and display info
129: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

131: !     ** Create eigensolver context
132:       call EPSCreate(PETSC_COMM_WORLD,solver,ierr)

134: !     ** Set operators. In this case, it is a standard eigenvalue problem
135:       call EPSSetOperators(solver,A,PETSC_NULL_OBJECT,ierr)
136:       call EPSSetProblemType(solver,EPS_HEP,ierr)

138: !     ** Set solver parameters at runtime
139:       call EPSSetFromOptions(solver,ierr)

141: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
142: !     Solve the eigensystem
143: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

145:       call EPSSolve(solver,ierr)

147: !     ** Optional: Get some information from the solver and display it
148:       call EPSGetType(solver,tname,ierr)
149:       if (rank .eq. 0) then
150:         write(*,120) tname
151:       endif
152:  120  format (' Solution method: ',A)
153:       call EPSGetDimensions(solver,nev,PETSC_NULL_INTEGER,              &
154:      &                      PETSC_NULL_INTEGER,ierr)
155:       if (rank .eq. 0) then
156:         write(*,130) nev
157:       endif
158:  130  format (' Number of requested eigenvalues:',I4)

160: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
161: !     Display solution and clean up
162: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

164:       call EPSPrintSolution(solver,PETSC_NULL_OBJECT,ierr)
165:       call EPSDestroy(solver,ierr)
166:       call MatDestroy(A,ierr)

168:       call SlepcFinalize(ierr)
169:       end

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex2.c0000644000175000017500000001065312211062077021524 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Standard symmetric eigenproblem corresponding to the Laplacian operator in 2 dimensions.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions in x dimension.\n" " -m , where = number of grid subdivisions in y dimension.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscInt N,n=10,m,Istart,Iend,II,nev,i,j; PetscBool flag; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscPrintf(PETSC_COMM_WORLD,"\n2-D Laplacian Eigenproblem, N=%D (%Dx%D grid)\n\n",N,n,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(A,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (i0) { ierr = MatSetValue(A,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (jActual source code: ex7.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves a generalized eigensystem Ax=kBx with matrices loaded from a file.\n"
 23:   "This example works for both real and complex numbers.\n\n"
 24:   "The command line options are:\n"
 25:   "  -f1 <filename>, where <filename> = matrix (A) file in PETSc binary form.\n"
 26:   "  -f2 <filename>, where <filename> = matrix (B) file in PETSc binary form.\n"
 27:   "  -evecs <filename>, output file to save computed eigenvectors.\n"
 28:   "  -ninitial <nini>, number of user-provided initial guesses.\n"
 29:   "  -finitial <filename>, where <filename> contains <nini> vectors (binary).\n"
 30:   "  -nconstr <ncon>, number of user-provided constraints.\n"
 31:   "  -fconstr <filename>, where <filename> contains <ncon> vectors (binary).\n\n";

 33: #include <slepceps.h>

 37: int main(int argc,char **argv)
 38: {
 39:   Mat            A,B;             /* matrices */
 40:   EPS            eps;             /* eigenproblem solver context */
 41:   EPSType        type;
 42:   PetscReal      tol;
 43:   Vec            xr,xi,*Iv,*Cv;
 44:   PetscInt       nev,maxit,i,its,lits,nconv,nini=0,ncon=0;
 45:   char           filename[PETSC_MAX_PATH_LEN];
 46:   PetscViewer    viewer;
 47:   PetscBool      flg,evecs,ishermitian;

 50:   SlepcInitialize(&argc,&argv,(char*)0,help);

 52:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 53:         Load the matrices that define the eigensystem, Ax=kBx
 54:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 56:   PetscPrintf(PETSC_COMM_WORLD,"\nGeneralized eigenproblem stored in file.\n\n");
 57:   PetscOptionsGetString(NULL,"-f1",filename,PETSC_MAX_PATH_LEN,&flg);
 58:   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix A with the -f1 option");

 60: #if defined(PETSC_USE_COMPLEX)
 61:   PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrices from binary files...\n");
 62: #else
 63:   PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrices from binary files...\n");
 64: #endif
 65:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 66:   MatCreate(PETSC_COMM_WORLD,&A);
 67:   MatSetFromOptions(A);
 68:   MatLoad(A,viewer);
 69:   PetscViewerDestroy(&viewer);

 71:   PetscOptionsGetString(NULL,"-f2",filename,PETSC_MAX_PATH_LEN,&flg);
 72:   if (flg) {
 73:     PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 74:     MatCreate(PETSC_COMM_WORLD,&B);
 75:     MatSetFromOptions(B);
 76:     MatLoad(B,viewer);
 77:     PetscViewerDestroy(&viewer);
 78:   } else {
 79:     PetscPrintf(PETSC_COMM_WORLD," Matrix B was not provided, setting B=I\n\n");
 80:     B = NULL;
 81:   }

 83:   MatGetVecs(A,NULL,&xr);
 84:   MatGetVecs(A,NULL,&xi);

 86:   /*
 87:      Read user constraints if available
 88:   */
 89:   PetscOptionsGetInt(NULL,"-nconstr",&ncon,&flg);
 90:   if (flg) {
 91:     if (ncon<=0) SETERRQ(PETSC_COMM_WORLD,1,"The number of constraints must be >0");
 92:     PetscOptionsGetString(NULL,"-fconstr",filename,PETSC_MAX_PATH_LEN,&flg);
 93:     if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must specify the name of the file storing the constraints");
 94:     PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 95:     VecDuplicateVecs(xr,ncon,&Cv);
 96:     for (i=0;i<ncon;i++) {
 97:       VecLoad(Cv[i],viewer);
 98:     }
 99:     PetscViewerDestroy(&viewer);
100:   }

102:   /*
103:      Read initial guesses if available
104:   */
105:   PetscOptionsGetInt(NULL,"-ninitial",&nini,&flg);
106:   if (flg) {
107:     if (nini<=0) SETERRQ(PETSC_COMM_WORLD,1,"The number of initial vectors must be >0");
108:     PetscOptionsGetString(NULL,"-finitial",filename,PETSC_MAX_PATH_LEN,&flg);
109:     if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must specify the name of the file containing the initial vectors");
110:     PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
111:     VecDuplicateVecs(xr,nini,&Iv);
112:     for (i=0;i<nini;i++) {
113:       VecLoad(Iv[i],viewer);
114:     }
115:     PetscViewerDestroy(&viewer);
116:   }

118:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
119:                 Create the eigensolver and set various options
120:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

122:   /*
123:      Create eigensolver context
124:   */
125:   EPSCreate(PETSC_COMM_WORLD,&eps);

127:   /*
128:      Set operators. In this case, it is a generalized eigenvalue problem
129:   */
130:   EPSSetOperators(eps,A,B);

132:   /*
133:      If the user provided initial guesses or constraints, pass them here
134:   */
135:   EPSSetInitialSpace(eps,nini,Iv);
136:   EPSSetDeflationSpace(eps,ncon,Cv);

138:   /*
139:      Set solver parameters at runtime
140:   */
141:   EPSSetFromOptions(eps);

143:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
144:                       Solve the eigensystem
145:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

147:   EPSSolve(eps);

149:   /*
150:      Optional: Get some information from the solver and display it
151:   */
152:   EPSGetIterationNumber(eps,&its);
153:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);
154:   EPSGetOperationCounters(eps,NULL,NULL,&lits);
155:   PetscPrintf(PETSC_COMM_WORLD," Number of linear iterations of the method: %D\n",lits);
156:   EPSGetType(eps,&type);
157:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
158:   EPSGetDimensions(eps,&nev,NULL,NULL);
159:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
160:   EPSGetTolerances(eps,&tol,&maxit);
161:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

163:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
164:                     Display solution and clean up
165:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

167:   EPSPrintSolution(eps,NULL);
168:   /*
169:      Save eigenvectors, if requested
170:   */
171:   PetscOptionsGetString(NULL,"-evecs",filename,PETSC_MAX_PATH_LEN,&evecs);
172:   EPSGetConverged(eps,&nconv);
173:   if (nconv>0 && evecs) {
174:     PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_WRITE,&viewer);
175:     EPSIsHermitian(eps,&ishermitian);
176:     for (i=0;i<nconv;i++) {
177:       EPSGetEigenvector(eps,i,xr,xi);
178:       VecView(xr,viewer);
179:       if (!ishermitian) { VecView(xi,viewer); }
180:     }
181:     PetscViewerDestroy(&viewer);
182:   }

184:   /*
185:      Free work space
186:   */
187:   EPSDestroy(&eps);
188:   MatDestroy(&A);
189:   MatDestroy(&B);
190:   VecDestroy(&xr);
191:   VecDestroy(&xi);
192:   if (nini > 0) {
193:     VecDestroyVecs(nini,&Iv);
194:   }
195:   if (ncon > 0) {
196:     VecDestroyVecs(ncon,&Cv);
197:   }
198:   SlepcFinalize();
199:   return 0;
200: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex5.c.html0000644000175000017500000003406612211062077022476 0ustar gladkgladk
Actual source code: ex5.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Eigenvalue problem associated with a Markov model of a random walk on a triangular grid. "
 23:   "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n"
 24:   "This example illustrates how the user can set the initial vector.\n\n"
 25:   "The command line options are:\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in each dimension.\n\n";

 28: #include <slepceps.h>

 30: /*
 31:    User-defined routines
 32: */
 33: PetscErrorCode MatMarkovModel(PetscInt m,Mat A);

 37: int main(int argc,char **argv)
 38: {
 39:   Vec            v0;              /* initial vector */
 40:   Mat            A;               /* operator matrix */
 41:   EPS            eps;             /* eigenproblem solver context */
 42:   EPSType        type;
 43:   PetscInt       N,m=15,nev;

 46:   SlepcInitialize(&argc,&argv,(char*)0,help);

 48:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 49:   N = m*(m+1)/2;
 50:   PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n\n",N,m);

 52:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 53:      Compute the operator matrix that defines the eigensystem, Ax=kx
 54:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 56:   MatCreate(PETSC_COMM_WORLD,&A);
 57:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 58:   MatSetFromOptions(A);
 59:   MatSetUp(A);
 60:   MatMarkovModel(m,A);

 62:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 63:                 Create the eigensolver and set various options
 64:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 66:   /*
 67:      Create eigensolver context
 68:   */
 69:   EPSCreate(PETSC_COMM_WORLD,&eps);

 71:   /*
 72:      Set operators. In this case, it is a standard eigenvalue problem
 73:   */
 74:   EPSSetOperators(eps,A,NULL);
 75:   EPSSetProblemType(eps,EPS_NHEP);

 77:   /*
 78:      Set solver parameters at runtime
 79:   */
 80:   EPSSetFromOptions(eps);

 82:   /*
 83:      Set the initial vector. This is optional, if not done the initial
 84:      vector is set to random values
 85:   */
 86:   MatGetVecs(A,&v0,NULL);
 87:   VecSet(v0,1.0);
 88:   EPSSetInitialSpace(eps,1,&v0);

 90:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 91:                       Solve the eigensystem
 92:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 94:   EPSSolve(eps);

 96:   /*
 97:      Optional: Get some information from the solver and display it
 98:   */
 99:   EPSGetType(eps,&type);
100:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
101:   EPSGetDimensions(eps,&nev,NULL,NULL);
102:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

104:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
105:                     Display solution and clean up
106:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

108:   EPSPrintSolution(eps,NULL);
109:   EPSDestroy(&eps);
110:   MatDestroy(&A);
111:   VecDestroy(&v0);
112:   SlepcFinalize();
113:   return 0;
114: }

118: /*
119:     Matrix generator for a Markov model of a random walk on a triangular grid.

121:     This subroutine generates a test matrix that models a random walk on a
122:     triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a
123:     FORTRAN subroutine to calculate the dominant invariant subspaces of a real
124:     matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few
125:     papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295
126:     (1980) ]. These matrices provide reasonably easy test problems for eigenvalue
127:     algorithms. The transpose of the matrix  is stochastic and so it is known
128:     that one is an exact eigenvalue. One seeks the eigenvector of the transpose
129:     associated with the eigenvalue unity. The problem is to calculate the steady
130:     state probability distribution of the system, which is the eigevector
131:     associated with the eigenvalue one and scaled in such a way that the sum all
132:     the components is equal to one.

134:     Note: the code will actually compute the transpose of the stochastic matrix
135:     that contains the transition probabilities.
136: */
137: PetscErrorCode MatMarkovModel(PetscInt m,Mat A)
138: {
139:   const PetscReal cst = 0.5/(PetscReal)(m-1);
140:   PetscReal       pd,pu;
141:   PetscInt        Istart,Iend,i,j,jmax,ix=0;
142:   PetscErrorCode  ierr;

145:   MatGetOwnershipRange(A,&Istart,&Iend);
146:   for (i=1;i<=m;i++) {
147:     jmax = m-i+1;
148:     for (j=1;j<=jmax;j++) {
149:       ix = ix + 1;
150:       if (ix-1<Istart || ix>Iend) continue;  /* compute only owned rows */
151:       if (j!=jmax) {
152:         pd = cst*(PetscReal)(i+j-1);
153:         /* north */
154:         if (i==1) {
155:           MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);
156:         } else {
157:           MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);
158:         }
159:         /* east */
160:         if (j==1) {
161:           MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);
162:         } else {
163:           MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);
164:         }
165:       }
166:       /* south */
167:       pu = 0.5 - cst*(PetscReal)(i+j-3);
168:       if (j>1) {
169:         MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);
170:       }
171:       /* west */
172:       if (i>1) {
173:         MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);
174:       }
175:     }
176:   }
177:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
178:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
179:   return(0);
180: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/makefile0000644000175000017500000001506612211062077022365 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/eps/examples/tutorials/ EXAMPLESC = ex1.c ex2.c ex3.c ex4.c ex5.c ex7.c ex9.c ex11.c ex12.c ex13.c \ ex18.c ex19.c EXAMPLESF = ex1f.F ex1f90.F90 ex6f.F MANSEC = EPS TESTEXAMPLES_C = ex2.PETSc runex2_1 ex2.rm \ ex3.PETSc runex3_1 ex3.rm \ ex5.PETSc runex5_1 ex5.rm \ ex9.PETSc runex9_1 ex9.rm \ ex11.PETSc runex11_1 ex11.rm \ ex13.PETSc runex13_1 ex13.rm \ ex18.PETSc runex18_1 ex18.rm TESTEXAMPLES_C_NOCOMPLEX = ex4.PETSc runex4_1 ex4.rm \ ex7.PETSc runex7_1 ex7.rm TESTEXAMPLES_FORTRAN_NOCOMPLEX = ex6f.PETSc runex6f_1 ex6f.rm TESTEXAMPLES_F90 = ex1f90.PETSc runex1f90_1 ex1f90.rm include ${SLEPC_DIR}/conf/slepc_common ex1: ex1.o chkopts -${CLINKER} -o ex1 ex1.o ${SLEPC_LIB} ${RM} ex1.o ex1f: ex1f.o chkopts -${FLINKER} -o ex1f ex1f.o ${SLEPC_LIB} ${RM} ex1f.o ex1f90: ex1f90.o chkopts -${FLINKER} -o ex1f90 ex1f90.o ${SLEPC_LIB} ${RM} ex1f90.o ex2: ex2.o chkopts -${CLINKER} -o ex2 ex2.o ${SLEPC_LIB} ${RM} ex2.o ex3: ex3.o chkopts -${CLINKER} -o ex3 ex3.o ${SLEPC_LIB} ${RM} ex3.o ex4: ex4.o chkopts -${CLINKER} -o ex4 ex4.o ${SLEPC_LIB} ${RM} ex4.o ex5: ex5.o chkopts -${CLINKER} -o ex5 ex5.o ${SLEPC_LIB} ${RM} ex5.o ex6f: ex6f.o chkopts -${FLINKER} -o ex6f ex6f.o ${SLEPC_LIB} ${RM} ex6f.o ex7: ex7.o chkopts -${CLINKER} -o ex7 ex7.o ${SLEPC_LIB} ${RM} ex7.o ex9: ex9.o chkopts -${CLINKER} -o ex9 ex9.o ${SLEPC_LIB} ${RM} ex9.o ex11: ex11.o chkopts -${CLINKER} -o ex11 ex11.o ${SLEPC_LIB} ${RM} ex11.o ex12: ex12.o chkopts -${CLINKER} -o ex12 ex12.o ${SLEPC_LIB} ${RM} ex12.o ex13: ex13.o chkopts -${CLINKER} -o ex13 ex13.o ${SLEPC_LIB} ${RM} ex13.o ex18: ex18.o chkopts -${CLINKER} -o ex18 ex18.o ${SLEPC_LIB} ${RM} ex18.o ex19: ex19.o chkopts -${CLINKER} -o ex19 ex19.o ${SLEPC_LIB} ${RM} ex19.o #------------------------------------------------------------------------------------ DATAPATH = ${SLEPC_DIR}/share/slepc/datafiles/matrices runex1_1: -@${MPIEXEC} -np 1 ./ex1 > ex1_1.tmp 2>&1; \ if (${DIFF} output/ex1_1.out ex1_1.tmp) then true; \ else echo "Possible problem with ex1_1, diffs above"; fi; \ ${RM} -f ex1_1.tmp runex1f_1: -@${MPIEXEC} -np 1 ./ex1f > ex1f_1.tmp 2>&1; \ if (${DIFF} output/ex1f_1.out ex1f_1.tmp) then true; \ else echo "Possible problem with ex1f_1, diffs above"; fi; \ ${RM} -f ex1f_1.tmp runex1f90_1: -@${MPIEXEC} -np 1 ./ex1f90 -eps_nev 4 -eps_terse > ex1f90_1.tmp 2>&1; \ if (${DIFF} output/ex1f90_1.out ex1f90_1.tmp) then true; \ else echo "Possible problem with ex1f90_1, diffs above"; fi; \ ${RM} -f ex1f90_1.tmp runex2_1: -@${MPIEXEC} -np 1 ./ex2 -eps_nev 4 -eps_terse > ex2_1.tmp 2>&1; \ if (${DIFF} output/ex2_1.out ex2_1.tmp) then true; \ else echo "Possible problem with ex2_1, diffs above"; fi; \ ${RM} -f ex2_1.tmp runex3_1: -@${MPIEXEC} -np 1 ./ex3 -eps_nev 4 -eps_terse > ex3_1.tmp 2>&1; \ if (${DIFF} output/ex3_1.out ex3_1.tmp) then true; \ else echo "Possible problem with ex3_1, diffs above"; fi; \ ${RM} -f ex3_1.tmp runex4_1: -@${MPIEXEC} -np 1 ./ex4 -file ${DATAPATH}/rdb200.petsc -eps_nev 4 -eps_terse > ex4_1.tmp 2>&1; \ if (${DIFF} output/ex4_1.out ex4_1.tmp) then true; \ else echo "Possible problem with ex4_1, diffs above"; fi; \ ${RM} -f ex4_1.tmp runex5_1: -@${MPIEXEC} -np 1 ./ex5 -st_shift 1 -eps_nev 4 -eps_terse > ex5_1.tmp 2>&1; \ if (${DIFF} output/ex5_1.out ex5_1.tmp) then true; \ else echo "Possible problem with ex5_1, diffs above"; fi; \ ${RM} -f ex5_1.tmp runex6f_1: -@${MPIEXEC} -np 1 ./ex6f -eps_max_it 1000 -eps_ncv 12 -eps_tol 1e-5 -eps_nev 4 -eps_terse > ex6f_1.tmp 2>&1; \ if (${DIFF} output/ex6f_1.out ex6f_1.tmp) then true; \ else echo "Possible problem with ex6f_1, diffs above"; fi; \ ${RM} -f ex6f_1.tmp runex7_1: -@${MPIEXEC} -np 1 ./ex7 -f1 ${DATAPATH}/bfw62a.petsc -f2 ${DATAPATH}/bfw62b.petsc -eps_nev 4 -eps_terse > ex7_1.tmp 2>&1; \ if (${DIFF} output/ex7_1.out ex7_1.tmp) then true; \ else echo "Possible problem with ex7_1, diffs above"; fi; \ ${RM} -f ex7_1.tmp runex9_1: -@${MPIEXEC} -np 1 ./ex9 -eps_nev 4 -eps_terse > ex9_1.tmp 2>&1; \ if (${DIFF} output/ex9_1.out ex9_1.tmp) then true; \ else echo "Possible problem with ex9_1, diffs above"; fi; \ ${RM} -f ex9_1.tmp runex11_1: -@${MPIEXEC} -np 1 ./ex11 -eps_nev 4 -eps_terse > ex11_1.tmp 2>&1; \ if (${DIFF} output/ex11_1.out ex11_1.tmp) then true; \ else echo "Possible problem with ex11_1, diffs above"; fi; \ ${RM} -f ex11_1.tmp runex12_1: -@${MPIEXEC} -np 1 ./ex12 -eps_type power -st_shift 1 -eps_nev 2 > ex12_1.tmp 2>&1; \ if (${DIFF} output/ex12_1.out ex12_1.tmp) then true; \ else echo "Possible problem with ex12_1, diffs above"; fi; \ ${RM} -f ex12_1.tmp runex13_1: -@${MPIEXEC} -np 1 ./ex13 -eps_nev 4 -eps_terse > ex13_1.tmp 2>&1; \ if (${DIFF} output/ex13_1.out ex13_1.tmp) then true; \ else echo "Possible problem with ex13_1, diffs above"; fi; \ ${RM} -f ex13_1.tmp runex18_1: -@${MPIEXEC} -np 1 ./ex18 -eps_nev 4 -eps_terse > ex18_1.tmp 2>&1; \ if (${DIFF} output/ex18_1.out ex18_1.tmp) then true; \ else echo "Possible problem with ex18_1, diffs above"; fi; \ ${RM} -f ex18_1.tmp runex19_1: -@${MPIEXEC} -np 1 ./ex19 -eps_nev 8 -eps_ncv 64 > ex19_1.tmp 2>&1; \ if (${DIFF} output/ex19_1.out ex19_1.tmp) then true; \ else echo "Possible problem with ex19_1, diffs above"; fi; \ ${RM} -f ex19_1.tmp slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex18.c.html0000644000175000017500000004314212211062077022555 0ustar gladkgladk
Actual source code: ex18.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves the same problem as in ex5, but with a user-defined sorting criterion."
 23:   "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n"
 24:   "This example illustrates how the user can set a custom spectrum selection.\n\n"
 25:   "The command line options are:\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in each dimension.\n\n";

 28: #include <slepceps.h>

 30: /*
 31:    User-defined routines
 32: */

 34: PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx);
 35: PetscErrorCode MatMarkovModel(PetscInt m,Mat A);

 39: int main(int argc,char **argv)
 40: {
 41:   Vec            v0;              /* initial vector */
 42:   Mat            A;               /* operator matrix */
 43:   EPS            eps;             /* eigenproblem solver context */
 44:   EPSType        type;
 45:   PetscScalar    target=0.5;
 46:   PetscInt       N,m=15,nev;

 49:   SlepcInitialize(&argc,&argv,(char*)0,help);

 51:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 52:   N = m*(m+1)/2;
 53:   PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n",N,m);
 54:   PetscOptionsGetScalar(NULL,"-target",&target,NULL);
 55:   PetscPrintf(PETSC_COMM_WORLD,"Searching closest eigenvalues to the right of %G.\n\n",target);

 57:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 58:      Compute the operator matrix that defines the eigensystem, Ax=kx
 59:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 61:   MatCreate(PETSC_COMM_WORLD,&A);
 62:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 63:   MatSetFromOptions(A);
 64:   MatSetUp(A);
 65:   MatMarkovModel(m,A);

 67:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 68:                 Create the eigensolver and set various options
 69:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 71:   /*
 72:      Create eigensolver context
 73:   */
 74:   EPSCreate(PETSC_COMM_WORLD,&eps);

 76:   /*
 77:      Set operators. In this case, it is a standard eigenvalue problem
 78:   */
 79:   EPSSetOperators(eps,A,NULL);
 80:   EPSSetProblemType(eps,EPS_NHEP);

 82:   /*
 83:      Set the custom comparing routine in order to obtain the eigenvalues
 84:      closest to the target on the right only
 85:   */
 86:   EPSSetEigenvalueComparison(eps,MyEigenSort,&target);

 88:   /*
 89:      Set solver parameters at runtime
 90:   */
 91:   EPSSetFromOptions(eps);

 93:   /*
 94:      Set the initial vector. This is optional, if not done the initial
 95:      vector is set to random values
 96:   */
 97:   MatGetVecs(A,&v0,NULL);
 98:   VecSet(v0,1.0);
 99:   EPSSetInitialSpace(eps,1,&v0);

101:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102:                       Solve the eigensystem
103:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

105:   EPSSolve(eps);

107:   /*
108:      Optional: Get some information from the solver and display it
109:   */
110:   EPSGetType(eps,&type);
111:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
112:   EPSGetDimensions(eps,&nev,NULL,NULL);
113:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

115:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116:                     Display solution and clean up
117:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

119:   EPSPrintSolution(eps,NULL);
120:   EPSDestroy(&eps);
121:   MatDestroy(&A);
122:   VecDestroy(&v0);
123:   SlepcFinalize();
124:   return 0;
125: }

129: /*
130:     Matrix generator for a Markov model of a random walk on a triangular grid.

132:     This subroutine generates a test matrix that models a random walk on a
133:     triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a
134:     FORTRAN subroutine to calculate the dominant invariant subspaces of a real
135:     matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few
136:     papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295
137:     (1980) ]. These matrices provide reasonably easy test problems for eigenvalue
138:     algorithms. The transpose of the matrix  is stochastic and so it is known
139:     that one is an exact eigenvalue. One seeks the eigenvector of the transpose
140:     associated with the eigenvalue unity. The problem is to calculate the steady
141:     state probability distribution of the system, which is the eigevector
142:     associated with the eigenvalue one and scaled in such a way that the sum all
143:     the components is equal to one.

145:     Note: the code will actually compute the transpose of the stochastic matrix
146:     that contains the transition probabilities.
147: */
148: PetscErrorCode MatMarkovModel(PetscInt m,Mat A)
149: {
150:   const PetscReal cst = 0.5/(PetscReal)(m-1);
151:   PetscReal       pd,pu;
152:   PetscInt        Istart,Iend,i,j,jmax,ix=0;
153:   PetscErrorCode  ierr;

156:   MatGetOwnershipRange(A,&Istart,&Iend);
157:   for (i=1;i<=m;i++) {
158:     jmax = m-i+1;
159:     for (j=1;j<=jmax;j++) {
160:       ix = ix + 1;
161:       if (ix-1<Istart || ix>Iend) continue;  /* compute only owned rows */
162:       if (j!=jmax) {
163:         pd = cst*(PetscReal)(i+j-1);
164:         /* north */
165:         if (i==1) {
166:           MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);
167:         } else {
168:           MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);
169:         }
170:         /* east */
171:         if (j==1) {
172:           MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);
173:         } else {
174:           MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);
175:         }
176:       }
177:       /* south */
178:       pu = 0.5 - cst*(PetscReal)(i+j-3);
179:       if (j>1) {
180:         MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);
181:       }
182:       /* west */
183:       if (i>1) {
184:         MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);
185:       }
186:     }
187:   }
188:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
189:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
190:   return(0);
191: }

195: /*
196:     Function for user-defined eigenvalue ordering criterion.

198:     Given two eigenvalues ar+i*ai and br+i*bi, the subroutine must choose
199:     one of them as the preferred one according to the criterion.
200:     In this example, the preferred value is the one closest to the target,
201:     but on the right side.
202: */
203: PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)
204: {
205:   PetscScalar target = *(PetscScalar*)ctx;
206:   PetscReal   da,db;
207:   PetscBool   aisright,bisright;

210:   if (PetscRealPart(target) < PetscRealPart(ar)) aisright = PETSC_TRUE;
211:   else aisright = PETSC_FALSE;
212:   if (PetscRealPart(target) < PetscRealPart(br)) bisright = PETSC_TRUE;
213:   else bisright = PETSC_FALSE;
214:   if (aisright == bisright) {
215:     /* both are on the same side of the target */
216:     da = SlepcAbsEigenvalue(ar-target,ai);
217:     db = SlepcAbsEigenvalue(br-target,bi);
218:     if (da < db) *r = -1;
219:     else if (da > db) *r = 1;
220:     else *r = 0;
221:   } else if (aisright && !bisright) *r = -1; /* 'a' is on the right */
222:   else *r = 1;  /* 'b' is on the right */
223:   return(0);
224: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex7.c0000644000175000017500000002042412211062077021526 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves a generalized eigensystem Ax=kBx with matrices loaded from a file.\n" "This example works for both real and complex numbers.\n\n" "The command line options are:\n" " -f1 , where = matrix (A) file in PETSc binary form.\n" " -f2 , where = matrix (B) file in PETSc binary form.\n" " -evecs , output file to save computed eigenvectors.\n" " -ninitial , number of user-provided initial guesses.\n" " -finitial , where contains vectors (binary).\n" " -nconstr , number of user-provided constraints.\n" " -fconstr , where contains vectors (binary).\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,B; /* matrices */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal tol; Vec xr,xi,*Iv,*Cv; PetscInt nev,maxit,i,its,lits,nconv,nini=0,ncon=0; char filename[PETSC_MAX_PATH_LEN]; PetscViewer viewer; PetscBool flg,evecs,ishermitian; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Load the matrices that define the eigensystem, Ax=kBx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscPrintf(PETSC_COMM_WORLD,"\nGeneralized eigenproblem stored in file.\n\n");CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-f1",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix A with the -f1 option"); #if defined(PETSC_USE_COMPLEX) ierr = PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrices from binary files...\n");CHKERRQ(ierr); #else ierr = PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrices from binary files...\n");CHKERRQ(ierr); #endif ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatLoad(A,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-f2",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&B);CHKERRQ(ierr); ierr = MatSetFromOptions(B);CHKERRQ(ierr); ierr = MatLoad(B,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD," Matrix B was not provided, setting B=I\n\n");CHKERRQ(ierr); B = NULL; } ierr = MatGetVecs(A,NULL,&xr);CHKERRQ(ierr); ierr = MatGetVecs(A,NULL,&xi);CHKERRQ(ierr); /* Read user constraints if available */ ierr = PetscOptionsGetInt(NULL,"-nconstr",&ncon,&flg);CHKERRQ(ierr); if (flg) { if (ncon<=0) SETERRQ(PETSC_COMM_WORLD,1,"The number of constraints must be >0"); ierr = PetscOptionsGetString(NULL,"-fconstr",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must specify the name of the file storing the constraints"); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = VecDuplicateVecs(xr,ncon,&Cv);CHKERRQ(ierr); for (i=0;i0"); ierr = PetscOptionsGetString(NULL,"-finitial",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must specify the name of the file containing the initial vectors"); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = VecDuplicateVecs(xr,nini,&Iv);CHKERRQ(ierr); for (i=0;i0 && evecs) { ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_WRITE,&viewer);CHKERRQ(ierr); ierr = EPSIsHermitian(eps,&ishermitian);CHKERRQ(ierr); for (i=0;i 0) { ierr = VecDestroyVecs(nini,&Iv);CHKERRQ(ierr); } if (ncon > 0) { ierr = VecDestroyVecs(ncon,&Cv);CHKERRQ(ierr); } ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/makefile.html0000644000175000017500000002426412211062077023330 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/eps/examples/tutorials/
EXAMPLESC  = ex1.c ex2.c ex3.c ex4.c ex5.c ex7.c ex9.c ex11.c ex12.c ex13.c \
             ex18.c ex19.c
EXAMPLESF  = ex1f.F ex1f90.F90 ex6f.F
MANSEC     = EPS

TESTEXAMPLES_C                 = ex2.PETSc runex2_1 ex2.rm \
                                 ex3.PETSc runex3_1 ex3.rm \
                                 ex5.PETSc runex5_1 ex5.rm \
                                 ex9.PETSc runex9_1 ex9.rm \
                                 ex11.PETSc runex11_1 ex11.rm \
                                 ex13.PETSc runex13_1 ex13.rm \
                                 ex18.PETSc runex18_1 ex18.rm
TESTEXAMPLES_C_NOCOMPLEX       = ex4.PETSc runex4_1 ex4.rm \
                                 ex7.PETSc runex7_1 ex7.rm
TESTEXAMPLES_FORTRAN_NOCOMPLEX = ex6f.PETSc runex6f_1 ex6f.rm
TESTEXAMPLES_F90               = ex1f90.PETSc runex1f90_1 ex1f90.rm

include ${SLEPC_DIR}/conf/slepc_common

ex1: ex1.o chkopts
	-${CLINKER} -o ex1 ex1.o ${SLEPC_LIB}
	${RM} ex1.o

ex1f: ex1f.o chkopts
	-${FLINKER} -o ex1f ex1f.o ${SLEPC_LIB}
	${RM} ex1f.o

ex1f90: ex1f90.o chkopts
	-${FLINKER} -o ex1f90 ex1f90.o ${SLEPC_LIB}
	${RM} ex1f90.o

ex2: ex2.o chkopts
	-${CLINKER} -o ex2 ex2.o ${SLEPC_LIB}
	${RM} ex2.o

ex3: ex3.o chkopts
	-${CLINKER} -o ex3 ex3.o ${SLEPC_LIB}
	${RM} ex3.o

ex4: ex4.o chkopts
	-${CLINKER} -o ex4 ex4.o ${SLEPC_LIB}
	${RM} ex4.o

ex5: ex5.o chkopts
	-${CLINKER} -o ex5 ex5.o ${SLEPC_LIB}
	${RM} ex5.o

ex6f: ex6f.o chkopts
	-${FLINKER} -o ex6f ex6f.o ${SLEPC_LIB}
	${RM} ex6f.o

ex7: ex7.o chkopts
	-${CLINKER} -o ex7 ex7.o ${SLEPC_LIB}
	${RM} ex7.o

ex9: ex9.o chkopts
	-${CLINKER} -o ex9 ex9.o ${SLEPC_LIB}
	${RM} ex9.o

ex11: ex11.o chkopts
	-${CLINKER} -o ex11 ex11.o ${SLEPC_LIB}
	${RM} ex11.o

ex12: ex12.o chkopts
	-${CLINKER} -o ex12 ex12.o ${SLEPC_LIB}
	${RM} ex12.o

ex13: ex13.o chkopts
	-${CLINKER} -o ex13 ex13.o ${SLEPC_LIB}
	${RM} ex13.o

ex18: ex18.o chkopts
	-${CLINKER} -o ex18 ex18.o ${SLEPC_LIB}
	${RM} ex18.o

ex19: ex19.o chkopts
	-${CLINKER} -o ex19 ex19.o ${SLEPC_LIB}
	${RM} ex19.o

#------------------------------------------------------------------------------------
DATAPATH = ${SLEPC_DIR}/share/slepc/datafiles/matrices

runex1_1:
	-@${MPIEXEC} -np 1 ./ex1 > ex1_1.tmp 2>&1; \
	   if (${DIFF} output/ex1_1.out ex1_1.tmp) then true; \
	   else echo "Possible problem with ex1_1, diffs above"; fi; \
	   ${RM} -f ex1_1.tmp

runex1f_1:
	-@${MPIEXEC} -np 1 ./ex1f > ex1f_1.tmp 2>&1; \
	   if (${DIFF} output/ex1f_1.out ex1f_1.tmp) then true; \
	   else echo "Possible problem with ex1f_1, diffs above"; fi; \
	   ${RM} -f ex1f_1.tmp

runex1f90_1:
	-@${MPIEXEC} -np 1 ./ex1f90 -eps_nev 4 -eps_terse > ex1f90_1.tmp 2>&1; \
	   if (${DIFF} output/ex1f90_1.out ex1f90_1.tmp) then true; \
	   else echo "Possible problem with ex1f90_1, diffs above"; fi; \
	   ${RM} -f ex1f90_1.tmp

runex2_1:
	-@${MPIEXEC} -np 1 ./ex2 -eps_nev 4 -eps_terse > ex2_1.tmp 2>&1; \
	   if (${DIFF} output/ex2_1.out ex2_1.tmp) then true; \
	   else echo "Possible problem with ex2_1, diffs above"; fi; \
	   ${RM} -f ex2_1.tmp

runex3_1:
	-@${MPIEXEC} -np 1 ./ex3 -eps_nev 4 -eps_terse > ex3_1.tmp 2>&1; \
	   if (${DIFF} output/ex3_1.out ex3_1.tmp) then true; \
	   else echo "Possible problem with ex3_1, diffs above"; fi; \
	   ${RM} -f ex3_1.tmp

runex4_1:
	-@${MPIEXEC} -np 1 ./ex4 -file ${DATAPATH}/rdb200.petsc -eps_nev 4 -eps_terse > ex4_1.tmp 2>&1; \
	   if (${DIFF} output/ex4_1.out ex4_1.tmp) then true; \
	   else echo "Possible problem with ex4_1, diffs above"; fi; \
	   ${RM} -f ex4_1.tmp

runex5_1:
	-@${MPIEXEC} -np 1 ./ex5 -st_shift 1 -eps_nev 4 -eps_terse > ex5_1.tmp 2>&1; \
	   if (${DIFF} output/ex5_1.out ex5_1.tmp) then true; \
	   else echo "Possible problem with ex5_1, diffs above"; fi; \
	   ${RM} -f ex5_1.tmp

runex6f_1:
	-@${MPIEXEC} -np 1 ./ex6f -eps_max_it 1000 -eps_ncv 12 -eps_tol 1e-5 -eps_nev 4 -eps_terse > ex6f_1.tmp 2>&1; \
	   if (${DIFF} output/ex6f_1.out ex6f_1.tmp) then true; \
	   else echo "Possible problem with ex6f_1, diffs above"; fi; \
	   ${RM} -f ex6f_1.tmp

runex7_1:
	-@${MPIEXEC} -np 1 ./ex7 -f1 ${DATAPATH}/bfw62a.petsc -f2 ${DATAPATH}/bfw62b.petsc -eps_nev 4 -eps_terse > ex7_1.tmp 2>&1; \
	   if (${DIFF} output/ex7_1.out ex7_1.tmp) then true; \
	   else echo "Possible problem with ex7_1, diffs above"; fi; \
	   ${RM} -f ex7_1.tmp

runex9_1:
	-@${MPIEXEC} -np 1 ./ex9 -eps_nev 4 -eps_terse > ex9_1.tmp 2>&1; \
	   if (${DIFF} output/ex9_1.out ex9_1.tmp) then true; \
	   else echo "Possible problem with ex9_1, diffs above"; fi; \
	   ${RM} -f ex9_1.tmp

runex11_1:
	-@${MPIEXEC} -np 1 ./ex11 -eps_nev 4 -eps_terse > ex11_1.tmp 2>&1; \
	   if (${DIFF} output/ex11_1.out ex11_1.tmp) then true; \
	   else echo "Possible problem with ex11_1, diffs above"; fi; \
	   ${RM} -f ex11_1.tmp

runex12_1:
	-@${MPIEXEC} -np 1 ./ex12 -eps_type power -st_shift 1 -eps_nev 2 > ex12_1.tmp 2>&1; \
	   if (${DIFF} output/ex12_1.out ex12_1.tmp) then true; \
	   else echo "Possible problem with ex12_1, diffs above"; fi; \
	   ${RM} -f ex12_1.tmp

runex13_1:
	-@${MPIEXEC} -np 1 ./ex13 -eps_nev 4 -eps_terse > ex13_1.tmp 2>&1; \
	   if (${DIFF} output/ex13_1.out ex13_1.tmp) then true; \
	   else echo "Possible problem with ex13_1, diffs above"; fi; \
	   ${RM} -f ex13_1.tmp

runex18_1:
	-@${MPIEXEC} -np 1 ./ex18 -eps_nev 4 -eps_terse > ex18_1.tmp 2>&1; \
	   if (${DIFF} output/ex18_1.out ex18_1.tmp) then true; \
	   else echo "Possible problem with ex18_1, diffs above"; fi; \
	   ${RM} -f ex18_1.tmp

runex19_1:
	-@${MPIEXEC} -np 1 ./ex19 -eps_nev 8 -eps_ncv 64 > ex19_1.tmp 2>&1; \
	   if (${DIFF} output/ex19_1.out ex19_1.tmp) then true; \
	   else echo "Possible problem with ex19_1, diffs above"; fi; \
	   ${RM} -f ex19_1.tmp

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/index.html0000644000175000017500000000463312211062077022660 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

ex1.c: Standard symmetric eigenproblem corresponding to the Laplacian operator in 1 dimension
ex2.c: Standard symmetric eigenproblem corresponding to the Laplacian operator in 2 dimensions
ex3.c: Solves the same eigenproblem as in example ex2, but using a shell matrix
ex4.c: Solves a standard eigensystem Ax=kx with the matrix loaded from a file
ex5.c: Eigenvalue problem associated with a Markov model of a random walk on a triangular grid
ex7.c: Solves a generalized eigensystem Ax=kBx with matrices loaded from a file
ex9.c: Solves a problem associated to the Brusselator wave model in chemical reactions, illustrating the use of shell matrices
ex11.c: Computes the smallest nonzero eigenvalue of the Laplacian of a graph
ex12.c: Solves the same eigenproblem as in example ex5, but computing also left eigenvectors
ex13.c: Generalized Symmetric eigenproblem
ex18.c: Solves the same problem as in ex5, but with a user-defined sorting criterion
ex19.c: Standard symmetric eigenproblem for the 3-D Laplacian built with the DM interface
makefile
slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex4.c.html0000644000175000017500000002246612211062077022476 0ustar gladkgladk

Actual source code: ex4.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves a standard eigensystem Ax=kx with the matrix loaded from a file.\n"
 23:   "This example works for both real and complex numbers.\n\n"
 24:   "The command line options are:\n"
 25:   "  -file <filename>, where <filename> = matrix file in PETSc binary form.\n\n";

 27: #include <slepceps.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;               /* operator matrix */
 34:   EPS            eps;             /* eigenproblem solver context */
 35:   EPSType        type;
 36:   PetscReal      tol;
 37:   PetscInt       nev,maxit,its;
 38:   char           filename[PETSC_MAX_PATH_LEN];
 39:   PetscViewer    viewer;
 40:   PetscBool      flg;

 43:   SlepcInitialize(&argc,&argv,(char*)0,help);

 45:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 46:         Load the operator matrix that defines the eigensystem, Ax=kx
 47:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 49:   PetscPrintf(PETSC_COMM_WORLD,"\nEigenproblem stored in file.\n\n");
 50:   PetscOptionsGetString(NULL,"-file",filename,PETSC_MAX_PATH_LEN,&flg);
 51:   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name with the -file option");

 53: #if defined(PETSC_USE_COMPLEX)
 54:   PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrix from a binary file...\n");
 55: #else
 56:   PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrix from a binary file...\n");
 57: #endif
 58:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 59:   MatCreate(PETSC_COMM_WORLD,&A);
 60:   MatSetFromOptions(A);
 61:   MatLoad(A,viewer);
 62:   PetscViewerDestroy(&viewer);

 64:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 65:                 Create the eigensolver and set various options
 66:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 68:   /*
 69:      Create eigensolver context
 70:   */
 71:   EPSCreate(PETSC_COMM_WORLD,&eps);

 73:   /*
 74:      Set operators. In this case, it is a standard eigenvalue problem
 75:   */
 76:   EPSSetOperators(eps,A,NULL);

 78:   /*
 79:      Set solver parameters at runtime
 80:   */
 81:   EPSSetFromOptions(eps);

 83:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 84:                       Solve the eigensystem
 85:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 87:   EPSSolve(eps);
 88:   EPSGetIterationNumber(eps,&its);
 89:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);

 91:   /*
 92:      Optional: Get some information from the solver and display it
 93:   */
 94:   EPSGetType(eps,&type);
 95:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
 96:   EPSGetDimensions(eps,&nev,NULL,NULL);
 97:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
 98:   EPSGetTolerances(eps,&tol,&maxit);
 99:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

101:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102:                     Display solution and clean up
103:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

105:   EPSPrintSolution(eps,NULL);
106:   EPSDestroy(&eps);
107:   MatDestroy(&A);
108:   SlepcFinalize();
109:   return 0;
110: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex9.c.html0000644000175000017500000004617712211062077022510 0ustar gladkgladk
Actual source code: ex9.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves a problem associated to the Brusselator wave model in chemical reactions, illustrating the use of shell matrices.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = block dimension of the 2x2 block matrix.\n"
 25:   "  -L <L>, where <L> = bifurcation parameter.\n"
 26:   "  -alpha <alpha>, -beta <beta>, -delta1 <delta1>,  -delta2 <delta2>,\n"
 27:   "       where <alpha> <beta> <delta1> <delta2> = model parameters.\n\n";

 29: #include <slepceps.h>

 31: /*
 32:    This example computes the eigenvalues with largest real part of the
 33:    following matrix

 35:         A = [ tau1*T+(beta-1)*I     alpha^2*I
 36:                   -beta*I        tau2*T-alpha^2*I ],

 38:    where

 40:         T = tridiag{1,-2,1}
 41:         h = 1/(n+1)
 42:         tau1 = delta1/(h*L)^2
 43:         tau2 = delta2/(h*L)^2
 44:  */


 47: /*
 48:    Matrix operations
 49: */
 50: PetscErrorCode MatMult_Brussel(Mat,Vec,Vec);
 51: PetscErrorCode MatShift_Brussel(PetscScalar*,Mat);
 52: PetscErrorCode MatGetDiagonal_Brussel(Mat,Vec);

 54: typedef struct {
 55:   Mat         T;
 56:   Vec         x1,x2,y1,y2;
 57:   PetscScalar alpha,beta,tau1,tau2,sigma;
 58: } CTX_BRUSSEL;

 62: int main(int argc,char **argv)
 63: {
 64:   Mat            A;               /* eigenvalue problem matrix */
 65:   EPS            eps;             /* eigenproblem solver context */
 66:   EPSType        type;
 67:   PetscScalar    delta1,delta2,L,h,value[3];
 68:   PetscInt       N=30,n,i,col[3],Istart,Iend,nev;
 69:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;
 70:   CTX_BRUSSEL    *ctx;

 73:   SlepcInitialize(&argc,&argv,(char*)0,help);

 75:   PetscOptionsGetInt(NULL,"-n",&N,NULL);
 76:   PetscPrintf(PETSC_COMM_WORLD,"\nBrusselator wave model, n=%D\n\n",N);

 78:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 79:         Generate the matrix
 80:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 82:   /*
 83:      Create shell matrix context and set default parameters
 84:   */
 85:   PetscNew(CTX_BRUSSEL,&ctx);
 86:   ctx->alpha = 2.0;
 87:   ctx->beta  = 5.45;
 88:   delta1     = 0.008;
 89:   delta2     = 0.004;
 90:   L          = 0.51302;

 92:   /*
 93:      Look the command line for user-provided parameters
 94:   */
 95:   PetscOptionsGetScalar(NULL,"-L",&L,NULL);
 96:   PetscOptionsGetScalar(NULL,"-alpha",&ctx->alpha,NULL);
 97:   PetscOptionsGetScalar(NULL,"-beta",&ctx->beta,NULL);
 98:   PetscOptionsGetScalar(NULL,"-delta1",&delta1,NULL);
 99:   PetscOptionsGetScalar(NULL,"-delta2",&delta2,NULL);

101:   /*
102:      Create matrix T
103:   */
104:   MatCreate(PETSC_COMM_WORLD,&ctx->T);
105:   MatSetSizes(ctx->T,PETSC_DECIDE,PETSC_DECIDE,N,N);
106:   MatSetFromOptions(ctx->T);
107:   MatSetUp(ctx->T);

109:   MatGetOwnershipRange(ctx->T,&Istart,&Iend);
110:   if (Istart==0) FirstBlock=PETSC_TRUE;
111:   if (Iend==N) LastBlock=PETSC_TRUE;
112:   value[0]=1.0; value[1]=-2.0; value[2]=1.0;
113:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
114:     col[0]=i-1; col[1]=i; col[2]=i+1;
115:     MatSetValues(ctx->T,1,&i,3,col,value,INSERT_VALUES);
116:   }
117:   if (LastBlock) {
118:     i=N-1; col[0]=N-2; col[1]=N-1;
119:     MatSetValues(ctx->T,1,&i,2,col,value,INSERT_VALUES);
120:   }
121:   if (FirstBlock) {
122:     i=0; col[0]=0; col[1]=1; value[0]=-2.0; value[1]=1.0;
123:     MatSetValues(ctx->T,1,&i,2,col,value,INSERT_VALUES);
124:   }

126:   MatAssemblyBegin(ctx->T,MAT_FINAL_ASSEMBLY);
127:   MatAssemblyEnd(ctx->T,MAT_FINAL_ASSEMBLY);
128:   MatGetLocalSize(ctx->T,&n,NULL);

130:   /*
131:      Fill the remaining information in the shell matrix context
132:      and create auxiliary vectors
133:   */
134:   h = 1.0 / (PetscReal)(N+1);
135:   ctx->tau1 = delta1 / ((h*L)*(h*L));
136:   ctx->tau2 = delta2 / ((h*L)*(h*L));
137:   ctx->sigma = 0.0;
138:   VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->x1);
139:   VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->x2);
140:   VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->y1);
141:   VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->y2);

143:   /*
144:      Create the shell matrix
145:   */
146:   MatCreateShell(PETSC_COMM_WORLD,2*n,2*n,2*N,2*N,(void*)ctx,&A);
147:   MatShellSetOperation(A,MATOP_MULT,(void(*)())MatMult_Brussel);
148:   MatShellSetOperation(A,MATOP_SHIFT,(void(*)())MatShift_Brussel);
149:   MatShellSetOperation(A,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Brussel);

151:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
152:                 Create the eigensolver and set various options
153:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

155:   /*
156:      Create eigensolver context
157:   */
158:   EPSCreate(PETSC_COMM_WORLD,&eps);

160:   /*
161:      Set operators. In this case, it is a standard eigenvalue problem
162:   */
163:   EPSSetOperators(eps,A,NULL);
164:   EPSSetProblemType(eps,EPS_NHEP);

166:   /*
167:      Ask for the rightmost eigenvalues
168:   */
169:   EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL);

171:   /*
172:      Set other solver options at runtime
173:   */
174:   EPSSetFromOptions(eps);

176:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
177:                       Solve the eigensystem
178:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

180:   EPSSolve(eps);

182:   /*
183:      Optional: Get some information from the solver and display it
184:   */
185:   EPSGetType(eps,&type);
186:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
187:   EPSGetDimensions(eps,&nev,NULL,NULL);
188:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

190:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
191:                     Display solution and clean up
192:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

194:   EPSPrintSolution(eps,NULL);
195:   EPSDestroy(&eps);
196:   MatDestroy(&A);
197:   MatDestroy(&ctx->T);
198:   VecDestroy(&ctx->x1);
199:   VecDestroy(&ctx->x2);
200:   VecDestroy(&ctx->y1);
201:   VecDestroy(&ctx->y2);
202:   PetscFree(ctx);
203:   SlepcFinalize();
204:   return 0;
205: }

209: PetscErrorCode MatMult_Brussel(Mat A,Vec x,Vec y)
210: {
211:   PetscInt          n;
212:   const PetscScalar *px;
213:   PetscScalar       *py;
214:   CTX_BRUSSEL       *ctx;
215:   PetscErrorCode    ierr;

218:   MatShellGetContext(A,(void**)&ctx);
219:   MatGetLocalSize(ctx->T,&n,NULL);
220:   VecGetArrayRead(x,&px);
221:   VecGetArray(y,&py);
222:   VecPlaceArray(ctx->x1,px);
223:   VecPlaceArray(ctx->x2,px+n);
224:   VecPlaceArray(ctx->y1,py);
225:   VecPlaceArray(ctx->y2,py+n);

227:   MatMult(ctx->T,ctx->x1,ctx->y1);
228:   VecScale(ctx->y1,ctx->tau1);
229:   VecAXPY(ctx->y1,ctx->beta - 1.0 + ctx->sigma,ctx->x1);
230:   VecAXPY(ctx->y1,ctx->alpha * ctx->alpha,ctx->x2);

232:   MatMult(ctx->T,ctx->x2,ctx->y2);
233:   VecScale(ctx->y2,ctx->tau2);
234:   VecAXPY(ctx->y2,-ctx->beta,ctx->x1);
235:   VecAXPY(ctx->y2,-ctx->alpha * ctx->alpha + ctx->sigma,ctx->x2);

237:   VecRestoreArrayRead(x,&px);
238:   VecRestoreArray(y,&py);
239:   VecResetArray(ctx->x1);
240:   VecResetArray(ctx->x2);
241:   VecResetArray(ctx->y1);
242:   VecResetArray(ctx->y2);
243:   return(0);
244: }

248: PetscErrorCode MatShift_Brussel(PetscScalar* a,Mat Y)
249: {
250:   CTX_BRUSSEL    *ctx;

254:   MatShellGetContext(Y,(void**)&ctx);
255:   ctx->sigma += *a;
256:   return(0);
257: }

261: PetscErrorCode MatGetDiagonal_Brussel(Mat A,Vec diag)
262: {
263:   Vec            d1,d2;
264:   PetscInt       n;
265:   PetscScalar    *pd;
266:   MPI_Comm       comm;
267:   CTX_BRUSSEL    *ctx;

271:   MatShellGetContext(A,(void**)&ctx);
272:   PetscObjectGetComm((PetscObject)A,&comm);
273:   MatGetLocalSize(ctx->T,&n,NULL);
274:   VecGetArray(diag,&pd);
275:   VecCreateMPIWithArray(comm,1,n,PETSC_DECIDE,pd,&d1);
276:   VecCreateMPIWithArray(comm,1,n,PETSC_DECIDE,pd+n,&d2);

278:   VecSet(d1,-2.0*ctx->tau1 + ctx->beta - 1.0 + ctx->sigma);
279:   VecSet(d2,-2.0*ctx->tau2 - ctx->alpha*ctx->alpha + ctx->sigma);

281:   VecDestroy(&d1);
282:   VecDestroy(&d2);
283:   VecRestoreArray(diag,&pd);
284:   return(0);
285: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex12.c0000644000175000017500000002301312211062077021577 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves the same eigenproblem as in example ex5, but computing also left eigenvectors. " "It is a Markov model of a random walk on a triangular grid. " "A standard nonsymmetric eigenproblem with real eigenvalues. The rightmost eigenvalue is known to be 1.\n\n" "The command line options are:\n" " -m , where = number of grid subdivisions in each dimension.\n\n"; #include /* User-defined routines */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A); #undef __FUNCT__ #define __FUNCT__ "main" int main (int argc,char **argv) { Vec v0,w0; /* initial vector */ Vec *X,*Y; /* right and left eigenvectors */ Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal error1,error2,tol,re,im; PetscScalar kr,ki; PetscInt nev,maxit,i,its,nconv,N,m=15; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); N = m*(m+1)/2; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n\n",N,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatMarkovModel(m,A);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem. Request also left eigenvectors */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); ierr = EPSSetLeftVectorsWanted(eps,PETSC_TRUE);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* Set the initial vector. This is optional, if not done the initial vector is set to random values */ ierr = MatGetVecs(A,&v0,&w0);CHKERRQ(ierr); ierr = VecSet(v0,1.0);CHKERRQ(ierr); ierr = MatMult(A,v0,w0);CHKERRQ(ierr); ierr = EPSSetInitialSpace(eps,1,&v0);CHKERRQ(ierr); ierr = EPSSetInitialSpaceLeft(eps,1,&w0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = EPSGetIterationNumber(eps,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); ierr = EPSGetTolerances(eps,&tol,&maxit);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Get number of converged approximate eigenpairs */ ierr = EPSGetConverged(eps,&nconv);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);CHKERRQ(ierr); if (nconv>0) { /* Display eigenvalues and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " k ||Ax-kx||/||kx|| ||y'A-ky'||/||ky||\n" " ----------------- ------------------ --------------------\n");CHKERRQ(ierr); for (i=0;i \n" " ---------------------------------------------------------\n");CHKERRQ(ierr); ierr = SlepcCheckOrthogonality(X,nconv,Y,nconv,NULL,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n");CHKERRQ(ierr); ierr = VecDestroyVecs(nconv,&X);CHKERRQ(ierr); ierr = VecDestroyVecs(nconv,&Y);CHKERRQ(ierr); } /* Free work space */ ierr = VecDestroy(&v0);CHKERRQ(ierr); ierr = VecDestroy(&w0);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMarkovModel" /* Matrix generator for a Markov model of a random walk on a triangular grid. This subroutine generates a test matrix that models a random walk on a triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a FORTRAN subroutine to calculate the dominant invariant subspaces of a real matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295 (1980) ]. These matrices provide reasonably easy test problems for eigenvalue algorithms. The transpose of the matrix is stochastic and so it is known that one is an exact eigenvalue. One seeks the eigenvector of the transpose associated with the eigenvalue unity. The problem is to calculate the steady state probability distribution of the system, which is the eigevector associated with the eigenvalue one and scaled in such a way that the sum all the components is equal to one. Note: the code will actually compute the transpose of the stochastic matrix that contains the transition probabilities. */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A) { const PetscReal cst = 0.5/(PetscReal)(m-1); PetscReal pd,pu; PetscInt i,j,jmax,ix=0,Istart,Iend; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=1;i<=m;i++) { jmax = m-i+1; for (j=1;j<=jmax;j++) { ix = ix + 1; if (ix-1Iend) continue; /* compute only owned rows */ if (j!=jmax) { pd = cst*(PetscReal)(i+j-1); /* north */ if (i==1) { ierr = MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);CHKERRQ(ierr); } /* east */ if (j==1) { ierr = MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);CHKERRQ(ierr); } } /* south */ pu = 0.5 - cst*(PetscReal)(i+j-3); if (j>1) { ierr = MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);CHKERRQ(ierr); } /* west */ if (i>1) { ierr = MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);CHKERRQ(ierr); } } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex11.c0000644000175000017500000001225112211062077021600 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Computes the smallest nonzero eigenvalue of the Laplacian of a graph.\n\n" "This example illustrates EPSSetDeflationSpace(). The example graph corresponds to a " "2-D regular mesh. The command line options are:\n" " -n , where = number of grid subdivisions in x dimension.\n" " -m , where = number of grid subdivisions in y dimension.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main (int argc,char **argv) { EPS eps; /* eigenproblem solver context */ Mat A; /* operator matrix */ Vec x; EPSType type; PetscInt N,n=10,m,i,j,II,Istart,Iend,nev; PetscScalar w; PetscBool flag; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nFiedler vector of a 2-D regular mesh, N=%D (%Dx%D grid)\n\n",N,n,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx In this example, A = L(G), where L is the Laplacian of graph G, i.e. Lii = degree of node i, Lij = -1 if edge (i,j) exists in G - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(A,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); w=w+1.0; } if (i0) { ierr = MatSetValue(A,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); w=w+1.0; } if (j. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves the same problem as in ex5, but with a user-defined sorting criterion." "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n" "This example illustrates how the user can set a custom spectrum selection.\n\n" "The command line options are:\n" " -m , where = number of grid subdivisions in each dimension.\n\n"; #include /* User-defined routines */ PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx); PetscErrorCode MatMarkovModel(PetscInt m,Mat A); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Vec v0; /* initial vector */ Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscScalar target=0.5; PetscInt N,m=15,nev; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); N = m*(m+1)/2; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n",N,m);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-target",&target,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Searching closest eigenvalues to the right of %G.\n\n",target);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatMarkovModel(m,A);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); /* Set the custom comparing routine in order to obtain the eigenvalues closest to the target on the right only */ ierr = EPSSetEigenvalueComparison(eps,MyEigenSort,&target);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* Set the initial vector. This is optional, if not done the initial vector is set to random values */ ierr = MatGetVecs(A,&v0,NULL);CHKERRQ(ierr); ierr = VecSet(v0,1.0);CHKERRQ(ierr); ierr = EPSSetInitialSpace(eps,1,&v0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = VecDestroy(&v0);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMarkovModel" /* Matrix generator for a Markov model of a random walk on a triangular grid. This subroutine generates a test matrix that models a random walk on a triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a FORTRAN subroutine to calculate the dominant invariant subspaces of a real matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295 (1980) ]. These matrices provide reasonably easy test problems for eigenvalue algorithms. The transpose of the matrix is stochastic and so it is known that one is an exact eigenvalue. One seeks the eigenvector of the transpose associated with the eigenvalue unity. The problem is to calculate the steady state probability distribution of the system, which is the eigevector associated with the eigenvalue one and scaled in such a way that the sum all the components is equal to one. Note: the code will actually compute the transpose of the stochastic matrix that contains the transition probabilities. */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A) { const PetscReal cst = 0.5/(PetscReal)(m-1); PetscReal pd,pu; PetscInt Istart,Iend,i,j,jmax,ix=0; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=1;i<=m;i++) { jmax = m-i+1; for (j=1;j<=jmax;j++) { ix = ix + 1; if (ix-1Iend) continue; /* compute only owned rows */ if (j!=jmax) { pd = cst*(PetscReal)(i+j-1); /* north */ if (i==1) { ierr = MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);CHKERRQ(ierr); } /* east */ if (j==1) { ierr = MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);CHKERRQ(ierr); } } /* south */ pu = 0.5 - cst*(PetscReal)(i+j-3); if (j>1) { ierr = MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);CHKERRQ(ierr); } /* west */ if (i>1) { ierr = MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);CHKERRQ(ierr); } } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MyEigenSort" /* Function for user-defined eigenvalue ordering criterion. Given two eigenvalues ar+i*ai and br+i*bi, the subroutine must choose one of them as the preferred one according to the criterion. In this example, the preferred value is the one closest to the target, but on the right side. */ PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx) { PetscScalar target = *(PetscScalar*)ctx; PetscReal da,db; PetscBool aisright,bisright; PetscFunctionBeginUser; if (PetscRealPart(target) < PetscRealPart(ar)) aisright = PETSC_TRUE; else aisright = PETSC_FALSE; if (PetscRealPart(target) < PetscRealPart(br)) bisright = PETSC_TRUE; else bisright = PETSC_FALSE; if (aisright == bisright) { /* both are on the same side of the target */ da = SlepcAbsEigenvalue(ar-target,ai); db = SlepcAbsEigenvalue(br-target,bi); if (da < db) *r = -1; else if (da > db) *r = 1; else *r = 0; } else if (aisright && !bisright) *r = -1; /* 'a' is on the right */ else *r = 1; /* 'b' is on the right */ PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex5.c0000644000175000017500000001535712211062077021535 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Eigenvalue problem associated with a Markov model of a random walk on a triangular grid. " "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n" "This example illustrates how the user can set the initial vector.\n\n" "The command line options are:\n" " -m , where = number of grid subdivisions in each dimension.\n\n"; #include /* User-defined routines */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Vec v0; /* initial vector */ Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscInt N,m=15,nev; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); N = m*(m+1)/2; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n\n",N,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatMarkovModel(m,A);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* Set the initial vector. This is optional, if not done the initial vector is set to random values */ ierr = MatGetVecs(A,&v0,NULL);CHKERRQ(ierr); ierr = VecSet(v0,1.0);CHKERRQ(ierr); ierr = EPSSetInitialSpace(eps,1,&v0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = VecDestroy(&v0);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMarkovModel" /* Matrix generator for a Markov model of a random walk on a triangular grid. This subroutine generates a test matrix that models a random walk on a triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a FORTRAN subroutine to calculate the dominant invariant subspaces of a real matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295 (1980) ]. These matrices provide reasonably easy test problems for eigenvalue algorithms. The transpose of the matrix is stochastic and so it is known that one is an exact eigenvalue. One seeks the eigenvector of the transpose associated with the eigenvalue unity. The problem is to calculate the steady state probability distribution of the system, which is the eigevector associated with the eigenvalue one and scaled in such a way that the sum all the components is equal to one. Note: the code will actually compute the transpose of the stochastic matrix that contains the transition probabilities. */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A) { const PetscReal cst = 0.5/(PetscReal)(m-1); PetscReal pd,pu; PetscInt Istart,Iend,i,j,jmax,ix=0; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=1;i<=m;i++) { jmax = m-i+1; for (j=1;j<=jmax;j++) { ix = ix + 1; if (ix-1Iend) continue; /* compute only owned rows */ if (j!=jmax) { pd = cst*(PetscReal)(i+j-1); /* north */ if (i==1) { ierr = MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);CHKERRQ(ierr); } /* east */ if (j==1) { ierr = MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);CHKERRQ(ierr); } } /* south */ pu = 0.5 - cst*(PetscReal)(i+j-3); if (j>1) { ierr = MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);CHKERRQ(ierr); } /* west */ if (i>1) { ierr = MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);CHKERRQ(ierr); } } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex9.c0000644000175000017500000002421212211062077021527 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves a problem associated to the Brusselator wave model in chemical reactions, illustrating the use of shell matrices.\n\n" "The command line options are:\n" " -n , where = block dimension of the 2x2 block matrix.\n" " -L , where = bifurcation parameter.\n" " -alpha , -beta , -delta1 , -delta2 ,\n" " where = model parameters.\n\n"; #include /* This example computes the eigenvalues with largest real part of the following matrix A = [ tau1*T+(beta-1)*I alpha^2*I -beta*I tau2*T-alpha^2*I ], where T = tridiag{1,-2,1} h = 1/(n+1) tau1 = delta1/(h*L)^2 tau2 = delta2/(h*L)^2 */ /* Matrix operations */ PetscErrorCode MatMult_Brussel(Mat,Vec,Vec); PetscErrorCode MatShift_Brussel(PetscScalar*,Mat); PetscErrorCode MatGetDiagonal_Brussel(Mat,Vec); typedef struct { Mat T; Vec x1,x2,y1,y2; PetscScalar alpha,beta,tau1,tau2,sigma; } CTX_BRUSSEL; #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* eigenvalue problem matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscScalar delta1,delta2,L,h,value[3]; PetscInt N=30,n,i,col[3],Istart,Iend,nev; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; CTX_BRUSSEL *ctx; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&N,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nBrusselator wave model, n=%D\n\n",N);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Generate the matrix - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create shell matrix context and set default parameters */ ierr = PetscNew(CTX_BRUSSEL,&ctx);CHKERRQ(ierr); ctx->alpha = 2.0; ctx->beta = 5.45; delta1 = 0.008; delta2 = 0.004; L = 0.51302; /* Look the command line for user-provided parameters */ ierr = PetscOptionsGetScalar(NULL,"-L",&L,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-alpha",&ctx->alpha,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-beta",&ctx->beta,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-delta1",&delta1,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-delta2",&delta2,NULL);CHKERRQ(ierr); /* Create matrix T */ ierr = MatCreate(PETSC_COMM_WORLD,&ctx->T);CHKERRQ(ierr); ierr = MatSetSizes(ctx->T,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(ctx->T);CHKERRQ(ierr); ierr = MatSetUp(ctx->T);CHKERRQ(ierr); ierr = MatGetOwnershipRange(ctx->T,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==N) LastBlock=PETSC_TRUE; value[0]=1.0; value[1]=-2.0; value[2]=1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(ctx->T,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=N-1; col[0]=N-2; col[1]=N-1; ierr = MatSetValues(ctx->T,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=-2.0; value[1]=1.0; ierr = MatSetValues(ctx->T,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(ctx->T,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(ctx->T,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->T,&n,NULL);CHKERRQ(ierr); /* Fill the remaining information in the shell matrix context and create auxiliary vectors */ h = 1.0 / (PetscReal)(N+1); ctx->tau1 = delta1 / ((h*L)*(h*L)); ctx->tau2 = delta2 / ((h*L)*(h*L)); ctx->sigma = 0.0; ierr = VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->x1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->x2);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->y1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PETSC_COMM_WORLD,1,n,PETSC_DECIDE,NULL,&ctx->y2);CHKERRQ(ierr); /* Create the shell matrix */ ierr = MatCreateShell(PETSC_COMM_WORLD,2*n,2*n,2*N,2*N,(void*)ctx,&A);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_MULT,(void(*)())MatMult_Brussel);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_SHIFT,(void(*)())MatShift_Brussel);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Brussel);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); /* Ask for the rightmost eigenvalues */ ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL);CHKERRQ(ierr); /* Set other solver options at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = MatDestroy(&ctx->T);CHKERRQ(ierr); ierr = VecDestroy(&ctx->x1);CHKERRQ(ierr); ierr = VecDestroy(&ctx->x2);CHKERRQ(ierr); ierr = VecDestroy(&ctx->y1);CHKERRQ(ierr); ierr = VecDestroy(&ctx->y2);CHKERRQ(ierr); ierr = PetscFree(ctx);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMult_Brussel" PetscErrorCode MatMult_Brussel(Mat A,Vec x,Vec y) { PetscInt n; const PetscScalar *px; PetscScalar *py; CTX_BRUSSEL *ctx; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->T,&n,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+n);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+n);CHKERRQ(ierr); ierr = MatMult(ctx->T,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,ctx->tau1);CHKERRQ(ierr); ierr = VecAXPY(ctx->y1,ctx->beta - 1.0 + ctx->sigma,ctx->x1);CHKERRQ(ierr); ierr = VecAXPY(ctx->y1,ctx->alpha * ctx->alpha,ctx->x2);CHKERRQ(ierr); ierr = MatMult(ctx->T,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->tau2);CHKERRQ(ierr); ierr = VecAXPY(ctx->y2,-ctx->beta,ctx->x1);CHKERRQ(ierr); ierr = VecAXPY(ctx->y2,-ctx->alpha * ctx->alpha + ctx->sigma,ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatShift_Brussel" PetscErrorCode MatShift_Brussel(PetscScalar* a,Mat Y) { CTX_BRUSSEL *ctx; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatShellGetContext(Y,(void**)&ctx);CHKERRQ(ierr); ctx->sigma += *a; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Brussel" PetscErrorCode MatGetDiagonal_Brussel(Mat A,Vec diag) { Vec d1,d2; PetscInt n; PetscScalar *pd; MPI_Comm comm; CTX_BRUSSEL *ctx; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = PetscObjectGetComm((PetscObject)A,&comm);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->T,&n,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(comm,1,n,PETSC_DECIDE,pd,&d1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(comm,1,n,PETSC_DECIDE,pd+n,&d2);CHKERRQ(ierr); ierr = VecSet(d1,-2.0*ctx->tau1 + ctx->beta - 1.0 + ctx->sigma);CHKERRQ(ierr); ierr = VecSet(d2,-2.0*ctx->tau2 - ctx->alpha*ctx->alpha + ctx->sigma);CHKERRQ(ierr); ierr = VecDestroy(&d1);CHKERRQ(ierr); ierr = VecDestroy(&d2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex1f.F0000644000175000017500000001546612211062077021643 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n ex1f [-help] [-n ] [all SLEPc options] ! ! Description: Simple example that solves an eigensystem with the EPS object. ! The standard symmetric eigenvalue problem to be solved corresponds to the ! Laplacian operator in 1 dimension. ! ! The command line options are: ! -n , where = number of grid points = matrix size ! ! ---------------------------------------------------------------------- ! program main implicit none #include #include #include #include #include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! A operator matrix ! eps eigenproblem solver context Mat A EPS eps EPSType tname PetscReal tol, error PetscScalar kr, ki PetscInt n, i, Istart, Iend PetscInt nev, maxit, its, nconv PetscInt col(3) PetscInt i1,i2,i3 PetscMPIInt rank PetscErrorCode ierr PetscBool flg PetscScalar value(3) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) n = 30 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr) if (rank .eq. 0) then write(*,100) n endif 100 format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)') ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Compute the operator matrix that defines the eigensystem, Ax=kx ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call MatCreate(PETSC_COMM_WORLD,A,ierr) call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr) call MatSetFromOptions(A,ierr) call MatSetUp(A,ierr) i1 = 1 i2 = 2 i3 = 3 call MatGetOwnershipRange(A,Istart,Iend,ierr) if (Istart .eq. 0) then i = 0 col(1) = 0 col(2) = 1 value(1) = 2.0 value(2) = -1.0 call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr) Istart = Istart+1 endif if (Iend .eq. n) then i = n-1 col(1) = n-2 col(2) = n-1 value(1) = -1.0 value(2) = 2.0 call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr) Iend = Iend-1 endif value(1) = -1.0 value(2) = 2.0 value(3) = -1.0 do i=Istart,Iend-1 col(1) = i-1 col(2) = i col(3) = i+1 call MatSetValues(A,i1,i,i3,col,value,INSERT_VALUES,ierr) enddo call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the eigensolver and display info ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create eigensolver context call EPSCreate(PETSC_COMM_WORLD,eps,ierr) ! ** Set operators. In this case, it is a standard eigenvalue problem call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr) call EPSSetProblemType(eps,EPS_HEP,ierr) ! ** Set solver parameters at runtime call EPSSetFromOptions(eps,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the eigensystem ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSSolve(eps,ierr) call EPSGetIterationNumber(eps,its,ierr) if (rank .eq. 0) then write(*,110) its endif 110 format (/' Number of iterations of the method:',I4) ! ** Optional: Get some information from the solver and display it call EPSGetType(eps,tname,ierr) if (rank .eq. 0) then write(*,120) tname endif 120 format (' Solution method: ',A) call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,130) nev endif 130 format (' Number of requested eigenvalues:',I2) call EPSGetTolerances(eps,tol,maxit,ierr) if (rank .eq. 0) then write(*,140) tol, maxit endif 140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Get number of converged eigenpairs call EPSGetConverged(eps,nconv,ierr) if (rank .eq. 0) then write(*,150) nconv endif 150 format (' Number of converged eigenpairs:',I2/) ! ** Display eigenvalues and relative errors if (nconv.gt.0) then if (rank .eq. 0) then write(*,*) ' k ||Ax-kx||/||kx||' write(*,*) ' ----------------- ------------------' endif do i=0,nconv-1 ! ** Get converged eigenpairs: i-th eigenvalue is stored in kr ! ** (real part) and ki (imaginary part) call EPSGetEigenpair(eps,i,kr,ki,PETSC_NULL_OBJECT, & & PETSC_NULL_OBJECT,ierr) ! ** Compute the relative error associated to each eigenpair call EPSComputeRelativeError(eps,i,error,ierr) if (rank .eq. 0) then write(*,160) PetscRealPart(kr), error endif 160 format (1P,' ',E12.4,' ',E12.4) enddo if (rank .eq. 0) then write(*,*) endif endif ! ** Free work space call EPSDestroy(eps,ierr) call MatDestroy(A,ierr) call SlepcFinalize(ierr) end slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex12.c.html0000644000175000017500000005013012211062077022542 0ustar gladkgladk
Actual source code: ex12.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves the same eigenproblem as in example ex5, but computing also left eigenvectors. "
 23:   "It is a Markov model of a random walk on a triangular grid. "
 24:   "A standard nonsymmetric eigenproblem with real eigenvalues. The rightmost eigenvalue is known to be 1.\n\n"
 25:   "The command line options are:\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in each dimension.\n\n";

 28: #include <slepceps.h>

 30: /*
 31:    User-defined routines
 32: */
 33: PetscErrorCode MatMarkovModel(PetscInt m,Mat A);

 37: int main (int argc,char **argv)
 38: {
 39:   Vec            v0,w0;           /* initial vector */
 40:   Vec            *X,*Y;           /* right and left eigenvectors */
 41:   Mat            A;               /* operator matrix */
 42:   EPS            eps;             /* eigenproblem solver context */
 43:   EPSType        type;
 44:   PetscReal      error1,error2,tol,re,im;
 45:   PetscScalar    kr,ki;
 46:   PetscInt       nev,maxit,i,its,nconv,N,m=15;

 49:   SlepcInitialize(&argc,&argv,(char*)0,help);

 51:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 52:   N = m*(m+1)/2;
 53:   PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n\n",N,m);

 55:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 56:      Compute the operator matrix that defines the eigensystem, Ax=kx
 57:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 59:   MatCreate(PETSC_COMM_WORLD,&A);
 60:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 61:   MatSetFromOptions(A);
 62:   MatSetUp(A);
 63:   MatMarkovModel(m,A);

 65:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 66:                 Create the eigensolver and set various options
 67:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 69:   /*
 70:      Create eigensolver context
 71:   */
 72:   EPSCreate(PETSC_COMM_WORLD,&eps);

 74:   /*
 75:      Set operators. In this case, it is a standard eigenvalue problem.
 76:      Request also left eigenvectors
 77:   */
 78:   EPSSetOperators(eps,A,NULL);
 79:   EPSSetProblemType(eps,EPS_NHEP);
 80:   EPSSetLeftVectorsWanted(eps,PETSC_TRUE);

 82:   /*
 83:      Set solver parameters at runtime
 84:   */
 85:   EPSSetFromOptions(eps);

 87:   /*
 88:      Set the initial vector. This is optional, if not done the initial
 89:      vector is set to random values
 90:   */
 91:   MatGetVecs(A,&v0,&w0);
 92:   VecSet(v0,1.0);
 93:   MatMult(A,v0,w0);
 94:   EPSSetInitialSpace(eps,1,&v0);
 95:   EPSSetInitialSpaceLeft(eps,1,&w0);

 97:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 98:                       Solve the eigensystem
 99:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

101:   EPSSolve(eps);
102:   EPSGetIterationNumber(eps,&its);
103:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);

105:   /*
106:      Optional: Get some information from the solver and display it
107:   */
108:   EPSGetType(eps,&type);
109:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
110:   EPSGetDimensions(eps,&nev,NULL,NULL);
111:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
112:   EPSGetTolerances(eps,&tol,&maxit);
113:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

115:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116:                     Display solution and clean up
117:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

119:   /*
120:      Get number of converged approximate eigenpairs
121:   */
122:   EPSGetConverged(eps,&nconv);
123:   PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);

125:   if (nconv>0) {
126:     /*
127:        Display eigenvalues and relative errors
128:     */
129:     PetscPrintf(PETSC_COMM_WORLD,
130:          "           k          ||Ax-kx||/||kx||   ||y'A-ky'||/||ky||\n"
131:          "   ----------------- ------------------ --------------------\n");

133:     for (i=0;i<nconv;i++) {
134:       /*
135:         Get converged eigenpairs: i-th eigenvalue is stored in kr (real part) and
136:         ki (imaginary part)
137:       */
138:       EPSGetEigenvalue(eps,i,&kr,&ki);
139:       /*
140:          Compute the relative errors associated to both right and left eigenvectors
141:       */
142:       EPSComputeRelativeError(eps,i,&error1);
143:       EPSComputeRelativeErrorLeft(eps,i,&error2);

145: #if defined(PETSC_USE_COMPLEX)
146:       re = PetscRealPart(kr);
147:       im = PetscImaginaryPart(kr);
148: #else
149:       re = kr;
150:       im = ki;
151: #endif
152:       if (im!=0.0) {
153:         PetscPrintf(PETSC_COMM_WORLD," %9F%+9F j %12G%12G\n",re,im,error1,error2);
154:       } else {
155:         PetscPrintf(PETSC_COMM_WORLD,"   %12F       %12G       %12G\n",re,error1,error2);
156:       }
157:     }
158:     PetscPrintf(PETSC_COMM_WORLD,"\n");

160:     VecDuplicateVecs(v0,nconv,&X);
161:     VecDuplicateVecs(w0,nconv,&Y);
162:     for (i=0;i<nconv;i++) {
163:       EPSGetEigenvector(eps,i,X[i],NULL);
164:       EPSGetEigenvectorLeft(eps,i,Y[i],NULL);
165:     }
166:     PetscPrintf(PETSC_COMM_WORLD,
167:          "                   Bi-orthogonality <x,y>                   \n"
168:          "   ---------------------------------------------------------\n");

170:     SlepcCheckOrthogonality(X,nconv,Y,nconv,NULL,NULL,NULL);
171:     PetscPrintf(PETSC_COMM_WORLD,"\n");
172:     VecDestroyVecs(nconv,&X);
173:     VecDestroyVecs(nconv,&Y);

175:   }

177:   /*
178:      Free work space
179:   */
180:   VecDestroy(&v0);
181:   VecDestroy(&w0);
182:   EPSDestroy(&eps);
183:   MatDestroy(&A);
184:   SlepcFinalize();
185:   return 0;
186: }

190: /*
191:     Matrix generator for a Markov model of a random walk on a triangular grid.

193:     This subroutine generates a test matrix that models a random walk on a
194:     triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a
195:     FORTRAN subroutine to calculate the dominant invariant subspaces of a real
196:     matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few
197:     papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295
198:     (1980) ]. These matrices provide reasonably easy test problems for eigenvalue
199:     algorithms. The transpose of the matrix  is stochastic and so it is known
200:     that one is an exact eigenvalue. One seeks the eigenvector of the transpose
201:     associated with the eigenvalue unity. The problem is to calculate the steady
202:     state probability distribution of the system, which is the eigevector
203:     associated with the eigenvalue one and scaled in such a way that the sum all
204:     the components is equal to one.
205:     Note: the code will actually compute the transpose of the stochastic matrix
206:     that contains the transition probabilities.
207: */
208: PetscErrorCode MatMarkovModel(PetscInt m,Mat A)
209: {
210:   const PetscReal cst = 0.5/(PetscReal)(m-1);
211:   PetscReal       pd,pu;
212:   PetscInt        i,j,jmax,ix=0,Istart,Iend;
213:   PetscErrorCode  ierr;

216:   MatGetOwnershipRange(A,&Istart,&Iend);
217:   for (i=1;i<=m;i++) {
218:     jmax = m-i+1;
219:     for (j=1;j<=jmax;j++) {
220:       ix = ix + 1;
221:       if (ix-1<Istart || ix>Iend) continue;  /* compute only owned rows */
222:       if (j!=jmax) {
223:         pd = cst*(PetscReal)(i+j-1);
224:         /* north */
225:         if (i==1) {
226:           MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);
227:         } else {
228:           MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);
229:         }
230:         /* east */
231:         if (j==1) {
232:           MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);
233:         } else {
234:           MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);
235:         }
236:       }
237:       /* south */
238:       pu = 0.5 - cst*(PetscReal)(i+j-3);
239:       if (j>1) {
240:         MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);
241:       }
242:       /* west */
243:       if (i>1) {
244:         MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);
245:       }
246:     }
247:   }
248:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
249:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
250:   return(0);
251: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex2.c.html0000644000175000017500000002220012211062077022456 0ustar gladkgladk
Actual source code: ex2.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Standard symmetric eigenproblem corresponding to the Laplacian operator in 2 dimensions.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions in x dimension.\n"
 25:   "  -m <m>, where <m> = number of grid subdivisions in y dimension.\n\n";

 27: #include <slepceps.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;               /* operator matrix */
 34:   EPS            eps;             /* eigenproblem solver context */
 35:   EPSType        type;
 36:   PetscInt       N,n=10,m,Istart,Iend,II,nev,i,j;
 37:   PetscBool      flag;

 40:   SlepcInitialize(&argc,&argv,(char*)0,help);

 42:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 43:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 44:   if (!flag) m=n;
 45:   N = n*m;
 46:   PetscPrintf(PETSC_COMM_WORLD,"\n2-D Laplacian Eigenproblem, N=%D (%Dx%D grid)\n\n",N,n,m);

 48:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 49:      Compute the operator matrix that defines the eigensystem, Ax=kx
 50:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 52:   MatCreate(PETSC_COMM_WORLD,&A);
 53:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 54:   MatSetFromOptions(A);
 55:   MatSetUp(A);

 57:   MatGetOwnershipRange(A,&Istart,&Iend);
 58:   for (II=Istart;II<Iend;II++) {
 59:     i = II/n; j = II-i*n;
 60:     if (i>0) { MatSetValue(A,II,II-n,-1.0,INSERT_VALUES); }
 61:     if (i<m-1) { MatSetValue(A,II,II+n,-1.0,INSERT_VALUES); }
 62:     if (j>0) { MatSetValue(A,II,II-1,-1.0,INSERT_VALUES); }
 63:     if (j<n-1) { MatSetValue(A,II,II+1,-1.0,INSERT_VALUES); }
 64:     MatSetValue(A,II,II,4.0,INSERT_VALUES);
 65:   }

 67:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 68:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 70:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 71:                 Create the eigensolver and set various options
 72:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 74:   /*
 75:      Create eigensolver context
 76:   */
 77:   EPSCreate(PETSC_COMM_WORLD,&eps);

 79:   /*
 80:      Set operators. In this case, it is a standard eigenvalue problem
 81:   */
 82:   EPSSetOperators(eps,A,NULL);
 83:   EPSSetProblemType(eps,EPS_HEP);

 85:   /*
 86:      Set solver parameters at runtime
 87:   */
 88:   EPSSetFromOptions(eps);

 90:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 91:                       Solve the eigensystem
 92:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 94:   EPSSolve(eps);

 96:   /*
 97:      Optional: Get some information from the solver and display it
 98:   */
 99:   EPSGetType(eps,&type);
100:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
101:   EPSGetDimensions(eps,&nev,NULL,NULL);
102:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

104:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
105:                     Display solution and clean up
106:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

108:   EPSPrintSolution(eps,NULL);
109:   EPSDestroy(&eps);
110:   MatDestroy(&A);
111:   SlepcFinalize();
112:   return 0;
113: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex19.c.html0000644000175000017500000004624712211062077022567 0ustar gladkgladk
Actual source code: ex19.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Standard symmetric eigenproblem for the 3-D Laplacian built with the DM interface.\n\n"
 23: "Use -seed <k> to modify the random initial vector.\n"
 24: "Use -da_grid_x <nx> etc. to change the problem size.\n\n";

 26: #include <slepceps.h>
 27: #include <petscdmda.h>
 28: #include <petsctime.h>

 32: PetscErrorCode GetExactEigenvalues(PetscInt M,PetscInt N,PetscInt P,PetscInt nconv,PetscReal *exact)
 33: {
 34:   PetscInt       n,i,j,k,l;
 35:   PetscReal      *evals,ax,ay,az,sx,sy,sz;

 39:   ax = PETSC_PI/2/(M+1);
 40:   ay = PETSC_PI/2/(N+1);
 41:   az = PETSC_PI/2/(P+1);
 42:   n = ceil(PetscPowReal(nconv,0.33333)+1);
 43:   PetscMalloc(n*n*n*sizeof(PetscReal),&evals);
 44:   l = 0;
 45:   for (i=1;i<=n;i++) {
 46:     sx = sin(ax*i);
 47:     for (j=1;j<=n;j++) {
 48:       sy = sin(ay*j);
 49:       for (k=1;k<=n;k++) {
 50:         sz = sin(az*k);
 51:         evals[l++] = 4.0*(sx*sx+sy*sy+sz*sz);
 52:       }
 53:     }
 54:   }
 55:   PetscSortReal(n*n*n,evals);
 56:   for (i=0;i<nconv;i++) exact[i] = evals[i];
 57:   PetscFree(evals);
 58:   return(0);
 59: }

 63: PetscErrorCode FillMatrix(DM da,Mat A)
 64: {
 66:   PetscInt       i,j,k,mx,my,mz,xm,ym,zm,xs,ys,zs,idx;
 67:   PetscScalar    v[7];
 68:   MatStencil     row,col[7];

 71:   DMDAGetInfo(da,0,&mx,&my,&mz,0,0,0,0,0,0,0,0,0);
 72:   DMDAGetCorners(da,&xs,&ys,&zs,&xm,&ym,&zm);

 74:   for (k=zs;k<zs+zm;k++) {
 75:     for (j=ys;j<ys+ym;j++) {
 76:       for (i=xs;i<xs+xm;i++) {
 77:         row.i=i; row.j=j; row.k=k;
 78:         col[0].i=row.i; col[0].j=row.j; col[0].k=row.k;
 79:         v[0]=6.0;
 80:         idx=1;
 81:         if (k>0) { v[idx]=-1.0; col[idx].i=i; col[idx].j=j; col[idx].k=k-1; idx++; }
 82:         if (j>0) { v[idx]=-1.0; col[idx].i=i; col[idx].j=j-1; col[idx].k=k; idx++; }
 83:         if (i>0) { v[idx]=-1.0; col[idx].i=i-1; col[idx].j=j; col[idx].k=k; idx++; }
 84:         if (i<mx-1) { v[idx]=-1.0; col[idx].i=i+1; col[idx].j=j; col[idx].k=k; idx++; }
 85:         if (j<my-1) { v[idx]=-1.0; col[idx].i=i; col[idx].j=j+1; col[idx].k=k; idx++; }
 86:         if (k<mz-1) { v[idx]=-1.0; col[idx].i=i; col[idx].j=j; col[idx].k=k+1; idx++; }
 87:         MatSetValuesStencil(A,1,&row,idx,col,v,INSERT_VALUES);
 88:       }
 89:     }
 90:   }
 91:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 92:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
 93:   return(0);
 94: }

 98: int main(int argc,char **argv)
 99: {
100:   Mat            A;               /* operator matrix */
101:   EPS            eps;             /* eigenproblem solver context */
102:   EPSType        type;
103:   DM             da;
104:   Vec            v0;
105:   PetscReal      error,tol,re,im,*exact;
106:   PetscScalar    kr,ki;
107:   PetscInt       M,N,P,m,n,p,nev,maxit,i,its,nconv,seed;
108:   PetscLogDouble t1,t2,t3;
109:   PetscBool      flg;
110:   PetscRandom    rctx;

113:   SlepcInitialize(&argc,&argv,(char*)0,help);

115:   PetscPrintf(PETSC_COMM_WORLD,"\n3-D Laplacian Eigenproblem\n\n");

117:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
118:      Compute the operator matrix that defines the eigensystem, Ax=kx
119:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

121:   DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,
122:                       DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-10,-10,-10,
123:                       PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,
124:                       1,1,NULL,NULL,NULL,&da);

126:   /* print DM information */
127:   DMDAGetInfo(da,NULL,&M,&N,&P,&m,&n,&p,NULL,NULL,NULL,NULL,NULL,NULL);
128:   PetscPrintf(PETSC_COMM_WORLD," Grid partitioning: %D %D %D\n",m,n,p);

130:   /* create and fill the matrix */
131:   DMCreateMatrix(da,MATAIJ,&A);
132:   FillMatrix(da,A);

134:   /* create random initial vector */
135:   seed = 1;
136:   PetscOptionsGetInt(NULL,"-seed",&seed,NULL);
137:   if (seed<0) SETERRQ(PETSC_COMM_WORLD,1,"Seed must be >=0");
138:   MatGetVecs(A,&v0,NULL);
139:   PetscRandomCreate(PETSC_COMM_WORLD,&rctx);
140:   PetscRandomSetFromOptions(rctx);
141:   for (i=0;i<seed;i++) {   /* simulate different seeds in the random generator */
142:     VecSetRandom(v0,rctx);
143:   }

145:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
146:                 Create the eigensolver and set various options
147:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

149:   /*
150:      Create eigensolver context
151:   */
152:   EPSCreate(PETSC_COMM_WORLD,&eps);

154:   /*
155:      Set operators. In this case, it is a standard eigenvalue problem
156:   */
157:   EPSSetOperators(eps,A,NULL);
158:   EPSSetProblemType(eps,EPS_HEP);

160:   /*
161:      Set specific solver options
162:   */
163:   EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);
164:   EPSSetTolerances(eps,1e-8,PETSC_DEFAULT);
165:   EPSSetInitialSpace(eps,1,&v0);

167:   /*
168:      Set solver parameters at runtime
169:   */
170:   EPSSetFromOptions(eps);

172:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
173:                       Solve the eigensystem
174:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

176:   PetscTime(&t1);
177:   EPSSetUp(eps);
178:   PetscTime(&t2);
179:   EPSSolve(eps);
180:   PetscTime(&t3);
181:   EPSGetIterationNumber(eps,&its);
182:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);

184:   /*
185:      Optional: Get some information from the solver and display it
186:   */
187:   EPSGetType(eps,&type);
188:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
189:   EPSGetDimensions(eps,&nev,NULL,NULL);
190:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
191:   EPSGetTolerances(eps,&tol,&maxit);
192:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

194:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
195:                     Display solution and clean up
196:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

198:   /*
199:      Get number of converged approximate eigenpairs
200:   */
201:   EPSGetConverged(eps,&nconv);
202:   PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate eigenpairs: %D\n\n",nconv);

204:   if (nconv>0) {
205:     PetscMalloc(nconv*sizeof(PetscReal),&exact);
206:     GetExactEigenvalues(M,N,P,nconv,exact);
207:     /*
208:        Display eigenvalues and relative errors
209:     */
210:     PetscPrintf(PETSC_COMM_WORLD,
211:          "           k          ||Ax-kx||/||kx||   Eigenvalue Error \n"
212:          "   ----------------- ------------------ ------------------\n");

214:     for (i=0;i<nconv;i++) {
215:       /*
216:         Get converged eigenpairs: i-th eigenvalue is stored in kr (real part) and
217:         ki (imaginary part)
218:       */
219:       EPSGetEigenpair(eps,i,&kr,&ki,NULL,NULL);
220:       /*
221:          Compute the relative error associated to each eigenpair
222:       */
223:       EPSComputeRelativeError(eps,i,&error);

225: #if defined(PETSC_USE_COMPLEX)
226:       re = PetscRealPart(kr);
227:       im = PetscImaginaryPart(kr);
228: #else
229:       re = kr;
230:       im = ki;
231: #endif
232:       if (im!=0.0) SETERRQ(PETSC_COMM_WORLD,1,"Eigenvalue should be real");
233:       else {
234:         PetscPrintf(PETSC_COMM_WORLD,"   %12G       %12G        %12G\n",re,error,PetscAbsReal(re-exact[i]));
235:       }
236:     }
237:     PetscFree(exact);
238:     PetscPrintf(PETSC_COMM_WORLD,"\n");
239:   }

241:   /*
242:      Show computing times
243:   */
244:   PetscOptionsHasName(NULL,"-showtimes",&flg);
245:   if (flg) {
246:     PetscPrintf(PETSC_COMM_WORLD," Elapsed time: %G (setup), %G (solve)\n",t2-t1,t3-t2);
247:   }

249:   /*
250:      Free work space
251:   */
252:   EPSDestroy(&eps);
253:   MatDestroy(&A);
254:   VecDestroy(&v0);
255:   PetscRandomDestroy(&rctx);
256:   DMDestroy(&da);
257:   SlepcFinalize();
258:   return 0;
259: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex13.c0000644000175000017500000001324312211062077021604 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Generalized Symmetric eigenproblem.\n\n" "The problem is Ax = lambda Bx, with:\n" " A = Laplacian operator in 2-D\n" " B = diagonal matrix with all values equal to 4 except nulldim zeros\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions in x dimension.\n" " -m , where = number of grid subdivisions in y dimension.\n" " -nulldim , where = dimension of the nullspace of B.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,B; /* matrices */ EPS eps; /* eigenproblem solver context */ ST st; /* spectral transformation context */ EPSType type; PetscInt N,n=10,m,Istart,Iend,II,nev,i,j,nulldim=0; PetscBool flag; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscOptionsGetInt(NULL,"-nulldim",&nulldim,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nGeneralized Symmetric Eigenproblem, N=%D (%Dx%D grid), null(B)=%D\n\n",N,n,m,nulldim);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the matrices that define the eigensystem, Ax=kBx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&B);CHKERRQ(ierr); ierr = MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(B);CHKERRQ(ierr); ierr = MatSetUp(B);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(A,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (i0) { ierr = MatSetValue(A,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (j=nulldim) { ierr = MatSetValue(B,II,II,4.0,INSERT_VALUES);CHKERRQ(ierr); } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a generalized eigenvalue problem */ ierr = EPSSetOperators(eps,A,B);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_GHEP);CHKERRQ(ierr); /* Select portion of spectrum */ ierr = EPSSetTarget(eps,0.0);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr); /* Use shift-and-invert to avoid solving linear systems with a singular B in case nulldim>0 */ ierr = PetscObjectTypeCompareAny((PetscObject)eps,&flag,EPSGD,EPSJD,EPSBLOPEX,"");CHKERRQ(ierr); if (!flag) { ierr = EPSGetST(eps,&st);CHKERRQ(ierr); ierr = STSetType(st,STSINVERT);CHKERRQ(ierr); } /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = MatDestroy(&B);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex13.c.html0000644000175000017500000002726012211062077022553 0ustar gladkgladk
Actual source code: ex13.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Generalized Symmetric eigenproblem.\n\n"
 23:   "The problem is Ax = lambda Bx, with:\n"
 24:   "   A = Laplacian operator in 2-D\n"
 25:   "   B = diagonal matrix with all values equal to 4 except nulldim zeros\n\n"
 26:   "The command line options are:\n"
 27:   "  -n <n>, where <n> = number of grid subdivisions in x dimension.\n"
 28:   "  -m <m>, where <m> = number of grid subdivisions in y dimension.\n"
 29:   "  -nulldim <k>, where <k> = dimension of the nullspace of B.\n\n";

 31: #include <slepceps.h>

 35: int main(int argc,char **argv)
 36: {
 37:   Mat            A,B;         /* matrices */
 38:   EPS            eps;         /* eigenproblem solver context */
 39:   ST             st;          /* spectral transformation context */
 40:   EPSType        type;
 41:   PetscInt       N,n=10,m,Istart,Iend,II,nev,i,j,nulldim=0;
 42:   PetscBool      flag;

 45:   SlepcInitialize(&argc,&argv,(char*)0,help);

 47:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 48:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 49:   if (!flag) m=n;
 50:   N = n*m;
 51:   PetscOptionsGetInt(NULL,"-nulldim",&nulldim,NULL);
 52:   PetscPrintf(PETSC_COMM_WORLD,"\nGeneralized Symmetric Eigenproblem, N=%D (%Dx%D grid), null(B)=%D\n\n",N,n,m,nulldim);

 54:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 55:      Compute the matrices that define the eigensystem, Ax=kBx
 56:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 58:   MatCreate(PETSC_COMM_WORLD,&A);
 59:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 60:   MatSetFromOptions(A);
 61:   MatSetUp(A);

 63:   MatCreate(PETSC_COMM_WORLD,&B);
 64:   MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,N,N);
 65:   MatSetFromOptions(B);
 66:   MatSetUp(B);

 68:   MatGetOwnershipRange(A,&Istart,&Iend);
 69:   for (II=Istart;II<Iend;II++) {
 70:     i = II/n; j = II-i*n;
 71:     if (i>0) { MatSetValue(A,II,II-n,-1.0,INSERT_VALUES); }
 72:     if (i<m-1) { MatSetValue(A,II,II+n,-1.0,INSERT_VALUES); }
 73:     if (j>0) { MatSetValue(A,II,II-1,-1.0,INSERT_VALUES); }
 74:     if (j<n-1) { MatSetValue(A,II,II+1,-1.0,INSERT_VALUES); }
 75:     MatSetValue(A,II,II,4.0,INSERT_VALUES);
 76:     if (II>=nulldim) { MatSetValue(B,II,II,4.0,INSERT_VALUES); }
 77:   }

 79:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 80:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
 81:   MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);
 82:   MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);

 84:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 85:                 Create the eigensolver and set various options
 86:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 88:   /*
 89:      Create eigensolver context
 90:   */
 91:   EPSCreate(PETSC_COMM_WORLD,&eps);

 93:   /*
 94:      Set operators. In this case, it is a generalized eigenvalue problem
 95:   */
 96:   EPSSetOperators(eps,A,B);
 97:   EPSSetProblemType(eps,EPS_GHEP);

 99:   /*
100:      Select portion of spectrum
101:   */
102:   EPSSetTarget(eps,0.0);
103:   EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);

105:   /*
106:      Use shift-and-invert to avoid solving linear systems with a singular B
107:      in case nulldim>0
108:   */
109:   PetscObjectTypeCompareAny((PetscObject)eps,&flag,EPSGD,EPSJD,EPSBLOPEX,"");
110:   if (!flag) {
111:     EPSGetST(eps,&st);
112:     STSetType(st,STSINVERT);
113:   }

115:   /*
116:      Set solver parameters at runtime
117:   */
118:   EPSSetFromOptions(eps);

120:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
121:                       Solve the eigensystem
122:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

124:   EPSSolve(eps);

126:   /*
127:      Optional: Get some information from the solver and display it
128:   */
129:   EPSGetType(eps,&type);
130:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
131:   EPSGetDimensions(eps,&nev,NULL,NULL);
132:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

134:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135:                     Display solution and clean up
136:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

138:   EPSPrintSolution(eps,NULL);
139:   EPSDestroy(&eps);
140:   MatDestroy(&A);
141:   MatDestroy(&B);
142:   SlepcFinalize();
143:   return 0;
144: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tutorials/ex19.c0000644000175000017500000002243612211062077021616 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Standard symmetric eigenproblem for the 3-D Laplacian built with the DM interface.\n\n" "Use -seed to modify the random initial vector.\n" "Use -da_grid_x etc. to change the problem size.\n\n"; #include #include #include #undef __FUNCT__ #define __FUNCT__ "GetExactEigenvalues" PetscErrorCode GetExactEigenvalues(PetscInt M,PetscInt N,PetscInt P,PetscInt nconv,PetscReal *exact) { PetscInt n,i,j,k,l; PetscReal *evals,ax,ay,az,sx,sy,sz; PetscErrorCode ierr; PetscFunctionBeginUser; ax = PETSC_PI/2/(M+1); ay = PETSC_PI/2/(N+1); az = PETSC_PI/2/(P+1); n = ceil(PetscPowReal(nconv,0.33333)+1); ierr = PetscMalloc(n*n*n*sizeof(PetscReal),&evals);CHKERRQ(ierr); l = 0; for (i=1;i<=n;i++) { sx = sin(ax*i); for (j=1;j<=n;j++) { sy = sin(ay*j); for (k=1;k<=n;k++) { sz = sin(az*k); evals[l++] = 4.0*(sx*sx+sy*sy+sz*sz); } } } ierr = PetscSortReal(n*n*n,evals);CHKERRQ(ierr); for (i=0;i0) { v[idx]=-1.0; col[idx].i=i; col[idx].j=j; col[idx].k=k-1; idx++; } if (j>0) { v[idx]=-1.0; col[idx].i=i; col[idx].j=j-1; col[idx].k=k; idx++; } if (i>0) { v[idx]=-1.0; col[idx].i=i-1; col[idx].j=j; col[idx].k=k; idx++; } if (i=0"); ierr = MatGetVecs(A,&v0,NULL);CHKERRQ(ierr); ierr = PetscRandomCreate(PETSC_COMM_WORLD,&rctx);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(rctx);CHKERRQ(ierr); for (i=0;i0) { ierr = PetscMalloc(nconv*sizeof(PetscReal),&exact);CHKERRQ(ierr); ierr = GetExactEigenvalues(M,N,P,nconv,exact);CHKERRQ(ierr); /* Display eigenvalues and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " k ||Ax-kx||/||kx|| Eigenvalue Error \n" " ----------------- ------------------ ------------------\n");CHKERRQ(ierr); for (i=0;i. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/eps/examples/ DIRS = tests tutorials include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/examples/makefile.html0000644000175000017500000000351412211062077021275 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/eps/examples/
DIRS     = tests tutorials

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/0000755000175000017500000000000012214143515017771 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/examples/tests/test6.c.html0000644000175000017500000001632612211062077022155 0ustar gladkgladk
Actual source code: test6.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Diagonal eigenproblem.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions = matrix dimension.\n"
 25:   "  -seed <s>, where <s> = seed for random number generation.\n\n";

 27: #include <slepceps.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;           /* problem matrix */
 34:   EPS            eps;         /* eigenproblem solver context */
 35:   Vec            v0;          /* initial vector */
 36:   PetscRandom    rand;
 37:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 38:   PetscInt       n=30,i,Istart,Iend,seed=0x12345678;

 41:   SlepcInitialize(&argc,&argv,(char*)0,help);

 43:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 44:   PetscPrintf(PETSC_COMM_WORLD,"\nDiagonal Eigenproblem, n=%D\n\n",n);

 46:   MatCreate(PETSC_COMM_WORLD,&A);
 47:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 48:   MatSetFromOptions(A);
 49:   MatSetUp(A);
 50:   MatGetOwnershipRange(A,&Istart,&Iend);
 51:   for (i=Istart;i<Iend;i++) {
 52:     MatSetValue(A,i,i,i+1,INSERT_VALUES);
 53:   }
 54:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 55:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 57:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 58:                       Solve the eigensystem
 59:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 60:   EPSCreate(PETSC_COMM_WORLD,&eps);
 61:   EPSSetOperators(eps,A,NULL);
 62:   EPSSetProblemType(eps,EPS_HEP);
 63:   EPSSetTolerances(eps,tol,PETSC_DECIDE);
 64:   EPSSetFromOptions(eps);
 65:   /* set random initial vector */
 66:   MatGetVecs(A,&v0,NULL);
 67:   PetscRandomCreate(PETSC_COMM_WORLD,&rand);
 68:   PetscRandomSetFromOptions(rand);
 69:   PetscOptionsGetInt(NULL,"-seed",&seed,NULL);
 70:   PetscRandomSetSeed(rand,seed);
 71:   PetscRandomSeed(rand);
 72:   VecSetRandom(v0,rand);
 73:   EPSSetInitialSpace(eps,1,&v0);
 74:   /* call the solver */
 75:   EPSSolve(eps);

 77:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 78:                     Display solution and clean up
 79:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 80:   EPSPrintSolution(eps,NULL);
 81:   EPSDestroy(&eps);
 82:   MatDestroy(&A);
 83:   VecDestroy(&v0);
 84:   PetscRandomDestroy(&rand);
 85:   SlepcFinalize();
 86:   return 0;
 87: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test10.c.html0000644000175000017500000002551112211062077022224 0ustar gladkgladk
Actual source code: test10.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Computes the smallest nonzero eigenvalue of the Laplacian of a graph.\n\n"
 23:   "This example illustrates EPSSetDeflationSpace(). The example graph corresponds to a "
 24:   "2-D regular mesh. The command line options are:\n"
 25:   "  -n <n>, where <n> = number of grid subdivisions in x dimension.\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in y dimension.\n\n";

 28: #include <slepceps.h>

 32: int main (int argc,char **argv)
 33: {
 34:   EPS            eps;             /* eigenproblem solver context */
 35:   Mat            A;               /* operator matrix */
 36:   Vec            x;
 37:   EPSType        type;
 38:   PetscInt       N,n=10,m,i,j,II,Istart,Iend,nev;
 39:   PetscScalar    w;
 40:   PetscBool      flag;

 43:   SlepcInitialize(&argc,&argv,(char*)0,help);

 45:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 46:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 47:   if (!flag) m=n;
 48:   N = n*m;
 49:   PetscPrintf(PETSC_COMM_WORLD,"\nFiedler vector of a 2-D regular mesh, N=%D (%Dx%D grid)\n\n",N,n,m);

 51:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 52:      Compute the operator matrix that defines the eigensystem, Ax=kx
 53:      In this example, A = L(G), where L is the Laplacian of graph G, i.e.
 54:      Lii = degree of node i, Lij = -1 if edge (i,j) exists in G
 55:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 57:   MatCreate(PETSC_COMM_WORLD,&A);
 58:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 59:   MatSetFromOptions(A);
 60:   MatSetUp(A);

 62:   MatGetOwnershipRange(A,&Istart,&Iend);
 63:   for (II=Istart;II<Iend;II++) {
 64:     i = II/n; j = II-i*n;
 65:     w = 0.0;
 66:     if (i>0) { MatSetValue(A,II,II-n,-1.0,INSERT_VALUES); w=w+1.0; }
 67:     if (i<m-1) { MatSetValue(A,II,II+n,-1.0,INSERT_VALUES); w=w+1.0; }
 68:     if (j>0) { MatSetValue(A,II,II-1,-1.0,INSERT_VALUES); w=w+1.0; }
 69:     if (j<n-1) { MatSetValue(A,II,II+1,-1.0,INSERT_VALUES); w=w+1.0; }
 70:     MatSetValue(A,II,II,w,INSERT_VALUES);
 71:   }

 73:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 74:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 76:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 77:                 Create the eigensolver and set various options
 78:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 80:   /*
 81:      Create eigensolver context
 82:   */
 83:   EPSCreate(PETSC_COMM_WORLD,&eps);

 85:   /*
 86:      Set operators. In this case, it is a standard eigenvalue problem
 87:   */
 88:   EPSSetOperators(eps,A,NULL);
 89:   EPSSetProblemType(eps,EPS_HEP);

 91:   /*
 92:      Select portion of spectrum
 93:   */
 94:   EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);

 96:   /*
 97:      Set solver parameters at runtime
 98:   */
 99:   EPSSetFromOptions(eps);

101:   /*
102:      Attach deflation space: in this case, the matrix has a constant
103:      nullspace, [1 1 ... 1]^T is the eigenvector of the zero eigenvalue
104:   */
105:   MatGetVecs(A,&x,NULL);
106:   VecSet(x,1.0);
107:   EPSSetDeflationSpace(eps,1,&x);
108:   VecDestroy(&x);

110:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
111:                       Solve the eigensystem
112:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

114:   EPSSolve(eps);

116:   /*
117:      Optional: Get some information from the solver and display it
118:   */
119:   EPSGetType(eps,&type);
120:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
121:   EPSGetDimensions(eps,&nev,NULL,NULL);
122:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

124:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
125:                     Display solution and clean up
126:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

128:   EPSPrintSolution(eps,NULL);
129:   EPSDestroy(&eps);
130:   MatDestroy(&A);
131:   SlepcFinalize();
132:   return 0;
133: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test5.c0000644000175000017500000000753512211062077021213 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test EPS with different builds with a matrix loaded from a file.\n" "This test is based on ex4.c in tutorials.\n" "It loads test matrices available in PETSc's distribution.\n" "Add -symm or -herm to select the symmetric/Hermitian matrix.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ char filename[PETSC_MAX_PATH_LEN]; const char *prefix,*scalar,*ints,*floats; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscViewer viewer; PetscBool flg,symm; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Load the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscOptionsHasName(NULL,"-symm",&symm);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-herm",&flg);CHKERRQ(ierr); if (flg) symm=PETSC_TRUE; #if defined(PETSC_USE_COMPLEX) prefix = symm? "hpd": "nh"; scalar = "complex"; #else prefix = symm? "spd": "ns"; scalar = "real"; #endif #if defined(PETSC_USE_64BIT_INDICES) ints = "int64"; #else ints = "int32"; #endif #if defined(PETSC_USE_REAL_DOUBLE) floats = "float64"; #elif defined(PETSC_USE_REAL_SINGLE) floats = "float32"; #endif ierr = PetscSNPrintf(filename,PETSC_MAX_PATH_LEN,"%s/share/petsc/datafiles/matrices/%s-%s-%s-%s",PETSC_DIR,prefix,scalar,ints,floats);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nReading matrix from binary file...\n\n");CHKERRQ(ierr); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatLoad(A,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); if (symm) { ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); } else { ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); } ierr = EPSSetTolerances(eps,tol,PETSC_DEFAULT);CHKERRQ(ierr); ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem and display solution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/0000755000175000017500000000000012214143515021331 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test5_blopex.out0000644000175000017500000000022012211062077024471 0ustar gladkgladk Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 0.96775, 1.96775, 2.38197, 3.20382 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test7f_1.out0000644000175000017500000000044012211062077023514 0ustar gladkgladk 1-D Laplacian Eigenproblem, n = 30 (Fortran) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test5_1.out0000644000175000017500000000143312211062077023347 0ustar gladkgladkeps type krylovschur Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.92072, 5.80648, 5.45756, 4.70098 eps type arnoldi Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.92072, 5.80648, 5.45756, 4.70098 eps type gd Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.92072, 5.80648, 5.45756, 4.70098 eps type jd Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.92072, 5.80648, 5.45756, 4.70098 eps type gd2 Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.92072, 5.80648, 5.45756, 4.70098 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test10_1.out0000644000175000017500000000265712211062077023434 0ustar gladkgladkeps type krylovschur Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.08101, 0.09789, 0.17890, 0.31749 eps type arnoldi Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.08101, 0.09789, 0.17890, 0.31749 eps type lanczos Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: lanczos Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.08101, 0.09789, 0.17890, 0.31749 eps type gd Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.08101, 0.09789, 0.17890, 0.31749 eps type jd Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.08101, 0.09789, 0.17890, 0.31749 eps type gd2 Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.08101, 0.09789, 0.17890, 0.31749 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test14f_1.out0000644000175000017500000000276712211062077023610 0ustar gladkgladk Diagonal Eigenproblem, n = 20 (Fortran) Matrix Object: 1 MPI processes type: seqaij row 0: (0, 1) row 1: (1, 2) row 2: (2, 3) row 3: (3, 4) row 4: (4, 5) row 5: (5, 6) row 6: (6, 7) row 7: (7, 8) row 8: (8, 9) row 9: (9, 10) row 10: (10, 11) row 11: (11, 12) row 12: (12, 13) row 13: (13, 14) row 14: (14, 15) row 15: (15, 16) row 16: (16, 17) row 17: (17, 18) row 18: (18, 19) row 19: (19, 20) Type set to krylovschur Problem type before changing = 0 ... changed to 1 hermitian Extraction before changing = 0 ... changed to 2 Balance: 2, its= 8, cutoff=0.000001 Which = 7, target = 4.8 Dimensions: nev= 4, ncv= 0, mpd= 0 Tolerance =0.00022, max_its = 200 Convergence test = 0 ST Object: 1 MPI processes type not yet set shift: 0 number of matrices: 1 KSP Object: (st_) 1 MPI processes type not yet set maximum iterations=10000, initial guess is zero tolerances: relative=1e-08, absolute=1e-50, divergence=10000 left preconditioning using DEFAULT norm type for convergence test PC Object: (st_) 1 MPI processes type not yet set IP Object: 1 MPI processes type not yet set orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) DS Object: 1 MPI processes type not yet set Finished - converged reason = 2, its= 2 All requested eigenvalues computed up to the required tolerance: 5.00000, 4.00000, 6.00000, 3.00000 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test8_1.out0000644000175000017500000000276712211062077023365 0ustar gladkgladkeps type krylovschur 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.60149, 7.36501 eps type arnoldi 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.60149, 7.36501 eps type lanczos 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: lanczos Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.60149, 7.36501 eps type gd 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.60149, 7.36501 eps type jd 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.60149, 7.36501 eps type gd2 2-D Laplacian Eigenproblem (matrix-free version), N=100 (10x10 grid) Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.83797, 7.60149, 7.60149, 7.36501 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test15f_1.out0000644000175000017500000000102512211062077023573 0ustar gladkgladk 1-D Laplacian Eigenproblem, n = 30 (Fortran) 1 EPS nconv= 0 first unconverged value (error) 3.9875 (0.648E-02) 2 EPS nconv= 0 first unconverged value (error) 3.9897 (0.203E-02) 3 EPS nconv= 0 first unconverged value (error) 3.9897 (0.129E-04) 4 EPS nconv= 1 first unconverged value (error) 3.9591 (0.361E-07) Solution method: krylovschur Number of requested eigenvalues: 1 All requested eigenvalues computed up to the required tolerance: 3.98974 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test11_1.out0000644000175000017500000000244212211062077023425 0ustar gladkgladkeps type krylovschur Markov Model, N=120 (m=15) Searching closest eigenvalues to the right of 0.5. Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.51928, 0.55740, 0.57028, 0.57143 eps type arnoldi Markov Model, N=120 (m=15) Searching closest eigenvalues to the right of 0.5. Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.51928, 0.55740, 0.57028, 0.57143 eps type gd Markov Model, N=120 (m=15) Searching closest eigenvalues to the right of 0.5. Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.51928, 0.55740, 0.57028, 0.57143 eps type jd Markov Model, N=120 (m=15) Searching closest eigenvalues to the right of 0.5. Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.51928, 0.55740, 0.57028, 0.57143 eps type gd2 Markov Model, N=120 (m=15) Searching closest eigenvalues to the right of 0.5. Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.51928, 0.55740, 0.57028, 0.57143 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test13_2.out0000644000175000017500000000065012211062077023427 0ustar gladkgladkeps type gd Tridiagonal with zero diagonal, n=30 All requested eigenvalues computed up to the required tolerance: -0.10130 All requested eigenvalues computed up to the required tolerance: -0.10130 eps type jd Tridiagonal with zero diagonal, n=30 All requested eigenvalues computed up to the required tolerance: 0.10130 All requested eigenvalues computed up to the required tolerance: 0.10130 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test4_1.out0000644000175000017500000000260112211062077023344 0ustar gladkgladkeps type krylovschur 1-D Laplacian Eigenproblem, n=30 EPS type: krylovschur Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 eps type arnoldi 1-D Laplacian Eigenproblem, n=30 EPS type: arnoldi Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 eps type lanczos 1-D Laplacian Eigenproblem, n=30 EPS type: lanczos Solution method: lanczos Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 eps type gd 1-D Laplacian Eigenproblem, n=30 EPS type: gd Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 eps type jd 1-D Laplacian Eigenproblem, n=30 EPS type: jd Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 eps type gd2 1-D Laplacian Eigenproblem, n=30 EPS type: gd2 Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test13_1.out0000644000175000017500000000120012211062077023416 0ustar gladkgladkeps type gd Tridiagonal with zero diagonal, n=30 All requested eigenvalues computed up to the required tolerance: -1.98974 All requested eigenvalues computed up to the required tolerance: -1.98974 eps type jd Tridiagonal with zero diagonal, n=30 All requested eigenvalues computed up to the required tolerance: -1.98974 All requested eigenvalues computed up to the required tolerance: -1.98974 eps type gd2 Tridiagonal with zero diagonal, n=30 All requested eigenvalues computed up to the required tolerance: -1.98974 All requested eigenvalues computed up to the required tolerance: -1.98974 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test5_1_complex.out0000644000175000017500000000171712211062077025103 0ustar gladkgladkeps type krylovschur Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.91999-0.01011i, 5.79911-0.07099i, 5.45754+0.00133i, 4.67482-0.10141i eps type arnoldi Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.91999-0.01011i, 5.79911-0.07099i, 5.45754+0.00133i, 4.67482-0.10141i eps type gd Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.91999-0.01011i, 5.79911-0.07099i, 5.45754+0.00133i, 4.67482-0.10141i eps type jd Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.91999-0.01011i, 5.79911-0.07099i, 5.45754+0.00133i, 4.67482-0.10141i eps type gd2 Reading matrix from binary file... All requested eigenvalues computed up to the required tolerance: 6.91999-0.01011i, 5.79911-0.07099i, 5.45754+0.00133i, 4.67482-0.10141i slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test2_1.out0000644000175000017500000000542212211062077023346 0ustar gladkgladkeps type krylovschur 1-D Laplacian Eigenproblem, n=30 - - - Largest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 - - - Smallest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 - - - Interior eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 2.10130, 1.89870, 2.30286, 2.50131 eps type arnoldi 1-D Laplacian Eigenproblem, n=30 - - - Largest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 - - - Smallest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 - - - Interior eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 2.10130, 1.89870, 2.30286, 2.50131 eps type lanczos 1-D Laplacian Eigenproblem, n=30 - - - Largest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 - - - Smallest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 - - - Interior eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 2.10130, 1.89870, 2.30286, 2.50131 eps type gd 1-D Laplacian Eigenproblem, n=30 - - - Largest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 - - - Smallest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 - - - Interior eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 2.10130, 1.89870, 2.30286, 2.50131 eps type jd 1-D Laplacian Eigenproblem, n=30 - - - Largest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 - - - Smallest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 - - - Interior eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 2.10130, 1.89870, 2.30286, 2.50131 eps type gd2 1-D Laplacian Eigenproblem, n=30 - - - Largest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 - - - Smallest eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 - - - Interior eigenvalues - - - All requested eigenvalues computed up to the required tolerance: 2.10130, 1.89870, 2.30286, 2.50131 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test12_1.out0000644000175000017500000000141412211062077023424 0ustar gladkgladkeps type krylovschur Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type arnoldi Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type gd Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type jd Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type gd2 Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test1_2.out0000644000175000017500000000105412211062077023343 0ustar gladkgladk Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 0.12369, 0.15282, 0.15532, 0.19855, 0.20105, 0.25744, 0.25947, 0.27505, 0.30293, 0.30894, 0.37736, 0.38239, 0.38822, 0.39051, 0.43542, 0.44727, 0.48344, 0.51036, 0.51809, 0.53715, 0.55101, 0.59457, 0.60776, 0.61641, 0.62306, 0.66816, 0.68143, 0.70270, 0.73630, 0.74253, 0.77075, 0.78191, 0.78385, 0.80544, 0.83744, 0.86049, 0.88990, 0.90049, 0.91944, 0.94022 Level of orthogonality below the tolerance slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test14_1.out0000644000175000017500000000262612211062077023434 0ustar gladkgladk Diagonal Eigenproblem, n=20 Matrix Object: 1 MPI processes type: seqaij row 0: (0, 1) row 1: (1, 2) row 2: (2, 3) row 3: (3, 4) row 4: (4, 5) row 5: (5, 6) row 6: (6, 7) row 7: (7, 8) row 8: (8, 9) row 9: (9, 10) row 10: (10, 11) row 11: (11, 12) row 12: (12, 13) row 13: (13, 14) row 14: (14, 15) row 15: (15, 16) row 16: (16, 17) row 17: (17, 18) row 18: (18, 19) row 19: (19, 20) Type set to krylovschur Problem type before changing = 0 ... changed to 1. hermitian Extraction before changing = 0 ... changed to 2 Balance: 2, its=8, cutoff=1e-06 Which = 7, target = 4.8 Dimensions: nev=4, ncv=0, mpd=0 Tolerance = 0.00022, max_its = 200 Convergence test = 1 ST Object: 1 MPI processes type not yet set shift: 0 number of matrices: 1 KSP Object: (st_) 1 MPI processes type not yet set maximum iterations=10000, initial guess is zero tolerances: relative=1e-08, absolute=1e-50, divergence=10000 left preconditioning using DEFAULT norm type for convergence test PC Object: (st_) 1 MPI processes type not yet set IP Object: 1 MPI processes type not yet set orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) DS Object: 1 MPI processes type not yet set Finished - converged reason = 2, its=2 All requested eigenvalues computed up to the required tolerance: 5.00000, 4.00000, 6.00000, 3.00000 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test6_1.out0000644000175000017500000000141412211062077023347 0ustar gladkgladkeps type krylovschur Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type arnoldi Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type gd Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type jd Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 eps type gd2 Diagonal Eigenproblem, n=30 All requested eigenvalues computed up to the required tolerance: 30.00000, 29.00000, 28.00000, 27.00000 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test3_1.out0000644000175000017500000000362412211062077023351 0ustar gladkgladkeps type krylovschur Tridiagonal with random diagonal, n=30 - - - First matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61861, 2.53982, 2.46239, 2.33322 - - - Second matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61224, 2.58655, 2.55415, 2.40928 eps type arnoldi Tridiagonal with random diagonal, n=30 - - - First matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61861, 2.53982, 2.46239, 2.33322 - - - Second matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61224, 2.58655, 2.55415, 2.40928 eps type lanczos Tridiagonal with random diagonal, n=30 - - - First matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61861, 2.53982, 2.46239, 2.33322 - - - Second matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61224, 2.58655, 2.55415, 2.40928 eps type gd Tridiagonal with random diagonal, n=30 - - - First matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61861, 2.53982, 2.46239, 2.33322 - - - Second matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61224, 2.58655, 2.55415, 2.40928 eps type jd Tridiagonal with random diagonal, n=30 - - - First matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61861, 2.53982, 2.46239, 2.33322 - - - Second matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61224, 2.58655, 2.55415, 2.40928 eps type gd2 Tridiagonal with random diagonal, n=30 - - - First matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61861, 2.53982, 2.46239, 2.33322 - - - Second matrix - - - All requested eigenvalues computed up to the required tolerance: 2.61224, 2.58655, 2.55415, 2.40928 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test9_1.out0000644000175000017500000000205512211062077023354 0ustar gladkgladkeps type krylovschur Markov Model, N=120 (m=15) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 1.00000, -1.00000, 0.97137, -0.97137 eps type arnoldi Markov Model, N=120 (m=15) Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 1.00000, -1.00000, 0.97137, -0.97137 eps type gd Markov Model, N=120 (m=15) Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 1.00000, -1.00000, 0.97137, -0.97137 eps type jd Markov Model, N=120 (m=15) Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 1.00000, -1.00000, 0.97137, -0.97137 eps type gd2 Markov Model, N=120 (m=15) Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 1.00000, -1.00000, 0.97137, -0.97137 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test1_1.out0000644000175000017500000000252412211062077023345 0ustar gladkgladkeps type krylovschur Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 29.73524, 29.67536, 29.58873, 29.46785 Level of orthogonality below the tolerance eps type arnoldi Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 29.73524, 29.67536, 29.58873, 29.46785 Level of orthogonality below the tolerance eps type lanczos Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 29.73524, 29.67536, 29.58873, 29.46785 Level of orthogonality below the tolerance eps type gd Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 29.73524, 29.67536, 29.58873, 29.46785 Level of orthogonality below the tolerance eps type jd Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 29.73524, 29.67536, 29.58873, 29.46785 Level of orthogonality below the tolerance eps type gd2 Generalized Symmetric Eigenproblem, N=2025 (45x45 grid) All requested eigenvalues computed up to the required tolerance: 29.73524, 29.67536, 29.58873, 29.46785 Level of orthogonality below the tolerance slepc-3.4.2.dfsg.orig/src/eps/examples/tests/output/test10_1_ks.out0000644000175000017500000000035112211062077024116 0ustar gladkgladk Fiedler vector of a 2-D regular mesh, N=110 (10x11 grid) Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 7.82110, 7.58462, 7.53702, 7.30054 slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test6.c0000644000175000017500000000721112211062077021203 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Diagonal eigenproblem.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions = matrix dimension.\n" " -seed , where = seed for random number generation.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* problem matrix */ EPS eps; /* eigenproblem solver context */ Vec v0; /* initial vector */ PetscRandom rand; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscInt n=30,i,Istart,Iend,seed=0x12345678; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nDiagonal Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;iActual source code: test9.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Eigenvalue problem associated with a Markov model of a random walk on a triangular grid. "
 23:   "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n"
 24:   "This example illustrates how the user can set the initial vector.\n\n"
 25:   "The command line options are:\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in each dimension.\n\n";

 28: #include <slepceps.h>

 30: /*
 31:    User-defined routines
 32: */
 33: PetscErrorCode MatMarkovModel(PetscInt m,Mat A);
 34: PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx);

 38: int main(int argc,char **argv)
 39: {
 40:   Vec            v0;              /* initial vector */
 41:   Mat            A;               /* operator matrix */
 42:   EPS            eps;             /* eigenproblem solver context */
 43:   EPSType        type;
 44:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 45:   PetscInt       N,m=15,nev;
 46:   PetscScalar    origin=0.0;

 49:   SlepcInitialize(&argc,&argv,(char*)0,help);

 51:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 52:   N = m*(m+1)/2;
 53:   PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n\n",N,m);

 55:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 56:      Compute the operator matrix that defines the eigensystem, Ax=kx
 57:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 59:   MatCreate(PETSC_COMM_WORLD,&A);
 60:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 61:   MatSetFromOptions(A);
 62:   MatSetUp(A);
 63:   MatMarkovModel(m,A);

 65:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 66:                 Create the eigensolver and set various options
 67:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 69:   /*
 70:      Create eigensolver context
 71:   */
 72:   EPSCreate(PETSC_COMM_WORLD,&eps);

 74:   /*
 75:      Set operators. In this case, it is a standard eigenvalue problem
 76:   */
 77:   EPSSetOperators(eps,A,NULL);
 78:   EPSSetProblemType(eps,EPS_NHEP);
 79:   EPSSetTolerances(eps,tol,PETSC_DECIDE);

 81:   /*
 82:      Set the custom comparing routine in order to obtain the eigenvalues
 83:      closest to the target on the right only
 84:   */
 85:   EPSSetEigenvalueComparison(eps,MyEigenSort,&origin);


 88:   /*
 89:      Set solver parameters at runtime
 90:   */
 91:   EPSSetFromOptions(eps);

 93:   /*
 94:      Set the initial vector. This is optional, if not done the initial
 95:      vector is set to random values
 96:   */
 97:   MatGetVecs(A,&v0,NULL);
 98:   VecSet(v0,1.0);
 99:   EPSSetInitialSpace(eps,1,&v0);

101:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102:                       Solve the eigensystem
103:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

105:   EPSSolve(eps);

107:   /*
108:      Optional: Get some information from the solver and display it
109:   */
110:   EPSGetType(eps,&type);
111:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
112:   EPSGetDimensions(eps,&nev,NULL,NULL);
113:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

115:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116:                     Display solution and clean up
117:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

119:   EPSPrintSolution(eps,NULL);
120:   EPSDestroy(&eps);
121:   MatDestroy(&A);
122:   VecDestroy(&v0);
123:   SlepcFinalize();
124:   return 0;
125: }

129: /*
130:     Matrix generator for a Markov model of a random walk on a triangular grid.

132:     This subroutine generates a test matrix that models a random walk on a
133:     triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a
134:     FORTRAN subroutine to calculate the dominant invariant subspaces of a real
135:     matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few
136:     papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295
137:     (1980) ]. These matrices provide reasonably easy test problems for eigenvalue
138:     algorithms. The transpose of the matrix  is stochastic and so it is known
139:     that one is an exact eigenvalue. One seeks the eigenvector of the transpose
140:     associated with the eigenvalue unity. The problem is to calculate the steady
141:     state probability distribution of the system, which is the eigevector
142:     associated with the eigenvalue one and scaled in such a way that the sum all
143:     the components is equal to one.

145:     Note: the code will actually compute the transpose of the stochastic matrix
146:     that contains the transition probabilities.
147: */
148: PetscErrorCode MatMarkovModel(PetscInt m,Mat A)
149: {
150:   const PetscReal cst = 0.5/(PetscReal)(m-1);
151:   PetscReal       pd,pu;
152:   PetscInt        Istart,Iend,i,j,jmax,ix=0;
153:   PetscErrorCode  ierr;

156:   MatGetOwnershipRange(A,&Istart,&Iend);
157:   for (i=1;i<=m;i++) {
158:     jmax = m-i+1;
159:     for (j=1;j<=jmax;j++) {
160:       ix = ix + 1;
161:       if (ix-1<Istart || ix>Iend) continue;  /* compute only owned rows */
162:       if (j!=jmax) {
163:         pd = cst*(PetscReal)(i+j-1);
164:         /* north */
165:         if (i==1) {
166:           MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);
167:         } else {
168:           MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);
169:         }
170:         /* east */
171:         if (j==1) {
172:           MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);
173:         } else {
174:           MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);
175:         }
176:       }
177:       /* south */
178:       pu = 0.5 - cst*(PetscReal)(i+j-3);
179:       if (j>1) {
180:         MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);
181:       }
182:       /* west */
183:       if (i>1) {
184:         MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);
185:       }
186:     }
187:   }
188:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
189:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
190:   return(0);
191: }

195: /*
196:     Function for user-defined eigenvalue ordering criterion.

198:     Given two eigenvalues ar+i*ai and br+i*bi, the subroutine must choose
199:     one of them as the preferred one according to the criterion.
200:     In this example, the preferred value is the one furthest to the origin.
201: */
202: PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)
203: {
204:   PetscScalar origin = *(PetscScalar*)ctx;
205:   PetscReal   d;

208:   d = (SlepcAbsEigenvalue(br-origin,bi) - SlepcAbsEigenvalue(ar-origin,ai))/PetscMax(SlepcAbsEigenvalue(ar-origin,ai),SlepcAbsEigenvalue(br-origin,bi));
209:   *r = d > PETSC_SQRT_MACHINE_EPSILON ? 1 : (d < -PETSC_SQRT_MACHINE_EPSILON ? -1 : PetscSign(PetscRealPart(br)));
210:   return(0);
211: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test4.c0000644000175000017500000001207412211062077021204 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test the solution of a HEP without calling EPSSetFromOptions (based on ex1.c).\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions = matrix dimension.\n" " -type = eps type to test.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* problem matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscScalar value[3]; PetscInt n=30,i,Istart,Iend,col[3],nev; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE,isgd2; char epstype[30] = "krylovschur"; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-type",epstype,30,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D",n);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nEPS type: %s\n\n",epstype);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); ierr = EPSSetDimensions(eps,4,PETSC_DEFAULT,PETSC_DEFAULT);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,PETSC_DEFAULT);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = PetscStrcmp(epstype,"gd2",&isgd2);CHKERRQ(ierr); if (isgd2) { ierr = EPSSetType(eps,EPSGD);CHKERRQ(ierr); ierr = EPSGDSetDoubleExpansion(eps,PETSC_TRUE);CHKERRQ(ierr); } else { ierr = EPSSetType(eps,epstype);CHKERRQ(ierr); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test1.c.html0000644000175000017500000002251012211062077022140 0ustar gladkgladk
Actual source code: test1.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Tests B-orthonormality of eigenvectors in a GHEP problem.\n\n";

 24: #include <slepceps.h>

 28: int main(int argc,char **argv)
 29: {
 30:   Mat            A,B;        /* matrices */
 31:   EPS            eps;        /* eigenproblem solver context */
 32:   Vec            *X,v;
 33:   PetscReal      lev,tol=1000*PETSC_MACHINE_EPSILON;
 34:   PetscInt       N,n=45,m,Istart,Iend,II,i,j,nconv;
 35:   PetscBool      flag;

 38:   SlepcInitialize(&argc,&argv,(char*)0,help);
 39:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 40:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 41:   if (!flag) m=n;
 42:   N = n*m;
 43:   PetscPrintf(PETSC_COMM_WORLD,"\nGeneralized Symmetric Eigenproblem, N=%D (%Dx%D grid)\n\n",N,n,m);

 45:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 46:      Compute the matrices that define the eigensystem, Ax=kBx
 47:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 49:   MatCreate(PETSC_COMM_WORLD,&A);
 50:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 51:   MatSetFromOptions(A);
 52:   MatSetUp(A);

 54:   MatCreate(PETSC_COMM_WORLD,&B);
 55:   MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,N,N);
 56:   MatSetFromOptions(B);
 57:   MatSetUp(B);

 59:   MatGetOwnershipRange(A,&Istart,&Iend);
 60:   for (II=Istart;II<Iend;II++) {
 61:     i = II/n; j = II-i*n;
 62:     if (i>0) { MatSetValue(A,II,II-n,-1.0,INSERT_VALUES); }
 63:     if (i<m-1) { MatSetValue(A,II,II+n,-1.0,INSERT_VALUES); }
 64:     if (j>0) { MatSetValue(A,II,II-1,-1.0,INSERT_VALUES); }
 65:     if (j<n-1) { MatSetValue(A,II,II+1,-1.0,INSERT_VALUES); }
 66:     MatSetValue(A,II,II,4.0,INSERT_VALUES);
 67:     MatSetValue(B,II,II,2.0/PetscLogScalar(II+2),INSERT_VALUES);
 68:   }

 70:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 71:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
 72:   MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);
 73:   MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);
 74:   MatGetVecs(B,&v,NULL);

 76:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 77:                 Create the eigensolver and set various options
 78:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 80:   EPSCreate(PETSC_COMM_WORLD,&eps);
 81:   EPSSetOperators(eps,A,B);
 82:   EPSSetProblemType(eps,EPS_GHEP);
 83:   EPSSetTolerances(eps,tol,PETSC_DECIDE);
 84:   EPSSetFromOptions(eps);

 86:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 87:                       Solve the eigensystem
 88:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 90:   EPSSolve(eps);

 92:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 93:                     Display solution and clean up
 94:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 96:   EPSPrintSolution(eps,NULL);
 97:   EPSGetConverged(eps,&nconv);
 98:   if (nconv>0) {
 99:     VecDuplicateVecs(v,nconv,&X);
100:     for (i=0;i<nconv;i++) {
101:       EPSGetEigenvector(eps,i,X[i],NULL);
102:     }
103:     SlepcCheckOrthogonality(X,nconv,NULL,nconv,B,NULL,&lev);
104:     if (lev<10*tol) {
105:       PetscPrintf(PETSC_COMM_WORLD,"Level of orthogonality below the tolerance\n");
106:     } else {
107:       PetscPrintf(PETSC_COMM_WORLD,"Level of orthogonality: %G\n",lev);
108:     }
109:     VecDestroyVecs(nconv,&X);
110:   }

112:   EPSDestroy(&eps);
113:   MatDestroy(&A);
114:   MatDestroy(&B);
115:   VecDestroy(&v);
116:   SlepcFinalize();
117:   return 0;
118: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test9.c0000644000175000017500000001776412211062077021224 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Eigenvalue problem associated with a Markov model of a random walk on a triangular grid. " "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n" "This example illustrates how the user can set the initial vector.\n\n" "The command line options are:\n" " -m , where = number of grid subdivisions in each dimension.\n\n"; #include /* User-defined routines */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A); PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Vec v0; /* initial vector */ Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscInt N,m=15,nev; PetscScalar origin=0.0; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); N = m*(m+1)/2; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n\n",N,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatMarkovModel(m,A);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,PETSC_DECIDE);CHKERRQ(ierr); /* Set the custom comparing routine in order to obtain the eigenvalues closest to the target on the right only */ ierr = EPSSetEigenvalueComparison(eps,MyEigenSort,&origin);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* Set the initial vector. This is optional, if not done the initial vector is set to random values */ ierr = MatGetVecs(A,&v0,NULL);CHKERRQ(ierr); ierr = VecSet(v0,1.0);CHKERRQ(ierr); ierr = EPSSetInitialSpace(eps,1,&v0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = VecDestroy(&v0);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMarkovModel" /* Matrix generator for a Markov model of a random walk on a triangular grid. This subroutine generates a test matrix that models a random walk on a triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a FORTRAN subroutine to calculate the dominant invariant subspaces of a real matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295 (1980) ]. These matrices provide reasonably easy test problems for eigenvalue algorithms. The transpose of the matrix is stochastic and so it is known that one is an exact eigenvalue. One seeks the eigenvector of the transpose associated with the eigenvalue unity. The problem is to calculate the steady state probability distribution of the system, which is the eigevector associated with the eigenvalue one and scaled in such a way that the sum all the components is equal to one. Note: the code will actually compute the transpose of the stochastic matrix that contains the transition probabilities. */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A) { const PetscReal cst = 0.5/(PetscReal)(m-1); PetscReal pd,pu; PetscInt Istart,Iend,i,j,jmax,ix=0; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=1;i<=m;i++) { jmax = m-i+1; for (j=1;j<=jmax;j++) { ix = ix + 1; if (ix-1Iend) continue; /* compute only owned rows */ if (j!=jmax) { pd = cst*(PetscReal)(i+j-1); /* north */ if (i==1) { ierr = MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);CHKERRQ(ierr); } /* east */ if (j==1) { ierr = MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);CHKERRQ(ierr); } } /* south */ pu = 0.5 - cst*(PetscReal)(i+j-3); if (j>1) { ierr = MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);CHKERRQ(ierr); } /* west */ if (i>1) { ierr = MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);CHKERRQ(ierr); } } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MyEigenSort" /* Function for user-defined eigenvalue ordering criterion. Given two eigenvalues ar+i*ai and br+i*bi, the subroutine must choose one of them as the preferred one according to the criterion. In this example, the preferred value is the one furthest to the origin. */ PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx) { PetscScalar origin = *(PetscScalar*)ctx; PetscReal d; PetscFunctionBeginUser; d = (SlepcAbsEigenvalue(br-origin,bi) - SlepcAbsEigenvalue(ar-origin,ai))/PetscMax(SlepcAbsEigenvalue(ar-origin,ai),SlepcAbsEigenvalue(br-origin,bi)); *r = d > PETSC_SQRT_MACHINE_EPSILON ? 1 : (d < -PETSC_SQRT_MACHINE_EPSILON ? -1 : PetscSign(PetscRealPart(br))); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test12.c.html0000644000175000017500000002046612211062077022232 0ustar gladkgladk
Actual source code: test12.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Diagonal eigenproblem. Illustrates use of shell preconditioner.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions = matrix dimension.\n"
 25:   "  -seed <s>, where <s> = seed for random number generation.\n\n";

 27: #include <slepceps.h>

 31: PetscErrorCode PCApply_User(PC pc,Vec x,Vec y)
 32: {

 36:   VecCopy(x,y);
 37:   return(0);
 38: }

 42: int main(int argc,char **argv)
 43: {
 44:   Mat            A;           /* problem matrix */
 45:   EPS            eps;         /* eigenproblem solver context */
 46:   Vec            v0;          /* initial vector */
 47:   PetscRandom    rand;
 48:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 49:   PetscInt       n=30,i,Istart,Iend,seed=0x12345678;
 51:   ST             st;
 52:   KSP            ksp;
 53:   PC             pc;

 55:   SlepcInitialize(&argc,&argv,(char*)0,help);

 57:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 58:   PetscPrintf(PETSC_COMM_WORLD,"\nDiagonal Eigenproblem, n=%D\n\n",n);

 60:   MatCreate(PETSC_COMM_WORLD,&A);
 61:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 62:   MatSetFromOptions(A);
 63:   MatSetUp(A);
 64:   MatGetOwnershipRange(A,&Istart,&Iend);
 65:   for (i=Istart;i<Iend;i++) {
 66:     MatSetValue(A,i,i,i+1,INSERT_VALUES);
 67:   }
 68:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 69:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 71:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 72:                       Solve the eigensystem
 73:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 74:   EPSCreate(PETSC_COMM_WORLD,&eps);
 75:   EPSSetOperators(eps,A,NULL);
 76:   EPSSetProblemType(eps,EPS_HEP);
 77:   EPSSetTolerances(eps,tol,PETSC_DECIDE);
 78:   EPSSetFromOptions(eps);
 79:   EPSGetST(eps,&st);
 80:   STGetKSP(st,&ksp);
 81:   KSPGetPC(ksp,&pc);
 82:   PCSetType(pc,PCSHELL);
 83:   PCShellSetApply(pc,PCApply_User);
 84:   STPrecondSetMatForPC(st,A);

 86:   /* set random initial vector */
 87:   MatGetVecs(A,&v0,NULL);
 88:   PetscRandomCreate(PETSC_COMM_WORLD,&rand);
 89:   PetscRandomSetFromOptions(rand);
 90:   PetscOptionsGetInt(NULL,"-seed",&seed,NULL);
 91:   PetscRandomSetSeed(rand,seed);
 92:   PetscRandomSeed(rand);
 93:   VecSetRandom(v0,rand);
 94:   EPSSetInitialSpace(eps,1,&v0);
 95:   /* call the solver */
 96:   EPSSolve(eps);

 98:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 99:                     Display solution and clean up
100:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
101:   EPSPrintSolution(eps,NULL);
102:   EPSDestroy(&eps);
103:   MatDestroy(&A);
104:   VecDestroy(&v0);
105:   PetscRandomDestroy(&rand);
106:   SlepcFinalize();
107:   return 0;
108: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test7f.F0000644000175000017500000001244012211062077021315 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n test7f [-help] [-n ] [all SLEPc options] ! ! Description: Simple example that solves an eigensystem with the EPS object. ! Same problem as ex1f but with simplified output. ! ! The command line options are: ! -n , where = number of grid points = matrix size ! ! ---------------------------------------------------------------------- ! program main implicit none #include #include #include #include #include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! A operator matrix ! eps eigenproblem solver context Mat A EPS eps EPSType tname PetscInt n, i, Istart, Iend PetscInt nev PetscInt col(3) PetscInt i1,i2,i3 PetscMPIInt rank PetscErrorCode ierr PetscBool flg PetscScalar value(3) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) n = 30 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr) if (rank .eq. 0) then write(*,100) n endif 100 format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)') ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Compute the operator matrix that defines the eigensystem, Ax=kx ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call MatCreate(PETSC_COMM_WORLD,A,ierr) call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr) call MatSetFromOptions(A,ierr) call MatSetUp(A,ierr) i1 = 1 i2 = 2 i3 = 3 call MatGetOwnershipRange(A,Istart,Iend,ierr) if (Istart .eq. 0) then i = 0 col(1) = 0 col(2) = 1 value(1) = 2.0 value(2) = -1.0 call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr) Istart = Istart+1 endif if (Iend .eq. n) then i = n-1 col(1) = n-2 col(2) = n-1 value(1) = -1.0 value(2) = 2.0 call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr) Iend = Iend-1 endif value(1) = -1.0 value(2) = 2.0 value(3) = -1.0 do i=Istart,Iend-1 col(1) = i-1 col(2) = i col(3) = i+1 call MatSetValues(A,i1,i,i3,col,value,INSERT_VALUES,ierr) enddo call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the eigensolver and display info ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create eigensolver context call EPSCreate(PETSC_COMM_WORLD,eps,ierr) ! ** Set operators. In this case, it is a standard eigenvalue problem call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr) call EPSSetProblemType(eps,EPS_HEP,ierr) ! ** Set solver parameters at runtime call EPSSetFromOptions(eps,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the eigensystem ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSSolve(eps,ierr) ! ** Optional: Get some information from the solver and display it call EPSGetType(eps,tname,ierr) if (rank .eq. 0) then write(*,120) tname endif 120 format (' Solution method: ',A) call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,130) nev endif 130 format (' Number of requested eigenvalues:',I2) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr) call EPSDestroy(eps,ierr) call MatDestroy(A,ierr) call SlepcFinalize(ierr) end slepc-3.4.2.dfsg.orig/src/eps/examples/tests/makefile0000644000175000017500000003174512211062077021503 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/eps/examples/tests/ EXAMPLESC = test1.c test2.c test3.c test4.c test5.c test6.c \ test8.c test9.c test10.c test11.c test12.c test13.c \ test14.c EXAMPLESF = test7f.F test14f.F test15f.F MANSEC = EPS TESTS = test1 test2 test3 test4 test5 test6 test7f test8 test9 test10 \ test11 test12 test13 test14 test14f test15f TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \ test2.PETSc runtest2_1 test2.rm \ test3.PETSc runtest3_1 test3.rm \ test4.PETSc runtest4_1 test4.rm \ test6.PETSc runtest6_1 test6.rm \ test8.PETSc runtest8_1 test8.rm \ test9.PETSc runtest9_1 test9.rm \ test10.PETSc runtest10_1 test10.rm \ test11.PETSc runtest11_1 test11.rm \ test12.PETSc runtest12_1 test12.rm \ test13.PETSc runtest13_1 test13.rm \ test14.PETSc runtest14_1 test14.rm TESTEXAMPLES_C_NOCOMPLEX = test1.PETSc runtest1_2 test1.rm TESTEXAMPLES_C_NOF128 = test5.PETSc runtest5_1 test5.rm TESTEXAMPLES_FORTRAN = test7f.PETSc runtest7f_1 test7f.rm \ test14f.PETSc runtest14f_1 test14f.rm \ test15f.PETSc runtest15f_1 test15f.rm TESTEXAMPLES_BLOPEX = test5.PETSc runtest5_blopex test5.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o test3: test3.o chkopts -${CLINKER} -o test3 test3.o ${SLEPC_LIB} ${RM} test3.o test4: test4.o chkopts -${CLINKER} -o test4 test4.o ${SLEPC_LIB} ${RM} test4.o test5: test5.o chkopts -${CLINKER} -o test5 test5.o ${SLEPC_LIB} ${RM} test5.o test6: test6.o chkopts -${CLINKER} -o test6 test6.o ${SLEPC_LIB} ${RM} test6.o test7f: test7f.o chkopts -${FLINKER} -o test7f test7f.o ${SLEPC_LIB} ${RM} test7f.o test8: test8.o chkopts -${CLINKER} -o test8 test8.o ${SLEPC_LIB} ${RM} test8.o test9: test9.o chkopts -${CLINKER} -o test9 test9.o ${SLEPC_LIB} ${RM} test9.o test10: test10.o chkopts -${CLINKER} -o test10 test10.o ${SLEPC_LIB} ${RM} test10.o test11: test11.o chkopts -${CLINKER} -o test11 test11.o ${SLEPC_LIB} ${RM} test11.o test12: test12.o chkopts -${CLINKER} -o test12 test12.o ${SLEPC_LIB} ${RM} test12.o test13: test13.o chkopts -${CLINKER} -o test13 test13.o ${SLEPC_LIB} ${RM} test13.o test14: test14.o chkopts -${CLINKER} -o test14 test14.o ${SLEPC_LIB} ${RM} test14.o test14f: test14f.o chkopts -${FLINKER} -o test14f test14f.o ${SLEPC_LIB} ${RM} test14f.o test15f: test15f.o chkopts -${FLINKER} -o test15f test15f.o ${SLEPC_LIB} ${RM} test15f.o #------------------------------------------------------------------------------------ EPSALL = krylovschur arnoldi lanczos gd jd gd2 EPSNS = krylovschur arnoldi gd jd gd2 EPSAR = gd jd gd2 TESTCODE = \ [ x${SAVE_OUTPUT} = xyes ] && cp $${test}.tmp output/$${test}.out; \ ${DIFF} output/$${test}.out $${test}.tmp || \ echo "Possible problem with $${test}, diffs above"; \ ${RM} -f $${test}.tmp runtest1_1: -@test=test1_1; \ for eps in ${EPSALL}; do \ echo "eps type $$eps"; \ if [ "$$eps" = lanczos ]; then EXTRA="-eps_lanczos_reorthog full"; else EXTRA=""; fi; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test1 -eps_type $$eps -eps_nev 4 $$EXTRA -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest1_2: -@test=test1_2; \ ${MPIEXEC} -np 1 ./test1 -eps_interval .1,1.1 -st_type sinvert -st_ksp_type preonly -st_pc_type cholesky -eps_terse 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest2_1: -@test=test2_1; \ for eps in ${EPSALL}; do \ echo "eps type $$eps"; \ if [ "$$eps" = arnoldi -o "$$eps" = lanczos ]; then EXTRA="-eps_ncv 15"; \ elif [ "$$eps" = gd2 ]; then EXTRA="-eps_ncv 30"; else EXTRA=""; fi; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test2 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest3_1: -@test=test3_1; \ for eps in ${EPSALL}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test3 -eps_type $$eps -eps_nev 4 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest4_1: -@test=test4_1; \ for eps in ${EPSALL}; do \ echo "eps type $$eps"; \ ${MPIEXEC} -np 1 ./test4 -type $$eps -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest5_1: -@test=test5_1; \ for eps in ${EPSNS}; do \ echo "eps type $$eps" >> test5_1.tmp; \ if [ "$$eps" = gd ]; then EXTRA="-eps_ncv 7 -eps_gd_minv 2"; \ elif [ "$$eps" = jd ]; then EXTRA="-eps_ncv 7 -eps_jd_minv 2"; \ elif [ "$$eps" = "gd2" ]; then eps=gd; EXTRA="-eps_gd_double_expansion"; else EXTRA=""; fi; \ ${MPIEXEC} -np 1 ./test5 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA >> test5_1.tmp 2>&1; \ done; \ if (${GREP} USE_COMPLEX ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h > /dev/null 2>&1) then \ [ x${SAVE_OUTPUT} = xyes ] && cp test5_1.tmp output/test5_1_complex.out; \ if (${DIFF} output/test5_1_complex.out test5_1.tmp) then true; \ else echo "Possible problem with test5_1, diffs above"; fi; \ else \ [ x${SAVE_OUTPUT} = xyes ] && cp test5_1.tmp output/test5_1.out; \ if (${DIFF} output/test5_1.out test5_1.tmp) then true; \ else echo "Possible problem with test5_1, diffs above"; fi; \ fi; \ ${RM} -f test5_1.tmp; runtest5_blopex: -@${MPIEXEC} -np 1 ./test5 -symm -eps_type blopex -eps_nev 4 -eps_terse > test5_blopex.tmp 2>&1; \ if (${DIFF} output/test5_blopex.out test5_blopex.tmp) then true; \ else echo "Possible problem with test5_blopex, diffs above"; fi; \ ${RM} -f test5_blopex.tmp; testtest5_blopex: test5.PETSc @if [ "${PETSC_WITH_BATCH}" != "" -o "${MPIEXEC}" = "/bin/false" ]; then \ echo "Skipping BLOPEX test"; \ elif [ -f test5 ]; then \ ${MPIEXEC} -np 1 ./test5 -symm -eps_type blopex -eps_nev 4 -eps_terse > test5_blopex.tmp 2>&1; \ if (${DIFF} output/test5_blopex.out test5_blopex.tmp > /dev/null 2>&1) then \ echo "BLOPEX example src/eps/examples/tests/test5 run successfully with 1 MPI process"; \ else echo "Possible error running BLOPEX src/eps/examples/tests/test5 with 1 MPI process"; \ cat test5_blopex.tmp; fi; \ ${RM} -f test5_blopex.tmp; \ ${MAKE} SLEPC_ARCH=${SLEPC_ARCH} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test5.rm ; fi runtest6_1: -@test=test6_1; \ for eps in ${EPSNS}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test6 -eps_type $$eps -eps_nev 4 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest7f_1: -@test=test7f_1; \ ${MPIEXEC} -np 1 ./test7f -eps_nev 4 -eps_terse > $${test}.tmp 2>&1; \ ${TESTCODE} testtest7f: test7f.PETSc @ok=0; if [ "${PETSC_WITH_BATCH}" != "" ]; then \ echo "Running with batch filesystem; to test run src/eps/examples/tests/test7f " ; \ echo "with your systems batch system"; \ elif [ "${MPIEXEC}" = "/bin/false" ]; then \ echo "*mpiexec not found*. Please run src/eps/examples/tests/test7f manually"; \ elif [ -f test7f ]; then \ GFORTRAN_UNBUFFERED_ALL=1 ${MPIEXEC} -np 1 ./test7f -eps_nev 4 -eps_terse > test7f_1.tmp 2>&1; \ if (${DIFF} output/test7f_1.out test7f_1.tmp > /dev/null 2>&1) then \ echo "Fortran example src/eps/examples/tests/test7f run successfully with 1 MPI process"; \ else echo "Possible error running Fortran src/eps/examples/tests/test7f with 1 MPI process"; \ cat test7f_1.tmp; ok=1; fi; \ ${RM} -f test7f_1.tmp; \ ${MAKE} SLEPC_ARCH=${SLEPC_ARCH} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test7f.rm ; \ else ok=1; fi; \ exit $$ok runtest8_1: -@test=test8_1; \ for eps in ${EPSALL}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test8 -eps_type $$eps -eps_nev 4 -eps_ncv 24 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest9_1: -@test=test9_1; \ for eps in ${EPSNS}; do \ echo "eps type $$eps"; \ if [ "$$eps" = jd ]; then EXTRA="-st_ksp_type cg"; else EXTRA=""; fi; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test9 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA 2>&1; \ done > $${test}.tmp;\ ${TESTCODE} runtest10_1: -@test=test10_1; \ for eps in ${EPSALL}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test10 -eps_type $$eps -eps_nev 4 -m 11 -eps_terse 2>&1; \ done > $${test}.tmp;\ ${TESTCODE} testtest10: test10.PETSc @ok=0; if [ "${PETSC_WITH_BATCH}" != "" ]; then \ echo "Running with batch filesystem; to test run src/eps/examples/tests/test10" ; \ echo "with your systems batch system"; \ elif [ "${MPIEXEC}" = "/bin/false" ]; then \ echo "*mpiexec not found*. Please run src/eps/examples/tests/test10 manually"; \ elif [ -f test10 ]; then \ ${MPIEXEC} -np 1 ./test10 -eps_nev 4 -m 11 -eps_largest_magnitude -eps_terse > test10_1.tmp 2>&1; \ if (${DIFF} output/test10_1_ks.out test10_1.tmp > /dev/null 2>&1) then \ echo "C/C++ example src/eps/examples/tests/test10 run successfully with 1 MPI process"; \ else echo "Possible error running C/C++ src/eps/examples/tests/test10 with 1 MPI process"; \ cat test10_1.tmp; ok=1; fi; \ if [ "${MPIEXEC}" != "${PETSC_DIR}/bin/mpiexec.uni" ]; then \ ${MPIEXEC} -np 2 ./test10 -eps_nev 4 -m 11 -eps_largest_magnitude -eps_terse > test10_1.tmp 2>&1; \ if (${DIFF} output/test10_1_ks.out test10_1.tmp > /dev/null 2>&1) then \ echo "C/C++ example src/eps/examples/tests/test10 run successfully with 2 MPI process"; \ else echo "Possible error running C/C++ src/eps/examples/tests/test10 with 2 MPI process"; \ cat test10_1.tmp; ok=1; fi; fi; \ ${RM} -f test10_1.tmp; \ ${MAKE} SLEPC_ARCH=${SLEPC_ARCH} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test10.rm; \ else ok=1; fi; \ exit $$ok runtest11_1: -@test=test11_1; \ for eps in ${EPSNS}; do \ echo "eps type $$eps"; \ if [ "$$eps" = krylovschur -o "$$eps" = arnoldi ]; then EXTRA="-st_type sinvert"; \ elif [ "$$eps" = gd ]; then EXTRA="-eps_max_it 5000"; \ elif [ "$$eps" = gd2 ]; then EXTRA="-eps_ncv 60 -eps_gd_minv 10"; else EXTRA=""; fi; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test11 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA 2>&1; \ done > $${test}.tmp;\ ${TESTCODE} runtest12_1: -@test=test12_1; \ for eps in ${EPSNS}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test12 -eps_type $$eps -eps_nev 4 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest13_1: -@test=test13_1; \ for eps in ${EPSAR}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test13 -eps_type $$eps -eps_max_it 5000 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest13_2: -@test=test13_2; \ for eps in ${EPSAR}; do \ echo "eps type $$eps"; \ if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test13 -eps_type $$eps -eps_non_hermitian -eps_max_it 5000 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest14_1: -@test=test14_1; \ ${MPIEXEC} -np 1 ./test14 -eps_terse 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest14f_1: -@test=test14f_1; \ ${MPIEXEC} -np 1 ./test14f -eps_terse 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest15f_1: -@test=test15f_1; \ ${MPIEXEC} -np 1 ./test15f -my_eps_monitor -eps_terse > $${test}.tmp 2>&1; \ ${TESTCODE} slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test15f.F.html0000644000175000017500000003460612211062077022347 0ustar gladkgladk
Actual source code: test15f.F

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n test15f [-help] [-n <n>] [all SLEPc options]
 21: !
 22: !  Description: Tests custom monitors from Fortran.
 23: !
 24: !  The command line options are:
 25: !    -n <n>, where <n> = number of grid points = matrix size
 26: !    -my_eps_monitor, activates the custom monitor
 27: !
 28: ! ----------------------------------------------------------------------
 29: !
 30:       program main
 31:       implicit none

 33: #include <finclude/petscsys.h>
 34: #include <finclude/petscvec.h>
 35: #include <finclude/petscmat.h>
 36: #include <finclude/slepcsys.h>
 37: #include <finclude/slepceps.h>

 39: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 40: !     Declarations
 41: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 42: !
 43: !  Variables:
 44: !     A     operator matrix
 45: !     eps   eigenproblem solver context

 47:       Mat            A
 48:       EPS            eps
 49:       EPSType        tname
 50:       PetscInt       n, i, Istart, Iend
 51:       PetscInt       nev
 52:       PetscInt       col(3)
 53:       PetscInt       i1,i2,i3
 54:       PetscMPIInt    rank
 55:       PetscErrorCode ierr
 56:       PetscBool      flg
 57:       PetscScalar    value(3)

 59: !  Note: Any user-defined Fortran routines (such as MyEPSMonitor)
 60: !  MUST be declared as external.

 62:       external MyEPSMonitor

 64: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 65: !     Beginning of program
 66: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 68:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 69:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 70:       n = 30
 71:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)

 73:       if (rank .eq. 0) then
 74:         write(*,100) n
 75:       endif
 76:  100  format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')

 78: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 79: !     Compute the operator matrix that defines the eigensystem, Ax=kx
 80: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 82:       call MatCreate(PETSC_COMM_WORLD,A,ierr)
 83:       call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr)
 84:       call MatSetFromOptions(A,ierr)
 85:       call MatSetUp(A,ierr)

 87:       i1 = 1
 88:       i2 = 2
 89:       i3 = 3
 90:       call MatGetOwnershipRange(A,Istart,Iend,ierr)
 91:       if (Istart .eq. 0) then
 92:         i = 0
 93:         col(1) = 0
 94:         col(2) = 1
 95:         value(1) =  2.0
 96:         value(2) = -1.0
 97:         call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr)
 98:         Istart = Istart+1
 99:       endif
100:       if (Iend .eq. n) then
101:         i = n-1
102:         col(1) = n-2
103:         col(2) = n-1
104:         value(1) = -1.0
105:         value(2) =  2.0
106:         call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr)
107:         Iend = Iend-1
108:       endif
109:       value(1) = -1.0
110:       value(2) =  2.0
111:       value(3) = -1.0
112:       do i=Istart,Iend-1
113:         col(1) = i-1
114:         col(2) = i
115:         col(3) = i+1
116:         call MatSetValues(A,i1,i,i3,col,value,INSERT_VALUES,ierr)
117:       enddo

119:       call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)
120:       call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)

122: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
123: !     Create the eigensolver and display info
124: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

126: !     ** Create eigensolver context
127:       call EPSCreate(PETSC_COMM_WORLD,eps,ierr)

129: !     ** Set operators. In this case, it is a standard eigenvalue problem
130:       call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr)
131:       call EPSSetProblemType(eps,EPS_HEP,ierr)

133: !     ** Set user-defined monitor
134:       call PetscOptionsHasName(PETSC_NULL_CHARACTER,'-my_eps_monitor',  &
135:      &                    flg,ierr)
136:       if (flg) then
137:         call EPSMonitorSet(eps,MyEPSMonitor,PETSC_NULL_OBJECT,          &
138:      &                     PETSC_NULL_FUNCTION,ierr)
139:       endif

141: !     ** Set solver parameters at runtime
142:       call EPSSetFromOptions(eps,ierr)

144: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
145: !     Solve the eigensystem
146: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

148:       call EPSSolve(eps,ierr)

150: !     ** Optional: Get some information from the solver and display it
151:       call EPSGetType(eps,tname,ierr)
152:       if (rank .eq. 0) then
153:         write(*,120) tname
154:       endif
155:  120  format (' Solution method: ',A)
156:       call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER,                 &
157:      &                      PETSC_NULL_INTEGER,ierr)
158:       if (rank .eq. 0) then
159:         write(*,130) nev
160:       endif
161:  130  format (' Number of requested eigenvalues:',I2)

163: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
164: !     Display solution and clean up
165: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

167:       call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr)
168:       call EPSDestroy(eps,ierr)
169:       call MatDestroy(A,ierr)

171:       call SlepcFinalize(ierr)
172:       end

174: ! --------------------------------------------------------------
175: !
176: !  MyEPSMonitor - This is a user-defined routine for monitoring
177: !  the EPS iterative solvers.
178: !
179: !  Input Parameters:
180: !    eps   - eigensolver context
181: !    its   - iteration number
182: !    nconv - number of converged eigenpairs
183: !    eigr  - real part of the eigenvalues
184: !    eigi  - imaginary part of the eigenvalues
185: !    errest- relative error estimates for each eigenpair
186: !    nest  - number of error estimates
187: !    dummy - optional user-defined monitor context (unused here)
188: !
189:       subroutine MyEPSMonitor(eps,its,nconv,eigr,eigi,errest,nest,dummy,&
190:      &                        ierr)

192:       implicit none

194: #include <finclude/petscsys.h>
195: #include <finclude/petscvec.h>
196: #include <finclude/petscmat.h>
197: #include <finclude/slepcsys.h>
198: #include <finclude/slepceps.h>

200:       EPS            eps
201:       Vec            x
202:       PetscErrorCode ierr
203:       PetscInt       its,nconv,nest,dummy
204:       PetscScalar    eigr(*),eigi(*)
205:       PetscReal      re,errest(*)
206:       PetscMPIInt    rank

208:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
209:       if (its .gt. 0 .and. rank .eq. 0) then
210:         re = PetscRealPart(eigr(nconv+1))
211:         write(6,140) its,nconv,re,errest(nconv+1)
212:       endif

214:  140  format(i3,' EPS nconv=',i2,' first unconverged value (error) ',   &
215:      &       f6.4,' (',g9.3,')')
216:       0
217:       end


slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test8.c.html0000644000175000017500000003302612211062077022153 0ustar gladkgladk
Actual source code: test8.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves the same eigenproblem as in example ex2, but using a shell matrix. "
 23:   "The problem is a standard symmetric eigenproblem corresponding to the 2-D Laplacian operator.\n\n"
 24:   "The command line options are:\n"
 25:   "  -n <n>, where <n> = number of grid subdivisions in both x and y dimensions.\n\n";

 27: #include <slepceps.h>
 28: #include <petscblaslapack.h>

 30: /*
 31:    User-defined routines
 32: */
 33: PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y);
 34: PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag);

 38: int main(int argc,char **argv)
 39: {
 40:   Mat            A;               /* operator matrix */
 41:   EPS            eps;             /* eigenproblem solver context */
 42:   EPSType        type;
 43:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 44:   PetscMPIInt    size;
 45:   PetscInt       N,n=10,nev;

 48:   SlepcInitialize(&argc,&argv,(char*)0,help);
 49:   MPI_Comm_size(PETSC_COMM_WORLD,&size);
 50:   if (size != 1) SETERRQ(PETSC_COMM_WORLD,1,"This is a uniprocessor example only");

 52:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 53:   N = n*n;
 54:   PetscPrintf(PETSC_COMM_WORLD,"\n2-D Laplacian Eigenproblem (matrix-free version), N=%D (%Dx%D grid)\n\n",N,n,n);

 56:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 57:      Compute the operator matrix that defines the eigensystem, Ax=kx
 58:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 60:   MatCreateShell(PETSC_COMM_WORLD,N,N,N,N,&n,&A);
 61:   MatSetFromOptions(A);
 62:   MatShellSetOperation(A,MATOP_MULT,(void(*)())MatMult_Laplacian2D);
 63:   MatShellSetOperation(A,MATOP_MULT_TRANSPOSE,(void(*)())MatMult_Laplacian2D);
 64:   MatShellSetOperation(A,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Laplacian2D);

 66:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 67:                 Create the eigensolver and set various options
 68:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 70:   /*
 71:      Create eigensolver context
 72:   */
 73:   EPSCreate(PETSC_COMM_WORLD,&eps);

 75:   /*
 76:      Set operators. In this case, it is a standard eigenvalue problem
 77:   */
 78:   EPSSetOperators(eps,A,NULL);
 79:   EPSSetProblemType(eps,EPS_HEP);
 80:   EPSSetTolerances(eps,tol,PETSC_DECIDE);

 82:   /*
 83:      Set solver parameters at runtime
 84:   */
 85:   EPSSetFromOptions(eps);

 87:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 88:                       Solve the eigensystem
 89:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 91:   EPSSolve(eps);

 93:   /*
 94:      Optional: Get some information from the solver and display it
 95:   */
 96:   EPSGetType(eps,&type);
 97:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
 98:   EPSGetDimensions(eps,&nev,NULL,NULL);
 99:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

101:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102:                     Display solution and clean up
103:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

105:   EPSPrintSolution(eps,NULL);
106:   EPSDestroy(&eps);
107:   MatDestroy(&A);
108:   SlepcFinalize();
109:   return 0;
110: }

112: /*
113:     Compute the matrix vector multiplication y<---T*x where T is a nx by nx
114:     tridiagonal matrix with DD on the diagonal, DL on the subdiagonal, and
115:     DU on the superdiagonal.
116:  */
117: static void tv(int nx,const PetscScalar *x,PetscScalar *y)
118: {
119:   PetscScalar dd,dl,du;
120:   int         j;

122:   dd  = 4.0;
123:   dl  = -1.0;
124:   du  = -1.0;

126:   y[0] =  dd*x[0] + du*x[1];
127:   for (j=1;j<nx-1;j++)
128:     y[j] = dl*x[j-1] + dd*x[j] + du*x[j+1];
129:   y[nx-1] = dl*x[nx-2] + dd*x[nx-1];
130: }

134: /*
135:     Matrix-vector product subroutine for the 2D Laplacian.

137:     The matrix used is the 2 dimensional discrete Laplacian on unit square with
138:     zero Dirichlet boundary condition.

140:     Computes y <-- A*x, where A is the block tridiagonal matrix

142:                  | T -I          |
143:                  |-I  T -I       |
144:              A = |   -I  T       |
145:                  |        ...  -I|
146:                  |           -I T|

148:     The subroutine TV is called to compute y<--T*x.
149:  */
150: PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y)
151: {
152:   void              *ctx;
153:   int               nx,lo,i,j;
154:   const PetscScalar *px;
155:   PetscScalar       *py;
156:   PetscErrorCode    ierr;

159:   MatShellGetContext(A,&ctx);
160:   nx = *(int*)ctx;
161:   VecGetArrayRead(x,&px);
162:   VecGetArray(y,&py);

164:   tv(nx,&px[0],&py[0]);
165:   for (i=0;i<nx;i++) py[i] -= px[nx+i];

167:   for (j=2;j<nx;j++) {
168:     lo = (j-1)*nx;
169:     tv(nx,&px[lo],&py[lo]);
170:     for (i=0;i<nx;i++) py[lo+i] -= px[lo-nx+i] + px[lo+nx+i];
171:   }

173:   lo = (nx-1)*nx;
174:   tv(nx,&px[lo],&py[lo]);
175:   for (i=0;i<nx;i++) py[lo+i] -= px[lo-nx+i];

177:   VecRestoreArrayRead(x,&px);
178:   VecRestoreArray(y,&py);
179:   return(0);
180: }

184: PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag)
185: {

189:   VecSet(diag,4.0);
190:   return(0);
191: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/makefile.html0000644000175000017500000005101612211062077022437 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/eps/examples/tests/
EXAMPLESC  = test1.c test2.c test3.c test4.c test5.c test6.c \
             test8.c test9.c test10.c test11.c test12.c test13.c \
             test14.c
EXAMPLESF  = test7f.F test14f.F test15f.F
MANSEC     = EPS
TESTS      = test1 test2 test3 test4 test5 test6 test7f test8 test9 test10 \
             test11 test12 test13 test14 test14f test15f

TESTEXAMPLES_C           = test1.PETSc runtest1_1 test1.rm \
                           test2.PETSc runtest2_1 test2.rm \
                           test3.PETSc runtest3_1 test3.rm \
                           test4.PETSc runtest4_1 test4.rm \
                           test6.PETSc runtest6_1 test6.rm \
                           test8.PETSc runtest8_1 test8.rm \
                           test9.PETSc runtest9_1 test9.rm \
                           test10.PETSc runtest10_1 test10.rm \
                           test11.PETSc runtest11_1 test11.rm \
                           test12.PETSc runtest12_1 test12.rm \
                           test13.PETSc runtest13_1 test13.rm \
                           test14.PETSc runtest14_1 test14.rm
TESTEXAMPLES_C_NOCOMPLEX = test1.PETSc runtest1_2 test1.rm
TESTEXAMPLES_C_NOF128    = test5.PETSc runtest5_1 test5.rm
TESTEXAMPLES_FORTRAN     = test7f.PETSc runtest7f_1 test7f.rm \
                           test14f.PETSc runtest14f_1 test14f.rm \
                           test15f.PETSc runtest15f_1 test15f.rm
TESTEXAMPLES_BLOPEX      = test5.PETSc runtest5_blopex test5.rm

include ${SLEPC_DIR}/conf/slepc_common

test1: test1.o chkopts
	-${CLINKER} -o test1 test1.o ${SLEPC_LIB}
	${RM} test1.o

test2: test2.o chkopts
	-${CLINKER} -o test2 test2.o ${SLEPC_LIB}
	${RM} test2.o

test3: test3.o chkopts
	-${CLINKER} -o test3 test3.o ${SLEPC_LIB}
	${RM} test3.o

test4: test4.o chkopts
	-${CLINKER} -o test4 test4.o ${SLEPC_LIB}
	${RM} test4.o

test5: test5.o chkopts
	-${CLINKER} -o test5 test5.o ${SLEPC_LIB}
	${RM} test5.o

test6: test6.o chkopts
	-${CLINKER} -o test6 test6.o ${SLEPC_LIB}
	${RM} test6.o

test7f: test7f.o chkopts
	-${FLINKER} -o test7f test7f.o ${SLEPC_LIB}
	${RM} test7f.o

test8: test8.o chkopts
	-${CLINKER} -o test8 test8.o ${SLEPC_LIB}
	${RM} test8.o

test9: test9.o chkopts
	-${CLINKER} -o test9 test9.o ${SLEPC_LIB}
	${RM} test9.o

test10: test10.o chkopts
	-${CLINKER} -o test10 test10.o ${SLEPC_LIB}
	${RM} test10.o

test11: test11.o chkopts
	-${CLINKER} -o test11 test11.o ${SLEPC_LIB}
	${RM} test11.o

test12: test12.o chkopts
	-${CLINKER} -o test12 test12.o ${SLEPC_LIB}
	${RM} test12.o

test13: test13.o chkopts
	-${CLINKER} -o test13 test13.o ${SLEPC_LIB}
	${RM} test13.o

test14: test14.o chkopts
	-${CLINKER} -o test14 test14.o ${SLEPC_LIB}
	${RM} test14.o

test14f: test14f.o chkopts
	-${FLINKER} -o test14f test14f.o ${SLEPC_LIB}
	${RM} test14f.o

test15f: test15f.o chkopts
	-${FLINKER} -o test15f test15f.o ${SLEPC_LIB}
	${RM} test15f.o

#------------------------------------------------------------------------------------
EPSALL = krylovschur arnoldi lanczos gd jd gd2
EPSNS  = krylovschur arnoldi gd jd gd2
EPSAR  = gd jd gd2

TESTCODE = \
	[ x${SAVE_OUTPUT} = xyes ] && cp $${test}.tmp output/$${test}.out; \
	${DIFF} output/$${test}.out $${test}.tmp || \
	echo "Possible problem with $${test}, diffs above"; \
	${RM} -f $${test}.tmp

runtest1_1:
	-@test=test1_1; \
	for eps in ${EPSALL}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = lanczos ]; then EXTRA="-eps_lanczos_reorthog full"; else EXTRA=""; fi; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test1 -eps_type $$eps -eps_nev 4 $$EXTRA -eps_terse 2>&1; \
	done > $${test}.tmp; \
	${TESTCODE}

runtest1_2:
	-@test=test1_2; \
	${MPIEXEC} -np 1 ./test1  -eps_interval .1,1.1 -st_type sinvert -st_ksp_type preonly -st_pc_type cholesky -eps_terse 2>&1 >  $${test}.tmp; \
	${TESTCODE}

runtest2_1:
	-@test=test2_1; \
	for eps in ${EPSALL}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = arnoldi -o "$$eps" = lanczos ]; then EXTRA="-eps_ncv 15"; \
	   elif [ "$$eps" = gd2 ]; then EXTRA="-eps_ncv 30"; else EXTRA=""; fi; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test2 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest3_1:
	-@test=test3_1; \
	for eps in ${EPSALL}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test3 -eps_type $$eps -eps_nev 4 -eps_terse 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest4_1:
	-@test=test4_1; \
	for eps in ${EPSALL}; do \
	   echo "eps type $$eps"; \
	   ${MPIEXEC} -np 1 ./test4 -type $$eps -eps_terse 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest5_1:
	-@test=test5_1; \
	for eps in ${EPSNS}; do \
	   echo "eps type $$eps" >> test5_1.tmp; \
	   if [ "$$eps" = gd ]; then EXTRA="-eps_ncv 7 -eps_gd_minv 2"; \
	   elif [ "$$eps" = jd ]; then EXTRA="-eps_ncv 7 -eps_jd_minv 2"; \
	   elif [ "$$eps" = "gd2" ]; then eps=gd; EXTRA="-eps_gd_double_expansion"; else EXTRA=""; fi; \
	   ${MPIEXEC} -np 1 ./test5 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA >> test5_1.tmp 2>&1; \
	done; \
	if (${GREP} USE_COMPLEX ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h > /dev/null 2>&1) then \
	  [ x${SAVE_OUTPUT} = xyes ] && cp test5_1.tmp output/test5_1_complex.out; \
	  if (${DIFF} output/test5_1_complex.out test5_1.tmp) then true; \
	  else echo "Possible problem with test5_1, diffs above"; fi; \
	else \
	  [ x${SAVE_OUTPUT} = xyes ] && cp test5_1.tmp output/test5_1.out; \
	  if (${DIFF} output/test5_1.out test5_1.tmp) then true; \
	  else echo "Possible problem with test5_1, diffs above"; fi; \
	fi; \
	${RM} -f test5_1.tmp;

runtest5_blopex:
	-@${MPIEXEC} -np 1 ./test5 -symm -eps_type blopex -eps_nev 4 -eps_terse > test5_blopex.tmp 2>&1; \
	if (${DIFF} output/test5_blopex.out test5_blopex.tmp) then true; \
	else echo "Possible problem with test5_blopex, diffs above"; fi; \
	${RM} -f test5_blopex.tmp;

testtest5_blopex: test5.PETSc
	@if [ "${PETSC_WITH_BATCH}" != "" -o "${MPIEXEC}" = "/bin/false" ]; then \
           echo "Skipping BLOPEX test"; \
	elif [ -f test5 ]; then \
           ${MPIEXEC} -np 1 ./test5 -symm -eps_type blopex -eps_nev 4 -eps_terse > test5_blopex.tmp 2>&1; \
	   if (${DIFF} output/test5_blopex.out test5_blopex.tmp > /dev/null 2>&1) then \
           echo "BLOPEX example src/eps/examples/tests/test5 run successfully with 1 MPI process"; \
	   else echo "Possible error running BLOPEX src/eps/examples/tests/test5 with 1 MPI process"; \
           cat test5_blopex.tmp; fi; \
           ${RM} -f test5_blopex.tmp; \
           ${MAKE} SLEPC_ARCH=${SLEPC_ARCH} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test5.rm ; fi

runtest6_1:
	-@test=test6_1; \
	for eps in ${EPSNS}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test6 -eps_type $$eps -eps_nev 4 -eps_terse 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest7f_1:
	-@test=test7f_1; \
	${MPIEXEC} -np 1 ./test7f -eps_nev 4 -eps_terse > $${test}.tmp 2>&1; \
	${TESTCODE}

testtest7f: test7f.PETSc
	@ok=0; if [ "${PETSC_WITH_BATCH}" != "" ]; then \
	   echo "Running with batch filesystem; to test run src/eps/examples/tests/test7f " ; \
	   echo "with your systems batch system"; \
        elif [ "${MPIEXEC}" = "/bin/false" ]; then \
           echo "*mpiexec not found*. Please run src/eps/examples/tests/test7f manually"; \
	elif [ -f test7f ]; then \
           GFORTRAN_UNBUFFERED_ALL=1 ${MPIEXEC} -np 1 ./test7f -eps_nev 4 -eps_terse > test7f_1.tmp 2>&1; \
	   if (${DIFF} output/test7f_1.out test7f_1.tmp > /dev/null 2>&1) then \
           echo "Fortran example src/eps/examples/tests/test7f run successfully with 1 MPI process"; \
	   else echo "Possible error running Fortran src/eps/examples/tests/test7f with 1 MPI process"; \
           cat test7f_1.tmp; ok=1; fi; \
           ${RM} -f test7f_1.tmp; \
           ${MAKE} SLEPC_ARCH=${SLEPC_ARCH} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test7f.rm ; \
	else ok=1; fi; \
	exit $$ok

runtest8_1:
	-@test=test8_1; \
	for eps in ${EPSALL}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test8 -eps_type $$eps -eps_nev 4 -eps_ncv 24 -eps_terse 2>&1; \
	done > $${test}.tmp; \
	${TESTCODE}

runtest9_1:
	-@test=test9_1; \
	for eps in ${EPSNS}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = jd ]; then EXTRA="-st_ksp_type cg"; else EXTRA=""; fi; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test9 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA 2>&1; \
	done > $${test}.tmp;\
	${TESTCODE}

runtest10_1:
	-@test=test10_1; \
	for eps in ${EPSALL}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test10 -eps_type $$eps -eps_nev 4 -m 11 -eps_terse 2>&1; \
	done > $${test}.tmp;\
	${TESTCODE}

testtest10: test10.PETSc
	@ok=0; if [ "${PETSC_WITH_BATCH}" != "" ]; then \
           echo "Running with batch filesystem; to test run src/eps/examples/tests/test10" ; \
           echo "with your systems batch system"; \
        elif [ "${MPIEXEC}" = "/bin/false" ]; then \
           echo "*mpiexec not found*. Please run src/eps/examples/tests/test10 manually"; \
	elif [ -f test10 ]; then \
           ${MPIEXEC} -np 1 ./test10 -eps_nev 4 -m 11 -eps_largest_magnitude -eps_terse > test10_1.tmp 2>&1; \
	   if (${DIFF} output/test10_1_ks.out test10_1.tmp > /dev/null 2>&1) then \
           echo "C/C++ example src/eps/examples/tests/test10 run successfully with 1 MPI process"; \
	   else echo "Possible error running C/C++ src/eps/examples/tests/test10 with 1 MPI process"; \
           cat test10_1.tmp; ok=1; fi; \
	   if [ "${MPIEXEC}" != "${PETSC_DIR}/bin/mpiexec.uni" ]; then \
           ${MPIEXEC} -np 2 ./test10 -eps_nev 4 -m 11 -eps_largest_magnitude -eps_terse > test10_1.tmp 2>&1; \
	   if (${DIFF} output/test10_1_ks.out test10_1.tmp > /dev/null 2>&1) then \
           echo "C/C++ example src/eps/examples/tests/test10 run successfully with 2 MPI process"; \
	   else echo "Possible error running C/C++ src/eps/examples/tests/test10 with 2 MPI process"; \
           cat test10_1.tmp; ok=1; fi; fi; \
           ${RM} -f test10_1.tmp; \
           ${MAKE} SLEPC_ARCH=${SLEPC_ARCH} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test10.rm; \
	else ok=1; fi; \
	exit $$ok

runtest11_1:
	-@test=test11_1; \
	for eps in ${EPSNS}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = krylovschur -o "$$eps" = arnoldi ]; then EXTRA="-st_type sinvert"; \
	   elif [ "$$eps" = gd ]; then EXTRA="-eps_max_it 5000"; \
	   elif [ "$$eps" = gd2 ]; then EXTRA="-eps_ncv 60 -eps_gd_minv 10"; else EXTRA=""; fi; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test11 -eps_type $$eps -eps_nev 4 -eps_terse $$EXTRA 2>&1; \
	done > $${test}.tmp;\
	${TESTCODE}

runtest12_1:
	-@test=test12_1; \
	for eps in ${EPSNS}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test12 -eps_type $$eps -eps_nev 4 -eps_terse 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest13_1:
	-@test=test13_1; \
	for eps in ${EPSAR}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test13 -eps_type $$eps -eps_max_it 5000 -eps_terse 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest13_2:
	-@test=test13_2; \
	for eps in ${EPSAR}; do \
	   echo "eps type $$eps"; \
	   if [ "$$eps" = gd2 ]; then eps="gd -eps_gd_double_expansion"; fi; \
	   ${MPIEXEC} -np 1 ./test13 -eps_type $$eps -eps_non_hermitian -eps_max_it 5000 -eps_terse 2>&1;    \
	done > $${test}.tmp; \
	${TESTCODE}

runtest14_1:
	-@test=test14_1; \
	${MPIEXEC} -np 1 ./test14 -eps_terse 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest14f_1:
	-@test=test14f_1; \
	${MPIEXEC} -np 1 ./test14f -eps_terse 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest15f_1:
	-@test=test15f_1; \
	${MPIEXEC} -np 1 ./test15f -my_eps_monitor -eps_terse > $${test}.tmp 2>&1; \
	${TESTCODE}

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test14.c.html0000644000175000017500000003344012211062077022230 0ustar gladkgladk
Actual source code: test14.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test EPS interface functions.\n\n";

 24: #include <slepceps.h>

 28: int main(int argc,char **argv)
 29: {
 30:   Mat                A,B;         /* problem matrix */
 31:   EPS                eps;         /* eigenproblem solver context */
 32:   ST                 st;
 33:   IP                 ip;
 34:   DS                 ds;
 35:   PetscReal          cut,tol;
 36:   PetscScalar        target;
 37:   PetscInt           n=20,i,its,nev,ncv,mpd,Istart,Iend;
 38:   PetscBool          flg;
 39:   EPSConvergedReason reason;
 40:   EPSType            type;
 41:   EPSExtraction      extr;
 42:   EPSBalance         bal;
 43:   EPSWhich           which;
 44:   EPSConv            conv;
 45:   EPSProblemType     ptype;
 46:   PetscErrorCode     ierr;

 48:   SlepcInitialize(&argc,&argv,(char*)0,help);
 49:   PetscPrintf(PETSC_COMM_WORLD,"\nDiagonal Eigenproblem, n=%D\n\n",n);

 51:   MatCreate(PETSC_COMM_WORLD,&A);
 52:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 53:   MatSetFromOptions(A);
 54:   MatSetUp(A);
 55:   MatGetOwnershipRange(A,&Istart,&Iend);
 56:   for (i=Istart;i<Iend;i++) {
 57:     MatSetValue(A,i,i,i+1,INSERT_VALUES);
 58:   }
 59:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 60:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 62:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 63:              Create eigensolver and test interface functions
 64:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 65:   EPSCreate(PETSC_COMM_WORLD,&eps);
 66:   EPSSetOperators(eps,A,NULL);
 67:   EPSGetOperators(eps,&B,NULL);
 68:   MatView(B,NULL);

 70:   EPSSetType(eps,EPSKRYLOVSCHUR);
 71:   EPSGetType(eps,&type);
 72:   PetscPrintf(PETSC_COMM_WORLD," Type set to %s\n",type);

 74:   EPSGetProblemType(eps,&ptype);
 75:   PetscPrintf(PETSC_COMM_WORLD," Problem type before changing = %D",ptype);
 76:   EPSSetProblemType(eps,EPS_HEP);
 77:   EPSGetProblemType(eps,&ptype);
 78:   PetscPrintf(PETSC_COMM_WORLD," ... changed to %D.",ptype);
 79:   EPSIsGeneralized(eps,&flg);
 80:   if (flg) { PetscPrintf(PETSC_COMM_WORLD," generalized"); }
 81:   EPSIsHermitian(eps,&flg);
 82:   if (flg) { PetscPrintf(PETSC_COMM_WORLD," hermitian"); }
 83:   EPSIsPositive(eps,&flg);
 84:   if (flg) { PetscPrintf(PETSC_COMM_WORLD," positive"); }

 86:   EPSGetExtraction(eps,&extr);
 87:   PetscPrintf(PETSC_COMM_WORLD,"\n Extraction before changing = %D",extr);
 88:   EPSSetExtraction(eps,EPS_HARMONIC);
 89:   EPSGetExtraction(eps,&extr);
 90:   PetscPrintf(PETSC_COMM_WORLD," ... changed to %D\n",extr);

 92:   EPSSetBalance(eps,EPS_BALANCE_ONESIDE,8,1e-6);
 93:   EPSGetBalance(eps,&bal,&its,&cut);
 94:   PetscPrintf(PETSC_COMM_WORLD," Balance: %D, its=%D, cutoff=%G\n",bal,its,cut);

 96:   EPSSetTarget(eps,4.8);
 97:   EPSGetTarget(eps,&target);
 98:   EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);
 99:   EPSGetWhichEigenpairs(eps,&which);
100:   PetscPrintf(PETSC_COMM_WORLD," Which = %D, target = %G\n",which,PetscRealPart(target));

102:   EPSSetDimensions(eps,4,PETSC_DEFAULT,PETSC_DEFAULT);
103:   EPSGetDimensions(eps,&nev,&ncv,&mpd);
104:   PetscPrintf(PETSC_COMM_WORLD," Dimensions: nev=%D, ncv=%D, mpd=%D\n",nev,ncv,mpd);

106:   EPSSetTolerances(eps,0,200);
107:   EPSSetTolerances(eps,2.2e-4,0);
108:   EPSGetTolerances(eps,&tol,&its);
109:   PetscPrintf(PETSC_COMM_WORLD," Tolerance = %.5F, max_its = %D\n",tol,its);

111:   EPSSetConvergenceTest(eps,EPS_CONV_ABS);
112:   EPSGetConvergenceTest(eps,&conv);
113:   PetscPrintf(PETSC_COMM_WORLD," Convergence test = %D\n",conv);

115:   EPSMonitorSet(eps,EPSMonitorFirst,NULL,NULL);
116:   EPSMonitorCancel(eps);

118:   EPSGetST(eps,&st);
119:   STView(st,NULL);
120:   EPSGetIP(eps,&ip);
121:   IPView(ip,NULL);
122:   EPSGetDS(eps,&ds);
123:   DSView(ds,NULL);

125:   EPSSetFromOptions(eps);
126:   EPSSolve(eps);
127:   EPSGetConvergedReason(eps,&reason);
128:   EPSGetIterationNumber(eps,&its);
129:   PetscPrintf(PETSC_COMM_WORLD," Finished - converged reason = %D, its=%D\n",reason,its);

131:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
132:                     Display solution and clean up
133:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
134:   EPSPrintSolution(eps,NULL);
135:   EPSDestroy(&eps);
136:   MatDestroy(&A);
137:   SlepcFinalize();
138:   return 0;
139: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test8.c0000644000175000017500000001455412211062077021215 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves the same eigenproblem as in example ex2, but using a shell matrix. " "The problem is a standard symmetric eigenproblem corresponding to the 2-D Laplacian operator.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions in both x and y dimensions.\n\n"; #include #include /* User-defined routines */ PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y); PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscMPIInt size; PetscInt N,n=10,nev; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr); if (size != 1) SETERRQ(PETSC_COMM_WORLD,1,"This is a uniprocessor example only"); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); N = n*n; ierr = PetscPrintf(PETSC_COMM_WORLD,"\n2-D Laplacian Eigenproblem (matrix-free version), N=%D (%Dx%D grid)\n\n",N,n,n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreateShell(PETSC_COMM_WORLD,N,N,N,N,&n,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_MULT,(void(*)())MatMult_Laplacian2D);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_MULT_TRANSPOSE,(void(*)())MatMult_Laplacian2D);CHKERRQ(ierr); ierr = MatShellSetOperation(A,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Laplacian2D);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,PETSC_DECIDE);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } /* Compute the matrix vector multiplication y<---T*x where T is a nx by nx tridiagonal matrix with DD on the diagonal, DL on the subdiagonal, and DU on the superdiagonal. */ static void tv(int nx,const PetscScalar *x,PetscScalar *y) { PetscScalar dd,dl,du; int j; dd = 4.0; dl = -1.0; du = -1.0; y[0] = dd*x[0] + du*x[1]; for (j=1;j. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Tests B-orthonormality of eigenvectors in a GHEP problem.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,B; /* matrices */ EPS eps; /* eigenproblem solver context */ Vec *X,v; PetscReal lev,tol=1000*PETSC_MACHINE_EPSILON; PetscInt N,n=45,m,Istart,Iend,II,i,j,nconv; PetscBool flag; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nGeneralized Symmetric Eigenproblem, N=%D (%Dx%D grid)\n\n",N,n,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the matrices that define the eigensystem, Ax=kBx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&B);CHKERRQ(ierr); ierr = MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(B);CHKERRQ(ierr); ierr = MatSetUp(B);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(A,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (i0) { ierr = MatSetValue(A,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (j0) { ierr = VecDuplicateVecs(v,nconv,&X);CHKERRQ(ierr); for (i=0;i Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

test1.c: Tests B-orthonormality of eigenvectors in a GHEP problem
test2.c: Tests multiple calls to EPSSolve with the same matrix
test3.c: Tests multiple calls to EPSSolve with different matrix
test4.c: Test the solution of a HEP without calling EPSSetFromOptions (based on ex1
test5.c: Test EPS with different builds with a matrix loaded from a file
test6.c: Diagonal eigenproblem
test8.c: Solves the same eigenproblem as in example ex2, but using a shell matrix
test9.c: Eigenvalue problem associated with a Markov model of a random walk on a triangular grid
test10.c: Computes the smallest nonzero eigenvalue of the Laplacian of a graph
test11.c: Solves the same problem as in ex5, but with a user-defined sorting criterion
test12.c: Diagonal eigenproblem
test13.c: Test EPSSetArbitrarySelection
test14.c: Test EPS interface functions
makefile
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test3.c0000644000175000017500000001261112211062077021200 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Tests multiple calls to EPSSolve with different matrix.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A1,A2; /* problem matrices */ EPS eps; /* eigenproblem solver context */ PetscScalar value[3]; PetscReal tol=1000*PETSC_MACHINE_EPSILON,v; Vec d; PetscInt n=30,i,Istart,Iend,col[3]; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscRandom myrand; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nTridiagonal with random diagonal, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create matrix tridiag([-1 0 -1]) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A1);CHKERRQ(ierr); ierr = MatSetSizes(A1,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A1);CHKERRQ(ierr); ierr = MatSetUp(A1);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A1,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=0.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A1,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A1,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=0.0; value[1]=-1.0; ierr = MatSetValues(A1,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A1,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A1,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create two matrices by filling the diagonal with rand values - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatDuplicate(A1,MAT_COPY_VALUES,&A2);CHKERRQ(ierr); ierr = MatGetVecs(A1,NULL,&d);CHKERRQ(ierr); ierr = PetscRandomCreate(PETSC_COMM_WORLD,&myrand);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(myrand);CHKERRQ(ierr); ierr = PetscRandomSetInterval(myrand,0.0,1.0);CHKERRQ(ierr); for (i=0; i. ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Description: Simple example to test the EPS Fortran interface. ! ! ---------------------------------------------------------------------- ! program main implicit none #include #include #include #include #include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Mat A,B EPS eps ST st IP ip DS ds PetscReal cut,tol PetscScalar tget,value PetscInt n,i,its,Istart,Iend PetscInt nev,ncv,mpd PetscBool flg EPSConvergedReason reason EPSType tname EPSExtraction extr EPSBalance bal EPSWhich which EPSConv conv EPSProblemType ptype PetscMPIInt rank PetscErrorCode ierr ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) n = 20 if (rank .eq. 0) then write(*,100) n endif 100 format (/'Diagonal Eigenproblem, n =',I3,' (Fortran)') call MatCreate(PETSC_COMM_WORLD,A,ierr) call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr) call MatSetFromOptions(A,ierr) call MatSetUp(A,ierr) call MatGetOwnershipRange(A,Istart,Iend,ierr) do i=Istart,Iend-1 value = i+1 call MatSetValue(A,i,i,value,INSERT_VALUES,ierr) enddo call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create eigensolver and test interface functions ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSCreate(PETSC_COMM_WORLD,eps,ierr) call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr) call EPSGetOperators(eps,B,PETSC_NULL_OBJECT,ierr) call MatView(B,PETSC_NULL_OBJECT,ierr) call EPSSetType(eps,EPSKRYLOVSCHUR,ierr) call EPSGetType(eps,tname,ierr) if (rank .eq. 0) then write(*,110) tname endif 110 format (' Type set to ',A) call EPSGetProblemType(eps,ptype,ierr) if (rank .eq. 0) then write(*,120) ptype endif 120 format (' Problem type before changing = ',I2) call EPSSetProblemType(eps,EPS_HEP,ierr) call EPSGetProblemType(eps,ptype,ierr) if (rank .eq. 0) then write(*,130) ptype endif 130 format (' ... changed to ',I2) call EPSIsGeneralized(eps,flg,ierr) if (flg .and. rank .eq. 0) then write(*,*) 'generalized' endif call EPSIsHermitian(eps,flg,ierr) if (flg .and. rank .eq. 0) then write(*,*) 'hermitian' endif call EPSIsPositive(eps,flg,ierr) if (flg .and. rank .eq. 0) then write(*,*) 'positive' endif call EPSGetExtraction(eps,extr,ierr) if (rank .eq. 0) then write(*,140) extr endif 140 format (' Extraction before changing = ',I2) call EPSSetExtraction(eps,EPS_HARMONIC,ierr) call EPSGetExtraction(eps,extr,ierr) if (rank .eq. 0) then write(*,150) extr endif 150 format (' ... changed to ',I2) its = 8 cut = 1.0d-6 bal = EPS_BALANCE_ONESIDE call EPSSetBalance(eps,bal,its,cut,ierr) ! call EPSGetBalance(eps,bal,its,cut,ierr) if (rank .eq. 0) then write(*,160) bal,its,cut endif 160 format (' Balance: ',I2,', its=',I2,', cutoff=',F8.6) tget = 4.8 call EPSSetTarget(eps,tget,ierr) call EPSGetTarget(eps,tget,ierr) call EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE,ierr) call EPSGetWhichEigenpairs(eps,which,ierr) if (rank .eq. 0) then write(*,170) which,PetscRealPart(tget) endif 170 format (' Which = ',I2,', target = ',F3.1) nev = 4 call EPSSetDimensions(eps,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) call EPSGetDimensions(eps,nev,ncv,mpd,ierr) if (rank .eq. 0) then write(*,180) nev,ncv,mpd endif 180 format (' Dimensions: nev=',I2,', ncv=',I2,', mpd=',I2) tol = 2.2d-4 its = 200 call EPSSetTolerances(eps,tol,its,ierr) call EPSGetTolerances(eps,tol,its,ierr) if (rank .eq. 0) then write(*,190) tol,its endif 190 format (' Tolerance =',F7.5,', max_its =',I4) call EPSSetConvergenceTest(eps,EPS_CONV_ABS,ierr) ! call EPSGetConvergenceTest(eps,conv,ierr) conv = 0 if (rank .eq. 0) then write(*,200) conv endif 200 format (' Convergence test =',I2) call EPSMonitorSet(eps,EPSMONITORFIRST,PETSC_NULL_OBJECT, & & PETSC_NULL_FUNCTION,ierr) call EPSMonitorCancel(eps,ierr) call EPSGetST(eps,st,ierr) call STView(st,PETSC_NULL_OBJECT,ierr) call EPSGetIP(eps,ip,ierr) call IPView(ip,PETSC_NULL_OBJECT,ierr) call EPSGetDS(eps,ds,ierr) call DSView(ds,PETSC_NULL_OBJECT,ierr) call EPSSetFromOptions(eps,ierr) call EPSSolve(eps,ierr) call EPSGetConvergedReason(eps,reason,ierr) call EPSGetIterationNumber(eps,its,ierr) if (rank .eq. 0) then write(*,210) reason,its endif 210 format (' Finished - converged reason =',I2,', its=',I4) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr) call EPSDestroy(eps,ierr) call MatDestroy(A,ierr) call SlepcFinalize(ierr) end slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test13.c.html0000644000175000017500000002402012211062077022221 0ustar gladkgladk

Actual source code: test13.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test EPSSetArbitrarySelection.\n\n";

 24: #include <slepceps.h>

 28: PetscErrorCode MyArbitrarySelection(PetscScalar eigr,PetscScalar eigi,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx)
 29: {
 30:   PetscErrorCode  ierr;
 31:   Vec             xref = *(Vec*)ctx;

 34:   VecDot(xr,xref,rr);
 35:   *rr = PetscAbsScalar(*rr);
 36:   if (ri) *ri = 0.0;
 37:   return(0);
 38: }

 42: int main(int argc,char **argv)
 43: {
 44:   Mat            A;           /* problem matrices */
 45:   EPS            eps;         /* eigenproblem solver context */
 46:   PetscScalar    seigr,seigi,value[3];
 47:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 48:   Vec            sxr,sxi;
 49:   PetscInt       n=30,i,Istart,Iend,col[3],nconv;
 50:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

 53:   SlepcInitialize(&argc,&argv,(char*)0,help);

 55:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 56:   PetscPrintf(PETSC_COMM_WORLD,"\nTridiagonal with zero diagonal, n=%D\n\n",n);

 58:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 59:            Create matrix tridiag([-1 0 -1])
 60:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 61:   MatCreate(PETSC_COMM_WORLD,&A);
 62:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 63:   MatSetFromOptions(A);
 64:   MatSetUp(A);

 66:   MatGetOwnershipRange(A,&Istart,&Iend);
 67:   if (Istart==0) FirstBlock=PETSC_TRUE;
 68:   if (Iend==n) LastBlock=PETSC_TRUE;
 69:   value[0]=-1.0; value[1]=0.0; value[2]=-1.0;
 70:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 71:     col[0]=i-1; col[1]=i; col[2]=i+1;
 72:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 73:   }
 74:   if (LastBlock) {
 75:     i=n-1; col[0]=n-2; col[1]=n-1;
 76:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 77:   }
 78:   if (FirstBlock) {
 79:     i=0; col[0]=0; col[1]=1; value[0]=0.0; value[1]=-1.0;
 80:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 81:   }

 83:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 84:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 86:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 87:                         Create the eigensolver
 88:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 89:   EPSCreate(PETSC_COMM_WORLD,&eps);
 90:   EPSSetProblemType(eps,EPS_HEP);
 91:   EPSSetTolerances(eps,tol,PETSC_DECIDE);
 92:   EPSSetOperators(eps,A,NULL);
 93:   EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);
 94:   EPSSetFromOptions(eps);

 96:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 97:                 Solve eigenproblem and store some solution
 98:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 99:   EPSSolve(eps);
100:   MatGetVecs(A,&sxr,NULL);
101:   MatGetVecs(A,&sxi,NULL);
102:   EPSGetConverged(eps,&nconv);
103:   if (nconv>0) {
104:     EPSGetEigenpair(eps,0,&seigr,&seigi,sxr,sxi);
105:     EPSPrintSolution(eps,NULL);

107:     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108:                  Solve eigenproblem using an arbitrary selection
109:        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
110:     EPSSetArbitrarySelection(eps,MyArbitrarySelection,&sxr);
111:     EPSSetWhichEigenpairs(eps,EPS_LARGEST_MAGNITUDE);
112:     EPSSolve(eps);
113:     EPSPrintSolution(eps,NULL);
114:   } else {
115:     PetscPrintf(PETSC_COMM_WORLD,"Problem: no eigenpairs converged.\n");
116:   }

118:   EPSDestroy(&eps);
119:   VecDestroy(&sxr);
120:   VecDestroy(&sxi);
121:   MatDestroy(&A);
122:   SlepcFinalize();
123:   return 0;
124: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test11.c0000644000175000017500000002136212211062077021262 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves the same problem as in ex5, but with a user-defined sorting criterion." "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n" "This example illustrates how the user can set a custom spectrum selection.\n\n" "The command line options are:\n" " -m , where = number of grid subdivisions in each dimension.\n\n"; #include /* User-defined routines */ PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx); PetscErrorCode MatMarkovModel(PetscInt m,Mat A); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Vec v0; /* initial vector */ Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ ST st; /* spectral transformation associated */ EPSType type; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscScalar target=0.5; PetscInt N,m=15,nev; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); N = m*(m+1)/2; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n",N,m);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-target",&target,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Searching closest eigenvalues to the right of %G.\n\n",target);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatMarkovModel(m,A);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,PETSC_DECIDE);CHKERRQ(ierr); /* Set the custom comparing routine in order to obtain the eigenvalues closest to the target on the right only */ ierr = EPSSetEigenvalueComparison(eps,MyEigenSort,&target);CHKERRQ(ierr); /* Set the preconditioner based on A - target * I */ ierr = EPSGetST(eps,&st);CHKERRQ(ierr); ierr = STSetShift(st,target);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* Set the initial vector. This is optional, if not done the initial vector is set to random values */ ierr = MatGetVecs(A,&v0,NULL);CHKERRQ(ierr); ierr = VecSet(v0,1.0);CHKERRQ(ierr); ierr = EPSSetInitialSpace(eps,1,&v0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = VecDestroy(&v0);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMarkovModel" /* Matrix generator for a Markov model of a random walk on a triangular grid. This subroutine generates a test matrix that models a random walk on a triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a FORTRAN subroutine to calculate the dominant invariant subspaces of a real matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295 (1980) ]. These matrices provide reasonably easy test problems for eigenvalue algorithms. The transpose of the matrix is stochastic and so it is known that one is an exact eigenvalue. One seeks the eigenvector of the transpose associated with the eigenvalue unity. The problem is to calculate the steady state probability distribution of the system, which is the eigevector associated with the eigenvalue one and scaled in such a way that the sum all the components is equal to one. Note: the code will actually compute the transpose of the stochastic matrix that contains the transition probabilities. */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A) { const PetscReal cst = 0.5/(PetscReal)(m-1); PetscReal pd,pu; PetscInt Istart,Iend,i,j,jmax,ix=0; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=1;i<=m;i++) { jmax = m-i+1; for (j=1;j<=jmax;j++) { ix = ix + 1; if (ix-1Iend) continue; /* compute only owned rows */ if (j!=jmax) { pd = cst*(PetscReal)(i+j-1); /* north */ if (i==1) { ierr = MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);CHKERRQ(ierr); } /* east */ if (j==1) { ierr = MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);CHKERRQ(ierr); } } /* south */ pu = 0.5 - cst*(PetscReal)(i+j-3); if (j>1) { ierr = MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);CHKERRQ(ierr); } /* west */ if (i>1) { ierr = MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);CHKERRQ(ierr); } } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MyEigenSort" /* Function for user-defined eigenvalue ordering criterion. Given two eigenvalues ar+i*ai and br+i*bi, the subroutine must choose one of them as the preferred one according to the criterion. In this example, the preferred value is the one closest to the target, but on the right side. */ PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx) { PetscScalar target = *(PetscScalar*)ctx; PetscReal da,db; PetscBool aisright,bisright; PetscFunctionBeginUser; if (PetscRealPart(target) < PetscRealPart(ar)) aisright = PETSC_TRUE; else aisright = PETSC_FALSE; if (PetscRealPart(target) < PetscRealPart(br)) bisright = PETSC_TRUE; else bisright = PETSC_FALSE; if (aisright == bisright) { /* both are on the same side of the target */ da = SlepcAbsEigenvalue(ar-target,ai); db = SlepcAbsEigenvalue(br-target,bi); if (da < db) *r = -1; else if (da > db) *r = 1; else *r = 0; } else if (aisright && !bisright) *r = -1; /* 'a' is on the right */ else *r = 1; /* 'b' is on the right */ PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test11.c.html0000644000175000017500000004474712211062077022241 0ustar gladkgladk
Actual source code: test11.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves the same problem as in ex5, but with a user-defined sorting criterion."
 23:   "It is a standard nonsymmetric eigenproblem with real eigenvalues and the rightmost eigenvalue is known to be 1.\n"
 24:   "This example illustrates how the user can set a custom spectrum selection.\n\n"
 25:   "The command line options are:\n"
 26:   "  -m <m>, where <m> = number of grid subdivisions in each dimension.\n\n";

 28: #include <slepceps.h>

 30: /*
 31:    User-defined routines
 32: */

 34: PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx);
 35: PetscErrorCode MatMarkovModel(PetscInt m,Mat A);

 39: int main(int argc,char **argv)
 40: {
 41:   Vec            v0;              /* initial vector */
 42:   Mat            A;               /* operator matrix */
 43:   EPS            eps;             /* eigenproblem solver context */
 44:   ST             st;              /* spectral transformation associated */
 45:   EPSType        type;
 46:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 47:   PetscScalar    target=0.5;
 48:   PetscInt       N,m=15,nev;

 51:   SlepcInitialize(&argc,&argv,(char*)0,help);

 53:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 54:   N = m*(m+1)/2;
 55:   PetscPrintf(PETSC_COMM_WORLD,"\nMarkov Model, N=%D (m=%D)\n",N,m);
 56:   PetscOptionsGetScalar(NULL,"-target",&target,NULL);
 57:   PetscPrintf(PETSC_COMM_WORLD,"Searching closest eigenvalues to the right of %G.\n\n",target);

 59:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 60:      Compute the operator matrix that defines the eigensystem, Ax=kx
 61:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 63:   MatCreate(PETSC_COMM_WORLD,&A);
 64:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 65:   MatSetFromOptions(A);
 66:   MatSetUp(A);
 67:   MatMarkovModel(m,A);

 69:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 70:                 Create the eigensolver and set various options
 71:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 73:   /*
 74:      Create eigensolver context
 75:   */
 76:   EPSCreate(PETSC_COMM_WORLD,&eps);

 78:   /*
 79:      Set operators. In this case, it is a standard eigenvalue problem
 80:   */
 81:   EPSSetOperators(eps,A,NULL);
 82:   EPSSetProblemType(eps,EPS_NHEP);
 83:   EPSSetTolerances(eps,tol,PETSC_DECIDE);

 85:   /*
 86:      Set the custom comparing routine in order to obtain the eigenvalues
 87:      closest to the target on the right only
 88:   */
 89:   EPSSetEigenvalueComparison(eps,MyEigenSort,&target);

 91:   /*
 92:      Set the preconditioner based on A - target * I
 93:   */
 94:   EPSGetST(eps,&st);
 95:   STSetShift(st,target);

 97:   /*
 98:      Set solver parameters at runtime
 99:   */
100:   EPSSetFromOptions(eps);

102:   /*
103:      Set the initial vector. This is optional, if not done the initial
104:      vector is set to random values
105:   */
106:   MatGetVecs(A,&v0,NULL);
107:   VecSet(v0,1.0);
108:   EPSSetInitialSpace(eps,1,&v0);

110:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
111:                       Solve the eigensystem
112:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

114:   EPSSolve(eps);

116:   /*
117:      Optional: Get some information from the solver and display it
118:   */
119:   EPSGetType(eps,&type);
120:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
121:   EPSGetDimensions(eps,&nev,NULL,NULL);
122:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

124:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
125:                     Display solution and clean up
126:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

128:   EPSPrintSolution(eps,NULL);
129:   EPSDestroy(&eps);
130:   MatDestroy(&A);
131:   VecDestroy(&v0);
132:   SlepcFinalize();
133:   return 0;
134: }

138: /*
139:     Matrix generator for a Markov model of a random walk on a triangular grid.

141:     This subroutine generates a test matrix that models a random walk on a
142:     triangular grid. This test example was used by G. W. Stewart ["{SRRIT} - a
143:     FORTRAN subroutine to calculate the dominant invariant subspaces of a real
144:     matrix", Tech. report. TR-514, University of Maryland (1978).] and in a few
145:     papers on eigenvalue problems by Y. Saad [see e.g. LAA, vol. 34, pp. 269-295
146:     (1980) ]. These matrices provide reasonably easy test problems for eigenvalue
147:     algorithms. The transpose of the matrix  is stochastic and so it is known
148:     that one is an exact eigenvalue. One seeks the eigenvector of the transpose
149:     associated with the eigenvalue unity. The problem is to calculate the steady
150:     state probability distribution of the system, which is the eigevector
151:     associated with the eigenvalue one and scaled in such a way that the sum all
152:     the components is equal to one.

154:     Note: the code will actually compute the transpose of the stochastic matrix
155:     that contains the transition probabilities.
156: */
157: PetscErrorCode MatMarkovModel(PetscInt m,Mat A)
158: {
159:   const PetscReal cst = 0.5/(PetscReal)(m-1);
160:   PetscReal       pd,pu;
161:   PetscInt        Istart,Iend,i,j,jmax,ix=0;
162:   PetscErrorCode  ierr;

165:   MatGetOwnershipRange(A,&Istart,&Iend);
166:   for (i=1;i<=m;i++) {
167:     jmax = m-i+1;
168:     for (j=1;j<=jmax;j++) {
169:       ix = ix + 1;
170:       if (ix-1<Istart || ix>Iend) continue;  /* compute only owned rows */
171:       if (j!=jmax) {
172:         pd = cst*(PetscReal)(i+j-1);
173:         /* north */
174:         if (i==1) {
175:           MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);
176:         } else {
177:           MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);
178:         }
179:         /* east */
180:         if (j==1) {
181:           MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);
182:         } else {
183:           MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);
184:         }
185:       }
186:       /* south */
187:       pu = 0.5 - cst*(PetscReal)(i+j-3);
188:       if (j>1) {
189:         MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);
190:       }
191:       /* west */
192:       if (i>1) {
193:         MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);
194:       }
195:     }
196:   }
197:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
198:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
199:   return(0);
200: }

204: /*
205:     Function for user-defined eigenvalue ordering criterion.

207:     Given two eigenvalues ar+i*ai and br+i*bi, the subroutine must choose
208:     one of them as the preferred one according to the criterion.
209:     In this example, the preferred value is the one closest to the target,
210:     but on the right side.
211: */
212: PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)
213: {
214:   PetscScalar target = *(PetscScalar*)ctx;
215:   PetscReal   da,db;
216:   PetscBool   aisright,bisright;

219:   if (PetscRealPart(target) < PetscRealPart(ar)) aisright = PETSC_TRUE;
220:   else aisright = PETSC_FALSE;
221:   if (PetscRealPart(target) < PetscRealPart(br)) bisright = PETSC_TRUE;
222:   else bisright = PETSC_FALSE;
223:   if (aisright == bisright) {
224:     /* both are on the same side of the target */
225:     da = SlepcAbsEigenvalue(ar-target,ai);
226:     db = SlepcAbsEigenvalue(br-target,bi);
227:     if (da < db) *r = -1;
228:     else if (da > db) *r = 1;
229:     else *r = 0;
230:   } else if (aisright && !bisright) *r = -1; /* 'a' is on the right */
231:   else *r = 1;  /* 'b' is on the right */
232:   return(0);
233: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test2.c0000644000175000017500000001235612211062077021205 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Tests multiple calls to EPSSolve with the same matrix.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* problem matrix */ EPS eps; /* eigenproblem solver context */ ST st; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscScalar value[3]; PetscInt n=30,i,Istart,Iend,col[3]; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE,flg; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,PETSC_DECIDE);CHKERRQ(ierr); ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve for largest eigenvalues - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL);CHKERRQ(ierr); ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," - - - Largest eigenvalues - - -\n");CHKERRQ(ierr); ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve for smallest eigenvalues - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr); ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," - - - Smallest eigenvalues - - -\n");CHKERRQ(ierr); ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve for interior eigenvalues (target=2.1) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr); ierr = EPSSetTarget(eps,2.1);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps,EPSLANCZOS,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGetST(eps,&st);CHKERRQ(ierr); ierr = STSetType(st,STSINVERT);CHKERRQ(ierr); } else { ierr = PetscObjectTypeCompare((PetscObject)eps,EPSKRYLOVSCHUR,&flg);CHKERRQ(ierr); if (!flg) { ierr = PetscObjectTypeCompare((PetscObject)eps,EPSARNOLDI,&flg);CHKERRQ(ierr); } if (flg) { ierr = EPSSetExtraction(eps,EPS_HARMONIC);CHKERRQ(ierr); } } ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," - - - Interior eigenvalues - - -\n");CHKERRQ(ierr); ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test10.c0000644000175000017500000001225112211062077021256 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Computes the smallest nonzero eigenvalue of the Laplacian of a graph.\n\n" "This example illustrates EPSSetDeflationSpace(). The example graph corresponds to a " "2-D regular mesh. The command line options are:\n" " -n , where = number of grid subdivisions in x dimension.\n" " -m , where = number of grid subdivisions in y dimension.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main (int argc,char **argv) { EPS eps; /* eigenproblem solver context */ Mat A; /* operator matrix */ Vec x; EPSType type; PetscInt N,n=10,m,i,j,II,Istart,Iend,nev; PetscScalar w; PetscBool flag; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nFiedler vector of a 2-D regular mesh, N=%D (%Dx%D grid)\n\n",N,n,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx In this example, A = L(G), where L is the Laplacian of graph G, i.e. Lii = degree of node i, Lij = -1 if edge (i,j) exists in G - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(A,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); w=w+1.0; } if (i0) { ierr = MatSetValue(A,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); w=w+1.0; } if (j. ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n test15f [-help] [-n ] [all SLEPc options] ! ! Description: Tests custom monitors from Fortran. ! ! The command line options are: ! -n , where = number of grid points = matrix size ! -my_eps_monitor, activates the custom monitor ! ! ---------------------------------------------------------------------- ! program main implicit none #include #include #include #include #include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! A operator matrix ! eps eigenproblem solver context Mat A EPS eps EPSType tname PetscInt n, i, Istart, Iend PetscInt nev PetscInt col(3) PetscInt i1,i2,i3 PetscMPIInt rank PetscErrorCode ierr PetscBool flg PetscScalar value(3) ! Note: Any user-defined Fortran routines (such as MyEPSMonitor) ! MUST be declared as external. external MyEPSMonitor ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) n = 30 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr) if (rank .eq. 0) then write(*,100) n endif 100 format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)') ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Compute the operator matrix that defines the eigensystem, Ax=kx ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call MatCreate(PETSC_COMM_WORLD,A,ierr) call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr) call MatSetFromOptions(A,ierr) call MatSetUp(A,ierr) i1 = 1 i2 = 2 i3 = 3 call MatGetOwnershipRange(A,Istart,Iend,ierr) if (Istart .eq. 0) then i = 0 col(1) = 0 col(2) = 1 value(1) = 2.0 value(2) = -1.0 call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr) Istart = Istart+1 endif if (Iend .eq. n) then i = n-1 col(1) = n-2 col(2) = n-1 value(1) = -1.0 value(2) = 2.0 call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr) Iend = Iend-1 endif value(1) = -1.0 value(2) = 2.0 value(3) = -1.0 do i=Istart,Iend-1 col(1) = i-1 col(2) = i col(3) = i+1 call MatSetValues(A,i1,i,i3,col,value,INSERT_VALUES,ierr) enddo call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the eigensolver and display info ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create eigensolver context call EPSCreate(PETSC_COMM_WORLD,eps,ierr) ! ** Set operators. In this case, it is a standard eigenvalue problem call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr) call EPSSetProblemType(eps,EPS_HEP,ierr) ! ** Set user-defined monitor call PetscOptionsHasName(PETSC_NULL_CHARACTER,'-my_eps_monitor', & & flg,ierr) if (flg) then call EPSMonitorSet(eps,MyEPSMonitor,PETSC_NULL_OBJECT, & & PETSC_NULL_FUNCTION,ierr) endif ! ** Set solver parameters at runtime call EPSSetFromOptions(eps,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the eigensystem ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSSolve(eps,ierr) ! ** Optional: Get some information from the solver and display it call EPSGetType(eps,tname,ierr) if (rank .eq. 0) then write(*,120) tname endif 120 format (' Solution method: ',A) call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,130) nev endif 130 format (' Number of requested eigenvalues:',I2) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr) call EPSDestroy(eps,ierr) call MatDestroy(A,ierr) call SlepcFinalize(ierr) end ! -------------------------------------------------------------- ! ! MyEPSMonitor - This is a user-defined routine for monitoring ! the EPS iterative solvers. ! ! Input Parameters: ! eps - eigensolver context ! its - iteration number ! nconv - number of converged eigenpairs ! eigr - real part of the eigenvalues ! eigi - imaginary part of the eigenvalues ! errest- relative error estimates for each eigenpair ! nest - number of error estimates ! dummy - optional user-defined monitor context (unused here) ! subroutine MyEPSMonitor(eps,its,nconv,eigr,eigi,errest,nest,dummy,& & ierr) implicit none #include #include #include #include #include EPS eps Vec x PetscErrorCode ierr PetscInt its,nconv,nest,dummy PetscScalar eigr(*),eigi(*) PetscReal re,errest(*) PetscMPIInt rank call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) if (its .gt. 0 .and. rank .eq. 0) then re = PetscRealPart(eigr(nconv+1)) write(6,140) its,nconv,re,errest(nconv+1) endif 140 format(i3,' EPS nconv=',i2,' first unconverged value (error) ', & & f6.4,' (',g9.3,')') ierr = 0 end slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test2.c.html0000644000175000017500000002531712211062077022151 0ustar gladkgladk
Actual source code: test2.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Tests multiple calls to EPSSolve with the same matrix.\n\n";

 24: #include <slepceps.h>

 28: int main(int argc,char **argv)
 29: {
 30:   Mat            A;           /* problem matrix */
 31:   EPS            eps;         /* eigenproblem solver context */
 32:   ST             st;
 33:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 34:   PetscScalar    value[3];
 35:   PetscInt       n=30,i,Istart,Iend,col[3];
 36:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE,flg;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);

 41:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 42:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);

 44:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 45:      Compute the operator matrix that defines the eigensystem, Ax=kx
 46:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 48:   MatCreate(PETSC_COMM_WORLD,&A);
 49:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 50:   MatSetFromOptions(A);
 51:   MatSetUp(A);

 53:   MatGetOwnershipRange(A,&Istart,&Iend);
 54:   if (Istart==0) FirstBlock=PETSC_TRUE;
 55:   if (Iend==n) LastBlock=PETSC_TRUE;
 56:   value[0]=-1.0; value[1]=2.0; value[2]=-1.0;
 57:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 58:     col[0]=i-1; col[1]=i; col[2]=i+1;
 59:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 60:   }
 61:   if (LastBlock) {
 62:     i=n-1; col[0]=n-2; col[1]=n-1;
 63:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 64:   }
 65:   if (FirstBlock) {
 66:     i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0;
 67:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 68:   }

 70:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 71:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 73:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 74:                         Create the eigensolver
 75:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 76:   EPSCreate(PETSC_COMM_WORLD,&eps);
 77:   EPSSetOperators(eps,A,NULL);
 78:   EPSSetProblemType(eps,EPS_HEP);
 79:   EPSSetTolerances(eps,tol,PETSC_DECIDE);
 80:   EPSSetFromOptions(eps);

 82:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 83:                     Solve for largest eigenvalues
 84:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 85:   EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL);
 86:   EPSSolve(eps);
 87:   PetscPrintf(PETSC_COMM_WORLD," - - - Largest eigenvalues - - -\n");
 88:   EPSPrintSolution(eps,NULL);

 90:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 91:                     Solve for smallest eigenvalues
 92:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 93:   EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);
 94:   EPSSolve(eps);
 95:   PetscPrintf(PETSC_COMM_WORLD," - - - Smallest eigenvalues - - -\n");
 96:   EPSPrintSolution(eps,NULL);

 98:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 99:                     Solve for interior eigenvalues (target=2.1)
100:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
101:   EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);
102:   EPSSetTarget(eps,2.1);
103:   PetscObjectTypeCompare((PetscObject)eps,EPSLANCZOS,&flg);
104:   if (flg) {
105:     EPSGetST(eps,&st);
106:     STSetType(st,STSINVERT);
107:   } else {
108:     PetscObjectTypeCompare((PetscObject)eps,EPSKRYLOVSCHUR,&flg);
109:     if (!flg) {
110:       PetscObjectTypeCompare((PetscObject)eps,EPSARNOLDI,&flg);
111:     }
112:     if (flg) {
113:       EPSSetExtraction(eps,EPS_HARMONIC);
114:     }
115:   }
116:   EPSSolve(eps);
117:   PetscPrintf(PETSC_COMM_WORLD," - - - Interior eigenvalues - - -\n");
118:   EPSPrintSolution(eps,NULL);

120:   EPSDestroy(&eps);
121:   MatDestroy(&A);
122:   SlepcFinalize();
123:   return 0;
124: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test13.c0000644000175000017500000001175612211062077021272 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test EPSSetArbitrarySelection.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "MyArbitrarySelection" PetscErrorCode MyArbitrarySelection(PetscScalar eigr,PetscScalar eigi,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx) { PetscErrorCode ierr; Vec xref = *(Vec*)ctx; PetscFunctionBeginUser; ierr = VecDot(xr,xref,rr);CHKERRQ(ierr); *rr = PetscAbsScalar(*rr); if (ri) *ri = 0.0; PetscFunctionReturn(0); } #undef __funct__ #define __funct__ "main" int main(int argc,char **argv) { Mat A; /* problem matrices */ EPS eps; /* eigenproblem solver context */ PetscScalar seigr,seigi,value[3]; PetscReal tol=1000*PETSC_MACHINE_EPSILON; Vec sxr,sxi; PetscInt n=30,i,Istart,Iend,col[3],nconv; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nTridiagonal with zero diagonal, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create matrix tridiag([-1 0 -1]) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=0.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=0.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,PETSC_DECIDE);CHKERRQ(ierr); ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr); ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve eigenproblem and store some solution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = MatGetVecs(A,&sxr,NULL);CHKERRQ(ierr); ierr = MatGetVecs(A,&sxi,NULL);CHKERRQ(ierr); ierr = EPSGetConverged(eps,&nconv);CHKERRQ(ierr); if (nconv>0) { ierr = EPSGetEigenpair(eps,0,&seigr,&seigi,sxr,sxi);CHKERRQ(ierr); ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve eigenproblem using an arbitrary selection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSetArbitrarySelection(eps,MyArbitrarySelection,&sxr);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_MAGNITUDE);CHKERRQ(ierr); ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD,"Problem: no eigenpairs converged.\n");CHKERRQ(ierr); } ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = VecDestroy(&sxr);CHKERRQ(ierr); ierr = VecDestroy(&sxi);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test14f.F.html0000644000175000017500000004165412211062077022347 0ustar gladkgladk
Actual source code: test14f.F

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Description: Simple example to test the EPS Fortran interface.
 21: !
 22: ! ----------------------------------------------------------------------
 23: !
 24:       program main
 25:       implicit none

 27: #include <finclude/petscsys.h>
 28: #include <finclude/petscvec.h>
 29: #include <finclude/petscmat.h>
 30: #include <finclude/slepcsys.h>
 31: #include <finclude/slepceps.h>

 33: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 34: !     Declarations
 35: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 36:       Mat                A,B
 37:       EPS                eps
 38:       ST                 st
 39:       IP                 ip
 40:       DS                 ds
 41:       PetscReal          cut,tol
 42:       PetscScalar        tget,value
 43:       PetscInt           n,i,its,Istart,Iend
 44:       PetscInt           nev,ncv,mpd
 45:       PetscBool          flg
 46:       EPSConvergedReason reason
 47:       EPSType            tname
 48:       EPSExtraction      extr
 49:       EPSBalance         bal
 50:       EPSWhich           which
 51:       EPSConv            conv
 52:       EPSProblemType     ptype
 53:       PetscMPIInt        rank
 54:       PetscErrorCode     ierr

 56: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 57: !     Beginning of program
 58: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 60:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 61:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 62:       n = 20
 63:       if (rank .eq. 0) then
 64:         write(*,100) n
 65:       endif
 66:  100  format (/'Diagonal Eigenproblem, n =',I3,' (Fortran)')

 68:       call MatCreate(PETSC_COMM_WORLD,A,ierr)
 69:       call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr)
 70:       call MatSetFromOptions(A,ierr)
 71:       call MatSetUp(A,ierr)
 72:       call MatGetOwnershipRange(A,Istart,Iend,ierr)
 73:       do i=Istart,Iend-1
 74:         value = i+1
 75:         call MatSetValue(A,i,i,value,INSERT_VALUES,ierr)
 76:       enddo
 77:       call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)
 78:       call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)

 80: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 81: !     Create eigensolver and test interface functions
 82: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 84:       call EPSCreate(PETSC_COMM_WORLD,eps,ierr)
 85:       call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr)
 86:       call EPSGetOperators(eps,B,PETSC_NULL_OBJECT,ierr)
 87:       call MatView(B,PETSC_NULL_OBJECT,ierr)

 89:       call EPSSetType(eps,EPSKRYLOVSCHUR,ierr)
 90:       call EPSGetType(eps,tname,ierr)
 91:       if (rank .eq. 0) then
 92:         write(*,110) tname
 93:       endif
 94:  110  format (' Type set to ',A)

 96:       call EPSGetProblemType(eps,ptype,ierr)
 97:       if (rank .eq. 0) then
 98:         write(*,120) ptype
 99:       endif
100:  120  format (' Problem type before changing = ',I2)
101:       call EPSSetProblemType(eps,EPS_HEP,ierr)
102:       call EPSGetProblemType(eps,ptype,ierr)
103:       if (rank .eq. 0) then
104:         write(*,130) ptype
105:       endif
106:  130  format (' ... changed to ',I2)
107:       call EPSIsGeneralized(eps,flg,ierr)
108:       if (flg .and. rank .eq. 0) then
109:         write(*,*) 'generalized'
110:       endif
111:       call EPSIsHermitian(eps,flg,ierr)
112:       if (flg .and. rank .eq. 0) then
113:         write(*,*) 'hermitian'
114:       endif
115:       call EPSIsPositive(eps,flg,ierr)
116:       if (flg .and. rank .eq. 0) then
117:         write(*,*) 'positive'
118:       endif

120:       call EPSGetExtraction(eps,extr,ierr)
121:       if (rank .eq. 0) then
122:         write(*,140) extr
123:       endif
124:  140  format (' Extraction before changing = ',I2)
125:       call EPSSetExtraction(eps,EPS_HARMONIC,ierr)
126:       call EPSGetExtraction(eps,extr,ierr)
127:       if (rank .eq. 0) then
128:         write(*,150) extr
129:       endif
130:  150  format (' ... changed to ',I2)

132:       its = 8
133:       cut = 1.0d-6
134:       bal = EPS_BALANCE_ONESIDE
135:       call EPSSetBalance(eps,bal,its,cut,ierr)
136: !      call EPSGetBalance(eps,bal,its,cut,ierr)
137:       if (rank .eq. 0) then
138:         write(*,160) bal,its,cut
139:       endif
140:  160  format (' Balance: ',I2,', its=',I2,', cutoff=',F8.6)

142:       tget = 4.8
143:       call EPSSetTarget(eps,tget,ierr)
144:       call EPSGetTarget(eps,tget,ierr)
145:       call EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE,ierr)
146:       call EPSGetWhichEigenpairs(eps,which,ierr)
147:       if (rank .eq. 0) then
148:         write(*,170) which,PetscRealPart(tget)
149:       endif
150:  170  format (' Which = ',I2,', target = ',F3.1)

152:       nev = 4
153:       call EPSSetDimensions(eps,nev,PETSC_NULL_INTEGER,                 &
154:      &                      PETSC_NULL_INTEGER,ierr)
155:       call EPSGetDimensions(eps,nev,ncv,mpd,ierr)
156:       if (rank .eq. 0) then
157:         write(*,180) nev,ncv,mpd
158:       endif
159:  180  format (' Dimensions: nev=',I2,', ncv=',I2,', mpd=',I2)

161:       tol = 2.2d-4
162:       its = 200
163:       call EPSSetTolerances(eps,tol,its,ierr)
164:       call EPSGetTolerances(eps,tol,its,ierr)
165:       if (rank .eq. 0) then
166:         write(*,190) tol,its
167:       endif
168:  190  format (' Tolerance =',F7.5,', max_its =',I4)

170:       call EPSSetConvergenceTest(eps,EPS_CONV_ABS,ierr)
171: !      call EPSGetConvergenceTest(eps,conv,ierr)
172:       conv = 0
173:       if (rank .eq. 0) then
174:         write(*,200) conv
175:       endif
176:  200  format (' Convergence test =',I2)

178:       call EPSMonitorSet(eps,EPSMONITORFIRST,PETSC_NULL_OBJECT,         &
179:      &                   PETSC_NULL_FUNCTION,ierr)
180:       call EPSMonitorCancel(eps,ierr)

182:       call EPSGetST(eps,st,ierr)
183:       call STView(st,PETSC_NULL_OBJECT,ierr)
184:       call EPSGetIP(eps,ip,ierr)
185:       call IPView(ip,PETSC_NULL_OBJECT,ierr)
186:       call EPSGetDS(eps,ds,ierr)
187:       call DSView(ds,PETSC_NULL_OBJECT,ierr)

189:       call EPSSetFromOptions(eps,ierr)
190:       call EPSSolve(eps,ierr)
191:       call EPSGetConvergedReason(eps,reason,ierr)
192:       call EPSGetIterationNumber(eps,its,ierr)
193:       if (rank .eq. 0) then
194:         write(*,210) reason,its
195:       endif
196:  210  format (' Finished - converged reason =',I2,', its=',I4)

198: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
199: !     Display solution and clean up
200: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
201:       call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr)
202:       call EPSDestroy(eps,ierr)
203:       call MatDestroy(A,ierr)

205:       call SlepcFinalize(ierr)
206:       end
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test3.c.html0000644000175000017500000002410212211062077022141 0ustar gladkgladk
Actual source code: test3.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Tests multiple calls to EPSSolve with different matrix.\n\n";

 24: #include <slepceps.h>

 28: int main(int argc,char **argv)
 29: {
 30:   Mat            A1,A2;       /* problem matrices */
 31:   EPS            eps;         /* eigenproblem solver context */
 32:   PetscScalar    value[3];
 33:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON,v;
 34:   Vec            d;
 35:   PetscInt       n=30,i,Istart,Iend,col[3];
 36:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;
 37:   PetscRandom    myrand;

 40:   SlepcInitialize(&argc,&argv,(char*)0,help);

 42:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 43:   PetscPrintf(PETSC_COMM_WORLD,"\nTridiagonal with random diagonal, n=%D\n\n",n);

 45:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 46:            Create matrix tridiag([-1 0 -1])
 47:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 48:   MatCreate(PETSC_COMM_WORLD,&A1);
 49:   MatSetSizes(A1,PETSC_DECIDE,PETSC_DECIDE,n,n);
 50:   MatSetFromOptions(A1);
 51:   MatSetUp(A1);

 53:   MatGetOwnershipRange(A1,&Istart,&Iend);
 54:   if (Istart==0) FirstBlock=PETSC_TRUE;
 55:   if (Iend==n) LastBlock=PETSC_TRUE;
 56:   value[0]=-1.0; value[1]=0.0; value[2]=-1.0;
 57:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 58:     col[0]=i-1; col[1]=i; col[2]=i+1;
 59:     MatSetValues(A1,1,&i,3,col,value,INSERT_VALUES);
 60:   }
 61:   if (LastBlock) {
 62:     i=n-1; col[0]=n-2; col[1]=n-1;
 63:     MatSetValues(A1,1,&i,2,col,value,INSERT_VALUES);
 64:   }
 65:   if (FirstBlock) {
 66:     i=0; col[0]=0; col[1]=1; value[0]=0.0; value[1]=-1.0;
 67:     MatSetValues(A1,1,&i,2,col,value,INSERT_VALUES);
 68:   }

 70:   MatAssemblyBegin(A1,MAT_FINAL_ASSEMBLY);
 71:   MatAssemblyEnd(A1,MAT_FINAL_ASSEMBLY);

 73:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 74:        Create two matrices by filling the diagonal with rand values
 75:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 76:   MatDuplicate(A1,MAT_COPY_VALUES,&A2);
 77:   MatGetVecs(A1,NULL,&d);
 78:   PetscRandomCreate(PETSC_COMM_WORLD,&myrand);
 79:   PetscRandomSetFromOptions(myrand);
 80:   PetscRandomSetInterval(myrand,0.0,1.0);
 81:   for (i=0; i<n; i++) {
 82:     PetscRandomGetValueReal(myrand,&v);
 83:     VecSetValue(d,i,v,INSERT_VALUES);
 84:   }
 85:   VecAssemblyBegin(d);
 86:   VecAssemblyEnd(d);
 87:   MatDiagonalSet(A1,d,INSERT_VALUES);
 88:   for (i=0; i<n; i++) {
 89:     PetscRandomGetValueReal(myrand,&v);
 90:     VecSetValue(d,i,v,INSERT_VALUES);
 91:   }
 92:   VecAssemblyBegin(d);
 93:   VecAssemblyEnd(d);
 94:   MatDiagonalSet(A2,d,INSERT_VALUES);
 95:   VecDestroy(&d);
 96:   PetscRandomDestroy(&myrand);

 98:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 99:                         Create the eigensolver
100:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
101:   EPSCreate(PETSC_COMM_WORLD,&eps);
102:   EPSSetProblemType(eps,EPS_HEP);
103:   EPSSetTolerances(eps,tol,PETSC_DECIDE);
104:   EPSSetOperators(eps,A1,NULL);
105:   EPSSetFromOptions(eps);

107:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108:                         Solve first eigenproblem
109:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
110:   EPSSolve(eps);
111:   PetscPrintf(PETSC_COMM_WORLD," - - - First matrix - - -\n");
112:   EPSPrintSolution(eps,NULL);

114:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115:                         Solve second eigenproblem
116:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
117:   EPSSetOperators(eps,A2,NULL);
118:   EPSSolve(eps);
119:   PetscPrintf(PETSC_COMM_WORLD," - - - Second matrix - - -\n");
120:   EPSPrintSolution(eps,NULL);

122:   EPSDestroy(&eps);
123:   MatDestroy(&A1);
124:   MatDestroy(&A2);
125:   SlepcFinalize();
126:   return 0;
127: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test12.c0000644000175000017500000001034212211062077021257 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Diagonal eigenproblem. Illustrates use of shell preconditioner.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions = matrix dimension.\n" " -seed , where = seed for random number generation.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "PCApply_User" PetscErrorCode PCApply_User(PC pc,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBeginUser; ierr = VecCopy(x,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* problem matrix */ EPS eps; /* eigenproblem solver context */ Vec v0; /* initial vector */ PetscRandom rand; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscInt n=30,i,Istart,Iend,seed=0x12345678; PetscErrorCode ierr; ST st; KSP ksp; PC pc; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nDiagonal Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;iActual source code: test7f.F
  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n test7f [-help] [-n <n>] [all SLEPc options]
 21: !
 22: !  Description: Simple example that solves an eigensystem with the EPS object.
 23: !  Same problem as ex1f but with simplified output.
 24: !
 25: !  The command line options are:
 26: !    -n <n>, where <n> = number of grid points = matrix size
 27: !
 28: ! ----------------------------------------------------------------------
 29: !
 30:       program main
 31:       implicit none

 33: #include <finclude/petscsys.h>
 34: #include <finclude/petscvec.h>
 35: #include <finclude/petscmat.h>
 36: #include <finclude/slepcsys.h>
 37: #include <finclude/slepceps.h>

 39: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 40: !     Declarations
 41: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 42: !
 43: !  Variables:
 44: !     A     operator matrix
 45: !     eps   eigenproblem solver context

 47:       Mat            A
 48:       EPS            eps
 49:       EPSType        tname
 50:       PetscInt       n, i, Istart, Iend
 51:       PetscInt       nev
 52:       PetscInt       col(3)
 53:       PetscInt       i1,i2,i3
 54:       PetscMPIInt    rank
 55:       PetscErrorCode ierr
 56:       PetscBool      flg
 57:       PetscScalar    value(3)

 59: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 60: !     Beginning of program
 61: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 63:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 64:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 65:       n = 30
 66:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)

 68:       if (rank .eq. 0) then
 69:         write(*,100) n
 70:       endif
 71:  100  format (/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')

 73: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 74: !     Compute the operator matrix that defines the eigensystem, Ax=kx
 75: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 77:       call MatCreate(PETSC_COMM_WORLD,A,ierr)
 78:       call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n,ierr)
 79:       call MatSetFromOptions(A,ierr)
 80:       call MatSetUp(A,ierr)

 82:       i1 = 1
 83:       i2 = 2
 84:       i3 = 3
 85:       call MatGetOwnershipRange(A,Istart,Iend,ierr)
 86:       if (Istart .eq. 0) then
 87:         i = 0
 88:         col(1) = 0
 89:         col(2) = 1
 90:         value(1) =  2.0
 91:         value(2) = -1.0
 92:         call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr)
 93:         Istart = Istart+1
 94:       endif
 95:       if (Iend .eq. n) then
 96:         i = n-1
 97:         col(1) = n-2
 98:         col(2) = n-1
 99:         value(1) = -1.0
100:         value(2) =  2.0
101:         call MatSetValues(A,i1,i,i2,col,value,INSERT_VALUES,ierr)
102:         Iend = Iend-1
103:       endif
104:       value(1) = -1.0
105:       value(2) =  2.0
106:       value(3) = -1.0
107:       do i=Istart,Iend-1
108:         col(1) = i-1
109:         col(2) = i
110:         col(3) = i+1
111:         call MatSetValues(A,i1,i,i3,col,value,INSERT_VALUES,ierr)
112:       enddo

114:       call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)
115:       call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)

117: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
118: !     Create the eigensolver and display info
119: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

121: !     ** Create eigensolver context
122:       call EPSCreate(PETSC_COMM_WORLD,eps,ierr)

124: !     ** Set operators. In this case, it is a standard eigenvalue problem
125:       call EPSSetOperators(eps,A,PETSC_NULL_OBJECT,ierr)
126:       call EPSSetProblemType(eps,EPS_HEP,ierr)

128: !     ** Set solver parameters at runtime
129:       call EPSSetFromOptions(eps,ierr)

131: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
132: !     Solve the eigensystem
133: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

135:       call EPSSolve(eps,ierr)

137: !     ** Optional: Get some information from the solver and display it
138:       call EPSGetType(eps,tname,ierr)
139:       if (rank .eq. 0) then
140:         write(*,120) tname
141:       endif
142:  120  format (' Solution method: ',A)
143:       call EPSGetDimensions(eps,nev,PETSC_NULL_INTEGER,                 &
144:      &                      PETSC_NULL_INTEGER,ierr)
145:       if (rank .eq. 0) then
146:         write(*,130) nev
147:       endif
148:  130  format (' Number of requested eigenvalues:',I2)

150: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
151: !     Display solution and clean up
152: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

154:       call EPSPrintSolution(eps,PETSC_NULL_OBJECT,ierr)
155:       call EPSDestroy(eps,ierr)
156:       call MatDestroy(A,ierr)

158:       call SlepcFinalize(ierr)
159:       end

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test4.c.html0000644000175000017500000002522612211062077022152 0ustar gladkgladk
Actual source code: test4.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test the solution of a HEP without calling EPSSetFromOptions (based on ex1.c).\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions = matrix dimension.\n"
 25:   "  -type <eps_type> = eps type to test.\n\n";

 27: #include <slepceps.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;           /* problem matrix */
 34:   EPS            eps;         /* eigenproblem solver context */
 35:   EPSType        type;
 36:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 37:   PetscScalar    value[3];
 38:   PetscInt       n=30,i,Istart,Iend,col[3],nev;
 39:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE,isgd2;
 40:   char           epstype[30] = "krylovschur";

 43:   SlepcInitialize(&argc,&argv,(char*)0,help);

 45:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 46:   PetscOptionsGetString(NULL,"-type",epstype,30,NULL);
 47:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D",n);
 48:   PetscPrintf(PETSC_COMM_WORLD,"\nEPS type: %s\n\n",epstype);

 50:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 51:      Compute the operator matrix that defines the eigensystem, Ax=kx
 52:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 54:   MatCreate(PETSC_COMM_WORLD,&A);
 55:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 56:   MatSetFromOptions(A);
 57:   MatSetUp(A);

 59:   MatGetOwnershipRange(A,&Istart,&Iend);
 60:   if (Istart==0) FirstBlock=PETSC_TRUE;
 61:   if (Iend==n) LastBlock=PETSC_TRUE;
 62:   value[0]=-1.0; value[1]=2.0; value[2]=-1.0;
 63:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 64:     col[0]=i-1; col[1]=i; col[2]=i+1;
 65:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 66:   }
 67:   if (LastBlock) {
 68:     i=n-1; col[0]=n-2; col[1]=n-1;
 69:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 70:   }
 71:   if (FirstBlock) {
 72:     i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0;
 73:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 74:   }

 76:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 77:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 79:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 80:                 Create the eigensolver and set various options
 81:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 82:   /*
 83:      Create eigensolver context
 84:   */
 85:   EPSCreate(PETSC_COMM_WORLD,&eps);

 87:   /*
 88:      Set operators. In this case, it is a standard eigenvalue problem
 89:   */
 90:   EPSSetOperators(eps,A,NULL);
 91:   EPSSetProblemType(eps,EPS_HEP);
 92:   EPSSetDimensions(eps,4,PETSC_DEFAULT,PETSC_DEFAULT);
 93:   EPSSetTolerances(eps,tol,PETSC_DEFAULT);

 95:   /*
 96:      Set solver parameters at runtime
 97:   */
 98:   PetscStrcmp(epstype,"gd2",&isgd2);
 99:   if (isgd2) {
100:     EPSSetType(eps,EPSGD);
101:     EPSGDSetDoubleExpansion(eps,PETSC_TRUE);
102:   } else {
103:     EPSSetType(eps,epstype);
104:   }

106:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
107:                       Solve the eigensystem
108:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

110:   EPSSolve(eps);
111:   /*
112:      Optional: Get some information from the solver and display it
113:   */
114:   EPSGetType(eps,&type);
115:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
116:   EPSGetDimensions(eps,&nev,NULL,NULL);
117:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

119:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
120:                     Display solution and clean up
121:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

123:   EPSPrintSolution(eps,NULL);
124:   EPSDestroy(&eps);
125:   MatDestroy(&A);
126:   SlepcFinalize();
127:   return 0;
128: }
slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test5.c.html0000644000175000017500000002104312211062077022144 0ustar gladkgladk
Actual source code: test5.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test EPS with different builds with a matrix loaded from a file.\n"
 23:   "This test is based on ex4.c in tutorials.\n"
 24:   "It loads test matrices available in PETSc's distribution.\n"
 25:   "Add -symm or -herm to select the symmetric/Hermitian matrix.\n\n";

 27: #include <slepceps.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;               /* operator matrix */
 34:   EPS            eps;             /* eigenproblem solver context */
 35:   char           filename[PETSC_MAX_PATH_LEN];
 36:   const char     *prefix,*scalar,*ints,*floats;
 37:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 38:   PetscViewer    viewer;
 39:   PetscBool      flg,symm;

 42:   SlepcInitialize(&argc,&argv,(char*)0,help);

 44:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 45:         Load the operator matrix that defines the eigensystem, Ax=kx
 46:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 47:   PetscOptionsHasName(NULL,"-symm",&symm);
 48:   PetscOptionsHasName(NULL,"-herm",&flg);
 49:   if (flg) symm=PETSC_TRUE;
 50: #if defined(PETSC_USE_COMPLEX)
 51:   prefix = symm? "hpd": "nh";
 52:   scalar = "complex";
 53: #else
 54:   prefix = symm? "spd": "ns";
 55:   scalar = "real";
 56: #endif
 57: #if defined(PETSC_USE_64BIT_INDICES)
 58:   ints   = "int64";
 59: #else
 60:   ints   = "int32";
 61: #endif
 62: #if defined(PETSC_USE_REAL_DOUBLE)
 63:   floats = "float64";
 64: #elif defined(PETSC_USE_REAL_SINGLE)
 65:   floats = "float32";
 66: #endif

 68:   PetscSNPrintf(filename,PETSC_MAX_PATH_LEN,"%s/share/petsc/datafiles/matrices/%s-%s-%s-%s",PETSC_DIR,prefix,scalar,ints,floats);
 69:   PetscPrintf(PETSC_COMM_WORLD,"\nReading matrix from binary file...\n\n");
 70:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 71:   MatCreate(PETSC_COMM_WORLD,&A);
 72:   MatSetFromOptions(A);
 73:   MatLoad(A,viewer);
 74:   PetscViewerDestroy(&viewer);

 76:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 77:                      Create the eigensolver
 78:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 79:   EPSCreate(PETSC_COMM_WORLD,&eps);
 80:   EPSSetOperators(eps,A,NULL);
 81:   if (symm) {
 82:     EPSSetProblemType(eps,EPS_HEP);
 83:   } else {
 84:     EPSSetProblemType(eps,EPS_NHEP);
 85:   }
 86:   EPSSetTolerances(eps,tol,PETSC_DEFAULT);
 87:   EPSSetFromOptions(eps);

 89:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 90:                 Solve the eigensystem and display solution
 91:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 92:   EPSSolve(eps);
 93:   EPSPrintSolution(eps,NULL);
 94:   EPSDestroy(&eps);
 95:   MatDestroy(&A);
 96:   SlepcFinalize();
 97:   return 0;
 98: }

slepc-3.4.2.dfsg.orig/src/eps/examples/tests/test14.c0000644000175000017500000001417112211062077021265 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test EPS interface functions.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,B; /* problem matrix */ EPS eps; /* eigenproblem solver context */ ST st; IP ip; DS ds; PetscReal cut,tol; PetscScalar target; PetscInt n=20,i,its,nev,ncv,mpd,Istart,Iend; PetscBool flg; EPSConvergedReason reason; EPSType type; EPSExtraction extr; EPSBalance bal; EPSWhich which; EPSConv conv; EPSProblemType ptype; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nDiagonal Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i Generic SLEPc Manual Pages

tests/
tutorials/
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/0000755000175000017500000000000012214143515016135 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/0000755000175000017500000000000012214143515017744 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/0000755000175000017500000000000012214143515020341 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/jd.c0000644000175000017500000006147112211062077021113 0ustar gladkgladk/* SLEPc eigensolver: "jd" Method: Jacobi-Davidson Algorithm: Jacobi-Davidson with various subspace extraction and restart techniques. References: [1] G.L.G. Sleijpen and H.A. van der Vorst, "A Jacobi-Davidson iteration method for linear eigenvalue problems", SIAM J. Matrix Anal. Appl. 17(2):401-425, 1996. [2] E. Romero and J.E. Roman, "A parallel implementation of Davidson methods for large-scale eigenvalue problems in SLEPc", submitted, 2013. Last update: Jul 2012 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include <../src/eps/impls/davidson/common/davidson.h> #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_JD" PetscErrorCode EPSSetFromOptions_JD(EPS eps) { PetscErrorCode ierr; PetscBool flg,op; PetscInt opi,opi0; PetscReal opf; KSP ksp; EPSOrthType orth; const char *orth_list[3] = {"I","B","B_opt"}; PetscFunctionBegin; ierr = PetscOptionsHead("EPS Jacobi-Davidson (JD) Options");CHKERRQ(ierr); ierr = EPSJDGetKrylovStart(eps,&op);CHKERRQ(ierr); ierr = PetscOptionsBool("-eps_jd_krylov_start","Start the searching subspace with a krylov basis","EPSJDSetKrylovStart",op,&op,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetKrylovStart(eps,op);CHKERRQ(ierr); } ierr = EPSJDGetBlockSize(eps,&opi);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_jd_blocksize","Number vectors add to the searching subspace","EPSJDSetBlockSize",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetBlockSize(eps,opi);CHKERRQ(ierr); } ierr = EPSJDGetRestart(eps,&opi,&opi0);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_jd_minv","Set the size of the searching subspace after restarting","EPSJDSetRestart",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetRestart(eps,opi,opi0);CHKERRQ(ierr); } ierr = PetscOptionsInt("-eps_jd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSJDSetRestart",opi0,&opi0,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetRestart(eps,opi,opi0);CHKERRQ(ierr); } ierr = EPSJDGetInitialSize(eps,&opi);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_jd_initial_size","Set the initial size of the searching subspace","EPSJDSetInitialSize",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetInitialSize(eps,opi);CHKERRQ(ierr); } ierr = EPSJDGetFix(eps,&opf);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_jd_fix","Set the tolerance for changing the target in the correction equation","EPSJDSetFix",opf,&opf,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetFix(eps,opf);CHKERRQ(ierr); } ierr = EPSJDGetBOrth(eps,&orth);CHKERRQ(ierr); ierr = PetscOptionsEList("-eps_jd_borth","orthogonalization used in the search subspace","EPSJDSetBOrth",orth_list,3,orth_list[orth-1],&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetBOrth(eps,(EPSOrthType)(opi+1));CHKERRQ(ierr); } ierr = EPSJDGetConstCorrectionTol(eps,&op);CHKERRQ(ierr); ierr = PetscOptionsBool("-eps_jd_const_correction_tol","Disable the dynamic stopping criterion when solving the correction equation","EPSJDSetConstCorrectionTol",op,&op,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetConstCorrectionTol(eps,op);CHKERRQ(ierr); } ierr = EPSJDGetWindowSizes(eps,&opi,&opi0);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_jd_pwindow","(Experimental!) Set the number of converged vectors in the projector","EPSJDSetWindowSizes",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); } ierr = PetscOptionsInt("-eps_jd_qwindow","(Experimental!) Set the number of converged vectors in the projected problem","EPSJDSetWindowSizes",opi0,&opi0,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSJDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); } /* Set STPrecond as the default ST */ if (!((PetscObject)eps->st)->type_name) { ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); } ierr = STPrecondSetKSPHasMat(eps->st,PETSC_FALSE);CHKERRQ(ierr); /* Set the default options of the KSP */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); if (!((PetscObject)ksp)->type_name) { ierr = KSPSetType(ksp,KSPBCGSL);CHKERRQ(ierr); ierr = KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_JD" PetscErrorCode EPSSetUp_JD(EPS eps) { PetscErrorCode ierr; PetscBool t; KSP ksp; PetscFunctionBegin; /* Setup common for all davidson solvers */ ierr = EPSSetUp_XD(eps);CHKERRQ(ierr); /* Set the default options of the KSP */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); if (!((PetscObject)ksp)->type_name) { ierr = KSPSetType(ksp,KSPBCGSL);CHKERRQ(ierr); ierr = KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);CHKERRQ(ierr); } /* Check some constraints */ ierr = PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr); if (t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"EPSJD does not work with KSPPREONLY"); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_JD" PetscErrorCode EPSDestroy_JD(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetKrylovStart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetKrylovStart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetRestart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetRestart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetInitialSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetInitialSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetFix_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetFix_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetConstCorrectionTol_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetConstCorrectionTol_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetWindowSizes_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetWindowSizes_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBOrth_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBOrth_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetKrylovStart" /*@ EPSJDSetKrylovStart - Activates or deactivates starting the searching subspace with a Krylov basis. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - krylovstart - boolean flag Options Database Key: . -eps_jd_krylov_start - Activates starting the searching subspace with a Krylov basis Level: advanced .seealso: EPSJDGetKrylovStart() @*/ PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,krylovstart,2); ierr = PetscTryMethod(eps,"EPSJDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetKrylovStart" /*@ EPSJDGetKrylovStart - Returns a flag indicating if the searching subspace is started with a Krylov basis. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: . krylovstart - boolean flag indicating if the searching subspace is started with a Krylov basis Level: advanced .seealso: EPSJDGetKrylovStart() @*/ PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscBool *krylovstart) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(krylovstart,2); ierr = PetscTryMethod(eps,"EPSJDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetBlockSize" /*@ EPSJDSetBlockSize - Sets the number of vectors to be added to the searching space in every iteration. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - blocksize - number of vectors added to the search space in every iteration Options Database Key: . -eps_jd_blocksize - number of vectors added to the searching space every iteration Level: advanced .seealso: EPSJDSetKrylovStart() @*/ PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,blocksize,2); ierr = PetscTryMethod(eps,"EPSJDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetBlockSize" /*@ EPSJDGetBlockSize - Returns the number of vectors to be added to the searching space in every iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . blocksize - number of vectors added to the search space in every iteration Level: advanced .seealso: EPSJDSetBlockSize() @*/ PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(blocksize,2); ierr = PetscTryMethod(eps,"EPSJDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetRestart" /*@ EPSJDGetRestart - Gets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: + minv - number of vectors of the searching subspace after restarting - plusk - number of vectors saved from the previous iteration Level: advanced .seealso: EPSJDSetRestart() @*/ PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSJDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetRestart" /*@ EPSJDSetRestart - Sets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . minv - number of vectors of the searching subspace after restarting - plusk - number of vectors saved from the previous iteration Options Database Keys: + -eps_jd_minv - number of vectors of the searching subspace after restarting - -eps_jd_plusk - number of vectors saved from the previous iteration Level: advanced .seealso: EPSJDGetRestart() @*/ PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,minv,2); PetscValidLogicalCollectiveInt(eps,plusk,3); ierr = PetscTryMethod(eps,"EPSJDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetInitialSize" /*@ EPSJDGetInitialSize - Returns the initial size of the searching space. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . initialsize - number of vectors of the initial searching subspace Notes: If EPSJDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSJDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors. Level: advanced .seealso: EPSJDSetInitialSize(), EPSJDGetKrylovStart() @*/ PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(initialsize,2); ierr = PetscTryMethod(eps,"EPSJDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetInitialSize" /*@ EPSJDSetInitialSize - Sets the initial size of the searching space. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - initialsize - number of vectors of the initial searching subspace Options Database Key: . -eps_jd_initial_size - number of vectors of the initial searching subspace Notes: If EPSJDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSJDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors. Level: advanced .seealso: EPSJDGetInitialSize(), EPSJDGetKrylovStart() @*/ PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,initialsize,2); ierr = PetscTryMethod(eps,"EPSJDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetFix" /*@ EPSJDGetFix - Returns the threshold for changing the target in the correction equation. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . fix - threshold for changing the target Note: The target in the correction equation is fixed at the first iterations. When the norm of the residual vector is lower than the fix value, the target is set to the corresponding eigenvalue. Level: advanced .seealso: EPSJDSetFix() @*/ PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(fix,2); ierr = PetscTryMethod(eps,"EPSJDGetFix_C",(EPS,PetscReal*),(eps,fix));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetFix" /*@ EPSJDSetFix - Sets the threshold for changing the target in the correction equation. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - fix - threshold for changing the target Options Database Key: . -eps_jd_fix - the fix value Note: The target in the correction equation is fixed at the first iterations. When the norm of the residual vector is lower than the fix value, the target is set to the corresponding eigenvalue. Level: advanced .seealso: EPSJDGetFix() @*/ PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveReal(eps,fix,2); ierr = PetscTryMethod(eps,"EPSJDSetFix_C",(EPS,PetscReal),(eps,fix));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetConstCorrectionTol" /*@ EPSJDSetConstCorrectionTol - If true, deactivates the dynamic stopping criterion (also called Newton) that sets the KSP relative tolerance to 0.5**i, where i is the number of EPS iterations from the last converged value. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - constant - if false, the KSP relative tolerance is set to 0.5**i. Options Database Key: . -eps_jd_const_correction_tol - Deactivates the dynamic stopping criterion. Level: advanced .seealso: EPSJDGetConstCorrectionTol() @*/ PetscErrorCode EPSJDSetConstCorrectionTol(EPS eps,PetscBool constant) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,constant,2); ierr = PetscTryMethod(eps,"EPSJDSetConstCorrectionTol_C",(EPS,PetscBool),(eps,constant));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetConstCorrectionTol" /*@ EPSJDGetConstCorrectionTol - Returns a flag indicating if the dynamic stopping is being used for solving the correction equation. If the flag is false the KSP relative tolerance is set to 0.5**i, where i is the number of EPS iterations from the last converged value. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: . constant - boolean flag indicating if the dynamic stopping criterion is not being used. Level: advanced .seealso: EPSJDGetConstCorrectionTol() @*/ PetscErrorCode EPSJDGetConstCorrectionTol(EPS eps,PetscBool *constant) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(constant,2); ierr = PetscTryMethod(eps,"EPSJDGetConstCorrectionTol",(EPS,PetscBool*),(eps,constant));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetWindowSizes" /*@ EPSJDGetWindowSizes - Gets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: + pwindow - number of converged vectors in the projector - qwindow - number of converged vectors in the projected problem Level: advanced .seealso: EPSJDSetWindowSizes() @*/ PetscErrorCode EPSJDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSJDGetWindowSizes_C",(EPS,PetscInt*,PetscInt*),(eps,pwindow,qwindow));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetWindowSizes" /*@ EPSJDSetWindowSizes - Sets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . pwindow - number of converged vectors in the projector - qwindow - number of converged vectors in the projected problem Options Database Keys: + -eps_jd_pwindow - set the number of converged vectors in the projector - -eps_jd_qwindow - set the number of converged vectors in the projected problem Level: advanced .seealso: EPSJDGetWindowSizes() @*/ PetscErrorCode EPSJDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,pwindow,2); PetscValidLogicalCollectiveInt(eps,qwindow,3); ierr = PetscTryMethod(eps,"EPSJDSetWindowSizes_C",(EPS,PetscInt,PetscInt),(eps,pwindow,qwindow));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetBOrth" /*@ EPSJDSetBOrth - Selects the orthogonalization that will be used in the search subspace in case of generalized Hermitian problems. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - borth - the kind of orthogonalization Possible values: The parameter 'borth' can have one of these values + EPS_ORTH_I - orthogonalization of the search subspace . EPS_ORTH_B - B-orthogonalization of the search subspace - EPS_ORTH_BOPT - B-orthogonalization of the search subspace with an alternative method Options Database Key: . -eps_jd_borth - Set the orthogonalization used in the search subspace Notes: If borth is EPS_ORTH_B, the solver uses a variant of Gram-Schmidt (selected in IP associated to the EPS) with the inner product defined by the matrix problem B. If borth is EPS_ORTH_BOPT, it uses another variant of Gram-Schmidt that only performs one matrix-vector product although more than one reorthogonalization would be done. Level: advanced .seealso: EPSJDGetBOrth() @*/ PetscErrorCode EPSJDSetBOrth(EPS eps,EPSOrthType borth) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,borth,2); ierr = PetscTryMethod(eps,"EPSJDSetBOrth_C",(EPS,EPSOrthType),(eps,borth));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetBOrth" /*@ EPSJDGetBOrth - Returns the orthogonalization used in the search subspace in case of generalized Hermitian problems. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: . borth - the kind of orthogonalization Notes: See EPSJDSetBOrth() for possible values of 'borth'. Level: advanced .seealso: EPSJDSetBOrth(), EPSOrthType @*/ PetscErrorCode EPSJDGetBOrth(EPS eps,EPSOrthType *borth) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(borth,2); ierr = PetscTryMethod(eps,"EPSJDGetBOrth_C",(EPS,EPSOrthType*),(eps,borth));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_JD" PETSC_EXTERN PetscErrorCode EPSCreate_JD(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; /* Load the Davidson solver */ ierr = EPSCreate_XD(eps);CHKERRQ(ierr); ierr = EPSXDSetMethod(eps,DVD_METH_JD);CHKERRQ(ierr); /* Overload the JD properties */ eps->ops->setfromoptions = EPSSetFromOptions_JD; eps->ops->setup = EPSSetUp_JD; eps->ops->destroy = EPSDestroy_JD; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetKrylovStart_C",EPSXDSetKrylovStart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetKrylovStart_C",EPSXDGetKrylovStart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBlockSize_C",EPSXDSetBlockSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBlockSize_C",EPSXDGetBlockSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetRestart_C",EPSXDSetRestart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetRestart_C",EPSXDGetRestart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetInitialSize_C",EPSXDSetInitialSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetInitialSize_C",EPSXDGetInitialSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetFix_C",EPSJDSetFix_JD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetFix_C",EPSXDGetFix_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetConstCorrectionTol_C",EPSJDSetConstCorrectionTol_JD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetConstCorrectionTol_C",EPSJDGetConstCorrectionTol_JD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetWindowSizes_C",EPSXDSetWindowSizes_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetWindowSizes_C",EPSXDGetWindowSizes_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBOrth_C",EPSXDSetBOrth_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBOrth_C",EPSXDGetBOrth_XD);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/jd.c.html0000644000175000017500000015752212211062077022061 0ustar gladkgladk

Actual source code: jd.c

  1: /*

  3:    SLEPc eigensolver: "jd"

  5:    Method: Jacobi-Davidson

  7:    Algorithm:

  9:        Jacobi-Davidson with various subspace extraction and
 10:        restart techniques.

 12:    References:

 14:        [1] G.L.G. Sleijpen and H.A. van der Vorst, "A Jacobi-Davidson
 15:            iteration method for linear eigenvalue problems", SIAM J.
 16:            Matrix Anal. Appl. 17(2):401-425, 1996.

 18:        [2] E. Romero and J.E. Roman, "A parallel implementation of
 19:            Davidson methods for large-scale eigenvalue problems in
 20:            SLEPc", submitted, 2013.

 22:    Last update: Jul 2012

 24:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 25:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 26:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 28:    This file is part of SLEPc.

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

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

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

 44: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 45: #include <../src/eps/impls/davidson/common/davidson.h>

 49: PetscErrorCode EPSSetFromOptions_JD(EPS eps)
 50: {
 52:   PetscBool      flg,op;
 53:   PetscInt       opi,opi0;
 54:   PetscReal      opf;
 55:   KSP            ksp;
 56:   EPSOrthType    orth;
 57:   const char     *orth_list[3] = {"I","B","B_opt"};

 60:   PetscOptionsHead("EPS Jacobi-Davidson (JD) Options");

 62:   EPSJDGetKrylovStart(eps,&op);
 63:   PetscOptionsBool("-eps_jd_krylov_start","Start the searching subspace with a krylov basis","EPSJDSetKrylovStart",op,&op,&flg);
 64:   if (flg) { EPSJDSetKrylovStart(eps,op); }

 66:   EPSJDGetBlockSize(eps,&opi);
 67:   PetscOptionsInt("-eps_jd_blocksize","Number vectors add to the searching subspace","EPSJDSetBlockSize",opi,&opi,&flg);
 68:   if (flg) { EPSJDSetBlockSize(eps,opi); }

 70:   EPSJDGetRestart(eps,&opi,&opi0);
 71:   PetscOptionsInt("-eps_jd_minv","Set the size of the searching subspace after restarting","EPSJDSetRestart",opi,&opi,&flg);
 72:   if (flg) { EPSJDSetRestart(eps,opi,opi0); }

 74:   PetscOptionsInt("-eps_jd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSJDSetRestart",opi0,&opi0,&flg);
 75:   if (flg) { EPSJDSetRestart(eps,opi,opi0); }

 77:   EPSJDGetInitialSize(eps,&opi);
 78:   PetscOptionsInt("-eps_jd_initial_size","Set the initial size of the searching subspace","EPSJDSetInitialSize",opi,&opi,&flg);
 79:   if (flg) { EPSJDSetInitialSize(eps,opi); }

 81:   EPSJDGetFix(eps,&opf);
 82:   PetscOptionsReal("-eps_jd_fix","Set the tolerance for changing the target in the correction equation","EPSJDSetFix",opf,&opf,&flg);
 83:   if (flg) { EPSJDSetFix(eps,opf); }

 85:   EPSJDGetBOrth(eps,&orth);
 86:   PetscOptionsEList("-eps_jd_borth","orthogonalization used in the search subspace","EPSJDSetBOrth",orth_list,3,orth_list[orth-1],&opi,&flg);
 87:   if (flg) { EPSJDSetBOrth(eps,(EPSOrthType)(opi+1)); }

 89:   EPSJDGetConstCorrectionTol(eps,&op);
 90:   PetscOptionsBool("-eps_jd_const_correction_tol","Disable the dynamic stopping criterion when solving the correction equation","EPSJDSetConstCorrectionTol",op,&op,&flg);
 91:   if (flg) { EPSJDSetConstCorrectionTol(eps,op); }

 93:   EPSJDGetWindowSizes(eps,&opi,&opi0);
 94:   PetscOptionsInt("-eps_jd_pwindow","(Experimental!) Set the number of converged vectors in the projector","EPSJDSetWindowSizes",opi,&opi,&flg);
 95:   if (flg) { EPSJDSetWindowSizes(eps,opi,opi0); }

 97:   PetscOptionsInt("-eps_jd_qwindow","(Experimental!) Set the number of converged vectors in the projected problem","EPSJDSetWindowSizes",opi0,&opi0,&flg);
 98:   if (flg) { EPSJDSetWindowSizes(eps,opi,opi0); }

100:   /* Set STPrecond as the default ST */
101:   if (!((PetscObject)eps->st)->type_name) {
102:     STSetType(eps->st,STPRECOND);
103:   }
104:   STPrecondSetKSPHasMat(eps->st,PETSC_FALSE);

106:   /* Set the default options of the KSP */
107:   STGetKSP(eps->st,&ksp);
108:   if (!((PetscObject)ksp)->type_name) {
109:     KSPSetType(ksp,KSPBCGSL);
110:     KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);
111:   }
112:   PetscOptionsTail();
113:   return(0);
114: }

118: PetscErrorCode EPSSetUp_JD(EPS eps)
119: {
121:   PetscBool      t;
122:   KSP            ksp;

125:   /* Setup common for all davidson solvers */
126:   EPSSetUp_XD(eps);

128:   /* Set the default options of the KSP */
129:   STGetKSP(eps->st,&ksp);
130:   if (!((PetscObject)ksp)->type_name) {
131:     KSPSetType(ksp,KSPBCGSL);
132:     KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);
133:   }

135:   /* Check some constraints */
136:   PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&t);
137:   if (t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"EPSJD does not work with KSPPREONLY");
138:   return(0);
139: }

143: PetscErrorCode EPSDestroy_JD(EPS eps)
144: {
145:   PetscErrorCode  ierr;

148:   PetscFree(eps->data);
149:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetKrylovStart_C",NULL);
150:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetKrylovStart_C",NULL);
151:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBlockSize_C",NULL);
152:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBlockSize_C",NULL);
153:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetRestart_C",NULL);
154:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetRestart_C",NULL);
155:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetInitialSize_C",NULL);
156:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetInitialSize_C",NULL);
157:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetFix_C",NULL);
158:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetFix_C",NULL);
159:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetConstCorrectionTol_C",NULL);
160:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetConstCorrectionTol_C",NULL);
161:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetWindowSizes_C",NULL);
162:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetWindowSizes_C",NULL);
163:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBOrth_C",NULL);
164:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBOrth_C",NULL);
165:   return(0);
166: }

170: /*@
171:    EPSJDSetKrylovStart - Activates or deactivates starting the searching
172:    subspace with a Krylov basis.

174:    Logically Collective on EPS

176:    Input Parameters:
177: +  eps - the eigenproblem solver context
178: -  krylovstart - boolean flag

180:    Options Database Key:
181: .  -eps_jd_krylov_start - Activates starting the searching subspace with a
182:     Krylov basis

184:    Level: advanced

186: .seealso: EPSJDGetKrylovStart()
187: @*/
188: PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart)
189: {

195:   PetscTryMethod(eps,"EPSJDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));
196:   return(0);
197: }

201: /*@
202:    EPSJDGetKrylovStart - Returns a flag indicating if the searching subspace is started with a
203:    Krylov basis.

205:    Not Collective

207:    Input Parameter:
208: .  eps - the eigenproblem solver context

210:    Output Parameters:
211: .  krylovstart - boolean flag indicating if the searching subspace is started
212:    with a Krylov basis

214:    Level: advanced

216: .seealso: EPSJDGetKrylovStart()
217: @*/
218: PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscBool *krylovstart)
219: {

225:   PetscTryMethod(eps,"EPSJDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));
226:   return(0);
227: }

231: /*@
232:    EPSJDSetBlockSize - Sets the number of vectors to be added to the searching space
233:    in every iteration.

235:    Logically Collective on EPS

237:    Input Parameters:
238: +  eps - the eigenproblem solver context
239: -  blocksize - number of vectors added to the search space in every iteration

241:    Options Database Key:
242: .  -eps_jd_blocksize - number of vectors added to the searching space every iteration

244:    Level: advanced

246: .seealso: EPSJDSetKrylovStart()
247: @*/
248: PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize)
249: {

255:   PetscTryMethod(eps,"EPSJDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));
256:   return(0);
257: }

261: /*@
262:    EPSJDGetBlockSize - Returns the number of vectors to be added to the searching space
263:    in every iteration.

265:    Not Collective

267:    Input Parameter:
268: .  eps - the eigenproblem solver context

270:    Output Parameter:
271: .  blocksize - number of vectors added to the search space in every iteration

273:    Level: advanced

275: .seealso: EPSJDSetBlockSize()
276: @*/
277: PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize)
278: {

284:   PetscTryMethod(eps,"EPSJDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));
285:   return(0);
286: }

290: /*@
291:    EPSJDGetRestart - Gets the number of vectors of the searching space after
292:    restarting and the number of vectors saved from the previous iteration.

294:    Not Collective

296:    Input Parameter:
297: .  eps - the eigenproblem solver context

299:    Output Parameter:
300: +  minv - number of vectors of the searching subspace after restarting
301: -  plusk - number of vectors saved from the previous iteration

303:    Level: advanced

305: .seealso: EPSJDSetRestart()
306: @*/
307: PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
308: {

313:   PetscTryMethod(eps,"EPSJDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));
314:   return(0);
315: }

319: /*@
320:    EPSJDSetRestart - Sets the number of vectors of the searching space after
321:    restarting and the number of vectors saved from the previous iteration.

323:    Logically Collective on EPS

325:    Input Parameters:
326: +  eps - the eigenproblem solver context
327: .  minv - number of vectors of the searching subspace after restarting
328: -  plusk - number of vectors saved from the previous iteration

330:    Options Database Keys:
331: +  -eps_jd_minv - number of vectors of the searching subspace after restarting
332: -  -eps_jd_plusk - number of vectors saved from the previous iteration

334:    Level: advanced

336: .seealso: EPSJDGetRestart()
337: @*/
338: PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
339: {

346:   PetscTryMethod(eps,"EPSJDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));
347:   return(0);
348: }

352: /*@
353:    EPSJDGetInitialSize - Returns the initial size of the searching space.

355:    Not Collective

357:    Input Parameter:
358: .  eps - the eigenproblem solver context

360:    Output Parameter:
361: .  initialsize - number of vectors of the initial searching subspace

363:    Notes:
364:    If EPSJDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
365:    EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
366:    provided vectors are not enough, the solver completes the subspace with
367:    random vectors. In the case of EPSJDGetKrylovStart() being PETSC_TRUE, the solver
368:    gets the first vector provided by the user or, if not available, a random vector,
369:    and expands the Krylov basis up to initialsize vectors.

371:    Level: advanced

373: .seealso: EPSJDSetInitialSize(), EPSJDGetKrylovStart()
374: @*/
375: PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize)
376: {

382:   PetscTryMethod(eps,"EPSJDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));
383:   return(0);
384: }

388: /*@
389:    EPSJDSetInitialSize - Sets the initial size of the searching space.

391:    Logically Collective on EPS

393:    Input Parameters:
394: +  eps - the eigenproblem solver context
395: -  initialsize - number of vectors of the initial searching subspace

397:    Options Database Key:
398: .  -eps_jd_initial_size - number of vectors of the initial searching subspace

400:    Notes:
401:    If EPSJDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
402:    EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
403:    provided vectors are not enough, the solver completes the subspace with
404:    random vectors. In the case of EPSJDGetKrylovStart() being PETSC_TRUE, the solver
405:    gets the first vector provided by the user or, if not available, a random vector,
406:    and expands the Krylov basis up to initialsize vectors.

408:    Level: advanced

410: .seealso: EPSJDGetInitialSize(), EPSJDGetKrylovStart()
411: @*/
412: PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize)
413: {

419:   PetscTryMethod(eps,"EPSJDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));
420:   return(0);
421: }

425: /*@
426:    EPSJDGetFix - Returns the threshold for changing the target in the correction
427:    equation.

429:    Not Collective

431:    Input Parameter:
432: .  eps - the eigenproblem solver context

434:    Output Parameter:
435: .  fix - threshold for changing the target

437:    Note:
438:    The target in the correction equation is fixed at the first iterations.
439:    When the norm of the residual vector is lower than the fix value,
440:    the target is set to the corresponding eigenvalue.

442:    Level: advanced

444: .seealso: EPSJDSetFix()
445: @*/
446: PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix)
447: {

453:   PetscTryMethod(eps,"EPSJDGetFix_C",(EPS,PetscReal*),(eps,fix));
454:   return(0);
455: }

459: /*@
460:    EPSJDSetFix - Sets the threshold for changing the target in the correction
461:    equation.

463:    Logically Collective on EPS

465:    Input Parameters:
466: +  eps - the eigenproblem solver context
467: -  fix - threshold for changing the target

469:    Options Database Key:
470: .  -eps_jd_fix - the fix value

472:    Note:
473:    The target in the correction equation is fixed at the first iterations.
474:    When the norm of the residual vector is lower than the fix value,
475:    the target is set to the corresponding eigenvalue.

477:    Level: advanced

479: .seealso: EPSJDGetFix()
480: @*/
481: PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix)
482: {

488:   PetscTryMethod(eps,"EPSJDSetFix_C",(EPS,PetscReal),(eps,fix));
489:   return(0);
490: }

494: /*@
495:    EPSJDSetConstCorrectionTol - If true, deactivates the dynamic stopping criterion
496:    (also called Newton) that sets the KSP relative tolerance
497:    to 0.5**i, where i is the number of EPS iterations from the last converged value.

499:    Logically Collective on EPS

501:    Input Parameters:
502: +  eps - the eigenproblem solver context
503: -  constant - if false, the KSP relative tolerance is set to 0.5**i.

505:    Options Database Key:
506: .  -eps_jd_const_correction_tol - Deactivates the dynamic stopping criterion.

508:    Level: advanced

510: .seealso: EPSJDGetConstCorrectionTol()
511: @*/
512: PetscErrorCode EPSJDSetConstCorrectionTol(EPS eps,PetscBool constant)
513: {

519:   PetscTryMethod(eps,"EPSJDSetConstCorrectionTol_C",(EPS,PetscBool),(eps,constant));
520:   return(0);
521: }

525: /*@
526:    EPSJDGetConstCorrectionTol - Returns a flag indicating if the dynamic stopping is being used for
527:    solving the correction equation. If the flag is false the KSP relative tolerance is set
528:    to 0.5**i, where i is the number of EPS iterations from the last converged value.

530:    Not Collective

532:    Input Parameter:
533: .  eps - the eigenproblem solver context

535:    Output Parameters:
536: .  constant - boolean flag indicating if the dynamic stopping criterion is not being used.

538:    Level: advanced

540: .seealso: EPSJDGetConstCorrectionTol()
541: @*/
542: PetscErrorCode EPSJDGetConstCorrectionTol(EPS eps,PetscBool *constant)
543: {

549:   PetscTryMethod(eps,"EPSJDGetConstCorrectionTol",(EPS,PetscBool*),(eps,constant));
550:   return(0);
551: }

555: /*@
556:    EPSJDGetWindowSizes - Gets the number of converged vectors in the projected
557:    problem (or Rayleigh quotient) and in the projector employed in the correction
558:    equation.

560:    Not Collective

562:    Input Parameter:
563: .  eps - the eigenproblem solver context

565:    Output Parameter:
566: +  pwindow - number of converged vectors in the projector
567: -  qwindow - number of converged vectors in the projected problem

569:    Level: advanced

571: .seealso: EPSJDSetWindowSizes()
572: @*/
573: PetscErrorCode EPSJDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)
574: {

579:   PetscTryMethod(eps,"EPSJDGetWindowSizes_C",(EPS,PetscInt*,PetscInt*),(eps,pwindow,qwindow));
580:   return(0);
581: }

585: /*@
586:    EPSJDSetWindowSizes - Sets the number of converged vectors in the projected
587:    problem (or Rayleigh quotient) and in the projector employed in the correction
588:    equation.

590:    Logically Collective on EPS

592:    Input Parameters:
593: +  eps - the eigenproblem solver context
594: .  pwindow - number of converged vectors in the projector
595: -  qwindow - number of converged vectors in the projected problem

597:    Options Database Keys:
598: +  -eps_jd_pwindow - set the number of converged vectors in the projector
599: -  -eps_jd_qwindow - set the number of converged vectors in the projected problem

601:    Level: advanced

603: .seealso: EPSJDGetWindowSizes()
604: @*/
605: PetscErrorCode EPSJDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)
606: {

613:   PetscTryMethod(eps,"EPSJDSetWindowSizes_C",(EPS,PetscInt,PetscInt),(eps,pwindow,qwindow));
614:   return(0);
615: }

619: /*@
620:    EPSJDSetBOrth - Selects the orthogonalization that will be used in the search
621:    subspace in case of generalized Hermitian problems.

623:    Logically Collective on EPS

625:    Input Parameters:
626: +  eps   - the eigenproblem solver context
627: -  borth - the kind of orthogonalization

629:    Possible values:
630:    The parameter 'borth' can have one of these values

632: +   EPS_ORTH_I - orthogonalization of the search subspace
633: .   EPS_ORTH_B - B-orthogonalization of the search subspace
634: -   EPS_ORTH_BOPT - B-orthogonalization of the search subspace with an alternative method

636:    Options Database Key:
637: .  -eps_jd_borth - Set the orthogonalization used in the search subspace

639:    Notes:
640:    If borth is EPS_ORTH_B, the solver uses a variant of Gram-Schmidt (selected in
641:    IP associated to the EPS) with the inner product defined by the matrix problem B.
642:    If borth is EPS_ORTH_BOPT, it uses another variant of Gram-Schmidt that only performs
643:    one matrix-vector product although more than one reorthogonalization would be done.

645:    Level: advanced

647: .seealso: EPSJDGetBOrth()
648: @*/
649: PetscErrorCode EPSJDSetBOrth(EPS eps,EPSOrthType borth)
650: {

656:   PetscTryMethod(eps,"EPSJDSetBOrth_C",(EPS,EPSOrthType),(eps,borth));
657:   return(0);
658: }

662: /*@
663:    EPSJDGetBOrth - Returns the orthogonalization used in the search
664:    subspace in case of generalized Hermitian problems.

666:    Not Collective

668:    Input Parameter:
669: .  eps - the eigenproblem solver context

671:    Output Parameters:
672: .  borth - the kind of orthogonalization

674:    Notes:
675:    See EPSJDSetBOrth() for possible values of 'borth'.

677:    Level: advanced

679: .seealso: EPSJDSetBOrth(), EPSOrthType
680: @*/
681: PetscErrorCode EPSJDGetBOrth(EPS eps,EPSOrthType *borth)
682: {

688:   PetscTryMethod(eps,"EPSJDGetBOrth_C",(EPS,EPSOrthType*),(eps,borth));
689:   return(0);
690: }

694: PETSC_EXTERN PetscErrorCode EPSCreate_JD(EPS eps)
695: {

699:   /* Load the Davidson solver */
700:   EPSCreate_XD(eps);
701:   EPSXDSetMethod(eps,DVD_METH_JD);

703:   /* Overload the JD properties */
704:   eps->ops->setfromoptions = EPSSetFromOptions_JD;
705:   eps->ops->setup          = EPSSetUp_JD;
706:   eps->ops->destroy        = EPSDestroy_JD;

708:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetKrylovStart_C",EPSXDSetKrylovStart_XD);
709:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetKrylovStart_C",EPSXDGetKrylovStart_XD);
710:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBlockSize_C",EPSXDSetBlockSize_XD);
711:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBlockSize_C",EPSXDGetBlockSize_XD);
712:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetRestart_C",EPSXDSetRestart_XD);
713:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetRestart_C",EPSXDGetRestart_XD);
714:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetInitialSize_C",EPSXDSetInitialSize_XD);
715:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetInitialSize_C",EPSXDGetInitialSize_XD);
716:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetFix_C",EPSJDSetFix_JD);
717:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetFix_C",EPSXDGetFix_XD);
718:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetConstCorrectionTol_C",EPSJDSetConstCorrectionTol_JD);
719:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetConstCorrectionTol_C",EPSJDGetConstCorrectionTol_JD);
720:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetWindowSizes_C",EPSXDSetWindowSizes_XD);
721:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetWindowSizes_C",EPSXDGetWindowSizes_XD);
722:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDSetBOrth_C",EPSXDSetBOrth_XD);
723:   PetscObjectComposeFunction((PetscObject)eps,"EPSJDGetBOrth_C",EPSXDGetBOrth_XD);
724:   return(0);
725: }

slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/makefile0000644000175000017500000000214212211062077022040 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = jd.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/davidson/jd/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/makefile.html0000644000175000017500000000373612211062077023015 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = jd.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/davidson/jd/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/index.html0000644000175000017500000000212012211062077022331 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

jd.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/ftn-auto/0000755000175000017500000000000012214143515022076 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/ftn-auto/jdf.c0000644000175000017500000001425012211062077023007 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* jd.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetkrylovstart_ EPSJDSETKRYLOVSTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetkrylovstart_ epsjdsetkrylovstart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetkrylovstart_ EPSJDGETKRYLOVSTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetkrylovstart_ epsjdgetkrylovstart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetblocksize_ EPSJDSETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetblocksize_ epsjdsetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetblocksize_ EPSJDGETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetblocksize_ epsjdgetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetrestart_ EPSJDGETRESTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetrestart_ epsjdgetrestart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetrestart_ EPSJDSETRESTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetrestart_ epsjdsetrestart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetinitialsize_ EPSJDGETINITIALSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetinitialsize_ epsjdgetinitialsize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetinitialsize_ EPSJDSETINITIALSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetinitialsize_ epsjdsetinitialsize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetfix_ EPSJDGETFIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetfix_ epsjdgetfix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetfix_ EPSJDSETFIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetfix_ epsjdsetfix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetconstcorrectiontol_ EPSJDSETCONSTCORRECTIONTOL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetconstcorrectiontol_ epsjdsetconstcorrectiontol #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetconstcorrectiontol_ EPSJDGETCONSTCORRECTIONTOL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetconstcorrectiontol_ epsjdgetconstcorrectiontol #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetwindowsizes_ EPSJDGETWINDOWSIZES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetwindowsizes_ epsjdgetwindowsizes #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetwindowsizes_ EPSJDSETWINDOWSIZES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetwindowsizes_ epsjdsetwindowsizes #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdsetborth_ EPSJDSETBORTH #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdsetborth_ epsjdsetborth #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsjdgetborth_ EPSJDGETBORTH #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsjdgetborth_ epsjdgetborth #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsjdsetkrylovstart_(EPS *eps,PetscBool *krylovstart, int *__ierr ){ *__ierr = EPSJDSetKrylovStart(*eps,*krylovstart); } void PETSC_STDCALL epsjdgetkrylovstart_(EPS *eps,PetscBool *krylovstart, int *__ierr ){ *__ierr = EPSJDGetKrylovStart(*eps,krylovstart); } void PETSC_STDCALL epsjdsetblocksize_(EPS *eps,PetscInt *blocksize, int *__ierr ){ *__ierr = EPSJDSetBlockSize(*eps,*blocksize); } void PETSC_STDCALL epsjdgetblocksize_(EPS *eps,PetscInt *blocksize, int *__ierr ){ *__ierr = EPSJDGetBlockSize(*eps,blocksize); } void PETSC_STDCALL epsjdgetrestart_(EPS *eps,PetscInt *minv,PetscInt *plusk, int *__ierr ){ *__ierr = EPSJDGetRestart(*eps,minv,plusk); } void PETSC_STDCALL epsjdsetrestart_(EPS *eps,PetscInt *minv,PetscInt *plusk, int *__ierr ){ *__ierr = EPSJDSetRestart(*eps,*minv,*plusk); } void PETSC_STDCALL epsjdgetinitialsize_(EPS *eps,PetscInt *initialsize, int *__ierr ){ *__ierr = EPSJDGetInitialSize(*eps,initialsize); } void PETSC_STDCALL epsjdsetinitialsize_(EPS *eps,PetscInt *initialsize, int *__ierr ){ *__ierr = EPSJDSetInitialSize(*eps,*initialsize); } void PETSC_STDCALL epsjdgetfix_(EPS *eps,PetscReal *fix, int *__ierr ){ *__ierr = EPSJDGetFix(*eps,fix); } void PETSC_STDCALL epsjdsetfix_(EPS *eps,PetscReal *fix, int *__ierr ){ *__ierr = EPSJDSetFix(*eps,*fix); } void PETSC_STDCALL epsjdsetconstcorrectiontol_(EPS *eps,PetscBool *constant, int *__ierr ){ *__ierr = EPSJDSetConstCorrectionTol(*eps,*constant); } void PETSC_STDCALL epsjdgetconstcorrectiontol_(EPS *eps,PetscBool *constant, int *__ierr ){ *__ierr = EPSJDGetConstCorrectionTol(*eps,constant); } void PETSC_STDCALL epsjdgetwindowsizes_(EPS *eps,PetscInt *pwindow,PetscInt *qwindow, int *__ierr ){ *__ierr = EPSJDGetWindowSizes(*eps,pwindow,qwindow); } void PETSC_STDCALL epsjdsetwindowsizes_(EPS *eps,PetscInt *pwindow,PetscInt *qwindow, int *__ierr ){ *__ierr = EPSJDSetWindowSizes(*eps,*pwindow,*qwindow); } void PETSC_STDCALL epsjdsetborth_(EPS *eps,EPSOrthType *borth, int *__ierr ){ *__ierr = EPSJDSetBOrth(*eps,*borth); } void PETSC_STDCALL epsjdgetborth_(EPS *eps,EPSOrthType *borth, int *__ierr ){ *__ierr = EPSJDGetBOrth(*eps, (EPSOrthType* )PetscToPointer((borth) )); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/jd/ftn-auto/makefile0000644000175000017500000000034512211062077023600 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = jdf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/davidson/jd/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/0000755000175000017500000000000012214143515021234 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_improvex.c0000644000175000017500000013300212211062077024105 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Step: improve the eigenvectors X - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" #include /*I "slepcvec.h" I*/ PetscErrorCode dvd_improvex_PfuncV(dvdDashboard *d,void *funcV,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,Vec *auxV,PetscScalar *auxS); PetscErrorCode PCApplyBA_dvd(PC pc,PCSide side,Vec in,Vec out,Vec w); PetscErrorCode PCApply_dvd(PC pc,Vec in,Vec out); PetscErrorCode PCApplyTranspose_dvd(PC pc,Vec in,Vec out); PetscErrorCode MatMult_dvd_jd(Mat A,Vec in,Vec out); PetscErrorCode MatMultTranspose_dvd_jd(Mat A,Vec in,Vec out); PetscErrorCode MatGetVecs_dvd_jd(Mat A,Vec *right,Vec *left); PetscErrorCode dvd_improvex_jd_d(dvdDashboard *d); PetscErrorCode dvd_improvex_jd_start(dvdDashboard *d); PetscErrorCode dvd_improvex_jd_end(dvdDashboard *d); PetscErrorCode dvd_improvex_jd_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D); PetscErrorCode dvd_improvex_jd_proj_cuv(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec **u,Vec **v,Vec *kr,Vec **auxV,PetscScalar **auxS,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld); PetscErrorCode dvd_improvex_jd_proj_uv_KXX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld); PetscErrorCode dvd_improvex_jd_proj_uv_KZX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld); PetscErrorCode dvd_improvex_jd_lit_const_0(dvdDashboard *d,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol); PetscErrorCode dvd_improvex_apply_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS); PetscErrorCode dvd_improvex_applytrans_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS); #define size_Z (64*4) /**** JD update step (I - Kfg'/(g'Kf)) K(A - sB) (I - Kfg'/(g'Kf)) t = (I - Kfg'/(g'Kf))r ****/ typedef struct { PetscInt size_X; void *old_improveX_data; /* old improveX_data */ improveX_type old_improveX; /* old improveX */ KSP ksp; /* correction equation solver */ Vec friends, /* reference vector for composite vectors */ *auxV; /* auxiliar vectors */ PetscScalar *auxS, /* auxiliar scalars */ *theta, *thetai; /* the shifts used in the correction eq. */ PetscInt maxits, /* maximum number of iterations */ r_s, r_e, /* the selected eigenpairs to improve */ ksp_max_size; /* the ksp maximum subvectors size */ PetscReal tol, /* the maximum solution tolerance */ lastTol, /* last tol for dynamic stopping criterion */ fix; /* tolerance for using the approx. eigenvalue */ PetscBool dynamic; /* if the dynamic stopping criterion is applied */ dvdDashboard *d; /* the currect dvdDashboard reference */ PC old_pc; /* old pc in ksp */ Vec *u, /* new X vectors */ *real_KZ, /* original KZ */ *KZ; /* KZ vecs for the projector KZ*inv(X'*KZ)*X' */ PetscScalar *XKZ, /* X'*KZ */ *iXKZ; /* inverse of XKZ */ PetscInt ldXKZ, /* leading dimension of XKZ */ size_iXKZ, /* size of iXKZ */ ldiXKZ, /* leading dimension of iXKZ */ size_KZ, /* size of converged KZ */ size_real_KZ, /* original size of KZ */ size_cX, /* last value of d->size_cX */ old_size_X; /* last number of improved vectors */ PetscBLASInt *iXKZPivots; /* array of pivots */ } dvdImprovex_jd; PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmult(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV); PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmulttrans(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV); #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd" PetscErrorCode dvd_improvex_jd(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs,PetscInt cX_impr,PetscBool dynamic) { PetscErrorCode ierr; dvdImprovex_jd *data; PetscBool useGD,her_probl,std_probl; PC pc; PetscInt size_P,s=1; PetscFunctionBegin; std_probl = DVD_IS(d->sEP,DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE; her_probl = DVD_IS(d->sEP,DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE; /* Setting configuration constrains */ ierr = PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&useGD);CHKERRQ(ierr); /* If the arithmetic is real and the problem is not Hermitian, then the block size is incremented in one */ #if !defined(PETSC_USE_COMPLEX) if (!her_probl) { max_bs++; b->max_size_P = PetscMax(b->max_size_P,2); s = 2; } else #endif b->max_size_P = PetscMax(b->max_size_P,1); b->max_size_X = PetscMax(b->max_size_X,max_bs); size_P = b->max_size_P+cX_impr; b->max_size_auxV = PetscMax(b->max_size_auxV, b->max_size_X*3+(useGD?0:2)+ /* u, kr, auxV(max_size_X+2?) */ ((her_probl || !d->eps->trueres)?1:PetscMax(s*2,b->max_size_cX_proj+b->max_size_X))); /* testConv */ b->own_scalars+= size_P*size_P; /* XKZ */ b->max_size_auxS = PetscMax(b->max_size_auxS, b->max_size_X*3 + /* theta, thetai */ size_P*size_P + /* iXKZ */ FromIntToScalar(size_P) + /* iXkZPivots */ PetscMax(PetscMax( 3*b->max_size_proj*b->max_size_X, /* dvd_improvex_apply_proj */ 8*cX_impr*b->max_size_X), /* dvd_improvex_jd_proj_cuv_KZX */ (her_probl || !d->eps->trueres)?0:b->max_nev*b->max_nev+PetscMax(b->max_nev*6,(b->max_nev+b->max_size_proj)*s+b->max_nev*(b->max_size_X+b->max_size_cX_proj)*(std_probl?2:4)+64))); /* preTestConv */ b->own_vecs+= size_P; /* KZ */ /* Setup the preconditioner */ if (ksp) { ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = dvd_static_precond_PC(d,b,pc);CHKERRQ(ierr); } else { ierr = dvd_static_precond_PC(d,b,0);CHKERRQ(ierr); } /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscMalloc(sizeof(dvdImprovex_jd),&data);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdImprovex_jd));CHKERRQ(ierr); data->dynamic = dynamic; data->size_real_KZ = size_P; data->real_KZ = b->free_vecs; b->free_vecs+= data->size_real_KZ; d->max_cX_in_impr = cX_impr; data->XKZ = b->free_scalars; b->free_scalars+= size_P*size_P; data->ldXKZ = size_P; data->size_X = b->max_size_X; data->old_improveX_data = d->improveX_data; d->improveX_data = data; data->old_improveX = d->improveX; data->ksp = useGD?NULL:ksp; data->d = d; d->improveX = dvd_improvex_jd_gen; data->ksp_max_size = max_bs; DVD_FL_ADD(d->startList,dvd_improvex_jd_start); DVD_FL_ADD(d->endList,dvd_improvex_jd_end); DVD_FL_ADD(d->destroyList,dvd_improvex_jd_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_start" PetscErrorCode dvd_improvex_jd_start(dvdDashboard *d) { PetscErrorCode ierr; dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscInt rA, cA, rlA, clA; Mat A; PetscBool t; PC pc; PetscFunctionBegin; data->KZ = data->real_KZ; data->size_KZ = data->size_cX = data->old_size_X = 0; data->lastTol = data->dynamic?0.5:0.0; /* Setup the ksp */ if (data->ksp) { /* Create the reference vector */ ierr = VecCreateCompWithVecs(d->V,data->ksp_max_size,NULL,&data->friends);CHKERRQ(ierr); ierr = PetscLogObjectParent(d->eps,data->friends);CHKERRQ(ierr); /* Save the current pc and set a PCNONE */ ierr = KSPGetPC(data->ksp, &data->old_pc);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)data->old_pc,PCNONE,&t);CHKERRQ(ierr); data->lastTol = 0.5; if (t) { data->old_pc = 0; } else { ierr = PetscObjectReference((PetscObject)data->old_pc);CHKERRQ(ierr); ierr = PCCreate(PetscObjectComm((PetscObject)d->eps),&pc);CHKERRQ(ierr); ierr = PCSetType(pc,PCSHELL);CHKERRQ(ierr); ierr = PCSetOperators(pc, d->A, d->A, SAME_PRECONDITIONER);CHKERRQ(ierr); ierr = PCShellSetApply(pc,PCApply_dvd);CHKERRQ(ierr); ierr = PCShellSetApplyBA(pc,PCApplyBA_dvd);CHKERRQ(ierr); ierr = PCShellSetApplyTranspose(pc,PCApplyTranspose_dvd);CHKERRQ(ierr); ierr = KSPSetPC(data->ksp,pc);CHKERRQ(ierr); ierr = PCDestroy(&pc);CHKERRQ(ierr); } /* Create the (I-v*u')*K*(A-s*B) matrix */ ierr = MatGetSize(d->A, &rA, &cA);CHKERRQ(ierr); ierr = MatGetLocalSize(d->A, &rlA, &clA);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)d->A), rlA*data->ksp_max_size, clA*data->ksp_max_size, rA*data->ksp_max_size, cA*data->ksp_max_size, data, &A);CHKERRQ(ierr); ierr = MatShellSetOperation(A, MATOP_MULT,(void(*)(void))MatMult_dvd_jd);CHKERRQ(ierr); ierr = MatShellSetOperation(A, MATOP_MULT_TRANSPOSE,(void(*)(void))MatMultTranspose_dvd_jd);CHKERRQ(ierr); ierr = MatShellSetOperation(A, MATOP_GET_VECS,(void(*)(void))MatGetVecs_dvd_jd);CHKERRQ(ierr); /* Try to avoid KSPReset */ ierr = KSPGetOperatorsSet(data->ksp,&t,NULL);CHKERRQ(ierr); if (t) { Mat M; PetscInt rM; ierr = KSPGetOperators(data->ksp,&M,NULL,NULL);CHKERRQ(ierr); ierr = MatGetSize(M,&rM,NULL);CHKERRQ(ierr); if (rM != rA*data->ksp_max_size) { ierr = KSPReset(data->ksp);CHKERRQ(ierr); } } ierr = KSPSetOperators(data->ksp, A, A, SAME_PRECONDITIONER);CHKERRQ(ierr); ierr = KSPSetUp(data->ksp);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); } else { data->old_pc = 0; data->friends = NULL; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_end" PetscErrorCode dvd_improvex_jd_end(dvdDashboard *d) { PetscErrorCode ierr; dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscFunctionBegin; if (data->friends) { ierr = VecDestroy(&data->friends);CHKERRQ(ierr); } /* Restore the pc of ksp */ if (data->old_pc) { ierr = KSPSetPC(data->ksp, data->old_pc);CHKERRQ(ierr); ierr = PCDestroy(&data->old_pc);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_d" PetscErrorCode dvd_improvex_jd_d(dvdDashboard *d) { PetscErrorCode ierr; dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscFunctionBegin; /* Restore changes in dvdDashboard */ d->improveX_data = data->old_improveX_data; /* Free local data and objects */ ierr = PetscFree(data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_gen" PetscErrorCode dvd_improvex_jd_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D) { dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscErrorCode ierr; PetscInt i,j,n,maxits,maxits0,lits,s,ld,k; PetscScalar *pX,*pY,*auxS = d->auxS,*auxS0; PetscReal tol,tol0; Vec *u,*v,*kr,kr_comp,D_comp; PetscBool odd_situation = PETSC_FALSE; PetscFunctionBegin; /* Quick exit */ if ((max_size_D == 0) || r_e-r_s <= 0) { *size_D = 0; /* Callback old improveX */ if (data->old_improveX) { d->improveX_data = data->old_improveX_data; data->old_improveX(d, NULL, 0, 0, 0, NULL); d->improveX_data = data; } PetscFunctionReturn(0); } n = PetscMin(PetscMin(data->size_X, max_size_D), r_e-r_s); if (n == 0) SETERRQ(PETSC_COMM_SELF,1, "n == 0"); if (data->size_X < r_e-r_s) SETERRQ(PETSC_COMM_SELF,1, "size_X < r_e-r_s"); ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); /* Restart lastTol if a new pair converged */ if (data->dynamic && data->size_cX < d->size_cX) data->lastTol = 0.5; for (i=0,s=0,auxS0=auxS;ieigi[i] != 0.0) { if (i+2 <= max_size_D) s=2; else break; } else #endif s=1; data->auxV = d->auxV; data->r_s = r_s+i; data->r_e = r_s+i+s; auxS = auxS0; data->theta = auxS; auxS+= 2*s; data->thetai = auxS; auxS+= s; kr = data->auxV; data->auxV+= s; /* Compute theta, maximum iterations and tolerance */ maxits = 0; tol = 1; for (j=0;jimprovex_jd_lit(d, r_s+i+j, &data->theta[2*j], &data->thetai[j], &maxits0, &tol0);CHKERRQ(ierr); maxits+= maxits0; tol*= tol0; } maxits/= s; tol = data->dynamic?data->lastTol:exp(log(tol)/s); /* Compute u, v and kr */ k = r_s+i+d->cX_in_H; ierr = DSVectors(d->ps,DS_MAT_X,&k,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->ps,DS_MAT_X,r_s+i+d->cX_in_H);CHKERRQ(ierr); k = r_s+i+d->cX_in_H; ierr = DSVectors(d->ps,DS_MAT_Y,&k,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->ps,DS_MAT_Y,r_s+i+d->cX_in_H);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Y,&pY);CHKERRQ(ierr); ierr = dvd_improvex_jd_proj_cuv(d,r_s+i,r_s+i+s,&u,&v,kr,&data->auxV,&auxS,data->theta,data->thetai,pX,pY,ld);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Y,&pY);CHKERRQ(ierr); data->u = u; /* Check if the first eigenpairs are converged */ if (i == 0) { PetscInt n_auxV = data->auxV-d->auxV+s, n_auxS = auxS - d->auxS; d->auxV+= n_auxV; d->size_auxV-= n_auxV; d->auxS+= n_auxS; d->size_auxS-= n_auxS; ierr = d->preTestConv(d,0,s,s,d->auxV-s,NULL,&d->npreconv);CHKERRQ(ierr); d->auxV-= n_auxV; d->size_auxV+= n_auxV; d->auxS-= n_auxS; d->size_auxS+= n_auxS; if (d->npreconv > 0) break; } /* Test the odd situation of solving Ax=b with A=I */ #if !defined(PETSC_USE_COMPLEX) odd_situation = (data->ksp && data->theta[0] == 1. && data->theta[1] == 0. && data->thetai[0] == 0. && d->B == NULL)?PETSC_TRUE:PETSC_FALSE; #else odd_situation = (data->ksp && data->theta[0] == 1. && data->theta[1] == 0. && d->B == NULL)?PETSC_TRUE:PETSC_FALSE; #endif /* If JD */ if (data->ksp && !odd_situation) { data->auxS = auxS; /* kr <- -kr */ for (j=0;jksp_max_size,data->friends,&kr_comp);CHKERRQ(ierr); ierr = VecCreateCompWithVecs(&D[i],data->ksp_max_size,data->friends,&D_comp);CHKERRQ(ierr); ierr = VecCompSetSubVecs(data->friends,s,NULL);CHKERRQ(ierr); /* Solve the correction equation */ ierr = KSPSetTolerances(data->ksp,tol,PETSC_DEFAULT,PETSC_DEFAULT,maxits);CHKERRQ(ierr); ierr = KSPSolve(data->ksp,kr_comp,D_comp);CHKERRQ(ierr); ierr = KSPGetIterationNumber(data->ksp,&lits);CHKERRQ(ierr); d->eps->st->lineariterations+= lits; /* Destroy the composed ks and D */ ierr = VecDestroy(&kr_comp);CHKERRQ(ierr); ierr = VecDestroy(&D_comp);CHKERRQ(ierr); /* If GD */ } else { for (j=0;jimprovex_precond(d, r_s+i+j, kr[j], D[i+j]);CHKERRQ(ierr); } ierr = dvd_improvex_apply_proj(d, &D[i], s, auxS);CHKERRQ(ierr); } /* Prevent that short vectors are discarded in the orthogonalization */ if (i == 0 && d->eps->errest[d->nconv+r_s] > PETSC_MACHINE_EPSILON && d->eps->errest[d->nconv+r_s] < PETSC_MAX_REAL) { for (j=0;jeps->errest[d->nconv+r_s]);CHKERRQ(ierr); } } } *size_D = i; if (data->dynamic) data->lastTol = PetscMax(data->lastTol/2.0,PETSC_MACHINE_EPSILON*10.0); /* Callback old improveX */ if (data->old_improveX) { d->improveX_data = data->old_improveX_data; data->old_improveX(d, NULL, 0, 0, 0, NULL); d->improveX_data = data; } PetscFunctionReturn(0); } /* y <- theta[1]A*x - theta[0]*B*x auxV, two auxiliary vectors */ #undef __FUNCT__ #define __FUNCT__ "dvd_aux_matmult" PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmult(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV) { PetscErrorCode ierr; PetscInt n,i; const Vec *Bx; PetscFunctionBegin; n = data->r_e - data->r_s; for (i=0;id->A,x[i],y[i]);CHKERRQ(ierr); } for (i=0;id->eigi[data->r_s+i] != 0.0) { if (data->d->B) { ierr = MatMult(data->d->B,x[i],auxV[0]);CHKERRQ(ierr); ierr = MatMult(data->d->B,x[i+1],auxV[1]);CHKERRQ(ierr); Bx = auxV; } else Bx = &x[i]; /* y_i <- [ t_2i+1*A*x_i - t_2i*Bx_i + ti_i*Bx_i+1; y_i+1 t_2i+1*A*x_i+1 - ti_i*Bx_i - t_2i*Bx_i+1 ] */ ierr = VecAXPBYPCZ(y[i],-data->theta[2*i],data->thetai[i],data->theta[2*i+1],Bx[0],Bx[1]);CHKERRQ(ierr); ierr = VecAXPBYPCZ(y[i+1],-data->thetai[i],-data->theta[2*i],data->theta[2*i+1],Bx[0],Bx[1]);CHKERRQ(ierr); i++; } else #endif { if (data->d->B) { ierr = MatMult(data->d->B,x[i],auxV[0]);CHKERRQ(ierr); Bx = auxV; } else Bx = &x[i]; ierr = VecAXPBY(y[i],-data->theta[i*2],data->theta[i*2+1],Bx[0]);CHKERRQ(ierr); } } PetscFunctionReturn(0); } /* y <- theta[1]'*A'*x - theta[0]'*B'*x auxV, two auxiliary vectors */ #undef __FUNCT__ #define __FUNCT__ "dvd_aux_matmulttrans" PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmulttrans(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV) { PetscErrorCode ierr; PetscInt n,i; const Vec *Bx; PetscFunctionBegin; n = data->r_e - data->r_s; for (i=0;id->A,x[i],y[i]);CHKERRQ(ierr); } for (i=0;id->eigi[data->r_s+i] != 0.0) { if (data->d->B) { ierr = MatMultTranspose(data->d->B,x[i],auxV[0]);CHKERRQ(ierr); ierr = MatMultTranspose(data->d->B,x[i+1],auxV[1]);CHKERRQ(ierr); Bx = auxV; } else Bx = &x[i]; /* y_i <- [ t_2i+1*A*x_i - t_2i*Bx_i - ti_i*Bx_i+1; y_i+1 t_2i+1*A*x_i+1 + ti_i*Bx_i - t_2i*Bx_i+1 ] */ ierr = VecAXPBYPCZ(y[i],-data->theta[2*i],-data->thetai[i],data->theta[2*i+1],Bx[0],Bx[1]);CHKERRQ(ierr); ierr = VecAXPBYPCZ(y[i+1],data->thetai[i],-data->theta[2*i],data->theta[2*i+1],Bx[0],Bx[1]);CHKERRQ(ierr); i++; } else #endif { if (data->d->B) { ierr = MatMultTranspose(data->d->B,x[i],auxV[0]);CHKERRQ(ierr); Bx = auxV; } else Bx = &x[i]; ierr = VecAXPBY(y[i],PetscConj(-data->theta[i*2]),PetscConj(data->theta[i*2+1]),Bx[0]);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "PCApplyBA_dvd" PetscErrorCode PCApplyBA_dvd(PC pc,PCSide side,Vec in,Vec out,Vec w) { PetscErrorCode ierr; dvdImprovex_jd *data; PetscInt n,i; const Vec *inx,*outx,*wx; Mat A; PetscFunctionBegin; ierr = PCGetOperators(pc,&A,NULL,NULL);CHKERRQ(ierr); ierr = MatShellGetContext(A,(void**)&data);CHKERRQ(ierr); ierr = VecCompGetSubVecs(in,NULL,&inx);CHKERRQ(ierr); ierr = VecCompGetSubVecs(out,NULL,&outx);CHKERRQ(ierr); ierr = VecCompGetSubVecs(w,NULL,&wx);CHKERRQ(ierr); n = data->r_e - data->r_s; /* Check auxiliary vectors */ if (&data->auxV[n] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors"); switch (side) { case PC_LEFT: /* aux <- theta[1]A*in - theta[0]*B*in */ ierr = dvd_aux_matmult(data,inx,data->auxV,outx);CHKERRQ(ierr); /* out <- K * aux */ for (i=0;id->improvex_precond(data->d,data->r_s+i,data->auxV[i],outx[i]);CHKERRQ(ierr); } break; case PC_RIGHT: /* aux <- K * in */ for (i=0;id->improvex_precond(data->d,data->r_s+i,inx[i],data->auxV[i]);CHKERRQ(ierr); } /* out <- theta[1]A*auxV - theta[0]*B*auxV */ ierr = dvd_aux_matmult(data,data->auxV,outx,wx);CHKERRQ(ierr); break; case PC_SYMMETRIC: /* aux <- K^{1/2} * in */ for (i=0;iold_pc,inx[i],data->auxV[i]);CHKERRQ(ierr); } /* out <- theta[1]A*auxV - theta[0]*B*auxV */ ierr = dvd_aux_matmult(data,data->auxV,wx,outx);CHKERRQ(ierr); /* aux <- K^{1/2} * in */ for (i=0;iold_pc,wx[i],outx[i]);CHKERRQ(ierr); } break; default: SETERRQ(PETSC_COMM_SELF,1, "Unsupported KSP side"); } /* out <- out - v*(u'*out) */ ierr = dvd_improvex_apply_proj(data->d,(Vec*)outx,n,data->auxS);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "PCApply_dvd" PetscErrorCode PCApply_dvd(PC pc,Vec in,Vec out) { PetscErrorCode ierr; dvdImprovex_jd *data; PetscInt n,i; const Vec *inx, *outx; Mat A; PetscFunctionBegin; ierr = PCGetOperators(pc,&A,NULL,NULL);CHKERRQ(ierr); ierr = MatShellGetContext(A,(void**)&data);CHKERRQ(ierr); ierr = VecCompGetSubVecs(in,NULL,&inx);CHKERRQ(ierr); ierr = VecCompGetSubVecs(out,NULL,&outx);CHKERRQ(ierr); n = data->r_e - data->r_s; /* out <- K * in */ for (i=0;id->improvex_precond(data->d,data->r_s+i,inx[i],outx[i]);CHKERRQ(ierr); } /* out <- out - v*(u'*out) */ ierr = dvd_improvex_apply_proj(data->d,(Vec*)outx,n,data->auxS);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "PCApplyTranspose_dvd" PetscErrorCode PCApplyTranspose_dvd(PC pc,Vec in,Vec out) { PetscErrorCode ierr; dvdImprovex_jd *data; PetscInt n,i; const Vec *inx, *outx; Mat A; PetscFunctionBegin; ierr = PCGetOperators(pc,&A,NULL,NULL);CHKERRQ(ierr); ierr = MatShellGetContext(A,(void**)&data);CHKERRQ(ierr); ierr = VecCompGetSubVecs(in,NULL,&inx);CHKERRQ(ierr); ierr = VecCompGetSubVecs(out,NULL,&outx);CHKERRQ(ierr); n = data->r_e - data->r_s; /* Check auxiliary vectors */ if (&data->auxV[n] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors"); /* auxV <- in */ for (i=0;iauxV[i]);CHKERRQ(ierr); } /* auxV <- auxV - u*(v'*auxV) */ ierr = dvd_improvex_applytrans_proj(data->d,data->auxV,n,data->auxS);CHKERRQ(ierr); /* out <- K' * aux */ for (i=0;iold_pc,data->auxV[i],outx[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_dvd_jd" PetscErrorCode MatMult_dvd_jd(Mat A,Vec in,Vec out) { PetscErrorCode ierr; dvdImprovex_jd *data; PetscInt n; const Vec *inx, *outx; PCSide side; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&data);CHKERRQ(ierr); ierr = VecCompGetSubVecs(in,NULL,&inx);CHKERRQ(ierr); ierr = VecCompGetSubVecs(out,NULL,&outx);CHKERRQ(ierr); n = data->r_e - data->r_s; /* Check auxiliary vectors */ if (&data->auxV[2] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors"); /* out <- theta[1]A*in - theta[0]*B*in */ ierr = dvd_aux_matmult(data,inx,outx,data->auxV);CHKERRQ(ierr); ierr = KSPGetPCSide(data->ksp,&side);CHKERRQ(ierr); if (side == PC_RIGHT) { /* out <- out - v*(u'*out) */ ierr = dvd_improvex_apply_proj(data->d,(Vec*)outx,n,data->auxS);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMultTranspose_dvd_jd" PetscErrorCode MatMultTranspose_dvd_jd(Mat A,Vec in,Vec out) { PetscErrorCode ierr; dvdImprovex_jd *data; PetscInt n,i; const Vec *inx,*outx,*r,*auxV; PCSide side; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&data);CHKERRQ(ierr); ierr = VecCompGetSubVecs(in,NULL,&inx);CHKERRQ(ierr); ierr = VecCompGetSubVecs(out,NULL,&outx);CHKERRQ(ierr); n = data->r_e - data->r_s; /* Check auxiliary vectors */ if (&data->auxV[n+2] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors"); ierr = KSPGetPCSide(data->ksp,&side);CHKERRQ(ierr); if (side == PC_RIGHT) { /* auxV <- in */ for (i=0;iauxV[i]);CHKERRQ(ierr); } /* auxV <- auxV - v*(u'*auxV) */ ierr = dvd_improvex_applytrans_proj(data->d,data->auxV,n,data->auxS);CHKERRQ(ierr); r = data->auxV; auxV = data->auxV+n; } else { r = inx; auxV = data->auxV; } /* out <- theta[1]A*r - theta[0]*B*r */ ierr = dvd_aux_matmulttrans(data,r,outx,auxV);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetVecs_dvd_jd" PetscErrorCode MatGetVecs_dvd_jd(Mat A,Vec *right,Vec *left) { PetscErrorCode ierr; Vec *r, *l; dvdImprovex_jd *data; PetscInt n, i; PetscFunctionBegin; ierr = MatShellGetContext(A, (void**)&data);CHKERRQ(ierr); n = data->ksp_max_size; if (right) { ierr = PetscMalloc(sizeof(Vec)*n, &r);CHKERRQ(ierr); } if (left) { ierr = PetscMalloc(sizeof(Vec)*n, &l);CHKERRQ(ierr); } for (i=0; id->A, right?&r[i]:NULL,left?&l[i]:NULL);CHKERRQ(ierr); } if (right) { ierr = VecCreateCompWithVecs(r, n, data->friends, right);CHKERRQ(ierr); for (i=0; ifriends, left);CHKERRQ(ierr); for (i=0; istate >= DVD_STATE_CONF) { switch (p) { case DVD_PROJ_KXX: d->improvex_jd_proj_uv = dvd_improvex_jd_proj_uv_KXX; break; case DVD_PROJ_KZX: d->improvex_jd_proj_uv = dvd_improvex_jd_proj_uv_KZX; break; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_proj_cuv" /* Compute: u <- X, v <- K*(theta[0]*A+theta[1]*B)*X, kr <- K^{-1}*(A-eig*B)*X, being X <- V*pX[i_s..i_e-1], Y <- W*pY[i_s..i_e-1] where auxV, 4*(i_e-i_s) auxiliar global vectors pX,pY, the right and left eigenvectors of the projected system ld, the leading dimension of pX and pY auxS: max(8*bs*max_cX_in_proj,size_V*size_V) */ PetscErrorCode dvd_improvex_jd_proj_cuv(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec **u,Vec **v,Vec *kr,Vec **auxV,PetscScalar **auxS,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld) { #if defined(PETSC_MISSING_LAPACK_GETRF) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt n = i_e - i_s, size_KZ, V_new, rm, i, size_in; dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscBLASInt s, ldXKZ, info; DvdReduction r; DvdReductionChunk ops[2]; DvdMult_copy_func sr[2]; PetscFunctionBegin; /* Check consistency */ V_new = d->size_cX - data->size_cX; if (V_new > data->old_size_X) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); data->old_size_X = n; /* KZ <- KZ(rm:rm+max_cX-1) */ rm = PetscMax(V_new+data->size_KZ-d->max_cX_in_impr, 0); for (i=0; imax_cX_in_impr; i++) { ierr = VecCopy(data->KZ[i+rm], data->KZ[i]);CHKERRQ(ierr); } data->size_cX = d->size_cX; /* XKZ <- XKZ(rm:rm+max_cX-1,rm:rm+max_cX-1) */ for (i=0; imax_cX_in_impr; i++) { ierr = SlepcDenseCopy(&data->XKZ[i*data->ldXKZ+i], data->ldXKZ, &data->XKZ[(i+rm)*data->ldXKZ+i+rm], data->ldXKZ, data->size_KZ, 1);CHKERRQ(ierr); } data->size_KZ = PetscMin(d->max_cX_in_impr, data->size_KZ+V_new); /* Compute X, KZ and KR */ *u = *auxV; *auxV+= n; *v = &data->KZ[data->size_KZ]; ierr = d->improvex_jd_proj_uv(d, i_s, i_e, *u, *v, kr, *auxV, theta, thetai, pX, pY, ld);CHKERRQ(ierr); /* XKZ <- X'*KZ */ size_KZ = data->size_KZ+n; size_in = 2*n*data->size_KZ+n*n; ierr = SlepcAllReduceSumBegin(ops,2,*auxS,*auxS+size_in,size_in,&r,PetscObjectComm((PetscObject)d->V[0]));CHKERRQ(ierr); ierr = VecsMultS(data->XKZ,0,data->ldXKZ,d->V-data->size_KZ,0,data->size_KZ,data->KZ,data->size_KZ,size_KZ,&r,&sr[0]);CHKERRQ(ierr); ierr = VecsMultS(&data->XKZ[data->size_KZ],0,data->ldXKZ,*u,0,n,data->KZ,0,size_KZ,&r,&sr[1]);CHKERRQ(ierr); ierr = SlepcAllReduceSumEnd(&r);CHKERRQ(ierr); /* iXKZ <- inv(XKZ) */ ierr = PetscBLASIntCast(size_KZ,&s);CHKERRQ(ierr); data->ldiXKZ = data->size_iXKZ = size_KZ; data->iXKZ = *auxS; *auxS+= size_KZ*size_KZ; data->iXKZPivots = (PetscBLASInt*)*auxS; *auxS += FromIntToScalar(size_KZ); ierr = SlepcDenseCopy(data->iXKZ,data->ldiXKZ,data->XKZ,data->ldXKZ,size_KZ,size_KZ);CHKERRQ(ierr); ierr = PetscBLASIntCast(data->ldiXKZ,&ldXKZ);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgetrf",LAPACKgetrf_(&s, &s, data->iXKZ, &ldXKZ, data->iXKZPivots, &info)); ierr = PetscFPTrapPop();CHKERRQ(ierr); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "Error in Lapack XGETRF %d", info); PetscFunctionReturn(0); #endif } #define DVD_COMPLEX_RAYLEIGH_QUOTIENT(ur,ui,Axr,Axi,Bxr,Bxi,eigr,eigi,b,ierr)\ { \ ierr = VecDot((Axr), (ur), &(b)[0]);CHKERRQ(ierr); /* r*A*r */ \ ierr = VecDot((Axr), (ui), &(b)[1]);CHKERRQ(ierr); /* i*A*r */ \ ierr = VecDot((Axi), (ur), &(b)[2]);CHKERRQ(ierr); /* r*A*i */ \ ierr = VecDot((Axi), (ui), &(b)[3]);CHKERRQ(ierr); /* i*A*i */ \ ierr = VecDot((Bxr), (ur), &(b)[4]);CHKERRQ(ierr); /* r*B*r */ \ ierr = VecDot((Bxr), (ui), &(b)[5]);CHKERRQ(ierr); /* i*B*r */ \ ierr = VecDot((Bxi), (ur), &(b)[6]);CHKERRQ(ierr); /* r*B*i */ \ ierr = VecDot((Bxi), (ui), &(b)[7]);CHKERRQ(ierr); /* i*B*i */ \ (b)[0] = (b)[0]+(b)[3]; /* rAr+iAi */ \ (b)[2] = (b)[2]-(b)[1]; /* rAi-iAr */ \ (b)[4] = (b)[4]+(b)[7]; /* rBr+iBi */ \ (b)[6] = (b)[6]-(b)[5]; /* rBi-iBr */ \ (b)[7] = (b)[4]*(b)[4] + (b)[6]*(b)[6]; /* k */ \ *(eigr) = ((b)[0]*(b)[4] + (b)[2]*(b)[6]) / (b)[7]; /* eig_r */ \ *(eigi) = ((b)[2]*(b)[4] - (b)[0]*(b)[6]) / (b)[7]; /* eig_i */ \ } #if !defined(PETSC_USE_COMPLEX) #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \ for ((i)=0; (i)<(n); (i)++) { \ if ((eigi)[(i_s)+(i)] != 0.0) { \ /* eig_r = [(rAr+iAi)*(rBr+iBi) + (rAi-iAr)*(rBi-iBr)]/k \ eig_i = [(rAi-iAr)*(rBr+iBi) - (rAr+iAi)*(rBi-iBr)]/k \ k = (rBr+iBi)*(rBr+iBi) + (rBi-iBr)*(rBi-iBr) */ \ DVD_COMPLEX_RAYLEIGH_QUOTIENT((u)[(i)], (u)[(i)+1], (Ax)[(i)], \ (Ax)[(i)+1], (Bx)[(i)], (Bx)[(i)+1], &(b)[8], &(b)[9], (b), (ierr)); \ if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[8])/ \ PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10 || \ PetscAbsScalar((eigi)[(i_s)+(i)] - (b)[9])/ \ PetscAbsScalar((eigi)[(i_s)+(i)]) > 1e-10) { \ (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its "\ "Rayleigh quotient value %G+%G\n", \ (eigr)[(i_s)+(i)], \ (eigi)[(i_s)+(i)], (b)[8], (b)[9]); \ } \ (i)++; \ } \ } #else #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \ for ((i)=0; (i)<(n); (i)++) { \ (ierr) = VecDot((Ax)[(i)], (u)[(i)], &(b)[0]);CHKERRQ(ierr); \ (ierr) = VecDot((Bx)[(i)], (u)[(i)], &(b)[1]);CHKERRQ(ierr); \ (b)[0] = (b)[0]/(b)[1]; \ if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[0])/ \ PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10) { \ (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its " \ "Rayleigh quotient value %G+%G\n", \ PetscRealPart((eigr)[(i_s)+(i)]), \ PetscImaginaryPart((eigr)[(i_s)+(i)]), PetscRealPart((b)[0]), \ PetscImaginaryPart((b)[0])); \ } \ } #endif #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_proj_uv_KZX" /* Compute: u <- X, v <- K*(theta[0]*A+theta[1]*B)*X, kr <- K^{-1}*(A-eig*B)*X, being X <- V*pX[i_s..i_e-1], Y <- W*pY[i_s..i_e-1] where auxV, 4*(i_e-i_s) auxiliar global vectors pX,pY, the right and left eigenvectors of the projected system ld, the leading dimension of pX and pY */ PetscErrorCode dvd_improvex_jd_proj_uv_KZX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld) { PetscErrorCode ierr; PetscInt n = i_e - i_s, i; PetscScalar b[16]; Vec *Ax, *Bx, *r=auxV, X[4]; /* The memory manager doen't allow to call a subroutines */ PetscScalar Z[size_Z]; PetscFunctionBegin; /* u <- X(i) */ ierr = dvd_improvex_compute_X(d,i_s,i_e,u,pX,ld);CHKERRQ(ierr); /* v <- theta[0]A*u + theta[1]*B*u */ /* Bx <- B*X(i) */ Bx = kr; if (d->BV) { ierr = SlepcUpdateVectorsZ(Bx, 0.0, 1.0, d->BV-d->cX_in_H, d->size_BV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);CHKERRQ(ierr); } else { for (i=0;iB) { ierr = MatMult(d->B, u[i], Bx[i]);CHKERRQ(ierr); } else { ierr = VecCopy(u[i], Bx[i]);CHKERRQ(ierr); } } } /* Ax <- A*X(i) */ Ax = r; ierr = SlepcUpdateVectorsZ(Ax, 0.0, 1.0, d->AV-d->cX_in_H, d->size_AV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);CHKERRQ(ierr); /* v <- Y(i) */ ierr = SlepcUpdateVectorsZ(v, 0.0, 1.0, (d->W?d->W:d->V)-d->cX_in_H, d->size_V+d->cX_in_H, &pY[ld*i_s], ld, d->size_H, n);CHKERRQ(ierr); /* Recompute the eigenvalue */ DVD_COMPUTE_N_RR(d->eps, i, i_s, n, d->eigr, d->eigi, v, Ax, Bx, b, ierr); for (i=0;ieigi[i_s+i] != 0.0) { /* [r_i r_i+1 kr_i kr_i+1]*= [ theta_2i' 0 1 0 0 theta_2i' 0 1 theta_2i+1 -thetai_i -eigr_i -eigi_i thetai_i theta_2i+1 eigi_i -eigr_i ] */ b[0] = b[5] = PetscConj(theta[2*i]); b[2] = b[7] = -theta[2*i+1]; b[6] = -(b[3] = thetai[i]); b[1] = b[4] = 0.0; b[8] = b[13] = 1.0/d->nX[i_s+i]; b[10] = b[15] = -d->eigr[i_s+i]/d->nX[i_s+i]; b[14] = -(b[11] = d->eigi[i_s+i]/d->nX[i_s+i]); b[9] = b[12] = 0.0; X[0] = Ax[i]; X[1] = Ax[i+1]; X[2] = Bx[i]; X[3] = Bx[i+1]; ierr = SlepcUpdateVectorsD(X, 4, 1.0, b, 4, 4, 4, Z, size_Z);CHKERRQ(ierr); i++; } else #endif { /* [Ax_i Bx_i]*= [ theta_2i' 1/nX_i theta_2i+1 -eig_i/nX_i ] */ b[0] = PetscConj(theta[i*2]); b[1] = theta[i*2+1]; b[2] = 1.0/d->nX[i_s+i]; b[3] = -d->eigr[i_s+i]/d->nX[i_s+i]; X[0] = Ax[i]; X[1] = Bx[i]; ierr = SlepcUpdateVectorsD(X, 2, 1.0, b, 2, 2, 2, Z, size_Z);CHKERRQ(ierr); } } for (i=0; inX[i_s+i] = 1.0; /* v <- K^{-1} r = K^{-1}(theta_2i'*Ax + theta_2i+1*Bx) */ for (i=0;iimprovex_precond(d, i_s+i, r[i], v[i]);CHKERRQ(ierr); } /* kr <- P*(Ax - eig_i*Bx) */ ierr = d->calcpairs_proj_res(d, i_s, i_e, kr);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_proj_uv_KXX" /* Compute: u <- K^{-1}*X, v <- X, kr <- K^{-1}*(A-eig*B)*X, being X <- V*pX[i_s..i_e-1] where auxV, 4*(i_e-i_s) auxiliar global vectors pX,pY, the right and left eigenvectors of the projected system ld, the leading dimension of pX and pY */ PetscErrorCode dvd_improvex_jd_proj_uv_KXX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld) { PetscErrorCode ierr; PetscInt n = i_e - i_s, i; PetscScalar b[16]; Vec *Ax, *Bx, *r = auxV, X[4]; /* The memory manager doen't allow to call a subroutines */ PetscScalar Z[size_Z]; PetscFunctionBegin; /* [v u] <- X(i) Y(i) */ ierr = dvd_improvex_compute_X(d,i_s,i_e,v,pX,ld);CHKERRQ(ierr); ierr = SlepcUpdateVectorsZ(u, 0.0, 1.0, (d->W?d->W:d->V)-d->cX_in_H, d->size_V+d->cX_in_H, &pY[ld*i_s], ld, d->size_H, n);CHKERRQ(ierr); /* Bx <- B*X(i) */ Bx = r; if (d->BV) { ierr = SlepcUpdateVectorsZ(Bx, 0.0, 1.0, d->BV-d->cX_in_H, d->size_BV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);CHKERRQ(ierr); } else { if (d->B) { for (i=0;iB, v[i], Bx[i]);CHKERRQ(ierr); } } else Bx = v; } /* Ax <- A*X(i) */ Ax = kr; ierr = SlepcUpdateVectorsZ(Ax, 0.0, 1.0, d->AV-d->cX_in_H, d->size_AV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);CHKERRQ(ierr); /* Recompute the eigenvalue */ DVD_COMPUTE_N_RR(d->eps, i, i_s, n, d->eigr, d->eigi, u, Ax, Bx, b, ierr); for (i=0;ieigi[i_s+i] == 0.0) { /* kr <- Ax -eig*Bx */ ierr = VecAXPBY(kr[i], -d->eigr[i_s+i]/d->nX[i_s+i], 1.0/d->nX[i_s+i], Bx[i]);CHKERRQ(ierr); } else { /* [kr_i kr_i+1 r_i r_i+1]*= [ 1 0 0 1 -eigr_i -eigi_i eigi_i -eigr_i] */ b[0] = b[5] = 1.0/d->nX[i_s+i]; b[2] = b[7] = -d->eigr[i_s+i]/d->nX[i_s+i]; b[6] = -(b[3] = d->eigi[i_s+i]/d->nX[i_s+i]); b[1] = b[4] = 0.0; X[0] = kr[i]; X[1] = kr[i+1]; X[2] = r[i]; X[3] = r[i+1]; ierr = SlepcUpdateVectorsD(X, 4, 1.0, b, 4, 4, 2, Z, size_Z);CHKERRQ(ierr); i++; } } for (i=0; inX[i_s+i] = 1.0; /* kr <- P*kr */ ierr = d->calcpairs_proj_res(d, i_s, i_e, r);CHKERRQ(ierr); /* u <- K^{-1} X(i) */ for (i=0;iimprovex_precond(d, i_s+i, v[i], u[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_lit_const" PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d,dvdBlackboard *b,PetscInt maxits,PetscReal tol,PetscReal fix) { dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscFunctionBegin; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { data->maxits = maxits; data->tol = tol; data->fix = fix; d->improvex_jd_lit = dvd_improvex_jd_lit_const_0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_jd_lit_const_0" PetscErrorCode dvd_improvex_jd_lit_const_0(dvdDashboard *d,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol) { dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscReal a; PetscFunctionBegin; a = SlepcAbsEigenvalue(d->eigr[i],d->eigi[i]); if (d->nR[i]/a < data->fix) { theta[0] = d->eigr[i]; theta[1] = 1.0; #if !defined(PETSC_USE_COMPLEX) *thetai = d->eigi[i]; #endif } else { theta[0] = d->target[0]; theta[1] = d->target[1]; #if !defined(PETSC_USE_COMPLEX) *thetai = 0.0; #endif } #if defined(PETSC_USE_COMPLEX) if (thetai) *thetai = 0.0; #endif *maxits = data->maxits; *tol = data->tol; PetscFunctionReturn(0); } /**** Patterns implementation *************************************************/ typedef PetscInt (*funcV0_t)(dvdDashboard*,PetscInt,PetscInt,Vec*); typedef PetscInt (*funcV1_t)(dvdDashboard*,PetscInt,PetscInt,Vec*,PetscScalar*,Vec); #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_PfuncV" /* Compute D <- K^{-1} * funcV[r_s..r_e] */ PetscErrorCode dvd_improvex_PfuncV(dvdDashboard *d,void *funcV,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,Vec *auxV,PetscScalar *auxS) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; if (max_size_D >= r_e-r_s+1) { /* The optimized version needs one vector extra of D */ /* D(1:r.size) = R(r_s:r_e-1) */ if (auxS) ((funcV1_t)funcV)(d, r_s, r_e, D+1, auxS, auxV[0]); else ((funcV0_t)funcV)(d, r_s, r_e, D+1); /* D = K^{-1} * R */ for (i=0; iimprovex_precond(d, i+r_s, D[i+1], D[i]);CHKERRQ(ierr); } } else if (max_size_D == r_e-r_s) { /* Non-optimized version */ /* auxV <- R[r_e-1] */ if (auxS) ((funcV1_t)funcV)(d, r_e-1, r_e, auxV, auxS, auxV[1]); else ((funcV0_t)funcV)(d, r_e-1, r_e, auxV); /* D(1:r.size-1) = R(r_s:r_e-2) */ if (auxS) ((funcV1_t)funcV)(d, r_s, r_e-1, D+1, auxS, auxV[1]); else ((funcV0_t)funcV)(d, r_s, r_e-1, D+1); /* D = K^{-1} * R */ for (i=0; iimprovex_precond(d, i+r_s, D[i+1], D[i]);CHKERRQ(ierr); } ierr = d->improvex_precond(d, r_e-1, auxV[0], D[r_e-r_s-1]);CHKERRQ(ierr); } else SETERRQ(PETSC_COMM_SELF,1, "Problem: r_e-r_s > max_size_D"); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_apply_proj" /* Compute (I - KZ*iXKZ*X')*V where, V, the vectors to apply the projector, cV, the number of vectors in V, auxS, auxiliar vector of size length 3*size_iXKZ*cV */ PetscErrorCode dvd_improvex_apply_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS) { #if defined(PETSC_MISSING_LAPACK_GETRS) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRS - Lapack routines are unavailable"); #else PetscErrorCode ierr; dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscInt size_in = data->size_iXKZ*cV, i, ldh; PetscScalar *h, *in, *out; PetscBLASInt cV_, n, info, ld; DvdReduction r; DvdReductionChunk ops[4]; DvdMult_copy_func sr[4]; PetscFunctionBegin; if (cV > 2) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* h <- X'*V */ h = auxS; in = h+size_in; out = in+size_in; ldh = data->size_iXKZ; ierr = SlepcAllReduceSumBegin(ops, 4, in, out, size_in, &r, PetscObjectComm((PetscObject)d->V[0]));CHKERRQ(ierr); for (i=0; iV-data->size_KZ,0,data->size_KZ,V+i,0,1,&r,&sr[i*2]);CHKERRQ(ierr); ierr = VecsMultS(&h[i*ldh+data->size_KZ],0,ldh,data->u,0,data->size_iXKZ-data->size_KZ,V+i,0,1,&r,&sr[i*2+1]);CHKERRQ(ierr); } ierr = SlepcAllReduceSumEnd(&r);CHKERRQ(ierr); /* h <- iXKZ\h */ ierr = PetscBLASIntCast(cV,&cV_);CHKERRQ(ierr); ierr = PetscBLASIntCast(data->size_iXKZ,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(data->ldiXKZ,&ld);CHKERRQ(ierr); PetscValidScalarPointer(data->iXKZ,0); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgetrs",LAPACKgetrs_("N", &n, &cV_, data->iXKZ, &ld, data->iXKZPivots, h, &n, &info)); ierr = PetscFPTrapPop();CHKERRQ(ierr); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "Error in Lapack XGETRS %d", info); /* V <- V - KZ*h */ for (i=0; iKZ,data->size_iXKZ,&h[ldh*i],ldh,data->size_iXKZ,1);CHKERRQ(ierr); } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_applytrans_proj" /* Compute (I - X*iXKZ*KZ')*V where, V, the vectors to apply the projector, cV, the number of vectors in V, auxS, auxiliar vector of size length 3*size_iXKZ*cV */ PetscErrorCode dvd_improvex_applytrans_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS) { #if defined(PETSC_MISSING_LAPACK_GETRS) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRS - Lapack routines are unavailable"); #else PetscErrorCode ierr; dvdImprovex_jd *data = (dvdImprovex_jd*)d->improveX_data; PetscInt size_in = data->size_iXKZ*cV, i, ldh; PetscScalar *h, *in, *out; PetscBLASInt cV_, n, info, ld; DvdReduction r; DvdReductionChunk ops[2]; DvdMult_copy_func sr[2]; PetscFunctionBegin; if (cV > 2) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* h <- KZ'*V */ h = auxS; in = h+size_in; out = in+size_in; ldh = data->size_iXKZ; ierr = SlepcAllReduceSumBegin(ops, 2, in, out, size_in, &r, PetscObjectComm((PetscObject)d->V[0]));CHKERRQ(ierr); for (i=0; iKZ,0,data->size_KZ,V+i,0,1,&r,&sr[i]);CHKERRQ(ierr); } ierr = SlepcAllReduceSumEnd(&r);CHKERRQ(ierr); /* h <- iXKZ\h */ ierr = PetscBLASIntCast(cV,&cV_);CHKERRQ(ierr); ierr = PetscBLASIntCast(data->size_iXKZ,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(data->ldiXKZ,&ld);CHKERRQ(ierr); PetscValidScalarPointer(data->iXKZ,0); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgetrs",LAPACKgetrs_("C", &n, &cV_, data->iXKZ, &ld, data->iXKZPivots, h, &n, &info)); ierr = PetscFPTrapPop();CHKERRQ(ierr); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "Error in Lapack XGETRS %d", info); /* V <- V - X*h */ for (i=0; iV-data->size_KZ,data->size_KZ,&h[ldh*i],ldh,data->size_KZ,1);CHKERRQ(ierr); ierr = SlepcUpdateVectorsZ(V+i,1.0,-1.0,data->u,data->size_iXKZ-data->size_KZ,&h[ldh*i+data->size_KZ],ldh,data->size_iXKZ-data->size_KZ,1);CHKERRQ(ierr); } PetscFunctionReturn(0); #endif } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_utils.c0000644000175000017500000004117212211062077023402 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Some utils - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" PetscErrorCode dvd_static_precond_PC_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px); PetscErrorCode dvd_jacobi_precond_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px); PetscErrorCode dvd_precond_none(dvdDashboard *d,PetscInt i,Vec x,Vec Px); PetscErrorCode dvd_improvex_precond_d(dvdDashboard *d); typedef struct { PC pc; } dvdPCWrapper; /* Create a static preconditioner from a PC */ #undef __FUNCT__ #define __FUNCT__ "dvd_static_precond_PC" PetscErrorCode dvd_static_precond_PC(dvdDashboard *d,dvdBlackboard *b,PC pc) { PetscErrorCode ierr; dvdPCWrapper *dvdpc; Mat P; PetscBool t0,t1,t2; PetscFunctionBegin; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { /* If the preconditioner is valid */ if (pc) { ierr = PetscMalloc(sizeof(dvdPCWrapper),&dvdpc);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdPCWrapper));CHKERRQ(ierr); dvdpc->pc = pc; ierr = PetscObjectReference((PetscObject)pc);CHKERRQ(ierr); d->improvex_precond_data = dvdpc; d->improvex_precond = dvd_static_precond_PC_0; /* PC saves the matrix associated with the linear system, and it has to be initialize to a valid matrix */ ierr = PCGetOperatorsSet(pc,NULL,&t0);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)pc,PCNONE,&t1);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)pc,PCSHELL,&t2);CHKERRQ(ierr); if (t0 && !t1) { ierr = PCGetOperators(pc,NULL,&P,NULL);CHKERRQ(ierr); ierr = PetscObjectReference((PetscObject)P);CHKERRQ(ierr); ierr = PCSetOperators(pc,P,P,SAME_PRECONDITIONER);CHKERRQ(ierr); ierr = MatDestroy(&P);CHKERRQ(ierr); } else if (t2) { ierr = PCSetOperators(pc,d->A,d->A,SAME_PRECONDITIONER);CHKERRQ(ierr); } else { d->improvex_precond = dvd_precond_none; } DVD_FL_ADD(d->destroyList, dvd_improvex_precond_d); /* Else, use no preconditioner */ } else d->improvex_precond = dvd_precond_none; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_precond_d" PetscErrorCode dvd_improvex_precond_d(dvdDashboard *d) { PetscErrorCode ierr; dvdPCWrapper *dvdpc = (dvdPCWrapper*)d->improvex_precond_data; PetscFunctionBegin; /* Free local data */ if (dvdpc->pc) { ierr = PCDestroy(&dvdpc->pc);CHKERRQ(ierr); } ierr = PetscFree(d->improvex_precond_data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_static_precond_PC_0" PetscErrorCode dvd_static_precond_PC_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px) { PetscErrorCode ierr; dvdPCWrapper *dvdpc = (dvdPCWrapper*)d->improvex_precond_data; PetscFunctionBegin; ierr = PCApply(dvdpc->pc, x, Px);CHKERRQ(ierr); PetscFunctionReturn(0); } typedef struct { Vec diagA, diagB; } dvdJacobiPrecond; #undef __FUNCT__ #define __FUNCT__ "dvd_jacobi_precond" /* Create the Jacobi preconditioner for Generalized Eigenproblems */ PetscErrorCode dvd_jacobi_precond(dvdDashboard *d,dvdBlackboard *b) { PetscErrorCode ierr; dvdJacobiPrecond *dvdjp; PetscBool t; PetscFunctionBegin; /* Check if the problem matrices support GetDiagonal */ ierr = MatHasOperation(d->A, MATOP_GET_DIAGONAL, &t);CHKERRQ(ierr); if (t && d->B) { ierr = MatHasOperation(d->B, MATOP_GET_DIAGONAL, &t);CHKERRQ(ierr); } /* Setting configuration constrains */ b->own_vecs += t?((d->B == 0)?1:2) : 0; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { if (t) { ierr = PetscMalloc(sizeof(dvdJacobiPrecond), &dvdjp);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdJacobiPrecond));CHKERRQ(ierr); dvdjp->diagA = *b->free_vecs; b->free_vecs++; ierr = MatGetDiagonal(d->A,dvdjp->diagA);CHKERRQ(ierr); if (d->B) { dvdjp->diagB = *b->free_vecs; b->free_vecs++; ierr = MatGetDiagonal(d->B, dvdjp->diagB);CHKERRQ(ierr); } else dvdjp->diagB = 0; d->improvex_precond_data = dvdjp; d->improvex_precond = dvd_jacobi_precond_0; DVD_FL_ADD(d->destroyList, dvd_improvex_precond_d); /* Else, use no preconditioner */ } else d->improvex_precond = dvd_precond_none; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_jacobi_precond_0" PetscErrorCode dvd_jacobi_precond_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px) { PetscErrorCode ierr; dvdJacobiPrecond *dvdjp = (dvdJacobiPrecond*)d->improvex_precond_data; PetscFunctionBegin; /* Compute inv(D - eig)*x */ if (dvdjp->diagB == 0) { /* Px <- diagA - l */ ierr = VecCopy(dvdjp->diagA, Px);CHKERRQ(ierr); ierr = VecShift(Px, -d->eigr[i]);CHKERRQ(ierr); } else { /* Px <- diagA - l*diagB */ ierr = VecWAXPY(Px, -d->eigr[i], dvdjp->diagB, dvdjp->diagA);CHKERRQ(ierr); } /* Px(i) <- x/Px(i) */ ierr = VecPointwiseDivide(Px, x, Px);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_precond_none" /* Create a trivial preconditioner */ PetscErrorCode dvd_precond_none(dvdDashboard *d,PetscInt i,Vec x,Vec Px) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecCopy(x, Px);CHKERRQ(ierr); PetscFunctionReturn(0); } /* Use of PETSc profiler functions */ /* Define stages */ #define DVD_STAGE_INITV 0 #define DVD_STAGE_NEWITER 1 #define DVD_STAGE_CALCPAIRS 2 #define DVD_STAGE_IMPROVEX 3 #define DVD_STAGE_UPDATEV 4 #define DVD_STAGE_ORTHV 5 PetscErrorCode dvd_profiler_d(dvdDashboard *d); typedef struct { PetscErrorCode (*old_initV)(struct _dvdDashboard*); PetscErrorCode (*old_calcPairs)(struct _dvdDashboard*); PetscErrorCode (*old_improveX)(struct _dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D); PetscErrorCode (*old_updateV)(struct _dvdDashboard*); PetscErrorCode (*old_orthV)(struct _dvdDashboard*); } DvdProfiler; static PetscLogStage stages[6] = {0,0,0,0,0,0}; /*** Other things ****/ #undef __FUNCT__ #define __FUNCT__ "dvd_prof_init" PetscErrorCode dvd_prof_init() { PetscErrorCode ierr; PetscFunctionBegin; if (!stages[0]) { ierr = PetscLogStageRegister("Dvd_step_initV",&stages[DVD_STAGE_INITV]);CHKERRQ(ierr); ierr = PetscLogStageRegister("Dvd_step_calcPairs",&stages[DVD_STAGE_CALCPAIRS]);CHKERRQ(ierr); ierr = PetscLogStageRegister("Dvd_step_improveX",&stages[DVD_STAGE_IMPROVEX]);CHKERRQ(ierr); ierr = PetscLogStageRegister("Dvd_step_updateV",&stages[DVD_STAGE_UPDATEV]);CHKERRQ(ierr); ierr = PetscLogStageRegister("Dvd_step_orthV",&stages[DVD_STAGE_ORTHV]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_initV_prof" PetscErrorCode dvd_initV_prof(dvdDashboard* d) { DvdProfiler *p = (DvdProfiler*)d->prof_data; PetscErrorCode ierr; PetscFunctionBegin; PetscLogStagePush(stages[DVD_STAGE_INITV]); ierr = p->old_initV(d);CHKERRQ(ierr); PetscLogStagePop(); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcPairs_prof" PetscErrorCode dvd_calcPairs_prof(dvdDashboard* d) { DvdProfiler *p = (DvdProfiler*)d->prof_data; PetscErrorCode ierr; PetscFunctionBegin; PetscLogStagePush(stages[DVD_STAGE_CALCPAIRS]); ierr = p->old_calcPairs(d);CHKERRQ(ierr); PetscLogStagePop(); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improveX_prof" PetscErrorCode dvd_improveX_prof(dvdDashboard* d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D) { DvdProfiler *p = (DvdProfiler*)d->prof_data; PetscErrorCode ierr; PetscFunctionBegin; PetscLogStagePush(stages[DVD_STAGE_IMPROVEX]); ierr = p->old_improveX(d, D, max_size_D, r_s, r_e, size_D);CHKERRQ(ierr); PetscLogStagePop(); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_prof" PetscErrorCode dvd_updateV_prof(dvdDashboard *d) { DvdProfiler *p = (DvdProfiler*)d->prof_data; PetscErrorCode ierr; PetscFunctionBegin; PetscLogStagePush(stages[DVD_STAGE_UPDATEV]); ierr = p->old_updateV(d);CHKERRQ(ierr); PetscLogStagePop(); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_orthV_prof" PetscErrorCode dvd_orthV_prof(dvdDashboard *d) { DvdProfiler *p = (DvdProfiler*)d->prof_data; PetscErrorCode ierr; PetscFunctionBegin; PetscLogStagePush(stages[DVD_STAGE_ORTHV]); ierr = p->old_orthV(d);CHKERRQ(ierr); PetscLogStagePop(); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_profiler" PetscErrorCode dvd_profiler(dvdDashboard *d,dvdBlackboard *b) { PetscErrorCode ierr; DvdProfiler *p; PetscFunctionBegin; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscFree(d->prof_data);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(DvdProfiler),&p);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(DvdProfiler));CHKERRQ(ierr); d->prof_data = p; p->old_initV = d->initV; d->initV = dvd_initV_prof; p->old_calcPairs = d->calcPairs; d->calcPairs = dvd_calcPairs_prof; p->old_improveX = d->improveX; d->improveX = dvd_improveX_prof; p->old_updateV = d->updateV; d->updateV = dvd_updateV_prof; DVD_FL_ADD(d->destroyList, dvd_profiler_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_profiler_d" PetscErrorCode dvd_profiler_d(dvdDashboard *d) { PetscErrorCode ierr; DvdProfiler *p = (DvdProfiler*)d->prof_data; PetscFunctionBegin; /* Free local data */ ierr = PetscFree(p);CHKERRQ(ierr); PetscFunctionReturn(0); } /* Configure the harmonics. switch (mode) { DVD_HARM_RR: harmonic RR DVD_HARM_RRR: relative harmonic RR DVD_HARM_REIGS: rightmost eigenvalues DVD_HARM_LEIGS: largest eigenvalues } fixedTarged, if true use the target instead of the best eigenvalue target, the fixed target to be used */ typedef struct { PetscScalar Wa, Wb, /* span{W} = span{Wa*AV - Wb*BV} */ Pa, Pb; /* H=W'*(Pa*AV - Pb*BV), G=W'*(Wa*AV - Wb*BV) */ PetscBool withTarget; HarmType_t mode; } dvdHarmonic; PetscErrorCode dvd_harm_start(dvdDashboard *d); PetscErrorCode dvd_harm_end(dvdDashboard *d); PetscErrorCode dvd_harm_d(dvdDashboard *d); PetscErrorCode dvd_harm_transf(dvdHarmonic *dvdh,PetscScalar t); PetscErrorCode dvd_harm_updateW(dvdDashboard *d); PetscErrorCode dvd_harm_proj(dvdDashboard *d); PetscErrorCode dvd_harm_eigs_trans(dvdDashboard *d); PetscErrorCode dvd_harm_eig_backtrans(dvdDashboard *d,PetscScalar ar,PetscScalar ai,PetscScalar *br,PetscScalar *bi); #undef __FUNCT__ #define __FUNCT__ "dvd_harm_conf" PetscErrorCode dvd_harm_conf(dvdDashboard *d,dvdBlackboard *b,HarmType_t mode,PetscBool fixedTarget,PetscScalar t) { PetscErrorCode ierr; dvdHarmonic *dvdh; PetscFunctionBegin; /* Set the problem to GNHEP: d->G maybe is upper triangular due to biorthogonality of V and W */ d->sEP = d->sA = d->sB = 0; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscMalloc(sizeof(dvdHarmonic),&dvdh);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdHarmonic));CHKERRQ(ierr); dvdh->withTarget = fixedTarget; dvdh->mode = mode; if (fixedTarget) dvd_harm_transf(dvdh, t); d->calcpairs_W_data = dvdh; d->calcpairs_W = dvd_harm_updateW; d->calcpairs_proj_trans = dvd_harm_proj; d->calcpairs_eigs_trans = dvd_harm_eigs_trans; d->calcpairs_eig_backtrans = dvd_harm_eig_backtrans; DVD_FL_ADD(d->destroyList, dvd_harm_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_d" PetscErrorCode dvd_harm_d(dvdDashboard *d) { PetscErrorCode ierr; PetscFunctionBegin; /* Free local data */ ierr = PetscFree(d->calcpairs_W_data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_transf" PetscErrorCode dvd_harm_transf(dvdHarmonic *dvdh,PetscScalar t) { PetscFunctionBegin; switch (dvdh->mode) { case DVD_HARM_RR: /* harmonic RR */ dvdh->Wa = 1.0; dvdh->Wb = t; dvdh->Pa = 0.0; dvdh->Pb = -1.0; break; case DVD_HARM_RRR: /* relative harmonic RR */ dvdh->Wa = 1.0; dvdh->Wb = t; dvdh->Pa = 1.0; dvdh->Pb = 0.0; break; case DVD_HARM_REIGS: /* rightmost eigenvalues */ dvdh->Wa = 1.0; dvdh->Wb = t; dvdh->Pa = 1.0; dvdh->Pb = -PetscConj(t); break; case DVD_HARM_LEIGS: /* largest eigenvalues */ dvdh->Wa = 0.0; dvdh->Wb = 1.0; dvdh->Pa = 1.0; dvdh->Pb = 0.0; break; case DVD_HARM_NONE: default: SETERRQ(PETSC_COMM_SELF,1, "Harmonic type not supported"); } /* Check the transformation does not change the sign of the imaginary part */ #if !defined(PETSC_USE_COMPLEX) if (dvdh->Pb*dvdh->Wa - dvdh->Wb*dvdh->Pa < 0.0) dvdh->Pa*= -1.0, dvdh->Pb*= -1.0; #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_updateW" PetscErrorCode dvd_harm_updateW(dvdDashboard *d) { dvdHarmonic *data = (dvdHarmonic*)d->calcpairs_W_data; PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; /* Update the target if it is necessary */ if (!data->withTarget) { ierr = dvd_harm_transf(data,d->eigr[0]);CHKERRQ(ierr); } for (i=d->V_new_s;iV_new_e;i++) { /* W(i) <- Wa*AV(i) - Wb*BV(i) */ ierr = VecAXPBYPCZ(d->W[i],data->Wa,-data->Wb,0.0,d->AV[i],(d->BV?d->BV:d->V)[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_proj" PetscErrorCode dvd_harm_proj(dvdDashboard *d) { dvdHarmonic *data = (dvdHarmonic*)d->calcpairs_W_data; PetscInt i,j; PetscFunctionBegin; if (d->sH != d->sG) SETERRQ(PETSC_COMM_SELF,1,"Projected matrices H and G must have the same structure"); /* [H G] <- [Pa*H - Pb*G, Wa*H - Wb*G] */ if (DVD_ISNOT(d->sH,DVD_MAT_LTRIANG)) /* Upper triangular part */ for (i=d->V_new_s+d->cX_in_H;iV_new_e+d->cX_in_H;i++) for (j=0;j<=i;j++) { PetscScalar h = d->H[d->ldH*i+j], g = d->G[d->ldH*i+j]; d->H[d->ldH*i+j] = data->Pa*h - data->Pb*g; d->G[d->ldH*i+j] = data->Wa*h - data->Wb*g; } if (DVD_ISNOT(d->sH,DVD_MAT_UTRIANG)) /* Lower triangular part */ for (i=0;iV_new_e+d->cX_in_H;i++) for (j=PetscMax(d->V_new_s+d->cX_in_H,i+(DVD_ISNOT(d->sH,DVD_MAT_LTRIANG)?1:0)); jV_new_e+d->cX_in_H; j++) { PetscScalar h = d->H[d->ldH*i+j], g = d->G[d->ldH*i+j]; d->H[d->ldH*i+j] = data->Pa*h - data->Pb*g; d->G[d->ldH*i+j] = data->Wa*h - data->Wb*g; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_backtrans" PetscErrorCode dvd_harm_backtrans(dvdHarmonic *data,PetscScalar *ar,PetscScalar *ai) { PetscScalar xr; #if !defined(PETSC_USE_COMPLEX) PetscScalar xi, k; #endif PetscFunctionBegin; PetscValidPointer(ar,2); xr = *ar; #if !defined(PETSC_USE_COMPLEX) PetscValidPointer(ai,3); xi = *ai; if (xi != 0.0) { k = (data->Pa - data->Wa*xr)*(data->Pa - data->Wa*xr) + data->Wa*data->Wa*xi*xi; *ar = (data->Pb*data->Pa - (data->Pb*data->Wa + data->Wb*data->Pa)*xr + data->Wb*data->Wa*(xr*xr + xi*xi))/k; *ai = (data->Pb*data->Wa - data->Wb*data->Pa)*xi/k; } else #endif *ar = (data->Pb - data->Wb*xr) / (data->Pa - data->Wa*xr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_eig_backtrans" PetscErrorCode dvd_harm_eig_backtrans(dvdDashboard *d,PetscScalar ar,PetscScalar ai,PetscScalar *br,PetscScalar *bi) { dvdHarmonic *data = (dvdHarmonic*)d->calcpairs_W_data; PetscErrorCode ierr; PetscFunctionBegin; ierr = dvd_harm_backtrans(data,&ar,&ai);CHKERRQ(ierr); *br = ar; *bi = ai; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_harm_eigs_trans" PetscErrorCode dvd_harm_eigs_trans(dvdDashboard *d) { dvdHarmonic *data = (dvdHarmonic*)d->calcpairs_W_data; PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; for (i=0;isize_H;i++) { ierr = dvd_harm_backtrans(data, &d->eigr[i-d->cX_in_H], &d->eigi[i-d->cX_in_H]);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_improvex.c.html0000644000175000017500000026522612211062077025066 0ustar gladkgladk

Actual source code: dvd_improvex.c

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

  4:   Step: improve the eigenvectors X

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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
 27: #include <slepc-private/vecimplslepc.h>         /*I "slepcvec.h" I*/

 29: PetscErrorCode dvd_improvex_PfuncV(dvdDashboard *d,void *funcV,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,Vec *auxV,PetscScalar *auxS);
 30: PetscErrorCode PCApplyBA_dvd(PC pc,PCSide side,Vec in,Vec out,Vec w);
 31: PetscErrorCode PCApply_dvd(PC pc,Vec in,Vec out);
 32: PetscErrorCode PCApplyTranspose_dvd(PC pc,Vec in,Vec out);
 33: PetscErrorCode MatMult_dvd_jd(Mat A,Vec in,Vec out);
 34: PetscErrorCode MatMultTranspose_dvd_jd(Mat A,Vec in,Vec out);
 35: PetscErrorCode MatGetVecs_dvd_jd(Mat A,Vec *right,Vec *left);
 36: PetscErrorCode dvd_improvex_jd_d(dvdDashboard *d);
 37: PetscErrorCode dvd_improvex_jd_start(dvdDashboard *d);
 38: PetscErrorCode dvd_improvex_jd_end(dvdDashboard *d);
 39: PetscErrorCode dvd_improvex_jd_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);
 40: PetscErrorCode dvd_improvex_jd_proj_cuv(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec **u,Vec **v,Vec *kr,Vec **auxV,PetscScalar **auxS,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld);
 41: PetscErrorCode dvd_improvex_jd_proj_uv_KXX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld);
 42: PetscErrorCode dvd_improvex_jd_proj_uv_KZX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld);
 43: PetscErrorCode dvd_improvex_jd_lit_const_0(dvdDashboard *d,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol);
 44: PetscErrorCode dvd_improvex_apply_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS);
 45: PetscErrorCode dvd_improvex_applytrans_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS);

 47: #define size_Z (64*4)

 49: /**** JD update step (I - Kfg'/(g'Kf)) K(A - sB) (I - Kfg'/(g'Kf)) t = (I - Kfg'/(g'Kf))r  ****/

 51: typedef struct {
 52:   PetscInt size_X;
 53:   void
 54:     *old_improveX_data;   /* old improveX_data */
 55:   improveX_type
 56:     old_improveX;         /* old improveX */
 57:   KSP ksp;                /* correction equation solver */
 58:   Vec
 59:     friends,              /* reference vector for composite vectors */
 60:     *auxV;                /* auxiliar vectors */
 61:   PetscScalar *auxS,      /* auxiliar scalars */
 62:     *theta,
 63:     *thetai;              /* the shifts used in the correction eq. */
 64:   PetscInt maxits,        /* maximum number of iterations */
 65:     r_s, r_e,             /* the selected eigenpairs to improve */
 66:     ksp_max_size;         /* the ksp maximum subvectors size */
 67:   PetscReal tol,          /* the maximum solution tolerance */
 68:     lastTol,              /* last tol for dynamic stopping criterion */
 69:     fix;                  /* tolerance for using the approx. eigenvalue */
 70:   PetscBool
 71:     dynamic;              /* if the dynamic stopping criterion is applied */
 72:   dvdDashboard
 73:     *d;                   /* the currect dvdDashboard reference */
 74:   PC old_pc;              /* old pc in ksp */
 75:   Vec
 76:     *u,                   /* new X vectors */
 77:     *real_KZ,             /* original KZ */
 78:     *KZ;                  /* KZ vecs for the projector KZ*inv(X'*KZ)*X' */
 79:   PetscScalar
 80:    *XKZ,                  /* X'*KZ */
 81:    *iXKZ;                 /* inverse of XKZ */
 82:   PetscInt
 83:     ldXKZ,                /* leading dimension of XKZ */
 84:     size_iXKZ,            /* size of iXKZ */
 85:     ldiXKZ,               /* leading dimension of iXKZ */
 86:     size_KZ,              /* size of converged KZ */
 87:     size_real_KZ,         /* original size of KZ */
 88:     size_cX,              /* last value of d->size_cX */
 89:     old_size_X;           /* last number of improved vectors */
 90:   PetscBLASInt
 91:     *iXKZPivots;          /* array of pivots */
 92: } dvdImprovex_jd;

 94: PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmult(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV);
 95: PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmulttrans(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV);

 99: PetscErrorCode dvd_improvex_jd(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs,PetscInt cX_impr,PetscBool dynamic)
100: {
101:   PetscErrorCode  ierr;
102:   dvdImprovex_jd  *data;
103:   PetscBool       useGD,her_probl,std_probl;
104:   PC              pc;
105:   PetscInt        size_P,s=1;

108:   std_probl = DVD_IS(d->sEP,DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
109:   her_probl = DVD_IS(d->sEP,DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE;

111:   /* Setting configuration constrains */
112:   PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&useGD);

114:   /* If the arithmetic is real and the problem is not Hermitian, then
115:      the block size is incremented in one */
116: #if !defined(PETSC_USE_COMPLEX)
117:   if (!her_probl) {
118:     max_bs++;
119:     b->max_size_P = PetscMax(b->max_size_P,2);
120:     s = 2;
121:   } else
122: #endif
123:     b->max_size_P = PetscMax(b->max_size_P,1);
124:   b->max_size_X = PetscMax(b->max_size_X,max_bs);
125:   size_P = b->max_size_P+cX_impr;
126:   b->max_size_auxV = PetscMax(b->max_size_auxV,
127:      b->max_size_X*3+(useGD?0:2)+ /* u, kr, auxV(max_size_X+2?) */
128:      ((her_probl || !d->eps->trueres)?1:PetscMax(s*2,b->max_size_cX_proj+b->max_size_X))); /* testConv */

130:   b->own_scalars+= size_P*size_P; /* XKZ */
131:   b->max_size_auxS = PetscMax(b->max_size_auxS,
132:     b->max_size_X*3 + /* theta, thetai */
133:     size_P*size_P + /* iXKZ */
134:     FromIntToScalar(size_P) + /* iXkZPivots */
135:     PetscMax(PetscMax(
136:       3*b->max_size_proj*b->max_size_X, /* dvd_improvex_apply_proj */
137:       8*cX_impr*b->max_size_X), /* dvd_improvex_jd_proj_cuv_KZX */
138:       (her_probl || !d->eps->trueres)?0:b->max_nev*b->max_nev+PetscMax(b->max_nev*6,(b->max_nev+b->max_size_proj)*s+b->max_nev*(b->max_size_X+b->max_size_cX_proj)*(std_probl?2:4)+64))); /* preTestConv */
139:   b->own_vecs+= size_P; /* KZ */

141:   /* Setup the preconditioner */
142:   if (ksp) {
143:     KSPGetPC(ksp,&pc);
144:     dvd_static_precond_PC(d,b,pc);
145:   } else {
146:     dvd_static_precond_PC(d,b,0);
147:   }

149:   /* Setup the step */
150:   if (b->state >= DVD_STATE_CONF) {
151:     PetscMalloc(sizeof(dvdImprovex_jd),&data);
152:     PetscLogObjectMemory(d->eps,sizeof(dvdImprovex_jd));
153:     data->dynamic = dynamic;
154:     data->size_real_KZ = size_P;
155:     data->real_KZ = b->free_vecs; b->free_vecs+= data->size_real_KZ;
156:     d->max_cX_in_impr = cX_impr;
157:     data->XKZ = b->free_scalars; b->free_scalars+= size_P*size_P;
158:     data->ldXKZ = size_P;
159:     data->size_X = b->max_size_X;
160:     data->old_improveX_data = d->improveX_data;
161:     d->improveX_data = data;
162:     data->old_improveX = d->improveX;
163:     data->ksp = useGD?NULL:ksp;
164:     data->d = d;
165:     d->improveX = dvd_improvex_jd_gen;
166:     data->ksp_max_size = max_bs;

168:     DVD_FL_ADD(d->startList,dvd_improvex_jd_start);
169:     DVD_FL_ADD(d->endList,dvd_improvex_jd_end);
170:     DVD_FL_ADD(d->destroyList,dvd_improvex_jd_d);
171:   }
172:   return(0);
173: }

177: PetscErrorCode dvd_improvex_jd_start(dvdDashboard *d)
178: {
179:   PetscErrorCode  ierr;
180:   dvdImprovex_jd  *data = (dvdImprovex_jd*)d->improveX_data;
181:   PetscInt        rA, cA, rlA, clA;
182:   Mat             A;
183:   PetscBool       t;
184:   PC              pc;

187:   data->KZ = data->real_KZ;
188:   data->size_KZ = data->size_cX = data->old_size_X = 0;
189:   data->lastTol = data->dynamic?0.5:0.0;

191:   /* Setup the ksp */
192:   if (data->ksp) {
193:     /* Create the reference vector */
194:     VecCreateCompWithVecs(d->V,data->ksp_max_size,NULL,&data->friends);
195:     PetscLogObjectParent(d->eps,data->friends);

197:     /* Save the current pc and set a PCNONE */
198:     KSPGetPC(data->ksp, &data->old_pc);
199:     PetscObjectTypeCompare((PetscObject)data->old_pc,PCNONE,&t);
200:     data->lastTol = 0.5;
201:     if (t) {
202:       data->old_pc = 0;
203:     } else {
204:       PetscObjectReference((PetscObject)data->old_pc);
205:       PCCreate(PetscObjectComm((PetscObject)d->eps),&pc);
206:       PCSetType(pc,PCSHELL);
207:       PCSetOperators(pc, d->A, d->A, SAME_PRECONDITIONER);
208:       PCShellSetApply(pc,PCApply_dvd);
209:       PCShellSetApplyBA(pc,PCApplyBA_dvd);
210:       PCShellSetApplyTranspose(pc,PCApplyTranspose_dvd);
211:       KSPSetPC(data->ksp,pc);
212:       PCDestroy(&pc);
213:     }

215:     /* Create the (I-v*u')*K*(A-s*B) matrix */
216:     MatGetSize(d->A, &rA, &cA);
217:     MatGetLocalSize(d->A, &rlA, &clA);
218:     MatCreateShell(PetscObjectComm((PetscObject)d->A), rlA*data->ksp_max_size,
219:                           clA*data->ksp_max_size, rA*data->ksp_max_size,
220:                           cA*data->ksp_max_size, data, &A);
221:     MatShellSetOperation(A, MATOP_MULT,(void(*)(void))MatMult_dvd_jd);
222:     MatShellSetOperation(A, MATOP_MULT_TRANSPOSE,(void(*)(void))MatMultTranspose_dvd_jd);
223:     MatShellSetOperation(A, MATOP_GET_VECS,(void(*)(void))MatGetVecs_dvd_jd);

225:     /* Try to avoid KSPReset */
226:     KSPGetOperatorsSet(data->ksp,&t,NULL);
227:     if (t) {
228:       Mat M;
229:       PetscInt rM;
230:       KSPGetOperators(data->ksp,&M,NULL,NULL);
231:       MatGetSize(M,&rM,NULL);
232:       if (rM != rA*data->ksp_max_size) { KSPReset(data->ksp); }
233:     }
234:     KSPSetOperators(data->ksp, A, A, SAME_PRECONDITIONER);
235:     KSPSetUp(data->ksp);
236:     MatDestroy(&A);
237:   } else {
238:     data->old_pc = 0;
239:     data->friends = NULL;
240:   }
241:   return(0);
242: }

246: PetscErrorCode dvd_improvex_jd_end(dvdDashboard *d)
247: {
248:   PetscErrorCode  ierr;
249:   dvdImprovex_jd  *data = (dvdImprovex_jd*)d->improveX_data;

252:   if (data->friends) { VecDestroy(&data->friends); }

254:   /* Restore the pc of ksp */
255:   if (data->old_pc) {
256:     KSPSetPC(data->ksp, data->old_pc);
257:     PCDestroy(&data->old_pc);
258:   }
259:   return(0);
260: }

264: PetscErrorCode dvd_improvex_jd_d(dvdDashboard *d)
265: {
266:   PetscErrorCode  ierr;
267:   dvdImprovex_jd  *data = (dvdImprovex_jd*)d->improveX_data;

270:   /* Restore changes in dvdDashboard */
271:   d->improveX_data = data->old_improveX_data;

273:   /* Free local data and objects */
274:   PetscFree(data);
275:   return(0);
276: }

280: PetscErrorCode dvd_improvex_jd_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D)
281: {
282:   dvdImprovex_jd  *data = (dvdImprovex_jd*)d->improveX_data;
283:   PetscErrorCode  ierr;
284:   PetscInt        i,j,n,maxits,maxits0,lits,s,ld,k;
285:   PetscScalar     *pX,*pY,*auxS = d->auxS,*auxS0;
286:   PetscReal       tol,tol0;
287:   Vec             *u,*v,*kr,kr_comp,D_comp;
288:   PetscBool       odd_situation = PETSC_FALSE;

291:   /* Quick exit */
292:   if ((max_size_D == 0) || r_e-r_s <= 0) {
293:    *size_D = 0;
294:    /* Callback old improveX */
295:     if (data->old_improveX) {
296:       d->improveX_data = data->old_improveX_data;
297:       data->old_improveX(d, NULL, 0, 0, 0, NULL);
298:       d->improveX_data = data;
299:     }
300:     return(0);
301:   }

303:   n = PetscMin(PetscMin(data->size_X, max_size_D), r_e-r_s);
304:   if (n == 0) SETERRQ(PETSC_COMM_SELF,1, "n == 0");
305:   if (data->size_X < r_e-r_s) SETERRQ(PETSC_COMM_SELF,1, "size_X < r_e-r_s");

307:   DSGetLeadingDimension(d->ps,&ld);

309:   /* Restart lastTol if a new pair converged */
310:   if (data->dynamic && data->size_cX < d->size_cX)
311:     data->lastTol = 0.5;

313:   for (i=0,s=0,auxS0=auxS;i<n;i+=s) {
314:     /* If the selected eigenvalue is complex, but the arithmetic is real... */
315: #if !defined(PETSC_USE_COMPLEX)
316:     if (d->eigi[i] != 0.0) {
317:       if (i+2 <= max_size_D) s=2;
318:       else break;
319:     } else
320: #endif
321:       s=1;

323:     data->auxV = d->auxV;
324:     data->r_s = r_s+i; data->r_e = r_s+i+s;
325:     auxS = auxS0;
326:     data->theta = auxS; auxS+= 2*s;
327:     data->thetai = auxS; auxS+= s;
328:     kr = data->auxV; data->auxV+= s;

330:     /* Compute theta, maximum iterations and tolerance */
331:     maxits = 0; tol = 1;
332:     for (j=0;j<s;j++) {
333:       d->improvex_jd_lit(d, r_s+i+j, &data->theta[2*j],
334:                                 &data->thetai[j], &maxits0, &tol0);
335:       maxits+= maxits0; tol*= tol0;
336:     }
337:     maxits/= s; tol = data->dynamic?data->lastTol:exp(log(tol)/s);

339:     /* Compute u, v and kr */
340:     k = r_s+i+d->cX_in_H;
341:     DSVectors(d->ps,DS_MAT_X,&k,NULL);
342:     DSNormalize(d->ps,DS_MAT_X,r_s+i+d->cX_in_H);
343:     k = r_s+i+d->cX_in_H;
344:     DSVectors(d->ps,DS_MAT_Y,&k,NULL);
345:     DSNormalize(d->ps,DS_MAT_Y,r_s+i+d->cX_in_H);
346:     DSGetArray(d->ps,DS_MAT_X,&pX);
347:     DSGetArray(d->ps,DS_MAT_Y,&pY);
348:     dvd_improvex_jd_proj_cuv(d,r_s+i,r_s+i+s,&u,&v,kr,&data->auxV,&auxS,data->theta,data->thetai,pX,pY,ld);
349:     DSRestoreArray(d->ps,DS_MAT_X,&pX);
350:     DSRestoreArray(d->ps,DS_MAT_Y,&pY);
351:     data->u = u;

353:     /* Check if the first eigenpairs are converged */
354:     if (i == 0) {
355:       PetscInt n_auxV = data->auxV-d->auxV+s, n_auxS = auxS - d->auxS;
356:       d->auxV+= n_auxV; d->size_auxV-= n_auxV;
357:       d->auxS+= n_auxS; d->size_auxS-= n_auxS;
358:       d->preTestConv(d,0,s,s,d->auxV-s,NULL,&d->npreconv);
359:       d->auxV-= n_auxV; d->size_auxV+= n_auxV;
360:       d->auxS-= n_auxS; d->size_auxS+= n_auxS;
361:       if (d->npreconv > 0) break;
362:     }

364:     /* Test the odd situation of solving Ax=b with A=I */
365: #if !defined(PETSC_USE_COMPLEX)
366:     odd_situation = (data->ksp && data->theta[0] == 1. && data->theta[1] == 0. && data->thetai[0] == 0. && d->B == NULL)?PETSC_TRUE:PETSC_FALSE;
367: #else
368:     odd_situation = (data->ksp && data->theta[0] == 1. && data->theta[1] == 0. && d->B == NULL)?PETSC_TRUE:PETSC_FALSE;
369: #endif
370:     /* If JD */
371:     if (data->ksp && !odd_situation) {
372:       data->auxS = auxS;

374:       /* kr <- -kr */
375:       for (j=0;j<s;j++) {
376:         VecScale(kr[j],-1.0);
377:       }

379:       /* Compose kr and D */
380:       VecCreateCompWithVecs(kr,data->ksp_max_size,data->friends,&kr_comp);
381:       VecCreateCompWithVecs(&D[i],data->ksp_max_size,data->friends,&D_comp);
382:       VecCompSetSubVecs(data->friends,s,NULL);

384:       /* Solve the correction equation */
385:       KSPSetTolerances(data->ksp,tol,PETSC_DEFAULT,PETSC_DEFAULT,maxits);
386:       KSPSolve(data->ksp,kr_comp,D_comp);
387:       KSPGetIterationNumber(data->ksp,&lits);
388:       d->eps->st->lineariterations+= lits;

390:       /* Destroy the composed ks and D */
391:       VecDestroy(&kr_comp);
392:       VecDestroy(&D_comp);

394:     /* If GD */
395:     } else {
396:       for (j=0;j<s;j++) {
397:         d->improvex_precond(d, r_s+i+j, kr[j], D[i+j]);
398:       }
399:       dvd_improvex_apply_proj(d, &D[i], s, auxS);
400:     }
401:     /* Prevent that short vectors are discarded in the orthogonalization */
402:     if (i == 0 && d->eps->errest[d->nconv+r_s] > PETSC_MACHINE_EPSILON && d->eps->errest[d->nconv+r_s] < PETSC_MAX_REAL) {
403:       for (j=0;j<s;j++) {
404:         VecScale(D[j],1.0/d->eps->errest[d->nconv+r_s]);
405:       }
406:     }
407:   }
408:   *size_D = i;
409:   if (data->dynamic) data->lastTol = PetscMax(data->lastTol/2.0,PETSC_MACHINE_EPSILON*10.0);

411:   /* Callback old improveX */
412:   if (data->old_improveX) {
413:     d->improveX_data = data->old_improveX_data;
414:     data->old_improveX(d, NULL, 0, 0, 0, NULL);
415:     d->improveX_data = data;
416:   }
417:   return(0);
418: }

420: /* y <- theta[1]A*x - theta[0]*B*x
421:    auxV, two auxiliary vectors */
424: PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmult(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV)
425: {
426:   PetscErrorCode  ierr;
427:   PetscInt        n,i;
428:   const Vec       *Bx;

431:   n = data->r_e - data->r_s;
432:   for (i=0;i<n;i++) {
433:     MatMult(data->d->A,x[i],y[i]);
434:   }

436:   for (i=0;i<n;i++) {
437: #if !defined(PETSC_USE_COMPLEX)
438:     if (data->d->eigi[data->r_s+i] != 0.0) {
439:       if (data->d->B) {
440:         MatMult(data->d->B,x[i],auxV[0]);
441:         MatMult(data->d->B,x[i+1],auxV[1]);
442:         Bx = auxV;
443:       } else Bx = &x[i];

445:       /* y_i   <- [ t_2i+1*A*x_i   - t_2i*Bx_i + ti_i*Bx_i+1;
446:          y_i+1      t_2i+1*A*x_i+1 - ti_i*Bx_i - t_2i*Bx_i+1  ] */
447:       VecAXPBYPCZ(y[i],-data->theta[2*i],data->thetai[i],data->theta[2*i+1],Bx[0],Bx[1]);
448:       VecAXPBYPCZ(y[i+1],-data->thetai[i],-data->theta[2*i],data->theta[2*i+1],Bx[0],Bx[1]);
449:       i++;
450:     } else
451: #endif
452:     {
453:       if (data->d->B) {
454:         MatMult(data->d->B,x[i],auxV[0]);
455:         Bx = auxV;
456:       } else Bx = &x[i];
457:       VecAXPBY(y[i],-data->theta[i*2],data->theta[i*2+1],Bx[0]);
458:     }
459:   }
460:   return(0);
461: }

463: /* y <- theta[1]'*A'*x - theta[0]'*B'*x
464:    auxV, two auxiliary vectors */
467: PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmulttrans(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV)
468: {
469:   PetscErrorCode  ierr;
470:   PetscInt        n,i;
471:   const Vec       *Bx;

474:   n = data->r_e - data->r_s;
475:   for (i=0;i<n;i++) {
476:     MatMultTranspose(data->d->A,x[i],y[i]);
477:   }

479:   for (i=0;i<n;i++) {
480: #if !defined(PETSC_USE_COMPLEX)
481:     if (data->d->eigi[data->r_s+i] != 0.0) {
482:       if (data->d->B) {
483:         MatMultTranspose(data->d->B,x[i],auxV[0]);
484:         MatMultTranspose(data->d->B,x[i+1],auxV[1]);
485:         Bx = auxV;
486:       } else Bx = &x[i];

488:       /* y_i   <- [ t_2i+1*A*x_i   - t_2i*Bx_i - ti_i*Bx_i+1;
489:          y_i+1      t_2i+1*A*x_i+1 + ti_i*Bx_i - t_2i*Bx_i+1  ] */
490:       VecAXPBYPCZ(y[i],-data->theta[2*i],-data->thetai[i],data->theta[2*i+1],Bx[0],Bx[1]);
491:       VecAXPBYPCZ(y[i+1],data->thetai[i],-data->theta[2*i],data->theta[2*i+1],Bx[0],Bx[1]);
492:       i++;
493:     } else
494: #endif
495:     {
496:       if (data->d->B) {
497:         MatMultTranspose(data->d->B,x[i],auxV[0]);
498:         Bx = auxV;
499:       } else Bx = &x[i];
500:       VecAXPBY(y[i],PetscConj(-data->theta[i*2]),PetscConj(data->theta[i*2+1]),Bx[0]);
501:     }
502:   }
503:   return(0);
504: }

508: PetscErrorCode PCApplyBA_dvd(PC pc,PCSide side,Vec in,Vec out,Vec w)
509: {
510:   PetscErrorCode  ierr;
511:   dvdImprovex_jd  *data;
512:   PetscInt        n,i;
513:   const Vec       *inx,*outx,*wx;
514:   Mat             A;

517:   PCGetOperators(pc,&A,NULL,NULL);
518:   MatShellGetContext(A,(void**)&data);
519:   VecCompGetSubVecs(in,NULL,&inx);
520:   VecCompGetSubVecs(out,NULL,&outx);
521:   VecCompGetSubVecs(w,NULL,&wx);
522:   n = data->r_e - data->r_s;

524:   /* Check auxiliary vectors */
525:   if (&data->auxV[n] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors");

527:   switch (side) {
528:   case PC_LEFT:
529:     /* aux <- theta[1]A*in - theta[0]*B*in */
530:     dvd_aux_matmult(data,inx,data->auxV,outx);

532:     /* out <- K * aux */
533:     for (i=0;i<n;i++) {
534:       data->d->improvex_precond(data->d,data->r_s+i,data->auxV[i],outx[i]);
535:     }
536:     break;
537:   case PC_RIGHT:
538:     /* aux <- K * in */
539:     for (i=0;i<n;i++) {
540:       data->d->improvex_precond(data->d,data->r_s+i,inx[i],data->auxV[i]);
541:     }

543:     /* out <- theta[1]A*auxV - theta[0]*B*auxV */
544:     dvd_aux_matmult(data,data->auxV,outx,wx);
545:     break;
546:   case PC_SYMMETRIC:
547:     /* aux <- K^{1/2} * in */
548:     for (i=0;i<n;i++) {
549:       PCApplySymmetricRight(data->old_pc,inx[i],data->auxV[i]);
550:     }

552:     /* out <- theta[1]A*auxV - theta[0]*B*auxV */
553:     dvd_aux_matmult(data,data->auxV,wx,outx);

555:     /* aux <- K^{1/2} * in */
556:     for (i=0;i<n;i++) {
557:       PCApplySymmetricLeft(data->old_pc,wx[i],outx[i]);
558:     }
559:     break;
560:   default:
561:     SETERRQ(PETSC_COMM_SELF,1, "Unsupported KSP side");
562:   }

564:   /* out <- out - v*(u'*out) */
565:   dvd_improvex_apply_proj(data->d,(Vec*)outx,n,data->auxS);
566:   return(0);
567: }

571: PetscErrorCode PCApply_dvd(PC pc,Vec in,Vec out)
572: {
573:   PetscErrorCode  ierr;
574:   dvdImprovex_jd  *data;
575:   PetscInt        n,i;
576:   const Vec       *inx, *outx;
577:   Mat             A;

580:   PCGetOperators(pc,&A,NULL,NULL);
581:   MatShellGetContext(A,(void**)&data);
582:   VecCompGetSubVecs(in,NULL,&inx);
583:   VecCompGetSubVecs(out,NULL,&outx);
584:   n = data->r_e - data->r_s;

586:   /* out <- K * in */
587:   for (i=0;i<n;i++) {
588:     data->d->improvex_precond(data->d,data->r_s+i,inx[i],outx[i]);
589:   }

591:   /* out <- out - v*(u'*out) */
592:   dvd_improvex_apply_proj(data->d,(Vec*)outx,n,data->auxS);
593:   return(0);
594: }

598: PetscErrorCode PCApplyTranspose_dvd(PC pc,Vec in,Vec out)
599: {
600:   PetscErrorCode  ierr;
601:   dvdImprovex_jd  *data;
602:   PetscInt        n,i;
603:   const Vec       *inx, *outx;
604:   Mat             A;

607:   PCGetOperators(pc,&A,NULL,NULL);
608:   MatShellGetContext(A,(void**)&data);
609:   VecCompGetSubVecs(in,NULL,&inx);
610:   VecCompGetSubVecs(out,NULL,&outx);
611:   n = data->r_e - data->r_s;

613:   /* Check auxiliary vectors */
614:   if (&data->auxV[n] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors");

616:   /* auxV <- in */
617:   for (i=0;i<n;i++) {
618:     VecCopy(inx[i],data->auxV[i]);
619:   }

621:   /* auxV <- auxV - u*(v'*auxV) */
622:   dvd_improvex_applytrans_proj(data->d,data->auxV,n,data->auxS);

624:   /* out <- K' * aux */
625:   for (i=0;i<n;i++) {
626:     PCApplyTranspose(data->old_pc,data->auxV[i],outx[i]);
627:   }
628:   return(0);
629: }

633: PetscErrorCode MatMult_dvd_jd(Mat A,Vec in,Vec out)
634: {
635:   PetscErrorCode  ierr;
636:   dvdImprovex_jd  *data;
637:   PetscInt        n;
638:   const Vec       *inx, *outx;
639:   PCSide          side;

642:   MatShellGetContext(A,(void**)&data);
643:   VecCompGetSubVecs(in,NULL,&inx);
644:   VecCompGetSubVecs(out,NULL,&outx);
645:   n = data->r_e - data->r_s;

647:   /* Check auxiliary vectors */
648:   if (&data->auxV[2] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors");

650:   /* out <- theta[1]A*in - theta[0]*B*in */
651:   dvd_aux_matmult(data,inx,outx,data->auxV);

653:   KSPGetPCSide(data->ksp,&side);
654:   if (side == PC_RIGHT) {
655:     /* out <- out - v*(u'*out) */
656:     dvd_improvex_apply_proj(data->d,(Vec*)outx,n,data->auxS);
657:   }
658:   return(0);
659: }

663: PetscErrorCode MatMultTranspose_dvd_jd(Mat A,Vec in,Vec out)
664: {
665:   PetscErrorCode  ierr;
666:   dvdImprovex_jd  *data;
667:   PetscInt        n,i;
668:   const Vec       *inx,*outx,*r,*auxV;
669:   PCSide          side;

672:   MatShellGetContext(A,(void**)&data);
673:   VecCompGetSubVecs(in,NULL,&inx);
674:   VecCompGetSubVecs(out,NULL,&outx);
675:   n = data->r_e - data->r_s;

677:   /* Check auxiliary vectors */
678:   if (&data->auxV[n+2] > data->d->auxV+data->d->size_auxV) SETERRQ(PETSC_COMM_SELF,1, "Insufficient auxiliary vectors");

680:   KSPGetPCSide(data->ksp,&side);
681:   if (side == PC_RIGHT) {
682:     /* auxV <- in */
683:     for (i=0;i<n;i++) {
684:       VecCopy(inx[i],data->auxV[i]);
685:     }

687:     /* auxV <- auxV - v*(u'*auxV) */
688:     dvd_improvex_applytrans_proj(data->d,data->auxV,n,data->auxS);
689:     r = data->auxV;
690:     auxV = data->auxV+n;
691:   } else {
692:     r = inx;
693:     auxV = data->auxV;
694:   }

696:   /* out <- theta[1]A*r - theta[0]*B*r */
697:   dvd_aux_matmulttrans(data,r,outx,auxV);
698:   return(0);
699: }

703: PetscErrorCode MatGetVecs_dvd_jd(Mat A,Vec *right,Vec *left)
704: {
705:   PetscErrorCode  ierr;
706:   Vec             *r, *l;
707:   dvdImprovex_jd  *data;
708:   PetscInt        n, i;

711:   MatShellGetContext(A, (void**)&data);
712:   n = data->ksp_max_size;
713:   if (right) {
714:     PetscMalloc(sizeof(Vec)*n, &r);
715:   }
716:   if (left) {
717:     PetscMalloc(sizeof(Vec)*n, &l);
718:   }
719:   for (i=0; i<n; i++) {
720:     MatGetVecs(data->d->A, right?&r[i]:NULL,left?&l[i]:NULL);
721:   }
722:   if (right) {
723:     VecCreateCompWithVecs(r, n, data->friends, right);
724:     for (i=0; i<n; i++) {
725:       VecDestroy(&r[i]);
726:     }
727:   }
728:   if (left) {
729:     VecCreateCompWithVecs(l, n, data->friends, left);
730:     for (i=0; i<n; i++) {
731:       VecDestroy(&l[i]);
732:     }
733:   }

735:   if (right) {
736:     PetscFree(r);
737:   }
738:   if (left) {
739:     PetscFree(l);
740:   }
741:   return(0);
742: }

746: PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d,dvdBlackboard *b,ProjType_t p)
747: {
749:   /* Setup the step */
750:   if (b->state >= DVD_STATE_CONF) {
751:     switch (p) {
752:     case DVD_PROJ_KXX:
753:       d->improvex_jd_proj_uv = dvd_improvex_jd_proj_uv_KXX; break;
754:     case DVD_PROJ_KZX:
755:       d->improvex_jd_proj_uv = dvd_improvex_jd_proj_uv_KZX; break;
756:     }
757:   }
758:   return(0);
759: }

763: /*
764:   Compute: u <- X, v <- K*(theta[0]*A+theta[1]*B)*X,
765:   kr <- K^{-1}*(A-eig*B)*X, being X <- V*pX[i_s..i_e-1], Y <- W*pY[i_s..i_e-1]
766:   where
767:   auxV, 4*(i_e-i_s) auxiliar global vectors
768:   pX,pY, the right and left eigenvectors of the projected system
769:   ld, the leading dimension of pX and pY
770:   auxS: max(8*bs*max_cX_in_proj,size_V*size_V)
771: */
772: PetscErrorCode dvd_improvex_jd_proj_cuv(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec **u,Vec **v,Vec *kr,Vec **auxV,PetscScalar **auxS,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld)
773: {
774: #if defined(PETSC_MISSING_LAPACK_GETRF)
776:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF - Lapack routine is unavailable");
777: #else
778:   PetscErrorCode    ierr;
779:   PetscInt          n = i_e - i_s, size_KZ, V_new, rm, i, size_in;
780:   dvdImprovex_jd    *data = (dvdImprovex_jd*)d->improveX_data;
781:   PetscBLASInt      s, ldXKZ, info;
782:   DvdReduction      r;
783:   DvdReductionChunk ops[2];
784:   DvdMult_copy_func sr[2];

787:   /* Check consistency */
788:   V_new = d->size_cX - data->size_cX;
789:   if (V_new > data->old_size_X) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
790:   data->old_size_X = n;

792:   /* KZ <- KZ(rm:rm+max_cX-1) */
793:   rm = PetscMax(V_new+data->size_KZ-d->max_cX_in_impr, 0);
794:   for (i=0; i<d->max_cX_in_impr; i++) {
795:     VecCopy(data->KZ[i+rm], data->KZ[i]);
796:   }
797:   data->size_cX = d->size_cX;

799:   /* XKZ <- XKZ(rm:rm+max_cX-1,rm:rm+max_cX-1) */
800:   for (i=0; i<d->max_cX_in_impr; i++) {
801:     SlepcDenseCopy(&data->XKZ[i*data->ldXKZ+i], data->ldXKZ, &data->XKZ[(i+rm)*data->ldXKZ+i+rm], data->ldXKZ, data->size_KZ, 1);
802:   }
803:   data->size_KZ = PetscMin(d->max_cX_in_impr, data->size_KZ+V_new);

805:   /* Compute X, KZ and KR */
806:   *u = *auxV; *auxV+= n;
807:   *v = &data->KZ[data->size_KZ];
808:   d->improvex_jd_proj_uv(d, i_s, i_e, *u, *v, kr, *auxV, theta, thetai,
809:                                 pX, pY, ld);

811:   /* XKZ <- X'*KZ */
812:   size_KZ = data->size_KZ+n;
813:   size_in = 2*n*data->size_KZ+n*n;
814:   SlepcAllReduceSumBegin(ops,2,*auxS,*auxS+size_in,size_in,&r,PetscObjectComm((PetscObject)d->V[0]));
815:   VecsMultS(data->XKZ,0,data->ldXKZ,d->V-data->size_KZ,0,data->size_KZ,data->KZ,data->size_KZ,size_KZ,&r,&sr[0]);
816:   VecsMultS(&data->XKZ[data->size_KZ],0,data->ldXKZ,*u,0,n,data->KZ,0,size_KZ,&r,&sr[1]);
817:   SlepcAllReduceSumEnd(&r);

819:   /* iXKZ <- inv(XKZ) */
820:   PetscBLASIntCast(size_KZ,&s);
821:   data->ldiXKZ = data->size_iXKZ = size_KZ;
822:   data->iXKZ = *auxS; *auxS+= size_KZ*size_KZ;
823:   data->iXKZPivots = (PetscBLASInt*)*auxS;
824:   *auxS += FromIntToScalar(size_KZ);
825:   SlepcDenseCopy(data->iXKZ,data->ldiXKZ,data->XKZ,data->ldXKZ,size_KZ,size_KZ);
826:   PetscBLASIntCast(data->ldiXKZ,&ldXKZ);
827:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
828:   PetscStackCallBLAS("LAPACKgetrf",LAPACKgetrf_(&s, &s, data->iXKZ, &ldXKZ, data->iXKZPivots, &info));
829:   PetscFPTrapPop();
830:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "Error in Lapack XGETRF %d", info);
831:   return(0);
832: #endif
833: }

835: #define DVD_COMPLEX_RAYLEIGH_QUOTIENT(ur,ui,Axr,Axi,Bxr,Bxi,eigr,eigi,b,ierr)\
836: { \
837:   VecDot((Axr), (ur), &(b)[0]); /* r*A*r */ \
838:   VecDot((Axr), (ui), &(b)[1]); /* i*A*r */ \
839:   VecDot((Axi), (ur), &(b)[2]); /* r*A*i */ \
840:   VecDot((Axi), (ui), &(b)[3]); /* i*A*i */ \
841:   VecDot((Bxr), (ur), &(b)[4]); /* r*B*r */ \
842:   VecDot((Bxr), (ui), &(b)[5]); /* i*B*r */ \
843:   VecDot((Bxi), (ur), &(b)[6]); /* r*B*i */ \
844:   VecDot((Bxi), (ui), &(b)[7]); /* i*B*i */ \
845:   (b)[0]  = (b)[0]+(b)[3]; /* rAr+iAi */ \
846:   (b)[2] =  (b)[2]-(b)[1]; /* rAi-iAr */ \
847:   (b)[4] = (b)[4]+(b)[7]; /* rBr+iBi */ \
848:   (b)[6] = (b)[6]-(b)[5]; /* rBi-iBr */ \
849:   (b)[7] = (b)[4]*(b)[4] + (b)[6]*(b)[6]; /* k */ \
850:   *(eigr) = ((b)[0]*(b)[4] + (b)[2]*(b)[6]) / (b)[7]; /* eig_r */ \
851:   *(eigi) = ((b)[2]*(b)[4] - (b)[0]*(b)[6]) / (b)[7]; /* eig_i */ \
852: }

854: #if !defined(PETSC_USE_COMPLEX)
855: #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \
856:   for ((i)=0; (i)<(n); (i)++) { \
857:     if ((eigi)[(i_s)+(i)] != 0.0) { \
858:       /* eig_r = [(rAr+iAi)*(rBr+iBi) + (rAi-iAr)*(rBi-iBr)]/k \
859:          eig_i = [(rAi-iAr)*(rBr+iBi) - (rAr+iAi)*(rBi-iBr)]/k \
860:          k     =  (rBr+iBi)*(rBr+iBi) + (rBi-iBr)*(rBi-iBr)    */ \
861:       DVD_COMPLEX_RAYLEIGH_QUOTIENT((u)[(i)], (u)[(i)+1], (Ax)[(i)], \
862:         (Ax)[(i)+1], (Bx)[(i)], (Bx)[(i)+1], &(b)[8], &(b)[9], (b), (ierr)); \
863:       if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[8])/ \
864:             PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10    || \
865:           PetscAbsScalar((eigi)[(i_s)+(i)] - (b)[9])/ \
866:             PetscAbsScalar((eigi)[(i_s)+(i)]) > 1e-10) { \
867:         (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its "\
868:                             "Rayleigh quotient value %G+%G\n", \
869:                             (eigr)[(i_s)+(i)], \
870:                             (eigi)[(i_s)+(i)], (b)[8], (b)[9]); \
871:       } \
872:       (i)++; \
873:     } \
874:   }
875: #else
876: #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \
877:   for ((i)=0; (i)<(n); (i)++) { \
878:       (ierr) = VecDot((Ax)[(i)], (u)[(i)], &(b)[0]); \
879:       (ierr) = VecDot((Bx)[(i)], (u)[(i)], &(b)[1]); \
880:       (b)[0] = (b)[0]/(b)[1]; \
881:       if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[0])/ \
882:             PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10) { \
883:         (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its " \
884:                "Rayleigh quotient value %G+%G\n", \
885:                PetscRealPart((eigr)[(i_s)+(i)]), \
886:                PetscImaginaryPart((eigr)[(i_s)+(i)]), PetscRealPart((b)[0]), \
887:                PetscImaginaryPart((b)[0])); \
888:       } \
889:     }
890: #endif

894: /*
895:   Compute: u <- X, v <- K*(theta[0]*A+theta[1]*B)*X,
896:   kr <- K^{-1}*(A-eig*B)*X, being X <- V*pX[i_s..i_e-1], Y <- W*pY[i_s..i_e-1]
897:   where
898:   auxV, 4*(i_e-i_s) auxiliar global vectors
899:   pX,pY, the right and left eigenvectors of the projected system
900:   ld, the leading dimension of pX and pY
901: */
902: PetscErrorCode dvd_improvex_jd_proj_uv_KZX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld)
903: {
904:   PetscErrorCode  ierr;
905:   PetscInt        n = i_e - i_s, i;
906:   PetscScalar     b[16];
907:   Vec             *Ax, *Bx, *r=auxV, X[4];
908:   /* The memory manager doen't allow to call a subroutines */
909:   PetscScalar     Z[size_Z];

912:   /* u <- X(i) */
913:   dvd_improvex_compute_X(d,i_s,i_e,u,pX,ld);

915:   /* v <- theta[0]A*u + theta[1]*B*u */

917:   /* Bx <- B*X(i) */
918:   Bx = kr;
919:   if (d->BV) {
920:     SlepcUpdateVectorsZ(Bx, 0.0, 1.0, d->BV-d->cX_in_H, d->size_BV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);
921:   } else {
922:     for (i=0;i<n;i++) {
923:       if (d->B) {
924:         MatMult(d->B, u[i], Bx[i]);
925:       } else {
926:         VecCopy(u[i], Bx[i]);
927:       }
928:     }
929:   }

931:   /* Ax <- A*X(i) */
932:   Ax = r;
933:   SlepcUpdateVectorsZ(Ax, 0.0, 1.0, d->AV-d->cX_in_H, d->size_AV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);

935:   /* v <- Y(i) */
936:   SlepcUpdateVectorsZ(v, 0.0, 1.0, (d->W?d->W:d->V)-d->cX_in_H, d->size_V+d->cX_in_H, &pY[ld*i_s], ld, d->size_H, n);

938:   /* Recompute the eigenvalue */
939:   DVD_COMPUTE_N_RR(d->eps, i, i_s, n, d->eigr, d->eigi, v, Ax, Bx, b, ierr);

941:   for (i=0;i<n;i++) {
942: #if !defined(PETSC_USE_COMPLEX)
943:     if (d->eigi[i_s+i] != 0.0) {
944:       /* [r_i r_i+1 kr_i kr_i+1]*= [ theta_2i'    0            1        0
945:                                        0         theta_2i'     0        1
946:                                      theta_2i+1 -thetai_i   -eigr_i -eigi_i
947:                                      thetai_i    theta_2i+1  eigi_i -eigr_i ] */
948:       b[0] = b[5] = PetscConj(theta[2*i]);
949:       b[2] = b[7] = -theta[2*i+1];
950:       b[6] = -(b[3] = thetai[i]);
951:       b[1] = b[4] = 0.0;
952:       b[8] = b[13] = 1.0/d->nX[i_s+i];
953:       b[10] = b[15] = -d->eigr[i_s+i]/d->nX[i_s+i];
954:       b[14] = -(b[11] = d->eigi[i_s+i]/d->nX[i_s+i]);
955:       b[9] = b[12] = 0.0;
956:       X[0] = Ax[i]; X[1] = Ax[i+1]; X[2] = Bx[i]; X[3] = Bx[i+1];
957:       SlepcUpdateVectorsD(X, 4, 1.0, b, 4, 4, 4, Z, size_Z);
958:       i++;
959:     } else
960: #endif
961:     {
962:       /* [Ax_i Bx_i]*= [ theta_2i'    1/nX_i
963:                         theta_2i+1  -eig_i/nX_i ] */
964:       b[0] = PetscConj(theta[i*2]);
965:       b[1] = theta[i*2+1];
966:       b[2] = 1.0/d->nX[i_s+i];
967:       b[3] = -d->eigr[i_s+i]/d->nX[i_s+i];
968:       X[0] = Ax[i]; X[1] = Bx[i];
969:       SlepcUpdateVectorsD(X, 2, 1.0, b, 2, 2, 2, Z, size_Z);
970:     }
971:   }
972:   for (i=0; i<n; i++) d->nX[i_s+i] = 1.0;

974:   /* v <- K^{-1} r = K^{-1}(theta_2i'*Ax + theta_2i+1*Bx) */
975:   for (i=0;i<n;i++) {
976:     d->improvex_precond(d, i_s+i, r[i], v[i]);
977:   }

979:   /* kr <- P*(Ax - eig_i*Bx) */
980:   d->calcpairs_proj_res(d, i_s, i_e, kr);
981:   return(0);
982: }

986: /*
987:   Compute: u <- K^{-1}*X, v <- X,
988:   kr <- K^{-1}*(A-eig*B)*X, being X <- V*pX[i_s..i_e-1]
989:   where
990:   auxV, 4*(i_e-i_s) auxiliar global vectors
991:   pX,pY, the right and left eigenvectors of the projected system
992:   ld, the leading dimension of pX and pY
993: */
994: PetscErrorCode dvd_improvex_jd_proj_uv_KXX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld)
995: {
996:   PetscErrorCode  ierr;
997:   PetscInt        n = i_e - i_s, i;
998:   PetscScalar     b[16];
999:   Vec             *Ax, *Bx, *r = auxV, X[4];
1000:   /* The memory manager doen't allow to call a subroutines */
1001:   PetscScalar     Z[size_Z];

1004:   /* [v u] <- X(i) Y(i) */
1005:   dvd_improvex_compute_X(d,i_s,i_e,v,pX,ld);
1006:   SlepcUpdateVectorsZ(u, 0.0, 1.0, (d->W?d->W:d->V)-d->cX_in_H, d->size_V+d->cX_in_H, &pY[ld*i_s], ld, d->size_H, n);

1008:   /* Bx <- B*X(i) */
1009:   Bx = r;
1010:   if (d->BV) {
1011:     SlepcUpdateVectorsZ(Bx, 0.0, 1.0, d->BV-d->cX_in_H, d->size_BV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);
1012:   } else {
1013:     if (d->B) {
1014:       for (i=0;i<n;i++) {
1015:         MatMult(d->B, v[i], Bx[i]);
1016:       }
1017:     } else Bx = v;
1018:   }

1020:   /* Ax <- A*X(i) */
1021:   Ax = kr;
1022:   SlepcUpdateVectorsZ(Ax, 0.0, 1.0, d->AV-d->cX_in_H, d->size_AV+d->cX_in_H, &pX[ld*i_s], ld, d->size_H, n);

1024:   /* Recompute the eigenvalue */
1025:   DVD_COMPUTE_N_RR(d->eps, i, i_s, n, d->eigr, d->eigi, u, Ax, Bx, b, ierr);

1027:   for (i=0;i<n;i++) {
1028:     if (d->eigi[i_s+i] == 0.0) {
1029:       /* kr <- Ax -eig*Bx */
1030:       VecAXPBY(kr[i], -d->eigr[i_s+i]/d->nX[i_s+i], 1.0/d->nX[i_s+i], Bx[i]);
1031:     } else {
1032:       /* [kr_i kr_i+1 r_i r_i+1]*= [   1        0
1033:                                        0        1
1034:                                     -eigr_i -eigi_i
1035:                                      eigi_i -eigr_i] */
1036:       b[0] = b[5] = 1.0/d->nX[i_s+i];
1037:       b[2] = b[7] = -d->eigr[i_s+i]/d->nX[i_s+i];
1038:       b[6] = -(b[3] = d->eigi[i_s+i]/d->nX[i_s+i]);
1039:       b[1] = b[4] = 0.0;
1040:       X[0] = kr[i]; X[1] = kr[i+1]; X[2] = r[i]; X[3] = r[i+1];
1041:       SlepcUpdateVectorsD(X, 4, 1.0, b, 4, 4, 2, Z, size_Z);
1042:       i++;
1043:     }
1044:   }
1045:   for (i=0; i<n; i++) d->nX[i_s+i] = 1.0;

1047:   /* kr <- P*kr */
1048:   d->calcpairs_proj_res(d, i_s, i_e, r);

1050:   /* u <- K^{-1} X(i) */
1051:   for (i=0;i<n;i++) {
1052:     d->improvex_precond(d, i_s+i, v[i], u[i]);
1053:   }
1054:   return(0);
1055: }

1059: PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d,dvdBlackboard *b,PetscInt maxits,PetscReal tol,PetscReal fix)
1060: {
1061:   dvdImprovex_jd  *data = (dvdImprovex_jd*)d->improveX_data;

1064:   /* Setup the step */
1065:   if (b->state >= DVD_STATE_CONF) {
1066:     data->maxits = maxits;
1067:     data->tol = tol;
1068:     data->fix = fix;
1069:     d->improvex_jd_lit = dvd_improvex_jd_lit_const_0;
1070:   }
1071:   return(0);
1072: }

1076: PetscErrorCode dvd_improvex_jd_lit_const_0(dvdDashboard *d,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol)
1077: {
1078:   dvdImprovex_jd  *data = (dvdImprovex_jd*)d->improveX_data;
1079:   PetscReal       a;

1082:   a = SlepcAbsEigenvalue(d->eigr[i],d->eigi[i]);

1084:   if (d->nR[i]/a < data->fix) {
1085:     theta[0] = d->eigr[i];
1086:     theta[1] = 1.0;
1087: #if !defined(PETSC_USE_COMPLEX)
1088:     *thetai = d->eigi[i];
1089: #endif
1090:   } else {
1091:     theta[0] = d->target[0];
1092:     theta[1] = d->target[1];
1093: #if !defined(PETSC_USE_COMPLEX)
1094:     *thetai = 0.0;
1095: #endif
1096: }

1098: #if defined(PETSC_USE_COMPLEX)
1099:   if (thetai) *thetai = 0.0;
1100: #endif
1101:   *maxits = data->maxits;
1102:   *tol = data->tol;
1103:   return(0);
1104: }

1106: /**** Patterns implementation *************************************************/

1108: typedef PetscInt (*funcV0_t)(dvdDashboard*,PetscInt,PetscInt,Vec*);
1109: typedef PetscInt (*funcV1_t)(dvdDashboard*,PetscInt,PetscInt,Vec*,PetscScalar*,Vec);

1113: /* Compute D <- K^{-1} * funcV[r_s..r_e] */
1114: PetscErrorCode dvd_improvex_PfuncV(dvdDashboard *d,void *funcV,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,Vec *auxV,PetscScalar *auxS)
1115: {
1116:   PetscErrorCode  ierr;
1117:   PetscInt        i;

1120:   if (max_size_D >= r_e-r_s+1) {
1121:     /* The optimized version needs one vector extra of D */
1122:     /* D(1:r.size) = R(r_s:r_e-1) */
1123:     if (auxS) ((funcV1_t)funcV)(d, r_s, r_e, D+1, auxS, auxV[0]);
1124:     else      ((funcV0_t)funcV)(d, r_s, r_e, D+1);

1126:     /* D = K^{-1} * R */
1127:     for (i=0; i<r_e-r_s; i++) {
1128:       d->improvex_precond(d, i+r_s, D[i+1], D[i]);
1129:     }
1130:   } else if (max_size_D == r_e-r_s) {
1131:     /* Non-optimized version */
1132:     /* auxV <- R[r_e-1] */
1133:     if (auxS) ((funcV1_t)funcV)(d, r_e-1, r_e, auxV, auxS, auxV[1]);
1134:     else      ((funcV0_t)funcV)(d, r_e-1, r_e, auxV);

1136:     /* D(1:r.size-1) = R(r_s:r_e-2) */
1137:     if (auxS) ((funcV1_t)funcV)(d, r_s, r_e-1, D+1, auxS, auxV[1]);
1138:     else      ((funcV0_t)funcV)(d, r_s, r_e-1, D+1);

1140:     /* D = K^{-1} * R */
1141:     for (i=0; i<r_e-r_s-1; i++) {
1142:       d->improvex_precond(d, i+r_s, D[i+1], D[i]);
1143:     }
1144:     d->improvex_precond(d, r_e-1, auxV[0], D[r_e-r_s-1]);
1145:   } else SETERRQ(PETSC_COMM_SELF,1, "Problem: r_e-r_s > max_size_D");
1146:   return(0);
1147: }

1151: /* Compute (I - KZ*iXKZ*X')*V where,
1152:    V, the vectors to apply the projector,
1153:    cV, the number of vectors in V,
1154:    auxS, auxiliar vector of size length 3*size_iXKZ*cV
1155: */
1156: PetscErrorCode dvd_improvex_apply_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS)
1157: {
1158: #if defined(PETSC_MISSING_LAPACK_GETRS)
1160:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRS - Lapack routines are unavailable");
1161: #else
1162:   PetscErrorCode    ierr;
1163:   dvdImprovex_jd    *data = (dvdImprovex_jd*)d->improveX_data;
1164:   PetscInt          size_in = data->size_iXKZ*cV, i, ldh;
1165:   PetscScalar       *h, *in, *out;
1166:   PetscBLASInt      cV_, n, info, ld;
1167:   DvdReduction      r;
1168:   DvdReductionChunk ops[4];
1169:   DvdMult_copy_func sr[4];

1172:   if (cV > 2) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

1174:   /* h <- X'*V */
1175:   h = auxS; in = h+size_in; out = in+size_in; ldh = data->size_iXKZ;
1176:   SlepcAllReduceSumBegin(ops, 4, in, out, size_in, &r,
1177:                                 PetscObjectComm((PetscObject)d->V[0]));
1178:   for (i=0; i<cV; i++) {
1179:     VecsMultS(&h[i*ldh],0,ldh,d->V-data->size_KZ,0,data->size_KZ,V+i,0,1,&r,&sr[i*2]);
1180:     VecsMultS(&h[i*ldh+data->size_KZ],0,ldh,data->u,0,data->size_iXKZ-data->size_KZ,V+i,0,1,&r,&sr[i*2+1]);
1181:   }
1182:   SlepcAllReduceSumEnd(&r);

1184:   /* h <- iXKZ\h */
1185:   PetscBLASIntCast(cV,&cV_);
1186:   PetscBLASIntCast(data->size_iXKZ,&n);
1187:   PetscBLASIntCast(data->ldiXKZ,&ld);
1189:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
1190:   PetscStackCallBLAS("LAPACKgetrs",LAPACKgetrs_("N", &n, &cV_, data->iXKZ, &ld, data->iXKZPivots, h, &n, &info));
1191:   PetscFPTrapPop();
1192:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "Error in Lapack XGETRS %d", info);

1194:   /* V <- V - KZ*h */
1195:   for (i=0; i<cV; i++) {
1196:     SlepcUpdateVectorsZ(V+i,1.0,-1.0,data->KZ,data->size_iXKZ,&h[ldh*i],ldh,data->size_iXKZ,1);
1197:   }
1198:   return(0);
1199: #endif
1200: }

1204: /* Compute (I - X*iXKZ*KZ')*V where,
1205:    V, the vectors to apply the projector,
1206:    cV, the number of vectors in V,
1207:    auxS, auxiliar vector of size length 3*size_iXKZ*cV
1208: */
1209: PetscErrorCode dvd_improvex_applytrans_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS)
1210: {
1211: #if defined(PETSC_MISSING_LAPACK_GETRS)
1213:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRS - Lapack routines are unavailable");
1214: #else
1215:   PetscErrorCode    ierr;
1216:   dvdImprovex_jd    *data = (dvdImprovex_jd*)d->improveX_data;
1217:   PetscInt          size_in = data->size_iXKZ*cV, i, ldh;
1218:   PetscScalar       *h, *in, *out;
1219:   PetscBLASInt      cV_, n, info, ld;
1220:   DvdReduction      r;
1221:   DvdReductionChunk ops[2];
1222:   DvdMult_copy_func sr[2];

1225:   if (cV > 2) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

1227:   /* h <- KZ'*V */
1228:   h = auxS; in = h+size_in; out = in+size_in; ldh = data->size_iXKZ;
1229:   SlepcAllReduceSumBegin(ops, 2, in, out, size_in, &r,
1230:                                 PetscObjectComm((PetscObject)d->V[0]));
1231:   for (i=0; i<cV; i++) {
1232:     VecsMultS(&h[i*ldh],0,ldh,data->KZ,0,data->size_KZ,V+i,0,1,&r,&sr[i]);
1233:   }
1234:   SlepcAllReduceSumEnd(&r);

1236:   /* h <- iXKZ\h */
1237:   PetscBLASIntCast(cV,&cV_);
1238:   PetscBLASIntCast(data->size_iXKZ,&n);
1239:   PetscBLASIntCast(data->ldiXKZ,&ld);
1241:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
1242:   PetscStackCallBLAS("LAPACKgetrs",LAPACKgetrs_("C", &n, &cV_, data->iXKZ, &ld, data->iXKZPivots, h, &n, &info));
1243:   PetscFPTrapPop();
1244:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "Error in Lapack XGETRS %d", info);

1246:   /* V <- V - X*h */
1247:   for (i=0; i<cV; i++) {
1248:     SlepcUpdateVectorsZ(V+i,1.0,-1.0,d->V-data->size_KZ,data->size_KZ,&h[ldh*i],ldh,data->size_KZ,1);
1249:     SlepcUpdateVectorsZ(V+i,1.0,-1.0,data->u,data->size_iXKZ-data->size_KZ,&h[ldh*i+data->size_KZ],ldh,data->size_iXKZ-data->size_KZ,1);
1250:   }
1251:   return(0);
1252: #endif
1253: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_blas.c.html0000644000175000017500000023330312211062077024125 0ustar gladkgladk
Actual source code: dvd_blas.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/vecimplslepc.h>
 23:  #include davidson.h

 25: PetscLogEvent SLEPC_SlepcDenseMatProd = 0;
 26: PetscLogEvent SLEPC_SlepcDenseNorm = 0;
 27: PetscLogEvent SLEPC_SlepcDenseCopy = 0;
 28: PetscLogEvent SLEPC_VecsMult = 0;

 30: void dvd_sum_local(void *in,void *out,PetscMPIInt *cnt,MPI_Datatype *t);
 31: PetscErrorCode VecsMultS_copy_func(PetscScalar *out,PetscInt size_out,void *ptr);

 35: /*
 36:   Compute C <- a*A*B + b*C, where
 37:     ldC, the leading dimension of C,
 38:     ldA, the leading dimension of A,
 39:     rA, cA, rows and columns of A,
 40:     At, if true use the transpose of A instead,
 41:     ldB, the leading dimension of B,
 42:     rB, cB, rows and columns of B,
 43:     Bt, if true use the transpose of B instead
 44: */
 45: PetscErrorCode SlepcDenseMatProd(PetscScalar *C,PetscInt _ldC,PetscScalar b,PetscScalar a,const PetscScalar *A,PetscInt _ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,PetscInt _ldB,PetscInt rB,PetscInt cB,PetscBool Bt)
 46: {
 47:   PetscErrorCode  ierr;
 48:   PetscInt        tmp;
 49:   PetscBLASInt    m, n, k, ldA = _ldA, ldB = _ldB, ldC = _ldC;
 50:   const char      *N = "N", *T = "C", *qA = N, *qB = N;

 53:   if ((rA == 0) || (cB == 0)) return(0);

 58:   PetscLogEventBegin(SLEPC_SlepcDenseMatProd,0,0,0,0);

 60:   /* Transpose if needed */
 61:   if (At) tmp = rA, rA = cA, cA = tmp, qA = T;
 62:   if (Bt) tmp = rB, rB = cB, cB = tmp, qB = T;

 64:   /* Check size */
 65:   if (cA != rB) SETERRQ(PETSC_COMM_SELF,1, "Matrix dimensions do not match");

 67:   /* Do stub */
 68:   if ((rA == 1) && (cA == 1) && (cB == 1)) {
 69:     if (!At && !Bt) *C = *A * *B;
 70:     else if (At && !Bt) *C = PetscConj(*A) * *B;
 71:     else if (!At && Bt) *C = *A * PetscConj(*B);
 72:     else *C = PetscConj(*A) * PetscConj(*B);
 73:     m = n = k = 1;
 74:   } else {
 75:     m = rA; n = cB; k = cA;
 76:     PetscStackCallBLAS("BLASgemm",BLASgemm_(qA,qB,&m,&n,&k,&a,(PetscScalar*)A,&ldA,(PetscScalar*)B,&ldB,&b,C,&ldC));
 77:   }

 79:   PetscLogFlops(m*n*2*k);
 80:   PetscLogEventEnd(SLEPC_SlepcDenseMatProd,0,0,0,0);
 81:   return(0);
 82: }

 86: /*
 87:   Compute C <- A*B, where
 88:     sC, structure of C,
 89:     ldC, the leading dimension of C,
 90:     sA, structure of A,
 91:     ldA, the leading dimension of A,
 92:     rA, cA, rows and columns of A,
 93:     At, if true use the transpose of A instead,
 94:     sB, structure of B,
 95:     ldB, the leading dimension of B,
 96:     rB, cB, rows and columns of B,
 97:     Bt, if true use the transpose of B instead
 98: */
 99: PetscErrorCode SlepcDenseMatProdTriang(PetscScalar *C,MatType_t sC,PetscInt ldC,const PetscScalar *A,MatType_t sA,PetscInt ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,MatType_t sB,PetscInt ldB,PetscInt rB,PetscInt cB,PetscBool Bt)
100: {
101:   PetscErrorCode  ierr;
102:   PetscInt        tmp;
103:   PetscScalar     one=1.0, zero=0.0;
104:   PetscBLASInt    rC, cC, _ldA = ldA, _ldB = ldB, _ldC = ldC;

107:   if ((rA == 0) || (cB == 0)) return(0);

112:   /* Transpose if needed */
113:   if (At) tmp = rA, rA = cA, cA = tmp;
114:   if (Bt) tmp = rB, rB = cB, cB = tmp;

116:   /* Check size */
117:   if (cA != rB) SETERRQ(PETSC_COMM_SELF,1, "Matrix dimensions do not match");
118:   if (sB != 0) SETERRQ(PETSC_COMM_SELF,1, "Matrix type not supported for B");

120:   /* Optimized version: trivial case */
121:   if ((rA == 1) && (cA == 1) && (cB == 1)) {
122:     if (!At && !Bt)     *C = *A * *B;
123:     else if (At && !Bt) *C = PetscConj(*A) * *B;
124:     else if (!At && Bt) *C = *A * PetscConj(*B);
125:     else if (At && Bt)  *C = PetscConj(*A) * PetscConj(*B);
126:     return(0);
127:   }

129:   /* Optimized versions: sA == 0 && sB == 0 */
130:   if ((sA == 0) && (sB == 0)) {
131:     if (At) tmp = rA, rA = cA, cA = tmp;
132:     if (Bt) tmp = rB, rB = cB, cB = tmp;
133:     SlepcDenseMatProd(C, ldC, 0.0, 1.0, A, ldA, rA, cA, At, B, ldB, rB, cB, Bt);
134:     return(0);
135:   }

137:   /* Optimized versions: A hermitian && (B not triang) */
138:   if (DVD_IS(sA,DVD_MAT_HERMITIAN) &&
139:       DVD_ISNOT(sB,DVD_MAT_UTRIANG) &&
140:       DVD_ISNOT(sB,DVD_MAT_LTRIANG)) {
141:     PetscLogEventBegin(SLEPC_SlepcDenseMatProd,0,0,0,0);
142:     rC = rA; cC = cB;
143:     PetscStackCallBLAS("BLASsymm",BLASsymm_("L",DVD_ISNOT(sA,DVD_MAT_LTRIANG)?"U":"L",&rC,&cC,&one,(PetscScalar*)A,&_ldA,(PetscScalar*)B,&_ldB,&zero,C,&_ldC));
144:     PetscLogFlops(rA*cB*cA);
145:     PetscLogEventEnd(SLEPC_SlepcDenseMatProd,0,0,0,0);
146:     return(0);
147:   }

149:   /* Optimized versions: B hermitian && (A not triang) */
150:   if (DVD_IS(sB,DVD_MAT_HERMITIAN) &&
151:       DVD_ISNOT(sA,DVD_MAT_UTRIANG) &&
152:       DVD_ISNOT(sA,DVD_MAT_LTRIANG)) {
153:     PetscLogEventBegin(SLEPC_SlepcDenseMatProd,0,0,0,0);
154:     rC = rA; cC = cB;
155:     PetscStackCallBLAS("BLASsymm",BLASsymm_("R",DVD_ISNOT(sB,DVD_MAT_LTRIANG)?"U":"L",&rC,&cC,&one,(PetscScalar*)B,&_ldB,(PetscScalar*)A,&_ldA,&zero,C,&_ldC));
156:     PetscLogFlops(rA*cB*cA);
157:     PetscLogEventEnd(SLEPC_SlepcDenseMatProd,0,0,0,0);
158:     return(0);
159:   }

161:   SETERRQ(PETSC_COMM_SELF,1, "Matrix type not supported for A");
162: }

166: /*
167:   Normalize the columns of the matrix A, where
168:     ldA, the leading dimension of A,
169:     rA, cA, rows and columns of A.
170:   if eigi is given, the pairs of contiguous columns i i+1 such as eigi[i] != 0
171:   are normalized as being one column.
172: */
173: PetscErrorCode SlepcDenseNorm(PetscScalar *A,PetscInt ldA,PetscInt _rA,PetscInt cA,PetscScalar *eigi)
174: {
175:   PetscErrorCode  ierr;
176:   PetscInt        i;
177:   PetscScalar     norm, norm0;
178:   PetscBLASInt    rA = _rA, one=1;


184:   PetscLogEventBegin(SLEPC_SlepcDenseNorm,0,0,0,0);

186:   for (i=0;i<cA;i++) {
187:     if (eigi && eigi[i] != 0.0) {
188:       norm = BLASnrm2_(&rA, &A[i*ldA], &one);
189:       norm0 = BLASnrm2_(&rA, &A[(i+1)*ldA], &one);
190:       norm = 1.0/PetscSqrtScalar(norm*norm + norm0*norm0);
191:       PetscStackCallBLAS("BLASscal",BLASscal_(&rA, &norm, &A[i*ldA], &one));
192:       PetscStackCallBLAS("BLASscal",BLASscal_(&rA, &norm, &A[(i+1)*ldA], &one));
193:       i++;
194:     } else {
195:       norm = BLASnrm2_(&rA, &A[i*ldA], &one);
196:       norm = 1.0 / norm;
197:       PetscStackCallBLAS("BLASscal",BLASscal_(&rA, &norm, &A[i*ldA], &one));
198:     }
199:   }

201:   PetscLogEventEnd(SLEPC_SlepcDenseNorm,0,0,0,0);
202:   return(0);
203: }

207: /*
208:   Y <- X, where
209:   ldX, leading dimension of X,
210:   rX, cX, rows and columns of X
211:   ldY, leading dimension of Y
212: */
213: PetscErrorCode SlepcDenseCopy(PetscScalar *Y,PetscInt ldY,PetscScalar *X,PetscInt ldX,PetscInt rX,PetscInt cX)
214: {
215:   PetscErrorCode  ierr;
216:   PetscInt        i;


222:   if ((ldX < rX) || (ldY < rX)) SETERRQ(PETSC_COMM_SELF,1, "Leading dimension error");

224:   /* Quick exit */
225:   if (Y == X) {
226:     if (ldX != ldY) SETERRQ(PETSC_COMM_SELF,1, "Leading dimension error");
227:     return(0);
228:   }

230:   PetscLogEventBegin(SLEPC_SlepcDenseCopy,0,0,0,0);
231:   for (i=0;i<cX;i++) {
232:     PetscMemcpy(&Y[ldY*i], &X[ldX*i], sizeof(PetscScalar)*rX);
233:   }
234:   PetscLogEventEnd(SLEPC_SlepcDenseCopy,0,0,0,0);
235:   return(0);
236: }

240: /*
241:   Y <- X, where
242:   ldX, leading dimension of X,
243:   rX, cX, rows and columns of X
244:   ldY, leading dimension of Y
245: */
246: PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y,MatType_t sY,PetscInt ldY,PetscScalar *X,MatType_t sX,PetscInt ldX,PetscInt rX,PetscInt cX)
247: {
248:   PetscErrorCode  ierr;
249:   PetscInt        i,j,c;


255:   if ((ldX < rX) || (ldY < rX)) SETERRQ(PETSC_COMM_SELF,1, "Leading dimension error");

257:   if (sY == 0 && sX == 0) {
258:     SlepcDenseCopy(Y, ldY, X, ldX, rX, cX);
259:     return(0);
260:   }

262:   if (rX != cX) SETERRQ(PETSC_COMM_SELF,1, "Rectangular matrices not supported");

264:   if (DVD_IS(sX,DVD_MAT_UTRIANG) &&
265:       DVD_ISNOT(sX,DVD_MAT_LTRIANG)) {        /* UpTr to ... */
266:     if (DVD_IS(sY,DVD_MAT_UTRIANG) &&
267:         DVD_ISNOT(sY,DVD_MAT_LTRIANG))        /* ... UpTr, */
268:       c = 0;                                      /*     so copy */
269:     else if (DVD_ISNOT(sY,DVD_MAT_UTRIANG) &&
270:              DVD_IS(sY,DVD_MAT_LTRIANG))       /* ... LoTr, */
271:       c = 1;                                      /*     so transpose */
272:     else                                          /* ... Full, */
273:       c = 2;                                      /*     so reflect from up */
274:   } else if (DVD_ISNOT(sX,DVD_MAT_UTRIANG) &&
275:              DVD_IS(sX,DVD_MAT_LTRIANG)) {    /* LoTr to ... */
276:     if (DVD_IS(sY,DVD_MAT_UTRIANG) &&
277:         DVD_ISNOT(sY,DVD_MAT_LTRIANG))        /* ... UpTr, */
278:       c = 1;                                      /*     so transpose */
279:     else if (DVD_ISNOT(sY,DVD_MAT_UTRIANG) &&
280:              DVD_IS(sY,DVD_MAT_LTRIANG))       /* ... LoTr, */
281:       c = 0;                                      /*     so copy */
282:     else                                          /* ... Full, */
283:       c = 3;                                      /*     so reflect fr. down */
284:   } else                                          /* Full to any, */
285:     c = 0;                                        /*     so copy */

287:   PetscLogEventBegin(SLEPC_SlepcDenseCopy,0,0,0,0);

289:   switch (c) {
290:   case 0: /* copy */
291:     for (i=0;i<cX;i++) {
292:       PetscMemcpy(&Y[ldY*i],&X[ldX*i],sizeof(PetscScalar)*rX);
293:     }
294:     break;

296:   case 1: /* transpose */
297:     for (i=0;i<cX;i++)
298:       for (j=0;j<rX;j++)
299:         Y[ldY*j+i] = PetscConj(X[ldX*i+j]);
300:     break;

302:   case 2: /* reflection from up */
303:     for (i=0;i<cX;i++)
304:       for (j=0;j<PetscMin(i+1,rX);j++)
305:         Y[ldY*j+i] = PetscConj(Y[ldY*i+j] = X[ldX*i+j]);
306:     break;

308:   case 3: /* reflection from down */
309:     for (i=0;i<cX;i++)
310:       for (j=i;j<rX;j++)
311:         Y[ldY*j+i] = PetscConj(Y[ldY*i+j] = X[ldX*i+j]);
312:     break;
313:   }
314:   PetscLogEventEnd(SLEPC_SlepcDenseCopy,0,0,0,0);
315:   return(0);
316: }

320: /*
321:   Compute Y[0..cM-1] <- alpha * X[0..cX-1] * M + beta * Y[0..cM-1],
322:   where X and Y are contiguous global vectors.
323: */
324: PetscErrorCode SlepcUpdateVectorsZ(Vec *Y,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM)
325: {
326:   PetscErrorCode  ierr;

329:   SlepcUpdateVectorsS(Y,1,beta,alpha,X,cX,1,M,ldM,rM,cM);
330:   return(0);
331: }

335: /*
336:   Compute Y[0:dY:cM*dY-1] <- alpha * X[0:dX:cX-1] * M + beta * Y[0:dY:cM*dY-1],
337:   where X and Y are contiguous global vectors.
338: */
339: PetscErrorCode SlepcUpdateVectorsS(Vec *Y,PetscInt dY,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,PetscInt dX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM)
340: {
341:   PetscErrorCode    ierr;
342:   const PetscScalar *px;
343:   PetscScalar       *py;
344:   PetscInt          rX, rY, ldX, ldY, i, rcX;

347:   SlepcValidVecsContiguous(Y,cM*dY,1);
348:   SlepcValidVecsContiguous(X,cX,5);

351:   /* Compute the real number of columns */
352:   rcX = cX/dX;
353:   if (rcX != rM) SETERRQ(PetscObjectComm((PetscObject)*Y),1, "Matrix dimensions do not match");

355:   if ((rcX == 0) || (rM == 0) || (cM == 0)) return(0);
356:   else if ((Y + cM <= X) || (X + cX <= Y) ||
357:              ((X != Y) && ((PetscMax(dX,dY))%(PetscMin(dX,dY))!=0))) {
358:     /* If Y[0..cM-1] and X[0..cX-1] are not overlapped... */

360:     /* Get the dense matrices and dimensions associated to Y and X */
361:     VecGetLocalSize(X[0], &rX);
362:     VecGetLocalSize(Y[0], &rY);
363:     if (rX != rY) SETERRQ(PetscObjectComm((PetscObject)*Y),1, "The multivectors do not have the same dimension");
364:     VecGetArrayRead(X[0], &px);
365:     VecGetArray(Y[0], &py);

367:     /* Update the strides */
368:     ldX = rX*dX; ldY= rY*dY;

370:     /* Do operation */
371:     SlepcDenseMatProd(py, ldY, beta, alpha, px, ldX, rX, rcX,
372:                     PETSC_FALSE, M, ldM, rM, cM, PETSC_FALSE);

374:     VecRestoreArrayRead(X[0], &px);
375:     VecRestoreArray(Y[0], &py);
376:     for (i=1;i<cM;i++) {
377:       PetscObjectStateIncrease((PetscObject)Y[dY*i]);
378:     }

380:   } else if ((Y >= X) && (beta == 0.0) && (dY == dX)) {
381:     /* If not, call to SlepcUpdateVectors */
382:     SlepcUpdateStrideVectors(cX, X, Y-X, dX, Y-X+cM*dX, M-ldM*(Y-X),
383:                                     ldM, PETSC_FALSE);
384:     if (alpha != 1.0)
385:       for (i=0;i<cM;i++) {
386:         VecScale(Y[i],alpha);
387:       }
388:   } else SETERRQ(PetscObjectComm((PetscObject)*Y),1, "Unsupported case");
389:   return(0);
390: }

394: /*
395:   Compute X <- alpha * X[0:dX:cX-1] * M
396:   where X is a matrix with non-consecutive columns
397: */
398: PetscErrorCode SlepcUpdateVectorsD(Vec *X,PetscInt cX,PetscScalar alpha,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *work,PetscInt lwork)
399: {
401:   PetscScalar    **px, *Y, *Z;
402:   PetscInt       rX, i, j, rY, rY0, ldY;

405:   SlepcValidVecsContiguous(X,cX,1);

409:   if (cX != rM) SETERRQ(PetscObjectComm((PetscObject)*X),1, "Matrix dimensions do not match");

411:   rY = (lwork/2)/cX;
412:   if (rY <= 0) SETERRQ(PetscObjectComm((PetscObject)*X),1, "Insufficient work space given");
413:   Y = work; Z = &Y[cX*rY]; ldY = rY;

415:   if ((cX == 0) || (rM == 0) || (cM == 0)) return(0);

417:   /* Get the dense vectors associated to the columns of X */
418:   PetscMalloc(sizeof(Vec)*cX,&px);
419:   for (i=0;i<cX;i++) {
420:     VecGetArray(X[i],&px[i]);
421:   }
422:   VecGetLocalSize(X[0],&rX);

424:   for (i=0,rY0=0;i<rX;i+=rY0) {
425:     rY0 = PetscMin(rY, rX-i);

427:     /* Y <- X[i0:i1,:] */
428:     for (j=0;j<cX;j++) {
429:       SlepcDenseCopy(&Y[ldY*j], ldY, px[j]+i, rX, rY0, 1);
430:     }

432:     /* Z <- Y * M */
433:     SlepcDenseMatProd(Z, ldY, 0.0, alpha, Y, ldY, rY0, cX, PETSC_FALSE,
434:                                                  M, ldM, rM, cM, PETSC_FALSE);

436:     /* X <- Z */
437:     for (j=0;j<cM;j++) {
438:       SlepcDenseCopy(px[j]+i, rX, &Z[j*ldY], ldY, rY0, 1);
439:     }
440:   }

442:   for (i=0;i<cX;i++) {
443:     VecRestoreArray(X[i],&px[i]);
444:   }
445:   PetscFree(px);
446:   return(0);
447: }

451: /* Computes M <- [ M(0:sU-1,  0:sV-1) W(0:sU-1,  sV:eV-1) ]
452:                  [ W(sU:eU-1, 0:sV-1) W(sU:eU-1, sV:eV-1) ]
453:   where W = U' * V.
454:   workS0 and workS1 are an auxiliary scalar vector of size
455:   (eU-sU)*sV*(sU!=0)+(eV-sV)*eU. But, if sU == 0, sV == 0 and eU == ldM, only workS0
456:   is needed, and of size eU*eV.
457: */
458: PetscErrorCode VecsMult(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,PetscScalar *workS0,PetscScalar *workS1)
459: {
460:   PetscErrorCode    ierr;
461:   PetscInt          ldU, ldV, i, j, k, ms = (eU-sU)*sV*(sU==0?0:1)+(eV-sV)*eU;
462:   const PetscScalar *pu, *pv;
463:   PetscScalar       *W, *Wr;

466:   /* Check if quick exit */
467:   if ((eU-sU == 0) || (eV-sV == 0)) return(0);

469:   SlepcValidVecsContiguous(U,eU,4);
470:   SlepcValidVecsContiguous(V,eV,7);

473:   /* Get the dense matrices and dimensions associated to U and V */
474:   VecGetLocalSize(U[0], &ldU);
475:   VecGetLocalSize(V[0], &ldV);
476:   if (ldU != ldV) SETERRQ(PetscObjectComm((PetscObject)*U),1, "Matrix dimensions do not match");
477:   VecGetArrayRead(U[0], &pu);
478:   VecGetArrayRead(V[0], &pv);

480:   if (workS0) {
482:     W = workS0;
483:   } else {
484:     PetscMalloc(sizeof(PetscScalar)*ms,&W);
485:   }

487:   PetscLogEventBegin(SLEPC_VecsMult,0,0,0,0);

489:   if ((sU == 0) && (sV == 0) && (eU == ldM)) {
490:     /* Use the smart memory usage version */

492:     /* W <- U' * V */
493:     SlepcDenseMatProdTriang(W, sM, eU,
494:                                    pu, 0, ldU, ldU, eU, PETSC_TRUE,
495:                                    pv, 0, ldV, ldV, eV, PETSC_FALSE);

497:     /* ReduceAll(W, SUM) */
498:     MPI_Allreduce(W, M, eU*eV, MPIU_SCALAR, MPIU_SUM,
499:                          PetscObjectComm((PetscObject)U[0]));
500:   /* Full M matrix */
501:   } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) &&
502:              DVD_ISNOT(sM,DVD_MAT_LTRIANG)) {
503:     if (workS1) {
505:       Wr = workS1;
506:       if (PetscAbs(PetscMin(W-workS1, workS1-W)) < ms) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
507:     } else {
508:       PetscMalloc(sizeof(PetscScalar)*ms,&Wr);
509:     }

511:     /* W(0:(eU-sU)*sV-1) <- U(sU:eU-1)' * V(0:sV-1) */
512:     if (sU > 0) {
513:       SlepcDenseMatProd(W, eU-sU, 0.0, 1.0,
514:                                pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE,
515:                                pv       , ldV, ldV, sV,    PETSC_FALSE);
516:     }

518:     /* W((eU-sU)*sV:(eU-sU)*sV+(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */
519:     SlepcDenseMatProd(W+(eU-sU)*sV*(sU > 0?1:0), eU, 0.0, 1.0,
520:                              pu,        ldU, ldU, eU,    PETSC_TRUE,
521:                              pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);

523:     /* ReduceAll(W, SUM) */
524:     MPI_Allreduce(W, Wr, ms, MPIU_SCALAR,
525:                       MPIU_SUM, PetscObjectComm((PetscObject)U[0]));

527:     /* M(...,...) <- W */
528:     k = 0;
529:     if (sU > 0) for (i=0; i<sV; i++)
530:       for (j=ldM*i+sU; j<ldM*i+eU; j++,k++) M[j] = Wr[k];
531:     for (i=sV; i<eV; i++)
532:       for (j=ldM*i; j<ldM*i+eU; j++,k++) M[j] = Wr[k];

534:     if (!workS1) {
535:       PetscFree(Wr);
536:     }

538:   /* Upper triangular M matrix */
539:   } else if (DVD_IS(sM,DVD_MAT_UTRIANG) &&
540:              DVD_ISNOT(sM,DVD_MAT_LTRIANG)) {
541:     if (workS1) {
543:       Wr = workS1;
544:       if (PetscAbs(PetscMin(W-workS1,workS1-W)) < (eV-sV)*eU) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
545:     } else {
546:       PetscMalloc(sizeof(PetscScalar)*(eV-sV)*eU,&Wr);
547:     }

549:     /* W(0:(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */
550:     SlepcDenseMatProd(W,         eU,  0.0, 1.0,
551:                              pu,        ldU, ldU, eU,    PETSC_TRUE,
552:                              pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);

554:     /* ReduceAll(W, SUM) */
555:     MPI_Allreduce(W, Wr, (eV-sV)*eU, MPIU_SCALAR, MPIU_SUM,
556:                          PetscObjectComm((PetscObject)U[0]));

558:     /* M(...,...) <- W */
559:     for (i=sV,k=0; i<eV; i++)
560:         for (j=ldM*i; j<ldM*i+eU; j++,k++) M[j] = Wr[k];

562:     if (!workS1) {
563:       PetscFree(Wr);
564:     }

566:   /* Lower triangular M matrix */
567:   } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) &&
568:              DVD_IS(sM,DVD_MAT_LTRIANG)) {
569:     if (workS1) {
571:       Wr = workS1;
572:       if (PetscMin(W - workS1, workS1 - W) < (eU-sU)*eV) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
573:     } else {
574:       PetscMalloc(sizeof(PetscScalar)*(eU-sU)*eV, &Wr);
575:     }

577:     /* W(0:(eU-sU)*eV-1) <- U(sU:eU-1)' * V(0:eV-1) */
578:     SlepcDenseMatProd(W, eU-sU, 0.0, 1.0,
579:                              pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE,
580:                              pv       , ldV, ldV, eV,    PETSC_FALSE);

582:     /* ReduceAll(W, SUM) */
583:     MPI_Allreduce(W, Wr, (eU-sU)*eV, MPIU_SCALAR, MPIU_SUM,
584:                          PetscObjectComm((PetscObject)U[0]));

586:     /* M(...,...) <- W */
587:     for (i=0,k=0; i<eV; i++)
588:       for (j=ldM*i+sU; j<ldM*i+eU; j++,k++) M[j] = Wr[k];

590:     if (!workS1) {
591:       PetscFree(Wr);
592:     }
593:   }

595:   PetscLogEventEnd(SLEPC_VecsMult,0,0,0,0);

597:   if (!workS0) {
598:     PetscFree(W);
599:   }

601:   VecRestoreArrayRead(U[0],&pu);
602:   VecRestoreArrayRead(V[0],&pv);
603:   return(0);
604: }

608: /* Computes M <- [ M(0:sU-1,  0:sV-1) W(0:sU-1,  sV:eV-1) ]
609:                  [ W(sU:eU-1, 0:sV-1) W(sU:eU-1, sV:eV-1) ]
610:   where W = local_U' * local_V. Needs VecsMultIb for completing the operation!
611:   workS0 and workS1 are an auxiliary scalar vector of size
612:   (eU-sU)*sV+(eV-sV)*eU. But, if sU == 0, sV == 0 and eU == ldM, only workS0
613:   is needed, and of size eU*eV.
614: */
615: PetscErrorCode VecsMultIa(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV)
616: {
617:   PetscErrorCode  ierr;
618:   PetscInt        ldU, ldV;
619:   PetscScalar     *pu, *pv;

622:   /* Check if quick exit */
623:   if ((eU-sU == 0) || (eV-sV == 0)) return(0);

625:   SlepcValidVecsContiguous(U,eU,4);
626:   SlepcValidVecsContiguous(V,eV,7);

629:   /* Get the dense matrices and dimensions associated to U and V */
630:   VecGetLocalSize(U[0],&ldU);
631:   VecGetLocalSize(V[0],&ldV);
632:   if (ldU != ldV) SETERRQ(PetscObjectComm((PetscObject)*U),1, "Matrix dimensions do not match");
633:   VecGetArray(U[0],&pu);
634:   VecGetArray(V[0],&pv);

636:   if ((sU == 0) && (sV == 0) && (eU == ldM)) {
637:     /* M <- local_U' * local_V */
638:     SlepcDenseMatProdTriang(M, sM, eU,
639:                                    pu, 0, ldU, ldU, eU, PETSC_TRUE,
640:                                    pv, 0, ldV, ldV, eV, PETSC_FALSE);

642:   /* Full M matrix */
643:   } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) &&
644:              DVD_ISNOT(sM,DVD_MAT_LTRIANG)) {
645:     /* M(sU:eU-1,0:sV-1) <- U(sU:eU-1)' * V(0:sV-1) */
646:     SlepcDenseMatProd(&M[sU], ldM, 0.0, 1.0,
647:                              pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE,
648:                              pv       , ldV, ldV, sV,    PETSC_FALSE);

650:     /* M(0:eU-1,sV:eV-1) <- U(0:eU-1)' * V(sV:eV-1) */
651:     SlepcDenseMatProd(&M[ldM*sV], ldM, 0.0, 1.0,
652:                              pu,        ldU, ldU, eU,    PETSC_TRUE,
653:                              pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);

655:   /* Other structures */
656:   } else SETERRQ(PetscObjectComm((PetscObject)*U),1, "Matrix structure not supported");

658:   VecRestoreArray(U[0],&pu);
659:   PetscObjectStateDecrease((PetscObject)U[0]);
660:   VecRestoreArray(V[0],&pv);
661:   PetscObjectStateDecrease((PetscObject)V[0]);
662:   return(0);
663: }

667: /* Computes M <- nprocs*M
668:   where nprocs is the number of processors.
669: */
670: PetscErrorCode VecsMultIc(PetscScalar *M,MatType_t sM,PetscInt ldM,PetscInt rM,PetscInt cM,Vec V)
671: {
672:   PetscInt    i,j;
673:   PetscMPIInt n;

676:   /* Check if quick exit */
677:   if ((rM == 0) || (cM == 0)) return(0);

680:   if (sM != 0) SETERRQ(PetscObjectComm((PetscObject)V),1, "Matrix structure not supported");

682:   MPI_Comm_size(PetscObjectComm((PetscObject)V), &n);

684:   for (i=0;i<cM;i++)
685:     for (j=0;j<rM;j++)
686:       M[ldM*i+j] /= (PetscScalar)n;
687:   return(0);
688: }

692: /* Computes N <- Allreduce([ M(0:sU-1,  0:sV-1) W(0:sU-1,  sV:eV-1) ])
693:                           ([ W(sU:eU-1, 0:sV-1) W(sU:eU-1, sV:eV-1) ])
694:   where W = U' * V.
695:   workS0 and workS1 are an auxiliary scalar vector of size
696:   (eU-sU)*sV+(eV-sV)*eU. But, if sU == 0, sV == 0 and eU == ldM, only workS0
697:   is needed, and of size eU*eV.
698: */
699: PetscErrorCode VecsMultIb(PetscScalar *M,MatType_t sM,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *auxS,Vec V)
700: {
702:   PetscScalar    *W, *Wr;

705:   /* Check if quick exit */
706:   if ((rM == 0) || (cM == 0)) return(0);

709:   if (auxS) {
711:     W = auxS;
712:   } else {
713:     PetscMalloc(sizeof(PetscScalar)*rM*cM*2,&W);
714:   }
715:   Wr = W + rM*cM;

717:   PetscLogEventBegin(SLEPC_VecsMult,0,0,0,0);

719:   if (sM == 0) {
720:     /* W <- M */
721:     SlepcDenseCopy(W, rM, M, ldM, rM, cM);

723:     /* Wr <- ReduceAll(W, SUM) */
724:     MPI_Allreduce(W, Wr, rM*cM, MPIU_SCALAR, MPIU_SUM,
725:                          PetscObjectComm((PetscObject)V));

727:     /* M <- Wr */
728:     SlepcDenseCopy(M, ldM, Wr, rM, rM, cM);

730:   /* Other structures */
731:   } else SETERRQ(PetscObjectComm((PetscObject)V),1, "Matrix structure not supported");

733:   PetscLogEventEnd(SLEPC_VecsMult,0,0,0,0);

735:   if (!auxS) {
736:     PetscFree(W);
737:   }
738:   return(0);
739: }

743: /* Computes M <- [ M(0:sU-1,  0:sV-1) W(0:sU-1,  sV:eV-1) ]
744:                  [ W(sU:eU-1, 0:sV-1) W(sU:eU-1, sV:eV-1) ]
745:   where W = U' * V.
746:   r, a DvdReduction structure,
747:   sr, an structure DvdMult_copy_func.
748: */
749: PetscErrorCode VecsMultS(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,DvdReduction *r,DvdMult_copy_func *sr)
750: {
751:   PetscErrorCode    ierr;
752:   PetscInt          ldU, ldV, ms = (eU-sU)*sV*(sU==0?0:1)+(eV-sV)*eU;
753:   const PetscScalar *pu, *pv;
754:   PetscScalar       *W;

757:   /* Check if quick exit */
758:   if ((eU-sU == 0) || (eV-sV == 0)) return(0);

760:   SlepcValidVecsContiguous(U,eU,4);
761:   SlepcValidVecsContiguous(V,eV,7);

764:   /* Get the dense matrices and dimensions associated to U and V */
765:   VecGetLocalSize(U[0],&ldU);
766:   VecGetLocalSize(V[0],&ldV);
767:   if (ldU != ldV) SETERRQ(PetscObjectComm((PetscObject)*U),1, "Matrix dimensions do not match");
768:   VecGetArrayRead(U[0],&pu);
769:   VecGetArrayRead(V[0],&pv);

771:   PetscLogEventBegin(SLEPC_VecsMult,0,0,0,0);

773:   if ((sU == 0) && (sV == 0)) {
774:     /* Use the smart memory usage version */

776:     /* Add the reduction to r */
777:     SlepcAllReduceSum(r, eU*eV, VecsMultS_copy_func, sr, &W);

779:     /* W <- U' * V */
780:     SlepcDenseMatProdTriang(W, sM, eU,
781:                                    pu, 0, ldU, ldU, eU, PETSC_TRUE,
782:                                    pv, 0, ldV, ldV, eV, PETSC_FALSE);

784:     /* M <- ReduceAll(W, SUM) */
785:     sr->M = M;    sr->ld = ldM;
786:     sr->i0 = 0;   sr->i1 = eV;    sr->s0 = sU;    sr->e0 = eU;
787:                   sr->i2 = eV;

789:   /* Full M matrix */
790:   } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) &&
791:              DVD_ISNOT(sM,DVD_MAT_LTRIANG)) {
792:     /* Add the reduction to r */
793:     SlepcAllReduceSum(r, ms, VecsMultS_copy_func, sr, &W);

795:     /* W(0:(eU-sU)*sV-1) <- U(sU:eU-1)' * V(0:sV-1) */
796:     SlepcDenseMatProd(W, eU-sU, 0.0, 1.0,
797:                              pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE,
798:                              pv       , ldV, ldV, sV,    PETSC_FALSE);

800:     /* W((eU-sU)*sV:(eU-sU)*sV+(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */
801:     SlepcDenseMatProd(W+(eU-sU)*sV*(sU > 0?1:0), eU, 0.0, 1.0,
802:                              pu,        ldU, ldU, eU,    PETSC_TRUE,
803:                              pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);

805:     /* M <- ReduceAll(W, SUM) */
806:     sr->M = M;            sr->ld = ldM;
807:     sr->i0 = sU>0?0:sV;   sr->i1 = sV;    sr->s0 = sU;    sr->e0 = eU;
808:                           sr->i2 = eV;    sr->s1 = 0;     sr->e1 = eU;

810:   /* Upper triangular M matrix */
811:   } else if (DVD_IS(sM,DVD_MAT_UTRIANG) &&
812:              DVD_ISNOT(sM,DVD_MAT_LTRIANG)) {
813:     /* Add the reduction to r */
814:     SlepcAllReduceSum(r, (eV-sV)*eU, VecsMultS_copy_func, sr, &W);

816:     /* W(0:(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */
817:     SlepcDenseMatProd(W,         eU,  0.0, 1.0,
818:                              pu,        ldU, ldU, eU,    PETSC_TRUE,
819:                              pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);

821:     /* M <- ReduceAll(W, SUM) */
822:     sr->M = M;    sr->ld = ldM;
823:     sr->i0 = sV;  sr->i1 = eV;    sr->s0 = 0;     sr->e0 = eU;
824:                   sr->i2 = eV;

826:   /* Lower triangular M matrix */
827:   } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) &&
828:              DVD_IS(sM,DVD_MAT_LTRIANG)) {
829:     /* Add the reduction to r */
830:     SlepcAllReduceSum(r, (eU-sU)*eV, VecsMultS_copy_func, sr, &W);

832:     /* W(0:(eU-sU)*eV-1) <- U(sU:eU-1)' * V(0:eV-1) */
833:     SlepcDenseMatProd(W, eU-sU, 0.0, 1.0,
834:                              pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE,
835:                              pv       , ldV, ldV, eV,    PETSC_FALSE);

837:     /* ReduceAll(W, SUM) */
838:     sr->M = M;    sr->ld = ldM;
839:     sr->i0 = 0;   sr->i1 = eV;    sr->s0 = sU;    sr->e0 = eU;
840:                   sr->i2 = eV;
841:   }

843:   PetscLogEventEnd(SLEPC_VecsMult,0,0,0,0);

845:   VecRestoreArrayRead(U[0],&pu);
846:   VecRestoreArrayRead(V[0],&pv);
847:   return(0);
848: }

852: PetscErrorCode VecsMultS_copy_func(PetscScalar *out,PetscInt size_out,void *ptr)
853: {
854:   PetscInt          i, j, k;
855:   DvdMult_copy_func *sr = (DvdMult_copy_func*)ptr;


860:   for (i=sr->i0,k=0; i<sr->i1; i++)
861:     for (j=sr->ld*i+sr->s0; j<sr->ld*i+sr->e0; j++,k++) sr->M[j] = out[k];
862:   for (i=sr->i1; i<sr->i2; i++)
863:     for (j=sr->ld*i+sr->s1; j<sr->ld*i+sr->e1; j++,k++) sr->M[j] = out[k];

865:   if (k != size_out) SETERRQ(PETSC_COMM_SELF,1, "Wrong size");
866:   return(0);
867: }

871: /* Orthonormalize a chunk of parallel vector.
872:    NOTE: wS0 and wS1 must be of size n*n.
873: */
874: PetscErrorCode VecsOrthonormalize(Vec *V,PetscInt n,PetscScalar *wS0,PetscScalar *wS1)
875: {
876: #if defined(PETSC_MISSING_LAPACK_PBTRF)
878:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"PBTRF - Lapack routine is unavailable");
879: #else
880:   PetscErrorCode  ierr;
881:   PetscBLASInt    nn = n, info, ld;
882:   PetscInt        ldV, i;
883:   PetscScalar     *H, *T, one=1.0, *pv;

886:   if (!wS0) {
887:     PetscMalloc(sizeof(PetscScalar)*n*n,&H);
888:   } else {
890:     H = wS0;
891:   }
892:   if (!wS1) {
893:     PetscMalloc(sizeof(PetscScalar)*n*n,&T);
894:   } else {
896:     T = wS1;
897:   }

899:   /* H <- V' * V */
900:   VecsMult(H, 0, n, V, 0, n, V, 0, n, T, NULL);

902:   /* H <- chol(H) */
903:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
904:   PetscStackCallBLAS("LAPACKpbtrf",LAPACKpbtrf_("U", &nn, &nn, H, &nn, &info));
905:   PetscFPTrapPop();
906:   if (info) SETERRQ1(PetscObjectComm((PetscObject)*V),PETSC_ERR_LIB, "Error in Lapack PBTRF %d", info);

908:   /* V <- V * inv(H) */
909:   VecGetLocalSize(V[0],&ldV);
910:   VecGetArray(V[0],&pv);
911:   ld = ldV;
912:   PetscStackCallBLAS("BLAStrsm",BLAStrsm_("R", "U", "N", "N", &ld, &nn, &one, H, &nn, pv, &ld));
913:   VecRestoreArray(V[0],&pv);
914:   for (i=1;i<n;i++) {
915:     PetscObjectStateIncrease((PetscObject)V[i]);
916:   }

918:   if (!wS0) {
919:     PetscFree(H);
920:   }
921:   if (!wS1) {
922:     PetscFree(T);
923:   }
924:   return(0);
925: #endif
926: }

930: /*
931:   Sum up several arrays with only one call to MPIReduce.
932: */
933: PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,PetscInt max_size_ops,PetscScalar *in,PetscScalar *out,PetscInt max_size_in,DvdReduction *r,MPI_Comm comm)
934: {

939:   r->in = in;
940:   r->out = out;
941:   r->size_in = 0;
942:   r->max_size_in = max_size_in;
943:   r->ops = ops;
944:   r->size_ops = 0;
945:   r->max_size_ops = max_size_ops;
946:   r->comm = comm;
947:   return(0);
948: }

952: PetscErrorCode SlepcAllReduceSum(DvdReduction *r,PetscInt size_in,DvdReductionPostF f,void *ptr,PetscScalar **in)
953: {
955:   *in = r->in + r->size_in;
956:   r->ops[r->size_ops].out = r->out + r->size_in;
957:   r->ops[r->size_ops].size_out = size_in;
958:   r->ops[r->size_ops].f = f;
959:   r->ops[r->size_ops].ptr = ptr;
960:   if (++(r->size_ops) > r->max_size_ops) SETERRQ(PETSC_COMM_SELF,1, "max_size_ops is not large enough");
961:   if ((r->size_in+= size_in) > r->max_size_in) SETERRQ(PETSC_COMM_SELF,1, "max_size_in is not large enough");
962:   return(0);
963: }

967: PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r)
968: {
969:   PetscErrorCode  ierr;
970:   PetscInt        i;

973:   /* Check if quick exit */
974:   if (r->size_ops == 0) return(0);

976:   /* Call the MPIAllReduce routine */
977:   MPI_Allreduce(r->in, r->out, r->size_in, MPIU_SCALAR, MPIU_SUM, r->comm);

979:   /* Call the postponed routines */
980:   for (i=0;i<r->size_ops;i++) {
981:     r->ops[i].f(r->ops[i].out, r->ops[i].size_out, r->ops[i].ptr);
982:   }

984:   /* Tag the operation as done */
985:   r->size_ops = 0;
986:   return(0);
987: }

991: /* auxS: size_cX+V_new_e */
992: PetscErrorCode dvd_orthV(IP ip,Vec *defl,PetscInt size_DS,Vec *cX,PetscInt size_cX,Vec *V,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand)
993: {
994:   PetscErrorCode  ierr;
995:   PetscInt        i, j;
996:   PetscBool       lindep;
997:   PetscReal       norm;
998:   PetscScalar     *auxS0 = auxS;

1001:   /* Orthonormalize V with IP */
1002:   for (i=V_new_s;i<V_new_e;i++) {
1003:     for (j=0;j<3;j++) {
1004:       if (j>0) { SlepcVecSetRandom(V[i], rand); }
1005:       if (cX + size_cX == V) {
1006:         /* If cX and V are contiguous, orthogonalize in one step */
1007:         IPOrthogonalize(ip, size_DS, defl, size_cX+i, NULL, cX,
1008:                                V[i], auxS0, &norm, &lindep);
1009:       } else if (defl) {
1010:         /* Else orthogonalize first against defl, and then against cX and V */
1011:         IPOrthogonalize(ip, size_DS, defl, size_cX, NULL, cX,
1012:                                V[i], auxS0, NULL, &lindep);
1013:         if (!lindep) {
1014:           IPOrthogonalize(ip, 0, NULL, i, NULL, V,
1015:                                  V[i], auxS0, &norm, &lindep);
1016:         }
1017:       } else {
1018:         /* Else orthogonalize first against cX and then against V */
1019:         IPOrthogonalize(ip, size_cX, cX, i, NULL, V,
1020:                                V[i], auxS0, &norm, &lindep);
1021:       }
1022:       if (!lindep && (norm > PETSC_SQRT_MACHINE_EPSILON)) break;
1023:       PetscInfo1(ip,"Orthonormalization problems adding the vector %D to the searching subspace\n",i);
1024:     }
1025:     if (lindep || (norm < PETSC_SQRT_MACHINE_EPSILON)) SETERRQ(PetscObjectComm((PetscObject)ip),1, "Error during orthonormalization of eigenvectors");
1026:     VecScale(V[i],1.0/norm);
1027:   }
1028:   return(0);
1029: }

1033: /* auxS: size_cX+V_new_e+1 */
1034: PetscErrorCode dvd_BorthV_faster(IP ip,Vec *defl,Vec *BDS,PetscReal *BDSn,PetscInt size_DS,Vec *cX,Vec *BcX,PetscReal *BcXn,PetscInt size_cX,Vec *V,Vec *BV,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand)
1035: {
1036:   PetscErrorCode  ierr;
1037:   PetscInt        i, j;
1038:   PetscBool       lindep;
1039:   PetscReal       norm;
1040:   PetscScalar     *auxS0 = auxS;

1043:   /* Orthonormalize V with IP */
1044:   for (i=V_new_s;i<V_new_e;i++) {
1045:     for (j=0;j<3;j++) {
1046:       if (j>0) { SlepcVecSetRandom(V[i],rand); }
1047:       if (cX + size_cX == V && BcX + size_cX == BV) {
1048:         /* If cX and V are contiguous, orthogonalize in one step */
1049:         IPBOrthogonalize(ip, size_DS, defl, BDS, BDSn, size_cX+i, NULL, cX, BcX, BcXn,
1050:                                V[i], BV[i], auxS0, &norm, &lindep);
1051:       } else if (defl) {
1052:         /* Else orthogonalize first against defl, and then against cX and V */
1053:         IPBOrthogonalize(ip, size_DS, defl, BDS, BDSn, size_cX, NULL, cX, BcX, BcXn,
1054:                                V[i], BV[i], auxS0, NULL, &lindep);
1055:         if (!lindep) {
1056:           IPBOrthogonalize(ip, 0, NULL, NULL, NULL, i, NULL, V, BV, BVn,
1057:                                   V[i], BV[i], auxS0, &norm, &lindep);
1058:         }
1059:       } else {
1060:         /* Else orthogonalize first against cX and then against V */
1061:         IPBOrthogonalize(ip, size_cX, cX, BcX, BcXn, i, NULL, V, BV, BVn,
1062:                                 V[i], BV[i], auxS0, &norm, &lindep);
1063:       }
1064:       if (!lindep && (PetscAbs(norm) > PETSC_SQRT_MACHINE_EPSILON)) break;
1065:       PetscInfo1(ip, "Orthonormalization problems adding the vector %d to the searching subspace\n", i);
1066:     }
1067:     if (lindep || (PetscAbs(norm) < PETSC_SQRT_MACHINE_EPSILON)) {
1068:         SETERRQ(PetscObjectComm((PetscObject)ip),1, "Error during the orthonormalization of the eigenvectors");
1069:     }
1070:     if (BVn) BVn[i] = norm > 0.0 ? 1.0 : -1.0;
1071:     norm = PetscAbs(norm);
1072:     VecScale(V[i],1.0/norm);
1073:     VecScale(BV[i],1.0/norm);
1074:   }
1075:   return(0);
1076: }

1080: /* auxS: size_cX+V_new_e+1 */
1081: PetscErrorCode dvd_BorthV_stable(IP ip,Vec *defl,PetscReal *BDSn,PetscInt size_DS,Vec *cX,PetscReal *BcXn,PetscInt size_cX,Vec *V,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand)
1082: {
1083:   PetscErrorCode  ierr;
1084:   PetscInt        i, j;
1085:   PetscBool       lindep;
1086:   PetscReal       norm;
1087:   PetscScalar     *auxS0 = auxS;

1090:   /* Orthonormalize V with IP */
1091:   for (i=V_new_s;i<V_new_e;i++) {
1092:     for (j=0;j<3;j++) {
1093:       if (j>0) {
1094:         SlepcVecSetRandom(V[i],rand);
1095:         PetscInfo1(ip,"Orthonormalization problems adding the vector %d to the searching subspace\n",i);
1096:       }
1097:       /* Orthogonalize against the deflation, if needed */
1098:       if (defl) {
1099:         IPPseudoOrthogonalize(ip,size_DS,defl,BDSn,V[i],auxS0,NULL,&lindep);
1100:         if (lindep) continue;
1101:       }
1102:       /* If cX and V are contiguous, orthogonalize in one step */
1103:       if (cX + size_cX == V) {
1104:         IPPseudoOrthogonalize(ip,size_cX+i,cX,BcXn,V[i],auxS0,&norm,&lindep);
1105:       /* Else orthogonalize first against cX and then against V */
1106:       } else {
1107:         IPPseudoOrthogonalize(ip,size_cX,cX,BcXn,V[i],auxS0,NULL,&lindep);
1108:         if (lindep) continue;
1109:         IPPseudoOrthogonalize(ip,i,V,BVn,V[i],auxS0,&norm,&lindep);
1110:       }
1111:       if (!lindep && (PetscAbs(norm) > PETSC_MACHINE_EPSILON)) break;
1112:     }
1113:     if (lindep || (PetscAbs(norm) < PETSC_MACHINE_EPSILON)) {
1114:         SETERRQ(PetscObjectComm((PetscObject)ip),1, "Error during the orthonormalization of the eigenvectors");
1115:     }
1116:     if (BVn) BVn[i] = norm > 0.0 ? 1.0 : -1.0;
1117:     norm = PetscAbs(norm);
1118:     VecScale(V[i],1.0/norm);
1119:   }
1120:   return(0);
1121: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_utils.c.html0000644000175000017500000010162312211062077024343 0ustar gladkgladk
Actual source code: dvd_utils.c

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

  4:   Some utils

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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

 28: PetscErrorCode dvd_static_precond_PC_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px);
 29: PetscErrorCode dvd_jacobi_precond_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px);
 30: PetscErrorCode dvd_precond_none(dvdDashboard *d,PetscInt i,Vec x,Vec Px);
 31: PetscErrorCode dvd_improvex_precond_d(dvdDashboard *d);

 33: typedef struct {
 34:   PC pc;
 35: } dvdPCWrapper;

 37: /*
 38:   Create a static preconditioner from a PC
 39: */
 42: PetscErrorCode dvd_static_precond_PC(dvdDashboard *d,dvdBlackboard *b,PC pc)
 43: {
 44:   PetscErrorCode  ierr;
 45:   dvdPCWrapper    *dvdpc;
 46:   Mat             P;
 47:   PetscBool       t0,t1,t2;

 50:   /* Setup the step */
 51:   if (b->state >= DVD_STATE_CONF) {
 52:     /* If the preconditioner is valid */
 53:     if (pc) {
 54:       PetscMalloc(sizeof(dvdPCWrapper),&dvdpc);
 55:       PetscLogObjectMemory(d->eps,sizeof(dvdPCWrapper));
 56:       dvdpc->pc = pc;
 57:       PetscObjectReference((PetscObject)pc);
 58:       d->improvex_precond_data = dvdpc;
 59:       d->improvex_precond = dvd_static_precond_PC_0;

 61:       /* PC saves the matrix associated with the linear system, and it has to
 62:          be initialize to a valid matrix */
 63:       PCGetOperatorsSet(pc,NULL,&t0);
 64:       PetscObjectTypeCompare((PetscObject)pc,PCNONE,&t1);
 65:       PetscObjectTypeCompare((PetscObject)pc,PCSHELL,&t2);
 66:       if (t0 && !t1) {
 67:         PCGetOperators(pc,NULL,&P,NULL);
 68:         PetscObjectReference((PetscObject)P);
 69:         PCSetOperators(pc,P,P,SAME_PRECONDITIONER);
 70:         MatDestroy(&P);
 71:       } else if (t2) {
 72:         PCSetOperators(pc,d->A,d->A,SAME_PRECONDITIONER);
 73:       } else {
 74:         d->improvex_precond = dvd_precond_none;
 75:       }

 77:       DVD_FL_ADD(d->destroyList, dvd_improvex_precond_d);

 79:     /* Else, use no preconditioner */
 80:     } else d->improvex_precond = dvd_precond_none;
 81:   }
 82:   return(0);
 83: }

 87: PetscErrorCode dvd_improvex_precond_d(dvdDashboard *d)
 88: {
 89:   PetscErrorCode  ierr;
 90:   dvdPCWrapper    *dvdpc = (dvdPCWrapper*)d->improvex_precond_data;

 93:   /* Free local data */
 94:   if (dvdpc->pc) { PCDestroy(&dvdpc->pc); }
 95:   PetscFree(d->improvex_precond_data);
 96:   return(0);
 97: }

101: PetscErrorCode dvd_static_precond_PC_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px)
102: {
103:   PetscErrorCode  ierr;
104:   dvdPCWrapper    *dvdpc = (dvdPCWrapper*)d->improvex_precond_data;

107:   PCApply(dvdpc->pc, x, Px);
108:   return(0);
109: }

111: typedef struct {
112:   Vec diagA, diagB;
113: } dvdJacobiPrecond;

117: /*
118:   Create the Jacobi preconditioner for Generalized Eigenproblems
119: */
120: PetscErrorCode dvd_jacobi_precond(dvdDashboard *d,dvdBlackboard *b)
121: {
122:   PetscErrorCode   ierr;
123:   dvdJacobiPrecond *dvdjp;
124:   PetscBool        t;

127:   /* Check if the problem matrices support GetDiagonal */
128:   MatHasOperation(d->A, MATOP_GET_DIAGONAL, &t);
129:   if (t && d->B) {
130:     MatHasOperation(d->B, MATOP_GET_DIAGONAL, &t);
131:   }

133:   /* Setting configuration constrains */
134:   b->own_vecs += t?((d->B == 0)?1:2) : 0;

136:   /* Setup the step */
137:   if (b->state >= DVD_STATE_CONF) {
138:     if (t) {
139:       PetscMalloc(sizeof(dvdJacobiPrecond), &dvdjp);
140:       PetscLogObjectMemory(d->eps,sizeof(dvdJacobiPrecond));
141:       dvdjp->diagA = *b->free_vecs;
142:       b->free_vecs++;
143:       MatGetDiagonal(d->A,dvdjp->diagA);
144:       if (d->B) {
145:         dvdjp->diagB = *b->free_vecs;
146:         b->free_vecs++;
147:         MatGetDiagonal(d->B, dvdjp->diagB);
148:       } else dvdjp->diagB = 0;
149:       d->improvex_precond_data = dvdjp;
150:       d->improvex_precond = dvd_jacobi_precond_0;

152:       DVD_FL_ADD(d->destroyList, dvd_improvex_precond_d);

154:     /* Else, use no preconditioner */
155:     } else d->improvex_precond = dvd_precond_none;
156:   }
157:   return(0);
158: }

162: PetscErrorCode dvd_jacobi_precond_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px)
163: {
164:   PetscErrorCode   ierr;
165:   dvdJacobiPrecond *dvdjp = (dvdJacobiPrecond*)d->improvex_precond_data;

168:   /* Compute inv(D - eig)*x */
169:   if (dvdjp->diagB == 0) {
170:     /* Px <- diagA - l */
171:     VecCopy(dvdjp->diagA, Px);
172:     VecShift(Px, -d->eigr[i]);
173:   } else {
174:     /* Px <- diagA - l*diagB */
175:     VecWAXPY(Px, -d->eigr[i], dvdjp->diagB, dvdjp->diagA);
176:   }

178:   /* Px(i) <- x/Px(i) */
179:   VecPointwiseDivide(Px, x, Px);
180:   return(0);
181: }

185: /*
186:   Create a trivial preconditioner
187: */
188: PetscErrorCode dvd_precond_none(dvdDashboard *d,PetscInt i,Vec x,Vec Px)
189: {
190:   PetscErrorCode  ierr;

193:   VecCopy(x, Px);
194:   return(0);
195: }


198: /*
199:   Use of PETSc profiler functions
200: */

202: /* Define stages */
203: #define DVD_STAGE_INITV 0
204: #define DVD_STAGE_NEWITER 1
205: #define DVD_STAGE_CALCPAIRS 2
206: #define DVD_STAGE_IMPROVEX 3
207: #define DVD_STAGE_UPDATEV 4
208: #define DVD_STAGE_ORTHV 5

210: PetscErrorCode dvd_profiler_d(dvdDashboard *d);

212: typedef struct {
213:   PetscErrorCode (*old_initV)(struct _dvdDashboard*);
214:   PetscErrorCode (*old_calcPairs)(struct _dvdDashboard*);
215:   PetscErrorCode (*old_improveX)(struct _dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);
216:   PetscErrorCode (*old_updateV)(struct _dvdDashboard*);
217:   PetscErrorCode (*old_orthV)(struct _dvdDashboard*);
218: } DvdProfiler;

220: static PetscLogStage stages[6] = {0,0,0,0,0,0};

222: /*** Other things ****/

226: PetscErrorCode dvd_prof_init()
227: {
228:   PetscErrorCode  ierr;

231:   if (!stages[0]) {
232:     PetscLogStageRegister("Dvd_step_initV",&stages[DVD_STAGE_INITV]);
233:     PetscLogStageRegister("Dvd_step_calcPairs",&stages[DVD_STAGE_CALCPAIRS]);
234:     PetscLogStageRegister("Dvd_step_improveX",&stages[DVD_STAGE_IMPROVEX]);
235:     PetscLogStageRegister("Dvd_step_updateV",&stages[DVD_STAGE_UPDATEV]);
236:     PetscLogStageRegister("Dvd_step_orthV",&stages[DVD_STAGE_ORTHV]);
237:   }
238:   return(0);
239: }

243: PetscErrorCode dvd_initV_prof(dvdDashboard* d)
244: {
245:   DvdProfiler     *p = (DvdProfiler*)d->prof_data;
246:   PetscErrorCode  ierr;

249:   PetscLogStagePush(stages[DVD_STAGE_INITV]);
250:   p->old_initV(d);
251:   PetscLogStagePop();
252:   return(0);
253: }

257: PetscErrorCode dvd_calcPairs_prof(dvdDashboard* d)
258: {
259:   DvdProfiler     *p = (DvdProfiler*)d->prof_data;
260:   PetscErrorCode  ierr;

263:   PetscLogStagePush(stages[DVD_STAGE_CALCPAIRS]);
264:   p->old_calcPairs(d);
265:   PetscLogStagePop();
266:   return(0);
267: }

271: PetscErrorCode dvd_improveX_prof(dvdDashboard* d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D)
272: {
273:   DvdProfiler     *p = (DvdProfiler*)d->prof_data;
274:   PetscErrorCode  ierr;

277:   PetscLogStagePush(stages[DVD_STAGE_IMPROVEX]);
278:   p->old_improveX(d, D, max_size_D, r_s, r_e, size_D);
279:   PetscLogStagePop();
280:   return(0);
281: }

285: PetscErrorCode dvd_updateV_prof(dvdDashboard *d)
286: {
287:   DvdProfiler     *p = (DvdProfiler*)d->prof_data;
288:   PetscErrorCode  ierr;

291:   PetscLogStagePush(stages[DVD_STAGE_UPDATEV]);
292:   p->old_updateV(d);
293:   PetscLogStagePop();
294:   return(0);
295: }

299: PetscErrorCode dvd_orthV_prof(dvdDashboard *d)
300: {
301:   DvdProfiler     *p = (DvdProfiler*)d->prof_data;
302:   PetscErrorCode  ierr;

305:   PetscLogStagePush(stages[DVD_STAGE_ORTHV]);
306:   p->old_orthV(d);
307:   PetscLogStagePop();
308:   return(0);
309: }

313: PetscErrorCode dvd_profiler(dvdDashboard *d,dvdBlackboard *b)
314: {
315:   PetscErrorCode  ierr;
316:   DvdProfiler     *p;

319:   /* Setup the step */
320:   if (b->state >= DVD_STATE_CONF) {
321:     PetscFree(d->prof_data);
322:     PetscMalloc(sizeof(DvdProfiler),&p);
323:     PetscLogObjectMemory(d->eps,sizeof(DvdProfiler));
324:     d->prof_data = p;
325:     p->old_initV = d->initV; d->initV = dvd_initV_prof;
326:     p->old_calcPairs = d->calcPairs; d->calcPairs = dvd_calcPairs_prof;
327:     p->old_improveX = d->improveX; d->improveX = dvd_improveX_prof;
328:     p->old_updateV = d->updateV; d->updateV = dvd_updateV_prof;

330:     DVD_FL_ADD(d->destroyList, dvd_profiler_d);
331:   }
332:   return(0);
333: }

337: PetscErrorCode dvd_profiler_d(dvdDashboard *d)
338: {
339:   PetscErrorCode  ierr;
340:   DvdProfiler     *p = (DvdProfiler*)d->prof_data;

343:   /* Free local data */
344:   PetscFree(p);
345:   return(0);
346: }


349: /*
350:   Configure the harmonics.
351:   switch (mode) {
352:   DVD_HARM_RR:    harmonic RR
353:   DVD_HARM_RRR:   relative harmonic RR
354:   DVD_HARM_REIGS: rightmost eigenvalues
355:   DVD_HARM_LEIGS: largest eigenvalues
356:   }
357:   fixedTarged, if true use the target instead of the best eigenvalue
358:   target, the fixed target to be used
359: */
360: typedef struct {
361:   PetscScalar
362:     Wa, Wb,       /* span{W} = span{Wa*AV - Wb*BV} */
363:     Pa, Pb;       /* H=W'*(Pa*AV - Pb*BV), G=W'*(Wa*AV - Wb*BV) */
364:   PetscBool
365:     withTarget;
366:   HarmType_t
367:     mode;
368: } dvdHarmonic;

370: PetscErrorCode dvd_harm_start(dvdDashboard *d);
371: PetscErrorCode dvd_harm_end(dvdDashboard *d);
372: PetscErrorCode dvd_harm_d(dvdDashboard *d);
373: PetscErrorCode dvd_harm_transf(dvdHarmonic *dvdh,PetscScalar t);
374: PetscErrorCode dvd_harm_updateW(dvdDashboard *d);
375: PetscErrorCode dvd_harm_proj(dvdDashboard *d);
376: PetscErrorCode dvd_harm_eigs_trans(dvdDashboard *d);
377: PetscErrorCode dvd_harm_eig_backtrans(dvdDashboard *d,PetscScalar ar,PetscScalar ai,PetscScalar *br,PetscScalar *bi);

381: PetscErrorCode dvd_harm_conf(dvdDashboard *d,dvdBlackboard *b,HarmType_t mode,PetscBool fixedTarget,PetscScalar t)
382: {
383:   PetscErrorCode  ierr;
384:   dvdHarmonic     *dvdh;

387:   /* Set the problem to GNHEP:
388:      d->G maybe is upper triangular due to biorthogonality of V and W */
389:   d->sEP = d->sA = d->sB = 0;

391:   /* Setup the step */
392:   if (b->state >= DVD_STATE_CONF) {
393:     PetscMalloc(sizeof(dvdHarmonic),&dvdh);
394:     PetscLogObjectMemory(d->eps,sizeof(dvdHarmonic));
395:     dvdh->withTarget = fixedTarget;
396:     dvdh->mode = mode;
397:     if (fixedTarget) dvd_harm_transf(dvdh, t);
398:     d->calcpairs_W_data = dvdh;
399:     d->calcpairs_W = dvd_harm_updateW;
400:     d->calcpairs_proj_trans = dvd_harm_proj;
401:     d->calcpairs_eigs_trans = dvd_harm_eigs_trans;
402:     d->calcpairs_eig_backtrans = dvd_harm_eig_backtrans;

404:     DVD_FL_ADD(d->destroyList, dvd_harm_d);
405:   }
406:   return(0);
407: }

411: PetscErrorCode dvd_harm_d(dvdDashboard *d)
412: {
413:   PetscErrorCode  ierr;

416:   /* Free local data */
417:   PetscFree(d->calcpairs_W_data);
418:   return(0);
419: }

423: PetscErrorCode dvd_harm_transf(dvdHarmonic *dvdh,PetscScalar t)
424: {
426:   switch (dvdh->mode) {
427:   case DVD_HARM_RR:    /* harmonic RR */
428:     dvdh->Wa = 1.0; dvdh->Wb = t;   dvdh->Pa = 0.0; dvdh->Pb = -1.0; break;
429:   case DVD_HARM_RRR:   /* relative harmonic RR */
430:     dvdh->Wa = 1.0; dvdh->Wb = t;   dvdh->Pa = 1.0; dvdh->Pb = 0.0; break;
431:   case DVD_HARM_REIGS: /* rightmost eigenvalues */
432:     dvdh->Wa = 1.0; dvdh->Wb = t;   dvdh->Pa = 1.0; dvdh->Pb = -PetscConj(t);
433:     break;
434:   case DVD_HARM_LEIGS: /* largest eigenvalues */
435:     dvdh->Wa = 0.0; dvdh->Wb = 1.0; dvdh->Pa = 1.0; dvdh->Pb = 0.0; break;
436:   case DVD_HARM_NONE:
437:   default:
438:     SETERRQ(PETSC_COMM_SELF,1, "Harmonic type not supported");
439:   }

441:   /* Check the transformation does not change the sign of the imaginary part */
442: #if !defined(PETSC_USE_COMPLEX)
443:   if (dvdh->Pb*dvdh->Wa - dvdh->Wb*dvdh->Pa < 0.0)
444:     dvdh->Pa*= -1.0, dvdh->Pb*= -1.0;
445: #endif
446:   return(0);
447: }

451: PetscErrorCode dvd_harm_updateW(dvdDashboard *d)
452: {
453:   dvdHarmonic     *data = (dvdHarmonic*)d->calcpairs_W_data;
454:   PetscErrorCode  ierr;
455:   PetscInt        i;

458:   /* Update the target if it is necessary */
459:   if (!data->withTarget) {
460:     dvd_harm_transf(data,d->eigr[0]);
461:   }

463:   for (i=d->V_new_s;i<d->V_new_e;i++) {
464:     /* W(i) <- Wa*AV(i) - Wb*BV(i) */
465:     VecAXPBYPCZ(d->W[i],data->Wa,-data->Wb,0.0,d->AV[i],(d->BV?d->BV:d->V)[i]);
466:   }
467:   return(0);
468: }

472: PetscErrorCode dvd_harm_proj(dvdDashboard *d)
473: {
474:   dvdHarmonic *data = (dvdHarmonic*)d->calcpairs_W_data;
475:   PetscInt    i,j;

478:   if (d->sH != d->sG) SETERRQ(PETSC_COMM_SELF,1,"Projected matrices H and G must have the same structure");

480:   /* [H G] <- [Pa*H - Pb*G, Wa*H - Wb*G] */
481:   if (DVD_ISNOT(d->sH,DVD_MAT_LTRIANG))     /* Upper triangular part */
482:     for (i=d->V_new_s+d->cX_in_H;i<d->V_new_e+d->cX_in_H;i++)
483:       for (j=0;j<=i;j++) {
484:         PetscScalar h = d->H[d->ldH*i+j], g = d->G[d->ldH*i+j];
485:         d->H[d->ldH*i+j] = data->Pa*h - data->Pb*g;
486:         d->G[d->ldH*i+j] = data->Wa*h - data->Wb*g;
487:       }
488:   if (DVD_ISNOT(d->sH,DVD_MAT_UTRIANG))     /* Lower triangular part */
489:     for (i=0;i<d->V_new_e+d->cX_in_H;i++)
490:       for (j=PetscMax(d->V_new_s+d->cX_in_H,i+(DVD_ISNOT(d->sH,DVD_MAT_LTRIANG)?1:0));
491:           j<d->V_new_e+d->cX_in_H; j++) {
492:         PetscScalar h = d->H[d->ldH*i+j], g = d->G[d->ldH*i+j];
493:         d->H[d->ldH*i+j] = data->Pa*h - data->Pb*g;
494:         d->G[d->ldH*i+j] = data->Wa*h - data->Wb*g;
495:       }
496:   return(0);
497: }

501: PetscErrorCode dvd_harm_backtrans(dvdHarmonic *data,PetscScalar *ar,PetscScalar *ai)
502: {
503:   PetscScalar xr;
504: #if !defined(PETSC_USE_COMPLEX)
505:   PetscScalar xi, k;
506: #endif

510:   xr = *ar;
511: #if !defined(PETSC_USE_COMPLEX)
513:   xi = *ai;

515:   if (xi != 0.0) {
516:     k = (data->Pa - data->Wa*xr)*(data->Pa - data->Wa*xr) +
517:         data->Wa*data->Wa*xi*xi;
518:     *ar = (data->Pb*data->Pa - (data->Pb*data->Wa + data->Wb*data->Pa)*xr +
519:            data->Wb*data->Wa*(xr*xr + xi*xi))/k;
520:     *ai = (data->Pb*data->Wa - data->Wb*data->Pa)*xi/k;
521:   } else
522: #endif
523:     *ar = (data->Pb - data->Wb*xr) / (data->Pa - data->Wa*xr);
524:   return(0);
525: }

529: PetscErrorCode dvd_harm_eig_backtrans(dvdDashboard *d,PetscScalar ar,PetscScalar ai,PetscScalar *br,PetscScalar *bi)
530: {
531:   dvdHarmonic     *data = (dvdHarmonic*)d->calcpairs_W_data;
532:   PetscErrorCode  ierr;

535:   dvd_harm_backtrans(data,&ar,&ai);
536:   *br = ar;
537:   *bi = ai;
538:   return(0);
539: }

543: PetscErrorCode dvd_harm_eigs_trans(dvdDashboard *d)
544: {
545:   dvdHarmonic     *data = (dvdHarmonic*)d->calcpairs_W_data;
546:   PetscInt        i;
547:   PetscErrorCode  ierr;

550:   for (i=0;i<d->size_H;i++) {
551:     dvd_harm_backtrans(data, &d->eigr[i-d->cX_in_H], &d->eigi[i-d->cX_in_H]);
552:   }
553:   return(0);
554: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/davidson.h0000644000175000017500000005557612211062077023236 0ustar gladkgladk/* Method: General Davidson Method (includes GD and JD) References: - Ernest R. Davidson. Super-matrix methods. Computer Physics Communications, 53:49–60, May 1989. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Dashboard struct: contains the methods that will be employed and the tunning options. */ #include /*I "slepceps.h" I*/ #include /*I "slepcst.h" I*/ #include typedef struct _dvdFunctionList { PetscErrorCode (*f)(void*); void *d; struct _dvdFunctionList *next; } dvdFunctionList; typedef PetscInt MatType_t; #define DVD_MAT_HERMITIAN (1<<1) #define DVD_MAT_NEG_DEF (1<<2) #define DVD_MAT_POS_DEF (1<<3) #define DVD_MAT_SINGULAR (1<<4) #define DVD_MAT_COMPLEX (1<<5) #define DVD_MAT_IMPLICIT (1<<6) #define DVD_MAT_IDENTITY (1<<7) #define DVD_MAT_DIAG (1<<8) #define DVD_MAT_TRIANG (1<<9) #define DVD_MAT_UTRIANG (1<<9) #define DVD_MAT_LTRIANG (1<<10) #define DVD_MAT_UNITARY (1<<11) typedef PetscInt EPType_t; #define DVD_EP_STD (1<<1) #define DVD_EP_HERMITIAN (1<<2) #define DVD_EP_INDEFINITE (1<<3) #define DVD_IS(T,P) ((T) & (P)) #define DVD_ISNOT(T,P) (((T) & (P)) ^ (P)) typedef enum { DVD_HARM_NONE, DVD_HARM_RR, DVD_HARM_RRR, DVD_HARM_REIGS, DVD_HARM_LEIGS } HarmType_t; typedef enum { DVD_INITV_CLASSIC, DVD_INITV_KRYLOV } InitType_t; typedef enum { DVD_PROJ_KXX, DVD_PROJ_KZX } ProjType_t; typedef enum { DVD_METH_GD, DVD_METH_JD, DVD_METH_GD2 } Method_t; typedef struct _dvdDashboard { /**** Function steps ****/ /* Initialize V */ PetscErrorCode (*initV)(struct _dvdDashboard*); void *initV_data; /* Find the approximate eigenpairs from V */ PetscErrorCode (*calcPairs)(struct _dvdDashboard*); void *calcPairs_data; /* Eigenpair test for convergence */ PetscBool (*testConv)(struct _dvdDashboard*,PetscScalar eigvr,PetscScalar eigvi,PetscReal res,PetscReal *error); void *testConv_data; /* Number of converged eigenpairs */ PetscInt nconv; /* Number of pairs ready to converge */ PetscInt npreconv; /* Improve the selected eigenpairs */ PetscErrorCode (*improveX)(struct _dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D); void *improveX_data; /* Check for restarting */ PetscBool (*isRestarting)(struct _dvdDashboard*); void *isRestarting_data; /* Perform restarting */ PetscErrorCode (*restartV)(struct _dvdDashboard*); void *restartV_data; /* Update V */ PetscErrorCode (*updateV)(struct _dvdDashboard*); void *updateV_data; /**** Problem specification ****/ Mat A, B; /* Problem matrices */ MatType_t sA, sB; /* Matrix specifications */ EPType_t sEP; /* Problem specifications */ PetscInt nev; /* number of eigenpairs */ EPSWhich which; /* spectrum selection */ PetscBool withTarget; /* if there is a target */ PetscScalar target[2]; /* target value */ PetscReal tol; /* tolerance */ PetscBool correctXnorm; /* if true, norm of X are computed */ /**** Subspaces specification ****/ Vec *V, /* searching subspace */ *real_V, /* original V */ *W, /* testing subspace */ *real_W, /* original W */ *cX, /* converged right eigenvectors */ *cY, /* converged left eigenvectors */ *BcX, /* basis of B*cX */ *AV, /* A*V */ *real_AV, /* original A*V space */ *BV, /* B*V */ *real_BV, /* original B*V space */ *BDS; /* B * eps->DV */ PetscInt size_V, /* size of V */ size_real_V, /* original size of V */ size_W, /* size of W */ size_real_W, /* original size of W */ size_AV, /* size of AV */ size_real_AV, /* original size of AV */ size_BV, /* size of BV */ size_BDS, /* size of BDS */ size_real_BV, /* original size of BV */ size_cX, /* size of cX */ size_cY, /* size of cY */ size_D, /* active vectors */ size_BcX, /* size of BcX */ size_real_eigr, /* size of original eigr, eigi, nR, errest */ max_size_V, /* max size of V */ max_size_W, /* max size of W */ max_size_X, /* max new vectors in V */ max_size_AV, /* max size of AV */ max_size_BV, /* max size of BV */ max_size_proj, /* max size projected problem */ max_cX_in_proj, /* max vectors from cX in the projected problem */ max_cX_in_impr, /* max vectros from cX in the projector */ max_size_P, /* max unconverged vectors in the projector */ bs; /* max vectors that expands the subspace every iteration */ EPS eps; /* Connection to SLEPc */ /**** Auxiliary space ****/ Vec *auxV; /* auxiliary vectors */ PetscScalar *auxS; /* auxiliary scalars */ PetscInt size_auxV, /* max size of auxV */ size_auxS; /* max size of auxS */ /**** Eigenvalues and errors ****/ PetscScalar *ceigr, *ceigi, /* converged eigenvalues */ *eigr, *eigi, /* current eigenvalues */ *real_eigr, *real_eigi; /* original eigr and eigi */ PetscReal *nR, /* residual norm */ *real_nR, /* original nR */ *nX, /* X norm */ *real_nX, /* original nX */ *errest, /* relative error eigenpairs */ *real_errest, /* original errest */ *nBDS, /* B-norms of DS */ *nBV, /* B-norms of V */ *nBcX, /* B-norms of cX */ *nBpX, /* B-norms of pX */ *real_nBV; /* original nBDS, nBV and nBcX */ /**** Shared function and variables ****/ PetscErrorCode (*e_Vchanged)(struct _dvdDashboard*,PetscInt s_imm,PetscInt e_imm,PetscInt s_new,PetscInt e_new); void *e_Vchanged_data; PetscErrorCode (*calcpairs_residual)(struct _dvdDashboard*,PetscInt s,PetscInt e,Vec *R); PetscErrorCode (*calcpairs_residual_eig)(struct _dvdDashboard*,PetscInt s,PetscInt e,Vec *R); PetscErrorCode (*calcpairs_selectPairs)(struct _dvdDashboard*,PetscInt n); void *calcpairs_residual_data; PetscErrorCode (*improvex_precond)(struct _dvdDashboard*,PetscInt i,Vec x,Vec Px); void *improvex_precond_data; PetscErrorCode (*improvex_jd_proj_uv)(struct _dvdDashboard*,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld); PetscErrorCode (*improvex_jd_lit)(struct _dvdDashboard*,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol); PetscErrorCode (*calcpairs_W)(struct _dvdDashboard*); void *calcpairs_W_data; PetscErrorCode (*calcpairs_proj_trans)(struct _dvdDashboard*); PetscErrorCode (*calcpairs_eigs_trans)(struct _dvdDashboard*); PetscErrorCode (*calcpairs_eig_backtrans)(struct _dvdDashboard*,PetscScalar,PetscScalar,PetscScalar*,PetscScalar*); PetscErrorCode (*calcpairs_proj_res)(struct _dvdDashboard*,PetscInt r_s,PetscInt r_e,Vec *R); PetscErrorCode (*preTestConv)(struct _dvdDashboard*,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv); PetscErrorCode (*e_newIteration)(struct _dvdDashboard*); void *e_newIteration_data; IP ipI; IP ipV, /* orthogonal routine options for V subspace */ ipW; /* orthogonal routine options for W subspace */ dvdFunctionList *startList, /* starting list */ *endList, /* ending list */ *destroyList; /* destructor list */ PetscScalar *H, /* Projected problem matrix A*/ *real_H, /* original H */ *G, /* Projected problem matrix B*/ *real_G, /* original G */ *S, /* first Schur matrix, S = pY'*H*pX */ *T, /* second Schur matrix, T = pY'*G*pX */ *cS, /* first Schur matrix of converged pairs */ *cT; /* second Schur matrix of converged pairs */ MatType_t sH, /* H properties */ sG; /* G properties */ PetscInt ldH, /* leading dimension of H */ ldS, /* leading dimension of S */ ldT, /* leading dimension of T */ ldcS, /* leading dimension of cS */ ldcT, /* leading dimension of cT */ size_H, /* rows and columns in H */ size_G, /* rows and columns in G */ size_MT, /* rows in MT */ size_cS, /* dimension of cS */ size_cT, /* dimension of cT */ max_size_cS, /* max size of cS and cT */ cX_in_V, /* number of converged vectors in V */ cX_in_W, /* number of converged vectors in W */ cX_in_AV, /* number of converged vectors in AV */ cX_in_BV, /* number of converged vectors in BV */ cX_in_H, /* number of converged vectors in H */ cX_in_G; /* number of converged vectors in G */ PetscInt V_tra_s, V_tra_e, /* cX <- [cX V*MT(0:V_tra_s-1)], V <- V*MT(V_tra_s:V_tra_e) */ V_new_s, V_new_e; /* added to V the columns V_new_s:V_new_e */ PetscBool BV_shift, /* if true BV is shifted when vectors converge */ W_shift; /* if true W is shifted when vectors converge */ DS conv_ps, /* projected problem with the converged pairs */ ps; /* projected problem with the search subspace */ EPSOrthType orthoV_type; void* prof_data; /* profiler data */ } dvdDashboard; /* Add the function fun at the beginning of list */ #define DVD_FL_ADD_BEGIN(list, fun) { \ dvdFunctionList *fl=(list); \ PetscErrorCode ierr; \ ierr = PetscMalloc(sizeof(dvdFunctionList), &(list));CHKERRQ(ierr); \ (list)->f = (PetscErrorCode(*)(void*))(fun); \ (list)->next = fl; \ } /* Add the function fun at the end of list */ #define DVD_FL_ADD_END(list, fun) { \ if ((list)) {DVD_FL_ADD_END0(list, fun);} \ else {DVD_FL_ADD_BEGIN(list, fun);} } #define DVD_FL_ADD_END0(list, fun) { \ dvdFunctionList *fl=(list); \ PetscErrorCode ierr; \ for (;fl->next; fl = fl->next); \ ierr = PetscMalloc(sizeof(dvdFunctionList), &fl->next);CHKERRQ(ierr); \ fl->next->f = (PetscErrorCode(*)(void*))(fun); \ fl->next->next = NULL; \ } #define DVD_FL_ADD(list, fun) DVD_FL_ADD_END(list, fun) #define DVD_FL_CALL(list, arg0) { \ dvdFunctionList *fl; \ for (fl=(list); fl; fl=fl->next) \ if (*(dvdCallback)fl->f) (*(dvdCallback)fl->f)((arg0)); \ } #define DVD_FL_DEL(list) { \ dvdFunctionList *fl=(list), *oldfl; \ PetscErrorCode ierr; \ while (fl) { \ oldfl = fl; fl = fl->next; ierr = PetscFree(oldfl);CHKERRQ(ierr);\ } \ (list) = NULL; \ } /* The blackboard configuration structure: saves information about the memory and other requirements. The starting memory structure: V W? AV BV? tKZ |-----------|-----------|-----------|------------|-------| nev+mpd nev+mpd scP+mpd nev?+mpd sP+scP scP+mpd scP+mpd The final memory structure considering W_shift and BV_shift: cX V cY? W? cAV AV BcX? BV? KZ tKZ |---|-------|----|------|---|-------|----|-------|---|---| nev mpd nev mpd scP mpd nev mpd scP sP <- shift scP scP <- !shift */ typedef struct { PetscInt max_size_V, /* max size of the searching subspace (mpd) */ max_size_X, /* max size of X (bs) */ size_V, /* real size of V (nev+size_P+mpd) */ max_size_oldX, /* max size of oldX */ max_size_auxV, /* max size of auxiliary vecs */ max_size_auxS, /* max size of auxiliary scalars */ max_nev, /* max number of converged pairs */ max_size_P, /* number of computed vectors for the projector */ max_size_cP, /* number of converged vectors in the projectors */ max_size_proj, /* max size projected problem */ max_size_cX_proj, /* max converged vectors in the projected problem */ own_vecs, /* number of global vecs */ own_scalars; /* number of local scalars */ Vec *free_vecs; /* free global vectors */ PetscScalar *free_scalars; /* free scalars */ PetscInt state; /* method states: 0: preconfiguring 1: configuring 2: running */ } dvdBlackboard; #define DVD_STATE_PRECONF 0 #define DVD_STATE_CONF 1 #define DVD_STATE_RUN 2 /* Shared types */ typedef PetscErrorCode (*dvdPrecond)(dvdDashboard*,PetscInt i,Vec x,Vec Px); typedef PetscErrorCode (*dvdCallback)(dvdDashboard*); typedef PetscErrorCode (*e_Vchanged_type)(dvdDashboard*,PetscInt s_imm,PetscInt e_imm,PetscInt s_new,PetscInt e_new); typedef PetscBool (*isRestarting_type)(dvdDashboard*); typedef PetscErrorCode (*e_newIteration_type)(dvdDashboard*); typedef PetscErrorCode (*improveX_type)(dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D); /* Structures for blas */ typedef PetscErrorCode (*DvdReductionPostF)(PetscScalar*,PetscInt,void*); typedef struct { PetscScalar *out; /* final vector */ PetscInt size_out; /* size of out */ DvdReductionPostF f; /* function called after the reduction */ void *ptr; } DvdReductionChunk; typedef struct { PetscScalar *in, /* vector to sum-up with more nodes */ *out; /* final vector */ PetscInt size_in, /* size of in */ max_size_in; /* max size of in */ DvdReductionChunk *ops; /* vector of reduction operations */ PetscInt size_ops, /* size of ops */ max_size_ops; /* max size of ops */ MPI_Comm comm; /* MPI communicator */ } DvdReduction; typedef struct { PetscInt i0, i1, i2, ld, s0, e0, s1, e1; PetscScalar *M; } DvdMult_copy_func; /* Routines for initV step */ PETSC_INTERN PetscErrorCode dvd_initV(dvdDashboard *d,dvdBlackboard *b,PetscInt k,PetscInt user,PetscBool krylov); /* Routines for calcPairs step */ PETSC_INTERN PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d,dvdBlackboard *b,EPSOrthType orth,IP ipI,PetscInt cX_proj,PetscBool harm); /* Routines for improveX step */ PETSC_INTERN PetscErrorCode dvd_improvex_jd(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs,PetscInt cX_impr,PetscBool dynamic); PETSC_INTERN PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d,dvdBlackboard *b,ProjType_t p); PETSC_INTERN PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d,dvdBlackboard *b,PetscInt maxits,PetscReal tol,PetscReal fix); PETSC_INTERN PetscErrorCode dvd_improvex_gd2(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs); PETSC_INTERN PetscErrorCode dvd_improvex_get_eigenvectors(dvdDashboard *d,PetscScalar *pX, PetscScalar *pY,PetscInt ld,PetscScalar *auxS,PetscInt size_auxS); /* Routines for testConv step */ PETSC_INTERN PetscErrorCode dvd_testconv_basic(dvdDashboard *d,dvdBlackboard *b); PETSC_INTERN PetscErrorCode dvd_testconv_slepc(dvdDashboard *d,dvdBlackboard *b); /* Routines for management of V */ PETSC_INTERN PetscErrorCode dvd_managementV_basic(dvdDashboard *d,dvdBlackboard *b,PetscInt bs,PetscInt mpd,PetscInt min_size_V,PetscInt plusk,PetscBool harm,PetscBool allResiduals); /* Some utilities */ PETSC_INTERN PetscErrorCode dvd_static_precond_PC(dvdDashboard *d,dvdBlackboard *b,PC pc); PETSC_INTERN PetscErrorCode dvd_jacobi_precond(dvdDashboard *d,dvdBlackboard *b); PETSC_INTERN PetscErrorCode dvd_profiler(dvdDashboard *d,dvdBlackboard *b); PETSC_INTERN PetscErrorCode dvd_prof_init(); PETSC_INTERN PetscErrorCode dvd_harm_conf(dvdDashboard *d,dvdBlackboard *b,HarmType_t mode,PetscBool fixedTarget,PetscScalar t); /* Methods */ PETSC_INTERN PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,HarmType_t harmMode,KSP ksp,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,Method_t method); PETSC_INTERN PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,IP ip,HarmType_t harmMode,PetscBool fixedTarget,PetscScalar t,KSP ksp,PetscReal fix,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,PetscBool dynamic,Method_t method); /* BLAS routines */ PETSC_INTERN PetscErrorCode SlepcDenseMatProdTriang(PetscScalar *C,MatType_t sC,PetscInt ldC,const PetscScalar *A,MatType_t sA,PetscInt ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,MatType_t sB,PetscInt ldB,PetscInt rB,PetscInt cB,PetscBool Bt); PETSC_INTERN PetscErrorCode SlepcDenseNorm(PetscScalar *A,PetscInt ldA,PetscInt _rA,PetscInt cA,PetscScalar *eigi); PETSC_INTERN PetscErrorCode SlepcDenseCopy(PetscScalar *Y,PetscInt ldY,PetscScalar *X,PetscInt ldX,PetscInt rX,PetscInt cX); PETSC_INTERN PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y,MatType_t sY,PetscInt ldY,PetscScalar *X,MatType_t sX,PetscInt ldX,PetscInt rX,PetscInt cX); PETSC_INTERN PetscErrorCode SlepcUpdateVectorsZ(Vec *Y,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM); PETSC_INTERN PetscErrorCode SlepcUpdateVectorsS(Vec *Y,PetscInt dY,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,PetscInt dX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM); PETSC_INTERN PetscErrorCode SlepcUpdateVectorsD(Vec *X,PetscInt cX,PetscScalar alpha,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *work,PetscInt lwork); PETSC_INTERN PetscErrorCode VecsMult(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,PetscScalar *workS0,PetscScalar *workS1); PETSC_INTERN PetscErrorCode VecsMultS(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,DvdReduction *r,DvdMult_copy_func *sr); PETSC_INTERN PetscErrorCode VecsMultIb(PetscScalar *M,MatType_t sM,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *auxS,Vec V); PETSC_INTERN PetscErrorCode VecsMultIa(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV); PETSC_INTERN PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,PetscInt max_size_ops,PetscScalar *in,PetscScalar *out,PetscInt max_size_in,DvdReduction *r,MPI_Comm comm); PETSC_INTERN PetscErrorCode SlepcAllReduceSum(DvdReduction *r,PetscInt size_in,DvdReductionPostF f,void *ptr,PetscScalar **in); PETSC_INTERN PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r); PETSC_INTERN PetscErrorCode dvd_orthV(IP ip,Vec *DS,PetscInt size_DS,Vec *cX,PetscInt size_cX,Vec *V,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand); PETSC_INTERN PetscErrorCode dvd_BorthV_faster(IP ip,Vec *DS,Vec *BDS,PetscReal *BDSn,PetscInt size_DS,Vec *cX,Vec *BcX,PetscReal *BcXn,PetscInt size_cX,Vec *V,Vec *BV,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand); PETSC_INTERN PetscErrorCode dvd_BorthV_stable(IP ip,Vec *defl,PetscReal *BDSn,PetscInt size_DS,Vec *cX,PetscReal *BcXn,PetscInt size_cX,Vec *V,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand); /* SLEPc interface routines */ PETSC_INTERN PetscErrorCode SLEPcNotImplemented(); PETSC_INTERN PetscErrorCode EPSCreate_XD(EPS eps); PETSC_INTERN PetscErrorCode EPSReset_XD(EPS eps); PETSC_INTERN PetscErrorCode EPSSetUp_XD(EPS eps); PETSC_INTERN PetscErrorCode EPSSolve_XD(EPS eps); PETSC_INTERN PetscErrorCode EPSComputeVectors_XD(EPS eps); PETSC_INTERN PetscErrorCode EPSXDSetKrylovStart_XD(EPS eps,PetscBool krylovstart); PETSC_INTERN PetscErrorCode EPSXDGetKrylovStart_XD(EPS eps,PetscBool *krylovstart); PETSC_INTERN PetscErrorCode EPSXDSetBlockSize_XD(EPS eps,PetscInt blocksize); PETSC_INTERN PetscErrorCode EPSXDGetBlockSize_XD(EPS eps,PetscInt *blocksize); PETSC_INTERN PetscErrorCode EPSXDSetRestart_XD(EPS eps,PetscInt minv,PetscInt plusk); PETSC_INTERN PetscErrorCode EPSXDGetRestart_XD(EPS eps,PetscInt *minv,PetscInt *plusk); PETSC_INTERN PetscErrorCode EPSXDGetInitialSize_XD(EPS eps,PetscInt *initialsize); PETSC_INTERN PetscErrorCode EPSXDSetInitialSize_XD(EPS eps,PetscInt initialsize); PETSC_INTERN PetscErrorCode EPSXDGetFix_XD(EPS eps,PetscReal *fix); PETSC_INTERN PetscErrorCode EPSJDSetFix_JD(EPS eps,PetscReal fix); PETSC_INTERN PetscErrorCode EPSXDSetBOrth_XD(EPS eps,EPSOrthType borth); PETSC_INTERN PetscErrorCode EPSXDGetBOrth_XD(EPS eps,EPSOrthType *borth); PETSC_INTERN PetscErrorCode EPSJDSetConstCorrectionTol_JD(EPS eps,PetscBool constant); PETSC_INTERN PetscErrorCode EPSJDGetConstCorrectionTol_JD(EPS eps,PetscBool *constant); PETSC_INTERN PetscErrorCode EPSXDSetWindowSizes_XD(EPS eps,PetscInt pwindow,PetscInt qwindow); PETSC_INTERN PetscErrorCode EPSXDGetWindowSizes_XD(EPS eps,PetscInt *pwindow,PetscInt *qwindow); PETSC_INTERN PetscErrorCode EPSXDSetMethod(EPS eps,Method_t method); PETSC_INTERN PetscErrorCode EPSXDGetMethod_XD(EPS eps,Method_t *method); /* Common inline function */ #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_compute_X" PETSC_STATIC_INLINE PetscErrorCode dvd_improvex_compute_X(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,PetscScalar *pX,PetscInt ld) { PetscErrorCode ierr; PetscInt n = i_e - i_s,i; PetscFunctionBegin; ierr = SlepcUpdateVectorsZ(u,0.0,1.0,d->V-d->cX_in_H,d->size_V+d->cX_in_H,&pX[ld*i_s],ld,d->size_H,n);CHKERRQ(ierr); /* nX(i) <- ||X(i)|| */ if (d->correctXnorm) { for (i=0; inX[i_s+i]);CHKERRQ(ierr); } for (i=0; inX[i_s+i]);CHKERRQ(ierr); } #if !defined(PETSC_USE_COMPLEX) for (i=0;ieigi[i_s+i] != 0.0) { d->nX[i_s+i] = d->nX[i_s+i+1] = PetscSqrtScalar(d->nX[i_s+i]*d->nX[i_s+i]+d->nX[i_s+i+1]*d->nX[i_s+i+1]); i++; } } #endif } else { for (i=0; inX[i_s+i] = 1.0; } PetscFunctionReturn(0); } #define _Ceil(A,B) ((A)/(B)+((A)%(B)==0?0:1)) #define FromIntToScalar(S) ((PetscInt)_Ceil((S)*sizeof(PetscBLASInt),sizeof(PetscScalar))) #define FromRealToScalar(S) ((PetscInt)_Ceil((S)*sizeof(PetscReal),sizeof(PetscScalar))) slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/davidson.h.html0000644000175000017500000014345012211062077024166 0ustar gladkgladk
Actual source code: davidson.h

  1: /*
  2:   Method: General Davidson Method (includes GD and JD)

  4:   References:
  5:     - Ernest R. Davidson. Super-matrix methods. Computer Physics Communications,
  6:       53:49–60, May 1989.

  8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 10:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 12:    This file is part of SLEPc.

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

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

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

 28: /*
 29:    Dashboard struct: contains the methods that will be employed and the tunning
 30:    options.
 31: */

 33: #include <slepc-private/epsimpl.h>         /*I "slepceps.h" I*/
 34: #include <slepc-private/stimpl.h>          /*I "slepcst.h" I*/
 35: #include <slepcblaslapack.h>

 37: typedef struct _dvdFunctionList {
 38:   PetscErrorCode (*f)(void*);
 39:   void *d;
 40:   struct _dvdFunctionList *next;
 41: } dvdFunctionList;

 43: typedef PetscInt MatType_t;
 44: #define DVD_MAT_HERMITIAN (1<<1)
 45: #define DVD_MAT_NEG_DEF (1<<2)
 46: #define DVD_MAT_POS_DEF (1<<3)
 47: #define DVD_MAT_SINGULAR (1<<4)
 48: #define DVD_MAT_COMPLEX (1<<5)
 49: #define DVD_MAT_IMPLICIT (1<<6)
 50: #define DVD_MAT_IDENTITY (1<<7)
 51: #define DVD_MAT_DIAG (1<<8)
 52: #define DVD_MAT_TRIANG (1<<9)
 53: #define DVD_MAT_UTRIANG (1<<9)
 54: #define DVD_MAT_LTRIANG (1<<10)
 55: #define DVD_MAT_UNITARY (1<<11)

 57: typedef PetscInt EPType_t;
 58: #define DVD_EP_STD (1<<1)
 59: #define DVD_EP_HERMITIAN (1<<2)
 60: #define DVD_EP_INDEFINITE (1<<3)

 62: #define DVD_IS(T,P) ((T) & (P))
 63: #define DVD_ISNOT(T,P) (((T) & (P)) ^ (P))

 65: typedef enum {
 66:   DVD_HARM_NONE,
 67:   DVD_HARM_RR,
 68:   DVD_HARM_RRR,
 69:   DVD_HARM_REIGS,
 70:   DVD_HARM_LEIGS
 71: } HarmType_t;

 73: typedef enum {
 74:   DVD_INITV_CLASSIC,
 75:   DVD_INITV_KRYLOV
 76: } InitType_t;

 78: typedef enum {
 79:   DVD_PROJ_KXX,
 80:   DVD_PROJ_KZX
 81: } ProjType_t;

 83: typedef enum {
 84:   DVD_METH_GD,
 85:   DVD_METH_JD,
 86:   DVD_METH_GD2
 87: } Method_t;

 89: typedef struct _dvdDashboard {
 90:   /**** Function steps ****/
 91:   /* Initialize V */
 92:   PetscErrorCode (*initV)(struct _dvdDashboard*);
 93:   void *initV_data;

 95:   /* Find the approximate eigenpairs from V */
 96:   PetscErrorCode (*calcPairs)(struct _dvdDashboard*);
 97:   void *calcPairs_data;

 99:   /* Eigenpair test for convergence */
100:   PetscBool (*testConv)(struct _dvdDashboard*,PetscScalar eigvr,PetscScalar eigvi,PetscReal res,PetscReal *error);
101:   void *testConv_data;

103:   /* Number of converged eigenpairs */
104:   PetscInt nconv;

106:   /* Number of pairs ready to converge */
107:   PetscInt npreconv;

109:   /* Improve the selected eigenpairs */
110:   PetscErrorCode (*improveX)(struct _dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);
111:   void *improveX_data;

113:   /* Check for restarting */
114:   PetscBool (*isRestarting)(struct _dvdDashboard*);
115:   void *isRestarting_data;

117:   /* Perform restarting */
118:   PetscErrorCode (*restartV)(struct _dvdDashboard*);
119:   void *restartV_data;

121:   /* Update V */
122:   PetscErrorCode (*updateV)(struct _dvdDashboard*);
123:   void *updateV_data;

125:   /**** Problem specification ****/
126:   Mat A, B;         /* Problem matrices */
127:   MatType_t sA, sB; /* Matrix specifications */
128:   EPType_t sEP;     /* Problem specifications */
129:   PetscInt nev;     /* number of eigenpairs */
130:   EPSWhich which;   /* spectrum selection */
131:   PetscBool
132:     withTarget;     /* if there is a target */
133:   PetscScalar
134:     target[2];         /* target value */
135:   PetscReal tol;    /* tolerance */
136:   PetscBool
137:     correctXnorm;   /* if true, norm of X are computed */

139:   /**** Subspaces specification ****/
140:   Vec *V,           /* searching subspace */
141:     *real_V,        /* original V */
142:     *W,             /* testing subspace */
143:     *real_W,        /* original W */
144:     *cX,            /* converged right eigenvectors */
145:     *cY,            /* converged left eigenvectors */
146:     *BcX,           /* basis of B*cX */
147:     *AV,            /* A*V */
148:     *real_AV,       /* original A*V space */
149:     *BV,            /* B*V */
150:     *real_BV,       /* original B*V space */
151:     *BDS;           /* B * eps->DV */
152:   PetscInt size_V,  /* size of V */
153:     size_real_V,    /* original size of V */
154:     size_W,         /* size of W */
155:     size_real_W,    /* original size of W */
156:     size_AV,        /* size of AV */
157:     size_real_AV,   /* original size of AV */
158:     size_BV,        /* size of BV */
159:     size_BDS,       /* size of BDS */
160:     size_real_BV,   /* original size of BV */
161:     size_cX,        /* size of cX */
162:     size_cY,        /* size of cY */
163:     size_D,         /* active vectors */
164:     size_BcX,       /* size of BcX */
165:     size_real_eigr, /* size of original eigr, eigi, nR, errest */
166:     max_size_V,     /* max size of V */
167:     max_size_W,     /* max size of W */
168:     max_size_X,     /* max new vectors in V */
169:     max_size_AV,    /* max size of AV */
170:     max_size_BV,    /* max size of BV */
171:     max_size_proj,  /* max size projected problem */
172:     max_cX_in_proj, /* max vectors from cX in the projected problem */
173:     max_cX_in_impr, /* max vectros from cX in the projector */
174:     max_size_P,     /* max unconverged vectors in the projector */
175:     bs;             /* max vectors that expands the subspace every iteration */
176:   EPS eps;          /* Connection to SLEPc */

178:   /**** Auxiliary space ****/
179:   Vec *auxV;        /* auxiliary vectors */
180:   PetscScalar
181:     *auxS;          /* auxiliary scalars */
182:   PetscInt
183:     size_auxV,      /* max size of auxV */
184:     size_auxS;      /* max size of auxS */

186:   /**** Eigenvalues and errors ****/
187:   PetscScalar
188:     *ceigr, *ceigi, /* converged eigenvalues */
189:     *eigr, *eigi,   /* current eigenvalues */
190:     *real_eigr,
191:     *real_eigi;     /* original eigr and eigi */
192:   PetscReal
193:     *nR,            /* residual norm */
194:     *real_nR,       /* original nR */
195:     *nX,            /* X norm */
196:     *real_nX,       /* original nX */
197:     *errest,        /* relative error eigenpairs */
198:     *real_errest,   /* original errest */
199:     *nBDS,          /* B-norms of DS */
200:     *nBV,           /* B-norms of V */
201:     *nBcX,          /* B-norms of cX */
202:     *nBpX,          /* B-norms of pX */
203:     *real_nBV;      /* original nBDS, nBV and nBcX */

205:   /**** Shared function and variables ****/
206:   PetscErrorCode (*e_Vchanged)(struct _dvdDashboard*,PetscInt s_imm,PetscInt e_imm,PetscInt s_new,PetscInt e_new);
207:   void *e_Vchanged_data;

209:   PetscErrorCode (*calcpairs_residual)(struct _dvdDashboard*,PetscInt s,PetscInt e,Vec *R);
210:   PetscErrorCode (*calcpairs_residual_eig)(struct _dvdDashboard*,PetscInt s,PetscInt e,Vec *R);
211:   PetscErrorCode (*calcpairs_selectPairs)(struct _dvdDashboard*,PetscInt n);
212:   void *calcpairs_residual_data;
213:   PetscErrorCode (*improvex_precond)(struct _dvdDashboard*,PetscInt i,Vec x,Vec Px);
214:   void *improvex_precond_data;
215:   PetscErrorCode (*improvex_jd_proj_uv)(struct _dvdDashboard*,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld);
216:   PetscErrorCode (*improvex_jd_lit)(struct _dvdDashboard*,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol);
217:   PetscErrorCode (*calcpairs_W)(struct _dvdDashboard*);
218:   void *calcpairs_W_data;
219:   PetscErrorCode (*calcpairs_proj_trans)(struct _dvdDashboard*);
220:   PetscErrorCode (*calcpairs_eigs_trans)(struct _dvdDashboard*);
221:   PetscErrorCode (*calcpairs_eig_backtrans)(struct _dvdDashboard*,PetscScalar,PetscScalar,PetscScalar*,PetscScalar*);
222:   PetscErrorCode (*calcpairs_proj_res)(struct _dvdDashboard*,PetscInt r_s,PetscInt r_e,Vec *R);
223:   PetscErrorCode (*preTestConv)(struct _dvdDashboard*,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv);

225:   PetscErrorCode (*e_newIteration)(struct _dvdDashboard*);
226:   void *e_newIteration_data;

228:   IP ipI;
229:   IP ipV,           /* orthogonal routine options for V subspace */
230:     ipW;            /* orthogonal routine options for W subspace */

232:   dvdFunctionList
233:     *startList,     /* starting list */
234:     *endList,       /* ending list */
235:     *destroyList;   /* destructor list */

237:   PetscScalar *H,   /* Projected problem matrix A*/
238:     *real_H,        /* original H */
239:     *G,             /* Projected problem matrix B*/
240:     *real_G,        /* original G */
241:     *S,             /* first Schur matrix, S = pY'*H*pX */
242:     *T,             /* second Schur matrix, T = pY'*G*pX */
243:     *cS,            /* first Schur matrix of converged pairs */
244:     *cT;            /* second Schur matrix of converged pairs */
245:   MatType_t
246:     sH,             /* H properties */
247:     sG;             /* G properties */
248:   PetscInt ldH,     /* leading dimension of H */
249:     ldS,            /* leading dimension of S */
250:     ldT,            /* leading dimension of T */
251:     ldcS,           /* leading dimension of cS */
252:     ldcT,           /* leading dimension of cT */
253:     size_H,         /* rows and columns in H */
254:     size_G,         /* rows and columns in G */
255:     size_MT,        /* rows in MT */
256:     size_cS,        /* dimension of cS */
257:     size_cT,        /* dimension of cT */
258:     max_size_cS,    /* max size of cS and cT */
259:     cX_in_V,        /* number of converged vectors in V */
260:     cX_in_W,        /* number of converged vectors in W */
261:     cX_in_AV,       /* number of converged vectors in AV */
262:     cX_in_BV,       /* number of converged vectors in BV */
263:     cX_in_H,        /* number of converged vectors in H */
264:     cX_in_G;        /* number of converged vectors in G */

266:   PetscInt
267:     V_tra_s,
268:     V_tra_e,        /* cX <- [cX V*MT(0:V_tra_s-1)], V <- V*MT(V_tra_s:V_tra_e) */
269:     V_new_s,
270:     V_new_e;        /* added to V the columns V_new_s:V_new_e */
271:   PetscBool
272:     BV_shift,       /* if true BV is shifted when vectors converge */
273:     W_shift;        /* if true W is shifted when vectors converge */
274:   DS conv_ps,       /* projected problem with the converged pairs */
275:     ps;             /* projected problem with the search subspace */

277:   EPSOrthType   orthoV_type;

279:   void* prof_data;  /* profiler data */
280: } dvdDashboard;

282: /* Add the function fun at the beginning of list */
283: #define DVD_FL_ADD_BEGIN(list, fun) { \
284:   dvdFunctionList *fl=(list); \
286:   PetscMalloc(sizeof(dvdFunctionList), &(list)); \
287:   (list)->f = (PetscErrorCode(*)(void*))(fun); \
288:   (list)->next = fl; \
289: }

291: /* Add the function fun at the end of list */
292: #define DVD_FL_ADD_END(list, fun) { \
293:   if ((list)) {DVD_FL_ADD_END0(list, fun);} \
294:   else {DVD_FL_ADD_BEGIN(list, fun);} }

296: #define DVD_FL_ADD_END0(list, fun) { \
297:   dvdFunctionList *fl=(list); \
299:   for (;fl->next; fl = fl->next); \
300:   PetscMalloc(sizeof(dvdFunctionList), &fl->next); \
301:   fl->next->f = (PetscErrorCode(*)(void*))(fun); \
302:   fl->next->next = NULL; \
303: }

305: #define DVD_FL_ADD(list, fun) DVD_FL_ADD_END(list, fun)

307: #define DVD_FL_CALL(list, arg0) { \
308:   dvdFunctionList *fl; \
309:   for (fl=(list); fl; fl=fl->next) \
310:     if (*(dvdCallback)fl->f) (*(dvdCallback)fl->f)((arg0)); \
311: }

313: #define DVD_FL_DEL(list) { \
314:   dvdFunctionList *fl=(list), *oldfl; \
316:   while (fl) { \
317:     oldfl = fl; fl = fl->next; PetscFree(oldfl);\
318:   } \
319:   (list) = NULL; \
320: }

322: /*
323:   The blackboard configuration structure: saves information about the memory
324:   and other requirements.

326:   The starting memory structure:

328:   V           W?          AV          BV?          tKZ
329:   |-----------|-----------|-----------|------------|-------|
330:   nev+mpd     nev+mpd     scP+mpd     nev?+mpd     sP+scP
331:               scP+mpd                 scP+mpd

333:   The final memory structure considering W_shift and BV_shift:

335:   cX  V       cY?  W?     cAV AV      BcX? BV?     KZ  tKZ
336:   |---|-------|----|------|---|-------|----|-------|---|---|
337:   nev mpd     nev  mpd    scP mpd     nev  mpd     scP sP    <- shift
338:               scP                     scP                    <- !shift
339: */
340: typedef struct {
341:   PetscInt max_size_V,  /* max size of the searching subspace (mpd) */
342:     max_size_X,         /* max size of X (bs) */
343:     size_V,             /* real size of V (nev+size_P+mpd) */
344:     max_size_oldX,      /* max size of oldX */
345:     max_size_auxV,      /* max size of auxiliary vecs */
346:     max_size_auxS,      /* max size of auxiliary scalars */
347:     max_nev,            /* max number of converged pairs */
348:     max_size_P,         /* number of computed vectors for the projector */
349:     max_size_cP,        /* number of converged vectors in the projectors */
350:     max_size_proj,      /* max size projected problem */
351:     max_size_cX_proj,   /* max converged vectors in the projected problem */
352:     own_vecs,           /* number of global vecs */
353:     own_scalars;        /* number of local scalars */
354:   Vec *free_vecs;       /* free global vectors */
355:   PetscScalar
356:     *free_scalars;      /* free scalars */
357:   PetscInt state;       /* method states:
358:                             0: preconfiguring
359:                             1: configuring
360:                             2: running
361:                         */
362: } dvdBlackboard;

364: #define DVD_STATE_PRECONF 0
365: #define DVD_STATE_CONF 1
366: #define DVD_STATE_RUN 2

368: /* Shared types */
369: typedef PetscErrorCode (*dvdPrecond)(dvdDashboard*,PetscInt i,Vec x,Vec Px);
370: typedef PetscErrorCode (*dvdCallback)(dvdDashboard*);
371: typedef PetscErrorCode (*e_Vchanged_type)(dvdDashboard*,PetscInt s_imm,PetscInt e_imm,PetscInt s_new,PetscInt e_new);
372: typedef PetscBool (*isRestarting_type)(dvdDashboard*);
373: typedef PetscErrorCode (*e_newIteration_type)(dvdDashboard*);
374: typedef PetscErrorCode (*improveX_type)(dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);

376: /* Structures for blas */
377: typedef PetscErrorCode (*DvdReductionPostF)(PetscScalar*,PetscInt,void*);
378: typedef struct {
379:   PetscScalar
380:     *out;               /* final vector */
381:   PetscInt
382:     size_out;           /* size of out */
383:   DvdReductionPostF
384:     f;                  /* function called after the reduction */
385:   void *ptr;
386: } DvdReductionChunk;

388: typedef struct {
389:   PetscScalar
390:     *in,                /* vector to sum-up with more nodes */
391:     *out;               /* final vector */
392:   PetscInt size_in,     /* size of in */
393:     max_size_in;        /* max size of in */
394:   DvdReductionChunk
395:     *ops;               /* vector of reduction operations */
396:   PetscInt
397:     size_ops,           /* size of ops */
398:     max_size_ops;       /* max size of ops */
399:   MPI_Comm comm;        /* MPI communicator */
400: } DvdReduction;

402: typedef struct {
403:   PetscInt i0, i1, i2, ld, s0, e0, s1, e1;
404:   PetscScalar *M;
405: } DvdMult_copy_func;

407: /* Routines for initV step */
408: PETSC_INTERN PetscErrorCode dvd_initV(dvdDashboard *d,dvdBlackboard *b,PetscInt k,PetscInt user,PetscBool krylov);

410: /* Routines for calcPairs step */
411: PETSC_INTERN PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d,dvdBlackboard *b,EPSOrthType orth,IP ipI,PetscInt cX_proj,PetscBool harm);

413: /* Routines for improveX step */
414: PETSC_INTERN PetscErrorCode dvd_improvex_jd(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs,PetscInt cX_impr,PetscBool dynamic);
415: PETSC_INTERN PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d,dvdBlackboard *b,ProjType_t p);
416: PETSC_INTERN PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d,dvdBlackboard *b,PetscInt maxits,PetscReal tol,PetscReal fix);
417: PETSC_INTERN PetscErrorCode dvd_improvex_gd2(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs);
418: PETSC_INTERN PetscErrorCode dvd_improvex_get_eigenvectors(dvdDashboard *d,PetscScalar *pX,
419:   PetscScalar *pY,PetscInt ld,PetscScalar *auxS,PetscInt size_auxS);

421: /* Routines for testConv step */
422: PETSC_INTERN PetscErrorCode dvd_testconv_basic(dvdDashboard *d,dvdBlackboard *b);
423: PETSC_INTERN PetscErrorCode dvd_testconv_slepc(dvdDashboard *d,dvdBlackboard *b);

425: /* Routines for management of V */
426: PETSC_INTERN PetscErrorCode dvd_managementV_basic(dvdDashboard *d,dvdBlackboard *b,PetscInt bs,PetscInt mpd,PetscInt min_size_V,PetscInt plusk,PetscBool harm,PetscBool allResiduals);

428: /* Some utilities */
429: PETSC_INTERN PetscErrorCode dvd_static_precond_PC(dvdDashboard *d,dvdBlackboard *b,PC pc);
430: PETSC_INTERN PetscErrorCode dvd_jacobi_precond(dvdDashboard *d,dvdBlackboard *b);
431: PETSC_INTERN PetscErrorCode dvd_profiler(dvdDashboard *d,dvdBlackboard *b);
432: PETSC_INTERN PetscErrorCode dvd_prof_init();
433: PETSC_INTERN PetscErrorCode dvd_harm_conf(dvdDashboard *d,dvdBlackboard *b,HarmType_t mode,PetscBool fixedTarget,PetscScalar t);

435: /* Methods */
436: PETSC_INTERN PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,HarmType_t harmMode,KSP ksp,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,Method_t method);
437: PETSC_INTERN PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,IP ip,HarmType_t harmMode,PetscBool fixedTarget,PetscScalar t,KSP ksp,PetscReal fix,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,PetscBool dynamic,Method_t method);

439: /* BLAS routines */
440: PETSC_INTERN PetscErrorCode SlepcDenseMatProdTriang(PetscScalar *C,MatType_t sC,PetscInt ldC,const PetscScalar *A,MatType_t sA,PetscInt ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,MatType_t sB,PetscInt ldB,PetscInt rB,PetscInt cB,PetscBool Bt);
441: PETSC_INTERN PetscErrorCode SlepcDenseNorm(PetscScalar *A,PetscInt ldA,PetscInt _rA,PetscInt cA,PetscScalar *eigi);
442: PETSC_INTERN PetscErrorCode SlepcDenseCopy(PetscScalar *Y,PetscInt ldY,PetscScalar *X,PetscInt ldX,PetscInt rX,PetscInt cX);
443: PETSC_INTERN PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y,MatType_t sY,PetscInt ldY,PetscScalar *X,MatType_t sX,PetscInt ldX,PetscInt rX,PetscInt cX);
444: PETSC_INTERN PetscErrorCode SlepcUpdateVectorsZ(Vec *Y,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM);
445: PETSC_INTERN PetscErrorCode SlepcUpdateVectorsS(Vec *Y,PetscInt dY,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,PetscInt dX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM);
446: PETSC_INTERN PetscErrorCode SlepcUpdateVectorsD(Vec *X,PetscInt cX,PetscScalar alpha,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *work,PetscInt lwork);
447: PETSC_INTERN PetscErrorCode VecsMult(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,PetscScalar *workS0,PetscScalar *workS1);
448: PETSC_INTERN PetscErrorCode VecsMultS(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,DvdReduction *r,DvdMult_copy_func *sr);
449: PETSC_INTERN PetscErrorCode VecsMultIb(PetscScalar *M,MatType_t sM,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *auxS,Vec V);
450: PETSC_INTERN PetscErrorCode VecsMultIa(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV);
451: PETSC_INTERN PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,PetscInt max_size_ops,PetscScalar *in,PetscScalar *out,PetscInt max_size_in,DvdReduction *r,MPI_Comm comm);
452: PETSC_INTERN PetscErrorCode SlepcAllReduceSum(DvdReduction *r,PetscInt size_in,DvdReductionPostF f,void *ptr,PetscScalar **in);
453: PETSC_INTERN PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r);
454: PETSC_INTERN PetscErrorCode dvd_orthV(IP ip,Vec *DS,PetscInt size_DS,Vec *cX,PetscInt size_cX,Vec *V,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand);
455: PETSC_INTERN PetscErrorCode dvd_BorthV_faster(IP ip,Vec *DS,Vec *BDS,PetscReal *BDSn,PetscInt size_DS,Vec *cX,Vec *BcX,PetscReal *BcXn,PetscInt size_cX,Vec *V,Vec *BV,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand);
456: PETSC_INTERN PetscErrorCode dvd_BorthV_stable(IP ip,Vec *defl,PetscReal *BDSn,PetscInt size_DS,Vec *cX,PetscReal *BcXn,PetscInt size_cX,Vec *V,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand);

458: /* SLEPc interface routines */
459: PETSC_INTERN PetscErrorCode SLEPcNotImplemented();
460: PETSC_INTERN PetscErrorCode EPSCreate_XD(EPS eps);
461: PETSC_INTERN PetscErrorCode EPSReset_XD(EPS eps);
462: PETSC_INTERN PetscErrorCode EPSSetUp_XD(EPS eps);
463: PETSC_INTERN PetscErrorCode EPSSolve_XD(EPS eps);
464: PETSC_INTERN PetscErrorCode EPSComputeVectors_XD(EPS eps);
465: PETSC_INTERN PetscErrorCode EPSXDSetKrylovStart_XD(EPS eps,PetscBool krylovstart);
466: PETSC_INTERN PetscErrorCode EPSXDGetKrylovStart_XD(EPS eps,PetscBool *krylovstart);
467: PETSC_INTERN PetscErrorCode EPSXDSetBlockSize_XD(EPS eps,PetscInt blocksize);
468: PETSC_INTERN PetscErrorCode EPSXDGetBlockSize_XD(EPS eps,PetscInt *blocksize);
469: PETSC_INTERN PetscErrorCode EPSXDSetRestart_XD(EPS eps,PetscInt minv,PetscInt plusk);
470: PETSC_INTERN PetscErrorCode EPSXDGetRestart_XD(EPS eps,PetscInt *minv,PetscInt *plusk);
471: PETSC_INTERN PetscErrorCode EPSXDGetInitialSize_XD(EPS eps,PetscInt *initialsize);
472: PETSC_INTERN PetscErrorCode EPSXDSetInitialSize_XD(EPS eps,PetscInt initialsize);
473: PETSC_INTERN PetscErrorCode EPSXDGetFix_XD(EPS eps,PetscReal *fix);
474: PETSC_INTERN PetscErrorCode EPSJDSetFix_JD(EPS eps,PetscReal fix);
475: PETSC_INTERN PetscErrorCode EPSXDSetBOrth_XD(EPS eps,EPSOrthType borth);
476: PETSC_INTERN PetscErrorCode EPSXDGetBOrth_XD(EPS eps,EPSOrthType *borth);
477: PETSC_INTERN PetscErrorCode EPSJDSetConstCorrectionTol_JD(EPS eps,PetscBool constant);
478: PETSC_INTERN PetscErrorCode EPSJDGetConstCorrectionTol_JD(EPS eps,PetscBool *constant);
479: PETSC_INTERN PetscErrorCode EPSXDSetWindowSizes_XD(EPS eps,PetscInt pwindow,PetscInt qwindow);
480: PETSC_INTERN PetscErrorCode EPSXDGetWindowSizes_XD(EPS eps,PetscInt *pwindow,PetscInt *qwindow);
481: PETSC_INTERN PetscErrorCode EPSXDSetMethod(EPS eps,Method_t method);
482: PETSC_INTERN PetscErrorCode EPSXDGetMethod_XD(EPS eps,Method_t *method);

484: /* Common inline function */
487: PETSC_STATIC_INLINE PetscErrorCode dvd_improvex_compute_X(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,PetscScalar *pX,PetscInt ld)
488: {
489:   PetscErrorCode  ierr;
490:   PetscInt        n = i_e - i_s,i;

493:   SlepcUpdateVectorsZ(u,0.0,1.0,d->V-d->cX_in_H,d->size_V+d->cX_in_H,&pX[ld*i_s],ld,d->size_H,n);
494:   /* nX(i) <- ||X(i)|| */
495:   if (d->correctXnorm) {
496:     for (i=0; i<n; i++) {
497:       VecNormBegin(u[i],NORM_2,&d->nX[i_s+i]);
498:     }
499:     for (i=0; i<n; i++) {
500:       VecNormEnd(u[i],NORM_2,&d->nX[i_s+i]);
501:     }
502: #if !defined(PETSC_USE_COMPLEX)
503:     for (i=0;i<n;i++) {
504:       if (d->eigi[i_s+i] != 0.0) {
505:         d->nX[i_s+i] = d->nX[i_s+i+1] = PetscSqrtScalar(d->nX[i_s+i]*d->nX[i_s+i]+d->nX[i_s+i+1]*d->nX[i_s+i+1]);
506:         i++;
507:       }
508:     }
509: #endif
510:   } else {
511:     for (i=0; i<n; i++) d->nX[i_s+i] = 1.0;
512:   }
513:   return(0);
514: }


517: #define _Ceil(A,B) ((A)/(B)+((A)%(B)==0?0:1))
518: #define FromIntToScalar(S) ((PetscInt)_Ceil((S)*sizeof(PetscBLASInt),sizeof(PetscScalar)))
519: #define FromRealToScalar(S) ((PetscInt)_Ceil((S)*sizeof(PetscReal),sizeof(PetscScalar)))
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_calcpairs.c0000644000175000017500000012136612211062077024207 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Step: calc the best eigenpairs in the subspace V. For that, performs these steps: 1) Update W <- A * V 2) Update H <- V' * W 3) Obtain eigenpairs of H 4) Select some eigenpairs 5) Compute the Ritz pairs of the selected ones - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" #include PetscErrorCode dvd_calcpairs_proj(dvdDashboard *d); PetscErrorCode dvd_calcpairs_qz_start(dvdDashboard *d); PetscErrorCode dvd_calcpairs_qz_d(dvdDashboard *d); PetscErrorCode dvd_calcpairs_projeig_solve(dvdDashboard *d); PetscErrorCode dvd_calcpairs_selectPairs(dvdDashboard *d,PetscInt n); PetscErrorCode dvd_calcpairs_X(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *X); PetscErrorCode dvd_calcpairs_Y(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *Y); PetscErrorCode dvd_calcpairs_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R); PetscErrorCode dvd_calcpairs_eig_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R); PetscErrorCode dvd_calcpairs_proj_res(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R); PetscErrorCode dvd_calcpairs_updateV0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr); PetscErrorCode dvd_calcpairs_updateV1(dvdDashboard *d); PetscErrorCode dvd_calcpairs_updateW0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr); PetscErrorCode dvd_calcpairs_updateW1(dvdDashboard *d); PetscErrorCode dvd_calcpairs_updateAV0(dvdDashboard *d); PetscErrorCode dvd_calcpairs_updateAV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr); PetscErrorCode dvd_calcpairs_updateBV0(dvdDashboard *d); PetscErrorCode dvd_calcpairs_updateBV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr); PETSC_STATIC_INLINE PetscErrorCode dvd_calcpairs_updateBV0_gen(dvdDashboard *d,Vec *real_BV,PetscInt *size_cX,Vec **BV,PetscInt *size_BV,PetscInt *max_size_BV,PetscBool BV_shift,PetscInt *cX_in_proj,DSMatType MT); /**** Control routines ********************************************************/ #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_qz" PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d,dvdBlackboard *b,EPSOrthType orth,IP ipI,PetscInt cX_proj,PetscBool harm) { PetscErrorCode ierr; PetscInt i,max_cS; PetscBool std_probl,her_probl,ind_probl,her_ind_probl; DSType dstype; const char *prefix; PetscErrorCode (*f)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); void *ctx; PetscFunctionBegin; std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE; her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE; ind_probl = DVD_IS(d->sEP, DVD_EP_INDEFINITE)?PETSC_TRUE:PETSC_FALSE; her_ind_probl = (her_probl || ind_probl)? PETSC_TRUE:PETSC_FALSE; /* Setting configuration constrains */ #if !defined(PETSC_USE_COMPLEX) /* if the last converged eigenvalue is complex its conjugate pair is also converged */ b->max_nev = PetscMax(b->max_nev, d->nev+(her_probl && !d->B?0:1)); #else b->max_nev = PetscMax(b->max_nev, d->nev); #endif b->max_size_proj = PetscMax(b->max_size_proj, b->max_size_V+cX_proj); d->size_real_V = b->max_size_V+b->max_nev; d->W_shift = d->B?PETSC_TRUE:PETSC_FALSE; d->size_real_W = harm?(b->max_size_V+(d->W_shift?b->max_nev:b->max_size_cP)):0; d->size_real_AV = b->max_size_V+b->max_size_cP; d->size_BDS = 0; if (d->B && her_ind_probl && (orth == EPS_ORTH_I || orth == EPS_ORTH_BOPT)) { d->size_real_BV = b->size_V; d->BV_shift = PETSC_TRUE; if (orth == EPS_ORTH_BOPT) d->size_BDS = d->eps->nds; } else if (d->B) { d->size_real_BV = b->max_size_V + b->max_size_P; d->BV_shift = PETSC_FALSE; } else { d->size_real_BV = 0; d->BV_shift = PETSC_FALSE; } b->own_vecs+= d->size_real_V + d->size_real_W + d->size_real_AV + d->size_real_BV + d->size_BDS; b->own_scalars+= b->max_size_proj*b->max_size_proj*2*(std_probl?1:2) + /* H, G?, S, T? */ b->max_nev*b->max_nev*(her_ind_probl?0:(!d->B?1:2)) + /* cS?, cT? */ FromRealToScalar(d->size_real_V)*(ind_probl?1:0) + /* nBV */ FromRealToScalar(b->max_size_proj)*(ind_probl?1:0) + /* nBpX */ (d->eps->arbitrary? b->size_V*2 : 0); /* rr, ri */ b->max_size_auxV = PetscMax(b->max_size_auxV, b->max_size_X); /* updateV0 */ max_cS = PetscMax(b->max_size_X,cX_proj); b->max_size_auxS = PetscMax(PetscMax( b->max_size_auxS, b->max_size_proj*b->max_size_proj*2*(std_probl?1:2) + /* updateAV1,BV1 */ max_cS*b->max_nev*(her_ind_probl?0:(!d->B?1:2)) + /* updateV0,W0 */ /* SlepcReduction: in */ PetscMax( b->max_size_proj*b->max_size_proj*2*(std_probl?1:2) + /* updateAV1,BV1 */ max_cS*b->max_nev*(her_ind_probl?0:(!d->B?1:2)), /* updateV0,W0 */ /* SlepcReduction: out */ PetscMax( b->max_size_proj*b->max_size_proj, /* updateAV0,BV0 */ b->max_size_proj+b->max_nev))), /* dvd_orth */ std_probl?0:(b->max_size_proj*11+16) /* projeig */); #if defined(PETSC_USE_COMPLEX) b->max_size_auxS = PetscMax(b->max_size_auxS, b->max_size_V); /* dvd_calcpairs_projeig_eig */ #endif /* Setup the step */ if (b->state >= DVD_STATE_CONF) { d->max_cX_in_proj = cX_proj; d->max_size_P = b->max_size_P; d->real_V = b->free_vecs; b->free_vecs+= d->size_real_V; if (harm) { d->real_W = b->free_vecs; b->free_vecs+= d->size_real_W; } else { d->real_W = NULL; } d->real_AV = d->AV = b->free_vecs; b->free_vecs+= d->size_real_AV; d->max_size_proj = b->max_size_proj; d->real_H = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj; d->ldH = b->max_size_proj; d->S = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj; if (!her_ind_probl) { d->cS = b->free_scalars; b->free_scalars+= b->max_nev*b->max_nev; d->max_size_cS = d->ldcS = b->max_nev; } else { d->cS = NULL; d->max_size_cS = d->ldcS = 0; d->orthoV_type = orth; if (ind_probl) { d->real_nBV = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(d->size_real_V); d->nBpX = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(d->max_size_proj); } else d->real_nBV = d->nBDS = d->nBpX = NULL; } d->ipV = ipI; d->ipW = ipI; if (orth == EPS_ORTH_BOPT) { d->BDS = b->free_vecs; b->free_vecs+= d->eps->nds; for (i=0; ieps->nds; i++) { ierr = MatMult(d->B, d->eps->defl[i], d->BDS[i]);CHKERRQ(ierr); } } else d->BDS = NULL; if (d->B) { d->real_BV = b->free_vecs; b->free_vecs+= d->size_real_BV; } else { d->size_real_BV = 0; d->real_BV = NULL; d->BV_shift = PETSC_FALSE; } if (!std_probl) { d->real_G = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj; d->T = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj; } else { d->real_G = NULL; d->T = NULL; } if (d->B && !her_ind_probl) { d->cT = b->free_scalars; b->free_scalars+= b->max_nev*b->max_nev; d->ldcT = b->max_nev; } else { d->cT = NULL; d->ldcT = 0; } if (d->eps->arbitrary) { d->eps->rr = b->free_scalars; b->free_scalars+= b->size_V; d->eps->ri = b->free_scalars; b->free_scalars+= b->size_V; } else { d->eps->rr = NULL; d->eps->ri = NULL; } /* Create a DS if the method works with Schur decompositions */ if (d->cS) { ierr = DSCreate(PetscObjectComm((PetscObject)d->eps->ds),&d->conv_ps);CHKERRQ(ierr); ierr = DSSetType(d->conv_ps,d->cT ? DSGNHEP : DSNHEP);CHKERRQ(ierr); /* Transfer as much as possible options from eps->ds to conv_ps */ ierr = DSGetOptionsPrefix(d->eps->ds,&prefix);CHKERRQ(ierr); ierr = DSSetOptionsPrefix(d->conv_ps,prefix);CHKERRQ(ierr); ierr = DSSetFromOptions(d->conv_ps);CHKERRQ(ierr); ierr = DSGetEigenvalueComparison(d->eps->ds,&f,&ctx);CHKERRQ(ierr); ierr = DSSetEigenvalueComparison(d->conv_ps,f,ctx);CHKERRQ(ierr); ierr = DSAllocate(d->conv_ps,b->max_nev);CHKERRQ(ierr); ierr = PetscLogObjectParent(d->eps,d->conv_ps);CHKERRQ(ierr); } else { d->conv_ps = NULL; } d->calcPairs = dvd_calcpairs_proj; d->calcpairs_residual = dvd_calcpairs_res_0; d->calcpairs_residual_eig = dvd_calcpairs_eig_res_0; d->calcpairs_proj_res = dvd_calcpairs_proj_res; d->calcpairs_selectPairs = dvd_calcpairs_selectPairs; d->ipI = ipI; /* Create and configure a DS for solving the projected problems */ if (d->real_W) { /* If we use harmonics */ dstype = DSGNHEP; } else { if (ind_probl) { dstype = DSGHIEP; } else if (std_probl) { dstype = her_probl ? DSHEP : DSNHEP; } else { dstype = her_probl ? DSGHEP : DSGNHEP; } } d->ps = d->eps->ds; ierr = DSSetType(d->ps,dstype);CHKERRQ(ierr); ierr = DSAllocate(d->ps,d->max_size_proj);CHKERRQ(ierr); DVD_FL_ADD(d->startList, dvd_calcpairs_qz_start); DVD_FL_ADD(d->destroyList, dvd_calcpairs_qz_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_qz_start" PetscErrorCode dvd_calcpairs_qz_start(dvdDashboard *d) { PetscBool her_probl,ind_probl,her_ind_probl; PetscInt i; PetscFunctionBegin; her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE; ind_probl = DVD_IS(d->sEP, DVD_EP_INDEFINITE)?PETSC_TRUE:PETSC_FALSE; her_ind_probl = (her_probl || ind_probl)? PETSC_TRUE:PETSC_FALSE; d->size_V = 0; d->V = d->real_V; d->cX = d->real_V; d->size_cX = 0; d->max_size_V = d->size_real_V; d->W = d->real_W; d->max_size_W = d->size_real_W; d->size_W = 0; d->size_AV = 0; d->AV = d->real_AV; d->max_size_AV = d->size_real_AV; d->size_H = 0; d->H = d->real_H; if (d->cS) for (i=0; imax_size_cS*d->max_size_cS; i++) d->cS[i] = 0.0; d->size_BV = 0; d->BV = d->real_BV; d->max_size_BV = d->size_real_BV; d->size_G = 0; d->G = d->real_G; if (d->cT) for (i=0; imax_size_cS*d->max_size_cS; i++) d->cT[i] = 0.0; d->cY = d->B && !her_ind_probl ? d->W : NULL; d->BcX = d->orthoV_type == EPS_ORTH_I && d->B && her_probl ? d->BcX : NULL; d->size_cY = 0; d->size_BcX = 0; d->cX_in_V = d->cX_in_H = d->cX_in_G = d->cX_in_W = d->cX_in_AV = d->cX_in_BV = 0; d->nBV = d->nBcX = d->real_nBV; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_qz_d" PetscErrorCode dvd_calcpairs_qz_d(dvdDashboard *d) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSDestroy(&d->conv_ps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_proj" PetscErrorCode dvd_calcpairs_proj(dvdDashboard *d) { PetscErrorCode ierr; DvdReduction r; #define MAX_OPS 7 DvdReductionChunk ops[MAX_OPS]; DvdMult_copy_func sr[MAX_OPS], *sr0 = sr; PetscInt size_in, i; PetscScalar *in = d->auxS, *out; PetscBool stdp; PetscFunctionBegin; stdp = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE; size_in = (d->size_cX+d->V_tra_s-d->cX_in_H)*d->V_tra_s*(d->cT?2:(d->cS?1:0)) + /* updateV0,W0 */ (d->size_H*(d->V_new_e-d->V_new_s)*2+ (d->V_new_e-d->V_new_s)*(d->V_new_e-d->V_new_s))*(!stdp?2:1); /* updateAV1,BV1 */ out = in+size_in; /* Check consistency */ if (2*size_in > d->size_auxS) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* Prepare reductions */ ierr = SlepcAllReduceSumBegin(ops, MAX_OPS, in, out, size_in, &r, PetscObjectComm((PetscObject)d->V[0]));CHKERRQ(ierr); /* Allocate size_in */ d->auxS+= size_in; d->size_auxS-= size_in; /* Update AV, BV, W and the projected matrices */ /* 1. S <- S*MT */ ierr = dvd_calcpairs_updateV0(d, &r, &sr0);CHKERRQ(ierr); ierr = dvd_calcpairs_updateW0(d, &r, &sr0);CHKERRQ(ierr); ierr = dvd_calcpairs_updateAV0(d);CHKERRQ(ierr); ierr = dvd_calcpairs_updateBV0(d);CHKERRQ(ierr); /* 2. V <- orth(V, V_new) */ ierr = dvd_calcpairs_updateV1(d);CHKERRQ(ierr); /* 3. AV <- [AV A * V(V_new_s:V_new_e-1)] */ /* Check consistency */ if (d->size_AV != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); for (i=d->V_new_s; iV_new_e; i++) { ierr = MatMult(d->A, d->V[i], d->AV[i]);CHKERRQ(ierr); } d->size_AV = d->V_new_e; /* 4. BV <- [BV B * V(V_new_s:V_new_e-1)] */ if (d->B && d->orthoV_type != EPS_ORTH_BOPT) { /* Check consistency */ if (d->size_BV != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); for (i=d->V_new_s; iV_new_e; i++) { ierr = MatMult(d->B, d->V[i], d->BV[i]);CHKERRQ(ierr); } d->size_BV = d->V_new_e; } /* 5 <- W <- [W f(AV,BV)] */ ierr = dvd_calcpairs_updateW1(d);CHKERRQ(ierr); ierr = dvd_calcpairs_updateAV1(d, &r, &sr0);CHKERRQ(ierr); ierr = dvd_calcpairs_updateBV1(d, &r, &sr0);CHKERRQ(ierr); /* Deallocate size_in */ d->auxS-= size_in; d->size_auxS+= size_in; /* Do reductions */ ierr = SlepcAllReduceSumEnd(&r);CHKERRQ(ierr); /* Perform the transformation on the projected problem */ if (d->calcpairs_proj_trans) { ierr = d->calcpairs_proj_trans(d);CHKERRQ(ierr); } d->V_tra_s = d->V_tra_e = 0; d->V_new_s = d->V_new_e; /* Solve the projected problem */ if (d->size_H>0) { ierr = dvd_calcpairs_projeig_solve(d);CHKERRQ(ierr); } /* Check consistency */ if (d->size_V != d->V_new_e || d->size_V+d->cX_in_H != d->size_H || d->cX_in_V != d->cX_in_H || d->size_V != d->size_AV || d->cX_in_H != d->cX_in_AV || (DVD_ISNOT(d->sEP, DVD_EP_STD) && ( d->size_V+d->cX_in_G != d->size_G || d->cX_in_H != d->cX_in_G || d->size_H != d->size_G || (d->BV && ( d->size_V != d->size_BV || d->cX_in_H != d->cX_in_BV)))) || (d->W && d->size_W != d->size_V)) { SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); } PetscFunctionReturn(0); #undef MAX_OPS } /**** Basic routines **********************************************************/ #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateV0" /* auxV: V_tra_s, DvdMult_copy_func: 1 */ PetscErrorCode dvd_calcpairs_updateV0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr) { PetscErrorCode ierr; PetscInt rm,i,ld; PetscScalar *pQ; PetscFunctionBegin; if (d->V_tra_s == 0 && d->V_tra_e == 0) PetscFunctionReturn(0); /* Update nBcX and nBV */ if (d->nBcX && d->nBpX && d->nBV) { d->nBV+= d->V_tra_s; for (i=0; iV_tra_s; i++) d->nBcX[d->size_cX+i] = d->nBpX[i]; for (i=d->V_tra_s; iV_tra_e; i++) d->nBV[i-d->V_tra_s] = d->nBpX[i]; } /* cX <- [cX V*MT(0:V_tra_s-1)], V <- V*MT(V_tra_s:V_tra_e) */ ierr = dvd_calcpairs_updateBV0_gen(d,d->real_V,&d->size_cX,&d->V,&d->size_V,&d->max_size_V,PETSC_TRUE,&d->cX_in_V,DS_MAT_Q);CHKERRQ(ierr); /* Udpate cS for standard problems */ if (d->cS && !d->cT && !d->cY && (d->V_tra_s > d->max_cX_in_proj || d->size_cX >= d->nev)) { /* Check consistency */ if (d->size_cS+d->V_tra_s != d->size_cX) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* auxV <- AV * ps.Q(0:V_tra_e-1) */ rm = d->size_cX>=d->nev?0:d->max_cX_in_proj; ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->AV-d->cX_in_AV,d->size_AV+d->cX_in_AV,pQ,ld,d->size_MT,d->V_tra_s-rm);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); /* cS(:, size_cS:) <- cX' * auxV */ ierr = VecsMultS(&d->cS[d->ldcS*d->size_cS], 0, d->ldcS, d->cX, 0, d->size_cX-rm, d->auxV, 0, d->V_tra_s-rm, r, (*sr)++);CHKERRQ(ierr); d->size_cS+= d->V_tra_s-rm; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateV1" /* auxS: size_cX+V_new_e+1 */ PetscErrorCode dvd_calcpairs_updateV1(dvdDashboard *d) { PetscErrorCode ierr; Vec *cX = d->BcX? d->BcX : ((d->cY && !d->W)? d->cY : d->cX); PetscFunctionBegin; if (d->V_new_s == d->V_new_e) PetscFunctionReturn(0); /* Check consistency */ if (d->size_V != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* V <- gs([cX V(0:V_new_s-1)], V(V_new_s:V_new_e-1)) */ if (d->orthoV_type == EPS_ORTH_BOPT) { ierr = dvd_BorthV_faster(d->ipV,d->eps->defl,d->BDS,d->nBDS,d->eps->nds,d->cX,d->real_BV,d->nBcX,d->size_cX,d->V,d->BV,d->nBV,d->V_new_s,d->V_new_e,d->auxS,d->eps->rand);CHKERRQ(ierr); d->size_BV = d->V_new_e; } else if (DVD_IS(d->sEP, DVD_EP_INDEFINITE)) { ierr = dvd_BorthV_stable(d->ipV,d->eps->defl,d->nBDS,d->eps->nds,d->cX,d->nBcX,d->size_cX,d->V,d->nBV,d->V_new_s,d->V_new_e,d->auxS,d->eps->rand);CHKERRQ(ierr); } else { ierr = dvd_orthV(d->ipV,d->eps->defl,d->eps->nds,cX,d->size_cX,d->V,d->V_new_s,d->V_new_e,d->auxS,d->eps->rand);CHKERRQ(ierr); } d->size_V = d->V_new_e; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateW0" /* auxV: V_tra_s, DvdMult_copy_func: 2 */ PetscErrorCode dvd_calcpairs_updateW0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr) { PetscErrorCode ierr; PetscInt rm,ld; PetscScalar *pQ; PetscFunctionBegin; if (d->V_tra_s == 0 && d->V_tra_e == 0) PetscFunctionReturn(0); /* cY <- [cY W*ps.Z(0:V_tra_s-1)], W <- W*ps.Z(V_tra_s:V_tra_e) */ ierr = dvd_calcpairs_updateBV0_gen(d,d->real_W,&d->size_cY,&d->W,&d->size_W,&d->max_size_W,d->W_shift,&d->cX_in_W,DS_MAT_Z);CHKERRQ(ierr); /* Udpate cS and cT */ if (d->cT && (d->V_tra_s > d->max_cX_in_proj || d->size_cX >= d->nev)) { /* Check consistency */ if (d->size_cS+d->V_tra_s != d->size_cX || (d->W && d->size_cY != d->size_cX)) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); /* auxV <- AV * ps.Q(0:V_tra_e-1) */ rm = d->size_cX>=d->nev?0:d->max_cX_in_proj; ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->AV-d->cX_in_H,d->size_AV-d->cX_in_H,pQ,ld,d->size_MT,d->V_tra_s-rm);CHKERRQ(ierr); /* cS(:, size_cS:) <- cY' * auxV */ ierr = VecsMultS(&d->cS[d->ldcS*d->size_cS], 0, d->ldcS, d->cY?d->cY:d->cX, 0, d->size_cX-rm, d->auxV, 0, d->V_tra_s-rm, r, (*sr)++);CHKERRQ(ierr); /* auxV <- BV * ps.Q(0:V_tra_e-1) */ ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->BV-d->cX_in_H,d->size_BV-d->cX_in_H,pQ,ld,d->size_MT,d->V_tra_s-rm);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); /* cT(:, size_cS:) <- cY' * auxV */ ierr = VecsMultS(&d->cT[d->ldcS*d->size_cS], 0, d->ldcS, d->cY?d->cY:d->cX, 0, d->size_cX-rm, d->auxV, 0, d->V_tra_s-rm, r, (*sr)++);CHKERRQ(ierr); d->size_cS+= d->V_tra_s-rm; d->size_cT+= d->V_tra_s-rm; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateW1" /* auxS: size_cX+V_new_e+1 */ PetscErrorCode dvd_calcpairs_updateW1(dvdDashboard *d) { PetscErrorCode ierr; Vec *cY = d->cY?d->cY:d->cX; PetscFunctionBegin; if (!d->W || d->V_new_s == d->V_new_e) PetscFunctionReturn(0); /* Check consistency */ if (d->size_W != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* Update W */ ierr = d->calcpairs_W(d);CHKERRQ(ierr); /* W <- gs([cY W(0:V_new_s-1)], W(V_new_s:V_new_e-1)) */ ierr = dvd_orthV(d->ipW, NULL, 0, cY, d->size_cX, d->W-d->cX_in_W, d->V_new_s+d->cX_in_W, d->V_new_e+d->cX_in_W, d->auxS, d->eps->rand);CHKERRQ(ierr); d->size_W = d->V_new_e; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateAV0" /* auxS: size_H*(V_tra_e-V_tra_s) */ PetscErrorCode dvd_calcpairs_updateAV0(dvdDashboard *d) { PetscErrorCode ierr; PetscInt cMT,tra_s,ld; PetscScalar *pQ,*pZ; PetscFunctionBegin; if (d->V_tra_s == 0 && d->V_tra_e == 0) PetscFunctionReturn(0); /* AV(V_tra_s-cp-1:) = cAV*ps.Q(V_tra_s:) */ ierr = dvd_calcpairs_updateBV0_gen(d,d->real_AV,NULL,&d->AV,&d->size_AV,&d->max_size_AV,PETSC_FALSE,&d->cX_in_AV,DS_MAT_Q);CHKERRQ(ierr); tra_s = PetscMax(d->V_tra_s-d->max_cX_in_proj,0); cMT = d->V_tra_e - tra_s; /* Update H <- ps.Z(tra_s)' * (H * ps.Q(tra_s:)) */ ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (d->W) { ierr = DSGetArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } else pZ = pQ; ierr = SlepcDenseMatProdTriang(d->auxS,0,d->ldH,d->H,d->sH,d->ldH,d->size_H,d->size_H,PETSC_FALSE,&pQ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_FALSE);CHKERRQ(ierr); ierr = SlepcDenseMatProdTriang(d->H,d->sH,d->ldH,&pZ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_TRUE,d->auxS,0,d->ldH,d->size_H,cMT,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (d->W) { ierr = DSRestoreArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } d->size_H = cMT; d->cX_in_H = d->cX_in_AV; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateAV1" /* DvdMult_copy_func: 2 */ PetscErrorCode dvd_calcpairs_updateAV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr) { PetscErrorCode ierr; Vec *W = d->W?d->W:d->V; PetscFunctionBegin; if (d->V_new_s == d->V_new_e) PetscFunctionReturn(0); /* Check consistency */ if (d->size_H != d->V_new_s+d->cX_in_H || d->size_V != d->V_new_e) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* H = [H W(old)'*AV(new); W(new)'*AV(old) W(new)'*AV(new) ], being old=0:V_new_s-1, new=V_new_s:V_new_e-1 */ ierr = VecsMultS(d->H,d->sH,d->ldH,W-d->cX_in_H,d->V_new_s+d->cX_in_H, d->V_new_e+d->cX_in_H, d->AV-d->cX_in_H,d->V_new_s+d->cX_in_H,d->V_new_e+d->cX_in_H, r, (*sr)++);CHKERRQ(ierr); d->size_H = d->V_new_e+d->cX_in_H; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateBV0" /* auxS: max(BcX*(size_cX+V_new_e+1), size_G*(V_tra_e-V_tra_s)) */ PetscErrorCode dvd_calcpairs_updateBV0(dvdDashboard *d) { PetscErrorCode ierr; PetscInt cMT,tra_s,i,ld; PetscBool lindep; PetscReal norm; PetscScalar *pQ,*pZ; PetscFunctionBegin; if (d->V_tra_s == 0 && d->V_tra_e == 0) PetscFunctionReturn(0); /* BV <- BV*MT */ ierr = dvd_calcpairs_updateBV0_gen(d,d->real_BV,NULL,&d->BV,&d->size_BV,&d->max_size_BV,d->BV_shift,&d->cX_in_BV,DS_MAT_Q);CHKERRQ(ierr); /* If BcX, BcX <- orth(BcX) */ if (d->BcX) { for (i=0; iV_tra_s; i++) { ierr = IPOrthogonalize(d->ipI, 0, NULL, d->size_BcX+i, NULL, d->BcX, d->BcX[d->size_BcX+i], NULL, &norm, &lindep);CHKERRQ(ierr); if (lindep) SETERRQ(PETSC_COMM_SELF,1, "Error during orth(BcX, B*cX(new))"); ierr = VecScale(d->BcX[d->size_BcX+i], 1.0/norm);CHKERRQ(ierr); } d->size_BcX+= d->V_tra_s; } /* Update G <- ps.Z' * (G * ps.Q) */ if (d->G) { tra_s = PetscMax(d->V_tra_s-d->max_cX_in_proj,0); cMT = d->V_tra_e - tra_s; ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (d->W) { ierr = DSGetArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } else pZ = pQ; ierr = SlepcDenseMatProdTriang(d->auxS,0,d->ldH,d->G,d->sG,d->ldH,d->size_G,d->size_G,PETSC_FALSE,&pQ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_FALSE);CHKERRQ(ierr); ierr = SlepcDenseMatProdTriang(d->G,d->sG,d->ldH,&pZ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_TRUE,d->auxS,0,d->ldH,d->size_G,cMT,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (d->W) { ierr = DSRestoreArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } d->size_G = cMT; d->cX_in_G = d->cX_in_V; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateBV1" /* DvdMult_copy_func: 2 */ PetscErrorCode dvd_calcpairs_updateBV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr) { PetscErrorCode ierr; Vec *W = d->W?d->W:d->V, *BV = d->BV?d->BV:d->V; PetscFunctionBegin; if (!d->G || d->V_new_s == d->V_new_e) PetscFunctionReturn(0); /* G = [G W(old)'*BV(new); W(new)'*BV(old) W(new)'*BV(new) ], being old=0:V_new_s-1, new=V_new_s:V_new_e-1 */ ierr = VecsMultS(d->G,d->sG,d->ldH,W-d->cX_in_G,d->V_new_s+d->cX_in_G,d->V_new_e+d->cX_in_G,BV-d->cX_in_G,d->V_new_s+d->cX_in_G,d->V_new_e+d->cX_in_G,r,(*sr)++);CHKERRQ(ierr); d->size_G = d->V_new_e+d->cX_in_G; PetscFunctionReturn(0); } /* in complex, d->size_H real auxiliar values are needed */ #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_projeig_solve" PetscErrorCode dvd_calcpairs_projeig_solve(dvdDashboard *d) { PetscErrorCode ierr; PetscScalar *A; PetscInt ld,i; PetscFunctionBegin; ierr = DSSetDimensions(d->ps,d->size_H,0,0,0);CHKERRQ(ierr); ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_A,&A);CHKERRQ(ierr); ierr = SlepcDenseCopyTriang(A,0,ld,d->H,d->sH,d->ldH,d->size_H,d->size_H);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_A,&A);CHKERRQ(ierr); if (d->G) { ierr = DSGetArray(d->ps,DS_MAT_B,&A);CHKERRQ(ierr); ierr = SlepcDenseCopyTriang(A,0,ld,d->G,d->sG,d->ldH,d->size_H,d->size_H);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_B,&A);CHKERRQ(ierr); } /* Set the signature on projected matrix B */ if (DVD_IS(d->sEP, DVD_EP_INDEFINITE)) { ierr = DSGetArray(d->ps,DS_MAT_B,&A);CHKERRQ(ierr); ierr = PetscMemzero(A,sizeof(PetscScalar)*d->size_H*ld);CHKERRQ(ierr); for (i=0; isize_H; i++) { A[i+ld*i] = d->nBV[i]; } ierr = DSRestoreArray(d->ps,DS_MAT_B,&A);CHKERRQ(ierr); } ierr = DSSetState(d->ps,DS_STATE_RAW);CHKERRQ(ierr); ierr = DSSolve(d->ps,d->eigr-d->cX_in_H,d->eigi-d->cX_in_H);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_apply_arbitrary" PetscErrorCode dvd_calcpairs_apply_arbitrary(dvdDashboard *d,PetscInt r_s,PetscInt r_e,PetscScalar **rr_,PetscScalar **ri_) { PetscInt i,k,ld; PetscScalar *pX,*rr,*ri,ar,ai; Vec *X = d->auxV,xr,xi; PetscErrorCode ierr; #if !defined(PETSC_USE_COMPLEX) PetscInt j; #endif PetscFunctionBegin; /* Quick exit without neither arbitrary selection nor harmonic extraction */ if (!d->eps->arbitrary && !d->calcpairs_eig_backtrans) { *rr_ = d->eigr-d->cX_in_H; *ri_ = d->eigi-d->cX_in_H; PetscFunctionReturn(0); } /* Quick exit without arbitrary selection, but with harmonic extraction */ if (!d->eps->arbitrary && d->calcpairs_eig_backtrans) { *rr_ = rr = d->auxS; *ri_ = ri = d->auxS+r_e-r_s; for (i=r_s; icalcpairs_eig_backtrans(d,d->eigr[i],d->eigi[i],&rr[i-r_s],&ri[i-r_s]);CHKERRQ(ierr); } PetscFunctionReturn(0); } ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); *rr_ = rr = d->eps->rr + d->eps->nconv; *ri_ = ri = d->eps->ri + d->eps->nconv; for (i=r_s; ips,DS_MAT_X,&k,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->ps,DS_MAT_X,i);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = dvd_improvex_compute_X(d,i,k+1,X,pX,ld);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_X,&pX);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (d->nX[i] != 1.0) { for (j=i; jnX[i]);CHKERRQ(ierr); } } xr = X[0]; xi = X[1]; if (i == k) { ierr = VecZeroEntries(xi);CHKERRQ(ierr); } #else xr = X[0]; xi = NULL; if (d->nX[i] != 1.0) { ierr = VecScale(xr,1.0/d->nX[i]);CHKERRQ(ierr); } #endif if (d->calcpairs_eig_backtrans) { ierr = d->calcpairs_eig_backtrans(d,d->eigr[i],d->eigi[i],&ar,&ai);CHKERRQ(ierr); } else { ar = d->eigr[i]; ai = d->eigi[i]; } ierr = (d->eps->arbitrary)(ar,ai,xr,xi,&rr[i-r_s],&ri[i-r_s],d->eps->arbitraryctx);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (i != k) { rr[i+1-r_s] = rr[i-r_s]; ri[i+1-r_s] = ri[i-r_s]; i++; } #endif } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_selectPairs" PetscErrorCode dvd_calcpairs_selectPairs(dvdDashboard *d,PetscInt n) { PetscInt k; PetscScalar *rr,*ri; PetscErrorCode ierr; PetscFunctionBegin; n = PetscMin(n,d->size_H-d->cX_in_H); /* Put the best n pairs at the beginning. Useful for restarting */ ierr = DSSetDimensions(d->ps,0,0,d->cX_in_H,0);CHKERRQ(ierr); ierr = dvd_calcpairs_apply_arbitrary(d,d->cX_in_H,d->size_H,&rr,&ri);CHKERRQ(ierr); k = n; ierr = DSSort(d->ps,d->eigr-d->cX_in_H,d->eigi-d->cX_in_H,rr,ri,&k);CHKERRQ(ierr); /* Put the best pair at the beginning. Useful to check its residual */ #if !defined(PETSC_USE_COMPLEX) if (n != 1 && (n != 2 || d->eigi[0] == 0.0)) #else if (n != 1) #endif { ierr = dvd_calcpairs_apply_arbitrary(d,d->cX_in_H,d->size_H,&rr,&ri);CHKERRQ(ierr); k = 1; ierr = DSSort(d->ps,d->eigr-d->cX_in_H,d->eigi-d->cX_in_H,rr,ri,&k);CHKERRQ(ierr); } if (d->calcpairs_eigs_trans) { ierr = d->calcpairs_eigs_trans(d);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_res_0" /* Compute the residual vectors R(i) <- (AV - BV*eigr(i))*pX(i), and also the norm associated to the Schur pair, where i = r_s..r_e */ PetscErrorCode dvd_calcpairs_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R) { PetscInt i,ldpX; PetscScalar *pX; PetscErrorCode ierr; Vec *BV = d->BV?d->BV:d->V; PetscFunctionBegin; ierr = DSGetLeadingDimension(d->ps,&ldpX);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pX);CHKERRQ(ierr); for (i=r_s; icorrectXnorm) { /* R(i) <- V*pX(i) */ ierr = SlepcUpdateVectorsZ(&R[i-r_s],0.0,1.0,&d->V[-d->cX_in_H],d->size_V+d->cX_in_H,&pX[ldpX*(i+d->cX_in_H)],ldpX,d->size_H,1);CHKERRQ(ierr); ierr = VecNorm(R[i-r_s],NORM_2,&d->nX[i]);CHKERRQ(ierr); } else d->nX[i] = 1.0; /* R(i-r_s) <- AV*pX(i) */ ierr = SlepcUpdateVectorsZ(&R[i-r_s],0.0,1.0,&d->AV[-d->cX_in_H],d->size_AV+d->cX_in_H,&pX[ldpX*(i+d->cX_in_H)],ldpX,d->size_H,1);CHKERRQ(ierr); /* R(i-r_s) <- R(i-r_s) - eigr(i)*BV*pX(i) */ ierr = SlepcUpdateVectorsZ(&R[i-r_s],1.0,-d->eigr[i+d->cX_in_H],&BV[-d->cX_in_H],d->size_V+d->cX_in_H,&pX[ldpX*(i+d->cX_in_H)],ldpX,d->size_H,1);CHKERRQ(ierr); } ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pX);CHKERRQ(ierr); ierr = d->calcpairs_proj_res(d, r_s, r_e, R);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_proj_res" PetscErrorCode dvd_calcpairs_proj_res(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R) { PetscInt i; PetscErrorCode ierr; PetscBool lindep; Vec *cX; PetscFunctionBegin; /* If exists the BcX, R <- orth(BcX, R), nR[i] <- ||R[i]|| */ if (d->BcX) cX = d->BcX; /* If exists left subspace, R <- orth(cY, R), nR[i] <- ||R[i]|| */ else if (d->cY) cX = d->cY; /* If fany configurations, R <- orth(cX, R), nR[i] <- ||R[i]|| */ else if (!(DVD_IS(d->sEP, DVD_EP_STD) && DVD_IS(d->sEP, DVD_EP_HERMITIAN))) cX = d->cX; /* Otherwise, nR[i] <- ||R[i]|| */ else cX = NULL; if (cX) { if (cX && d->orthoV_type == EPS_ORTH_BOPT) { Vec auxV; ierr = VecDuplicate(d->auxV[0],&auxV);CHKERRQ(ierr); for (i=0; iipV,d->eps->nds,d->eps->defl,d->BDS,d->nBDS,d->size_cX,NULL,d->cX,d->real_BV,d->nBcX,R[i],auxV,NULL,&d->nR[r_s+i],&lindep);CHKERRQ(ierr); } ierr = VecDestroy(&auxV);CHKERRQ(ierr); } else if (DVD_IS(d->sEP, DVD_EP_INDEFINITE)) { for (i=0; iipV,d->size_cX,cX,d->nBcX,R[i],NULL,&d->nR[r_s+i],&lindep);CHKERRQ(ierr); } } else { for (i=0; iipI,0,NULL,d->size_cX,NULL,cX,R[i],NULL,&d->nR[r_s+i],&lindep);CHKERRQ(ierr); } } if (lindep || (PetscAbs(d->nR[r_s+i]) < PETSC_MACHINE_EPSILON)) { ierr = PetscInfo2(d->eps,"The computed eigenvector residual %D is too low, %G!\n",r_s+i,d->nR[r_s+i]);CHKERRQ(ierr); } } if (!cX || (cX && d->orthoV_type == EPS_ORTH_BOPT)) { for (i=0;inR[r_s+i]);CHKERRQ(ierr); } for (i=0;inR[r_s+i]);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_eig_res_0" /* Compute the residual vectors R(i) <- (AV - BV*eigr(i))*pX(i), and also the norm associated to the eigenpair, where i = r_s..r_e R, vectors of Vec of size r_e-r_s, auxV, PetscMax(r_e+cX_in_H, 2*(r_e-r_s)) vectors, auxS, auxiliar vector of size (d->size_cX+r_e)^2+6(d->size_cX+r_e)+(r_e-r_s)*d->size_H */ PetscErrorCode dvd_calcpairs_eig_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R) { PetscInt i,size_in,n,ld,ldc,k; PetscErrorCode ierr; Vec *Bx; PetscScalar *cS,*cT,*pcX,*pX,*pX0; DvdReduction r; DvdReductionChunk ops[2]; DvdMult_copy_func sr[2]; #if !defined(PETSC_USE_COMPLEX) PetscScalar b[8]; Vec X[4]; #endif PetscFunctionBegin; /* Quick return */ if (!d->cS) PetscFunctionReturn(0); size_in = (d->size_cX+r_e)*(d->cX_in_AV+r_e)*(d->cT?2:1); /* Check consistency */ if (d->size_auxV < PetscMax(2*(r_e-r_s),d->cX_in_AV+r_e) || d->size_auxS < PetscMax(d->size_H*(r_e-r_s) /* pX0 */, 2*size_in /* SlepcAllReduceSum */)) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken"); /* Compute expanded cS = conv_ps.A, cT = conv_ps.B: conv_ps.A = [ cX'*A*cX cX'*A*X ] [ X'*A*cX X'*A*X ], where cX'*A*cX = cS and X = V*ps.Q */ n = d->size_cX+r_e; ierr = DSSetDimensions(d->conv_ps,n,0,0,0);CHKERRQ(ierr); ierr = DSGetLeadingDimension(d->conv_ps,&ldc);CHKERRQ(ierr); ierr = DSGetArray(d->conv_ps,DS_MAT_A,&cS);CHKERRQ(ierr); ierr = SlepcDenseCopyTriang(cS,0,ldc,d->cS,0,d->ldcS,d->size_cS,d->size_cS);CHKERRQ(ierr); if (d->cT) { ierr = DSGetArray(d->conv_ps,DS_MAT_B,&cT);CHKERRQ(ierr); ierr = SlepcDenseCopyTriang(cT,0,ldc,d->cT,0,d->ldcT,d->size_cS,d->size_cS);CHKERRQ(ierr); } ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pX);CHKERRQ(ierr); /* Prepare reductions */ ierr = SlepcAllReduceSumBegin(ops,2,d->auxS,d->auxS+size_in,size_in,&r,PetscObjectComm((PetscObject)d->V[0]));CHKERRQ(ierr); /* auxV <- A*X = AV * pX(0:r_e+cX_in_H) */ ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->AV-d->cX_in_AV,d->size_AV+d->cX_in_AV,pX,ld,d->size_H,d->cX_in_AV+r_e);CHKERRQ(ierr); /* cS(:, size_cS:) <- cX' * auxV */ ierr = VecsMultS(&cS[ldc*d->size_cS],0,ldc,d->cY?d->cY:d->cX,0,d->size_cX+r_e,d->auxV,0,d->cX_in_AV+r_e,&r,&sr[0]);CHKERRQ(ierr); if (d->cT) { /* R <- BV * pX(0:r_e+cX_in_H) */ ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->BV-d->cX_in_BV,d->size_BV+d->cX_in_BV,pX,ld,d->size_G,d->cX_in_BV+r_e);CHKERRQ(ierr); /* cT(:, size_cS:) <- cX' * auxV */ ierr = VecsMultS(&cT[ldc*d->size_cT],0,ldc,d->cY?d->cY:d->cX,0,d->size_cY+r_e,d->auxV,0,d->cX_in_BV+r_e,&r,&sr[1]);CHKERRQ(ierr); } /* Do reductions */ ierr = SlepcAllReduceSumEnd(&r);CHKERRQ(ierr); ierr = DSRestoreArray(d->conv_ps,DS_MAT_A,&cS);CHKERRQ(ierr); if (d->cT) { ierr = DSRestoreArray(d->conv_ps,DS_MAT_B,&cT);CHKERRQ(ierr); } ierr = DSSetState(d->conv_ps,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); /* eig(S,T) */ k = d->size_cX+r_s; ierr = DSVectors(d->conv_ps,DS_MAT_X,&k,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->conv_ps,DS_MAT_X,d->size_cX+r_s);CHKERRQ(ierr); /* pX0 <- ps.Q(0:d->cX_in_AV+r_e-1) * conv_ps.X(size_cX-cX_in_H:) */ pX0 = d->auxS; ierr = DSGetArray(d->conv_ps,DS_MAT_X,&pcX);CHKERRQ(ierr); ierr = SlepcDenseMatProd(pX0,d->size_H,0.0,1.0,&pX[(d->cX_in_AV+r_s)*ld],ld,d->size_H,r_e-r_s,PETSC_FALSE,&pcX[d->size_cX+d->size_cX*ldc],ldc,r_e+d->cX_in_H,r_e-r_s,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pX);CHKERRQ(ierr); /* auxV <- cX(0:size_cX-cX_in_AV)*conv_ps.X + V*pX0 */ ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->cX,d->size_cX,&pcX[d->size_cX*ldc],ldc,d->size_cX,r_e-r_s);CHKERRQ(ierr); ierr = DSRestoreArray(d->conv_ps,DS_MAT_X,&pcX);CHKERRQ(ierr); ierr = SlepcUpdateVectorsZ(d->auxV,(d->size_cX-d->cX_in_AV==0)?0.0:1.0,1.0,d->V-d->cX_in_AV,d->size_V+d->cX_in_AV,pX0,d->size_H,d->size_H,r_e-r_s);CHKERRQ(ierr); /* nX <- ||auxV|| */ for (i=0;iauxV[i],NORM_2,&d->nX[r_s+i]);CHKERRQ(ierr); } for (i=0;iauxV[i],NORM_2,&d->nX[r_s+i]);CHKERRQ(ierr); } /* R <- A*auxV */ for (i=0; iA,d->auxV[i],R[i]);CHKERRQ(ierr); } /* Bx <- B*auxV */ if (d->B) { Bx = &d->auxV[r_e-r_s]; for (i=0; iB,d->auxV[i],Bx[i]);CHKERRQ(ierr); } } else Bx = d->auxV; /* R <- (A - eig*B)*V*pX */ for (i=0;ieigi[r_s+i] != 0.0) { /* [Ax_i Ax_i+1 Bx_i Bx_i+1]*= [ 1 0 0 1 -eigr_i -eigi_i eigi_i -eigr_i] */ b[0] = b[5] = 1.0; b[2] = b[7] = -d->eigr[r_s+i]; b[6] = -(b[3] = d->eigi[r_s+i]); b[1] = b[4] = 0.0; X[0] = R[i]; X[1] = R[i+1]; X[2] = Bx[i]; X[3] = Bx[i+1]; ierr = SlepcUpdateVectorsD(X,4,1.0,b,4,4,2,d->auxS,d->size_auxS);CHKERRQ(ierr); i++; } else #endif { /* R <- Ax -eig*Bx */ ierr = VecAXPBY(R[i], -d->eigr[r_s+i], 1.0, Bx[i]);CHKERRQ(ierr); } } /* nR <- ||R|| */ for (i=0;inR[r_s+i]);CHKERRQ(ierr); } for (i=0;inR[r_s+i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } /**** Pattern routines ********************************************************/ /* BV <- BV*MT */ #undef __FUNCT__ #define __FUNCT__ "dvd_calcpairs_updateBV0_gen" PETSC_STATIC_INLINE PetscErrorCode dvd_calcpairs_updateBV0_gen(dvdDashboard *d,Vec *real_BV,PetscInt *size_cBV,Vec **BV,PetscInt *size_BV,PetscInt *max_size_BV,PetscBool BV_shift,PetscInt *cX_in_proj,DSMatType mat) { PetscErrorCode ierr; PetscInt cMT,rm,cp,tra_s,i,ld; Vec *nBV; PetscScalar *MT; PetscFunctionBegin; if (!real_BV || !*BV || (d->V_tra_s == 0 && d->V_tra_e == 0)) PetscFunctionReturn(0); ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,mat,&MT);CHKERRQ(ierr); if (d->V_tra_s > d->max_cX_in_proj && !BV_shift) { tra_s = PetscMax(d->V_tra_s-d->max_cX_in_proj, 0); cMT = d->V_tra_e - tra_s; rm = d->V_tra_s - tra_s; cp = PetscMin(d->max_cX_in_proj - rm, *cX_in_proj); nBV = real_BV+d->max_cX_in_proj; /* BV(-cp-rm:-1-rm) <- BV(-cp:-1) */ for (i=-cp; i<0; i++) { ierr = VecCopy((*BV)[i], nBV[i-rm]);CHKERRQ(ierr); } /* BV(-rm:) <- BV*MT(tra_s:V_tra_e-1) */ ierr = SlepcUpdateVectorsZ(&nBV[-rm],0.0,1.0,*BV-*cX_in_proj,*size_BV+*cX_in_proj,&MT[ld*tra_s],ld,d->size_MT,cMT);CHKERRQ(ierr); *size_BV = d->V_tra_e - d->V_tra_s; *max_size_BV-= nBV - *BV; *BV = nBV; if (cX_in_proj && d->max_cX_in_proj>0) *cX_in_proj = cp+rm; } else if (d->V_tra_s <= d->max_cX_in_proj || BV_shift) { /* [BcX BV] <- [BcX BV*MT] */ ierr = SlepcUpdateVectorsZ(*BV-*cX_in_proj,0.0,1.0,*BV-*cX_in_proj,*size_BV+*cX_in_proj,MT,ld,d->size_MT,d->V_tra_e);CHKERRQ(ierr); *BV+= d->V_tra_s-*cX_in_proj; *max_size_BV-= d->V_tra_s-*cX_in_proj; *size_BV = d->V_tra_e - d->V_tra_s; if (size_cBV && BV_shift) *size_cBV = *BV - real_BV; if (d->max_cX_in_proj>0) *cX_in_proj = PetscMin(*BV - real_BV, d->max_cX_in_proj); } else { /* !BV_shift */ /* BV <- BV*MT(V_tra_s:) */ ierr = SlepcUpdateVectorsZ(*BV,0.0,1.0,*BV,*size_BV,&MT[d->V_tra_s*ld],ld,d->size_MT,d->V_tra_e-d->V_tra_s);CHKERRQ(ierr); *size_BV = d->V_tra_e - d->V_tra_s; } ierr = DSRestoreArray(d->ps,mat,&MT);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/davidson.c0000644000175000017500000006060312211062077023214 0ustar gladkgladk/* Skeleton of Davidson solver. Actual solvers are GD and JD. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" PetscErrorCode EPSView_XD(EPS eps,PetscViewer viewer); typedef struct { /**** Solver options ****/ PetscInt blocksize, /* block size */ initialsize, /* initial size of V */ minv, /* size of V after restarting */ plusk; /* keep plusk eigenvectors from the last iteration */ EPSOrthType ipB; /* true if B-ortho is used */ PetscInt method; /* method for improving the approximate solution */ PetscReal fix; /* the fix parameter */ PetscBool krylovstart; /* true if the starting subspace is a Krylov basis */ PetscBool dynamic; /* true if dynamic stopping criterion is used */ PetscInt cX_in_proj, /* converged vectors in the projected problem */ cX_in_impr; /* converged vectors in the projector */ Method_t scheme; /* method employed: GD, JD or GD2 */ /**** Solver data ****/ dvdDashboard ddb; /**** Things to destroy ****/ PetscScalar *wS; Vec *wV; PetscInt size_wV; } EPS_DAVIDSON; #undef __FUNCT__ #define __FUNCT__ "EPSCreate_XD" PetscErrorCode EPSCreate_XD(EPS eps) { PetscErrorCode ierr; EPS_DAVIDSON *data; PetscFunctionBegin; eps->st->ops->getbilinearform = STGetBilinearForm_Default; eps->ops->solve = EPSSolve_XD; eps->ops->setup = EPSSetUp_XD; eps->ops->reset = EPSReset_XD; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_XD; eps->ops->view = EPSView_XD; ierr = PetscNewLog(eps,EPS_DAVIDSON,&data);CHKERRQ(ierr); eps->data = data; data->wS = NULL; data->wV = NULL; data->size_wV = 0; ierr = PetscMemzero(&data->ddb,sizeof(dvdDashboard));CHKERRQ(ierr); /* Set default values */ ierr = EPSXDSetKrylovStart_XD(eps,PETSC_FALSE);CHKERRQ(ierr); ierr = EPSXDSetBlockSize_XD(eps,1);CHKERRQ(ierr); ierr = EPSXDSetRestart_XD(eps,6,0);CHKERRQ(ierr); ierr = EPSXDSetInitialSize_XD(eps,5);CHKERRQ(ierr); ierr = EPSJDSetFix_JD(eps,0.01);CHKERRQ(ierr); ierr = EPSXDSetBOrth_XD(eps,EPS_ORTH_B);CHKERRQ(ierr); ierr = EPSJDSetConstCorrectionTol_JD(eps,PETSC_TRUE);CHKERRQ(ierr); ierr = EPSXDSetWindowSizes_XD(eps,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_XD" PetscErrorCode EPSSetUp_XD(EPS eps) { PetscErrorCode ierr; EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; dvdDashboard *dvd = &data->ddb; dvdBlackboard b; PetscInt nvecs,nscalars,min_size_V,plusk,bs,initv,i,cX_in_proj,cX_in_impr,nmat; Mat A,B; KSP ksp; PetscBool t,ipB,ispositive,dynamic; HarmType_t harm; InitType_t init; PetscReal fix; PetscScalar target; PetscFunctionBegin; /* Setup EPS options and get the problem specification */ ierr = EPSXDGetBlockSize_XD(eps,&bs);CHKERRQ(ierr); if (bs <= 0) bs = 1; if (eps->ncv) { if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The value of ncv must be at least nev"); } else if (eps->mpd) eps->ncv = eps->mpd + eps->nev + bs; else if (eps->nev<500) eps->ncv = PetscMin(eps->n-bs,PetscMax(2*eps->nev,eps->nev+15))+bs; else eps->ncv = PetscMin(eps->n-bs,eps->nev+500)+bs; if (!eps->mpd) eps->mpd = eps->ncv; if (eps->mpd > eps->ncv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The mpd has to be less or equal than ncv"); if (eps->mpd < 2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The mpd has to be greater than 2"); if (!eps->max_it) eps->max_it = PetscMax(100*eps->ncv,2*eps->n); if (!eps->which) eps->which = EPS_LARGEST_MAGNITUDE; if (eps->ishermitian && (eps->which==EPS_LARGEST_IMAGINARY || eps->which==EPS_SMALLEST_IMAGINARY)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Wrong value of eps->which"); if (!(eps->nev + bs <= eps->ncv)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The ncv has to be greater than nev plus blocksize"); ierr = EPSXDGetRestart_XD(eps,&min_size_V,&plusk);CHKERRQ(ierr); if (!min_size_V) min_size_V = PetscMin(PetscMax(bs,5),eps->mpd/2); if (!(min_size_V+bs <= eps->mpd)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The value of minv must be less than mpd minus blocksize"); ierr = EPSXDGetInitialSize_XD(eps,&initv);CHKERRQ(ierr); if (eps->mpd < initv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The initv has to be less or equal than mpd"); /* Davidson solvers do not support left eigenvectors */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); /* Set STPrecond as the default ST */ if (!((PetscObject)eps->st)->type_name) { ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); } ierr = STPrecondSetKSPHasMat(eps->st,PETSC_FALSE);CHKERRQ(ierr); /* Change the default sigma to inf if necessary */ if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL || eps->which == EPS_LARGEST_IMAGINARY) { ierr = STSetDefaultShift(eps->st,PETSC_MAX_REAL);CHKERRQ(ierr); } /* Davidson solvers only support STPRECOND */ ierr = STSetUp(eps->st);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&t);CHKERRQ(ierr); if (!t) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"%s only works with precond spectral transformation", ((PetscObject)eps)->type_name); /* Setup problem specification in dvd */ ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } ierr = EPSReset_XD(eps);CHKERRQ(ierr); ierr = PetscMemzero(dvd,sizeof(dvdDashboard));CHKERRQ(ierr); dvd->A = A; dvd->B = eps->isgeneralized? B : NULL; ispositive = eps->ispositive; dvd->sA = DVD_MAT_IMPLICIT | (eps->ishermitian? DVD_MAT_HERMITIAN : 0) | ((ispositive && !eps->isgeneralized) ? DVD_MAT_POS_DEF : 0); /* Asume -eps_hermitian means hermitian-definite in generalized problems */ if (!ispositive && !eps->isgeneralized && eps->ishermitian) ispositive = PETSC_TRUE; if (!eps->isgeneralized) dvd->sB = DVD_MAT_IMPLICIT | DVD_MAT_HERMITIAN | DVD_MAT_IDENTITY | DVD_MAT_UNITARY | DVD_MAT_POS_DEF; else dvd->sB = DVD_MAT_IMPLICIT | (eps->ishermitian? DVD_MAT_HERMITIAN : 0) | (ispositive? DVD_MAT_POS_DEF : 0); ipB = (dvd->B && data->ipB != EPS_ORTH_I && DVD_IS(dvd->sB,DVD_MAT_HERMITIAN))?PETSC_TRUE:PETSC_FALSE; if (data->ipB != EPS_ORTH_I && !ipB) data->ipB = EPS_ORTH_I; dvd->correctXnorm = ipB; dvd->sEP = ((!eps->isgeneralized || (eps->isgeneralized && ipB))? DVD_EP_STD : 0) | (ispositive? DVD_EP_HERMITIAN : 0) | ((eps->problem_type == EPS_GHIEP && ipB) ? DVD_EP_INDEFINITE : 0); dvd->nev = eps->nev; dvd->which = eps->which; dvd->withTarget = PETSC_TRUE; switch (eps->which) { case EPS_TARGET_MAGNITUDE: case EPS_TARGET_IMAGINARY: dvd->target[0] = target = eps->target; dvd->target[1] = 1.0; break; case EPS_TARGET_REAL: dvd->target[0] = PetscRealPart(target = eps->target); dvd->target[1] = 1.0; break; case EPS_LARGEST_REAL: case EPS_LARGEST_MAGNITUDE: case EPS_LARGEST_IMAGINARY: /* TODO: think about this case */ dvd->target[0] = 1.0; dvd->target[1] = target = 0.0; break; case EPS_SMALLEST_MAGNITUDE: case EPS_SMALLEST_REAL: case EPS_SMALLEST_IMAGINARY: /* TODO: think about this case */ dvd->target[0] = target = 0.0; dvd->target[1] = 1.0; break; case EPS_WHICH_USER: ierr = STGetShift(eps->st,&target);CHKERRQ(ierr); dvd->target[0] = target; dvd->target[1] = 1.0; break; case EPS_ALL: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported option: which == EPS_ALL"); break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported value of option 'which'"); } dvd->tol = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol; dvd->eps = eps; /* Setup the extraction technique */ if (!eps->extraction) { if (ipB || ispositive) eps->extraction = EPS_RITZ; else { switch (eps->which) { case EPS_TARGET_REAL: case EPS_TARGET_MAGNITUDE: case EPS_TARGET_IMAGINARY: case EPS_SMALLEST_MAGNITUDE: case EPS_SMALLEST_REAL: case EPS_SMALLEST_IMAGINARY: eps->extraction = EPS_HARMONIC; break; case EPS_LARGEST_REAL: case EPS_LARGEST_MAGNITUDE: case EPS_LARGEST_IMAGINARY: eps->extraction = EPS_HARMONIC_LARGEST; break; default: eps->extraction = EPS_RITZ; } } } switch (eps->extraction) { case EPS_RITZ: harm = DVD_HARM_NONE; break; case EPS_HARMONIC: harm = DVD_HARM_RR; break; case EPS_HARMONIC_RELATIVE: harm = DVD_HARM_RRR; break; case EPS_HARMONIC_RIGHT: harm = DVD_HARM_REIGS; break; case EPS_HARMONIC_LARGEST: harm = DVD_HARM_LEIGS; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); } /* Setup the type of starting subspace */ ierr = EPSXDGetKrylovStart_XD(eps,&t);CHKERRQ(ierr); init = (!t)? DVD_INITV_CLASSIC : DVD_INITV_KRYLOV; /* Setup the presence of converged vectors in the projected problem and in the projector */ ierr = EPSXDGetWindowSizes_XD(eps,&cX_in_impr,&cX_in_proj);CHKERRQ(ierr); if (min_size_V <= cX_in_proj) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"minv has to be greater than qwindow"); if (bs > 1 && cX_in_impr > 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported option: pwindow > 0 and bs > 1"); /* Setup IP */ if (ipB && dvd->B) { ierr = IPSetMatrix(eps->ip,dvd->B);CHKERRQ(ierr); } else { ierr = IPSetMatrix(eps->ip,NULL);CHKERRQ(ierr); } /* Get the fix parameter */ ierr = EPSXDGetFix_XD(eps,&fix);CHKERRQ(ierr); /* Get whether the stopping criterion is used */ ierr = EPSJDGetConstCorrectionTol_JD(eps,&dynamic);CHKERRQ(ierr); /* Orthonormalize the deflation space */ ierr = dvd_orthV(eps->ip,NULL,0,NULL,0,eps->defl,0,PetscAbs(eps->nds),NULL,eps->rand);CHKERRQ(ierr); /* Preconfigure dvd */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); ierr = dvd_schm_basic_preconf(dvd,&b,eps->mpd,min_size_V,bs, initv, PetscAbs(eps->nini), plusk,harm, ksp,init,eps->trackall, data->ipB,cX_in_proj,cX_in_impr, data->scheme);CHKERRQ(ierr); /* Allocate memory */ nvecs = b.max_size_auxV + b.own_vecs; nscalars = b.own_scalars + b.max_size_auxS; ierr = PetscMalloc(nscalars*sizeof(PetscScalar),&data->wS);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,nscalars*sizeof(PetscScalar));CHKERRQ(ierr); ierr = VecDuplicateVecs(eps->t,nvecs,&data->wV);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,nvecs,data->wV);CHKERRQ(ierr); data->size_wV = nvecs; b.free_vecs = data->wV; b.free_scalars = data->wS; dvd->auxV = data->wV + b.own_vecs; dvd->auxS = b.free_scalars + b.own_scalars; dvd->size_auxV = b.max_size_auxV; dvd->size_auxS = b.max_size_auxS; eps->errest_left = NULL; ierr = PetscMalloc(eps->ncv*sizeof(PetscInt),&eps->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,eps->ncv*sizeof(PetscInt));CHKERRQ(ierr); for (i=0;incv;i++) eps->perm[i] = i; /* Configure dvd for a basic GD */ ierr = dvd_schm_basic_conf(dvd,&b,eps->mpd,min_size_V,bs, initv, PetscAbs(eps->nini),plusk, eps->ip,harm,dvd->withTarget, target,ksp, fix,init,eps->trackall, data->ipB,cX_in_proj,cX_in_impr,dynamic, data->scheme);CHKERRQ(ierr); /* Associate the eigenvalues to the EPS */ eps->eigr = dvd->real_eigr; eps->eigi = dvd->real_eigi; eps->errest = dvd->real_errest; eps->V = dvd->real_V; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_XD" PetscErrorCode EPSSolve_XD(EPS eps) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; dvdDashboard *d = &data->ddb; PetscErrorCode ierr; PetscFunctionBegin; /* Call the starting routines */ DVD_FL_CALL(d->startList,d); for (eps->its=0;eps->itsmax_it;eps->its++) { /* Initialize V, if it is needed */ if (d->size_V == 0) { ierr = d->initV(d);CHKERRQ(ierr); } /* Find the best approximated eigenpairs in V, X */ ierr = d->calcPairs(d);CHKERRQ(ierr); /* Test for convergence */ if (eps->nconv >= eps->nev) break; /* Expand the subspace */ ierr = d->updateV(d);CHKERRQ(ierr); /* Monitor progress */ eps->nconv = d->nconv; ierr = EPSMonitor(eps,eps->its+1,eps->nconv,eps->eigr,eps->eigi,eps->errest,d->size_V+d->size_cX);CHKERRQ(ierr); } /* Call the ending routines */ DVD_FL_CALL(d->endList,d); if (eps->nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL; else eps->reason = EPS_DIVERGED_ITS; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_XD" PetscErrorCode EPSReset_XD(EPS eps) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; dvdDashboard *dvd = &data->ddb; PetscErrorCode ierr; PetscFunctionBegin; /* Call step destructors and destroys the list */ DVD_FL_CALL(dvd->destroyList,dvd); DVD_FL_DEL(dvd->destroyList); DVD_FL_DEL(dvd->startList); DVD_FL_DEL(dvd->endList); if (data->size_wV > 0) { ierr = VecDestroyVecs(data->size_wV,&data->wV);CHKERRQ(ierr); } ierr = PetscFree(data->wS);CHKERRQ(ierr); ierr = PetscFree(eps->perm);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_XD" PetscErrorCode EPSView_XD(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; PetscBool isascii,opb; PetscInt opi,opi0; Method_t meth; EPSOrthType borth; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = EPSXDGetMethod_XD(eps,&meth);CHKERRQ(ierr); if (meth==DVD_METH_GD2) { ierr = PetscViewerASCIIPrintf(viewer," Davidson: using double expansion variant (GD2)\n");CHKERRQ(ierr); } ierr = EPSXDGetBOrth_XD(eps,&borth);CHKERRQ(ierr); switch (borth) { case EPS_ORTH_I: ierr = PetscViewerASCIIPrintf(viewer," Davidson: search subspace is orthogonalized\n");CHKERRQ(ierr); break; case EPS_ORTH_B: ierr = PetscViewerASCIIPrintf(viewer," Davidson: search subspace is B-orthogonalized\n");CHKERRQ(ierr); break; case EPS_ORTH_BOPT: ierr = PetscViewerASCIIPrintf(viewer," Davidson: search subspace is B-orthogonalized with an optimized method\n");CHKERRQ(ierr); break; } ierr = EPSXDGetBlockSize_XD(eps,&opi);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Davidson: block size=%D\n",opi);CHKERRQ(ierr); ierr = EPSXDGetKrylovStart_XD(eps,&opb);CHKERRQ(ierr); if (!opb) { ierr = PetscViewerASCIIPrintf(viewer," Davidson: type of the initial subspace: non-Krylov\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Davidson: type of the initial subspace: Krylov\n");CHKERRQ(ierr); } ierr = EPSXDGetRestart_XD(eps,&opi,&opi0);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Davidson: size of the subspace after restarting: %D\n",opi);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Davidson: number of vectors after restarting from the previous iteration: %D\n",opi0);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetKrylovStart_XD" PetscErrorCode EPSXDSetKrylovStart_XD(EPS eps,PetscBool krylovstart) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; data->krylovstart = krylovstart; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetKrylovStart_XD" PetscErrorCode EPSXDGetKrylovStart_XD(EPS eps,PetscBool *krylovstart) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *krylovstart = data->krylovstart; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetBlockSize_XD" PetscErrorCode EPSXDSetBlockSize_XD(EPS eps,PetscInt blocksize) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (blocksize == PETSC_DEFAULT || blocksize == PETSC_DECIDE) blocksize = 1; if (blocksize <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid blocksize value"); data->blocksize = blocksize; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetBlockSize_XD" PetscErrorCode EPSXDGetBlockSize_XD(EPS eps,PetscInt *blocksize) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *blocksize = data->blocksize; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetRestart_XD" PetscErrorCode EPSXDSetRestart_XD(EPS eps,PetscInt minv,PetscInt plusk) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (minv == PETSC_DEFAULT || minv == PETSC_DECIDE) minv = 5; if (minv <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid minv value"); if (plusk == PETSC_DEFAULT || plusk == PETSC_DECIDE) plusk = 5; if (plusk < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid plusk value"); data->minv = minv; data->plusk = plusk; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetRestart_XD" PetscErrorCode EPSXDGetRestart_XD(EPS eps,PetscInt *minv,PetscInt *plusk) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (minv) *minv = data->minv; if (plusk) *plusk = data->plusk; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetInitialSize_XD" PetscErrorCode EPSXDGetInitialSize_XD(EPS eps,PetscInt *initialsize) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *initialsize = data->initialsize; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetInitialSize_XD" PetscErrorCode EPSXDSetInitialSize_XD(EPS eps,PetscInt initialsize) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (initialsize == PETSC_DEFAULT || initialsize == PETSC_DECIDE) initialsize = 5; if (initialsize <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid initial size value"); data->initialsize = initialsize; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetFix_XD" PetscErrorCode EPSXDGetFix_XD(EPS eps,PetscReal *fix) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *fix = data->fix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetFix_JD" PetscErrorCode EPSJDSetFix_JD(EPS eps,PetscReal fix) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (fix == PETSC_DEFAULT || fix == PETSC_DECIDE) fix = 0.01; if (fix < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid fix value"); data->fix = fix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetBOrth_XD" PetscErrorCode EPSXDSetBOrth_XD(EPS eps,EPSOrthType borth) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; data->ipB = borth; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetBOrth_XD" PetscErrorCode EPSXDGetBOrth_XD(EPS eps,EPSOrthType *borth) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *borth = data->ipB; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDSetConstCorrectionTol_JD" PetscErrorCode EPSJDSetConstCorrectionTol_JD(EPS eps,PetscBool constant) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; data->dynamic = !constant?PETSC_TRUE:PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSJDGetConstCorrectionTol_JD" PetscErrorCode EPSJDGetConstCorrectionTol_JD(EPS eps,PetscBool *constant) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *constant = !data->dynamic?PETSC_TRUE:PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetWindowSizes_XD" PetscErrorCode EPSXDSetWindowSizes_XD(EPS eps,PetscInt pwindow,PetscInt qwindow) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (pwindow == PETSC_DEFAULT || pwindow == PETSC_DECIDE) pwindow = 0; if (pwindow < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid pwindow value"); if (qwindow == PETSC_DEFAULT || qwindow == PETSC_DECIDE) qwindow = 0; if (qwindow < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid qwindow value"); data->cX_in_proj = qwindow; data->cX_in_impr = pwindow; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetWindowSizes_XD" PetscErrorCode EPSXDGetWindowSizes_XD(EPS eps,PetscInt *pwindow,PetscInt *qwindow) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; if (pwindow) *pwindow = data->cX_in_impr; if (qwindow) *qwindow = data->cX_in_proj; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDSetMethod" PetscErrorCode EPSXDSetMethod(EPS eps,Method_t method) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; data->scheme = method; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSXDGetMethod_XD" PetscErrorCode EPSXDGetMethod_XD(EPS eps,Method_t *method) { EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; PetscFunctionBegin; *method = data->scheme; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeVectors_XD" /* EPSComputeVectors_XD - Compute eigenvectors from the vectors provided by the eigensolver. This version is intended for solvers that provide Schur vectors from the QZ decompositon. Given the partial Schur decomposition OP*V=V*T, the following steps are performed: 1) compute eigenvectors of (S,T): S*Z=T*Z*D 2) compute eigenvectors of OP: X=V*Z If left eigenvectors are required then also do Z'*T=D*Z', Y=W*Z */ PetscErrorCode EPSComputeVectors_XD(EPS eps) { PetscErrorCode ierr; EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data; dvdDashboard *d = &data->ddb; PetscScalar *pX,*cS,*cT; PetscInt ld; PetscFunctionBegin; if (d->cS) { /* Compute the eigenvectors associated to (cS, cT) */ ierr = DSSetDimensions(d->conv_ps,d->size_cS,0,0,0);CHKERRQ(ierr); ierr = DSGetLeadingDimension(d->conv_ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->conv_ps,DS_MAT_A,&cS);CHKERRQ(ierr); ierr = SlepcDenseCopyTriang(cS,0,ld,d->cS,0,d->ldcS,d->size_cS,d->size_cS);CHKERRQ(ierr); ierr = DSRestoreArray(d->conv_ps,DS_MAT_A,&cS);CHKERRQ(ierr); if (d->cT) { ierr = DSGetArray(d->conv_ps,DS_MAT_B,&cT);CHKERRQ(ierr); ierr = SlepcDenseCopyTriang(cT,0,ld,d->cT,0,d->ldcT,d->size_cS,d->size_cS);CHKERRQ(ierr); ierr = DSRestoreArray(d->conv_ps,DS_MAT_B,&cT);CHKERRQ(ierr); } ierr = DSSetState(d->conv_ps,DS_STATE_RAW);CHKERRQ(ierr); ierr = DSSolve(d->conv_ps,eps->eigr,eps->eigi);CHKERRQ(ierr); ierr = DSVectors(d->conv_ps,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->conv_ps,DS_MAT_X,-1);CHKERRQ(ierr); /* V <- cX * pX */ ierr = DSGetArray(d->conv_ps,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = SlepcUpdateVectorsZ(eps->V,0.0,1.0,d->cX,d->size_cX,pX,ld,d->nconv,d->nconv);CHKERRQ(ierr); ierr = DSRestoreArray(d->conv_ps,DS_MAT_X,&pX);CHKERRQ(ierr); } eps->evecsavailable = PETSC_TRUE; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_testconv.c.html0000644000175000017500000001424012211062077025046 0ustar gladkgladk
Actual source code: dvd_testconv.c

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

  4:   Step: test for convergence

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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

 28: PetscBool dvd_testconv_basic_0(dvdDashboard *d, PetscScalar eigvr,
 29:                                 PetscScalar eigvi, PetscReal r,
 30:                                 PetscReal *err);
 31: PetscBool dvd_testconv_slepc_0(dvdDashboard *d, PetscScalar eigvr,
 32:                                 PetscScalar eigvi, PetscReal r,
 33:                                 PetscReal *err);

 37: PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b)
 38: {
 39:   PetscErrorCode  ierr;

 42:   /* Setup the step */
 43:   if (b->state >= DVD_STATE_CONF) {
 44:     PetscFree(d->testConv_data);
 45:     d->testConv = dvd_testconv_basic_0;
 46:   }
 47:   return(0);
 48: }

 52: PetscBool dvd_testconv_basic_0(dvdDashboard *d, PetscScalar eigvr,
 53:                                 PetscScalar eigvi, PetscReal r,
 54:                                 PetscReal *err)
 55: {
 56:   PetscBool       conv;
 57:   PetscReal       eig_norm, errest;

 60:   eig_norm = SlepcAbsEigenvalue(eigvr, eigvi);
 61:   errest = r/eig_norm;
 62:   conv = (errest <= d->tol) ? PETSC_TRUE : PETSC_FALSE;
 63:   if (err) *err = errest;
 64:   PetscFunctionReturn(conv);
 65: }

 69: PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b)
 70: {
 71:   PetscErrorCode  ierr;

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

 84: PetscBool dvd_testconv_slepc_0(dvdDashboard *d, PetscScalar eigvr,
 85:                                 PetscScalar eigvi, PetscReal r,
 86:                                 PetscReal *err)
 87: {
 88:   PetscErrorCode  ierr;

 91:   (*d->eps->converged)(d->eps, eigvr, eigvi, r, err, d->eps->convergedctx);
 92:   CHKERRABORT(PetscObjectComm((PetscObject)d->eps), ierr);
 93:   PetscFunctionReturn(*err<d->eps->tol ? PETSC_TRUE : PETSC_FALSE);
 94: }

slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_schm.c.html0000644000175000017500000002325512211062077024141 0ustar gladkgladk
Actual source code: dvd_schm.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22:  #include davidson.h

 24: #define DVD_CHECKSUM(b) \
 25:   ((b)->max_size_V + (b)->max_size_auxV + (b)->max_size_auxS + \
 26:    (b)->own_vecs + (b)->own_scalars + (b)->max_size_oldX)

 30: PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,HarmType_t harmMode,KSP ksp,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,Method_t method)
 31: {
 33:   PetscInt       check_sum0, check_sum1;

 36:   PetscMemzero(b, sizeof(dvdBlackboard));
 37:   b->state = DVD_STATE_PRECONF;

 39:   for (check_sum0=-1,check_sum1=DVD_CHECKSUM(b); check_sum0 != check_sum1;
 40:        check_sum0 = check_sum1, check_sum1 = DVD_CHECKSUM(b)) {
 41:     b->own_vecs = b->own_scalars = 0;

 43:     /* Setup basic management of V */
 44:     dvd_managementV_basic(d, b, bs, mpd, min_size_V, plusk,
 45:                                harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE,
 46:                                allResiduals);

 48:     /* Setup the initial subspace for V */
 49:     dvd_initV(d, b, ini_size_V, size_initV,
 50:                      init==DVD_INITV_KRYLOV?PETSC_TRUE:PETSC_FALSE);

 52:     /* Setup the convergence in order to use the SLEPc convergence test */
 53:     dvd_testconv_slepc(d, b);

 55:     /* Setup Raileigh-Ritz for selecting the best eigenpairs in V */
 56:     dvd_calcpairs_qz(d, b, orth, NULL, cX_proj,
 57:                 harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);
 58:     if (harmMode != DVD_HARM_NONE) {
 59:       dvd_harm_conf(d, b, harmMode, PETSC_FALSE, 0.0);
 60:     }

 62:     /* Setup the method for improving the eigenvectors */
 63:     switch (method) {
 64:       case DVD_METH_GD:
 65:       case DVD_METH_JD:
 66:       dvd_improvex_jd(d, b, ksp, bs, cX_impr, PETSC_FALSE);
 67:       dvd_improvex_jd_proj_uv(d, b, DVD_PROJ_KZX);
 68:       dvd_improvex_jd_lit_const(d, b, 0, 0.0, 0.0);
 69:       break;
 70:       case DVD_METH_GD2:
 71:       dvd_improvex_gd2(d, b, ksp, bs);
 72:       break;
 73:     }
 74:   }
 75:   return(0);
 76: }

 80: PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,IP ip,HarmType_t harmMode,PetscBool fixedTarget,PetscScalar t,KSP ksp,PetscReal fix,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,PetscBool dynamic,Method_t method)
 81: {
 82:   PetscInt        check_sum0, check_sum1, maxits;
 83:   Vec             *fv;
 84:   PetscScalar     *fs;
 85:   PetscReal       tol;
 86:   PetscErrorCode  ierr;

 89:   b->state = DVD_STATE_CONF;
 90:   check_sum0 = DVD_CHECKSUM(b);
 91:   b->own_vecs = 0; b->own_scalars = 0;
 92:   fv = b->free_vecs; fs = b->free_scalars;

 94:   /* Setup basic management of V */
 95:   dvd_managementV_basic(d, b, bs, mpd, min_size_V, plusk,
 96:                         harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE,
 97:                         allResiduals);

 99:   /* Setup the initial subspace for V */
100:   dvd_initV(d, b, ini_size_V, size_initV,
101:                    init==DVD_INITV_KRYLOV?PETSC_TRUE:PETSC_FALSE);

103:   /* Setup the convergence in order to use the SLEPc convergence test */
104:   dvd_testconv_slepc(d, b);

106:   /* Setup Raileigh-Ritz for selecting the best eigenpairs in V */
107:   dvd_calcpairs_qz(d, b, orth, ip, cX_proj,
108:                 harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);
109:   if (harmMode != DVD_HARM_NONE) {
110:     dvd_harm_conf(d, b, harmMode, fixedTarget, t);
111:   }

113:   /* Setup the method for improving the eigenvectors */
114:   switch (method) {
115:     case DVD_METH_GD:
116:     case DVD_METH_JD:
117:       dvd_improvex_jd(d, b, ksp, bs, cX_impr, dynamic);
118:       dvd_improvex_jd_proj_uv(d, b, DVD_PROJ_KZX);
119:       KSPGetTolerances(ksp, &tol, NULL, NULL, &maxits);
120:       dvd_improvex_jd_lit_const(d, b, maxits, tol, fix);
121:       break;
122:     case DVD_METH_GD2:
123:       dvd_improvex_gd2(d, b, ksp, bs);
124:       break;
125:   }

127:   check_sum1 = DVD_CHECKSUM(b);
128:   if ((check_sum0 != check_sum1) ||
129:       (b->free_vecs - fv > b->own_vecs) ||
130:       (b->free_scalars - fs > b->own_scalars))
131:     SETERRQ(PETSC_COMM_SELF,1, "Something awful happened");
132:   return(0);
133: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_gd2.c.html0000644000175000017500000007164312211062077023667 0ustar gladkgladk
Actual source code: dvd_gd2.c

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

  4:   Step: improve the eigenvectors X with GD2

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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
 27: #include <slepc-private/vecimplslepc.h>         /*I "slepcvec.h" I*/

 29: PetscErrorCode dvd_improvex_gd2_d(dvdDashboard *d);
 30: PetscErrorCode dvd_improvex_gd2_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);
 31: PetscErrorCode dvd_improvex_get_eigenvectors(dvdDashboard *d,PetscScalar *pX,PetscScalar *pY,PetscInt ld_,PetscScalar *auxS,PetscInt size_auxS);

 33: #define size_Z (64*4)

 35: /**** GD2 update step K*[A*X B*X]  ****/

 37: typedef struct {
 38:   PetscInt size_X;
 39:   void         *old_improveX_data;   /* old improveX_data */
 40:   improveX_type old_improveX;        /* old improveX */
 41: } dvdImprovex_gd2;

 45: PetscErrorCode dvd_improvex_gd2(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs)
 46: {
 47:   PetscErrorCode  ierr;
 48:   dvdImprovex_gd2 *data;
 49:   PetscBool       her_probl,std_probl;
 50:   PC              pc;
 51:   PetscInt        s=1;

 54:   std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
 55:   her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE;

 57:   /* Setting configuration constrains */
 58:   /* If the arithmetic is real and the problem is not Hermitian, then
 59:      the block size is incremented in one */
 60: #if !defined(PETSC_USE_COMPLEX)
 61:   if (!her_probl) {
 62:     max_bs++;
 63:     b->max_size_P = PetscMax(b->max_size_P, 2);
 64:     s = 2;
 65:   } else
 66: #endif
 67:     b->max_size_P = PetscMax(b->max_size_P, 1);
 68:   b->max_size_X = PetscMax(b->max_size_X, max_bs);
 69:   b->max_size_auxV = PetscMax(b->max_size_auxV,
 70:      s +
 71:      ((her_probl || !d->eps->trueres)?1:PetscMax(s*2,b->max_size_cX_proj+b->max_size_X))); /* testConv */

 73:   b->max_size_auxS = PetscMax(b->max_size_auxS,
 74:       (her_probl || !d->eps->trueres)?0:b->max_nev*b->max_nev+PetscMax(b->max_nev*6,(b->max_nev+b->max_size_proj)*s+b->max_nev*(b->max_size_X+b->max_size_cX_proj)*(std_probl?2:4)+64)); /* preTestConv */

 76:   /* Setup the preconditioner */
 77:   if (ksp) {
 78:     KSPGetPC(ksp,&pc);
 79:     dvd_static_precond_PC(d,b,pc);
 80:   } else {
 81:     dvd_static_precond_PC(d,b,0);
 82:   }

 84:   /* Setup the step */
 85:   if (b->state >= DVD_STATE_CONF) {
 86:     PetscMalloc(sizeof(dvdImprovex_gd2),&data);
 87:     PetscLogObjectMemory(d->eps,sizeof(dvdImprovex_gd2));
 88:     data->old_improveX_data = d->improveX_data;
 89:     d->improveX_data = data;
 90:     data->old_improveX = d->improveX;
 91:     data->size_X = b->max_size_X;
 92:     d->improveX = dvd_improvex_gd2_gen;

 94:     DVD_FL_ADD(d->destroyList,dvd_improvex_gd2_d);
 95:   }
 96:   return(0);
 97: }

101: PetscErrorCode dvd_improvex_gd2_d(dvdDashboard *d)
102: {
103:   PetscErrorCode  ierr;
104:   dvdImprovex_gd2 *data = (dvdImprovex_gd2*)d->improveX_data;

107:   /* Restore changes in dvdDashboard */
108:   d->improveX_data = data->old_improveX_data;

110:   /* Free local data and objects */
111:   PetscFree(data);
112:   return(0);
113: }

115: #define DVD_COMPLEX_RAYLEIGH_QUOTIENT(ur,ui,Axr,Axi,Bxr,Bxi,eigr,eigi,b,ierr)\
116: { \
117:   VecDot((Axr), (ur), &(b)[0]); /* r*A*r */ \
118:   VecDot((Axr), (ui), &(b)[1]); /* i*A*r */ \
119:   VecDot((Axi), (ur), &(b)[2]); /* r*A*i */ \
120:   VecDot((Axi), (ui), &(b)[3]); /* i*A*i */ \
121:   VecDot((Bxr), (ur), &(b)[4]); /* r*B*r */ \
122:   VecDot((Bxr), (ui), &(b)[5]); /* i*B*r */ \
123:   VecDot((Bxi), (ur), &(b)[6]); /* r*B*i */ \
124:   VecDot((Bxi), (ui), &(b)[7]); /* i*B*i */ \
125:   (b)[0]  = (b)[0]+(b)[3]; /* rAr+iAi */ \
126:   (b)[2] =  (b)[2]-(b)[1]; /* rAi-iAr */ \
127:   (b)[4] = (b)[4]+(b)[7]; /* rBr+iBi */ \
128:   (b)[6] = (b)[6]-(b)[5]; /* rBi-iBr */ \
129:   (b)[7] = (b)[4]*(b)[4] + (b)[6]*(b)[6]; /* k */ \
130:   *(eigr) = ((b)[0]*(b)[4] + (b)[2]*(b)[6]) / (b)[7]; /* eig_r */ \
131:   *(eigi) = ((b)[2]*(b)[4] - (b)[0]*(b)[6]) / (b)[7]; /* eig_i */ \
132: }

134: #if !defined(PETSC_USE_COMPLEX)
135: #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \
136:   for ((i)=0; (i)<(n); (i)++) { \
137:     if ((eigi)[(i_s)+(i)] != 0.0) { \
138:       /* eig_r = [(rAr+iAi)*(rBr+iBi) + (rAi-iAr)*(rBi-iBr)]/k \
139:          eig_i = [(rAi-iAr)*(rBr+iBi) - (rAr+iAi)*(rBi-iBr)]/k \
140:          k     =  (rBr+iBi)*(rBr+iBi) + (rBi-iBr)*(rBi-iBr)    */ \
141:       DVD_COMPLEX_RAYLEIGH_QUOTIENT((u)[(i)], (u)[(i)+1], (Ax)[(i)], \
142:         (Ax)[(i)+1], (Bx)[(i)], (Bx)[(i)+1], &(b)[8], &(b)[9], (b), (ierr)); \
143:       if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[8])/ \
144:             PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10    || \
145:           PetscAbsScalar((eigi)[(i_s)+(i)] - (b)[9])/ \
146:             PetscAbsScalar((eigi)[(i_s)+(i)]) > 1e-10) { \
147:         (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its "\
148:                             "Rayleigh quotient value %G+%G\n", \
149:                             (eigr)[(i_s)+(i)], \
150:                             (eigi)[(i_s)+1], (b)[8], (b)[9]); \
151:       } \
152:       (i)++; \
153:     } else { \
154:       (ierr) = VecDot((Ax)[(i)], (u)[(i)], &(b)[0]); \
155:       (ierr) = VecDot((Bx)[(i)], (u)[(i)], &(b)[1]); \
156:       (b)[0] = (b)[0]/(b)[1]; \
157:       if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[0])/ \
158:             PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10) { \
159:         (ierr) = PetscInfo3((eps), "The eigenvalue %G is far from its " \
160:                "Rayleigh quotient value %G. (y'*B*x = %G)\n", \
161:                (eigr)[(i_s)+(i)], \
162:                (b)[0], (b)[1]); \
163:       } \
164:     } \
165:   }
166: #else
167: #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \
168:   for ((i)=0; (i)<(n); (i)++) { \
169:       (ierr) = VecDot((Ax)[(i)], (u)[(i)], &(b)[0]); \
170:       (ierr) = VecDot((Bx)[(i)], (u)[(i)], &(b)[1]); \
171:       (b)[0] = (b)[0]/(b)[1]; \
172:       if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[0])/ \
173:             PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10) { \
174:         (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its " \
175:                "Rayleigh quotient value %G+%G\n", \
176:                PetscRealPart((eigr)[(i_s)+(i)]), \
177:                PetscImaginaryPart((eigr)[(i_s)+(i)]), PetscRealPart((b)[0]), \
178:                PetscImaginaryPart((b)[0])); \
179:       } \
180:     }
181: #endif

185: PetscErrorCode dvd_improvex_gd2_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D)
186: {
187:   dvdImprovex_gd2 *data = (dvdImprovex_gd2*)d->improveX_data;
188:   PetscErrorCode  ierr;
189:   PetscInt        i,j,n,s,ld,k;
190:   PetscScalar     *pX,*pY,b[10],Z[size_Z];
191:   Vec             *Ax,*Bx,X[4];

194:   /* Compute the number of pairs to improve */
195:   n = PetscMin(PetscMin(PetscMin(data->size_X*2,max_size_D),(r_e-r_s)*2),d->max_size_proj-d->size_H)/2;
196: #if !defined(PETSC_USE_COMPLEX)
197:   /* If the last eigenvalue is a complex conjugate pair, n is increased by one */
198:   for (i=0; i<n; i++) {
199:     if (d->eigi[i] != 0.0) i++;
200:   }
201:   if (i > n) {
202:     n = PetscMin(PetscMin(PetscMin(data->size_X*2,max_size_D),(n+1)*2),d->max_size_proj-d->size_H)/2;
203:     if (i > n) n--;
204:   }
205: #endif

207:   /* Quick exit */
208:   if (max_size_D == 0 || r_e-r_s <= 0 || n == 0) {
209:    *size_D = 0;
210:    /* Callback old improveX */
211:     if (data->old_improveX) {
212:       d->improveX_data = data->old_improveX_data;
213:       data->old_improveX(d,NULL,0,0,0,NULL);
214:       d->improveX_data = data;
215:     }
216:     return(0);
217:   }

219:   /* Compute the eigenvectors of the selected pairs */
220:   for (i=0;i<n;) {
221:     k = r_s+i+d->cX_in_H;
222:     DSVectors(d->ps,DS_MAT_X,&k,NULL);
223:     DSNormalize(d->ps,DS_MAT_X,r_s+i+d->cX_in_H);
224:     k = r_s+i+d->cX_in_H;
225:     DSVectors(d->ps,DS_MAT_Y,&k,NULL);
226:     DSNormalize(d->ps,DS_MAT_Y,r_s+i+d->cX_in_H);
227:     /* Jump complex conjugate pairs */
228:     i = k+1;
229:   }
230:   DSGetArray(d->ps,DS_MAT_X,&pX);
231:   DSGetArray(d->ps,DS_MAT_Y,&pY);
232:   DSGetLeadingDimension(d->ps,&ld);

234:   /* Bx <- B*X(i) */
235:   Bx = D+n;
236:   if (d->BV) {
237:     /* Compute the norms of the eigenvectors */
238:     if (d->correctXnorm) {
239:       dvd_improvex_compute_X(d,r_s,r_s+n,Bx,pX,ld);
240:     } else {
241:       for (i=0; i<n; i++) d->nX[r_s+i] = 1.0;
242:     }
243:     SlepcUpdateVectorsZ(Bx,0.0,1.0,d->BV-d->cX_in_H,d->size_BV+d->cX_in_H,&pX[ld*r_s],ld,d->size_H,n);
244:   } else if (d->B) {
245:     for (i=0;i<n;i++) {
246:       /* auxV(0) <- X(i) */
247:       dvd_improvex_compute_X(d,r_s+i,r_s+i+1,d->auxV,pX,ld);
248:       /* Bx(i) <- B*auxV(0) */
249:       MatMult(d->B,d->auxV[0],Bx[i]);
250:     }
251:   } else {
252:     /* Bx <- X */
253:     dvd_improvex_compute_X(d,r_s,r_s+n,Bx,pX,ld);
254:   }

256:   /* Ax <- A*X(i) */
257:   Ax = D;
258:   SlepcUpdateVectorsZ(Ax,0.0,1.0,d->AV-d->cX_in_H,d->size_AV+d->cX_in_H,&pX[ld*r_s],ld,d->size_H,n);

260: #if !defined(PETSC_USE_COMPLEX)
261:   s = d->eigi[r_s] == 0.0 ? 1 : 2;
262:   /* If the available vectors allow the computation of the eigenvalue */
263:   if (s <= n) {
264: #else
265:   s = 1;
266: #endif
267:   /* v <- Y(i) */
268:   SlepcUpdateVectorsZ(d->auxV,0.0,1.0,(d->W?d->W:d->V)-d->cX_in_H,d->size_V+d->cX_in_H,&pY[ld*r_s],ld,d->size_H,s);

270:   /* Recompute the eigenvalue */
271:   DVD_COMPUTE_N_RR(d->eps,i,r_s,1,d->eigr,d->eigi,d->auxV,Ax,Bx,b,ierr);
272: #if !defined(PETSC_USE_COMPLEX)
273:   }
274: #endif

276:   DSRestoreArray(d->ps,DS_MAT_X,&pX);
277:   DSRestoreArray(d->ps,DS_MAT_Y,&pY);

279:   for (i=0,s=0;i<n;i+=s) {
280: #if !defined(PETSC_USE_COMPLEX)
281:     if (d->eigi[r_s+i] != 0.0) {
282:        /* [Ax_i Ax_i+1 Bx_i Bx_i+1]*= [   1        0
283:                                           0        1
284:                                        -eigr_i -eigi_i
285:                                         eigi_i -eigr_i] */
286:       b[0] = b[5] = 1.0/d->nX[r_s+i];
287:       b[2] = b[7] = -d->eigr[r_s+i]/d->nX[r_s+i];
288:       b[6] = -(b[3] = d->eigi[r_s+i]/d->nX[r_s+i]);
289:       b[1] = b[4] = 0.0;
290:       X[0] = Ax[i]; X[1] = Ax[i+1]; X[2] = Bx[i]; X[3] = Bx[i+1];
291:       SlepcUpdateVectorsD(X,4,1.0,b,4,4,2,Z,size_Z);
292:       s = 2;
293:     } else
294: #endif
295:     {
296:       /* [Ax_i Bx_i]*= [ 1/nX_i    conj(eig_i/nX_i)
297:                        -eig_i/nX_i     1/nX_i       ] */
298:       b[0] = 1.0/d->nX[r_s+i];
299:       b[1] = -d->eigr[r_s+i]/d->nX[r_s+i];
300:       b[2] = PetscConj(d->eigr[r_s+i]/d->nX[r_s+i]);
301:       b[3] = 1.0/d->nX[r_s+i];
302:       X[0] = Ax[i]; X[1] = Bx[i];
303:       SlepcUpdateVectorsD(X,2,1.0,b,2,2,2,Z,size_Z);
304:       s = 1;
305:     }
306:     for (j=0; j<s; j++) d->nX[r_s+i+j] = 1.0;

308:     /* Ax = R <- P*(Ax - eig_i*Bx) */
309:     d->calcpairs_proj_res(d,r_s+i,r_s+i+s,&Ax[i]);

311:     /* Check if the first eigenpairs are converged */
312:     if (i == 0) {
313:       d->preTestConv(d,0,s,s,Ax,NULL,&d->npreconv);
314:       if (d->npreconv > 0) break;
315:     }
316:   }

318:   /* D <- K*[Ax Bx] */
319:   if (d->npreconv == 0) {
320:     VecCopy(D[0],d->auxV[0]);
321:     for (i=0;i<2*n-1;i++) {
322:       d->improvex_precond(d,r_s+(i+1)%n,D[i+1],D[i]);
323:     }
324:     d->improvex_precond(d,r_s,d->auxV[0],D[2*n-1]);
325:     *size_D = 2*n;
326: #if !defined(PETSC_USE_COMPLEX)
327:     if (d->eigi[r_s] != 0.0) {
328:       s = 4;
329:     } else
330: #endif
331:     s = 2;
332:     /* Prevent that short vectors are discarded in the orthogonalization */
333:     if (d->eps->errest[d->nconv+r_s] > PETSC_MACHINE_EPSILON && d->eps->errest[d->nconv+r_s] < PETSC_MAX_REAL) {
334:       for (i=0; i<s && i<*size_D; i++) {
335:         VecScale(D[i],1.0/d->eps->errest[d->nconv+r_s]);
336:       }
337:     }
338:   } else {
339:     *size_D = 0;
340:   }

342:   /* Callback old improveX */
343:   if (data->old_improveX) {
344:     d->improveX_data = data->old_improveX_data;
345:     data->old_improveX(d,NULL,0,0,0,NULL);
346:     d->improveX_data = data;
347:   }
348:   return(0);
349: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/makefile0000644000175000017500000000235312211062077022737 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = davidson.c dvd_blas.c dvd_calcpairs.c dvd_improvex.c dvd_initv.c dvd_schm.c dvd_testconv.c dvd_updatev.c dvd_utils.c dvd_gd2.c SOURCEF = SOURCEH = davidson.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/davidson/common/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_initv.c.html0000644000175000017500000002332012211062077024331 0ustar gladkgladk
Actual source code: dvd_initv.c

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

  4:   Step: init subspace V

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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

 28: PetscErrorCode dvd_initV_classic_0(dvdDashboard *d);
 29: PetscErrorCode dvd_initV_krylov_0(dvdDashboard *d);
 30: PetscErrorCode dvd_initV_d(dvdDashboard *d);

 32: typedef struct {
 33:   PetscInt k,           /* desired initial subspace size */
 34:   user;                 /* number of user initial vectors */
 35:   void *old_initV_data; /* old initV data */
 36: } dvdInitV;

 40: PetscErrorCode dvd_initV(dvdDashboard *d, dvdBlackboard *b, PetscInt k,PetscInt user, PetscBool krylov)
 41: {
 42:   PetscErrorCode  ierr;
 43:   dvdInitV        *data;

 46:   /* Setting configuration constrains */
 47:   b->max_size_V = PetscMax(b->max_size_V, k);
 48:   if (krylov)
 49:     b->max_size_auxV = PetscMax(b->max_size_auxV, 1);

 51:   /* Setup the step */
 52:   if (b->state >= DVD_STATE_CONF) {
 53:     PetscMalloc(sizeof(dvdInitV),&data);
 54:     PetscLogObjectMemory(d->eps,sizeof(dvdInitV));
 55:     data->k = k;
 56:     data->user = PetscMin(k, user);
 57:     data->old_initV_data = d->initV_data;
 58:     d->initV_data = data;
 59:     if (krylov) {
 60:       d->initV = dvd_initV_krylov_0;
 61:     } else {
 62:       d->initV = dvd_initV_classic_0;
 63:     }
 64:     DVD_FL_ADD(d->destroyList, dvd_initV_d);
 65:   }
 66:   return(0);
 67: }

 71: PetscErrorCode dvd_initV_classic_0(dvdDashboard *d)
 72: {
 73:   PetscErrorCode  ierr;
 74:   dvdInitV        *data = (dvdInitV*)d->initV_data;
 75:   PetscInt        i, user = PetscMin(data->user, d->max_size_V),
 76:                   k = PetscMin(data->k, d->max_size_V);

 79:   /* Generate a set of random initial vectors and orthonormalize them */
 80:   for (i=user; i<k; i++) {
 81:     SlepcVecSetRandom(d->V[i],d->eps->rand);
 82:   }
 83:   d->V_tra_s = 0; d->V_tra_e = 0;
 84:   d->V_new_s = 0; d->V_new_e = i;

 86:   /* After that the user vectors will be destroyed */
 87:   data->user = 0;
 88:   return(0);
 89: }

 93: PetscErrorCode dvd_initV_krylov_0(dvdDashboard *d)
 94: {
 95:   PetscErrorCode  ierr;
 96:   dvdInitV        *data = (dvdInitV*)d->initV_data;
 97:   PetscInt        i, user = PetscMin(data->user, d->max_size_V),
 98:                   k = PetscMin(data->k, d->max_size_V);
 99:   Vec             *cX = d->BcX? d->BcX : ((d->cY && !d->W)? d->cY : d->cX);

102:   /* If needed, generate a random vector for starting the arnoldi method */
103:   if (user == 0) {
104:     SlepcVecSetRandom(d->V[0], d->eps->rand);
105:     user = 1;
106:   }

108:   /* Perform k steps of Arnoldi with the operator K^{-1}*(t[1]*A-t[2]*B) */
109:   dvd_orthV(d->ipV, d->eps->defl, d->eps->nds, cX, d->size_cX, d->V, 0,
110:                    user, d->auxS, d->eps->rand);
111:   for (i=user; i<k; i++) {
112:     /* aux <- theta[1]A*in - theta[0]*B*in */
113:     if (d->B) {
114:       MatMult(d->A, d->V[i-user], d->V[i]);
115:       MatMult(d->B, d->V[i-user], d->auxV[0]);
116:       VecAXPBY(d->auxV[0], d->target[1], -d->target[0], d->V[i]);
117:     } else {
118:       MatMult(d->A, d->V[i-user], d->auxV[0]);
119:       VecAXPBY(d->auxV[0], -d->target[0], d->target[1], d->V[i-user]);
120:     }
121:     d->improvex_precond(d, 0, d->auxV[0], d->V[i]);
122:     dvd_orthV(d->ipV, d->eps->defl, d->eps->nds, cX, d->size_cX, d->V, i,
123:                      i+1, d->auxS, d->eps->rand);
124:   }

126:   d->V_tra_s = 0; d->V_tra_e = 0;
127:   d->V_new_s = 0; d->V_new_e = i;

129:   /* After that the user vectors will be destroyed */
130:   data->user = 0;
131:   return(0);
132: }

136: PetscErrorCode dvd_initV_d(dvdDashboard *d)
137: {
138:   PetscErrorCode  ierr;
139:   dvdInitV        *data = (dvdInitV*)d->initV_data;

142:   /* Restore changes in dvdDashboard */
143:   d->initV_data = data->old_initV_data;

145:   /* Free local data */
146:   PetscFree(data);
147:   return(0);
148: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/makefile.html0000644000175000017500000000414712211062077023705 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = davidson.c dvd_blas.c dvd_calcpairs.c dvd_improvex.c dvd_initv.c dvd_schm.c dvd_testconv.c dvd_updatev.c dvd_utils.c dvd_gd2.c
SOURCEF  =
SOURCEH  = davidson.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/davidson/common/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_calcpairs.c.html0000644000175000017500000024504212211062077025150 0ustar gladkgladk
Actual source code: dvd_calcpairs.c

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

  4:   Step: calc the best eigenpairs in the subspace V.

  6:   For that, performs these steps:
  7:     1) Update W <- A * V
  8:     2) Update H <- V' * W
  9:     3) Obtain eigenpairs of H
 10:     4) Select some eigenpairs
 11:     5) Compute the Ritz pairs of the selected ones

 13:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 14:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 15:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 17:    This file is part of SLEPc.

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

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

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

 33:  #include davidson.h
 34: #include <slepcblaslapack.h>

 36: PetscErrorCode dvd_calcpairs_proj(dvdDashboard *d);
 37: PetscErrorCode dvd_calcpairs_qz_start(dvdDashboard *d);
 38: PetscErrorCode dvd_calcpairs_qz_d(dvdDashboard *d);
 39: PetscErrorCode dvd_calcpairs_projeig_solve(dvdDashboard *d);
 40: PetscErrorCode dvd_calcpairs_selectPairs(dvdDashboard *d,PetscInt n);
 41: PetscErrorCode dvd_calcpairs_X(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *X);
 42: PetscErrorCode dvd_calcpairs_Y(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *Y);
 43: PetscErrorCode dvd_calcpairs_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R);
 44: PetscErrorCode dvd_calcpairs_eig_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R);
 45: PetscErrorCode dvd_calcpairs_proj_res(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R);
 46: PetscErrorCode dvd_calcpairs_updateV0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr);
 47: PetscErrorCode dvd_calcpairs_updateV1(dvdDashboard *d);
 48: PetscErrorCode dvd_calcpairs_updateW0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr);
 49: PetscErrorCode dvd_calcpairs_updateW1(dvdDashboard *d);
 50: PetscErrorCode dvd_calcpairs_updateAV0(dvdDashboard *d);
 51: PetscErrorCode dvd_calcpairs_updateAV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr);
 52: PetscErrorCode dvd_calcpairs_updateBV0(dvdDashboard *d);
 53: PetscErrorCode dvd_calcpairs_updateBV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr);
 54: PETSC_STATIC_INLINE PetscErrorCode dvd_calcpairs_updateBV0_gen(dvdDashboard *d,Vec *real_BV,PetscInt *size_cX,Vec **BV,PetscInt *size_BV,PetscInt *max_size_BV,PetscBool BV_shift,PetscInt *cX_in_proj,DSMatType MT);

 56: /**** Control routines ********************************************************/
 59: PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d,dvdBlackboard *b,EPSOrthType orth,IP ipI,PetscInt cX_proj,PetscBool harm)
 60: {
 62:   PetscInt       i,max_cS;
 63:   PetscBool      std_probl,her_probl,ind_probl,her_ind_probl;
 64:   DSType         dstype;
 65:   const char     *prefix;
 66:   PetscErrorCode (*f)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 67:   void           *ctx;

 70:   std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
 71:   her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE;
 72:   ind_probl = DVD_IS(d->sEP, DVD_EP_INDEFINITE)?PETSC_TRUE:PETSC_FALSE;
 73:   her_ind_probl = (her_probl || ind_probl)? PETSC_TRUE:PETSC_FALSE;

 75:   /* Setting configuration constrains */
 76: #if !defined(PETSC_USE_COMPLEX)
 77:   /* if the last converged eigenvalue is complex its conjugate pair is also
 78:      converged */
 79:   b->max_nev = PetscMax(b->max_nev, d->nev+(her_probl && !d->B?0:1));
 80: #else
 81:   b->max_nev = PetscMax(b->max_nev, d->nev);
 82: #endif
 83:   b->max_size_proj = PetscMax(b->max_size_proj, b->max_size_V+cX_proj);
 84:   d->size_real_V = b->max_size_V+b->max_nev;
 85:   d->W_shift = d->B?PETSC_TRUE:PETSC_FALSE;
 86:   d->size_real_W = harm?(b->max_size_V+(d->W_shift?b->max_nev:b->max_size_cP)):0;
 87:   d->size_real_AV = b->max_size_V+b->max_size_cP;
 88:   d->size_BDS = 0;
 89:   if (d->B && her_ind_probl && (orth == EPS_ORTH_I || orth == EPS_ORTH_BOPT)) {
 90:     d->size_real_BV = b->size_V; d->BV_shift = PETSC_TRUE;
 91:     if (orth == EPS_ORTH_BOPT) d->size_BDS = d->eps->nds;
 92:   } else if (d->B) {
 93:     d->size_real_BV = b->max_size_V + b->max_size_P; d->BV_shift = PETSC_FALSE;
 94:   } else {
 95:     d->size_real_BV = 0; d->BV_shift = PETSC_FALSE;
 96:   }
 97:   b->own_vecs+= d->size_real_V + d->size_real_W + d->size_real_AV +
 98:                 d->size_real_BV + d->size_BDS;
 99:   b->own_scalars+= b->max_size_proj*b->max_size_proj*2*(std_probl?1:2) +
100:                                               /* H, G?, S, T? */
101:                    b->max_nev*b->max_nev*(her_ind_probl?0:(!d->B?1:2)) +
102:                                                 /* cS?, cT? */
103:                    FromRealToScalar(d->size_real_V)*(ind_probl?1:0) + /* nBV */
104:                    FromRealToScalar(b->max_size_proj)*(ind_probl?1:0) + /* nBpX */
105:                    (d->eps->arbitrary? b->size_V*2 : 0); /* rr, ri */
106:   b->max_size_auxV = PetscMax(b->max_size_auxV, b->max_size_X);
107:                                                 /* updateV0 */
108:   max_cS = PetscMax(b->max_size_X,cX_proj);
109:   b->max_size_auxS = PetscMax(PetscMax(
110:     b->max_size_auxS,
111:     b->max_size_proj*b->max_size_proj*2*(std_probl?1:2) + /* updateAV1,BV1 */
112:       max_cS*b->max_nev*(her_ind_probl?0:(!d->B?1:2)) + /* updateV0,W0 */
113:                                                      /* SlepcReduction: in */
114:       PetscMax(
115:         b->max_size_proj*b->max_size_proj*2*(std_probl?1:2) + /* updateAV1,BV1 */
116:           max_cS*b->max_nev*(her_ind_probl?0:(!d->B?1:2)), /* updateV0,W0 */
117:                                                     /* SlepcReduction: out */
118:         PetscMax(
119:           b->max_size_proj*b->max_size_proj, /* updateAV0,BV0 */
120:           b->max_size_proj+b->max_nev))), /* dvd_orth */
121:     std_probl?0:(b->max_size_proj*11+16) /* projeig */);
122: #if defined(PETSC_USE_COMPLEX)
123:   b->max_size_auxS = PetscMax(b->max_size_auxS, b->max_size_V);
124:                                            /* dvd_calcpairs_projeig_eig */
125: #endif

127:   /* Setup the step */
128:   if (b->state >= DVD_STATE_CONF) {
129:     d->max_cX_in_proj = cX_proj;
130:     d->max_size_P = b->max_size_P;
131:     d->real_V = b->free_vecs; b->free_vecs+= d->size_real_V;
132:     if (harm) {
133:       d->real_W = b->free_vecs; b->free_vecs+= d->size_real_W;
134:     } else {
135:       d->real_W = NULL;
136:     }
137:     d->real_AV = d->AV = b->free_vecs; b->free_vecs+= d->size_real_AV;
138:     d->max_size_proj = b->max_size_proj;
139:     d->real_H = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj;
140:     d->ldH = b->max_size_proj;
141:     d->S = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj;
142:     if (!her_ind_probl) {
143:       d->cS = b->free_scalars; b->free_scalars+= b->max_nev*b->max_nev;
144:       d->max_size_cS = d->ldcS = b->max_nev;
145:     } else {
146:       d->cS = NULL;
147:       d->max_size_cS = d->ldcS = 0;
148:       d->orthoV_type = orth;
149:       if (ind_probl) {
150:         d->real_nBV = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(d->size_real_V);
151:         d->nBpX = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(d->max_size_proj);
152:       } else d->real_nBV = d->nBDS = d->nBpX = NULL;
153:     }
154:     d->ipV = ipI;
155:     d->ipW = ipI;
156:     if (orth == EPS_ORTH_BOPT) {
157:       d->BDS = b->free_vecs; b->free_vecs+= d->eps->nds;
158:       for (i=0; i<d->eps->nds; i++) {
159:         MatMult(d->B, d->eps->defl[i], d->BDS[i]);
160:       }
161:     } else d->BDS = NULL;
162:     if (d->B) {
163:       d->real_BV = b->free_vecs; b->free_vecs+= d->size_real_BV;
164:     } else {
165:       d->size_real_BV = 0;
166:       d->real_BV = NULL;
167:       d->BV_shift = PETSC_FALSE;
168:     }
169:     if (!std_probl) {
170:       d->real_G = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj;
171:       d->T = b->free_scalars; b->free_scalars+= b->max_size_proj*b->max_size_proj;
172:     } else {
173:       d->real_G = NULL;
174:       d->T = NULL;
175:     }
176:     if (d->B && !her_ind_probl) {
177:       d->cT = b->free_scalars; b->free_scalars+= b->max_nev*b->max_nev;
178:       d->ldcT = b->max_nev;
179:     } else {
180:       d->cT = NULL;
181:       d->ldcT = 0;
182:     }
183:     if (d->eps->arbitrary) {
184:       d->eps->rr = b->free_scalars; b->free_scalars+= b->size_V;
185:       d->eps->ri = b->free_scalars; b->free_scalars+= b->size_V;
186:     } else {
187:       d->eps->rr = NULL;
188:       d->eps->ri = NULL;
189:     }
190:     /* Create a DS if the method works with Schur decompositions */
191:     if (d->cS) {
192:       DSCreate(PetscObjectComm((PetscObject)d->eps->ds),&d->conv_ps);
193:       DSSetType(d->conv_ps,d->cT ? DSGNHEP : DSNHEP);
194:       /* Transfer as much as possible options from eps->ds to conv_ps */
195:       DSGetOptionsPrefix(d->eps->ds,&prefix);
196:       DSSetOptionsPrefix(d->conv_ps,prefix);
197:       DSSetFromOptions(d->conv_ps);
198:       DSGetEigenvalueComparison(d->eps->ds,&f,&ctx);
199:       DSSetEigenvalueComparison(d->conv_ps,f,ctx);
200:       DSAllocate(d->conv_ps,b->max_nev);
201:       PetscLogObjectParent(d->eps,d->conv_ps);
202:     } else {
203:       d->conv_ps = NULL;
204:     }
205:     d->calcPairs = dvd_calcpairs_proj;
206:     d->calcpairs_residual = dvd_calcpairs_res_0;
207:     d->calcpairs_residual_eig = dvd_calcpairs_eig_res_0;
208:     d->calcpairs_proj_res = dvd_calcpairs_proj_res;
209:     d->calcpairs_selectPairs = dvd_calcpairs_selectPairs;
210:     d->ipI = ipI;
211:     /* Create and configure a DS for solving the projected problems */
212:     if (d->real_W) {    /* If we use harmonics */
213:       dstype = DSGNHEP;
214:     } else {
215:       if (ind_probl) {
216:         dstype = DSGHIEP;
217:       } else if (std_probl) {
218:         dstype = her_probl ? DSHEP : DSNHEP;
219:       } else {
220:         dstype = her_probl ? DSGHEP : DSGNHEP;
221:       }
222:     }
223:     d->ps = d->eps->ds;
224:     DSSetType(d->ps,dstype);
225:     DSAllocate(d->ps,d->max_size_proj);

227:     DVD_FL_ADD(d->startList, dvd_calcpairs_qz_start);
228:     DVD_FL_ADD(d->destroyList, dvd_calcpairs_qz_d);
229:   }
230:   return(0);
231: }

235: PetscErrorCode dvd_calcpairs_qz_start(dvdDashboard *d)
236: {
237:   PetscBool her_probl,ind_probl,her_ind_probl;
238:   PetscInt  i;

241:   her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE;
242:   ind_probl = DVD_IS(d->sEP, DVD_EP_INDEFINITE)?PETSC_TRUE:PETSC_FALSE;
243:   her_ind_probl = (her_probl || ind_probl)? PETSC_TRUE:PETSC_FALSE;

245:   d->size_V = 0;
246:   d->V = d->real_V;
247:   d->cX = d->real_V;
248:   d->size_cX = 0;
249:   d->max_size_V = d->size_real_V;
250:   d->W = d->real_W;
251:   d->max_size_W = d->size_real_W;
252:   d->size_W = 0;
253:   d->size_AV = 0;
254:   d->AV = d->real_AV;
255:   d->max_size_AV = d->size_real_AV;
256:   d->size_H = 0;
257:   d->H = d->real_H;
258:   if (d->cS) for (i=0; i<d->max_size_cS*d->max_size_cS; i++) d->cS[i] = 0.0;
259:   d->size_BV = 0;
260:   d->BV = d->real_BV;
261:   d->max_size_BV = d->size_real_BV;
262:   d->size_G = 0;
263:   d->G = d->real_G;
264:   if (d->cT) for (i=0; i<d->max_size_cS*d->max_size_cS; i++) d->cT[i] = 0.0;
265:   d->cY = d->B && !her_ind_probl ? d->W : NULL;
266:   d->BcX = d->orthoV_type == EPS_ORTH_I && d->B && her_probl ? d->BcX : NULL;
267:   d->size_cY = 0;
268:   d->size_BcX = 0;
269:   d->cX_in_V = d->cX_in_H = d->cX_in_G = d->cX_in_W = d->cX_in_AV = d->cX_in_BV = 0;
270:   d->nBV = d->nBcX = d->real_nBV;
271:   return(0);
272: }

276: PetscErrorCode dvd_calcpairs_qz_d(dvdDashboard *d)
277: {
278:   PetscErrorCode  ierr;

281:   DSDestroy(&d->conv_ps);
282:   return(0);
283: }

287: PetscErrorCode dvd_calcpairs_proj(dvdDashboard *d)
288: {
289:   PetscErrorCode  ierr;
290:   DvdReduction    r;
291: #define MAX_OPS 7
292:   DvdReductionChunk
293:                   ops[MAX_OPS];
294:   DvdMult_copy_func
295:                   sr[MAX_OPS], *sr0 = sr;
296:   PetscInt        size_in, i;
297:   PetscScalar     *in = d->auxS, *out;
298:   PetscBool       stdp;

301:   stdp = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
302:   size_in =
303:     (d->size_cX+d->V_tra_s-d->cX_in_H)*d->V_tra_s*(d->cT?2:(d->cS?1:0)) + /* updateV0,W0 */
304:     (d->size_H*(d->V_new_e-d->V_new_s)*2+
305:       (d->V_new_e-d->V_new_s)*(d->V_new_e-d->V_new_s))*(!stdp?2:1); /* updateAV1,BV1 */

307:   out = in+size_in;

309:   /* Check consistency */
310:   if (2*size_in > d->size_auxS) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

312:   /* Prepare reductions */
313:   SlepcAllReduceSumBegin(ops, MAX_OPS, in, out, size_in, &r,
314:                                 PetscObjectComm((PetscObject)d->V[0]));
315:   /* Allocate size_in */
316:   d->auxS+= size_in;
317:   d->size_auxS-= size_in;

319:   /* Update AV, BV, W and the projected matrices */
320:   /* 1. S <- S*MT */
321:   dvd_calcpairs_updateV0(d, &r, &sr0);
322:   dvd_calcpairs_updateW0(d, &r, &sr0);
323:   dvd_calcpairs_updateAV0(d);
324:   dvd_calcpairs_updateBV0(d);
325:   /* 2. V <- orth(V, V_new) */
326:   dvd_calcpairs_updateV1(d);
327:   /* 3. AV <- [AV A * V(V_new_s:V_new_e-1)] */
328:   /* Check consistency */
329:   if (d->size_AV != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
330:   for (i=d->V_new_s; i<d->V_new_e; i++) {
331:     MatMult(d->A, d->V[i], d->AV[i]);
332:   }
333:   d->size_AV = d->V_new_e;
334:   /* 4. BV <- [BV B * V(V_new_s:V_new_e-1)] */
335:   if (d->B && d->orthoV_type != EPS_ORTH_BOPT) {
336:     /* Check consistency */
337:     if (d->size_BV != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
338:     for (i=d->V_new_s; i<d->V_new_e; i++) {
339:       MatMult(d->B, d->V[i], d->BV[i]);
340:     }
341:     d->size_BV = d->V_new_e;
342:   }
343:   /* 5 <- W <- [W f(AV,BV)] */
344:   dvd_calcpairs_updateW1(d);
345:   dvd_calcpairs_updateAV1(d, &r, &sr0);
346:   dvd_calcpairs_updateBV1(d, &r, &sr0);

348:   /* Deallocate size_in */
349:   d->auxS-= size_in;
350:   d->size_auxS+= size_in;

352:   /* Do reductions */
353:   SlepcAllReduceSumEnd(&r);

355:   /* Perform the transformation on the projected problem */
356:   if (d->calcpairs_proj_trans) {
357:     d->calcpairs_proj_trans(d);
358:   }

360:   d->V_tra_s = d->V_tra_e = 0;
361:   d->V_new_s = d->V_new_e;

363:   /* Solve the projected problem */
364:   if (d->size_H>0) {
365:     dvd_calcpairs_projeig_solve(d);
366:   }

368:   /* Check consistency */
369:   if (d->size_V != d->V_new_e || d->size_V+d->cX_in_H != d->size_H || d->cX_in_V != d->cX_in_H ||
370:       d->size_V != d->size_AV || d->cX_in_H != d->cX_in_AV ||
371:         (DVD_ISNOT(d->sEP, DVD_EP_STD) && (
372:           d->size_V+d->cX_in_G != d->size_G || d->cX_in_H != d->cX_in_G ||
373:           d->size_H != d->size_G || (d->BV && (
374:             d->size_V != d->size_BV || d->cX_in_H != d->cX_in_BV)))) ||
375:       (d->W && d->size_W != d->size_V)) {
376:     SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");
377:   }
378:   return(0);
379: #undef MAX_OPS
380: }

382: /**** Basic routines **********************************************************/

386: /* auxV: V_tra_s, DvdMult_copy_func: 1 */
387: PetscErrorCode dvd_calcpairs_updateV0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)
388: {
389:   PetscErrorCode  ierr;
390:   PetscInt        rm,i,ld;
391:   PetscScalar     *pQ;

394:   if (d->V_tra_s == 0 && d->V_tra_e == 0) return(0);

396:   /* Update nBcX and nBV */
397:   if (d->nBcX && d->nBpX && d->nBV) {
398:     d->nBV+= d->V_tra_s;
399:     for (i=0; i<d->V_tra_s; i++) d->nBcX[d->size_cX+i] = d->nBpX[i];
400:     for (i=d->V_tra_s; i<d->V_tra_e; i++) d->nBV[i-d->V_tra_s] = d->nBpX[i];
401:   }

403:   /* cX <- [cX V*MT(0:V_tra_s-1)], V <- V*MT(V_tra_s:V_tra_e) */
404:   dvd_calcpairs_updateBV0_gen(d,d->real_V,&d->size_cX,&d->V,&d->size_V,&d->max_size_V,PETSC_TRUE,&d->cX_in_V,DS_MAT_Q);

406:   /* Udpate cS for standard problems */
407:   if (d->cS && !d->cT && !d->cY && (d->V_tra_s > d->max_cX_in_proj || d->size_cX >= d->nev)) {
408:     /* Check consistency */
409:     if (d->size_cS+d->V_tra_s != d->size_cX) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

411:     /* auxV <- AV * ps.Q(0:V_tra_e-1) */
412:     rm = d->size_cX>=d->nev?0:d->max_cX_in_proj;
413:     DSGetLeadingDimension(d->ps,&ld);
414:     DSGetArray(d->ps,DS_MAT_Q,&pQ);
415:     SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->AV-d->cX_in_AV,d->size_AV+d->cX_in_AV,pQ,ld,d->size_MT,d->V_tra_s-rm);
416:     DSRestoreArray(d->ps,DS_MAT_Q,&pQ);

418:     /* cS(:, size_cS:) <- cX' * auxV */
419:     VecsMultS(&d->cS[d->ldcS*d->size_cS], 0, d->ldcS, d->cX, 0, d->size_cX-rm, d->auxV, 0, d->V_tra_s-rm, r, (*sr)++);
420:     d->size_cS+= d->V_tra_s-rm;
421:   }
422:   return(0);
423: }

427: /* auxS: size_cX+V_new_e+1 */
428: PetscErrorCode dvd_calcpairs_updateV1(dvdDashboard *d)
429: {
430:   PetscErrorCode  ierr;
431:   Vec             *cX = d->BcX? d->BcX : ((d->cY && !d->W)? d->cY : d->cX);

434:   if (d->V_new_s == d->V_new_e) return(0);

436:   /* Check consistency */
437:   if (d->size_V != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

439:   /* V <- gs([cX V(0:V_new_s-1)], V(V_new_s:V_new_e-1)) */
440:   if (d->orthoV_type == EPS_ORTH_BOPT) {
441:     dvd_BorthV_faster(d->ipV,d->eps->defl,d->BDS,d->nBDS,d->eps->nds,d->cX,d->real_BV,d->nBcX,d->size_cX,d->V,d->BV,d->nBV,d->V_new_s,d->V_new_e,d->auxS,d->eps->rand);
442:     d->size_BV = d->V_new_e;
443:   } else if (DVD_IS(d->sEP, DVD_EP_INDEFINITE)) {
444:     dvd_BorthV_stable(d->ipV,d->eps->defl,d->nBDS,d->eps->nds,d->cX,d->nBcX,d->size_cX,d->V,d->nBV,d->V_new_s,d->V_new_e,d->auxS,d->eps->rand);
445:   } else {
446:     dvd_orthV(d->ipV,d->eps->defl,d->eps->nds,cX,d->size_cX,d->V,d->V_new_s,d->V_new_e,d->auxS,d->eps->rand);
447:   }
448:   d->size_V = d->V_new_e;
449:   return(0);
450: }

454: /* auxV: V_tra_s, DvdMult_copy_func: 2 */
455: PetscErrorCode dvd_calcpairs_updateW0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)
456: {
457:   PetscErrorCode  ierr;
458:   PetscInt        rm,ld;
459:   PetscScalar     *pQ;

462:   if (d->V_tra_s == 0 && d->V_tra_e == 0) return(0);

464:   /* cY <- [cY W*ps.Z(0:V_tra_s-1)], W <- W*ps.Z(V_tra_s:V_tra_e) */
465:   dvd_calcpairs_updateBV0_gen(d,d->real_W,&d->size_cY,&d->W,&d->size_W,&d->max_size_W,d->W_shift,&d->cX_in_W,DS_MAT_Z);

467:   /* Udpate cS and cT */
468:   if (d->cT && (d->V_tra_s > d->max_cX_in_proj || d->size_cX >= d->nev)) {
469:     /* Check consistency */
470:     if (d->size_cS+d->V_tra_s != d->size_cX || (d->W && d->size_cY != d->size_cX)) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

472:     DSGetLeadingDimension(d->ps,&ld);
473:     DSGetArray(d->ps,DS_MAT_Q,&pQ);
474:     /* auxV <- AV * ps.Q(0:V_tra_e-1) */
475:     rm = d->size_cX>=d->nev?0:d->max_cX_in_proj;
476:     SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->AV-d->cX_in_H,d->size_AV-d->cX_in_H,pQ,ld,d->size_MT,d->V_tra_s-rm);

478:     /* cS(:, size_cS:) <- cY' * auxV */
479:     VecsMultS(&d->cS[d->ldcS*d->size_cS], 0, d->ldcS, d->cY?d->cY:d->cX, 0, d->size_cX-rm, d->auxV, 0, d->V_tra_s-rm, r, (*sr)++);

481:     /* auxV <- BV * ps.Q(0:V_tra_e-1) */
482:     SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->BV-d->cX_in_H,d->size_BV-d->cX_in_H,pQ,ld,d->size_MT,d->V_tra_s-rm);
483:     DSRestoreArray(d->ps,DS_MAT_Q,&pQ);

485:     /* cT(:, size_cS:) <- cY' * auxV */
486:     VecsMultS(&d->cT[d->ldcS*d->size_cS], 0, d->ldcS, d->cY?d->cY:d->cX, 0, d->size_cX-rm, d->auxV, 0, d->V_tra_s-rm, r, (*sr)++);

488:     d->size_cS+= d->V_tra_s-rm;
489:     d->size_cT+= d->V_tra_s-rm;
490:   }
491:   return(0);
492: }

496: /* auxS: size_cX+V_new_e+1 */
497: PetscErrorCode dvd_calcpairs_updateW1(dvdDashboard *d)
498: {
499:   PetscErrorCode  ierr;
500:   Vec             *cY = d->cY?d->cY:d->cX;

503:   if (!d->W || d->V_new_s == d->V_new_e) return(0);

505:   /* Check consistency */
506:   if (d->size_W != d->V_new_s) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

508:   /* Update W */
509:   d->calcpairs_W(d);

511:   /* W <- gs([cY W(0:V_new_s-1)], W(V_new_s:V_new_e-1)) */
512:   dvd_orthV(d->ipW, NULL, 0, cY, d->size_cX, d->W-d->cX_in_W, d->V_new_s+d->cX_in_W, d->V_new_e+d->cX_in_W, d->auxS, d->eps->rand);
513:   d->size_W = d->V_new_e;
514:   return(0);
515: }

519: /* auxS: size_H*(V_tra_e-V_tra_s) */
520: PetscErrorCode dvd_calcpairs_updateAV0(dvdDashboard *d)
521: {
522:   PetscErrorCode  ierr;
523:   PetscInt        cMT,tra_s,ld;
524:   PetscScalar     *pQ,*pZ;

527:   if (d->V_tra_s == 0 && d->V_tra_e == 0) return(0);

529:   /* AV(V_tra_s-cp-1:) = cAV*ps.Q(V_tra_s:) */
530:   dvd_calcpairs_updateBV0_gen(d,d->real_AV,NULL,&d->AV,&d->size_AV,&d->max_size_AV,PETSC_FALSE,&d->cX_in_AV,DS_MAT_Q);
531:   tra_s = PetscMax(d->V_tra_s-d->max_cX_in_proj,0);
532:   cMT = d->V_tra_e - tra_s;

534:   /* Update H <- ps.Z(tra_s)' * (H * ps.Q(tra_s:)) */
535:   DSGetLeadingDimension(d->ps,&ld);
536:   DSGetArray(d->ps,DS_MAT_Q,&pQ);
537:   if (d->W) {
538:     DSGetArray(d->ps,DS_MAT_Z,&pZ);
539:   } else pZ = pQ;
540:   SlepcDenseMatProdTriang(d->auxS,0,d->ldH,d->H,d->sH,d->ldH,d->size_H,d->size_H,PETSC_FALSE,&pQ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_FALSE);
541:   SlepcDenseMatProdTriang(d->H,d->sH,d->ldH,&pZ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_TRUE,d->auxS,0,d->ldH,d->size_H,cMT,PETSC_FALSE);
542:   DSRestoreArray(d->ps,DS_MAT_Q,&pQ);
543:   if (d->W) {
544:     DSRestoreArray(d->ps,DS_MAT_Z,&pZ);
545:   }
546:   d->size_H = cMT;
547:   d->cX_in_H = d->cX_in_AV;
548:   return(0);
549: }

553: /* DvdMult_copy_func: 2 */
554: PetscErrorCode dvd_calcpairs_updateAV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)
555: {
556:   PetscErrorCode  ierr;
557:   Vec             *W = d->W?d->W:d->V;

560:   if (d->V_new_s == d->V_new_e) return(0);

562:   /* Check consistency */
563:   if (d->size_H != d->V_new_s+d->cX_in_H || d->size_V != d->V_new_e) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

565:   /* H = [H               W(old)'*AV(new);
566:           W(new)'*AV(old) W(new)'*AV(new) ],
567:      being old=0:V_new_s-1, new=V_new_s:V_new_e-1 */
568:   VecsMultS(d->H,d->sH,d->ldH,W-d->cX_in_H,d->V_new_s+d->cX_in_H, d->V_new_e+d->cX_in_H, d->AV-d->cX_in_H,d->V_new_s+d->cX_in_H,d->V_new_e+d->cX_in_H, r, (*sr)++);
569:   d->size_H = d->V_new_e+d->cX_in_H;
570:   return(0);
571: }

575: /* auxS: max(BcX*(size_cX+V_new_e+1), size_G*(V_tra_e-V_tra_s)) */
576: PetscErrorCode dvd_calcpairs_updateBV0(dvdDashboard *d)
577: {
578:   PetscErrorCode  ierr;
579:   PetscInt        cMT,tra_s,i,ld;
580:   PetscBool       lindep;
581:   PetscReal       norm;
582:   PetscScalar     *pQ,*pZ;

585:   if (d->V_tra_s == 0 && d->V_tra_e == 0) return(0);

587:   /* BV <- BV*MT */
588:   dvd_calcpairs_updateBV0_gen(d,d->real_BV,NULL,&d->BV,&d->size_BV,&d->max_size_BV,d->BV_shift,&d->cX_in_BV,DS_MAT_Q);

590:   /* If BcX, BcX <- orth(BcX) */
591:   if (d->BcX) {
592:     for (i=0; i<d->V_tra_s; i++) {
593:       IPOrthogonalize(d->ipI, 0, NULL, d->size_BcX+i, NULL,
594:                              d->BcX, d->BcX[d->size_BcX+i], NULL,
595:                              &norm, &lindep);
596:       if (lindep) SETERRQ(PETSC_COMM_SELF,1, "Error during orth(BcX, B*cX(new))");
597:       VecScale(d->BcX[d->size_BcX+i], 1.0/norm);
598:     }
599:     d->size_BcX+= d->V_tra_s;
600:   }

602:   /* Update G <- ps.Z' * (G * ps.Q) */
603:   if (d->G) {
604:     tra_s = PetscMax(d->V_tra_s-d->max_cX_in_proj,0);
605:     cMT = d->V_tra_e - tra_s;
606:     DSGetLeadingDimension(d->ps,&ld);
607:     DSGetArray(d->ps,DS_MAT_Q,&pQ);
608:     if (d->W) {
609:       DSGetArray(d->ps,DS_MAT_Z,&pZ);
610:     } else pZ = pQ;
611:     SlepcDenseMatProdTriang(d->auxS,0,d->ldH,d->G,d->sG,d->ldH,d->size_G,d->size_G,PETSC_FALSE,&pQ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_FALSE);
612:     SlepcDenseMatProdTriang(d->G,d->sG,d->ldH,&pZ[ld*tra_s],0,ld,d->size_MT,cMT,PETSC_TRUE,d->auxS,0,d->ldH,d->size_G,cMT,PETSC_FALSE);
613:     DSRestoreArray(d->ps,DS_MAT_Q,&pQ);
614:     if (d->W) {
615:       DSRestoreArray(d->ps,DS_MAT_Z,&pZ);
616:     }
617:     d->size_G = cMT;
618:     d->cX_in_G = d->cX_in_V;
619:   }
620:   return(0);
621: }

625: /* DvdMult_copy_func: 2 */
626: PetscErrorCode dvd_calcpairs_updateBV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)
627: {
628:   PetscErrorCode  ierr;
629:   Vec             *W = d->W?d->W:d->V, *BV = d->BV?d->BV:d->V;

632:   if (!d->G || d->V_new_s == d->V_new_e) return(0);

634:   /* G = [G               W(old)'*BV(new);
635:           W(new)'*BV(old) W(new)'*BV(new) ],
636:      being old=0:V_new_s-1, new=V_new_s:V_new_e-1 */
637:   VecsMultS(d->G,d->sG,d->ldH,W-d->cX_in_G,d->V_new_s+d->cX_in_G,d->V_new_e+d->cX_in_G,BV-d->cX_in_G,d->V_new_s+d->cX_in_G,d->V_new_e+d->cX_in_G,r,(*sr)++);
638:   d->size_G = d->V_new_e+d->cX_in_G;
639:   return(0);
640: }

642: /* in complex, d->size_H real auxiliar values are needed */
645: PetscErrorCode dvd_calcpairs_projeig_solve(dvdDashboard *d)
646: {
647:   PetscErrorCode  ierr;
648:   PetscScalar     *A;
649:   PetscInt        ld,i;

652:   DSSetDimensions(d->ps,d->size_H,0,0,0);
653:   DSGetLeadingDimension(d->ps,&ld);
654:   DSGetArray(d->ps,DS_MAT_A,&A);
655:   SlepcDenseCopyTriang(A,0,ld,d->H,d->sH,d->ldH,d->size_H,d->size_H);
656:   DSRestoreArray(d->ps,DS_MAT_A,&A);
657:   if (d->G) {
658:     DSGetArray(d->ps,DS_MAT_B,&A);
659:     SlepcDenseCopyTriang(A,0,ld,d->G,d->sG,d->ldH,d->size_H,d->size_H);
660:     DSRestoreArray(d->ps,DS_MAT_B,&A);
661:   }
662:   /* Set the signature on projected matrix B */
663:   if (DVD_IS(d->sEP, DVD_EP_INDEFINITE)) {
664:     DSGetArray(d->ps,DS_MAT_B,&A);
665:     PetscMemzero(A,sizeof(PetscScalar)*d->size_H*ld);
666:     for (i=0; i<d->size_H; i++) {
667:       A[i+ld*i] = d->nBV[i];
668:     }
669:     DSRestoreArray(d->ps,DS_MAT_B,&A);
670:   }
671:   DSSetState(d->ps,DS_STATE_RAW);
672:   DSSolve(d->ps,d->eigr-d->cX_in_H,d->eigi-d->cX_in_H);
673:   return(0);
674: }

678: PetscErrorCode dvd_calcpairs_apply_arbitrary(dvdDashboard *d,PetscInt r_s,PetscInt r_e,PetscScalar **rr_,PetscScalar **ri_)
679: {
680:   PetscInt        i,k,ld;
681:   PetscScalar     *pX,*rr,*ri,ar,ai;
682:   Vec             *X = d->auxV,xr,xi;
683:   PetscErrorCode  ierr;
684: #if !defined(PETSC_USE_COMPLEX)
685:   PetscInt        j;
686: #endif

689:   /* Quick exit without neither arbitrary selection nor harmonic extraction */
690:   if (!d->eps->arbitrary && !d->calcpairs_eig_backtrans) {
691:     *rr_ = d->eigr-d->cX_in_H;
692:     *ri_ = d->eigi-d->cX_in_H;
693:     return(0);
694:   }

696:   /* Quick exit without arbitrary selection, but with harmonic extraction */
697:   if (!d->eps->arbitrary && d->calcpairs_eig_backtrans) {
698:     *rr_ = rr = d->auxS;
699:     *ri_ = ri = d->auxS+r_e-r_s;
700:     for (i=r_s; i<r_e; i++) {
701:       d->calcpairs_eig_backtrans(d,d->eigr[i],d->eigi[i],&rr[i-r_s],&ri[i-r_s]);
702:     }
703:     return(0);
704:   }

706:   DSGetLeadingDimension(d->ps,&ld);
707:   *rr_ = rr = d->eps->rr + d->eps->nconv;
708:   *ri_ = ri = d->eps->ri + d->eps->nconv;
709:   for (i=r_s; i<r_e; i++) {
710:     k = i;
711:     DSVectors(d->ps,DS_MAT_X,&k,NULL);
712:     DSNormalize(d->ps,DS_MAT_X,i);
713:     DSGetArray(d->ps,DS_MAT_X,&pX);
714:     dvd_improvex_compute_X(d,i,k+1,X,pX,ld);
715:     DSRestoreArray(d->ps,DS_MAT_X,&pX);
716: #if !defined(PETSC_USE_COMPLEX)
717:     if (d->nX[i] != 1.0) {
718:       for (j=i; j<k+1; j++) {
719:         VecScale(X[j-i],1/d->nX[i]);
720:       }
721:     }
722:     xr = X[0];
723:     xi = X[1];
724:     if (i == k) {
725:       VecZeroEntries(xi);
726:     }
727: #else
728:     xr = X[0];
729:     xi = NULL;
730:     if (d->nX[i] != 1.0) {
731:       VecScale(xr,1.0/d->nX[i]);
732:     }
733: #endif
734:     if (d->calcpairs_eig_backtrans) {
735:       d->calcpairs_eig_backtrans(d,d->eigr[i],d->eigi[i],&ar,&ai);
736:     } else {
737:       ar = d->eigr[i];
738:       ai = d->eigi[i];
739:     }
740:     (d->eps->arbitrary)(ar,ai,xr,xi,&rr[i-r_s],&ri[i-r_s],d->eps->arbitraryctx);
741: #if !defined(PETSC_USE_COMPLEX)
742:     if (i != k) {
743:       rr[i+1-r_s] = rr[i-r_s];
744:       ri[i+1-r_s] = ri[i-r_s];
745:       i++;
746:     }
747: #endif
748:   }
749:   return(0);
750: }

754: PetscErrorCode dvd_calcpairs_selectPairs(dvdDashboard *d,PetscInt n)
755: {
756:   PetscInt        k;
757:   PetscScalar     *rr,*ri;
758:   PetscErrorCode  ierr;

761:   n = PetscMin(n,d->size_H-d->cX_in_H);
762:   /* Put the best n pairs at the beginning. Useful for restarting */
763:   DSSetDimensions(d->ps,0,0,d->cX_in_H,0);
764:   dvd_calcpairs_apply_arbitrary(d,d->cX_in_H,d->size_H,&rr,&ri);
765:   k = n;
766:   DSSort(d->ps,d->eigr-d->cX_in_H,d->eigi-d->cX_in_H,rr,ri,&k);
767:   /* Put the best pair at the beginning. Useful to check its residual */
768: #if !defined(PETSC_USE_COMPLEX)
769:   if (n != 1 && (n != 2 || d->eigi[0] == 0.0))
770: #else
771:   if (n != 1)
772: #endif
773:   {
774:     dvd_calcpairs_apply_arbitrary(d,d->cX_in_H,d->size_H,&rr,&ri);
775:     k = 1;
776:     DSSort(d->ps,d->eigr-d->cX_in_H,d->eigi-d->cX_in_H,rr,ri,&k);
777:   }
778:   if (d->calcpairs_eigs_trans) {
779:     d->calcpairs_eigs_trans(d);
780:   }
781:   return(0);
782: }

786: /* Compute the residual vectors R(i) <- (AV - BV*eigr(i))*pX(i), and also
787:    the norm associated to the Schur pair, where i = r_s..r_e
788: */
789: PetscErrorCode dvd_calcpairs_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R)
790: {
791:   PetscInt        i,ldpX;
792:   PetscScalar     *pX;
793:   PetscErrorCode  ierr;
794:   Vec             *BV = d->BV?d->BV:d->V;

797:   DSGetLeadingDimension(d->ps,&ldpX);
798:   DSGetArray(d->ps,DS_MAT_Q,&pX);
799:   for (i=r_s; i<r_e; i++) {
800:     /* nX(i) <- ||X(i)|| */
801:     if (d->correctXnorm) {
802:       /* R(i) <- V*pX(i) */
803:       SlepcUpdateVectorsZ(&R[i-r_s],0.0,1.0,&d->V[-d->cX_in_H],d->size_V+d->cX_in_H,&pX[ldpX*(i+d->cX_in_H)],ldpX,d->size_H,1);
804:       VecNorm(R[i-r_s],NORM_2,&d->nX[i]);
805:     } else d->nX[i] = 1.0;
806:     /* R(i-r_s) <- AV*pX(i) */
807:     SlepcUpdateVectorsZ(&R[i-r_s],0.0,1.0,&d->AV[-d->cX_in_H],d->size_AV+d->cX_in_H,&pX[ldpX*(i+d->cX_in_H)],ldpX,d->size_H,1);
808:     /* R(i-r_s) <- R(i-r_s) - eigr(i)*BV*pX(i) */
809:     SlepcUpdateVectorsZ(&R[i-r_s],1.0,-d->eigr[i+d->cX_in_H],&BV[-d->cX_in_H],d->size_V+d->cX_in_H,&pX[ldpX*(i+d->cX_in_H)],ldpX,d->size_H,1);
810:   }
811:   DSRestoreArray(d->ps,DS_MAT_Q,&pX);
812:   d->calcpairs_proj_res(d, r_s, r_e, R);
813:   return(0);
814: }

818: PetscErrorCode dvd_calcpairs_proj_res(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R)
819: {
820:   PetscInt        i;
821:   PetscErrorCode  ierr;
822:   PetscBool       lindep;
823:   Vec             *cX;

826:   /* If exists the BcX, R <- orth(BcX, R), nR[i] <- ||R[i]|| */
827:   if (d->BcX)
828:     cX = d->BcX;

830:   /* If exists left subspace, R <- orth(cY, R), nR[i] <- ||R[i]|| */
831:   else if (d->cY) cX = d->cY;

833:   /* If fany configurations, R <- orth(cX, R), nR[i] <- ||R[i]|| */
834:   else if (!(DVD_IS(d->sEP, DVD_EP_STD) && DVD_IS(d->sEP, DVD_EP_HERMITIAN))) cX = d->cX;

836:   /* Otherwise, nR[i] <- ||R[i]|| */
837:   else cX = NULL;

839:   if (cX) {
840:     if (cX && d->orthoV_type == EPS_ORTH_BOPT) {
841:       Vec auxV;
842:       VecDuplicate(d->auxV[0],&auxV);
843:       for (i=0; i<r_e-r_s; i++) {
844:         IPBOrthogonalize(d->ipV,d->eps->nds,d->eps->defl,d->BDS,d->nBDS,d->size_cX,NULL,d->cX,d->real_BV,d->nBcX,R[i],auxV,NULL,&d->nR[r_s+i],&lindep);
845:       }
846:       VecDestroy(&auxV);
847:     } else if (DVD_IS(d->sEP, DVD_EP_INDEFINITE)) {
848:       for (i=0; i<r_e-r_s; i++) {
849:         IPPseudoOrthogonalize(d->ipV,d->size_cX,cX,d->nBcX,R[i],NULL,&d->nR[r_s+i],&lindep);
850:       }
851:     } else {
852:       for (i=0; i<r_e-r_s; i++) {
853:         IPOrthogonalize(d->ipI,0,NULL,d->size_cX,NULL,cX,R[i],NULL,&d->nR[r_s+i],&lindep);
854:       }
855:     }
856:     if (lindep || (PetscAbs(d->nR[r_s+i]) < PETSC_MACHINE_EPSILON)) {
857:       PetscInfo2(d->eps,"The computed eigenvector residual %D is too low, %G!\n",r_s+i,d->nR[r_s+i]);
858:     }
859:   }
860:   if (!cX || (cX && d->orthoV_type == EPS_ORTH_BOPT)) {
861:     for (i=0;i<r_e-r_s;i++) {
862:       VecNormBegin(R[i],NORM_2,&d->nR[r_s+i]);
863:     }
864:     for (i=0;i<r_e-r_s;i++) {
865:       VecNormEnd(R[i],NORM_2,&d->nR[r_s+i]);
866:     }
867:   }
868:   return(0);
869: }

873: /* Compute the residual vectors R(i) <- (AV - BV*eigr(i))*pX(i), and also
874:    the norm associated to the eigenpair, where i = r_s..r_e
875:    R, vectors of Vec of size r_e-r_s,
876:    auxV, PetscMax(r_e+cX_in_H, 2*(r_e-r_s)) vectors,
877:    auxS, auxiliar vector of size (d->size_cX+r_e)^2+6(d->size_cX+r_e)+(r_e-r_s)*d->size_H
878: */
879: PetscErrorCode dvd_calcpairs_eig_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R)
880: {
881:   PetscInt        i,size_in,n,ld,ldc,k;
882:   PetscErrorCode  ierr;
883:   Vec             *Bx;
884:   PetscScalar     *cS,*cT,*pcX,*pX,*pX0;
885:   DvdReduction    r;
886:   DvdReductionChunk
887:                   ops[2];
888:   DvdMult_copy_func
889:                   sr[2];
890: #if !defined(PETSC_USE_COMPLEX)
891:   PetscScalar     b[8];
892:   Vec             X[4];
893: #endif

896:   /* Quick return */
897:   if (!d->cS) return(0);

899:   size_in = (d->size_cX+r_e)*(d->cX_in_AV+r_e)*(d->cT?2:1);
900:   /* Check consistency */
901:   if (d->size_auxV < PetscMax(2*(r_e-r_s),d->cX_in_AV+r_e) || d->size_auxS < PetscMax(d->size_H*(r_e-r_s) /* pX0 */, 2*size_in /* SlepcAllReduceSum */)) SETERRQ(PETSC_COMM_SELF,1, "Consistency broken");

903:   /*
904:     Compute expanded cS = conv_ps.A, cT = conv_ps.B:
905:     conv_ps.A = [ cX'*A*cX    cX'*A*X ]
906:                 [  X'*A*cX     X'*A*X ], where cX'*A*cX = cS and X = V*ps.Q
907:   */
908:   n = d->size_cX+r_e;
909:   DSSetDimensions(d->conv_ps,n,0,0,0);
910:   DSGetLeadingDimension(d->conv_ps,&ldc);
911:   DSGetArray(d->conv_ps,DS_MAT_A,&cS);
912:   SlepcDenseCopyTriang(cS,0,ldc,d->cS,0,d->ldcS,d->size_cS,d->size_cS);
913:   if (d->cT) {
914:     DSGetArray(d->conv_ps,DS_MAT_B,&cT);
915:     SlepcDenseCopyTriang(cT,0,ldc,d->cT,0,d->ldcT,d->size_cS,d->size_cS);
916:   }
917:   DSGetLeadingDimension(d->ps,&ld);
918:   DSGetArray(d->ps,DS_MAT_Q,&pX);
919:   /* Prepare reductions */
920:   SlepcAllReduceSumBegin(ops,2,d->auxS,d->auxS+size_in,size_in,&r,PetscObjectComm((PetscObject)d->V[0]));
921:   /* auxV <- A*X = AV * pX(0:r_e+cX_in_H) */
922:   SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->AV-d->cX_in_AV,d->size_AV+d->cX_in_AV,pX,ld,d->size_H,d->cX_in_AV+r_e);
923:   /* cS(:, size_cS:) <- cX' * auxV */
924:   VecsMultS(&cS[ldc*d->size_cS],0,ldc,d->cY?d->cY:d->cX,0,d->size_cX+r_e,d->auxV,0,d->cX_in_AV+r_e,&r,&sr[0]);

926:   if (d->cT) {
927:     /* R <- BV * pX(0:r_e+cX_in_H) */
928:     SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->BV-d->cX_in_BV,d->size_BV+d->cX_in_BV,pX,ld,d->size_G,d->cX_in_BV+r_e);
929:     /* cT(:, size_cS:) <- cX' * auxV */
930:     VecsMultS(&cT[ldc*d->size_cT],0,ldc,d->cY?d->cY:d->cX,0,d->size_cY+r_e,d->auxV,0,d->cX_in_BV+r_e,&r,&sr[1]);
931:   }
932:   /* Do reductions */
933:   SlepcAllReduceSumEnd(&r);

935:   DSRestoreArray(d->conv_ps,DS_MAT_A,&cS);
936:   if (d->cT) {
937:     DSRestoreArray(d->conv_ps,DS_MAT_B,&cT);
938:   }
939:   DSSetState(d->conv_ps,DS_STATE_INTERMEDIATE);
940:   /* eig(S,T) */
941:   k = d->size_cX+r_s;
942:   DSVectors(d->conv_ps,DS_MAT_X,&k,NULL);
943:   DSNormalize(d->conv_ps,DS_MAT_X,d->size_cX+r_s);
944:   /* pX0 <- ps.Q(0:d->cX_in_AV+r_e-1) * conv_ps.X(size_cX-cX_in_H:) */
945:   pX0 = d->auxS;
946:   DSGetArray(d->conv_ps,DS_MAT_X,&pcX);
947:   SlepcDenseMatProd(pX0,d->size_H,0.0,1.0,&pX[(d->cX_in_AV+r_s)*ld],ld,d->size_H,r_e-r_s,PETSC_FALSE,&pcX[d->size_cX+d->size_cX*ldc],ldc,r_e+d->cX_in_H,r_e-r_s,PETSC_FALSE);
948:   DSRestoreArray(d->ps,DS_MAT_Q,&pX);
949:   /* auxV <- cX(0:size_cX-cX_in_AV)*conv_ps.X + V*pX0 */
950:   SlepcUpdateVectorsZ(d->auxV,0.0,1.0,d->cX,d->size_cX,&pcX[d->size_cX*ldc],ldc,d->size_cX,r_e-r_s);
951:   DSRestoreArray(d->conv_ps,DS_MAT_X,&pcX);
952:   SlepcUpdateVectorsZ(d->auxV,(d->size_cX-d->cX_in_AV==0)?0.0:1.0,1.0,d->V-d->cX_in_AV,d->size_V+d->cX_in_AV,pX0,d->size_H,d->size_H,r_e-r_s);
953:   /* nX <- ||auxV|| */
954:   for (i=0;i<r_e-r_s;i++) {
955:     VecNormBegin(d->auxV[i],NORM_2,&d->nX[r_s+i]);
956:   }
957:   for (i=0;i<r_e-r_s;i++) {
958:     VecNormEnd(d->auxV[i],NORM_2,&d->nX[r_s+i]);
959:   }
960:   /* R <- A*auxV */
961:   for (i=0; i<r_e-r_s; i++) {
962:     MatMult(d->A,d->auxV[i],R[i]);
963:   }
964:   /* Bx <- B*auxV */
965:   if (d->B) {
966:     Bx = &d->auxV[r_e-r_s];
967:     for (i=0; i<r_e-r_s; i++) {
968:       MatMult(d->B,d->auxV[i],Bx[i]);
969:     }
970:   } else Bx = d->auxV;
971:   /* R <- (A - eig*B)*V*pX */
972:   for (i=0;i<r_e-r_s;i++) {
973: #if !defined(PETSC_USE_COMPLEX)
974:     if (d->eigi[r_s+i] != 0.0) {
975:       /* [Ax_i Ax_i+1 Bx_i Bx_i+1]*= [   1        0
976:                                          0        1
977:                                       -eigr_i -eigi_i
978:                                        eigi_i -eigr_i] */
979:       b[0] = b[5] = 1.0;
980:       b[2] = b[7] = -d->eigr[r_s+i];
981:       b[6] = -(b[3] = d->eigi[r_s+i]);
982:       b[1] = b[4] = 0.0;
983:       X[0] = R[i]; X[1] = R[i+1]; X[2] = Bx[i]; X[3] = Bx[i+1];
984:       SlepcUpdateVectorsD(X,4,1.0,b,4,4,2,d->auxS,d->size_auxS);
985:       i++;
986:     } else
987: #endif
988:     {
989:       /* R <- Ax -eig*Bx */
990:       VecAXPBY(R[i], -d->eigr[r_s+i], 1.0, Bx[i]);
991:     }
992:   }
993:   /* nR <- ||R|| */
994:   for (i=0;i<r_e-r_s;i++) {
995:     VecNormBegin(R[i],NORM_2,&d->nR[r_s+i]);
996:   }
997:   for (i=0;i<r_e-r_s;i++) {
998:     VecNormEnd(R[i],NORM_2,&d->nR[r_s+i]);
999:   }
1000:   return(0);
1001: }


1004: /**** Pattern routines ********************************************************/

1006: /* BV <- BV*MT */
1009: PETSC_STATIC_INLINE PetscErrorCode dvd_calcpairs_updateBV0_gen(dvdDashboard *d,Vec *real_BV,PetscInt *size_cBV,Vec **BV,PetscInt *size_BV,PetscInt *max_size_BV,PetscBool BV_shift,PetscInt *cX_in_proj,DSMatType mat)
1010: {
1011:   PetscErrorCode  ierr;
1012:   PetscInt        cMT,rm,cp,tra_s,i,ld;
1013:   Vec             *nBV;
1014:   PetscScalar     *MT;

1017:   if (!real_BV || !*BV || (d->V_tra_s == 0 && d->V_tra_e == 0)) return(0);

1019:   DSGetLeadingDimension(d->ps,&ld);
1020:   DSGetArray(d->ps,mat,&MT);
1021:   if (d->V_tra_s > d->max_cX_in_proj && !BV_shift) {
1022:     tra_s = PetscMax(d->V_tra_s-d->max_cX_in_proj, 0);
1023:     cMT = d->V_tra_e - tra_s;
1024:     rm = d->V_tra_s - tra_s;
1025:     cp = PetscMin(d->max_cX_in_proj - rm, *cX_in_proj);
1026:     nBV = real_BV+d->max_cX_in_proj;
1027:     /* BV(-cp-rm:-1-rm) <- BV(-cp:-1) */
1028:     for (i=-cp; i<0; i++) {
1029:       VecCopy((*BV)[i], nBV[i-rm]);
1030:     }
1031:     /* BV(-rm:) <- BV*MT(tra_s:V_tra_e-1) */
1032:     SlepcUpdateVectorsZ(&nBV[-rm],0.0,1.0,*BV-*cX_in_proj,*size_BV+*cX_in_proj,&MT[ld*tra_s],ld,d->size_MT,cMT);
1033:     *size_BV = d->V_tra_e  - d->V_tra_s;
1034:     *max_size_BV-= nBV - *BV;
1035:     *BV = nBV;
1036:     if (cX_in_proj && d->max_cX_in_proj>0) *cX_in_proj = cp+rm;
1037:   } else if (d->V_tra_s <= d->max_cX_in_proj || BV_shift) {
1038:     /* [BcX BV] <- [BcX BV*MT] */
1039:     SlepcUpdateVectorsZ(*BV-*cX_in_proj,0.0,1.0,*BV-*cX_in_proj,*size_BV+*cX_in_proj,MT,ld,d->size_MT,d->V_tra_e);
1040:     *BV+= d->V_tra_s-*cX_in_proj;
1041:     *max_size_BV-= d->V_tra_s-*cX_in_proj;
1042:     *size_BV = d->V_tra_e  - d->V_tra_s;
1043:     if (size_cBV && BV_shift) *size_cBV = *BV - real_BV;
1044:     if (d->max_cX_in_proj>0) *cX_in_proj = PetscMin(*BV - real_BV, d->max_cX_in_proj);
1045:   } else { /* !BV_shift */
1046:     /* BV <- BV*MT(V_tra_s:) */
1047:     SlepcUpdateVectorsZ(*BV,0.0,1.0,*BV,*size_BV,&MT[d->V_tra_s*ld],ld,d->size_MT,d->V_tra_e-d->V_tra_s);
1048:     *size_BV = d->V_tra_e - d->V_tra_s;
1049:   }
1050:   DSRestoreArray(d->ps,mat,&MT);
1051:   return(0);
1052: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/index.html0000644000175000017500000000310012211062077023223 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

davidson.h
davidson.c
dvd_blas.c
dvd_calcpairs.c
dvd_improvex.c
dvd_initv.c
dvd_schm.c
dvd_testconv.c
dvd_updatev.c
dvd_utils.c
dvd_gd2.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_initv.c0000644000175000017500000001154012211062077023367 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Step: init subspace V - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" PetscErrorCode dvd_initV_classic_0(dvdDashboard *d); PetscErrorCode dvd_initV_krylov_0(dvdDashboard *d); PetscErrorCode dvd_initV_d(dvdDashboard *d); typedef struct { PetscInt k, /* desired initial subspace size */ user; /* number of user initial vectors */ void *old_initV_data; /* old initV data */ } dvdInitV; #undef __FUNCT__ #define __FUNCT__ "dvd_initV" PetscErrorCode dvd_initV(dvdDashboard *d, dvdBlackboard *b, PetscInt k,PetscInt user, PetscBool krylov) { PetscErrorCode ierr; dvdInitV *data; PetscFunctionBegin; /* Setting configuration constrains */ b->max_size_V = PetscMax(b->max_size_V, k); if (krylov) b->max_size_auxV = PetscMax(b->max_size_auxV, 1); /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscMalloc(sizeof(dvdInitV),&data);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdInitV));CHKERRQ(ierr); data->k = k; data->user = PetscMin(k, user); data->old_initV_data = d->initV_data; d->initV_data = data; if (krylov) { d->initV = dvd_initV_krylov_0; } else { d->initV = dvd_initV_classic_0; } DVD_FL_ADD(d->destroyList, dvd_initV_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_initV_classic_0" PetscErrorCode dvd_initV_classic_0(dvdDashboard *d) { PetscErrorCode ierr; dvdInitV *data = (dvdInitV*)d->initV_data; PetscInt i, user = PetscMin(data->user, d->max_size_V), k = PetscMin(data->k, d->max_size_V); PetscFunctionBegin; /* Generate a set of random initial vectors and orthonormalize them */ for (i=user; iV[i],d->eps->rand);CHKERRQ(ierr); } d->V_tra_s = 0; d->V_tra_e = 0; d->V_new_s = 0; d->V_new_e = i; /* After that the user vectors will be destroyed */ data->user = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_initV_krylov_0" PetscErrorCode dvd_initV_krylov_0(dvdDashboard *d) { PetscErrorCode ierr; dvdInitV *data = (dvdInitV*)d->initV_data; PetscInt i, user = PetscMin(data->user, d->max_size_V), k = PetscMin(data->k, d->max_size_V); Vec *cX = d->BcX? d->BcX : ((d->cY && !d->W)? d->cY : d->cX); PetscFunctionBegin; /* If needed, generate a random vector for starting the arnoldi method */ if (user == 0) { ierr = SlepcVecSetRandom(d->V[0], d->eps->rand);CHKERRQ(ierr); user = 1; } /* Perform k steps of Arnoldi with the operator K^{-1}*(t[1]*A-t[2]*B) */ ierr = dvd_orthV(d->ipV, d->eps->defl, d->eps->nds, cX, d->size_cX, d->V, 0, user, d->auxS, d->eps->rand);CHKERRQ(ierr); for (i=user; iB) { ierr = MatMult(d->A, d->V[i-user], d->V[i]);CHKERRQ(ierr); ierr = MatMult(d->B, d->V[i-user], d->auxV[0]);CHKERRQ(ierr); ierr = VecAXPBY(d->auxV[0], d->target[1], -d->target[0], d->V[i]);CHKERRQ(ierr); } else { ierr = MatMult(d->A, d->V[i-user], d->auxV[0]);CHKERRQ(ierr); ierr = VecAXPBY(d->auxV[0], -d->target[0], d->target[1], d->V[i-user]);CHKERRQ(ierr); } ierr = d->improvex_precond(d, 0, d->auxV[0], d->V[i]);CHKERRQ(ierr); ierr = dvd_orthV(d->ipV, d->eps->defl, d->eps->nds, cX, d->size_cX, d->V, i, i+1, d->auxS, d->eps->rand);CHKERRQ(ierr); } d->V_tra_s = 0; d->V_tra_e = 0; d->V_new_s = 0; d->V_new_e = i; /* After that the user vectors will be destroyed */ data->user = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_initV_d" PetscErrorCode dvd_initV_d(dvdDashboard *d) { PetscErrorCode ierr; dvdInitV *data = (dvdInitV*)d->initV_data; PetscFunctionBegin; /* Restore changes in dvdDashboard */ d->initV_data = data->old_initV_data; /* Free local data */ ierr = PetscFree(data);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_updatev.c0000644000175000017500000004100112211062077023701 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Step: test for restarting, updateV, restartV - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" #include /*I "slepcds.h" I*/ PetscErrorCode dvd_updateV_start(dvdDashboard *d); PetscBool dvd_isrestarting_fullV(dvdDashboard *d); PetscErrorCode dvd_managementV_basic_d(dvdDashboard *d); PetscErrorCode dvd_updateV_extrapol(dvdDashboard *d); PetscErrorCode dvd_updateV_conv_gen(dvdDashboard *d); PetscErrorCode dvd_updateV_restart_gen(dvdDashboard *d); PetscErrorCode dvd_updateV_update_gen(dvdDashboard *d); PetscErrorCode dvd_updateV_testConv(dvdDashboard *d,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv); typedef struct { PetscInt min_size_V, /* restart with this number of eigenvectors */ plusk, /* when restart, save plusk vectors from last iteration */ mpd; /* max size of the searching subspace */ void *old_updateV_data; /* old updateV data */ isRestarting_type old_isRestarting; /* old isRestarting */ PetscScalar *oldU, /* previous projected right igenvectors */ *oldV; /* previous projected left eigenvectors */ PetscInt ldoldU, /* leading dimension of oldU */ size_oldU; /* size of oldU */ PetscBool allResiduals; /* if computing all the residuals */ } dvdManagV_basic; #undef __FUNCT__ #define __FUNCT__ "dvd_managementV_basic" PetscErrorCode dvd_managementV_basic(dvdDashboard *d,dvdBlackboard *b,PetscInt bs,PetscInt mpd,PetscInt min_size_V,PetscInt plusk,PetscBool harm,PetscBool allResiduals) { PetscErrorCode ierr; dvdManagV_basic *data; #if !defined(PETSC_USE_COMPLEX) PetscBool her_probl, std_probl; #endif PetscFunctionBegin; /* Setting configuration constrains */ #if !defined(PETSC_USE_COMPLEX) /* if the last converged eigenvalue is complex its conjugate pair is also converged */ her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE; std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE; b->max_size_X = PetscMax(b->max_size_X, bs+(her_probl && std_probl)?0:1); #else b->max_size_X = PetscMax(b->max_size_X, bs); #endif b->max_size_V = PetscMax(b->max_size_V, mpd); min_size_V = PetscMin(min_size_V, mpd-bs); b->max_size_auxV = PetscMax(b->max_size_auxV, 1); /* dvd_updateV_testConv */ b->size_V = PetscMax(b->size_V, b->max_size_V + b->max_size_P + b->max_nev); b->own_scalars+= b->size_V*2 /* eigr, eigr */ + b->size_V /* nR */ + b->size_V /* nX */ + b->size_V /* errest */ + b->max_size_V*b->max_size_V*(harm?2:1)*(plusk>0?1:0) /* oldU,oldV? */; b->max_size_oldX = plusk; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscMalloc(sizeof(dvdManagV_basic),&data);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdManagV_basic));CHKERRQ(ierr); data->mpd = b->max_size_V; data->min_size_V = min_size_V; d->bs = bs; d->max_size_X = b->max_size_X; data->plusk = plusk; data->allResiduals = allResiduals; d->size_real_eigr = b->size_V; d->real_eigr = b->free_scalars; b->free_scalars+= b->size_V; d->real_eigi = b->free_scalars; b->free_scalars+= b->size_V; d->real_nR = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(b->size_V); d->real_nX = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(b->size_V); d->real_errest = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(b->size_V); if (plusk > 0) { data->oldU = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V; } if (harm) { if (plusk > 0) { data->oldV = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V; } } else { data->oldV = NULL; } data->old_updateV_data = d->updateV_data; d->updateV_data = data; data->old_isRestarting = d->isRestarting; d->isRestarting = dvd_isrestarting_fullV; d->updateV = dvd_updateV_extrapol; d->preTestConv = dvd_updateV_testConv; DVD_FL_ADD(d->startList, dvd_updateV_start); DVD_FL_ADD(d->destroyList, dvd_managementV_basic_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_start" PetscErrorCode dvd_updateV_start(dvdDashboard *d) { dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscInt i; PetscFunctionBegin; d->size_cX = 0; d->eigr = d->ceigr = d->real_eigr; d->eigi = d->ceigi = d->real_eigi; for (i=0;isize_real_V;i++) d->eigi[i] = 0.0; d->nR = d->real_nR; for (i=0;isize_real_V;i++) d->nR[i] = PETSC_MAX_REAL; d->nX = d->real_nX; d->errest = d->real_errest; for (i=0;isize_real_V;i++) d->errest[i] = PETSC_MAX_REAL; data->ldoldU = 0; data->oldV = NULL; data->size_oldU = 0; d->nconv = 0; d->npreconv = 0; d->V_tra_s = d->V_tra_e = d->V_new_s = d->V_new_e = 0; d->size_D = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_isrestarting_fullV" PetscBool dvd_isrestarting_fullV(dvdDashboard *d) { PetscBool restart; dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscFunctionBegin; restart = (d->size_V + d->max_size_X > PetscMin(data->mpd,d->max_size_V))? PETSC_TRUE:PETSC_FALSE; /* Check old isRestarting function */ if (!restart && data->old_isRestarting) restart = data->old_isRestarting(d); PetscFunctionReturn(restart); } #undef __FUNCT__ #define __FUNCT__ "dvd_managementV_basic_d" PetscErrorCode dvd_managementV_basic_d(dvdDashboard *d) { PetscErrorCode ierr; dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscFunctionBegin; /* Restore changes in dvdDashboard */ d->updateV_data = data->old_updateV_data; /* Free local data */ ierr = PetscFree(data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_extrapol" PetscErrorCode dvd_updateV_extrapol(dvdDashboard *d) { dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; ierr = d->calcpairs_selectPairs(d, data->min_size_V);CHKERRQ(ierr); /* If the subspaces doesn't need restart, add new vector */ if (!d->isRestarting(d)) { d->size_D = 0; ierr = dvd_updateV_update_gen(d);CHKERRQ(ierr); /* If some vector were add, exit */ if (d->size_D > 0) PetscFunctionReturn(0); } /* If some eigenpairs were converged, lock them */ if (d->npreconv > 0) { i = d->npreconv; ierr = dvd_updateV_conv_gen(d);CHKERRQ(ierr); /* If some eigenpair was locked, exit */ if (i > d->npreconv) PetscFunctionReturn(0); } /* Else, a restarting is performed */ ierr = dvd_updateV_restart_gen(d);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_conv_gen" PetscErrorCode dvd_updateV_conv_gen(dvdDashboard *d) { dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscInt npreconv,ld,cMT,cMTX; PetscErrorCode ierr; PetscScalar *pQ,*pZ; #if !defined(PETSC_USE_COMPLEX) PetscInt i; #endif PetscFunctionBegin; npreconv = d->npreconv; /* Constrains the converged pairs to nev */ #if !defined(PETSC_USE_COMPLEX) /* Tries to maintain together conjugate eigenpairs */ 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)); npreconv = i; #else npreconv = PetscMax(PetscMin(d->nev - d->nconv, npreconv), 0); #endif /* Quick exit */ if (npreconv == 0) PetscFunctionReturn(0); npreconv+= d->cX_in_H; ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); d->size_MT = d->size_H; cMT = d->size_H - npreconv; /* Harmonics restarts wiht right eigenvectors, and other with the left ones. If the problem is standard or hermitian, left and right vectors are the same */ if (!(d->W||!d->cY||d->BcX||DVD_IS(d->sEP,DVD_EP_STD)||DVD_IS(d->sEP,DVD_EP_HERMITIAN))) { /* ps.Q <- [ps.Q(0:npreconv-1) ps.Z(npreconv:size_H-1)] */ ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); ierr = SlepcDenseCopy(&pQ[ld*npreconv],ld,&pZ[ld*npreconv],ld,d->size_H,cMT);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } if (DVD_IS(d->sEP,DVD_EP_INDEFINITE)) { ierr = DSPseudoOrthogonalize(d->ps,DS_MAT_Q,d->size_H,d->nBV-d->cX_in_H,&cMTX,d->nBpX);CHKERRQ(ierr); } else { ierr = DSOrthogonalize(d->ps,DS_MAT_Q,d->size_H,&cMTX);CHKERRQ(ierr); } cMT = cMTX - npreconv; if (d->W) { ierr = DSOrthogonalize(d->ps,DS_MAT_Z,d->size_H,&cMTX);CHKERRQ(ierr); cMT = PetscMin(cMT,cMTX - npreconv); } /* Lock the converged pairs */ d->eigr+= npreconv-d->cX_in_H; #if !defined(PETSC_USE_COMPLEX) if (d->eigi) d->eigi+= npreconv-d->cX_in_H; #endif d->nconv+= npreconv-d->cX_in_H; d->errest+= npreconv-d->cX_in_H; /* Notify the changes in V and update the other subspaces */ d->V_tra_s = npreconv; d->V_tra_e = d->size_H; d->V_new_s = cMT; d->V_new_e = d->V_new_s; /* Remove oldU */ data->size_oldU = 0; d->npreconv-= npreconv-d->cX_in_H; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_restart_gen" PetscErrorCode dvd_updateV_restart_gen(dvdDashboard *d) { dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscInt size_plusk,size_X,i,j,ld,cMTX,cMTY; PetscScalar *pQ,*pZ; PetscErrorCode ierr; PetscFunctionBegin; /* Select size_X desired pairs from V */ size_X = PetscMin(PetscMin(data->min_size_V, d->size_V), d->max_size_V); /* Add plusk eigenvectors from the previous iteration */ size_plusk = PetscMax(0, PetscMin(PetscMin(data->plusk, data->size_oldU), d->max_size_V - size_X)); ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); d->size_MT = d->size_H; /* ps.Q <- orth([pX(0:size_X-1) [oldU(0:size_plusk-1); 0] ]) */ /* Harmonics restarts wiht right eigenvectors, and other with the left ones. If the problem is standard or hermitian, left and right vectors are the same */ ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (!(d->W||!d->cY||d->BcX||DVD_IS(d->sEP,DVD_EP_STD)||DVD_IS(d->sEP,DVD_EP_HERMITIAN))) { ierr = DSGetArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); ierr = SlepcDenseCopy(pQ,ld,pZ,ld,d->size_H,size_X);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } if (size_plusk > 0 && DVD_IS(d->sEP,DVD_EP_INDEFINITE)) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported plusk>0 in indefinite eigenvalue problems"); if (size_plusk > 0) { ierr = SlepcDenseCopy(&pQ[ld*size_X],ld,data->oldU,data->ldoldU,data->size_oldU,size_plusk);CHKERRQ(ierr); for (i=size_X;isize_oldU;jsize_H;j++) { pQ[j*ld+i] = 0.0; } } } ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (DVD_IS(d->sEP,DVD_EP_INDEFINITE)) { ierr = DSPseudoOrthogonalize(d->ps,DS_MAT_Q,size_X,d->nBV-d->cX_in_H,&cMTX,d->nBpX);CHKERRQ(ierr); } else { ierr = DSOrthogonalize(d->ps,DS_MAT_Q,size_X+size_plusk,&cMTX);CHKERRQ(ierr); } if (d->W && size_plusk > 0) { /* ps.Z <- orth([ps.Z(0:size_X-1) [oldV(0:size_plusk-1); 0] ]) */ ierr = DSGetArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); ierr = SlepcDenseCopy(&pZ[ld*size_X],ld,data->oldV,data->ldoldU,data->size_oldU,size_plusk);CHKERRQ(ierr); for(i=size_X; isize_oldU; jsize_H; j++) { pZ[j*ld+i] = 0.0; } } ierr = DSRestoreArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); ierr = DSOrthogonalize(d->ps,DS_MAT_Z,size_X+size_plusk,&cMTY);CHKERRQ(ierr); cMTX = PetscMin(cMTX, cMTY); } /* Notify the changes in V and update the other subspaces */ d->V_tra_s = d->cX_in_H; d->V_tra_e = cMTX; d->V_new_s = d->V_tra_e-d->cX_in_H; d->V_new_e = d->V_new_s; /* Remove oldU */ data->size_oldU = 0; /* Remove npreconv */ d->npreconv = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_update_gen" PetscErrorCode dvd_updateV_update_gen(dvdDashboard *d) { dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscInt size_D,ld,s; PetscScalar *pQ,*pZ; PetscErrorCode ierr; PetscFunctionBegin; /* Select the desired pairs */ size_D = PetscMin(PetscMin(PetscMin(d->bs, d->size_V), d->max_size_V-d->size_V), d->size_H); if (size_D == 0) { ierr = PetscInfo2(d->eps, "MON: D:%D H:%D\n", size_D, d->size_H);CHKERRQ(ierr); ierr = d->initV(d);CHKERRQ(ierr); ierr = d->calcPairs(d);CHKERRQ(ierr); } /* Fill V with D */ ierr = d->improveX(d, d->V+d->size_V, d->max_size_V-d->size_V, 0, size_D, &size_D);CHKERRQ(ierr); /* If D is empty, exit */ d->size_D = size_D; if (size_D == 0) PetscFunctionReturn(0); /* Get the residual of all pairs */ #if !defined(PETSC_USE_COMPLEX) s = d->eigi[0]!=0.0?2:1; #else s = 1; #endif ierr = dvd_updateV_testConv(d,s,s,data->allResiduals?d->size_V:size_D,d->auxV,d->auxS,NULL);CHKERRQ(ierr); /* Notify the changes in V */ d->V_tra_s = 0; d->V_tra_e = 0; d->V_new_s = d->size_V; d->V_new_e = d->size_V+size_D; /* Save the projected eigenvectors */ if (data->plusk > 0) { data->ldoldU = data->size_oldU = d->size_H; ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); ierr = SlepcDenseCopy(data->oldU,data->ldoldU,pQ,ld,d->size_H,d->size_H);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Q,&pQ);CHKERRQ(ierr); if (d->cY) { ierr = DSGetArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); ierr = SlepcDenseCopy(data->oldV,data->ldoldU,pZ,ld,d->size_H,d->size_H);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Z,&pZ);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_updateV_testConv" /* auxV: (by calcpairs_residual_eig) */ PetscErrorCode dvd_updateV_testConv(dvdDashboard *d,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv) { PetscInt i,j,b; PetscReal norm; PetscErrorCode ierr; PetscBool conv, c; dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data; PetscFunctionBegin; if (nConv) *nConv = s; for (i=s, conv=PETSC_TRUE; (conv || data->allResiduals) && (i < e); i+=b) { #if !defined(PETSC_USE_COMPLEX) b = d->eigi[i]!=0.0?2:1; #else b = 1; #endif if (i+b-1 >= pre) { ierr = d->calcpairs_residual(d, i, i+b, auxV);CHKERRQ(ierr); } /* Test the Schur vector */ for (j=0,c=PETSC_TRUE; jnR[i+j]/d->nX[i+j]; c = d->testConv(d, d->eigr[i+j], d->eigi[i+j], norm, &d->errest[i+j]); } /* Test the eigenvector */ if (d->eps->trueres && conv && c) { ierr = d->calcpairs_residual_eig(d,i,i+b,auxV);CHKERRQ(ierr); for (j=0,c=PETSC_TRUE; jnR[i+j]/d->nX[i+j]; c = d->testConv(d, d->eigr[i+j], d->eigi[i+j], norm, &d->errest[i+j]); } } if (conv && c) { if (nConv) *nConv = i+b; } else conv = PETSC_FALSE; } pre = PetscMax(pre, i); #if !defined(PETSC_USE_COMPLEX) /* Enforce converged conjugate complex eigenpairs */ if (nConv) { for (j=0;j<*nConv;j++) if (d->eigi[j] != 0.0) j++; if (j>*nConv) (*nConv)--; } #endif for (i=pre;ierrest[i] = d->nR[i] = PETSC_MAX_REAL; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_schm.c0000644000175000017500000001267412211062077023201 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" #define DVD_CHECKSUM(b) \ ((b)->max_size_V + (b)->max_size_auxV + (b)->max_size_auxS + \ (b)->own_vecs + (b)->own_scalars + (b)->max_size_oldX) #undef __FUNCT__ #define __FUNCT__ "dvd_schm_basic_preconf" PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,HarmType_t harmMode,KSP ksp,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,Method_t method) { PetscErrorCode ierr; PetscInt check_sum0, check_sum1; PetscFunctionBegin; ierr = PetscMemzero(b, sizeof(dvdBlackboard));CHKERRQ(ierr); b->state = DVD_STATE_PRECONF; for (check_sum0=-1,check_sum1=DVD_CHECKSUM(b); check_sum0 != check_sum1; check_sum0 = check_sum1, check_sum1 = DVD_CHECKSUM(b)) { b->own_vecs = b->own_scalars = 0; /* Setup basic management of V */ ierr = dvd_managementV_basic(d, b, bs, mpd, min_size_V, plusk, harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE, allResiduals);CHKERRQ(ierr); /* Setup the initial subspace for V */ ierr = dvd_initV(d, b, ini_size_V, size_initV, init==DVD_INITV_KRYLOV?PETSC_TRUE:PETSC_FALSE);CHKERRQ(ierr); /* Setup the convergence in order to use the SLEPc convergence test */ ierr = dvd_testconv_slepc(d, b);CHKERRQ(ierr); /* Setup Raileigh-Ritz for selecting the best eigenpairs in V */ ierr = dvd_calcpairs_qz(d, b, orth, NULL, cX_proj, harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);CHKERRQ(ierr); if (harmMode != DVD_HARM_NONE) { ierr = dvd_harm_conf(d, b, harmMode, PETSC_FALSE, 0.0);CHKERRQ(ierr); } /* Setup the method for improving the eigenvectors */ switch (method) { case DVD_METH_GD: case DVD_METH_JD: ierr = dvd_improvex_jd(d, b, ksp, bs, cX_impr, PETSC_FALSE);CHKERRQ(ierr); ierr = dvd_improvex_jd_proj_uv(d, b, DVD_PROJ_KZX);CHKERRQ(ierr); ierr = dvd_improvex_jd_lit_const(d, b, 0, 0.0, 0.0);CHKERRQ(ierr); break; case DVD_METH_GD2: ierr = dvd_improvex_gd2(d, b, ksp, bs);CHKERRQ(ierr); break; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_schm_basic_conf" PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,IP ip,HarmType_t harmMode,PetscBool fixedTarget,PetscScalar t,KSP ksp,PetscReal fix,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,PetscBool dynamic,Method_t method) { PetscInt check_sum0, check_sum1, maxits; Vec *fv; PetscScalar *fs; PetscReal tol; PetscErrorCode ierr; PetscFunctionBegin; b->state = DVD_STATE_CONF; check_sum0 = DVD_CHECKSUM(b); b->own_vecs = 0; b->own_scalars = 0; fv = b->free_vecs; fs = b->free_scalars; /* Setup basic management of V */ ierr = dvd_managementV_basic(d, b, bs, mpd, min_size_V, plusk, harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE, allResiduals);CHKERRQ(ierr); /* Setup the initial subspace for V */ ierr = dvd_initV(d, b, ini_size_V, size_initV, init==DVD_INITV_KRYLOV?PETSC_TRUE:PETSC_FALSE);CHKERRQ(ierr); /* Setup the convergence in order to use the SLEPc convergence test */ ierr = dvd_testconv_slepc(d, b);CHKERRQ(ierr); /* Setup Raileigh-Ritz for selecting the best eigenpairs in V */ ierr = dvd_calcpairs_qz(d, b, orth, ip, cX_proj, harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);CHKERRQ(ierr); if (harmMode != DVD_HARM_NONE) { ierr = dvd_harm_conf(d, b, harmMode, fixedTarget, t);CHKERRQ(ierr); } /* Setup the method for improving the eigenvectors */ switch (method) { case DVD_METH_GD: case DVD_METH_JD: ierr = dvd_improvex_jd(d, b, ksp, bs, cX_impr, dynamic);CHKERRQ(ierr); ierr = dvd_improvex_jd_proj_uv(d, b, DVD_PROJ_KZX);CHKERRQ(ierr); ierr = KSPGetTolerances(ksp, &tol, NULL, NULL, &maxits);CHKERRQ(ierr); ierr = dvd_improvex_jd_lit_const(d, b, maxits, tol, fix);CHKERRQ(ierr); break; case DVD_METH_GD2: ierr = dvd_improvex_gd2(d, b, ksp, bs);CHKERRQ(ierr); break; } check_sum1 = DVD_CHECKSUM(b); if ((check_sum0 != check_sum1) || (b->free_vecs - fv > b->own_vecs) || (b->free_scalars - fs > b->own_scalars)) SETERRQ(PETSC_COMM_SELF,1, "Something awful happened"); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_blas.c0000644000175000017500000012001212211062077023152 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include "davidson.h" PetscLogEvent SLEPC_SlepcDenseMatProd = 0; PetscLogEvent SLEPC_SlepcDenseNorm = 0; PetscLogEvent SLEPC_SlepcDenseCopy = 0; PetscLogEvent SLEPC_VecsMult = 0; void dvd_sum_local(void *in,void *out,PetscMPIInt *cnt,MPI_Datatype *t); PetscErrorCode VecsMultS_copy_func(PetscScalar *out,PetscInt size_out,void *ptr); #undef __FUNCT__ #define __FUNCT__ "SlepcDenseMatProd" /* Compute C <- a*A*B + b*C, where ldC, the leading dimension of C, ldA, the leading dimension of A, rA, cA, rows and columns of A, At, if true use the transpose of A instead, ldB, the leading dimension of B, rB, cB, rows and columns of B, Bt, if true use the transpose of B instead */ PetscErrorCode SlepcDenseMatProd(PetscScalar *C,PetscInt _ldC,PetscScalar b,PetscScalar a,const PetscScalar *A,PetscInt _ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,PetscInt _ldB,PetscInt rB,PetscInt cB,PetscBool Bt) { PetscErrorCode ierr; PetscInt tmp; PetscBLASInt m, n, k, ldA = _ldA, ldB = _ldB, ldC = _ldC; const char *N = "N", *T = "C", *qA = N, *qB = N; PetscFunctionBegin; if ((rA == 0) || (cB == 0)) PetscFunctionReturn(0); PetscValidScalarPointer(C,1); PetscValidScalarPointer(A,5); PetscValidScalarPointer(B,10); ierr = PetscLogEventBegin(SLEPC_SlepcDenseMatProd,0,0,0,0);CHKERRQ(ierr); /* Transpose if needed */ if (At) tmp = rA, rA = cA, cA = tmp, qA = T; if (Bt) tmp = rB, rB = cB, cB = tmp, qB = T; /* Check size */ if (cA != rB) SETERRQ(PETSC_COMM_SELF,1, "Matrix dimensions do not match"); /* Do stub */ if ((rA == 1) && (cA == 1) && (cB == 1)) { if (!At && !Bt) *C = *A * *B; else if (At && !Bt) *C = PetscConj(*A) * *B; else if (!At && Bt) *C = *A * PetscConj(*B); else *C = PetscConj(*A) * PetscConj(*B); m = n = k = 1; } else { m = rA; n = cB; k = cA; PetscStackCallBLAS("BLASgemm",BLASgemm_(qA,qB,&m,&n,&k,&a,(PetscScalar*)A,&ldA,(PetscScalar*)B,&ldB,&b,C,&ldC)); } ierr = PetscLogFlops(m*n*2*k);CHKERRQ(ierr); ierr = PetscLogEventEnd(SLEPC_SlepcDenseMatProd,0,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcDenseMatProdTriang" /* Compute C <- A*B, where sC, structure of C, ldC, the leading dimension of C, sA, structure of A, ldA, the leading dimension of A, rA, cA, rows and columns of A, At, if true use the transpose of A instead, sB, structure of B, ldB, the leading dimension of B, rB, cB, rows and columns of B, Bt, if true use the transpose of B instead */ PetscErrorCode SlepcDenseMatProdTriang(PetscScalar *C,MatType_t sC,PetscInt ldC,const PetscScalar *A,MatType_t sA,PetscInt ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,MatType_t sB,PetscInt ldB,PetscInt rB,PetscInt cB,PetscBool Bt) { PetscErrorCode ierr; PetscInt tmp; PetscScalar one=1.0, zero=0.0; PetscBLASInt rC, cC, _ldA = ldA, _ldB = ldB, _ldC = ldC; PetscFunctionBegin; if ((rA == 0) || (cB == 0)) PetscFunctionReturn(0); PetscValidScalarPointer(C,1); PetscValidScalarPointer(A,4); PetscValidScalarPointer(B,10); /* Transpose if needed */ if (At) tmp = rA, rA = cA, cA = tmp; if (Bt) tmp = rB, rB = cB, cB = tmp; /* Check size */ if (cA != rB) SETERRQ(PETSC_COMM_SELF,1, "Matrix dimensions do not match"); if (sB != 0) SETERRQ(PETSC_COMM_SELF,1, "Matrix type not supported for B"); /* Optimized version: trivial case */ if ((rA == 1) && (cA == 1) && (cB == 1)) { if (!At && !Bt) *C = *A * *B; else if (At && !Bt) *C = PetscConj(*A) * *B; else if (!At && Bt) *C = *A * PetscConj(*B); else if (At && Bt) *C = PetscConj(*A) * PetscConj(*B); PetscFunctionReturn(0); } /* Optimized versions: sA == 0 && sB == 0 */ if ((sA == 0) && (sB == 0)) { if (At) tmp = rA, rA = cA, cA = tmp; if (Bt) tmp = rB, rB = cB, cB = tmp; ierr = SlepcDenseMatProd(C, ldC, 0.0, 1.0, A, ldA, rA, cA, At, B, ldB, rB, cB, Bt);CHKERRQ(ierr); PetscFunctionReturn(0); } /* Optimized versions: A hermitian && (B not triang) */ if (DVD_IS(sA,DVD_MAT_HERMITIAN) && DVD_ISNOT(sB,DVD_MAT_UTRIANG) && DVD_ISNOT(sB,DVD_MAT_LTRIANG)) { ierr = PetscLogEventBegin(SLEPC_SlepcDenseMatProd,0,0,0,0);CHKERRQ(ierr); rC = rA; cC = cB; PetscStackCallBLAS("BLASsymm",BLASsymm_("L",DVD_ISNOT(sA,DVD_MAT_LTRIANG)?"U":"L",&rC,&cC,&one,(PetscScalar*)A,&_ldA,(PetscScalar*)B,&_ldB,&zero,C,&_ldC)); ierr = PetscLogFlops(rA*cB*cA);CHKERRQ(ierr); ierr = PetscLogEventEnd(SLEPC_SlepcDenseMatProd,0,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } /* Optimized versions: B hermitian && (A not triang) */ if (DVD_IS(sB,DVD_MAT_HERMITIAN) && DVD_ISNOT(sA,DVD_MAT_UTRIANG) && DVD_ISNOT(sA,DVD_MAT_LTRIANG)) { ierr = PetscLogEventBegin(SLEPC_SlepcDenseMatProd,0,0,0,0);CHKERRQ(ierr); rC = rA; cC = cB; PetscStackCallBLAS("BLASsymm",BLASsymm_("R",DVD_ISNOT(sB,DVD_MAT_LTRIANG)?"U":"L",&rC,&cC,&one,(PetscScalar*)B,&_ldB,(PetscScalar*)A,&_ldA,&zero,C,&_ldC)); ierr = PetscLogFlops(rA*cB*cA);CHKERRQ(ierr); ierr = PetscLogEventEnd(SLEPC_SlepcDenseMatProd,0,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } SETERRQ(PETSC_COMM_SELF,1, "Matrix type not supported for A"); } #undef __FUNCT__ #define __FUNCT__ "SlepcDenseNorm" /* Normalize the columns of the matrix A, where ldA, the leading dimension of A, rA, cA, rows and columns of A. if eigi is given, the pairs of contiguous columns i i+1 such as eigi[i] != 0 are normalized as being one column. */ PetscErrorCode SlepcDenseNorm(PetscScalar *A,PetscInt ldA,PetscInt _rA,PetscInt cA,PetscScalar *eigi) { PetscErrorCode ierr; PetscInt i; PetscScalar norm, norm0; PetscBLASInt rA = _rA, one=1; PetscFunctionBegin; PetscValidScalarPointer(A,1); PetscValidScalarPointer(eigi,5); ierr = PetscLogEventBegin(SLEPC_SlepcDenseNorm,0,0,0,0);CHKERRQ(ierr); for (i=0;i= X) && (beta == 0.0) && (dY == dX)) { /* If not, call to SlepcUpdateVectors */ ierr = SlepcUpdateStrideVectors(cX, X, Y-X, dX, Y-X+cM*dX, M-ldM*(Y-X), ldM, PETSC_FALSE);CHKERRQ(ierr); if (alpha != 1.0) for (i=0;i 0) { ierr = SlepcDenseMatProd(W, eU-sU, 0.0, 1.0, pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE, pv , ldV, ldV, sV, PETSC_FALSE);CHKERRQ(ierr); } /* W((eU-sU)*sV:(eU-sU)*sV+(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */ ierr = SlepcDenseMatProd(W+(eU-sU)*sV*(sU > 0?1:0), eU, 0.0, 1.0, pu, ldU, ldU, eU, PETSC_TRUE, pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);CHKERRQ(ierr); /* ReduceAll(W, SUM) */ ierr = MPI_Allreduce(W, Wr, ms, MPIU_SCALAR, MPIU_SUM, PetscObjectComm((PetscObject)U[0]));CHKERRQ(ierr); /* M(...,...) <- W */ k = 0; if (sU > 0) for (i=0; iM = M; sr->ld = ldM; sr->i0 = 0; sr->i1 = eV; sr->s0 = sU; sr->e0 = eU; sr->i2 = eV; /* Full M matrix */ } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) && DVD_ISNOT(sM,DVD_MAT_LTRIANG)) { /* Add the reduction to r */ ierr = SlepcAllReduceSum(r, ms, VecsMultS_copy_func, sr, &W);CHKERRQ(ierr); /* W(0:(eU-sU)*sV-1) <- U(sU:eU-1)' * V(0:sV-1) */ ierr = SlepcDenseMatProd(W, eU-sU, 0.0, 1.0, pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE, pv , ldV, ldV, sV, PETSC_FALSE);CHKERRQ(ierr); /* W((eU-sU)*sV:(eU-sU)*sV+(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */ ierr = SlepcDenseMatProd(W+(eU-sU)*sV*(sU > 0?1:0), eU, 0.0, 1.0, pu, ldU, ldU, eU, PETSC_TRUE, pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);CHKERRQ(ierr); /* M <- ReduceAll(W, SUM) */ sr->M = M; sr->ld = ldM; sr->i0 = sU>0?0:sV; sr->i1 = sV; sr->s0 = sU; sr->e0 = eU; sr->i2 = eV; sr->s1 = 0; sr->e1 = eU; /* Upper triangular M matrix */ } else if (DVD_IS(sM,DVD_MAT_UTRIANG) && DVD_ISNOT(sM,DVD_MAT_LTRIANG)) { /* Add the reduction to r */ ierr = SlepcAllReduceSum(r, (eV-sV)*eU, VecsMultS_copy_func, sr, &W);CHKERRQ(ierr); /* W(0:(eV-sV)*eU-1) <- U(0:eU-1)' * V(sV:eV-1) */ ierr = SlepcDenseMatProd(W, eU, 0.0, 1.0, pu, ldU, ldU, eU, PETSC_TRUE, pv+ldV*sV, ldV, ldV, eV-sV, PETSC_FALSE);CHKERRQ(ierr); /* M <- ReduceAll(W, SUM) */ sr->M = M; sr->ld = ldM; sr->i0 = sV; sr->i1 = eV; sr->s0 = 0; sr->e0 = eU; sr->i2 = eV; /* Lower triangular M matrix */ } else if (DVD_ISNOT(sM,DVD_MAT_UTRIANG) && DVD_IS(sM,DVD_MAT_LTRIANG)) { /* Add the reduction to r */ ierr = SlepcAllReduceSum(r, (eU-sU)*eV, VecsMultS_copy_func, sr, &W);CHKERRQ(ierr); /* W(0:(eU-sU)*eV-1) <- U(sU:eU-1)' * V(0:eV-1) */ ierr = SlepcDenseMatProd(W, eU-sU, 0.0, 1.0, pu+ldU*sU, ldU, ldU, eU-sU, PETSC_TRUE, pv , ldV, ldV, eV, PETSC_FALSE);CHKERRQ(ierr); /* ReduceAll(W, SUM) */ sr->M = M; sr->ld = ldM; sr->i0 = 0; sr->i1 = eV; sr->s0 = sU; sr->e0 = eU; sr->i2 = eV; } ierr = PetscLogEventEnd(SLEPC_VecsMult,0,0,0,0);CHKERRQ(ierr); ierr = VecRestoreArrayRead(U[0],&pu);CHKERRQ(ierr); ierr = VecRestoreArrayRead(V[0],&pv);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecsMultS_copy_func" PetscErrorCode VecsMultS_copy_func(PetscScalar *out,PetscInt size_out,void *ptr) { PetscInt i, j, k; DvdMult_copy_func *sr = (DvdMult_copy_func*)ptr; PetscFunctionBegin; PetscValidScalarPointer(out,1); for (i=sr->i0,k=0; ii1; i++) for (j=sr->ld*i+sr->s0; jld*i+sr->e0; j++,k++) sr->M[j] = out[k]; for (i=sr->i1; ii2; i++) for (j=sr->ld*i+sr->s1; jld*i+sr->e1; j++,k++) sr->M[j] = out[k]; if (k != size_out) SETERRQ(PETSC_COMM_SELF,1, "Wrong size"); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecsOrthonormalize" /* Orthonormalize a chunk of parallel vector. NOTE: wS0 and wS1 must be of size n*n. */ PetscErrorCode VecsOrthonormalize(Vec *V,PetscInt n,PetscScalar *wS0,PetscScalar *wS1) { #if defined(PETSC_MISSING_LAPACK_PBTRF) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"PBTRF - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscBLASInt nn = n, info, ld; PetscInt ldV, i; PetscScalar *H, *T, one=1.0, *pv; PetscFunctionBegin; if (!wS0) { ierr = PetscMalloc(sizeof(PetscScalar)*n*n,&H);CHKERRQ(ierr); } else { PetscValidScalarPointer(wS0,3); H = wS0; } if (!wS1) { ierr = PetscMalloc(sizeof(PetscScalar)*n*n,&T);CHKERRQ(ierr); } else { PetscValidScalarPointer(wS1,4); T = wS1; } /* H <- V' * V */ ierr = VecsMult(H, 0, n, V, 0, n, V, 0, n, T, NULL);CHKERRQ(ierr); /* H <- chol(H) */ ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKpbtrf",LAPACKpbtrf_("U", &nn, &nn, H, &nn, &info)); ierr = PetscFPTrapPop();CHKERRQ(ierr); if (info) SETERRQ1(PetscObjectComm((PetscObject)*V),PETSC_ERR_LIB, "Error in Lapack PBTRF %d", info); /* V <- V * inv(H) */ ierr = VecGetLocalSize(V[0],&ldV);CHKERRQ(ierr); ierr = VecGetArray(V[0],&pv);CHKERRQ(ierr); ld = ldV; PetscStackCallBLAS("BLAStrsm",BLAStrsm_("R", "U", "N", "N", &ld, &nn, &one, H, &nn, pv, &ld)); ierr = VecRestoreArray(V[0],&pv);CHKERRQ(ierr); for (i=1;iin = in; r->out = out; r->size_in = 0; r->max_size_in = max_size_in; r->ops = ops; r->size_ops = 0; r->max_size_ops = max_size_ops; r->comm = comm; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcAllReduceSum" PetscErrorCode SlepcAllReduceSum(DvdReduction *r,PetscInt size_in,DvdReductionPostF f,void *ptr,PetscScalar **in) { PetscFunctionBegin; *in = r->in + r->size_in; r->ops[r->size_ops].out = r->out + r->size_in; r->ops[r->size_ops].size_out = size_in; r->ops[r->size_ops].f = f; r->ops[r->size_ops].ptr = ptr; if (++(r->size_ops) > r->max_size_ops) SETERRQ(PETSC_COMM_SELF,1, "max_size_ops is not large enough"); if ((r->size_in+= size_in) > r->max_size_in) SETERRQ(PETSC_COMM_SELF,1, "max_size_in is not large enough"); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcAllReduceSumEnd" PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; /* Check if quick exit */ if (r->size_ops == 0) PetscFunctionReturn(0); /* Call the MPIAllReduce routine */ ierr = MPI_Allreduce(r->in, r->out, r->size_in, MPIU_SCALAR, MPIU_SUM, r->comm);CHKERRQ(ierr); /* Call the postponed routines */ for (i=0;isize_ops;i++) { ierr = r->ops[i].f(r->ops[i].out, r->ops[i].size_out, r->ops[i].ptr);CHKERRQ(ierr); } /* Tag the operation as done */ r->size_ops = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_orthV" /* auxS: size_cX+V_new_e */ PetscErrorCode dvd_orthV(IP ip,Vec *defl,PetscInt size_DS,Vec *cX,PetscInt size_cX,Vec *V,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand) { PetscErrorCode ierr; PetscInt i, j; PetscBool lindep; PetscReal norm; PetscScalar *auxS0 = auxS; PetscFunctionBegin; /* Orthonormalize V with IP */ for (i=V_new_s;i0) { ierr = SlepcVecSetRandom(V[i], rand);CHKERRQ(ierr); } if (cX + size_cX == V) { /* If cX and V are contiguous, orthogonalize in one step */ ierr = IPOrthogonalize(ip, size_DS, defl, size_cX+i, NULL, cX, V[i], auxS0, &norm, &lindep);CHKERRQ(ierr); } else if (defl) { /* Else orthogonalize first against defl, and then against cX and V */ ierr = IPOrthogonalize(ip, size_DS, defl, size_cX, NULL, cX, V[i], auxS0, NULL, &lindep);CHKERRQ(ierr); if (!lindep) { ierr = IPOrthogonalize(ip, 0, NULL, i, NULL, V, V[i], auxS0, &norm, &lindep);CHKERRQ(ierr); } } else { /* Else orthogonalize first against cX and then against V */ ierr = IPOrthogonalize(ip, size_cX, cX, i, NULL, V, V[i], auxS0, &norm, &lindep);CHKERRQ(ierr); } if (!lindep && (norm > PETSC_SQRT_MACHINE_EPSILON)) break; ierr = PetscInfo1(ip,"Orthonormalization problems adding the vector %D to the searching subspace\n",i);CHKERRQ(ierr); } if (lindep || (norm < PETSC_SQRT_MACHINE_EPSILON)) SETERRQ(PetscObjectComm((PetscObject)ip),1, "Error during orthonormalization of eigenvectors"); ierr = VecScale(V[i],1.0/norm);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_BorthV_faster" /* auxS: size_cX+V_new_e+1 */ PetscErrorCode dvd_BorthV_faster(IP ip,Vec *defl,Vec *BDS,PetscReal *BDSn,PetscInt size_DS,Vec *cX,Vec *BcX,PetscReal *BcXn,PetscInt size_cX,Vec *V,Vec *BV,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand) { PetscErrorCode ierr; PetscInt i, j; PetscBool lindep; PetscReal norm; PetscScalar *auxS0 = auxS; PetscFunctionBegin; /* Orthonormalize V with IP */ for (i=V_new_s;i0) { ierr = SlepcVecSetRandom(V[i],rand);CHKERRQ(ierr); } if (cX + size_cX == V && BcX + size_cX == BV) { /* If cX and V are contiguous, orthogonalize in one step */ ierr = IPBOrthogonalize(ip, size_DS, defl, BDS, BDSn, size_cX+i, NULL, cX, BcX, BcXn, V[i], BV[i], auxS0, &norm, &lindep);CHKERRQ(ierr); } else if (defl) { /* Else orthogonalize first against defl, and then against cX and V */ ierr = IPBOrthogonalize(ip, size_DS, defl, BDS, BDSn, size_cX, NULL, cX, BcX, BcXn, V[i], BV[i], auxS0, NULL, &lindep);CHKERRQ(ierr); if (!lindep) { ierr = IPBOrthogonalize(ip, 0, NULL, NULL, NULL, i, NULL, V, BV, BVn, V[i], BV[i], auxS0, &norm, &lindep);CHKERRQ(ierr); } } else { /* Else orthogonalize first against cX and then against V */ ierr = IPBOrthogonalize(ip, size_cX, cX, BcX, BcXn, i, NULL, V, BV, BVn, V[i], BV[i], auxS0, &norm, &lindep);CHKERRQ(ierr); } if (!lindep && (PetscAbs(norm) > PETSC_SQRT_MACHINE_EPSILON)) break; ierr = PetscInfo1(ip, "Orthonormalization problems adding the vector %d to the searching subspace\n", i);CHKERRQ(ierr); } if (lindep || (PetscAbs(norm) < PETSC_SQRT_MACHINE_EPSILON)) { SETERRQ(PetscObjectComm((PetscObject)ip),1, "Error during the orthonormalization of the eigenvectors"); } if (BVn) BVn[i] = norm > 0.0 ? 1.0 : -1.0; norm = PetscAbs(norm); ierr = VecScale(V[i],1.0/norm);CHKERRQ(ierr); ierr = VecScale(BV[i],1.0/norm);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_BorthV_stable" /* auxS: size_cX+V_new_e+1 */ PetscErrorCode dvd_BorthV_stable(IP ip,Vec *defl,PetscReal *BDSn,PetscInt size_DS,Vec *cX,PetscReal *BcXn,PetscInt size_cX,Vec *V,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand) { PetscErrorCode ierr; PetscInt i, j; PetscBool lindep; PetscReal norm; PetscScalar *auxS0 = auxS; PetscFunctionBegin; /* Orthonormalize V with IP */ for (i=V_new_s;i0) { ierr = SlepcVecSetRandom(V[i],rand);CHKERRQ(ierr); ierr = PetscInfo1(ip,"Orthonormalization problems adding the vector %d to the searching subspace\n",i);CHKERRQ(ierr); } /* Orthogonalize against the deflation, if needed */ if (defl) { ierr = IPPseudoOrthogonalize(ip,size_DS,defl,BDSn,V[i],auxS0,NULL,&lindep);CHKERRQ(ierr); if (lindep) continue; } /* If cX and V are contiguous, orthogonalize in one step */ if (cX + size_cX == V) { ierr = IPPseudoOrthogonalize(ip,size_cX+i,cX,BcXn,V[i],auxS0,&norm,&lindep);CHKERRQ(ierr); /* Else orthogonalize first against cX and then against V */ } else { ierr = IPPseudoOrthogonalize(ip,size_cX,cX,BcXn,V[i],auxS0,NULL,&lindep);CHKERRQ(ierr); if (lindep) continue; ierr = IPPseudoOrthogonalize(ip,i,V,BVn,V[i],auxS0,&norm,&lindep);CHKERRQ(ierr); } if (!lindep && (PetscAbs(norm) > PETSC_MACHINE_EPSILON)) break; } if (lindep || (PetscAbs(norm) < PETSC_MACHINE_EPSILON)) { SETERRQ(PetscObjectComm((PetscObject)ip),1, "Error during the orthonormalization of the eigenvectors"); } if (BVn) BVn[i] = norm > 0.0 ? 1.0 : -1.0; norm = PetscAbs(norm); ierr = VecScale(V[i],1.0/norm);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/davidson.c.html0000644000175000017500000014042012211062077024153 0ustar gladkgladk

Actual source code: davidson.c

  1: /*
  2:    Skeleton of Davidson solver. Actual solvers are GD and JD.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24:  #include davidson.h

 26: PetscErrorCode EPSView_XD(EPS eps,PetscViewer viewer);

 28: typedef struct {
 29:   /**** Solver options ****/
 30:   PetscInt blocksize,     /* block size */
 31:     initialsize,          /* initial size of V */
 32:     minv,                 /* size of V after restarting */
 33:     plusk;                /* keep plusk eigenvectors from the last iteration */
 34:   EPSOrthType ipB;        /* true if B-ortho is used */
 35:   PetscInt   method;      /* method for improving the approximate solution */
 36:   PetscReal  fix;         /* the fix parameter */
 37:   PetscBool  krylovstart; /* true if the starting subspace is a Krylov basis */
 38:   PetscBool  dynamic;     /* true if dynamic stopping criterion is used */
 39:   PetscInt   cX_in_proj,  /* converged vectors in the projected problem */
 40:     cX_in_impr;           /* converged vectors in the projector */
 41:   Method_t   scheme;      /* method employed: GD, JD or GD2 */

 43:   /**** Solver data ****/
 44:   dvdDashboard ddb;

 46:   /**** Things to destroy ****/
 47:   PetscScalar *wS;
 48:   Vec         *wV;
 49:   PetscInt    size_wV;
 50: } EPS_DAVIDSON;

 54: PetscErrorCode EPSCreate_XD(EPS eps)
 55: {
 57:   EPS_DAVIDSON   *data;

 60:   eps->st->ops->getbilinearform  = STGetBilinearForm_Default;
 61:   eps->ops->solve                = EPSSolve_XD;
 62:   eps->ops->setup                = EPSSetUp_XD;
 63:   eps->ops->reset                = EPSReset_XD;
 64:   eps->ops->backtransform        = EPSBackTransform_Default;
 65:   eps->ops->computevectors       = EPSComputeVectors_XD;
 66:   eps->ops->view                 = EPSView_XD;

 68:   PetscNewLog(eps,EPS_DAVIDSON,&data);
 69:   eps->data = data;
 70:   data->wS = NULL;
 71:   data->wV = NULL;
 72:   data->size_wV = 0;
 73:   PetscMemzero(&data->ddb,sizeof(dvdDashboard));

 75:   /* Set default values */
 76:   EPSXDSetKrylovStart_XD(eps,PETSC_FALSE);
 77:   EPSXDSetBlockSize_XD(eps,1);
 78:   EPSXDSetRestart_XD(eps,6,0);
 79:   EPSXDSetInitialSize_XD(eps,5);
 80:   EPSJDSetFix_JD(eps,0.01);
 81:   EPSXDSetBOrth_XD(eps,EPS_ORTH_B);
 82:   EPSJDSetConstCorrectionTol_JD(eps,PETSC_TRUE);
 83:   EPSXDSetWindowSizes_XD(eps,0,0);
 84:   return(0);
 85: }

 89: PetscErrorCode EPSSetUp_XD(EPS eps)
 90: {
 92:   EPS_DAVIDSON   *data = (EPS_DAVIDSON*)eps->data;
 93:   dvdDashboard   *dvd = &data->ddb;
 94:   dvdBlackboard  b;
 95:   PetscInt       nvecs,nscalars,min_size_V,plusk,bs,initv,i,cX_in_proj,cX_in_impr,nmat;
 96:   Mat            A,B;
 97:   KSP            ksp;
 98:   PetscBool      t,ipB,ispositive,dynamic;
 99:   HarmType_t     harm;
100:   InitType_t     init;
101:   PetscReal      fix;
102:   PetscScalar    target;

105:   /* Setup EPS options and get the problem specification */
106:   EPSXDGetBlockSize_XD(eps,&bs);
107:   if (bs <= 0) bs = 1;
108:   if (eps->ncv) {
109:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The value of ncv must be at least nev");
110:   } else if (eps->mpd) eps->ncv = eps->mpd + eps->nev + bs;
111:   else if (eps->nev<500) eps->ncv = PetscMin(eps->n-bs,PetscMax(2*eps->nev,eps->nev+15))+bs;
112:   else eps->ncv = PetscMin(eps->n-bs,eps->nev+500)+bs;
113:   if (!eps->mpd) eps->mpd = eps->ncv;
114:   if (eps->mpd > eps->ncv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The mpd has to be less or equal than ncv");
115:   if (eps->mpd < 2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The mpd has to be greater than 2");
116:   if (!eps->max_it) eps->max_it = PetscMax(100*eps->ncv,2*eps->n);
117:   if (!eps->which) eps->which = EPS_LARGEST_MAGNITUDE;
118:   if (eps->ishermitian && (eps->which==EPS_LARGEST_IMAGINARY || eps->which==EPS_SMALLEST_IMAGINARY)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Wrong value of eps->which");
119:   if (!(eps->nev + bs <= eps->ncv)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The ncv has to be greater than nev plus blocksize");

121:   EPSXDGetRestart_XD(eps,&min_size_V,&plusk);
122:   if (!min_size_V) min_size_V = PetscMin(PetscMax(bs,5),eps->mpd/2);
123:   if (!(min_size_V+bs <= eps->mpd)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The value of minv must be less than mpd minus blocksize");
124:   EPSXDGetInitialSize_XD(eps,&initv);
125:   if (eps->mpd < initv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The initv has to be less or equal than mpd");

127:   /* Davidson solvers do not support left eigenvectors */
128:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");

130:   /* Set STPrecond as the default ST */
131:   if (!((PetscObject)eps->st)->type_name) {
132:     STSetType(eps->st,STPRECOND);
133:   }
134:   STPrecondSetKSPHasMat(eps->st,PETSC_FALSE);

136:   /* Change the default sigma to inf if necessary */
137:   if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL ||
138:       eps->which == EPS_LARGEST_IMAGINARY) {
139:     STSetDefaultShift(eps->st,PETSC_MAX_REAL);
140:   }

142:   /* Davidson solvers only support STPRECOND */
143:   STSetUp(eps->st);
144:   PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&t);
145:   if (!t) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"%s only works with precond spectral transformation",
146:     ((PetscObject)eps)->type_name);

148:   /* Setup problem specification in dvd */
149:   STGetNumMatrices(eps->st,&nmat);
150:   STGetOperators(eps->st,0,&A);
151:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
152:   EPSReset_XD(eps);
153:   PetscMemzero(dvd,sizeof(dvdDashboard));
154:   dvd->A = A; dvd->B = eps->isgeneralized? B : NULL;
155:   ispositive = eps->ispositive;
156:   dvd->sA = DVD_MAT_IMPLICIT |
157:             (eps->ishermitian? DVD_MAT_HERMITIAN : 0) |
158:             ((ispositive && !eps->isgeneralized) ? DVD_MAT_POS_DEF : 0);
159:   /* Asume -eps_hermitian means hermitian-definite in generalized problems */
160:   if (!ispositive && !eps->isgeneralized && eps->ishermitian) ispositive = PETSC_TRUE;
161:   if (!eps->isgeneralized) dvd->sB = DVD_MAT_IMPLICIT | DVD_MAT_HERMITIAN | DVD_MAT_IDENTITY | DVD_MAT_UNITARY | DVD_MAT_POS_DEF;
162:   else dvd->sB = DVD_MAT_IMPLICIT | (eps->ishermitian? DVD_MAT_HERMITIAN : 0) | (ispositive? DVD_MAT_POS_DEF : 0);
163:   ipB = (dvd->B && data->ipB != EPS_ORTH_I && DVD_IS(dvd->sB,DVD_MAT_HERMITIAN))?PETSC_TRUE:PETSC_FALSE;
164:   if (data->ipB != EPS_ORTH_I && !ipB) data->ipB = EPS_ORTH_I;
165:   dvd->correctXnorm = ipB;
166:   dvd->sEP = ((!eps->isgeneralized || (eps->isgeneralized && ipB))? DVD_EP_STD : 0) |
167:              (ispositive? DVD_EP_HERMITIAN : 0) |
168:              ((eps->problem_type == EPS_GHIEP && ipB) ? DVD_EP_INDEFINITE : 0);
169:   dvd->nev = eps->nev;
170:   dvd->which = eps->which;
171:   dvd->withTarget = PETSC_TRUE;
172:   switch (eps->which) {
173:     case EPS_TARGET_MAGNITUDE:
174:     case EPS_TARGET_IMAGINARY:
175:       dvd->target[0] = target = eps->target; dvd->target[1] = 1.0;
176:       break;
177:     case EPS_TARGET_REAL:
178:       dvd->target[0] = PetscRealPart(target = eps->target); dvd->target[1] = 1.0;
179:       break;
180:     case EPS_LARGEST_REAL:
181:     case EPS_LARGEST_MAGNITUDE:
182:     case EPS_LARGEST_IMAGINARY: /* TODO: think about this case */
183:       dvd->target[0] = 1.0; dvd->target[1] = target = 0.0;
184:       break;
185:     case EPS_SMALLEST_MAGNITUDE:
186:     case EPS_SMALLEST_REAL:
187:     case EPS_SMALLEST_IMAGINARY: /* TODO: think about this case */
188:       dvd->target[0] = target = 0.0; dvd->target[1] = 1.0;
189:       break;
190:     case EPS_WHICH_USER:
191:       STGetShift(eps->st,&target);
192:       dvd->target[0] = target; dvd->target[1] = 1.0;
193:       break;
194:     case EPS_ALL:
195:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported option: which == EPS_ALL");
196:       break;
197:     default:
198:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported value of option 'which'");
199:   }
200:   dvd->tol = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol;
201:   dvd->eps = eps;

203:   /* Setup the extraction technique */
204:   if (!eps->extraction) {
205:     if (ipB || ispositive) eps->extraction = EPS_RITZ;
206:     else {
207:       switch (eps->which) {
208:         case EPS_TARGET_REAL:
209:         case EPS_TARGET_MAGNITUDE:
210:         case EPS_TARGET_IMAGINARY:
211:         case EPS_SMALLEST_MAGNITUDE:
212:         case EPS_SMALLEST_REAL:
213:         case EPS_SMALLEST_IMAGINARY:
214:           eps->extraction = EPS_HARMONIC;
215:           break;
216:         case EPS_LARGEST_REAL:
217:         case EPS_LARGEST_MAGNITUDE:
218:         case EPS_LARGEST_IMAGINARY:
219:           eps->extraction = EPS_HARMONIC_LARGEST;
220:           break;
221:         default:
222:           eps->extraction = EPS_RITZ;
223:       }
224:     }
225:   }
226:   switch (eps->extraction) {
227:     case EPS_RITZ:              harm = DVD_HARM_NONE; break;
228:     case EPS_HARMONIC:          harm = DVD_HARM_RR; break;
229:     case EPS_HARMONIC_RELATIVE: harm = DVD_HARM_RRR; break;
230:     case EPS_HARMONIC_RIGHT:    harm = DVD_HARM_REIGS; break;
231:     case EPS_HARMONIC_LARGEST:  harm = DVD_HARM_LEIGS; break;
232:     default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
233:   }

235:   /* Setup the type of starting subspace */
236:   EPSXDGetKrylovStart_XD(eps,&t);
237:   init = (!t)? DVD_INITV_CLASSIC : DVD_INITV_KRYLOV;

239:   /* Setup the presence of converged vectors in the projected problem and in the projector */
240:   EPSXDGetWindowSizes_XD(eps,&cX_in_impr,&cX_in_proj);
241:   if (min_size_V <= cX_in_proj) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"minv has to be greater than qwindow");
242:   if (bs > 1 && cX_in_impr > 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported option: pwindow > 0 and bs > 1");

244:   /* Setup IP */
245:   if (ipB && dvd->B) {
246:     IPSetMatrix(eps->ip,dvd->B);
247:   } else {
248:     IPSetMatrix(eps->ip,NULL);
249:   }

251:   /* Get the fix parameter */
252:   EPSXDGetFix_XD(eps,&fix);

254:   /* Get whether the stopping criterion is used */
255:   EPSJDGetConstCorrectionTol_JD(eps,&dynamic);

257:   /* Orthonormalize the deflation space */
258:   dvd_orthV(eps->ip,NULL,0,NULL,0,eps->defl,0,PetscAbs(eps->nds),NULL,eps->rand);

260:   /* Preconfigure dvd */
261:   STGetKSP(eps->st,&ksp);
262:   dvd_schm_basic_preconf(dvd,&b,eps->mpd,min_size_V,bs,
263:                                 initv,
264:                                 PetscAbs(eps->nini),
265:                                 plusk,harm,
266:                                 ksp,init,eps->trackall,
267:                                 data->ipB,cX_in_proj,cX_in_impr,
268:                                 data->scheme);

270:   /* Allocate memory */
271:   nvecs = b.max_size_auxV + b.own_vecs;
272:   nscalars = b.own_scalars + b.max_size_auxS;
273:   PetscMalloc(nscalars*sizeof(PetscScalar),&data->wS);
274:   PetscLogObjectMemory(eps,nscalars*sizeof(PetscScalar));
275:   VecDuplicateVecs(eps->t,nvecs,&data->wV);
276:   PetscLogObjectParents(eps,nvecs,data->wV);
277:   data->size_wV = nvecs;
278:   b.free_vecs = data->wV;
279:   b.free_scalars = data->wS;
280:   dvd->auxV = data->wV + b.own_vecs;
281:   dvd->auxS = b.free_scalars + b.own_scalars;
282:   dvd->size_auxV = b.max_size_auxV;
283:   dvd->size_auxS = b.max_size_auxS;

285:   eps->errest_left = NULL;
286:   PetscMalloc(eps->ncv*sizeof(PetscInt),&eps->perm);
287:   PetscLogObjectMemory(eps,eps->ncv*sizeof(PetscInt));
288:   for (i=0;i<eps->ncv;i++) eps->perm[i] = i;

290:   /* Configure dvd for a basic GD */
291:   dvd_schm_basic_conf(dvd,&b,eps->mpd,min_size_V,bs,
292:                              initv,
293:                              PetscAbs(eps->nini),plusk,
294:                              eps->ip,harm,dvd->withTarget,
295:                              target,ksp,
296:                              fix,init,eps->trackall,
297:                              data->ipB,cX_in_proj,cX_in_impr,dynamic,
298:                              data->scheme);

300:   /* Associate the eigenvalues to the EPS */
301:   eps->eigr = dvd->real_eigr;
302:   eps->eigi = dvd->real_eigi;
303:   eps->errest = dvd->real_errest;
304:   eps->V = dvd->real_V;
305:   return(0);
306: }

310: PetscErrorCode EPSSolve_XD(EPS eps)
311: {
312:   EPS_DAVIDSON   *data = (EPS_DAVIDSON*)eps->data;
313:   dvdDashboard   *d = &data->ddb;

317:   /* Call the starting routines */
318:   DVD_FL_CALL(d->startList,d);

320:   for (eps->its=0;eps->its<eps->max_it;eps->its++) {
321:     /* Initialize V, if it is needed */
322:     if (d->size_V == 0) { d->initV(d); }

324:     /* Find the best approximated eigenpairs in V, X */
325:     d->calcPairs(d);

327:     /* Test for convergence */
328:     if (eps->nconv >= eps->nev) break;

330:     /* Expand the subspace */
331:     d->updateV(d);

333:     /* Monitor progress */
334:     eps->nconv = d->nconv;
335:     EPSMonitor(eps,eps->its+1,eps->nconv,eps->eigr,eps->eigi,eps->errest,d->size_V+d->size_cX);
336:   }

338:   /* Call the ending routines */
339:   DVD_FL_CALL(d->endList,d);

341:   if (eps->nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL;
342:   else eps->reason = EPS_DIVERGED_ITS;
343:   return(0);
344: }

348: PetscErrorCode EPSReset_XD(EPS eps)
349: {
350:   EPS_DAVIDSON   *data = (EPS_DAVIDSON*)eps->data;
351:   dvdDashboard   *dvd = &data->ddb;

355:   /* Call step destructors and destroys the list */
356:   DVD_FL_CALL(dvd->destroyList,dvd);
357:   DVD_FL_DEL(dvd->destroyList);
358:   DVD_FL_DEL(dvd->startList);
359:   DVD_FL_DEL(dvd->endList);

361:   if (data->size_wV > 0) {
362:     VecDestroyVecs(data->size_wV,&data->wV);
363:   }
364:   PetscFree(data->wS);
365:   PetscFree(eps->perm);
366:   return(0);
367: }

371: PetscErrorCode EPSView_XD(EPS eps,PetscViewer viewer)
372: {
374:   PetscBool      isascii,opb;
375:   PetscInt       opi,opi0;
376:   Method_t       meth;
377:   EPSOrthType    borth;

380:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
381:   if (isascii) {
382:     EPSXDGetMethod_XD(eps,&meth);
383:     if (meth==DVD_METH_GD2) {
384:       PetscViewerASCIIPrintf(viewer,"  Davidson: using double expansion variant (GD2)\n");
385:     }
386:     EPSXDGetBOrth_XD(eps,&borth);
387:     switch (borth) {
388:     case EPS_ORTH_I:
389:       PetscViewerASCIIPrintf(viewer,"  Davidson: search subspace is orthogonalized\n");
390:       break;
391:     case EPS_ORTH_B:
392:       PetscViewerASCIIPrintf(viewer,"  Davidson: search subspace is B-orthogonalized\n");
393:       break;
394:     case EPS_ORTH_BOPT:
395:       PetscViewerASCIIPrintf(viewer,"  Davidson: search subspace is B-orthogonalized with an optimized method\n");
396:       break;
397:     }
398:     EPSXDGetBlockSize_XD(eps,&opi);
399:     PetscViewerASCIIPrintf(viewer,"  Davidson: block size=%D\n",opi);
400:     EPSXDGetKrylovStart_XD(eps,&opb);
401:     if (!opb) {
402:       PetscViewerASCIIPrintf(viewer,"  Davidson: type of the initial subspace: non-Krylov\n");
403:     } else {
404:       PetscViewerASCIIPrintf(viewer,"  Davidson: type of the initial subspace: Krylov\n");
405:     }
406:     EPSXDGetRestart_XD(eps,&opi,&opi0);
407:     PetscViewerASCIIPrintf(viewer,"  Davidson: size of the subspace after restarting: %D\n",opi);
408:     PetscViewerASCIIPrintf(viewer,"  Davidson: number of vectors after restarting from the previous iteration: %D\n",opi0);
409:   }
410:   return(0);
411: }

415: PetscErrorCode EPSXDSetKrylovStart_XD(EPS eps,PetscBool krylovstart)
416: {
417:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

420:   data->krylovstart = krylovstart;
421:   return(0);
422: }

426: PetscErrorCode EPSXDGetKrylovStart_XD(EPS eps,PetscBool *krylovstart)
427: {
428:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

431:   *krylovstart = data->krylovstart;
432:   return(0);
433: }

437: PetscErrorCode EPSXDSetBlockSize_XD(EPS eps,PetscInt blocksize)
438: {
439:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

442:   if (blocksize == PETSC_DEFAULT || blocksize == PETSC_DECIDE) blocksize = 1;
443:   if (blocksize <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid blocksize value");
444:   data->blocksize = blocksize;
445:   return(0);
446: }

450: PetscErrorCode EPSXDGetBlockSize_XD(EPS eps,PetscInt *blocksize)
451: {
452:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

455:   *blocksize = data->blocksize;
456:   return(0);
457: }

461: PetscErrorCode EPSXDSetRestart_XD(EPS eps,PetscInt minv,PetscInt plusk)
462: {
463:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

466:   if (minv == PETSC_DEFAULT || minv == PETSC_DECIDE) minv = 5;
467:   if (minv <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid minv value");
468:   if (plusk == PETSC_DEFAULT || plusk == PETSC_DECIDE) plusk = 5;
469:   if (plusk < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid plusk value");
470:   data->minv = minv;
471:   data->plusk = plusk;
472:   return(0);
473: }

477: PetscErrorCode EPSXDGetRestart_XD(EPS eps,PetscInt *minv,PetscInt *plusk)
478: {
479:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

482:   if (minv) *minv = data->minv;
483:   if (plusk) *plusk = data->plusk;
484:   return(0);
485: }

489: PetscErrorCode EPSXDGetInitialSize_XD(EPS eps,PetscInt *initialsize)
490: {
491:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

494:   *initialsize = data->initialsize;
495:   return(0);
496: }

500: PetscErrorCode EPSXDSetInitialSize_XD(EPS eps,PetscInt initialsize)
501: {
502:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

505:   if (initialsize == PETSC_DEFAULT || initialsize == PETSC_DECIDE) initialsize = 5;
506:   if (initialsize <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid initial size value");
507:   data->initialsize = initialsize;
508:   return(0);
509: }

513: PetscErrorCode EPSXDGetFix_XD(EPS eps,PetscReal *fix)
514: {
515:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

518:   *fix = data->fix;
519:   return(0);
520: }

524: PetscErrorCode EPSJDSetFix_JD(EPS eps,PetscReal fix)
525: {
526:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

529:   if (fix == PETSC_DEFAULT || fix == PETSC_DECIDE) fix = 0.01;
530:   if (fix < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid fix value");
531:   data->fix = fix;
532:   return(0);
533: }

537: PetscErrorCode EPSXDSetBOrth_XD(EPS eps,EPSOrthType borth)
538: {
539:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

542:   data->ipB = borth;
543:   return(0);
544: }

548: PetscErrorCode EPSXDGetBOrth_XD(EPS eps,EPSOrthType *borth)
549: {
550:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

553:   *borth = data->ipB;
554:   return(0);
555: }

559: PetscErrorCode EPSJDSetConstCorrectionTol_JD(EPS eps,PetscBool constant)
560: {
561:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

564:   data->dynamic = !constant?PETSC_TRUE:PETSC_FALSE;
565:   return(0);
566: }

570: PetscErrorCode EPSJDGetConstCorrectionTol_JD(EPS eps,PetscBool *constant)
571: {
572:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

575:   *constant = !data->dynamic?PETSC_TRUE:PETSC_FALSE;
576:   return(0);
577: }

581: PetscErrorCode EPSXDSetWindowSizes_XD(EPS eps,PetscInt pwindow,PetscInt qwindow)
582: {
583:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

586:   if (pwindow == PETSC_DEFAULT || pwindow == PETSC_DECIDE) pwindow = 0;
587:   if (pwindow < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid pwindow value");
588:   if (qwindow == PETSC_DEFAULT || qwindow == PETSC_DECIDE) qwindow = 0;
589:   if (qwindow < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid qwindow value");
590:   data->cX_in_proj = qwindow;
591:   data->cX_in_impr = pwindow;
592:   return(0);
593: }

597: PetscErrorCode EPSXDGetWindowSizes_XD(EPS eps,PetscInt *pwindow,PetscInt *qwindow)
598: {
599:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

602:   if (pwindow) *pwindow = data->cX_in_impr;
603:   if (qwindow) *qwindow = data->cX_in_proj;
604:   return(0);
605: }

609: PetscErrorCode EPSXDSetMethod(EPS eps,Method_t method)
610: {
611:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

614:   data->scheme = method;
615:   return(0);
616: }

620: PetscErrorCode EPSXDGetMethod_XD(EPS eps,Method_t *method)
621: {
622:   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;

625:   *method = data->scheme;
626:   return(0);
627: }

631: /*
632:   EPSComputeVectors_XD - Compute eigenvectors from the vectors
633:   provided by the eigensolver. This version is intended for solvers
634:   that provide Schur vectors from the QZ decompositon. Given the partial
635:   Schur decomposition OP*V=V*T, the following steps are performed:
636:       1) compute eigenvectors of (S,T): S*Z=T*Z*D
637:       2) compute eigenvectors of OP: X=V*Z
638:   If left eigenvectors are required then also do Z'*T=D*Z', Y=W*Z
639:  */
640: PetscErrorCode EPSComputeVectors_XD(EPS eps)
641: {
643:   EPS_DAVIDSON   *data = (EPS_DAVIDSON*)eps->data;
644:   dvdDashboard   *d = &data->ddb;
645:   PetscScalar    *pX,*cS,*cT;
646:   PetscInt       ld;

649:   if (d->cS) {
650:     /* Compute the eigenvectors associated to (cS, cT) */
651:     DSSetDimensions(d->conv_ps,d->size_cS,0,0,0);
652:     DSGetLeadingDimension(d->conv_ps,&ld);
653:     DSGetArray(d->conv_ps,DS_MAT_A,&cS);
654:     SlepcDenseCopyTriang(cS,0,ld,d->cS,0,d->ldcS,d->size_cS,d->size_cS);
655:     DSRestoreArray(d->conv_ps,DS_MAT_A,&cS);
656:     if (d->cT) {
657:       DSGetArray(d->conv_ps,DS_MAT_B,&cT);
658:       SlepcDenseCopyTriang(cT,0,ld,d->cT,0,d->ldcT,d->size_cS,d->size_cS);
659:       DSRestoreArray(d->conv_ps,DS_MAT_B,&cT);
660:     }
661:     DSSetState(d->conv_ps,DS_STATE_RAW);
662:     DSSolve(d->conv_ps,eps->eigr,eps->eigi);
663:     DSVectors(d->conv_ps,DS_MAT_X,NULL,NULL);
664:     DSNormalize(d->conv_ps,DS_MAT_X,-1);

666:     /* V <- cX * pX */
667:     DSGetArray(d->conv_ps,DS_MAT_X,&pX);
668:     SlepcUpdateVectorsZ(eps->V,0.0,1.0,d->cX,d->size_cX,pX,ld,d->nconv,d->nconv);
669:     DSRestoreArray(d->conv_ps,DS_MAT_X,&pX);
670:   }

672:   eps->evecsavailable = PETSC_TRUE;
673:   return(0);
674: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_gd2.c0000644000175000017500000003131312211062077022712 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Step: improve the eigenvectors X with GD2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" #include /*I "slepcvec.h" I*/ PetscErrorCode dvd_improvex_gd2_d(dvdDashboard *d); PetscErrorCode dvd_improvex_gd2_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D); PetscErrorCode dvd_improvex_get_eigenvectors(dvdDashboard *d,PetscScalar *pX,PetscScalar *pY,PetscInt ld_,PetscScalar *auxS,PetscInt size_auxS); #define size_Z (64*4) /**** GD2 update step K*[A*X B*X] ****/ typedef struct { PetscInt size_X; void *old_improveX_data; /* old improveX_data */ improveX_type old_improveX; /* old improveX */ } dvdImprovex_gd2; #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_gd2" PetscErrorCode dvd_improvex_gd2(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs) { PetscErrorCode ierr; dvdImprovex_gd2 *data; PetscBool her_probl,std_probl; PC pc; PetscInt s=1; PetscFunctionBegin; std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE; her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE; /* Setting configuration constrains */ /* If the arithmetic is real and the problem is not Hermitian, then the block size is incremented in one */ #if !defined(PETSC_USE_COMPLEX) if (!her_probl) { max_bs++; b->max_size_P = PetscMax(b->max_size_P, 2); s = 2; } else #endif b->max_size_P = PetscMax(b->max_size_P, 1); b->max_size_X = PetscMax(b->max_size_X, max_bs); b->max_size_auxV = PetscMax(b->max_size_auxV, s + ((her_probl || !d->eps->trueres)?1:PetscMax(s*2,b->max_size_cX_proj+b->max_size_X))); /* testConv */ b->max_size_auxS = PetscMax(b->max_size_auxS, (her_probl || !d->eps->trueres)?0:b->max_nev*b->max_nev+PetscMax(b->max_nev*6,(b->max_nev+b->max_size_proj)*s+b->max_nev*(b->max_size_X+b->max_size_cX_proj)*(std_probl?2:4)+64)); /* preTestConv */ /* Setup the preconditioner */ if (ksp) { ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = dvd_static_precond_PC(d,b,pc);CHKERRQ(ierr); } else { ierr = dvd_static_precond_PC(d,b,0);CHKERRQ(ierr); } /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscMalloc(sizeof(dvdImprovex_gd2),&data);CHKERRQ(ierr); ierr = PetscLogObjectMemory(d->eps,sizeof(dvdImprovex_gd2));CHKERRQ(ierr); data->old_improveX_data = d->improveX_data; d->improveX_data = data; data->old_improveX = d->improveX; data->size_X = b->max_size_X; d->improveX = dvd_improvex_gd2_gen; DVD_FL_ADD(d->destroyList,dvd_improvex_gd2_d); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_gd2_d" PetscErrorCode dvd_improvex_gd2_d(dvdDashboard *d) { PetscErrorCode ierr; dvdImprovex_gd2 *data = (dvdImprovex_gd2*)d->improveX_data; PetscFunctionBegin; /* Restore changes in dvdDashboard */ d->improveX_data = data->old_improveX_data; /* Free local data and objects */ ierr = PetscFree(data);CHKERRQ(ierr); PetscFunctionReturn(0); } #define DVD_COMPLEX_RAYLEIGH_QUOTIENT(ur,ui,Axr,Axi,Bxr,Bxi,eigr,eigi,b,ierr)\ { \ ierr = VecDot((Axr), (ur), &(b)[0]);CHKERRQ(ierr); /* r*A*r */ \ ierr = VecDot((Axr), (ui), &(b)[1]);CHKERRQ(ierr); /* i*A*r */ \ ierr = VecDot((Axi), (ur), &(b)[2]);CHKERRQ(ierr); /* r*A*i */ \ ierr = VecDot((Axi), (ui), &(b)[3]);CHKERRQ(ierr); /* i*A*i */ \ ierr = VecDot((Bxr), (ur), &(b)[4]);CHKERRQ(ierr); /* r*B*r */ \ ierr = VecDot((Bxr), (ui), &(b)[5]);CHKERRQ(ierr); /* i*B*r */ \ ierr = VecDot((Bxi), (ur), &(b)[6]);CHKERRQ(ierr); /* r*B*i */ \ ierr = VecDot((Bxi), (ui), &(b)[7]);CHKERRQ(ierr); /* i*B*i */ \ (b)[0] = (b)[0]+(b)[3]; /* rAr+iAi */ \ (b)[2] = (b)[2]-(b)[1]; /* rAi-iAr */ \ (b)[4] = (b)[4]+(b)[7]; /* rBr+iBi */ \ (b)[6] = (b)[6]-(b)[5]; /* rBi-iBr */ \ (b)[7] = (b)[4]*(b)[4] + (b)[6]*(b)[6]; /* k */ \ *(eigr) = ((b)[0]*(b)[4] + (b)[2]*(b)[6]) / (b)[7]; /* eig_r */ \ *(eigi) = ((b)[2]*(b)[4] - (b)[0]*(b)[6]) / (b)[7]; /* eig_i */ \ } #if !defined(PETSC_USE_COMPLEX) #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \ for ((i)=0; (i)<(n); (i)++) { \ if ((eigi)[(i_s)+(i)] != 0.0) { \ /* eig_r = [(rAr+iAi)*(rBr+iBi) + (rAi-iAr)*(rBi-iBr)]/k \ eig_i = [(rAi-iAr)*(rBr+iBi) - (rAr+iAi)*(rBi-iBr)]/k \ k = (rBr+iBi)*(rBr+iBi) + (rBi-iBr)*(rBi-iBr) */ \ DVD_COMPLEX_RAYLEIGH_QUOTIENT((u)[(i)], (u)[(i)+1], (Ax)[(i)], \ (Ax)[(i)+1], (Bx)[(i)], (Bx)[(i)+1], &(b)[8], &(b)[9], (b), (ierr)); \ if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[8])/ \ PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10 || \ PetscAbsScalar((eigi)[(i_s)+(i)] - (b)[9])/ \ PetscAbsScalar((eigi)[(i_s)+(i)]) > 1e-10) { \ (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its "\ "Rayleigh quotient value %G+%G\n", \ (eigr)[(i_s)+(i)], \ (eigi)[(i_s)+1], (b)[8], (b)[9]);CHKERRQ(ierr); \ } \ (i)++; \ } else { \ (ierr) = VecDot((Ax)[(i)], (u)[(i)], &(b)[0]);CHKERRQ(ierr); \ (ierr) = VecDot((Bx)[(i)], (u)[(i)], &(b)[1]);CHKERRQ(ierr); \ (b)[0] = (b)[0]/(b)[1]; \ if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[0])/ \ PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10) { \ (ierr) = PetscInfo3((eps), "The eigenvalue %G is far from its " \ "Rayleigh quotient value %G. (y'*B*x = %G)\n", \ (eigr)[(i_s)+(i)], \ (b)[0], (b)[1]);CHKERRQ(ierr); \ } \ } \ } #else #define DVD_COMPUTE_N_RR(eps,i,i_s,n,eigr,eigi,u,Ax,Bx,b,ierr) \ for ((i)=0; (i)<(n); (i)++) { \ (ierr) = VecDot((Ax)[(i)], (u)[(i)], &(b)[0]);CHKERRQ(ierr); \ (ierr) = VecDot((Bx)[(i)], (u)[(i)], &(b)[1]);CHKERRQ(ierr); \ (b)[0] = (b)[0]/(b)[1]; \ if (PetscAbsScalar((eigr)[(i_s)+(i)] - (b)[0])/ \ PetscAbsScalar((eigr)[(i_s)+(i)]) > 1e-10) { \ (ierr) = PetscInfo4((eps), "The eigenvalue %G+%G is far from its " \ "Rayleigh quotient value %G+%G\n", \ PetscRealPart((eigr)[(i_s)+(i)]), \ PetscImaginaryPart((eigr)[(i_s)+(i)]), PetscRealPart((b)[0]), \ PetscImaginaryPart((b)[0])); \ } \ } #endif #undef __FUNCT__ #define __FUNCT__ "dvd_improvex_gd2_gen" PetscErrorCode dvd_improvex_gd2_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D) { dvdImprovex_gd2 *data = (dvdImprovex_gd2*)d->improveX_data; PetscErrorCode ierr; PetscInt i,j,n,s,ld,k; PetscScalar *pX,*pY,b[10],Z[size_Z]; Vec *Ax,*Bx,X[4]; PetscFunctionBegin; /* Compute the number of pairs to improve */ n = PetscMin(PetscMin(PetscMin(data->size_X*2,max_size_D),(r_e-r_s)*2),d->max_size_proj-d->size_H)/2; #if !defined(PETSC_USE_COMPLEX) /* If the last eigenvalue is a complex conjugate pair, n is increased by one */ for (i=0; ieigi[i] != 0.0) i++; } if (i > n) { n = PetscMin(PetscMin(PetscMin(data->size_X*2,max_size_D),(n+1)*2),d->max_size_proj-d->size_H)/2; if (i > n) n--; } #endif /* Quick exit */ if (max_size_D == 0 || r_e-r_s <= 0 || n == 0) { *size_D = 0; /* Callback old improveX */ if (data->old_improveX) { d->improveX_data = data->old_improveX_data; ierr = data->old_improveX(d,NULL,0,0,0,NULL);CHKERRQ(ierr); d->improveX_data = data; } PetscFunctionReturn(0); } /* Compute the eigenvectors of the selected pairs */ for (i=0;icX_in_H; ierr = DSVectors(d->ps,DS_MAT_X,&k,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->ps,DS_MAT_X,r_s+i+d->cX_in_H);CHKERRQ(ierr); k = r_s+i+d->cX_in_H; ierr = DSVectors(d->ps,DS_MAT_Y,&k,NULL);CHKERRQ(ierr); ierr = DSNormalize(d->ps,DS_MAT_Y,r_s+i+d->cX_in_H);CHKERRQ(ierr); /* Jump complex conjugate pairs */ i = k+1; } ierr = DSGetArray(d->ps,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = DSGetArray(d->ps,DS_MAT_Y,&pY);CHKERRQ(ierr); ierr = DSGetLeadingDimension(d->ps,&ld);CHKERRQ(ierr); /* Bx <- B*X(i) */ Bx = D+n; if (d->BV) { /* Compute the norms of the eigenvectors */ if (d->correctXnorm) { ierr = dvd_improvex_compute_X(d,r_s,r_s+n,Bx,pX,ld);CHKERRQ(ierr); } else { for (i=0; inX[r_s+i] = 1.0; } ierr = SlepcUpdateVectorsZ(Bx,0.0,1.0,d->BV-d->cX_in_H,d->size_BV+d->cX_in_H,&pX[ld*r_s],ld,d->size_H,n);CHKERRQ(ierr); } else if (d->B) { for (i=0;iauxV,pX,ld);CHKERRQ(ierr); /* Bx(i) <- B*auxV(0) */ ierr = MatMult(d->B,d->auxV[0],Bx[i]);CHKERRQ(ierr); } } else { /* Bx <- X */ ierr = dvd_improvex_compute_X(d,r_s,r_s+n,Bx,pX,ld);CHKERRQ(ierr); } /* Ax <- A*X(i) */ Ax = D; ierr = SlepcUpdateVectorsZ(Ax,0.0,1.0,d->AV-d->cX_in_H,d->size_AV+d->cX_in_H,&pX[ld*r_s],ld,d->size_H,n);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) s = d->eigi[r_s] == 0.0 ? 1 : 2; /* If the available vectors allow the computation of the eigenvalue */ if (s <= n) { #else s = 1; #endif /* v <- Y(i) */ ierr = SlepcUpdateVectorsZ(d->auxV,0.0,1.0,(d->W?d->W:d->V)-d->cX_in_H,d->size_V+d->cX_in_H,&pY[ld*r_s],ld,d->size_H,s);CHKERRQ(ierr); /* Recompute the eigenvalue */ DVD_COMPUTE_N_RR(d->eps,i,r_s,1,d->eigr,d->eigi,d->auxV,Ax,Bx,b,ierr); #if !defined(PETSC_USE_COMPLEX) } #endif ierr = DSRestoreArray(d->ps,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = DSRestoreArray(d->ps,DS_MAT_Y,&pY);CHKERRQ(ierr); for (i=0,s=0;ieigi[r_s+i] != 0.0) { /* [Ax_i Ax_i+1 Bx_i Bx_i+1]*= [ 1 0 0 1 -eigr_i -eigi_i eigi_i -eigr_i] */ b[0] = b[5] = 1.0/d->nX[r_s+i]; b[2] = b[7] = -d->eigr[r_s+i]/d->nX[r_s+i]; b[6] = -(b[3] = d->eigi[r_s+i]/d->nX[r_s+i]); b[1] = b[4] = 0.0; X[0] = Ax[i]; X[1] = Ax[i+1]; X[2] = Bx[i]; X[3] = Bx[i+1]; ierr = SlepcUpdateVectorsD(X,4,1.0,b,4,4,2,Z,size_Z);CHKERRQ(ierr); s = 2; } else #endif { /* [Ax_i Bx_i]*= [ 1/nX_i conj(eig_i/nX_i) -eig_i/nX_i 1/nX_i ] */ b[0] = 1.0/d->nX[r_s+i]; b[1] = -d->eigr[r_s+i]/d->nX[r_s+i]; b[2] = PetscConj(d->eigr[r_s+i]/d->nX[r_s+i]); b[3] = 1.0/d->nX[r_s+i]; X[0] = Ax[i]; X[1] = Bx[i]; ierr = SlepcUpdateVectorsD(X,2,1.0,b,2,2,2,Z,size_Z);CHKERRQ(ierr); s = 1; } for (j=0; jnX[r_s+i+j] = 1.0; /* Ax = R <- P*(Ax - eig_i*Bx) */ ierr = d->calcpairs_proj_res(d,r_s+i,r_s+i+s,&Ax[i]);CHKERRQ(ierr); /* Check if the first eigenpairs are converged */ if (i == 0) { ierr = d->preTestConv(d,0,s,s,Ax,NULL,&d->npreconv);CHKERRQ(ierr); if (d->npreconv > 0) break; } } /* D <- K*[Ax Bx] */ if (d->npreconv == 0) { ierr = VecCopy(D[0],d->auxV[0]);CHKERRQ(ierr); for (i=0;i<2*n-1;i++) { ierr = d->improvex_precond(d,r_s+(i+1)%n,D[i+1],D[i]);CHKERRQ(ierr); } ierr = d->improvex_precond(d,r_s,d->auxV[0],D[2*n-1]);CHKERRQ(ierr); *size_D = 2*n; #if !defined(PETSC_USE_COMPLEX) if (d->eigi[r_s] != 0.0) { s = 4; } else #endif s = 2; /* Prevent that short vectors are discarded in the orthogonalization */ if (d->eps->errest[d->nconv+r_s] > PETSC_MACHINE_EPSILON && d->eps->errest[d->nconv+r_s] < PETSC_MAX_REAL) { for (i=0; ieps->errest[d->nconv+r_s]);CHKERRQ(ierr); } } } else { *size_D = 0; } /* Callback old improveX */ if (data->old_improveX) { d->improveX_data = data->old_improveX_data; ierr = data->old_improveX(d,NULL,0,0,0,NULL);CHKERRQ(ierr); d->improveX_data = data; } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_updatev.c.html0000644000175000017500000010325412211062077024655 0ustar gladkgladk
Actual source code: dvd_updatev.c

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

  4:   Step: test for restarting, updateV, restartV

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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
 27: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/

 29: PetscErrorCode dvd_updateV_start(dvdDashboard *d);
 30: PetscBool dvd_isrestarting_fullV(dvdDashboard *d);
 31: PetscErrorCode dvd_managementV_basic_d(dvdDashboard *d);
 32: PetscErrorCode dvd_updateV_extrapol(dvdDashboard *d);
 33: PetscErrorCode dvd_updateV_conv_gen(dvdDashboard *d);
 34: PetscErrorCode dvd_updateV_restart_gen(dvdDashboard *d);
 35: PetscErrorCode dvd_updateV_update_gen(dvdDashboard *d);
 36: PetscErrorCode dvd_updateV_testConv(dvdDashboard *d,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv);

 38: typedef struct {
 39:   PetscInt
 40:     min_size_V,     /* restart with this number of eigenvectors */
 41:     plusk,          /* when restart, save plusk vectors from last iteration */
 42:     mpd;            /* max size of the searching subspace */
 43:   void
 44:     *old_updateV_data;
 45:                     /* old updateV data */
 46:   isRestarting_type
 47:     old_isRestarting;
 48:                     /* old isRestarting */
 49:   PetscScalar
 50:     *oldU,          /* previous projected right igenvectors */
 51:     *oldV;          /* previous projected left eigenvectors */
 52:   PetscInt
 53:     ldoldU,         /* leading dimension of oldU */
 54:     size_oldU;      /* size of oldU */
 55:   PetscBool
 56:     allResiduals;   /* if computing all the residuals */
 57: } dvdManagV_basic;


 62: PetscErrorCode dvd_managementV_basic(dvdDashboard *d,dvdBlackboard *b,PetscInt bs,PetscInt mpd,PetscInt min_size_V,PetscInt plusk,PetscBool harm,PetscBool allResiduals)
 63: {
 64:   PetscErrorCode  ierr;
 65:   dvdManagV_basic *data;
 66: #if !defined(PETSC_USE_COMPLEX)
 67:   PetscBool       her_probl, std_probl;
 68: #endif

 71:   /* Setting configuration constrains */
 72: #if !defined(PETSC_USE_COMPLEX)
 73:   /* if the last converged eigenvalue is complex its conjugate pair is also
 74:      converged */
 75:   her_probl = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE;
 76:   std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
 77:   b->max_size_X = PetscMax(b->max_size_X, bs+(her_probl && std_probl)?0:1);
 78: #else
 79:   b->max_size_X = PetscMax(b->max_size_X, bs);
 80: #endif

 82:   b->max_size_V = PetscMax(b->max_size_V, mpd);
 83:   min_size_V = PetscMin(min_size_V, mpd-bs);
 84:   b->max_size_auxV = PetscMax(b->max_size_auxV, 1); /* dvd_updateV_testConv */
 85:   b->size_V = PetscMax(b->size_V, b->max_size_V + b->max_size_P + b->max_nev);
 86:   b->own_scalars+= b->size_V*2 /* eigr, eigr */ +
 87:                    b->size_V /* nR */   +
 88:                    b->size_V /* nX */   +
 89:                    b->size_V /* errest */ +
 90:                    b->max_size_V*b->max_size_V*(harm?2:1)*(plusk>0?1:0)
 91:                                                /* oldU,oldV? */;
 92:   b->max_size_oldX = plusk;

 94:   /* Setup the step */
 95:   if (b->state >= DVD_STATE_CONF) {
 96:     PetscMalloc(sizeof(dvdManagV_basic),&data);
 97:     PetscLogObjectMemory(d->eps,sizeof(dvdManagV_basic));
 98:     data->mpd = b->max_size_V;
 99:     data->min_size_V = min_size_V;
100:     d->bs = bs;
101:     d->max_size_X = b->max_size_X;
102:     data->plusk = plusk;
103:     data->allResiduals = allResiduals;

105:     d->size_real_eigr = b->size_V;
106:     d->real_eigr = b->free_scalars; b->free_scalars+= b->size_V;
107:     d->real_eigi = b->free_scalars; b->free_scalars+= b->size_V;
108:     d->real_nR = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(b->size_V);
109:     d->real_nX = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(b->size_V);
110:     d->real_errest = (PetscReal*)b->free_scalars; b->free_scalars+= FromRealToScalar(b->size_V);
111:     if (plusk > 0) {
112:       data->oldU = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V;
113:     }
114:     if (harm) {
115:       if (plusk > 0) {
116:         data->oldV = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V;
117:       }
118:     } else {
119:       data->oldV = NULL;
120:     }

122:     data->old_updateV_data = d->updateV_data;
123:     d->updateV_data = data;
124:     data->old_isRestarting = d->isRestarting;
125:     d->isRestarting = dvd_isrestarting_fullV;
126:     d->updateV = dvd_updateV_extrapol;
127:     d->preTestConv = dvd_updateV_testConv;
128:     DVD_FL_ADD(d->startList, dvd_updateV_start);
129:     DVD_FL_ADD(d->destroyList, dvd_managementV_basic_d);
130:   }
131:   return(0);
132: }

136: PetscErrorCode dvd_updateV_start(dvdDashboard *d)
137: {
138:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
139:   PetscInt        i;

142:   d->size_cX = 0;
143:   d->eigr = d->ceigr = d->real_eigr;
144:   d->eigi = d->ceigi = d->real_eigi;
145:   for (i=0;i<d->size_real_V;i++) d->eigi[i] = 0.0;
146:   d->nR = d->real_nR;
147:   for (i=0;i<d->size_real_V;i++) d->nR[i] = PETSC_MAX_REAL;
148:   d->nX = d->real_nX;
149:   d->errest = d->real_errest;
150:   for (i=0;i<d->size_real_V;i++) d->errest[i] = PETSC_MAX_REAL;
151:   data->ldoldU = 0;
152:   data->oldV = NULL;
153:   data->size_oldU = 0;
154:   d->nconv = 0;
155:   d->npreconv = 0;
156:   d->V_tra_s = d->V_tra_e = d->V_new_s = d->V_new_e = 0;
157:   d->size_D = 0;
158:   return(0);
159: }

163: PetscBool dvd_isrestarting_fullV(dvdDashboard *d)
164: {
165:   PetscBool       restart;
166:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;

169:   restart = (d->size_V + d->max_size_X > PetscMin(data->mpd,d->max_size_V))?
170:                 PETSC_TRUE:PETSC_FALSE;

172:   /* Check old isRestarting function */
173:   if (!restart && data->old_isRestarting)
174:     restart = data->old_isRestarting(d);
175:   PetscFunctionReturn(restart);
176: }

180: PetscErrorCode dvd_managementV_basic_d(dvdDashboard *d)
181: {
182:   PetscErrorCode  ierr;
183:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;

186:   /* Restore changes in dvdDashboard */
187:   d->updateV_data = data->old_updateV_data;

189:   /* Free local data */
190:   PetscFree(data);
191:   return(0);
192: }

196: PetscErrorCode dvd_updateV_extrapol(dvdDashboard *d)
197: {
198:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
199:   PetscInt        i;
200:   PetscErrorCode  ierr;

203:   d->calcpairs_selectPairs(d, data->min_size_V);

205:   /* If the subspaces doesn't need restart, add new vector */
206:   if (!d->isRestarting(d)) {
207:     d->size_D = 0;
208:     dvd_updateV_update_gen(d);

210:     /* If some vector were add, exit */
211:     if (d->size_D > 0) return(0);
212:   }

214:   /* If some eigenpairs were converged, lock them  */
215:   if (d->npreconv > 0) {
216:     i = d->npreconv;
217:     dvd_updateV_conv_gen(d);

219:     /* If some eigenpair was locked, exit */
220:     if (i > d->npreconv) return(0);
221:   }

223:   /* Else, a restarting is performed */
224:   dvd_updateV_restart_gen(d);
225:   return(0);
226: }

230: PetscErrorCode dvd_updateV_conv_gen(dvdDashboard *d)
231: {
232:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
233:   PetscInt        npreconv,ld,cMT,cMTX;
234:   PetscErrorCode  ierr;
235:   PetscScalar     *pQ,*pZ;
236: #if !defined(PETSC_USE_COMPLEX)
237:   PetscInt        i;
238: #endif

241:   npreconv = d->npreconv;
242:   /* Constrains the converged pairs to nev */
243: #if !defined(PETSC_USE_COMPLEX)
244:   /* Tries to maintain together conjugate eigenpairs */
245:   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));
246:   npreconv = i;
247: #else
248:   npreconv = PetscMax(PetscMin(d->nev - d->nconv, npreconv), 0);
249: #endif
250:   /* Quick exit */
251:   if (npreconv == 0) return(0);

253:   npreconv+= d->cX_in_H;
254:   DSGetLeadingDimension(d->ps,&ld);
255:   d->size_MT = d->size_H;
256:   cMT = d->size_H - npreconv;
257:   /* Harmonics restarts wiht right eigenvectors, and other with the left ones.
258:      If the problem is standard or hermitian, left and right vectors are the same */
259:   if (!(d->W||!d->cY||d->BcX||DVD_IS(d->sEP,DVD_EP_STD)||DVD_IS(d->sEP,DVD_EP_HERMITIAN))) {
260:     /* ps.Q <- [ps.Q(0:npreconv-1) ps.Z(npreconv:size_H-1)] */
261:     DSGetArray(d->ps,DS_MAT_Q,&pQ);
262:     DSGetArray(d->ps,DS_MAT_Z,&pZ);
263:     SlepcDenseCopy(&pQ[ld*npreconv],ld,&pZ[ld*npreconv],ld,d->size_H,cMT);
264:     DSRestoreArray(d->ps,DS_MAT_Q,&pQ);
265:     DSRestoreArray(d->ps,DS_MAT_Z,&pZ);
266:   }
267:   if (DVD_IS(d->sEP,DVD_EP_INDEFINITE)) {
268:     DSPseudoOrthogonalize(d->ps,DS_MAT_Q,d->size_H,d->nBV-d->cX_in_H,&cMTX,d->nBpX);
269:   } else {
270:     DSOrthogonalize(d->ps,DS_MAT_Q,d->size_H,&cMTX);
271:   }
272:   cMT = cMTX - npreconv;

274:   if (d->W) {
275:     DSOrthogonalize(d->ps,DS_MAT_Z,d->size_H,&cMTX);
276:     cMT = PetscMin(cMT,cMTX - npreconv);
277:   }

279:   /* Lock the converged pairs */
280:   d->eigr+= npreconv-d->cX_in_H;
281: #if !defined(PETSC_USE_COMPLEX)
282:   if (d->eigi) d->eigi+= npreconv-d->cX_in_H;
283: #endif
284:   d->nconv+= npreconv-d->cX_in_H;
285:   d->errest+= npreconv-d->cX_in_H;
286:   /* Notify the changes in V and update the other subspaces */
287:   d->V_tra_s = npreconv;          d->V_tra_e = d->size_H;
288:   d->V_new_s = cMT;               d->V_new_e = d->V_new_s;
289:   /* Remove oldU */
290:   data->size_oldU = 0;

292:   d->npreconv-= npreconv-d->cX_in_H;
293:   return(0);
294: }

298: PetscErrorCode dvd_updateV_restart_gen(dvdDashboard *d)
299: {
300:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
301:   PetscInt        size_plusk,size_X,i,j,ld,cMTX,cMTY;
302:   PetscScalar     *pQ,*pZ;
303:   PetscErrorCode  ierr;

306:   /* Select size_X desired pairs from V */
307:   size_X = PetscMin(PetscMin(data->min_size_V,
308:                              d->size_V),
309:                              d->max_size_V);

311:   /* Add plusk eigenvectors from the previous iteration */
312:   size_plusk = PetscMax(0, PetscMin(PetscMin(data->plusk,
313:                                     data->size_oldU),
314:                                     d->max_size_V - size_X));

316:   DSGetLeadingDimension(d->ps,&ld);
317:   d->size_MT = d->size_H;
318:   /* ps.Q <- orth([pX(0:size_X-1) [oldU(0:size_plusk-1); 0] ]) */
319:   /* Harmonics restarts wiht right eigenvectors, and other with the left ones.
320:      If the problem is standard or hermitian, left and right vectors are the same */
321:   DSGetArray(d->ps,DS_MAT_Q,&pQ);
322:   if (!(d->W||!d->cY||d->BcX||DVD_IS(d->sEP,DVD_EP_STD)||DVD_IS(d->sEP,DVD_EP_HERMITIAN))) {
323:     DSGetArray(d->ps,DS_MAT_Z,&pZ);
324:     SlepcDenseCopy(pQ,ld,pZ,ld,d->size_H,size_X);
325:     DSRestoreArray(d->ps,DS_MAT_Z,&pZ);
326:   }
327:   if (size_plusk > 0 && DVD_IS(d->sEP,DVD_EP_INDEFINITE)) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported plusk>0 in indefinite eigenvalue problems");
328:   if (size_plusk > 0) {
329:     SlepcDenseCopy(&pQ[ld*size_X],ld,data->oldU,data->ldoldU,data->size_oldU,size_plusk);
330:     for (i=size_X;i<size_X+size_plusk;i++) {
331:       for (j=data->size_oldU;j<d->size_H;j++) {
332:         pQ[j*ld+i] = 0.0;
333:       }
334:     }
335:   }
336:   DSRestoreArray(d->ps,DS_MAT_Q,&pQ);
337:   if (DVD_IS(d->sEP,DVD_EP_INDEFINITE)) {
338:     DSPseudoOrthogonalize(d->ps,DS_MAT_Q,size_X,d->nBV-d->cX_in_H,&cMTX,d->nBpX);
339:   } else {
340:     DSOrthogonalize(d->ps,DS_MAT_Q,size_X+size_plusk,&cMTX);
341:   }

343:   if (d->W && size_plusk > 0) {
344:     /* ps.Z <- orth([ps.Z(0:size_X-1) [oldV(0:size_plusk-1); 0] ]) */
345:     DSGetArray(d->ps,DS_MAT_Z,&pZ);
346:     SlepcDenseCopy(&pZ[ld*size_X],ld,data->oldV,data->ldoldU,data->size_oldU,size_plusk);
347:     for(i=size_X; i<size_X+size_plusk; i++) {
348:       for(j=data->size_oldU; j<d->size_H; j++) {
349:         pZ[j*ld+i] = 0.0;
350:       }
351:     }
352:     DSRestoreArray(d->ps,DS_MAT_Z,&pZ);
353:     DSOrthogonalize(d->ps,DS_MAT_Z,size_X+size_plusk,&cMTY);
354:     cMTX = PetscMin(cMTX, cMTY);
355:   }

357:   /* Notify the changes in V and update the other subspaces */
358:   d->V_tra_s = d->cX_in_H;            d->V_tra_e = cMTX;
359:   d->V_new_s = d->V_tra_e-d->cX_in_H; d->V_new_e = d->V_new_s;

361:   /* Remove oldU */
362:   data->size_oldU = 0;

364:   /* Remove npreconv */
365:   d->npreconv = 0;
366:   return(0);
367: }

371: PetscErrorCode dvd_updateV_update_gen(dvdDashboard *d)
372: {
373:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
374:   PetscInt        size_D,ld,s;
375:   PetscScalar     *pQ,*pZ;
376:   PetscErrorCode  ierr;

379:   /* Select the desired pairs */
380:   size_D = PetscMin(PetscMin(PetscMin(d->bs,
381:                                       d->size_V),
382:                                       d->max_size_V-d->size_V),
383:                                       d->size_H);
384:   if (size_D == 0) {
385:     PetscInfo2(d->eps, "MON: D:%D H:%D\n", size_D, d->size_H);
386:     d->initV(d);
387:     d->calcPairs(d);
388:   }

390:   /* Fill V with D */
391:   d->improveX(d, d->V+d->size_V, d->max_size_V-d->size_V, 0, size_D, &size_D);

393:   /* If D is empty, exit */
394:   d->size_D = size_D;
395:   if (size_D == 0) return(0);

397:   /* Get the residual of all pairs */
398: #if !defined(PETSC_USE_COMPLEX)
399:   s = d->eigi[0]!=0.0?2:1;
400: #else
401:   s = 1;
402: #endif
403:   dvd_updateV_testConv(d,s,s,data->allResiduals?d->size_V:size_D,d->auxV,d->auxS,NULL);

405:   /* Notify the changes in V */
406:   d->V_tra_s = 0;                 d->V_tra_e = 0;
407:   d->V_new_s = d->size_V;         d->V_new_e = d->size_V+size_D;

409:   /* Save the projected eigenvectors */
410:   if (data->plusk > 0) {
411:     data->ldoldU = data->size_oldU = d->size_H;
412:     DSGetLeadingDimension(d->ps,&ld);
413:     DSGetArray(d->ps,DS_MAT_Q,&pQ);
414:     SlepcDenseCopy(data->oldU,data->ldoldU,pQ,ld,d->size_H,d->size_H);
415:     DSRestoreArray(d->ps,DS_MAT_Q,&pQ);
416:     if (d->cY) {
417:       DSGetArray(d->ps,DS_MAT_Z,&pZ);
418:       SlepcDenseCopy(data->oldV,data->ldoldU,pZ,ld,d->size_H,d->size_H);
419:       DSRestoreArray(d->ps,DS_MAT_Z,&pZ);
420:     }
421:   }
422:   return(0);
423: }

427: /* auxV: (by calcpairs_residual_eig) */
428: PetscErrorCode dvd_updateV_testConv(dvdDashboard *d,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv)
429: {
430:   PetscInt        i,j,b;
431:   PetscReal       norm;
432:   PetscErrorCode  ierr;
433:   PetscBool       conv, c;
434:   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;

437:   if (nConv) *nConv = s;
438:   for (i=s, conv=PETSC_TRUE;
439:       (conv || data->allResiduals) && (i < e);
440:       i+=b) {
441: #if !defined(PETSC_USE_COMPLEX)
442:     b = d->eigi[i]!=0.0?2:1;
443: #else
444:     b = 1;
445: #endif
446:     if (i+b-1 >= pre) {
447:       d->calcpairs_residual(d, i, i+b, auxV);
448:     }
449:     /* Test the Schur vector */
450:     for (j=0,c=PETSC_TRUE; j<b && c; j++) {
451:       norm = d->nR[i+j]/d->nX[i+j];
452:       c = d->testConv(d, d->eigr[i+j], d->eigi[i+j], norm, &d->errest[i+j]);
453:     }
454:     /* Test the eigenvector */
455:     if (d->eps->trueres && conv && c) {
456:       d->calcpairs_residual_eig(d,i,i+b,auxV);
457:       for (j=0,c=PETSC_TRUE; j<b && c; j++) {
458:         norm = d->nR[i+j]/d->nX[i+j];
459:         c = d->testConv(d, d->eigr[i+j], d->eigi[i+j], norm, &d->errest[i+j]);
460:       }
461:     }
462:     if (conv && c) { if (nConv) *nConv = i+b; }
463:     else conv = PETSC_FALSE;
464:   }
465:   pre = PetscMax(pre, i);

467: #if !defined(PETSC_USE_COMPLEX)
468:   /* Enforce converged conjugate complex eigenpairs */
469:   if (nConv) {
470:     for (j=0;j<*nConv;j++) if (d->eigi[j] != 0.0) j++;
471:     if (j>*nConv) (*nConv)--;
472:   }
473: #endif
474:   for (i=pre;i<e;i++) d->errest[i] = d->nR[i] = PETSC_MAX_REAL;
475:   return(0);
476: }
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/common/dvd_testconv.c0000644000175000017500000000603012211062077024101 0ustar gladkgladk/* SLEPc eigensolver: "davidson" Step: test for convergence - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "davidson.h" PetscBool dvd_testconv_basic_0(dvdDashboard *d, PetscScalar eigvr, PetscScalar eigvi, PetscReal r, PetscReal *err); PetscBool dvd_testconv_slepc_0(dvdDashboard *d, PetscScalar eigvr, PetscScalar eigvi, PetscReal r, PetscReal *err); #undef __FUNCT__ #define __FUNCT__ "dvd_testconv_basic" PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b) { PetscErrorCode ierr; PetscFunctionBegin; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscFree(d->testConv_data);CHKERRQ(ierr); d->testConv = dvd_testconv_basic_0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_testconv_basic_0" PetscBool dvd_testconv_basic_0(dvdDashboard *d, PetscScalar eigvr, PetscScalar eigvi, PetscReal r, PetscReal *err) { PetscBool conv; PetscReal eig_norm, errest; PetscFunctionBegin; eig_norm = SlepcAbsEigenvalue(eigvr, eigvi); errest = r/eig_norm; conv = (errest <= d->tol) ? PETSC_TRUE : PETSC_FALSE; if (err) *err = errest; PetscFunctionReturn(conv); } #undef __FUNCT__ #define __FUNCT__ "dvd_testconv_slepc" PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b) { PetscErrorCode ierr; PetscFunctionBegin; /* Setup the step */ if (b->state >= DVD_STATE_CONF) { ierr = PetscFree(d->testConv_data);CHKERRQ(ierr); d->testConv = dvd_testconv_slepc_0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "dvd_testconv_slepc_0" PetscBool dvd_testconv_slepc_0(dvdDashboard *d, PetscScalar eigvr, PetscScalar eigvi, PetscReal r, PetscReal *err) { PetscErrorCode ierr; PetscFunctionBegin; ierr = (*d->eps->converged)(d->eps, eigvr, eigvi, r, err, d->eps->convergedctx); CHKERRABORT(PetscObjectComm((PetscObject)d->eps), ierr); PetscFunctionReturn(*erreps->tol ? PETSC_TRUE : PETSC_FALSE); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/makefile0000644000175000017500000000214712211062077021450 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = common gd jd LOCDIR = src/eps/impls/davidson/ MANSEC = EPS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/makefile.html0000644000175000017500000000374312211062077022416 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  =
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     = common gd jd
LOCDIR   = src/eps/impls/davidson/
MANSEC   = EPS

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/index.html0000644000175000017500000000220512211062077021740 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

common/
gd/
jd/
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/0000755000175000017500000000000012214143515020336 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/gd.c0000644000175000017500000005477412211062077021115 0ustar gladkgladk/* SLEPc eigensolver: "gd" Method: Generalized Davidson Algorithm: Generalized Davidson with various subspace extraction and restart techniques. References: [1] E.R. Davidson, "Super-matrix methods", Comput. Phys. Commun. 53(2):49-60, 1989. [2] E. Romero and J.E. Roman, "A parallel implementation of Davidson methods for large-scale eigenvalue problems in SLEPc", submitted, 2013. Last update: Jul 2012 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include <../src/eps/impls/davidson/common/davidson.h> #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_GD" PetscErrorCode EPSSetFromOptions_GD(EPS eps) { PetscErrorCode ierr; PetscBool flg,op; PetscInt opi,opi0; KSP ksp; EPSOrthType orth; const char *orth_list[3] = {"I","B","B_opt"}; PetscFunctionBegin; ierr = PetscOptionsHead("EPS Generalized Davidson (GD) Options");CHKERRQ(ierr); ierr = EPSGDGetKrylovStart(eps,&op);CHKERRQ(ierr); ierr = PetscOptionsBool("-eps_gd_krylov_start","Start the searching subspace with a krylov basis","EPSGDSetKrylovStart",op,&op,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetKrylovStart(eps,op);CHKERRQ(ierr); } ierr = EPSGDGetBOrth(eps,&orth);CHKERRQ(ierr); ierr = PetscOptionsEList("-eps_gd_borth","orthogonalization used in the search subspace","EPSGDSetBOrth",orth_list,3,orth_list[orth-1],&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetBOrth(eps,(EPSOrthType)(opi+1));CHKERRQ(ierr); } ierr = EPSGDGetBlockSize(eps,&opi);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_gd_blocksize","Number vectors add to the searching subspace","EPSGDSetBlockSize",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetBlockSize(eps,opi);CHKERRQ(ierr); } ierr = EPSGDGetRestart(eps,&opi,&opi0);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_gd_minv","Set the size of the searching subspace after restarting","EPSGDSetRestart",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); } ierr = PetscOptionsInt("-eps_gd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSGDSetRestart",opi0,&opi0,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); } ierr = EPSGDGetInitialSize(eps,&opi);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_gd_initial_size","Set the initial size of the searching subspace","EPSGDSetInitialSize",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetInitialSize(eps,opi);CHKERRQ(ierr); } ierr = EPSGDGetWindowSizes(eps,&opi,&opi0);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_gd_pwindow","(Experimental!) Set the number of converged vectors in the projector","EPSGDSetWindowSizes",opi,&opi,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); } ierr = PetscOptionsInt("-eps_gd_qwindow","(Experimental!) Set the number of converged vectors in the projected problem","EPSGDSetWindowSizes",opi0,&opi0,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); } ierr = PetscOptionsBool("-eps_gd_double_expansion","use the doble-expansion variant of GD","EPSGDSetDoubleExpansion",PETSC_FALSE,&op,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSGDSetDoubleExpansion(eps,op);CHKERRQ(ierr); } /* Set STPrecond as the default ST */ if (!((PetscObject)eps->st)->type_name) { ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); } ierr = STPrecondSetKSPHasMat(eps->st,PETSC_FALSE);CHKERRQ(ierr); /* Set the default options of the KSP */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); if (!((PetscObject)ksp)->type_name) { ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_GD" PetscErrorCode EPSSetUp_GD(EPS eps) { PetscErrorCode ierr; PetscBool t; KSP ksp; PetscFunctionBegin; /* Set KSPPREONLY as default */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); if (!((PetscObject)ksp)->type_name) { ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr); } /* Setup common for all davidson solvers */ ierr = EPSSetUp_XD(eps);CHKERRQ(ierr); /* Check some constraints */ ierr = PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr); if (!t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"EPSGD only works with KSPPREONLY"); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_GD" PetscErrorCode EPSDestroy_GD(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetKrylovStart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetKrylovStart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBOrth_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBOrth_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetRestart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetRestart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetInitialSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetInitialSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetWindowSizes_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetWindowSizes_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetDoubleExpansion_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetDoubleExpansion_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetKrylovStart" /*@ EPSGDSetKrylovStart - Activates or deactivates starting the searching subspace with a Krylov basis. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - krylovstart - boolean flag Options Database Key: . -eps_gd_krylov_start - Activates starting the searching subspace with a Krylov basis Level: advanced .seealso: EPSGDGetKrylovStart() @*/ PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,krylovstart,2); ierr = PetscTryMethod(eps,"EPSGDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetKrylovStart" /*@ EPSGDGetKrylovStart - Returns a flag indicating if the search subspace is started with a Krylov basis. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: . krylovstart - boolean flag indicating if the search subspace is started with a Krylov basis Level: advanced .seealso: EPSGDGetKrylovStart() @*/ PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(krylovstart,2); ierr = PetscTryMethod(eps,"EPSGDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetBlockSize" /*@ EPSGDSetBlockSize - Sets the number of vectors to be added to the searching space in every iteration. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - blocksize - number of vectors added to the search space in every iteration Options Database Key: . -eps_gd_blocksize - number of vectors added to the search space in every iteration Level: advanced .seealso: EPSGDSetKrylovStart() @*/ PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,blocksize,2); ierr = PetscTryMethod(eps,"EPSGDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetBlockSize" /*@ EPSGDGetBlockSize - Returns the number of vectors to be added to the searching space in every iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . blocksize - number of vectors added to the search space in every iteration Level: advanced .seealso: EPSGDSetBlockSize() @*/ PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(blocksize,2); ierr = PetscTryMethod(eps,"EPSGDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetRestart" /*@ EPSGDGetRestart - Gets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: + minv - number of vectors of the searching subspace after restarting - plusk - number of vectors saved from the previous iteration Level: advanced .seealso: EPSGDSetRestart() @*/ PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSGDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetRestart" /*@ EPSGDSetRestart - Sets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . minv - number of vectors of the searching subspace after restarting - plusk - number of vectors saved from the previous iteration Options Database Keys: + -eps_gd_minv - number of vectors of the searching subspace after restarting - -eps_gd_plusk - number of vectors saved from the previous iteration Level: advanced .seealso: EPSGDSetRestart() @*/ PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,minv,2); PetscValidLogicalCollectiveInt(eps,plusk,2); ierr = PetscTryMethod(eps,"EPSGDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetInitialSize" /*@ EPSGDGetInitialSize - Returns the initial size of the searching space. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . initialsize - number of vectors of the initial searching subspace Notes: If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors. Level: advanced .seealso: EPSGDSetInitialSize(), EPSGDGetKrylovStart() @*/ PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(initialsize,2); ierr = PetscTryMethod(eps,"EPSGDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetInitialSize" /*@ EPSGDSetInitialSize - Sets the initial size of the searching space. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - initialsize - number of vectors of the initial searching subspace Options Database Key: . -eps_gd_initial_size - number of vectors of the initial searching subspace Notes: If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors. Level: advanced .seealso: EPSGDGetInitialSize(), EPSGDGetKrylovStart() @*/ PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,initialsize,2); ierr = PetscTryMethod(eps,"EPSGDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetBOrth" /*@ EPSGDSetBOrth - Selects the orthogonalization that will be used in the search subspace in case of generalized Hermitian problems. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - borth - the kind of orthogonalization Possible values: The parameter 'borth' can have one of these values + EPS_ORTH_I - orthogonalization of the search subspace . EPS_ORTH_B - B-orthogonalization of the search subspace - EPS_ORTH_BOPT - B-orthogonalization of the search subspace with an alternative method Options Database Key: . -eps_gd_borth - Set the orthogonalization used in the search subspace Notes: If borth is EPS_ORTH_B, the solver uses a variant of Gram-Schmidt (selected in IP associated to the EPS) with the inner product defined by the matrix problem B. If borth is EPS_ORTH_BOPT, it uses another variant of Gram-Schmidt that only performs one matrix-vector product although more than one reorthogonalization would be done. Level: advanced .seealso: EPSGDGetBOrth() @*/ PetscErrorCode EPSGDSetBOrth(EPS eps,EPSOrthType borth) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,borth,2); ierr = PetscTryMethod(eps,"EPSGDSetBOrth_C",(EPS,EPSOrthType),(eps,borth));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetBOrth" /*@ EPSGDGetBOrth - Returns the orthogonalization used in the search subspace in case of generalized Hermitian problems. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: . borth - the kind of orthogonalization Notes: See EPSGDSetBOrth() for possible values of 'borth'. Level: advanced .seealso: EPSGDSetBOrth(), EPSOrthType @*/ PetscErrorCode EPSGDGetBOrth(EPS eps,EPSOrthType *borth) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(borth,2); ierr = PetscTryMethod(eps,"EPSGDGetBOrth_C",(EPS,EPSOrthType*),(eps,borth));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetWindowSizes" /*@ EPSGDGetWindowSizes - Gets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: + pwindow - number of converged vectors in the projector - qwindow - number of converged vectors in the projected problem Level: advanced .seealso: EPSGDSetWindowSizes() @*/ PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSGDGetWindowSizes_C",(EPS,PetscInt*,PetscInt*),(eps,pwindow,qwindow));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetWindowSizes" /*@ EPSGDSetWindowSizes - Sets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . pwindow - number of converged vectors in the projector - qwindow - number of converged vectors in the projected problem Options Database Keys: + -eps_gd_pwindow - set the number of converged vectors in the projector - -eps_gd_qwindow - set the number of converged vectors in the projected problem Level: advanced .seealso: EPSGDGetWindowSizes() @*/ PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,pwindow,2); PetscValidLogicalCollectiveInt(eps,qwindow,3); ierr = PetscTryMethod(eps,"EPSGDSetWindowSizes_C",(EPS,PetscInt,PetscInt),(eps,pwindow,qwindow));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetDoubleExpansion_GD" static PetscErrorCode EPSGDSetDoubleExpansion_GD(EPS eps,PetscBool use_gd2) { PetscErrorCode ierr; PetscFunctionBegin; ierr = EPSXDSetMethod(eps,use_gd2?DVD_METH_GD2:DVD_METH_GD);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetDoubleExpansion_GD" static PetscErrorCode EPSGDGetDoubleExpansion_GD(EPS eps,PetscBool *flg) { Method_t meth; PetscErrorCode ierr; PetscFunctionBegin; ierr = EPSXDGetMethod_XD(eps,&meth);CHKERRQ(ierr); if (meth==DVD_METH_GD2) *flg = PETSC_TRUE; else *flg = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDGetDoubleExpansion" /*@ EPSGDGetDoubleExpansion - Gets a flag indicating whether the double expansion variant has been activated or not. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . flg - the flag Level: advanced .seealso: EPSGDSetDoubleExpansion() @*/ PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *flg) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(flg,2); ierr = PetscTryMethod(eps,"EPSGDGetDoubleExpansion_C",(EPS,PetscBool*),(eps,flg));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGDSetDoubleExpansion" /*@ EPSGDSetDoubleExpansion - Activate a variant where the search subspace is expanded with K*[A*x B*x] (double expansion) instead of the classic K*r, where K is the preconditioner, x the selected approximate eigenvector and r its associated residual vector. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - use_gd2 - the boolean flag Options Database Keys: . -eps_gd_double_expansion - activate the double-expansion variant of GD Level: advanced @*/ PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool use_gd2) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,use_gd2,2); ierr = PetscTryMethod(eps,"EPSGDSetDoubleExpansion_C",(EPS,PetscBool),(eps,use_gd2));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_GD" PETSC_EXTERN PetscErrorCode EPSCreate_GD(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; /* Load the Davidson solver */ ierr = EPSCreate_XD(eps);CHKERRQ(ierr); ierr = EPSJDSetFix_JD(eps,0.0);CHKERRQ(ierr); ierr = EPSXDSetMethod(eps,DVD_METH_GD);CHKERRQ(ierr); /* Overload the GD properties */ eps->ops->setfromoptions = EPSSetFromOptions_GD; eps->ops->setup = EPSSetUp_GD; eps->ops->destroy = EPSDestroy_GD; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetKrylovStart_C",EPSXDSetKrylovStart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetKrylovStart_C",EPSXDGetKrylovStart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBOrth_C",EPSXDSetBOrth_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBOrth_C",EPSXDGetBOrth_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBlockSize_C",EPSXDSetBlockSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBlockSize_C",EPSXDGetBlockSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetRestart_C",EPSXDSetRestart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetRestart_C",EPSXDGetRestart_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetInitialSize_C",EPSXDSetInitialSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetInitialSize_C",EPSXDGetInitialSize_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetWindowSizes_C",EPSXDSetWindowSizes_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetWindowSizes_C",EPSXDGetWindowSizes_XD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetDoubleExpansion_C",EPSGDSetDoubleExpansion_GD);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetDoubleExpansion_C",EPSGDGetDoubleExpansion_GD);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/makefile0000644000175000017500000000214212211062077022035 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = gd.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/davidson/gd/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/makefile.html0000644000175000017500000000373612211062077023012 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = gd.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/davidson/gd/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/gd.c.html0000644000175000017500000014452612211062077022053 0ustar gladkgladk
Actual source code: gd.c

  1: /*

  3:    SLEPc eigensolver: "gd"

  5:    Method: Generalized Davidson

  7:    Algorithm:

  9:        Generalized Davidson with various subspace extraction and
 10:        restart techniques.

 12:    References:

 14:        [1] E.R. Davidson, "Super-matrix methods", Comput. Phys. Commun.
 15:            53(2):49-60, 1989.

 17:        [2] E. Romero and J.E. Roman, "A parallel implementation of
 18:            Davidson methods for large-scale eigenvalue problems in
 19:            SLEPc", submitted, 2013.

 21:    Last update: Jul 2012

 23:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 24:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 25:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 27:    This file is part of SLEPc.

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

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

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

 43: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 44: #include <../src/eps/impls/davidson/common/davidson.h>

 48: PetscErrorCode EPSSetFromOptions_GD(EPS eps)
 49: {
 51:   PetscBool      flg,op;
 52:   PetscInt       opi,opi0;
 53:   KSP            ksp;
 54:   EPSOrthType    orth;
 55:   const char     *orth_list[3] = {"I","B","B_opt"};

 58:   PetscOptionsHead("EPS Generalized Davidson (GD) Options");

 60:   EPSGDGetKrylovStart(eps,&op);
 61:   PetscOptionsBool("-eps_gd_krylov_start","Start the searching subspace with a krylov basis","EPSGDSetKrylovStart",op,&op,&flg);
 62:   if (flg) { EPSGDSetKrylovStart(eps,op); }

 64:   EPSGDGetBOrth(eps,&orth);
 65:   PetscOptionsEList("-eps_gd_borth","orthogonalization used in the search subspace","EPSGDSetBOrth",orth_list,3,orth_list[orth-1],&opi,&flg);
 66:   if (flg) { EPSGDSetBOrth(eps,(EPSOrthType)(opi+1)); }

 68:   EPSGDGetBlockSize(eps,&opi);
 69:   PetscOptionsInt("-eps_gd_blocksize","Number vectors add to the searching subspace","EPSGDSetBlockSize",opi,&opi,&flg);
 70:   if (flg) { EPSGDSetBlockSize(eps,opi); }

 72:   EPSGDGetRestart(eps,&opi,&opi0);
 73:   PetscOptionsInt("-eps_gd_minv","Set the size of the searching subspace after restarting","EPSGDSetRestart",opi,&opi,&flg);
 74:   if (flg) { EPSGDSetRestart(eps,opi,opi0); }

 76:   PetscOptionsInt("-eps_gd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSGDSetRestart",opi0,&opi0,&flg);
 77:   if (flg) { EPSGDSetRestart(eps,opi,opi0); }

 79:   EPSGDGetInitialSize(eps,&opi);
 80:   PetscOptionsInt("-eps_gd_initial_size","Set the initial size of the searching subspace","EPSGDSetInitialSize",opi,&opi,&flg);
 81:   if (flg) { EPSGDSetInitialSize(eps,opi); }

 83:   EPSGDGetWindowSizes(eps,&opi,&opi0);
 84:   PetscOptionsInt("-eps_gd_pwindow","(Experimental!) Set the number of converged vectors in the projector","EPSGDSetWindowSizes",opi,&opi,&flg);
 85:   if (flg) { EPSGDSetWindowSizes(eps,opi,opi0); }

 87:   PetscOptionsInt("-eps_gd_qwindow","(Experimental!) Set the number of converged vectors in the projected problem","EPSGDSetWindowSizes",opi0,&opi0,&flg);
 88:   if (flg) { EPSGDSetWindowSizes(eps,opi,opi0); }

 90:   PetscOptionsBool("-eps_gd_double_expansion","use the doble-expansion variant of GD","EPSGDSetDoubleExpansion",PETSC_FALSE,&op,&flg);
 91:   if (flg) { EPSGDSetDoubleExpansion(eps,op); }

 93:   /* Set STPrecond as the default ST */
 94:   if (!((PetscObject)eps->st)->type_name) {
 95:     STSetType(eps->st,STPRECOND);
 96:   }
 97:   STPrecondSetKSPHasMat(eps->st,PETSC_FALSE);

 99:   /* Set the default options of the KSP */
100:   STGetKSP(eps->st,&ksp);
101:   if (!((PetscObject)ksp)->type_name) {
102:     KSPSetType(ksp,KSPPREONLY);
103:   }
104:   PetscOptionsTail();
105:   return(0);
106: }

110: PetscErrorCode EPSSetUp_GD(EPS eps)
111: {
113:   PetscBool      t;
114:   KSP            ksp;

117:   /* Set KSPPREONLY as default */
118:   STGetKSP(eps->st,&ksp);
119:   if (!((PetscObject)ksp)->type_name) {
120:     KSPSetType(ksp,KSPPREONLY);
121:   }

123:   /* Setup common for all davidson solvers */
124:   EPSSetUp_XD(eps);

126:   /* Check some constraints */
127:   PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&t);
128:   if (!t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"EPSGD only works with KSPPREONLY");
129:   return(0);
130: }

134: PetscErrorCode EPSDestroy_GD(EPS eps)
135: {
136:   PetscErrorCode  ierr;

139:   PetscFree(eps->data);
140:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetKrylovStart_C",NULL);
141:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetKrylovStart_C",NULL);
142:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBOrth_C",NULL);
143:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBOrth_C",NULL);
144:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBlockSize_C",NULL);
145:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBlockSize_C",NULL);
146:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetRestart_C",NULL);
147:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetRestart_C",NULL);
148:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetInitialSize_C",NULL);
149:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetInitialSize_C",NULL);
150:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetWindowSizes_C",NULL);
151:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetWindowSizes_C",NULL);
152:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetDoubleExpansion_C",NULL);
153:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetDoubleExpansion_C",NULL);
154:   return(0);
155: }

159: /*@
160:    EPSGDSetKrylovStart - Activates or deactivates starting the searching
161:    subspace with a Krylov basis.

163:    Logically Collective on EPS

165:    Input Parameters:
166: +  eps - the eigenproblem solver context
167: -  krylovstart - boolean flag

169:    Options Database Key:
170: .  -eps_gd_krylov_start - Activates starting the searching subspace with a
171:     Krylov basis

173:    Level: advanced

175: .seealso: EPSGDGetKrylovStart()
176: @*/
177: PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)
178: {

184:   PetscTryMethod(eps,"EPSGDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));
185:   return(0);
186: }

190: /*@
191:    EPSGDGetKrylovStart - Returns a flag indicating if the search subspace is started with a
192:    Krylov basis.

194:    Not Collective

196:    Input Parameter:
197: .  eps - the eigenproblem solver context

199:    Output Parameters:
200: .  krylovstart - boolean flag indicating if the search subspace is started
201:    with a Krylov basis

203:    Level: advanced

205: .seealso: EPSGDGetKrylovStart()
206: @*/
207: PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)
208: {

214:   PetscTryMethod(eps,"EPSGDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));
215:   return(0);
216: }

220: /*@
221:    EPSGDSetBlockSize - Sets the number of vectors to be added to the searching space
222:    in every iteration.

224:    Logically Collective on EPS

226:    Input Parameters:
227: +  eps - the eigenproblem solver context
228: -  blocksize - number of vectors added to the search space in every iteration

230:    Options Database Key:
231: .  -eps_gd_blocksize - number of vectors added to the search space in every iteration

233:    Level: advanced

235: .seealso: EPSGDSetKrylovStart()
236: @*/
237: PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)
238: {

244:   PetscTryMethod(eps,"EPSGDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));
245:   return(0);
246: }

250: /*@
251:    EPSGDGetBlockSize - Returns the number of vectors to be added to the searching space
252:    in every iteration.

254:    Not Collective

256:    Input Parameter:
257: .  eps - the eigenproblem solver context

259:    Output Parameter:
260: .  blocksize - number of vectors added to the search space in every iteration

262:    Level: advanced

264: .seealso: EPSGDSetBlockSize()
265: @*/
266: PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)
267: {

273:   PetscTryMethod(eps,"EPSGDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));
274:   return(0);
275: }

279: /*@
280:    EPSGDGetRestart - Gets the number of vectors of the searching space after
281:    restarting and the number of vectors saved from the previous iteration.

283:    Not Collective

285:    Input Parameter:
286: .  eps - the eigenproblem solver context

288:    Output Parameter:
289: +  minv - number of vectors of the searching subspace after restarting
290: -  plusk - number of vectors saved from the previous iteration

292:    Level: advanced

294: .seealso: EPSGDSetRestart()
295: @*/
296: PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
297: {

302:   PetscTryMethod(eps,"EPSGDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));
303:   return(0);
304: }

308: /*@
309:    EPSGDSetRestart - Sets the number of vectors of the searching space after
310:    restarting and the number of vectors saved from the previous iteration.

312:    Logically Collective on EPS

314:    Input Parameters:
315: +  eps - the eigenproblem solver context
316: .  minv - number of vectors of the searching subspace after restarting
317: -  plusk - number of vectors saved from the previous iteration

319:    Options Database Keys:
320: +  -eps_gd_minv - number of vectors of the searching subspace after restarting
321: -  -eps_gd_plusk - number of vectors saved from the previous iteration

323:    Level: advanced

325: .seealso: EPSGDSetRestart()
326: @*/
327: PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
328: {

335:   PetscTryMethod(eps,"EPSGDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));
336:   return(0);
337: }

341: /*@
342:    EPSGDGetInitialSize - Returns the initial size of the searching space.

344:    Not Collective

346:    Input Parameter:
347: .  eps - the eigenproblem solver context

349:    Output Parameter:
350: .  initialsize - number of vectors of the initial searching subspace

352:    Notes:
353:    If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
354:    EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
355:    provided vectors are not enough, the solver completes the subspace with
356:    random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver
357:    gets the first vector provided by the user or, if not available, a random vector,
358:    and expands the Krylov basis up to initialsize vectors.

360:    Level: advanced

362: .seealso: EPSGDSetInitialSize(), EPSGDGetKrylovStart()
363: @*/
364: PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)
365: {

371:   PetscTryMethod(eps,"EPSGDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));
372:   return(0);
373: }

377: /*@
378:    EPSGDSetInitialSize - Sets the initial size of the searching space.

380:    Logically Collective on EPS

382:    Input Parameters:
383: +  eps - the eigenproblem solver context
384: -  initialsize - number of vectors of the initial searching subspace

386:    Options Database Key:
387: .  -eps_gd_initial_size - number of vectors of the initial searching subspace

389:    Notes:
390:    If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
391:    EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
392:    provided vectors are not enough, the solver completes the subspace with
393:    random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver
394:    gets the first vector provided by the user or, if not available, a random vector,
395:    and expands the Krylov basis up to initialsize vectors.

397:    Level: advanced

399: .seealso: EPSGDGetInitialSize(), EPSGDGetKrylovStart()
400: @*/
401: PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)
402: {

408:   PetscTryMethod(eps,"EPSGDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));
409:   return(0);
410: }

414: /*@
415:    EPSGDSetBOrth - Selects the orthogonalization that will be used in the search
416:    subspace in case of generalized Hermitian problems.

418:    Logically Collective on EPS

420:    Input Parameters:
421: +  eps   - the eigenproblem solver context
422: -  borth - the kind of orthogonalization

424:    Possible values:
425:    The parameter 'borth' can have one of these values

427: +   EPS_ORTH_I - orthogonalization of the search subspace
428: .   EPS_ORTH_B - B-orthogonalization of the search subspace
429: -   EPS_ORTH_BOPT - B-orthogonalization of the search subspace with an alternative method

431:    Options Database Key:
432: .  -eps_gd_borth - Set the orthogonalization used in the search subspace

434:    Notes:
435:    If borth is EPS_ORTH_B, the solver uses a variant of Gram-Schmidt (selected in
436:    IP associated to the EPS) with the inner product defined by the matrix problem B.
437:    If borth is EPS_ORTH_BOPT, it uses another variant of Gram-Schmidt that only performs
438:    one matrix-vector product although more than one reorthogonalization would be done.

440:    Level: advanced

442: .seealso: EPSGDGetBOrth()
443: @*/
444: PetscErrorCode EPSGDSetBOrth(EPS eps,EPSOrthType borth)
445: {

451:   PetscTryMethod(eps,"EPSGDSetBOrth_C",(EPS,EPSOrthType),(eps,borth));
452:   return(0);
453: }

457: /*@
458:    EPSGDGetBOrth - Returns the orthogonalization used in the search
459:    subspace in case of generalized Hermitian problems.

461:    Not Collective

463:    Input Parameter:
464: .  eps - the eigenproblem solver context

466:    Output Parameters:
467: .  borth - the kind of orthogonalization

469:    Notes:
470:    See EPSGDSetBOrth() for possible values of 'borth'.

472:    Level: advanced

474: .seealso: EPSGDSetBOrth(), EPSOrthType
475: @*/
476: PetscErrorCode EPSGDGetBOrth(EPS eps,EPSOrthType *borth)
477: {

483:   PetscTryMethod(eps,"EPSGDGetBOrth_C",(EPS,EPSOrthType*),(eps,borth));
484:   return(0);
485: }

489: /*@
490:    EPSGDGetWindowSizes - Gets the number of converged vectors in the projected
491:    problem (or Rayleigh quotient) and in the projector employed in the correction
492:    equation.

494:    Not Collective

496:    Input Parameter:
497: .  eps - the eigenproblem solver context

499:    Output Parameter:
500: +  pwindow - number of converged vectors in the projector
501: -  qwindow - number of converged vectors in the projected problem

503:    Level: advanced

505: .seealso: EPSGDSetWindowSizes()
506: @*/
507: PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)
508: {

513:   PetscTryMethod(eps,"EPSGDGetWindowSizes_C",(EPS,PetscInt*,PetscInt*),(eps,pwindow,qwindow));
514:   return(0);
515: }

519: /*@
520:    EPSGDSetWindowSizes - Sets the number of converged vectors in the projected
521:    problem (or Rayleigh quotient) and in the projector employed in the correction
522:    equation.

524:    Logically Collective on EPS

526:    Input Parameters:
527: +  eps - the eigenproblem solver context
528: .  pwindow - number of converged vectors in the projector
529: -  qwindow - number of converged vectors in the projected problem

531:    Options Database Keys:
532: +  -eps_gd_pwindow - set the number of converged vectors in the projector
533: -  -eps_gd_qwindow - set the number of converged vectors in the projected problem

535:    Level: advanced

537: .seealso: EPSGDGetWindowSizes()
538: @*/
539: PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)
540: {

547:   PetscTryMethod(eps,"EPSGDSetWindowSizes_C",(EPS,PetscInt,PetscInt),(eps,pwindow,qwindow));
548:   return(0);
549: }

553: static PetscErrorCode EPSGDSetDoubleExpansion_GD(EPS eps,PetscBool use_gd2)
554: {

558:   EPSXDSetMethod(eps,use_gd2?DVD_METH_GD2:DVD_METH_GD);
559:   return(0);
560: }

564: static PetscErrorCode EPSGDGetDoubleExpansion_GD(EPS eps,PetscBool *flg)
565: {
566:   Method_t       meth;

570:   EPSXDGetMethod_XD(eps,&meth);
571:   if (meth==DVD_METH_GD2) *flg = PETSC_TRUE;
572:   else *flg = PETSC_FALSE;
573:   return(0);
574: }

578: /*@
579:    EPSGDGetDoubleExpansion - Gets a flag indicating whether the double
580:    expansion variant has been activated or not.

582:    Not Collective

584:    Input Parameter:
585: .  eps - the eigenproblem solver context

587:    Output Parameter:
588: .  flg - the flag

590:    Level: advanced

592: .seealso: EPSGDSetDoubleExpansion()
593: @*/
594: PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *flg)
595: {

601:   PetscTryMethod(eps,"EPSGDGetDoubleExpansion_C",(EPS,PetscBool*),(eps,flg));
602:   return(0);
603: }

607: /*@
608:    EPSGDSetDoubleExpansion - Activate a variant where the search subspace is
609:    expanded with K*[A*x B*x] (double expansion) instead of the classic K*r,
610:    where K is the preconditioner, x the selected approximate eigenvector and
611:    r its associated residual vector.

613:    Logically Collective on EPS

615:    Input Parameters:
616: +  eps - the eigenproblem solver context
617: -  use_gd2 - the boolean flag

619:    Options Database Keys:
620: .  -eps_gd_double_expansion - activate the double-expansion variant of GD

622:    Level: advanced
623: @*/
624: PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool use_gd2)
625: {

631:   PetscTryMethod(eps,"EPSGDSetDoubleExpansion_C",(EPS,PetscBool),(eps,use_gd2));
632:   return(0);
633: }

637: PETSC_EXTERN PetscErrorCode EPSCreate_GD(EPS eps)
638: {
639:   PetscErrorCode  ierr;

642:   /* Load the Davidson solver */
643:   EPSCreate_XD(eps);
644:   EPSJDSetFix_JD(eps,0.0);
645:   EPSXDSetMethod(eps,DVD_METH_GD);

647:   /* Overload the GD properties */
648:   eps->ops->setfromoptions       = EPSSetFromOptions_GD;
649:   eps->ops->setup                = EPSSetUp_GD;
650:   eps->ops->destroy              = EPSDestroy_GD;

652:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetKrylovStart_C",EPSXDSetKrylovStart_XD);
653:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetKrylovStart_C",EPSXDGetKrylovStart_XD);
654:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBOrth_C",EPSXDSetBOrth_XD);
655:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBOrth_C",EPSXDGetBOrth_XD);
656:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBlockSize_C",EPSXDSetBlockSize_XD);
657:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBlockSize_C",EPSXDGetBlockSize_XD);
658:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetRestart_C",EPSXDSetRestart_XD);
659:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetRestart_C",EPSXDGetRestart_XD);
660:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetInitialSize_C",EPSXDSetInitialSize_XD);
661:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetInitialSize_C",EPSXDGetInitialSize_XD);
662:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetWindowSizes_C",EPSXDSetWindowSizes_XD);
663:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetWindowSizes_C",EPSXDGetWindowSizes_XD);
664:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetDoubleExpansion_C",EPSGDSetDoubleExpansion_GD);
665:   PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetDoubleExpansion_C",EPSGDGetDoubleExpansion_GD);
666:   return(0);
667: }

slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/index.html0000644000175000017500000000212012211062077022326 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

gd.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/ftn-auto/0000755000175000017500000000000012214143515022073 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/ftn-auto/gdf.c0000644000175000017500000001305112211062077022777 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* gd.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetkrylovstart_ EPSGDSETKRYLOVSTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetkrylovstart_ epsgdsetkrylovstart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetkrylovstart_ EPSGDGETKRYLOVSTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetkrylovstart_ epsgdgetkrylovstart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetblocksize_ EPSGDSETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetblocksize_ epsgdsetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetblocksize_ EPSGDGETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetblocksize_ epsgdgetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetrestart_ EPSGDGETRESTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetrestart_ epsgdgetrestart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetrestart_ EPSGDSETRESTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetrestart_ epsgdsetrestart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetinitialsize_ EPSGDGETINITIALSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetinitialsize_ epsgdgetinitialsize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetinitialsize_ EPSGDSETINITIALSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetinitialsize_ epsgdsetinitialsize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetborth_ EPSGDSETBORTH #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetborth_ epsgdsetborth #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetborth_ EPSGDGETBORTH #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetborth_ epsgdgetborth #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetwindowsizes_ EPSGDGETWINDOWSIZES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetwindowsizes_ epsgdgetwindowsizes #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetwindowsizes_ EPSGDSETWINDOWSIZES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetwindowsizes_ epsgdsetwindowsizes #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdgetdoubleexpansion_ EPSGDGETDOUBLEEXPANSION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdgetdoubleexpansion_ epsgdgetdoubleexpansion #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgdsetdoubleexpansion_ EPSGDSETDOUBLEEXPANSION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgdsetdoubleexpansion_ epsgdsetdoubleexpansion #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsgdsetkrylovstart_(EPS *eps,PetscBool *krylovstart, int *__ierr ){ *__ierr = EPSGDSetKrylovStart(*eps,*krylovstart); } void PETSC_STDCALL epsgdgetkrylovstart_(EPS *eps,PetscBool *krylovstart, int *__ierr ){ *__ierr = EPSGDGetKrylovStart(*eps,krylovstart); } void PETSC_STDCALL epsgdsetblocksize_(EPS *eps,PetscInt *blocksize, int *__ierr ){ *__ierr = EPSGDSetBlockSize(*eps,*blocksize); } void PETSC_STDCALL epsgdgetblocksize_(EPS *eps,PetscInt *blocksize, int *__ierr ){ *__ierr = EPSGDGetBlockSize(*eps,blocksize); } void PETSC_STDCALL epsgdgetrestart_(EPS *eps,PetscInt *minv,PetscInt *plusk, int *__ierr ){ *__ierr = EPSGDGetRestart(*eps,minv,plusk); } void PETSC_STDCALL epsgdsetrestart_(EPS *eps,PetscInt *minv,PetscInt *plusk, int *__ierr ){ *__ierr = EPSGDSetRestart(*eps,*minv,*plusk); } void PETSC_STDCALL epsgdgetinitialsize_(EPS *eps,PetscInt *initialsize, int *__ierr ){ *__ierr = EPSGDGetInitialSize(*eps,initialsize); } void PETSC_STDCALL epsgdsetinitialsize_(EPS *eps,PetscInt *initialsize, int *__ierr ){ *__ierr = EPSGDSetInitialSize(*eps,*initialsize); } void PETSC_STDCALL epsgdsetborth_(EPS *eps,EPSOrthType *borth, int *__ierr ){ *__ierr = EPSGDSetBOrth(*eps,*borth); } void PETSC_STDCALL epsgdgetborth_(EPS *eps,EPSOrthType *borth, int *__ierr ){ *__ierr = EPSGDGetBOrth(*eps, (EPSOrthType* )PetscToPointer((borth) )); } void PETSC_STDCALL epsgdgetwindowsizes_(EPS *eps,PetscInt *pwindow,PetscInt *qwindow, int *__ierr ){ *__ierr = EPSGDGetWindowSizes(*eps,pwindow,qwindow); } void PETSC_STDCALL epsgdsetwindowsizes_(EPS *eps,PetscInt *pwindow,PetscInt *qwindow, int *__ierr ){ *__ierr = EPSGDSetWindowSizes(*eps,*pwindow,*qwindow); } void PETSC_STDCALL epsgdgetdoubleexpansion_(EPS *eps,PetscBool *flg, int *__ierr ){ *__ierr = EPSGDGetDoubleExpansion(*eps,flg); } void PETSC_STDCALL epsgdsetdoubleexpansion_(EPS *eps,PetscBool *use_gd2, int *__ierr ){ *__ierr = EPSGDSetDoubleExpansion(*eps,*use_gd2); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/davidson/gd/ftn-auto/makefile0000644000175000017500000000034512211062077023575 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = gdf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/davidson/gd/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/0000755000175000017500000000000012214143515017463 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylov.c0000644000175000017500000001704412211062077021163 0ustar gladkgladk/* Common subroutines for all Krylov-type solvers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #undef __FUNCT__ #define __FUNCT__ "EPSBasicArnoldi" /* EPSBasicArnoldi - Computes an m-step Arnoldi factorization. The first k columns are assumed to be locked and therefore they are not modified. On exit, the following relation is satisfied: OP * V - V * H = f * e_m^T where the columns of V are the Arnoldi vectors (which are B-orthonormal), H is an upper Hessenberg matrix, f is the residual vector and e_m is the m-th vector of the canonical basis. The vector f is B-orthogonal to the columns of V. On exit, beta contains the B-norm of f and the next Arnoldi vector can be computed as v_{m+1} = f / beta. */ PetscErrorCode EPSBasicArnoldi(EPS eps,PetscBool trans,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown) { PetscErrorCode ierr; PetscInt j,m = *M; PetscReal norm; PetscFunctionBegin; for (j=k;jst,V[j],V[j+1]);CHKERRQ(ierr); } else { ierr = STApply(eps->st,V[j],V[j+1]);CHKERRQ(ierr); } ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,NULL,V,V[j+1],H+ldh*j,&norm,breakdown);CHKERRQ(ierr); H[j+1+ldh*j] = norm; if (*breakdown) { *M = j+1; *beta = norm; PetscFunctionReturn(0); } else { ierr = VecScale(V[j+1],1/norm);CHKERRQ(ierr); } } if (trans) { ierr = STApplyTranspose(eps->st,V[m-1],f);CHKERRQ(ierr); } else { ierr = STApply(eps->st,V[m-1],f);CHKERRQ(ierr); } ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,m,NULL,V,f,H+ldh*(m-1),beta,NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSKrylovConvergence" /* EPSKrylovConvergence - Implements the loop that checks for convergence in Krylov methods. Input Parameters: eps - the eigensolver; some error estimates are updated in eps->errest getall - whether all residuals must be computed kini - initial value of k (the loop variable) nits - number of iterations of the loop V - set of basis vectors (used only if trueresidual is activated) nv - number of vectors to process (dimension of Q, columns of V) beta - norm of f (the residual vector of the Arnoldi/Lanczos factorization) corrf - correction factor for residual estimates (only in harmonic KS) Output Parameters: kout - the first index where the convergence test failed */ PetscErrorCode EPSKrylovConvergence(EPS eps,PetscBool getall,PetscInt kini,PetscInt nits,Vec *V,PetscInt nv,PetscReal beta,PetscReal corrf,PetscInt *kout) { PetscErrorCode ierr; PetscInt k,newk,marker,ld; PetscScalar re,im,*Zr,*Zi,*X; PetscReal resnorm; PetscBool isshift,refined; Vec x,y; PetscFunctionBegin; if (eps->trueres) { ierr = VecDuplicate(eps->t,&x);CHKERRQ(ierr); ierr = VecDuplicate(eps->t,&y);CHKERRQ(ierr); } ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = DSGetRefined(eps->ds,&refined);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STSHIFT,&isshift);CHKERRQ(ierr); marker = -1; if (eps->trackall) getall = PETSC_TRUE; for (k=kini;keigr[k]; im = eps->eigi[k]; if (eps->trueres || isshift) { ierr = STBackTransform(eps->st,1,&re,&im);CHKERRQ(ierr); } newk = k; ierr = DSVectors(eps->ds,DS_MAT_X,&newk,&resnorm);CHKERRQ(ierr); if (eps->trueres) { ierr = DSGetArray(eps->ds,DS_MAT_X,&X);CHKERRQ(ierr); Zr = X+k*ld; if (newk==k+1) Zi = X+newk*ld; else Zi = NULL; ierr = EPSComputeRitzVector(eps,Zr,Zi,V,nv,x,y);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_X,&X);CHKERRQ(ierr); ierr = EPSComputeResidualNorm_Private(eps,re,im,x,y,&resnorm);CHKERRQ(ierr); } else if (!refined) resnorm *= beta*corrf; /* error estimate */ ierr = (*eps->converged)(eps,re,im,resnorm,&eps->errest[k],eps->convergedctx);CHKERRQ(ierr); if (marker==-1 && eps->errest[k] >= eps->tol) marker = k; if (newk==k+1) { eps->errest[k+1] = eps->errest[k]; k++; } if (marker!=-1 && !getall) break; } if (marker!=-1) k = marker; *kout = k; if (eps->trueres) { ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSFullLanczos" /* EPSFullLanczos - Computes an m-step Lanczos factorization with full reorthogonalization. At each Lanczos step, the corresponding Lanczos vector is orthogonalized with respect to all previous Lanczos vectors. This is equivalent to computing an m-step Arnoldi factorization and exploting symmetry of the operator. The first k columns are assumed to be locked and therefore they are not modified. On exit, the following relation is satisfied: OP * V - V * T = f * e_m^T where the columns of V are the Lanczos vectors (which are B-orthonormal), T is a real symmetric tridiagonal matrix, f is the residual vector and e_m is the m-th vector of the canonical basis. The tridiagonal is stored as two arrays: alpha contains the diagonal elements, beta the off-diagonal. The vector f is B-orthogonal to the columns of V. On exit, the last element of beta contains the B-norm of f and the next Lanczos vector can be computed as v_{m+1} = f / beta(end). */ PetscErrorCode EPSFullLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown) { PetscErrorCode ierr; PetscInt j,m = *M; PetscReal norm; PetscScalar *hwork,lhwork[100]; PetscFunctionBegin; if (m > 100) { ierr = PetscMalloc((eps->nds+m)*sizeof(PetscScalar),&hwork);CHKERRQ(ierr); } else hwork = lhwork; for (j=k;jst,V[j],V[j+1]);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,NULL,V,V[j+1],hwork,&norm,breakdown);CHKERRQ(ierr); alpha[j] = PetscRealPart(hwork[j]); beta[j] = norm; if (*breakdown) { *M = j+1; if (m > 100) { ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } else { ierr = VecScale(V[j+1],1.0/norm);CHKERRQ(ierr); } } ierr = STApply(eps->st,V[m-1],f);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,m,NULL,V,f,hwork,&norm,NULL);CHKERRQ(ierr); alpha[m-1] = PetscRealPart(hwork[m-1]); beta[m-1] = norm; if (m > 100) { ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylov.c.html0000644000175000017500000004015412211062077022124 0ustar gladkgladk

Actual source code: krylov.c

  1: /*
  2:    Common subroutines for all Krylov-type solvers.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>
 25: #include <slepc-private/slepcimpl.h>
 26: #include <slepcblaslapack.h>

 30: /*
 31:    EPSBasicArnoldi - Computes an m-step Arnoldi factorization. The first k
 32:    columns are assumed to be locked and therefore they are not modified. On
 33:    exit, the following relation is satisfied:

 35:                     OP * V - V * H = f * e_m^T

 37:    where the columns of V are the Arnoldi vectors (which are B-orthonormal),
 38:    H is an upper Hessenberg matrix, f is the residual vector and e_m is
 39:    the m-th vector of the canonical basis. The vector f is B-orthogonal to
 40:    the columns of V. On exit, beta contains the B-norm of f and the next
 41:    Arnoldi vector can be computed as v_{m+1} = f / beta.
 42: */
 43: PetscErrorCode EPSBasicArnoldi(EPS eps,PetscBool trans,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)
 44: {
 46:   PetscInt       j,m = *M;
 47:   PetscReal      norm;

 50:   for (j=k;j<m-1;j++) {
 51:     if (trans) {
 52:       STApplyTranspose(eps->st,V[j],V[j+1]);
 53:     } else {
 54:       STApply(eps->st,V[j],V[j+1]);
 55:     }
 56:     IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,NULL,V,V[j+1],H+ldh*j,&norm,breakdown);
 57:     H[j+1+ldh*j] = norm;
 58:     if (*breakdown) {
 59:       *M = j+1;
 60:       *beta = norm;
 61:       return(0);
 62:     } else {
 63:       VecScale(V[j+1],1/norm);
 64:     }
 65:   }
 66:   if (trans) {
 67:     STApplyTranspose(eps->st,V[m-1],f);
 68:   } else {
 69:     STApply(eps->st,V[m-1],f);
 70:   }
 71:   IPOrthogonalize(eps->ip,eps->nds,eps->defl,m,NULL,V,f,H+ldh*(m-1),beta,NULL);
 72:   return(0);
 73: }

 77: /*
 78:    EPSKrylovConvergence - Implements the loop that checks for convergence
 79:    in Krylov methods.

 81:    Input Parameters:
 82:      eps   - the eigensolver; some error estimates are updated in eps->errest
 83:      getall - whether all residuals must be computed
 84:      kini  - initial value of k (the loop variable)
 85:      nits  - number of iterations of the loop
 86:      V     - set of basis vectors (used only if trueresidual is activated)
 87:      nv    - number of vectors to process (dimension of Q, columns of V)
 88:      beta  - norm of f (the residual vector of the Arnoldi/Lanczos factorization)
 89:      corrf - correction factor for residual estimates (only in harmonic KS)

 91:    Output Parameters:
 92:      kout  - the first index where the convergence test failed
 93: */
 94: PetscErrorCode EPSKrylovConvergence(EPS eps,PetscBool getall,PetscInt kini,PetscInt nits,Vec *V,PetscInt nv,PetscReal beta,PetscReal corrf,PetscInt *kout)
 95: {
 97:   PetscInt       k,newk,marker,ld;
 98:   PetscScalar    re,im,*Zr,*Zi,*X;
 99:   PetscReal      resnorm;
100:   PetscBool      isshift,refined;
101:   Vec            x,y;

104:   if (eps->trueres) {
105:     VecDuplicate(eps->t,&x);
106:     VecDuplicate(eps->t,&y);
107:   }
108:   DSGetLeadingDimension(eps->ds,&ld);
109:   DSGetRefined(eps->ds,&refined);
110:   PetscObjectTypeCompare((PetscObject)eps->st,STSHIFT,&isshift);
111:   marker = -1;
112:   if (eps->trackall) getall = PETSC_TRUE;
113:   for (k=kini;k<kini+nits;k++) {
114:     /* eigenvalue */
115:     re = eps->eigr[k];
116:     im = eps->eigi[k];
117:     if (eps->trueres || isshift) {
118:       STBackTransform(eps->st,1,&re,&im);
119:     }
120:     newk = k;
121:     DSVectors(eps->ds,DS_MAT_X,&newk,&resnorm);
122:     if (eps->trueres) {
123:       DSGetArray(eps->ds,DS_MAT_X,&X);
124:       Zr = X+k*ld;
125:       if (newk==k+1) Zi = X+newk*ld;
126:       else Zi = NULL;
127:       EPSComputeRitzVector(eps,Zr,Zi,V,nv,x,y);
128:       DSRestoreArray(eps->ds,DS_MAT_X,&X);
129:       EPSComputeResidualNorm_Private(eps,re,im,x,y,&resnorm);
130:     }
131:     else if (!refined) resnorm *= beta*corrf;
132:     /* error estimate */
133:     (*eps->converged)(eps,re,im,resnorm,&eps->errest[k],eps->convergedctx);
134:     if (marker==-1 && eps->errest[k] >= eps->tol) marker = k;
135:     if (newk==k+1) {
136:       eps->errest[k+1] = eps->errest[k];
137:       k++;
138:     }
139:     if (marker!=-1 && !getall) break;
140:   }
141:   if (marker!=-1) k = marker;
142:   *kout = k;
143:   if (eps->trueres) {
144:     VecDestroy(&x);
145:     VecDestroy(&y);
146:   }
147:   return(0);
148: }

152: /*
153:    EPSFullLanczos - Computes an m-step Lanczos factorization with full
154:    reorthogonalization.  At each Lanczos step, the corresponding Lanczos
155:    vector is orthogonalized with respect to all previous Lanczos vectors.
156:    This is equivalent to computing an m-step Arnoldi factorization and
157:    exploting symmetry of the operator.

159:    The first k columns are assumed to be locked and therefore they are
160:    not modified. On exit, the following relation is satisfied:

162:                     OP * V - V * T = f * e_m^T

164:    where the columns of V are the Lanczos vectors (which are B-orthonormal),
165:    T is a real symmetric tridiagonal matrix, f is the residual vector and e_m
166:    is the m-th vector of the canonical basis. The tridiagonal is stored as
167:    two arrays: alpha contains the diagonal elements, beta the off-diagonal.
168:    The vector f is B-orthogonal to the columns of V. On exit, the last element
169:    of beta contains the B-norm of f and the next Lanczos vector can be
170:    computed as v_{m+1} = f / beta(end).

172: */
173: PetscErrorCode EPSFullLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown)
174: {
176:   PetscInt       j,m = *M;
177:   PetscReal      norm;
178:   PetscScalar    *hwork,lhwork[100];

181:   if (m > 100) {
182:     PetscMalloc((eps->nds+m)*sizeof(PetscScalar),&hwork);
183:   } else hwork = lhwork;

185:   for (j=k;j<m-1;j++) {
186:     STApply(eps->st,V[j],V[j+1]);
187:     IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,NULL,V,V[j+1],hwork,&norm,breakdown);
188:     alpha[j] = PetscRealPart(hwork[j]);
189:     beta[j] = norm;
190:     if (*breakdown) {
191:       *M = j+1;
192:       if (m > 100) {
193:         PetscFree(hwork);
194:       }
195:       return(0);
196:     } else {
197:       VecScale(V[j+1],1.0/norm);
198:     }
199:   }
200:   STApply(eps->st,V[m-1],f);
201:   IPOrthogonalize(eps->ip,eps->nds,eps->defl,m,NULL,V,f,hwork,&norm,NULL);
202:   alpha[m-1] = PetscRealPart(hwork[m-1]);
203:   beta[m-1] = norm;

205:   if (m > 100) {
206:     PetscFree(hwork);
207:   }
208:   return(0);
209: }

slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/makefile0000644000175000017500000000217512211062077021170 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = krylov.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = arnoldi lanczos krylovschur LOCDIR = src/eps/impls/krylov/ MANSEC = EPS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/makefile.html0000644000175000017500000000377112211062077022136 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = krylov.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     = arnoldi lanczos krylovschur
LOCDIR   = src/eps/impls/krylov/
MANSEC   = EPS

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/0000755000175000017500000000000012214143515021134 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/lanczos.c.html0000644000175000017500000021132212211062077023715 0ustar gladkgladk
Actual source code: lanczos.c

  1: /*

  3:    SLEPc eigensolver: "lanczos"

  5:    Method: Explicitly Restarted Symmetric/Hermitian Lanczos

  7:    Algorithm:

  9:        Lanczos method for symmetric (Hermitian) problems, with explicit
 10:        restart and deflation. Several reorthogonalization strategies can
 11:        be selected.

 13:    References:

 15:        [1] "Lanczos Methods in SLEPc", SLEPc Technical Report STR-5,
 16:            available at http://www.grycap.upv.es/slepc.

 18:    Last update: Feb 2009

 20:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 21:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 22:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 24:    This file is part of SLEPc.

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

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

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

 40: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 41: #include <slepcblaslapack.h>

 43: PetscErrorCode EPSSolve_Lanczos(EPS);

 45: typedef struct {
 46:   EPSLanczosReorthogType reorthog;
 47:   Vec *AV;
 48: } EPS_LANCZOS;

 52: PetscErrorCode EPSSetUp_Lanczos(EPS eps)
 53: {
 54:   EPS_LANCZOS    *lanczos = (EPS_LANCZOS*)eps->data;

 58:   if (eps->ncv) { /* ncv set */
 59:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev");
 60:   } else if (eps->mpd) { /* mpd set */
 61:     eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 62:   } else { /* neither set: defaults depend on nev being small or large */
 63:     if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15));
 64:     else {
 65:       eps->mpd = 500;
 66:       eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 67:     }
 68:   }
 69:   if (!eps->mpd) eps->mpd = eps->ncv;
 70:   if (eps->ncv>eps->nev+eps->mpd) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must not be larger than nev+mpd");
 71:   if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);

 73:   if (!eps->which) { EPSSetWhichEigenpairs_Default(eps); }
 74:   switch (eps->which) {
 75:     case EPS_LARGEST_IMAGINARY:
 76:     case EPS_SMALLEST_IMAGINARY:
 77:     case EPS_TARGET_IMAGINARY:
 78:       SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
 79:     default: ; /* default case to remove warning */
 80:   }
 81:   if (!eps->extraction) {
 82:     EPSSetExtraction(eps,EPS_RITZ);
 83:   } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
 84:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

 86:   EPSAllocateSolution(eps);
 87:   if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_SELECTIVE) {
 88:     VecDuplicateVecs(eps->t,eps->ncv,&lanczos->AV);
 89:     PetscLogObjectParents(eps,eps->ncv,lanczos->AV);
 90:   }
 91:   DSSetType(eps->ds,DSHEP);
 92:   DSSetCompact(eps->ds,PETSC_TRUE);
 93:   DSAllocate(eps->ds,eps->ncv);
 94:   if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL) {
 95:     EPSSetWorkVecs(eps,2);
 96:   } else {
 97:     EPSSetWorkVecs(eps,1);
 98:   }

100:   /* dispatch solve method */
101:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
102:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems");
103:   if (eps->isgeneralized && eps->ishermitian && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method does not work for indefinite problems");
104:   eps->ops->solve = EPSSolve_Lanczos;
105:   return(0);
106: }

110: /*
111:    EPSLocalLanczos - Local reorthogonalization.

113:    This is the simplest variant. At each Lanczos step, the corresponding Lanczos vector
114:    is orthogonalized with respect to the two previous Lanczos vectors, according to
115:    the three term Lanczos recurrence. WARNING: This variant does not track the loss of
116:    orthogonality that occurs in finite-precision arithmetic and, therefore, the
117:    generated vectors are not guaranteed to be (semi-)orthogonal.
118: */
119: static PetscErrorCode EPSLocalLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown)
120: {
122:   PetscInt       i,j,m = *M;
123:   PetscReal      norm;
124:   PetscBool      *which,lwhich[100];
125:   PetscScalar    *hwork,lhwork[100];

128:   if (m > 100) {
129:     PetscMalloc(sizeof(PetscBool)*m,&which);
130:     PetscMalloc(m*sizeof(PetscScalar),&hwork);
131:   } else {
132:     which = lwhich;
133:     hwork = lhwork;
134:   }
135:   for (i=0;i<k;i++)
136:     which[i] = PETSC_TRUE;

138:   for (j=k;j<m-1;j++) {
139:     STApply(eps->st,V[j],V[j+1]);
140:     which[j] = PETSC_TRUE;
141:     if (j-2>=k) which[j-2] = PETSC_FALSE;
142:     IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,which,V,V[j+1],hwork,&norm,breakdown);
143:     alpha[j] = PetscRealPart(hwork[j]);
144:     beta[j] = norm;
145:     if (*breakdown) {
146:       *M = j+1;
147:       if (m > 100) {
148:         PetscFree(which);
149:         PetscFree(hwork);
150:       }
151:       return(0);
152:     } else {
153:       VecScale(V[j+1],1.0/norm);
154:     }
155:   }
156:   STApply(eps->st,V[m-1],f);
157:   IPOrthogonalize(eps->ip,eps->nds,eps->defl,m,NULL,V,f,hwork,&norm,NULL);
158:   alpha[m-1] = PetscRealPart(hwork[m-1]);
159:   beta[m-1] = norm;

161:   if (m > 100) {
162:     PetscFree(which);
163:     PetscFree(hwork);
164:   }
165:   return(0);
166: }

170: /*
171:    DenseTridiagonal - Solves a real tridiagonal Hermitian Eigenvalue Problem.

173:    Input Parameters:
174: +  n   - dimension of the eigenproblem
175: .  D   - pointer to the array containing the diagonal elements
176: -  E   - pointer to the array containing the off-diagonal elements

178:    Output Parameters:
179: +  w  - pointer to the array to store the computed eigenvalues
180: -  V  - pointer to the array to store the eigenvectors

182:    Notes:
183:    If V is NULL then the eigenvectors are not computed.

185:    This routine use LAPACK routines xSTEVR.

187: */
188: static PetscErrorCode DenseTridiagonal(PetscInt n_,PetscReal *D,PetscReal *E,PetscReal *w,PetscScalar *V)
189: {
190: #if defined(SLEPC_MISSING_LAPACK_STEVR)
192:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"STEVR - Lapack routine is unavailable");
193: #else
195:   PetscReal      abstol = 0.0,vl,vu,*work;
196:   PetscBLASInt   il,iu,m,*isuppz,n,lwork,*iwork,liwork,info;
197:   const char     *jobz;
198: #if defined(PETSC_USE_COMPLEX)
199:   PetscInt       i,j;
200:   PetscReal      *VV;
201: #endif

204:   PetscBLASIntCast(n_,&n);
205:   PetscBLASIntCast(20*n_,&lwork);
206:   PetscBLASIntCast(10*n_,&liwork);
207:   if (V) {
208:     jobz = "V";
209: #if defined(PETSC_USE_COMPLEX)
210:     PetscMalloc(n*n*sizeof(PetscReal),&VV);
211: #endif
212:   } else jobz = "N";
213:   PetscMalloc(2*n*sizeof(PetscBLASInt),&isuppz);
214:   PetscMalloc(lwork*sizeof(PetscReal),&work);
215:   PetscMalloc(liwork*sizeof(PetscBLASInt),&iwork);
216:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
217: #if defined(PETSC_USE_COMPLEX)
218:   PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_(jobz,"A",&n,D,E,&vl,&vu,&il,&iu,&abstol,&m,w,VV,&n,isuppz,work,&lwork,iwork,&liwork,&info));
219: #else
220:   PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_(jobz,"A",&n,D,E,&vl,&vu,&il,&iu,&abstol,&m,w,V,&n,isuppz,work,&lwork,iwork,&liwork,&info));
221: #endif
222:   PetscFPTrapPop();
223:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DSTEVR %d",info);
224: #if defined(PETSC_USE_COMPLEX)
225:   if (V) {
226:     for (i=0;i<n;i++)
227:       for (j=0;j<n;j++)
228:         V[i*n+j] = VV[i*n+j];
229:     PetscFree(VV);
230:   }
231: #endif
232:   PetscFree(isuppz);
233:   PetscFree(work);
234:   PetscFree(iwork);
235:   return(0);
236: #endif
237: }

241: /*
242:    EPSSelectiveLanczos - Selective reorthogonalization.
243: */
244: static PetscErrorCode EPSSelectiveLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal anorm)
245: {
247:   EPS_LANCZOS    *lanczos = (EPS_LANCZOS*)eps->data;
248:   PetscInt       i,j,m = *M,n,nritz=0,nritzo;
249:   PetscReal      *d,*e,*ritz,norm;
250:   PetscScalar    *Y,*hwork,lhwork[100];
251:   PetscBool      *which,lwhich[100];

254:   PetscMalloc(m*sizeof(PetscReal),&d);
255:   PetscMalloc(m*sizeof(PetscReal),&e);
256:   PetscMalloc(m*sizeof(PetscReal),&ritz);
257:   PetscMalloc(m*m*sizeof(PetscScalar),&Y);
258:   if (m > 100) {
259:     PetscMalloc(sizeof(PetscBool)*m,&which);
260:     PetscMalloc(m*sizeof(PetscScalar),&hwork);
261:   } else {
262:     which = lwhich;
263:     hwork = lhwork;
264:   }
265:   for (i=0;i<k;i++)
266:     which[i] = PETSC_TRUE;

268:   for (j=k;j<m;j++) {
269:     /* Lanczos step */
270:     STApply(eps->st,V[j],f);
271:     which[j] = PETSC_TRUE;
272:     if (j-2>=k) which[j-2] = PETSC_FALSE;
273:     IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,which,V,f,hwork,&norm,breakdown);
274:     alpha[j] = PetscRealPart(hwork[j]);
275:     beta[j] = norm;
276:     if (*breakdown) {
277:       *M = j+1;
278:       break;
279:     }

281:     /* Compute eigenvalues and eigenvectors Y of the tridiagonal block */
282:     n = j-k+1;
283:     for (i=0;i<n;i++) {
284:       d[i] = alpha[i+k];
285:       e[i] = beta[i+k];
286:     }
287:     DenseTridiagonal(n,d,e,ritz,Y);

289:     /* Estimate ||A|| */
290:     for (i=0;i<n;i++)
291:       if (PetscAbsReal(ritz[i]) > anorm) anorm = PetscAbsReal(ritz[i]);

293:     /* Compute nearly converged Ritz vectors */
294:     nritzo = 0;
295:     for (i=0;i<n;i++)
296:       if (norm*PetscAbsScalar(Y[i*n+n-1]) < PETSC_SQRT_MACHINE_EPSILON*anorm)
297:         nritzo++;

299:     if (nritzo>nritz) {
300:       nritz = 0;
301:       for (i=0;i<n;i++) {
302:         if (norm*PetscAbsScalar(Y[i*n+n-1]) < PETSC_SQRT_MACHINE_EPSILON*anorm) {
303:           SlepcVecMAXPBY(lanczos->AV[nritz],0.0,1.0,n,Y+i*n,V+k);
304:           nritz++;
305:         }
306:       }
307:     }

309:     if (nritz > 0) {
310:       IPOrthogonalize(eps->ip,0,NULL,nritz,NULL,lanczos->AV,f,hwork,&norm,breakdown);
311:       if (*breakdown) {
312:         *M = j+1;
313:         break;
314:       }
315:     }

317:     if (j<m-1) {
318:       VecScale(f,1.0 / norm);
319:       VecCopy(f,V[j+1]);
320:     }
321:   }

323:   PetscFree(d);
324:   PetscFree(e);
325:   PetscFree(ritz);
326:   PetscFree(Y);
327:   if (m > 100) {
328:     PetscFree(which);
329:     PetscFree(hwork);
330:   }
331:   return(0);
332: }

336: static void update_omega(PetscReal *omega,PetscReal *omega_old,PetscInt j,PetscReal *alpha,PetscReal *beta,PetscReal eps1,PetscReal anorm)
337: {
338:   PetscInt       k;
339:   PetscReal      T,binv;

342:   /* Estimate of contribution to roundoff errors from A*v
343:        fl(A*v) = A*v + f,
344:      where ||f|| \approx eps1*||A||.
345:      For a full matrix A, a rule-of-thumb estimate is eps1 = sqrt(n)*eps. */
346:   T = eps1*anorm;
347:   binv = 1.0/beta[j+1];

349:   /* Update omega(1) using omega(0)==0. */
350:   omega_old[0]= beta[1]*omega[1] + (alpha[0]-alpha[j])*omega[0] -
351:                 beta[j]*omega_old[0];
352:   if (omega_old[0] > 0) omega_old[0] = binv*(omega_old[0] + T);
353:   else omega_old[0] = binv*(omega_old[0] - T);

355:   /* Update remaining components. */
356:   for (k=1;k<j-1;k++) {
357:     omega_old[k] = beta[k+1]*omega[k+1] + (alpha[k]-alpha[j])*omega[k] + beta[k]*omega[k-1] - beta[j]*omega_old[k];
358:     if (omega_old[k] > 0) omega_old[k] = binv*(omega_old[k] + T);
359:     else omega_old[k] = binv*(omega_old[k] - T);
360:   }
361:   omega_old[j-1] = binv*T;

363:   /* Swap omega and omega_old. */
364:   for (k=0;k<j;k++) {
365:     omega[k] = omega_old[k];
366:     omega_old[k] = omega[k];
367:   }
368:   omega[j] = eps1;
369:   PetscFunctionReturnVoid();
370: }

374: static void compute_int(PetscBool *which,PetscReal *mu,PetscInt j,PetscReal delta,PetscReal eta)
375: {
376:   PetscInt  i,k,maxpos;
377:   PetscReal max;
378:   PetscBool found;

381:   /* initialize which */
382:   found = PETSC_FALSE;
383:   maxpos = 0;
384:   max = 0.0;
385:   for (i=0;i<j;i++) {
386:     if (PetscAbsReal(mu[i]) >= delta) {
387:       which[i] = PETSC_TRUE;
388:       found = PETSC_TRUE;
389:     } else which[i] = PETSC_FALSE;
390:     if (PetscAbsReal(mu[i]) > max) {
391:       maxpos = i;
392:       max = PetscAbsReal(mu[i]);
393:     }
394:   }
395:   if (!found) which[maxpos] = PETSC_TRUE;

397:   for (i=0;i<j;i++)
398:     if (which[i]) {
399:       /* find left interval */
400:       for (k=i;k>=0;k--) {
401:         if (PetscAbsReal(mu[k])<eta || which[k]) break;
402:         else which[k] = PETSC_TRUE;
403:       }
404:       /* find right interval */
405:       for (k=i+1;k<j;k++) {
406:         if (PetscAbsReal(mu[k])<eta || which[k]) break;
407:         else which[k] = PETSC_TRUE;
408:       }
409:     }
410:   PetscFunctionReturnVoid();
411: }

415: /*
416:    EPSPartialLanczos - Partial reorthogonalization.
417: */
418: static PetscErrorCode EPSPartialLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal anorm)
419: {
420:   EPS_LANCZOS    *lanczos = (EPS_LANCZOS*)eps->data;
422:   PetscInt       i,j,m = *M;
423:   PetscReal      norm,*omega,lomega[100],*omega_old,lomega_old[100],eps1,delta,eta;
424:   PetscBool      *which,lwhich[100],*which2,lwhich2[100];
425:   PetscBool      reorth = PETSC_FALSE,force_reorth = PETSC_FALSE;
426:   PetscBool      fro = PETSC_FALSE,estimate_anorm = PETSC_FALSE;
427:   PetscScalar    *hwork,lhwork[100];

430:   if (m>100) {
431:     PetscMalloc(m*sizeof(PetscReal),&omega);
432:     PetscMalloc(m*sizeof(PetscReal),&omega_old);
433:   } else {
434:     omega = lomega;
435:     omega_old = lomega_old;
436:   }
437:   if (m > 100) {
438:     PetscMalloc(sizeof(PetscBool)*m,&which);
439:     PetscMalloc(sizeof(PetscBool)*m,&which2);
440:     PetscMalloc(m*sizeof(PetscScalar),&hwork);
441:   } else {
442:     which = lwhich;
443:     which2 = lwhich2;
444:     hwork = lhwork;
445:   }

447:   eps1 = PetscSqrtReal((PetscReal)eps->n)*PETSC_MACHINE_EPSILON/2;
448:   delta = PETSC_SQRT_MACHINE_EPSILON/PetscSqrtReal((PetscReal)eps->ncv);
449:   eta = PetscPowReal(PETSC_MACHINE_EPSILON,3.0/4.0)/PetscSqrtReal((PetscReal)eps->ncv);
450:   if (anorm < 0.0) {
451:     anorm = 1.0;
452:     estimate_anorm = PETSC_TRUE;
453:   }
454:   for (i=0;i<m-k;i++)
455:     omega[i] = omega_old[i] = 0.0;
456:   for (i=0;i<k;i++)
457:     which[i] = PETSC_TRUE;

459:   for (j=k;j<m;j++) {
460:     STApply(eps->st,V[j],f);
461:     if (fro) {
462:       /* Lanczos step with full reorthogonalization */
463:       IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,NULL,V,f,hwork,&norm,breakdown);
464:       alpha[j] = PetscRealPart(hwork[j]);
465:     } else {
466:       /* Lanczos step */
467:       which[j] = PETSC_TRUE;
468:       if (j-2>=k) which[j-2] = PETSC_FALSE;
469:       IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,which,V,f,hwork,&norm,breakdown);
470:       alpha[j] = PetscRealPart(hwork[j]);
471:       beta[j] = norm;

473:       /* Estimate ||A|| if needed */
474:       if (estimate_anorm) {
475:         if (j>k) anorm = PetscMax(anorm,PetscAbsReal(alpha[j])+norm+beta[j-1]);
476:         else anorm = PetscMax(anorm,PetscAbsReal(alpha[j])+norm);
477:       }

479:       /* Check if reorthogonalization is needed */
480:       reorth = PETSC_FALSE;
481:       if (j>k) {
482:         update_omega(omega,omega_old,j,alpha,beta-1,eps1,anorm);
483:         for (i=0;i<j-k;i++)
484:           if (PetscAbsScalar(omega[i]) > delta) reorth = PETSC_TRUE;
485:       }

487:       if (reorth || force_reorth) {
488:         if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_PERIODIC) {
489:           /* Periodic reorthogonalization */
490:           if (force_reorth) force_reorth = PETSC_FALSE;
491:           else force_reorth = PETSC_TRUE;
492:           IPOrthogonalize(eps->ip,0,NULL,j-k,NULL,V+k,f,hwork,&norm,breakdown);
493:           for (i=0;i<j-k;i++)
494:             omega[i] = eps1;
495:         } else {
496:           /* Partial reorthogonalization */
497:           if (force_reorth) force_reorth = PETSC_FALSE;
498:           else {
499:             force_reorth = PETSC_TRUE;
500:             compute_int(which2,omega,j-k,delta,eta);
501:             for (i=0;i<j-k;i++)
502:               if (which2[i]) omega[i] = eps1;
503:           }
504:           IPOrthogonalize(eps->ip,0,NULL,j-k,which2,V+k,f,hwork,&norm,breakdown);
505:         }
506:       }
507:     }

509:     if (*breakdown || norm < eps->n*anorm*PETSC_MACHINE_EPSILON) {
510:       *M = j+1;
511:       break;
512:     }
513:     if (!fro && norm*delta < anorm*eps1) {
514:       fro = PETSC_TRUE;
515:       PetscInfo1(eps,"Switching to full reorthogonalization at iteration %D\n",eps->its);
516:     }

518:     beta[j] = norm;
519:     if (j<m-1) {
520:       VecScale(f,1.0/norm);
521:       VecCopy(f,V[j+1]);
522:     }
523:   }

525:   if (m>100) {
526:     PetscFree(omega);
527:     PetscFree(omega_old);
528:     PetscFree(which);
529:     PetscFree(which2);
530:     PetscFree(hwork);
531:   }
532:   return(0);
533: }

537: /*
538:    EPSBasicLanczos - Computes an m-step Lanczos factorization. The first k
539:    columns are assumed to be locked and therefore they are not modified. On
540:    exit, the following relation is satisfied:

542:                     OP * V - V * T = f * e_m^T

544:    where the columns of V are the Lanczos vectors, T is a tridiagonal matrix,
545:    f is the residual vector and e_m is the m-th vector of the canonical basis.
546:    The Lanczos vectors (together with vector f) are B-orthogonal (to working
547:    accuracy) if full reorthogonalization is being used, otherwise they are
548:    (B-)semi-orthogonal. On exit, beta contains the B-norm of f and the next
549:    Lanczos vector can be computed as v_{m+1} = f / beta.

551:    This function simply calls another function which depends on the selected
552:    reorthogonalization strategy.
553: */
554: static PetscErrorCode EPSBasicLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *m,Vec f,PetscBool *breakdown,PetscReal anorm)
555: {
556:   EPS_LANCZOS        *lanczos = (EPS_LANCZOS*)eps->data;
557:   PetscScalar        *T;
558:   PetscInt           i,n=*m;
559:   PetscReal          betam;
560:   PetscErrorCode     ierr;
561:   IPOrthogRefineType orthog_ref;

564:   switch (lanczos->reorthog) {
565:     case EPS_LANCZOS_REORTHOG_LOCAL:
566:       EPSLocalLanczos(eps,alpha,beta,V,k,m,f,breakdown);
567:       break;
568:     case EPS_LANCZOS_REORTHOG_SELECTIVE:
569:       EPSSelectiveLanczos(eps,alpha,beta,V,k,m,f,breakdown,anorm);
570:       break;
571:     case EPS_LANCZOS_REORTHOG_FULL:
572:       EPSFullLanczos(eps,alpha,beta,V,k,m,f,breakdown);
573:       break;
574:     case EPS_LANCZOS_REORTHOG_PARTIAL:
575:     case EPS_LANCZOS_REORTHOG_PERIODIC:
576:       EPSPartialLanczos(eps,alpha,beta,V,k,m,f,breakdown,anorm);
577:       break;
578:     case EPS_LANCZOS_REORTHOG_DELAYED:
579:       PetscMalloc(n*n*sizeof(PetscScalar),&T);
580:       IPGetOrthogonalization(eps->ip,NULL,&orthog_ref,NULL);
581:       if (orthog_ref == IP_ORTHOG_REFINE_NEVER) {
582:         EPSDelayedArnoldi1(eps,T,n,V,k,m,f,&betam,breakdown);
583:       } else {
584:         EPSDelayedArnoldi(eps,T,n,V,k,m,f,&betam,breakdown);
585:       }
586:       for (i=k;i<n-1;i++) {
587:         alpha[i] = PetscRealPart(T[n*i+i]);
588:         beta[i] = PetscRealPart(T[n*i+i+1]);
589:       }
590:       alpha[n-1] = PetscRealPart(T[n*(n-1)+n-1]);
591:       beta[n-1] = betam;
592:       PetscFree(T);
593:       break;
594:     default:
595:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid reorthogonalization type");
596:   }
597:   return(0);
598: }

602: PetscErrorCode EPSSolve_Lanczos(EPS eps)
603: {
604:   EPS_LANCZOS    *lanczos = (EPS_LANCZOS*)eps->data;
606:   PetscInt       nconv,i,j,k,l,x,n,*perm,restart,ncv=eps->ncv,r,ld;
607:   Vec            w=eps->work[1],f=eps->work[0];
608:   PetscScalar    *Y,*ritz,stmp;
609:   PetscReal      *d,*e,*bnd,anorm,beta,norm,rtmp,resnorm;
610:   PetscBool      breakdown;
611:   char           *conv,ctmp;

614:   DSGetLeadingDimension(eps->ds,&ld);
615:   PetscMalloc(ncv*sizeof(PetscScalar),&ritz);
616:   PetscMalloc(ncv*sizeof(PetscReal),&bnd);
617:   PetscMalloc(ncv*sizeof(PetscInt),&perm);
618:   PetscMalloc(ncv*sizeof(char),&conv);

620:   /* The first Lanczos vector is the normalized initial vector */
621:   EPSGetStartVector(eps,0,eps->V[0],NULL);

623:   anorm = -1.0;
624:   nconv = 0;

626:   /* Restart loop */
627:   while (eps->reason == EPS_CONVERGED_ITERATING) {
628:     eps->its++;

630:     /* Compute an ncv-step Lanczos factorization */
631:     n = PetscMin(nconv+eps->mpd,ncv);
632:     DSGetArrayReal(eps->ds,DS_MAT_T,&d);
633:     e = d + ld;
634:     EPSBasicLanczos(eps,d,e,eps->V,nconv,&n,f,&breakdown,anorm);
635:     beta = e[n-1];
636:     DSRestoreArrayReal(eps->ds,DS_MAT_T,&d);
637:     DSSetDimensions(eps->ds,n,0,nconv,0);
638:     DSSetState(eps->ds,DS_STATE_INTERMEDIATE);

640:     /* Solve projected problem */
641:     DSSolve(eps->ds,ritz,NULL);
642:     DSSort(eps->ds,ritz,NULL,NULL,NULL,NULL);

644:     /* Estimate ||A|| */
645:     for (i=nconv;i<n;i++)
646:       anorm = PetscMax(anorm,PetscAbsReal(PetscRealPart(ritz[i])));

648:     /* Compute residual norm estimates as beta*abs(Y(m,:)) + eps*||A|| */
649:     DSGetArray(eps->ds,DS_MAT_Q,&Y);
650:     for (i=nconv;i<n;i++) {
651:       resnorm = beta*PetscAbsScalar(Y[n-1+i*ld]) + PETSC_MACHINE_EPSILON*anorm;
652:       (*eps->converged)(eps,ritz[i],eps->eigi[i],resnorm,&bnd[i],eps->convergedctx);
653:       if (bnd[i]<eps->tol) conv[i] = 'C';
654:       else conv[i] = 'N';
655:     }
656:     DSRestoreArray(eps->ds,DS_MAT_Q,&Y);

658:     /* purge repeated ritz values */
659:     if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL)
660:       for (i=nconv+1;i<n;i++)
661:         if (conv[i] == 'C')
662:           if (PetscAbsScalar((ritz[i]-ritz[i-1])/ritz[i]) < eps->tol)
663:             conv[i] = 'R';

665:     /* Compute restart vector */
666:     if (breakdown) {
667:       PetscInfo2(eps,"Breakdown in Lanczos method (it=%D norm=%G)\n",eps->its,beta);
668:     } else {
669:       restart = nconv;
670:       while (restart<n && conv[restart] != 'N') restart++;
671:       if (restart >= n) {
672:         breakdown = PETSC_TRUE;
673:       } else {
674:         for (i=restart+1;i<n;i++)
675:           if (conv[i] == 'N') {
676:             (*eps->comparison)(ritz[restart],0.0,ritz[i],0.0,&r,eps->comparisonctx);
677:             if (r>0) restart = i;
678:           }
679:         DSGetArray(eps->ds,DS_MAT_Q,&Y);
680:         SlepcVecMAXPBY(f,0.0,1.0,n-nconv,Y+restart*ld+nconv,eps->V+nconv);
681:         DSRestoreArray(eps->ds,DS_MAT_Q,&Y);
682:       }
683:     }

685:     /* Count and put converged eigenvalues first */
686:     for (i=nconv;i<n;i++) perm[i] = i;
687:     for (k=nconv;k<n;k++)
688:       if (conv[perm[k]] != 'C') {
689:         j = k + 1;
690:         while (j<n && conv[perm[j]] != 'C') j++;
691:         if (j>=n) break;
692:         l = perm[k]; perm[k] = perm[j]; perm[j] = l;
693:       }

695:     /* Sort eigenvectors according to permutation */
696:     DSGetArray(eps->ds,DS_MAT_Q,&Y);
697:     for (i=nconv;i<k;i++) {
698:       x = perm[i];
699:       if (x != i) {
700:         j = i + 1;
701:         while (perm[j] != i) j++;
702:         /* swap eigenvalues i and j */
703:         stmp = ritz[x]; ritz[x] = ritz[i]; ritz[i] = stmp;
704:         rtmp = bnd[x]; bnd[x] = bnd[i]; bnd[i] = rtmp;
705:         ctmp = conv[x]; conv[x] = conv[i]; conv[i] = ctmp;
706:         perm[j] = x; perm[i] = i;
707:         /* swap eigenvectors i and j */
708:         for (l=0;l<n;l++) {
709:           stmp = Y[l+x*ld]; Y[l+x*ld] = Y[l+i*ld]; Y[l+i*ld] = stmp;
710:         }
711:       }
712:     }

714:     /* compute converged eigenvectors */
715:     SlepcUpdateVectors(n,eps->V,nconv,k,Y,ld,PETSC_FALSE);
716:     DSRestoreArray(eps->ds,DS_MAT_Q,&Y);

718:     /* purge spurious ritz values */
719:     if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL) {
720:       for (i=nconv;i<k;i++) {
721:         VecNorm(eps->V[i],NORM_2,&norm);
722:         VecScale(eps->V[i],1.0/norm);
723:         STApply(eps->st,eps->V[i],w);
724:         VecAXPY(w,-ritz[i],eps->V[i]);
725:         VecNorm(w,NORM_2,&norm);
726:         (*eps->converged)(eps,ritz[i],eps->eigi[i],norm,&bnd[i],eps->convergedctx);
727:         if (bnd[i]>=eps->tol) conv[i] = 'S';
728:       }
729:       for (i=nconv;i<k;i++)
730:         if (conv[i] != 'C') {
731:           j = i + 1;
732:           while (j<k && conv[j] != 'C') j++;
733:           if (j>=k) break;
734:           /* swap eigenvalues i and j */
735:           stmp = ritz[j]; ritz[j] = ritz[i]; ritz[i] = stmp;
736:           rtmp = bnd[j]; bnd[j] = bnd[i]; bnd[i] = rtmp;
737:           ctmp = conv[j]; conv[j] = conv[i]; conv[i] = ctmp;
738:           /* swap eigenvectors i and j */
739:           VecSwap(eps->V[i],eps->V[j]);
740:         }
741:       k = i;
742:     }

744:     /* store ritz values and estimated errors */
745:     for (i=nconv;i<n;i++) {
746:       eps->eigr[i] = ritz[i];
747:       eps->errest[i] = bnd[i];
748:     }
749:     EPSMonitor(eps,eps->its,nconv,eps->eigr,eps->eigi,eps->errest,n);
750:     nconv = k;
751:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
752:     if (nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL;

754:     if (eps->reason == EPS_CONVERGED_ITERATING) { /* copy restart vector */
755:       if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL && !breakdown) {
756:         /* Reorthonormalize restart vector */
757:         IPOrthogonalize(eps->ip,eps->nds,eps->defl,nconv,NULL,eps->V,f,NULL,&norm,&breakdown);
758:         VecScale(f,1.0/norm);
759:       }
760:       if (breakdown) {
761:         /* Use random vector for restarting */
762:         PetscInfo(eps,"Using random vector for restart\n");
763:         EPSGetStartVector(eps,nconv,f,&breakdown);
764:       }
765:       if (breakdown) { /* give up */
766:         eps->reason = EPS_DIVERGED_BREAKDOWN;
767:         PetscInfo(eps,"Unable to generate more start vectors\n");
768:       } else {
769:         VecCopy(f,eps->V[nconv]);
770:       }
771:     }
772:   }

774:   eps->nconv = nconv;

776:   PetscFree(ritz);
777:   PetscFree(bnd);
778:   PetscFree(perm);
779:   PetscFree(conv);
780:   return(0);
781: }

785: PetscErrorCode EPSSetFromOptions_Lanczos(EPS eps)
786: {
787:   PetscErrorCode         ierr;
788:   EPS_LANCZOS            *lanczos = (EPS_LANCZOS*)eps->data;
789:   PetscBool              flg;
790:   EPSLanczosReorthogType reorthog;

793:   PetscOptionsHead("EPS Lanczos Options");
794:   PetscOptionsEnum("-eps_lanczos_reorthog","Lanczos reorthogonalization","EPSLanczosSetReorthog",EPSLanczosReorthogTypes,(PetscEnum)lanczos->reorthog,(PetscEnum*)&reorthog,&flg);
795:   if (flg) {
796:     EPSLanczosSetReorthog(eps,reorthog);
797:   }
798:   PetscOptionsTail();
799:   return(0);
800: }

804: static PetscErrorCode EPSLanczosSetReorthog_Lanczos(EPS eps,EPSLanczosReorthogType reorthog)
805: {
806:   EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data;

809:   switch (reorthog) {
810:     case EPS_LANCZOS_REORTHOG_LOCAL:
811:     case EPS_LANCZOS_REORTHOG_FULL:
812:     case EPS_LANCZOS_REORTHOG_DELAYED:
813:     case EPS_LANCZOS_REORTHOG_SELECTIVE:
814:     case EPS_LANCZOS_REORTHOG_PERIODIC:
815:     case EPS_LANCZOS_REORTHOG_PARTIAL:
816:       lanczos->reorthog = reorthog;
817:       break;
818:     default:
819:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid reorthogonalization type");
820:   }
821:   return(0);
822: }

826: /*@
827:    EPSLanczosSetReorthog - Sets the type of reorthogonalization used during the Lanczos
828:    iteration.

830:    Logically Collective on EPS

832:    Input Parameters:
833: +  eps - the eigenproblem solver context
834: -  reorthog - the type of reorthogonalization

836:    Options Database Key:
837: .  -eps_lanczos_reorthog - Sets the reorthogonalization type (either 'local', 'selective',
838:                          'periodic', 'partial', 'full' or 'delayed')

840:    Level: advanced

842: .seealso: EPSLanczosGetReorthog(), EPSLanczosReorthogType
843: @*/
844: PetscErrorCode EPSLanczosSetReorthog(EPS eps,EPSLanczosReorthogType reorthog)
845: {

851:   PetscTryMethod(eps,"EPSLanczosSetReorthog_C",(EPS,EPSLanczosReorthogType),(eps,reorthog));
852:   return(0);
853: }

857: static PetscErrorCode EPSLanczosGetReorthog_Lanczos(EPS eps,EPSLanczosReorthogType *reorthog)
858: {
859:   EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data;

862:   *reorthog = lanczos->reorthog;
863:   return(0);
864: }

868: /*@C
869:    EPSLanczosGetReorthog - Gets the type of reorthogonalization used during the Lanczos
870:    iteration.

872:    Not Collective

874:    Input Parameter:
875: .  eps - the eigenproblem solver context

877:    Output Parameter:
878: .  reorthog - the type of reorthogonalization

880:    Level: advanced

882: .seealso: EPSLanczosSetReorthog(), EPSLanczosReorthogType
883: @*/
884: PetscErrorCode EPSLanczosGetReorthog(EPS eps,EPSLanczosReorthogType *reorthog)
885: {

891:   PetscTryMethod(eps,"EPSLanczosGetReorthog_C",(EPS,EPSLanczosReorthogType*),(eps,reorthog));
892:   return(0);
893: }

897: PetscErrorCode EPSReset_Lanczos(EPS eps)
898: {
900:   EPS_LANCZOS    *lanczos = (EPS_LANCZOS*)eps->data;

903:   VecDestroyVecs(eps->ncv,&lanczos->AV);
904:   EPSReset_Default(eps);
905:   return(0);
906: }

910: PetscErrorCode EPSDestroy_Lanczos(EPS eps)
911: {

915:   PetscFree(eps->data);
916:   PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosSetReorthog_C",NULL);
917:   PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosGetReorthog_C",NULL);
918:   return(0);
919: }

923: PetscErrorCode EPSView_Lanczos(EPS eps,PetscViewer viewer)
924: {
926:   EPS_LANCZOS    *lanczos = (EPS_LANCZOS*)eps->data;
927:   PetscBool      isascii;

930:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
931:   if (isascii) {
932:     PetscViewerASCIIPrintf(viewer,"  Lanczos: %s reorthogonalization\n",EPSLanczosReorthogTypes[lanczos->reorthog]);
933:   }
934:   return(0);
935: }

939: PETSC_EXTERN PetscErrorCode EPSCreate_Lanczos(EPS eps)
940: {

944:   PetscNewLog(eps,EPS_LANCZOS,&eps->data);
945:   eps->ops->setup                = EPSSetUp_Lanczos;
946:   eps->ops->setfromoptions       = EPSSetFromOptions_Lanczos;
947:   eps->ops->destroy              = EPSDestroy_Lanczos;
948:   eps->ops->reset                = EPSReset_Lanczos;
949:   eps->ops->view                 = EPSView_Lanczos;
950:   eps->ops->backtransform        = EPSBackTransform_Default;
951:   eps->ops->computevectors       = EPSComputeVectors_Hermitian;
952:   PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosSetReorthog_C",EPSLanczosSetReorthog_Lanczos);
953:   PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosGetReorthog_C",EPSLanczosGetReorthog_Lanczos);
954:   return(0);
955: }

slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/lanczos.c0000644000175000017500000010105012211062077022746 0ustar gladkgladk/* SLEPc eigensolver: "lanczos" Method: Explicitly Restarted Symmetric/Hermitian Lanczos Algorithm: Lanczos method for symmetric (Hermitian) problems, with explicit restart and deflation. Several reorthogonalization strategies can be selected. References: [1] "Lanczos Methods in SLEPc", SLEPc Technical Report STR-5, available at http://www.grycap.upv.es/slepc. Last update: Feb 2009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_Lanczos(EPS); typedef struct { EPSLanczosReorthogType reorthog; Vec *AV; } EPS_LANCZOS; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_Lanczos" PetscErrorCode EPSSetUp_Lanczos(EPS eps) { EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscErrorCode ierr; PetscFunctionBegin; if (eps->ncv) { /* ncv set */ if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev"); } else if (eps->mpd) { /* mpd set */ eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15)); else { eps->mpd = 500; eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } } if (!eps->mpd) eps->mpd = eps->ncv; if (eps->ncv>eps->nev+eps->mpd) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must not be larger than nev+mpd"); if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv); if (!eps->which) { ierr = EPSSetWhichEigenpairs_Default(eps);CHKERRQ(ierr); } switch (eps->which) { case EPS_LARGEST_IMAGINARY: case EPS_SMALLEST_IMAGINARY: case EPS_TARGET_IMAGINARY: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); default: ; /* default case to remove warning */ } if (!eps->extraction) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_SELECTIVE) { ierr = VecDuplicateVecs(eps->t,eps->ncv,&lanczos->AV);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,eps->ncv,lanczos->AV);CHKERRQ(ierr); } ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); ierr = DSSetCompact(eps->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSAllocate(eps->ds,eps->ncv);CHKERRQ(ierr); if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL) { ierr = EPSSetWorkVecs(eps,2);CHKERRQ(ierr); } else { ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); } /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems"); if (eps->isgeneralized && eps->ishermitian && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method does not work for indefinite problems"); eps->ops->solve = EPSSolve_Lanczos; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSLocalLanczos" /* EPSLocalLanczos - Local reorthogonalization. This is the simplest variant. At each Lanczos step, the corresponding Lanczos vector is orthogonalized with respect to the two previous Lanczos vectors, according to the three term Lanczos recurrence. WARNING: This variant does not track the loss of orthogonality that occurs in finite-precision arithmetic and, therefore, the generated vectors are not guaranteed to be (semi-)orthogonal. */ static PetscErrorCode EPSLocalLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown) { PetscErrorCode ierr; PetscInt i,j,m = *M; PetscReal norm; PetscBool *which,lwhich[100]; PetscScalar *hwork,lhwork[100]; PetscFunctionBegin; if (m > 100) { ierr = PetscMalloc(sizeof(PetscBool)*m,&which);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscScalar),&hwork);CHKERRQ(ierr); } else { which = lwhich; hwork = lhwork; } for (i=0;ist,V[j],V[j+1]);CHKERRQ(ierr); which[j] = PETSC_TRUE; if (j-2>=k) which[j-2] = PETSC_FALSE; ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,which,V,V[j+1],hwork,&norm,breakdown);CHKERRQ(ierr); alpha[j] = PetscRealPart(hwork[j]); beta[j] = norm; if (*breakdown) { *M = j+1; if (m > 100) { ierr = PetscFree(which);CHKERRQ(ierr); ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } else { ierr = VecScale(V[j+1],1.0/norm);CHKERRQ(ierr); } } ierr = STApply(eps->st,V[m-1],f);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,m,NULL,V,f,hwork,&norm,NULL);CHKERRQ(ierr); alpha[m-1] = PetscRealPart(hwork[m-1]); beta[m-1] = norm; if (m > 100) { ierr = PetscFree(which);CHKERRQ(ierr); ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DenseTridiagonal" /* DenseTridiagonal - Solves a real tridiagonal Hermitian Eigenvalue Problem. Input Parameters: + n - dimension of the eigenproblem . D - pointer to the array containing the diagonal elements - E - pointer to the array containing the off-diagonal elements Output Parameters: + w - pointer to the array to store the computed eigenvalues - V - pointer to the array to store the eigenvectors Notes: If V is NULL then the eigenvectors are not computed. This routine use LAPACK routines xSTEVR. */ static PetscErrorCode DenseTridiagonal(PetscInt n_,PetscReal *D,PetscReal *E,PetscReal *w,PetscScalar *V) { #if defined(SLEPC_MISSING_LAPACK_STEVR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"STEVR - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscReal abstol = 0.0,vl,vu,*work; PetscBLASInt il,iu,m,*isuppz,n,lwork,*iwork,liwork,info; const char *jobz; #if defined(PETSC_USE_COMPLEX) PetscInt i,j; PetscReal *VV; #endif PetscFunctionBegin; ierr = PetscBLASIntCast(n_,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(20*n_,&lwork);CHKERRQ(ierr); ierr = PetscBLASIntCast(10*n_,&liwork);CHKERRQ(ierr); if (V) { jobz = "V"; #if defined(PETSC_USE_COMPLEX) ierr = PetscMalloc(n*n*sizeof(PetscReal),&VV);CHKERRQ(ierr); #endif } else jobz = "N"; ierr = PetscMalloc(2*n*sizeof(PetscBLASInt),&isuppz);CHKERRQ(ierr); ierr = PetscMalloc(lwork*sizeof(PetscReal),&work);CHKERRQ(ierr); ierr = PetscMalloc(liwork*sizeof(PetscBLASInt),&iwork);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_(jobz,"A",&n,D,E,&vl,&vu,&il,&iu,&abstol,&m,w,VV,&n,isuppz,work,&lwork,iwork,&liwork,&info)); #else PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_(jobz,"A",&n,D,E,&vl,&vu,&il,&iu,&abstol,&m,w,V,&n,isuppz,work,&lwork,iwork,&liwork,&info)); #endif ierr = PetscFPTrapPop();CHKERRQ(ierr); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DSTEVR %d",info); #if defined(PETSC_USE_COMPLEX) if (V) { for (i=0;idata; PetscInt i,j,m = *M,n,nritz=0,nritzo; PetscReal *d,*e,*ritz,norm; PetscScalar *Y,*hwork,lhwork[100]; PetscBool *which,lwhich[100]; PetscFunctionBegin; ierr = PetscMalloc(m*sizeof(PetscReal),&d);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscReal),&e);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscReal),&ritz);CHKERRQ(ierr); ierr = PetscMalloc(m*m*sizeof(PetscScalar),&Y);CHKERRQ(ierr); if (m > 100) { ierr = PetscMalloc(sizeof(PetscBool)*m,&which);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscScalar),&hwork);CHKERRQ(ierr); } else { which = lwhich; hwork = lhwork; } for (i=0;ist,V[j],f);CHKERRQ(ierr); which[j] = PETSC_TRUE; if (j-2>=k) which[j-2] = PETSC_FALSE; ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,which,V,f,hwork,&norm,breakdown);CHKERRQ(ierr); alpha[j] = PetscRealPart(hwork[j]); beta[j] = norm; if (*breakdown) { *M = j+1; break; } /* Compute eigenvalues and eigenvectors Y of the tridiagonal block */ n = j-k+1; for (i=0;i anorm) anorm = PetscAbsReal(ritz[i]); /* Compute nearly converged Ritz vectors */ nritzo = 0; for (i=0;inritz) { nritz = 0; for (i=0;iAV[nritz],0.0,1.0,n,Y+i*n,V+k);CHKERRQ(ierr); nritz++; } } } if (nritz > 0) { ierr = IPOrthogonalize(eps->ip,0,NULL,nritz,NULL,lanczos->AV,f,hwork,&norm,breakdown);CHKERRQ(ierr); if (*breakdown) { *M = j+1; break; } } if (j 100) { ierr = PetscFree(which);CHKERRQ(ierr); ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "update_omega" static void update_omega(PetscReal *omega,PetscReal *omega_old,PetscInt j,PetscReal *alpha,PetscReal *beta,PetscReal eps1,PetscReal anorm) { PetscInt k; PetscReal T,binv; PetscFunctionBegin; /* Estimate of contribution to roundoff errors from A*v fl(A*v) = A*v + f, where ||f|| \approx eps1*||A||. For a full matrix A, a rule-of-thumb estimate is eps1 = sqrt(n)*eps. */ T = eps1*anorm; binv = 1.0/beta[j+1]; /* Update omega(1) using omega(0)==0. */ omega_old[0]= beta[1]*omega[1] + (alpha[0]-alpha[j])*omega[0] - beta[j]*omega_old[0]; if (omega_old[0] > 0) omega_old[0] = binv*(omega_old[0] + T); else omega_old[0] = binv*(omega_old[0] - T); /* Update remaining components. */ for (k=1;k 0) omega_old[k] = binv*(omega_old[k] + T); else omega_old[k] = binv*(omega_old[k] - T); } omega_old[j-1] = binv*T; /* Swap omega and omega_old. */ for (k=0;k= delta) { which[i] = PETSC_TRUE; found = PETSC_TRUE; } else which[i] = PETSC_FALSE; if (PetscAbsReal(mu[i]) > max) { maxpos = i; max = PetscAbsReal(mu[i]); } } if (!found) which[maxpos] = PETSC_TRUE; for (i=0;i=0;k--) { if (PetscAbsReal(mu[k])data; PetscErrorCode ierr; PetscInt i,j,m = *M; PetscReal norm,*omega,lomega[100],*omega_old,lomega_old[100],eps1,delta,eta; PetscBool *which,lwhich[100],*which2,lwhich2[100]; PetscBool reorth = PETSC_FALSE,force_reorth = PETSC_FALSE; PetscBool fro = PETSC_FALSE,estimate_anorm = PETSC_FALSE; PetscScalar *hwork,lhwork[100]; PetscFunctionBegin; if (m>100) { ierr = PetscMalloc(m*sizeof(PetscReal),&omega);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscReal),&omega_old);CHKERRQ(ierr); } else { omega = lomega; omega_old = lomega_old; } if (m > 100) { ierr = PetscMalloc(sizeof(PetscBool)*m,&which);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscBool)*m,&which2);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscScalar),&hwork);CHKERRQ(ierr); } else { which = lwhich; which2 = lwhich2; hwork = lhwork; } eps1 = PetscSqrtReal((PetscReal)eps->n)*PETSC_MACHINE_EPSILON/2; delta = PETSC_SQRT_MACHINE_EPSILON/PetscSqrtReal((PetscReal)eps->ncv); eta = PetscPowReal(PETSC_MACHINE_EPSILON,3.0/4.0)/PetscSqrtReal((PetscReal)eps->ncv); if (anorm < 0.0) { anorm = 1.0; estimate_anorm = PETSC_TRUE; } for (i=0;ist,V[j],f);CHKERRQ(ierr); if (fro) { /* Lanczos step with full reorthogonalization */ ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,NULL,V,f,hwork,&norm,breakdown);CHKERRQ(ierr); alpha[j] = PetscRealPart(hwork[j]); } else { /* Lanczos step */ which[j] = PETSC_TRUE; if (j-2>=k) which[j-2] = PETSC_FALSE; ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,j+1,which,V,f,hwork,&norm,breakdown);CHKERRQ(ierr); alpha[j] = PetscRealPart(hwork[j]); beta[j] = norm; /* Estimate ||A|| if needed */ if (estimate_anorm) { if (j>k) anorm = PetscMax(anorm,PetscAbsReal(alpha[j])+norm+beta[j-1]); else anorm = PetscMax(anorm,PetscAbsReal(alpha[j])+norm); } /* Check if reorthogonalization is needed */ reorth = PETSC_FALSE; if (j>k) { update_omega(omega,omega_old,j,alpha,beta-1,eps1,anorm); for (i=0;i delta) reorth = PETSC_TRUE; } if (reorth || force_reorth) { if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_PERIODIC) { /* Periodic reorthogonalization */ if (force_reorth) force_reorth = PETSC_FALSE; else force_reorth = PETSC_TRUE; ierr = IPOrthogonalize(eps->ip,0,NULL,j-k,NULL,V+k,f,hwork,&norm,breakdown);CHKERRQ(ierr); for (i=0;iip,0,NULL,j-k,which2,V+k,f,hwork,&norm,breakdown);CHKERRQ(ierr); } } } if (*breakdown || norm < eps->n*anorm*PETSC_MACHINE_EPSILON) { *M = j+1; break; } if (!fro && norm*delta < anorm*eps1) { fro = PETSC_TRUE; ierr = PetscInfo1(eps,"Switching to full reorthogonalization at iteration %D\n",eps->its);CHKERRQ(ierr); } beta[j] = norm; if (j100) { ierr = PetscFree(omega);CHKERRQ(ierr); ierr = PetscFree(omega_old);CHKERRQ(ierr); ierr = PetscFree(which);CHKERRQ(ierr); ierr = PetscFree(which2);CHKERRQ(ierr); ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBasicLanczos" /* EPSBasicLanczos - Computes an m-step Lanczos factorization. The first k columns are assumed to be locked and therefore they are not modified. On exit, the following relation is satisfied: OP * V - V * T = f * e_m^T where the columns of V are the Lanczos vectors, T is a tridiagonal matrix, f is the residual vector and e_m is the m-th vector of the canonical basis. The Lanczos vectors (together with vector f) are B-orthogonal (to working accuracy) if full reorthogonalization is being used, otherwise they are (B-)semi-orthogonal. On exit, beta contains the B-norm of f and the next Lanczos vector can be computed as v_{m+1} = f / beta. This function simply calls another function which depends on the selected reorthogonalization strategy. */ static PetscErrorCode EPSBasicLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *m,Vec f,PetscBool *breakdown,PetscReal anorm) { EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscScalar *T; PetscInt i,n=*m; PetscReal betam; PetscErrorCode ierr; IPOrthogRefineType orthog_ref; PetscFunctionBegin; switch (lanczos->reorthog) { case EPS_LANCZOS_REORTHOG_LOCAL: ierr = EPSLocalLanczos(eps,alpha,beta,V,k,m,f,breakdown);CHKERRQ(ierr); break; case EPS_LANCZOS_REORTHOG_SELECTIVE: ierr = EPSSelectiveLanczos(eps,alpha,beta,V,k,m,f,breakdown,anorm);CHKERRQ(ierr); break; case EPS_LANCZOS_REORTHOG_FULL: ierr = EPSFullLanczos(eps,alpha,beta,V,k,m,f,breakdown);CHKERRQ(ierr); break; case EPS_LANCZOS_REORTHOG_PARTIAL: case EPS_LANCZOS_REORTHOG_PERIODIC: ierr = EPSPartialLanczos(eps,alpha,beta,V,k,m,f,breakdown,anorm);CHKERRQ(ierr); break; case EPS_LANCZOS_REORTHOG_DELAYED: ierr = PetscMalloc(n*n*sizeof(PetscScalar),&T);CHKERRQ(ierr); ierr = IPGetOrthogonalization(eps->ip,NULL,&orthog_ref,NULL);CHKERRQ(ierr); if (orthog_ref == IP_ORTHOG_REFINE_NEVER) { ierr = EPSDelayedArnoldi1(eps,T,n,V,k,m,f,&betam,breakdown);CHKERRQ(ierr); } else { ierr = EPSDelayedArnoldi(eps,T,n,V,k,m,f,&betam,breakdown);CHKERRQ(ierr); } for (i=k;idata; PetscErrorCode ierr; PetscInt nconv,i,j,k,l,x,n,*perm,restart,ncv=eps->ncv,r,ld; Vec w=eps->work[1],f=eps->work[0]; PetscScalar *Y,*ritz,stmp; PetscReal *d,*e,*bnd,anorm,beta,norm,rtmp,resnorm; PetscBool breakdown; char *conv,ctmp; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = PetscMalloc(ncv*sizeof(PetscScalar),&ritz);CHKERRQ(ierr); ierr = PetscMalloc(ncv*sizeof(PetscReal),&bnd);CHKERRQ(ierr); ierr = PetscMalloc(ncv*sizeof(PetscInt),&perm);CHKERRQ(ierr); ierr = PetscMalloc(ncv*sizeof(char),&conv);CHKERRQ(ierr); /* The first Lanczos vector is the normalized initial vector */ ierr = EPSGetStartVector(eps,0,eps->V[0],NULL);CHKERRQ(ierr); anorm = -1.0; nconv = 0; /* Restart loop */ while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; /* Compute an ncv-step Lanczos factorization */ n = PetscMin(nconv+eps->mpd,ncv); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&d);CHKERRQ(ierr); e = d + ld; ierr = EPSBasicLanczos(eps,d,e,eps->V,nconv,&n,f,&breakdown,anorm);CHKERRQ(ierr); beta = e[n-1]; ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&d);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,n,0,nconv,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); /* Solve projected problem */ ierr = DSSolve(eps->ds,ritz,NULL);CHKERRQ(ierr); ierr = DSSort(eps->ds,ritz,NULL,NULL,NULL,NULL);CHKERRQ(ierr); /* Estimate ||A|| */ for (i=nconv;ids,DS_MAT_Q,&Y);CHKERRQ(ierr); for (i=nconv;iconverged)(eps,ritz[i],eps->eigi[i],resnorm,&bnd[i],eps->convergedctx);CHKERRQ(ierr); if (bnd[i]tol) conv[i] = 'C'; else conv[i] = 'N'; } ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); /* purge repeated ritz values */ if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL) for (i=nconv+1;itol) conv[i] = 'R'; /* Compute restart vector */ if (breakdown) { ierr = PetscInfo2(eps,"Breakdown in Lanczos method (it=%D norm=%G)\n",eps->its,beta);CHKERRQ(ierr); } else { restart = nconv; while (restart= n) { breakdown = PETSC_TRUE; } else { for (i=restart+1;icomparison)(ritz[restart],0.0,ritz[i],0.0,&r,eps->comparisonctx);CHKERRQ(ierr); if (r>0) restart = i; } ierr = DSGetArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); ierr = SlepcVecMAXPBY(f,0.0,1.0,n-nconv,Y+restart*ld+nconv,eps->V+nconv);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); } } /* Count and put converged eigenvalues first */ for (i=nconv;i=n) break; l = perm[k]; perm[k] = perm[j]; perm[j] = l; } /* Sort eigenvectors according to permutation */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); for (i=nconv;iV,nconv,k,Y,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); /* purge spurious ritz values */ if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL) { for (i=nconv;iV[i],NORM_2,&norm);CHKERRQ(ierr); ierr = VecScale(eps->V[i],1.0/norm);CHKERRQ(ierr); ierr = STApply(eps->st,eps->V[i],w);CHKERRQ(ierr); ierr = VecAXPY(w,-ritz[i],eps->V[i]);CHKERRQ(ierr); ierr = VecNorm(w,NORM_2,&norm);CHKERRQ(ierr); ierr = (*eps->converged)(eps,ritz[i],eps->eigi[i],norm,&bnd[i],eps->convergedctx);CHKERRQ(ierr); if (bnd[i]>=eps->tol) conv[i] = 'S'; } for (i=nconv;i=k) break; /* swap eigenvalues i and j */ stmp = ritz[j]; ritz[j] = ritz[i]; ritz[i] = stmp; rtmp = bnd[j]; bnd[j] = bnd[i]; bnd[i] = rtmp; ctmp = conv[j]; conv[j] = conv[i]; conv[i] = ctmp; /* swap eigenvectors i and j */ ierr = VecSwap(eps->V[i],eps->V[j]);CHKERRQ(ierr); } k = i; } /* store ritz values and estimated errors */ for (i=nconv;ieigr[i] = ritz[i]; eps->errest[i] = bnd[i]; } ierr = EPSMonitor(eps,eps->its,nconv,eps->eigr,eps->eigi,eps->errest,n);CHKERRQ(ierr); nconv = k; if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL; if (eps->reason == EPS_CONVERGED_ITERATING) { /* copy restart vector */ if (lanczos->reorthog == EPS_LANCZOS_REORTHOG_LOCAL && !breakdown) { /* Reorthonormalize restart vector */ ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,nconv,NULL,eps->V,f,NULL,&norm,&breakdown);CHKERRQ(ierr); ierr = VecScale(f,1.0/norm);CHKERRQ(ierr); } if (breakdown) { /* Use random vector for restarting */ ierr = PetscInfo(eps,"Using random vector for restart\n");CHKERRQ(ierr); ierr = EPSGetStartVector(eps,nconv,f,&breakdown);CHKERRQ(ierr); } if (breakdown) { /* give up */ eps->reason = EPS_DIVERGED_BREAKDOWN; ierr = PetscInfo(eps,"Unable to generate more start vectors\n");CHKERRQ(ierr); } else { ierr = VecCopy(f,eps->V[nconv]);CHKERRQ(ierr); } } } eps->nconv = nconv; ierr = PetscFree(ritz);CHKERRQ(ierr); ierr = PetscFree(bnd);CHKERRQ(ierr); ierr = PetscFree(perm);CHKERRQ(ierr); ierr = PetscFree(conv);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_Lanczos" PetscErrorCode EPSSetFromOptions_Lanczos(EPS eps) { PetscErrorCode ierr; EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscBool flg; EPSLanczosReorthogType reorthog; PetscFunctionBegin; ierr = PetscOptionsHead("EPS Lanczos Options");CHKERRQ(ierr); ierr = PetscOptionsEnum("-eps_lanczos_reorthog","Lanczos reorthogonalization","EPSLanczosSetReorthog",EPSLanczosReorthogTypes,(PetscEnum)lanczos->reorthog,(PetscEnum*)&reorthog,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSLanczosSetReorthog(eps,reorthog);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSLanczosSetReorthog_Lanczos" static PetscErrorCode EPSLanczosSetReorthog_Lanczos(EPS eps,EPSLanczosReorthogType reorthog) { EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscFunctionBegin; switch (reorthog) { case EPS_LANCZOS_REORTHOG_LOCAL: case EPS_LANCZOS_REORTHOG_FULL: case EPS_LANCZOS_REORTHOG_DELAYED: case EPS_LANCZOS_REORTHOG_SELECTIVE: case EPS_LANCZOS_REORTHOG_PERIODIC: case EPS_LANCZOS_REORTHOG_PARTIAL: lanczos->reorthog = reorthog; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid reorthogonalization type"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSLanczosSetReorthog" /*@ EPSLanczosSetReorthog - Sets the type of reorthogonalization used during the Lanczos iteration. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - reorthog - the type of reorthogonalization Options Database Key: . -eps_lanczos_reorthog - Sets the reorthogonalization type (either 'local', 'selective', 'periodic', 'partial', 'full' or 'delayed') Level: advanced .seealso: EPSLanczosGetReorthog(), EPSLanczosReorthogType @*/ PetscErrorCode EPSLanczosSetReorthog(EPS eps,EPSLanczosReorthogType reorthog) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,reorthog,2); ierr = PetscTryMethod(eps,"EPSLanczosSetReorthog_C",(EPS,EPSLanczosReorthogType),(eps,reorthog));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSLanczosGetReorthog_Lanczos" static PetscErrorCode EPSLanczosGetReorthog_Lanczos(EPS eps,EPSLanczosReorthogType *reorthog) { EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscFunctionBegin; *reorthog = lanczos->reorthog; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSLanczosGetReorthog" /*@C EPSLanczosGetReorthog - Gets the type of reorthogonalization used during the Lanczos iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . reorthog - the type of reorthogonalization Level: advanced .seealso: EPSLanczosSetReorthog(), EPSLanczosReorthogType @*/ PetscErrorCode EPSLanczosGetReorthog(EPS eps,EPSLanczosReorthogType *reorthog) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(reorthog,2); ierr = PetscTryMethod(eps,"EPSLanczosGetReorthog_C",(EPS,EPSLanczosReorthogType*),(eps,reorthog));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_Lanczos" PetscErrorCode EPSReset_Lanczos(EPS eps) { PetscErrorCode ierr; EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscFunctionBegin; ierr = VecDestroyVecs(eps->ncv,&lanczos->AV);CHKERRQ(ierr); ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_Lanczos" PetscErrorCode EPSDestroy_Lanczos(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosSetReorthog_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosGetReorthog_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_Lanczos" PetscErrorCode EPSView_Lanczos(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_LANCZOS *lanczos = (EPS_LANCZOS*)eps->data; PetscBool isascii; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," Lanczos: %s reorthogonalization\n",EPSLanczosReorthogTypes[lanczos->reorthog]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_Lanczos" PETSC_EXTERN PetscErrorCode EPSCreate_Lanczos(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_LANCZOS,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_Lanczos; eps->ops->setfromoptions = EPSSetFromOptions_Lanczos; eps->ops->destroy = EPSDestroy_Lanczos; eps->ops->reset = EPSReset_Lanczos; eps->ops->view = EPSView_Lanczos; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Hermitian; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosSetReorthog_C",EPSLanczosSetReorthog_Lanczos);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSLanczosGetReorthog_C",EPSLanczosGetReorthog_Lanczos);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/makefile0000644000175000017500000000215212211062077022634 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = lanczos.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/krylov/lanczos/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/makefile.html0000644000175000017500000000374612211062077023611 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = lanczos.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/krylov/lanczos/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/index.html0000644000175000017500000000213212211062077023127 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

lanczos.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/ftn-auto/0000755000175000017500000000000012214143515022671 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/ftn-auto/makefile0000644000175000017500000000035512211062077024374 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = lanczosf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/krylov/lanczos/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/lanczos/ftn-auto/lanczosf.c0000644000175000017500000000210212211062077024647 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* lanczos.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epslanczossetreorthog_ EPSLANCZOSSETREORTHOG #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epslanczossetreorthog_ epslanczossetreorthog #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epslanczossetreorthog_(EPS *eps,EPSLanczosReorthogType *reorthog, int *__ierr ){ *__ierr = EPSLanczosSetReorthog(*eps,*reorthog); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/index.html0000644000175000017500000000231412211062077021460 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

arnoldi/
lanczos/
krylovschur/
krylov.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/0000755000175000017500000000000012214143515021113 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/makefile0000644000175000017500000000215212211062077022613 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = arnoldi.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/krylov/arnoldi/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/makefile.html0000644000175000017500000000374612211062077023570 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = arnoldi.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/krylov/arnoldi/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/index.html0000644000175000017500000000213212211062077023106 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

arnoldi.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/arnoldi.c0000644000175000017500000004173512211062077022721 0ustar gladkgladk/* SLEPc eigensolver: "arnoldi" Method: Explicitly Restarted Arnoldi Algorithm: Arnoldi method with explicit restart and deflation. References: [1] "Arnoldi Methods in SLEPc", SLEPc Technical Report STR-4, available at http://www.grycap.upv.es/slepc. Last update: Feb 2009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_Arnoldi(EPS); typedef struct { PetscBool delayed; } EPS_ARNOLDI; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_Arnoldi" PetscErrorCode EPSSetUp_Arnoldi(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; if (eps->ncv) { /* ncv set */ if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev"); } else if (eps->mpd) { /* mpd set */ eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15)); else { eps->mpd = 500; eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } } if (!eps->mpd) eps->mpd = eps->ncv; if (eps->ncv>eps->nev+eps->mpd) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must not be larger than nev+mpd"); if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv); if (!eps->which) { ierr = EPSSetWhichEigenpairs_Default(eps);CHKERRQ(ierr); } if (eps->ishermitian && (eps->which==EPS_LARGEST_IMAGINARY || eps->which==EPS_SMALLEST_IMAGINARY)) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (!eps->extraction) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); if (eps->extraction==EPS_REFINED || eps->extraction==EPS_REFINED_HARMONIC) { ierr = DSSetRefined(eps->ds,PETSC_TRUE);CHKERRQ(ierr); } ierr = DSSetExtraRow(eps->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSAllocate(eps->ds,eps->ncv+1);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); if (eps->isgeneralized && eps->ishermitian && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method does not work for indefinite problems"); eps->ops->solve = EPSSolve_Arnoldi; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDelayedArnoldi" /* EPSDelayedArnoldi - This function is equivalent to EPSBasicArnoldi but performs the computation in a different way. The main idea is that reorthogonalization is delayed to the next Arnoldi step. This version is more scalable but in some cases convergence may stagnate. */ PetscErrorCode EPSDelayedArnoldi(EPS eps,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown) { PetscErrorCode ierr; PetscInt i,j,m=*M; Vec u,t; PetscScalar shh[100],*lhh,dot,dot2; PetscReal norm1=0.0,norm2; PetscFunctionBegin; if (m<=100) lhh = shh; else { ierr = PetscMalloc(m*sizeof(PetscScalar),&lhh);CHKERRQ(ierr); } ierr = VecDuplicate(f,&u);CHKERRQ(ierr); ierr = VecDuplicate(f,&t);CHKERRQ(ierr); for (j=k;jst,V[j],f);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,f,NULL,NULL,NULL);CHKERRQ(ierr); ierr = IPMInnerProductBegin(eps->ip,f,j+1,V,H+ldh*j);CHKERRQ(ierr); if (j>k) { ierr = IPMInnerProductBegin(eps->ip,V[j],j,V,lhh);CHKERRQ(ierr); ierr = IPInnerProductBegin(eps->ip,V[j],V[j],&dot);CHKERRQ(ierr); } if (j>k+1) { ierr = IPNormBegin(eps->ip,u,&norm2);CHKERRQ(ierr); ierr = VecDotBegin(u,V[j-2],&dot2);CHKERRQ(ierr); } ierr = IPMInnerProductEnd(eps->ip,f,j+1,V,H+ldh*j);CHKERRQ(ierr); if (j>k) { ierr = IPMInnerProductEnd(eps->ip,V[j],j,V,lhh);CHKERRQ(ierr); ierr = IPInnerProductEnd(eps->ip,V[j],V[j],&dot);CHKERRQ(ierr); } if (j>k+1) { ierr = IPNormEnd(eps->ip,u,&norm2);CHKERRQ(ierr); ierr = VecDotEnd(u,V[j-2],&dot2);CHKERRQ(ierr); if (PetscAbsScalar(dot2/norm2) > PETSC_MACHINE_EPSILON) { *breakdown = PETSC_TRUE; *M = j-1; *beta = norm2; if (m>100) { ierr = PetscFree(lhh);CHKERRQ(ierr); } ierr = VecDestroy(&u);CHKERRQ(ierr); ierr = VecDestroy(&t);CHKERRQ(ierr); PetscFunctionReturn(0); } } if (j>k) { norm1 = PetscSqrtReal(PetscRealPart(dot)); for (i=0;ik) { ierr = SlepcVecMAXPBY(t,1.0,-1.0,j,lhh,V);CHKERRQ(ierr); for (i=0;ik+1) { ierr = VecCopy(u,V[j-1]);CHKERRQ(ierr); ierr = VecScale(V[j-1],1.0/norm2);CHKERRQ(ierr); H[ldh*(j-2)+j-1] = norm2; } if (jip,t,&norm2);CHKERRQ(ierr); ierr = VecScale(t,1.0/norm2);CHKERRQ(ierr); ierr = VecCopy(t,V[m-1]);CHKERRQ(ierr); H[ldh*(m-2)+m-1] = norm2; ierr = IPMInnerProduct(eps->ip,f,m,V,lhh);CHKERRQ(ierr); ierr = SlepcVecMAXPBY(f,1.0,-1.0,m,lhh,V);CHKERRQ(ierr); for (i=0;iip,f,beta);CHKERRQ(ierr); ierr = VecScale(f,1.0 / *beta);CHKERRQ(ierr); *breakdown = PETSC_FALSE; if (m>100) { ierr = PetscFree(lhh);CHKERRQ(ierr); } ierr = VecDestroy(&u);CHKERRQ(ierr); ierr = VecDestroy(&t);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDelayedArnoldi1" /* EPSDelayedArnoldi1 - This function is similar to EPSDelayedArnoldi1, but without reorthogonalization (only delayed normalization). */ PetscErrorCode EPSDelayedArnoldi1(EPS eps,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown) { PetscErrorCode ierr; PetscInt i,j,m=*M; PetscScalar dot; PetscReal norm=0.0; PetscFunctionBegin; for (j=k;jst,V[j],f);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,f,NULL,NULL,NULL);CHKERRQ(ierr); ierr = IPMInnerProductBegin(eps->ip,f,j+1,V,H+ldh*j);CHKERRQ(ierr); if (j>k) { ierr = IPInnerProductBegin(eps->ip,V[j],V[j],&dot);CHKERRQ(ierr); } ierr = IPMInnerProductEnd(eps->ip,f,j+1,V,H+ldh*j);CHKERRQ(ierr); if (j>k) { ierr = IPInnerProductEnd(eps->ip,V[j],V[j],&dot);CHKERRQ(ierr); } if (j>k) { norm = PetscSqrtReal(PetscRealPart(dot)); ierr = VecScale(V[j],1.0/norm);CHKERRQ(ierr); H[ldh*(j-1)+j] = norm; for (i=0;iip,f,beta);CHKERRQ(ierr); ierr = VecScale(f,1.0 / *beta);CHKERRQ(ierr); *breakdown = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_Arnoldi" PetscErrorCode EPSSolve_Arnoldi(EPS eps) { PetscErrorCode ierr; PetscInt k,nv,ld; Vec f=eps->work[0]; PetscScalar *H,*U,*X; PetscReal beta,gamma=1.0; PetscBool breakdown,harmonic,refined; IPOrthogRefineType orthog_ref; EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = DSGetRefined(eps->ds,&refined);CHKERRQ(ierr); harmonic = (eps->extraction==EPS_HARMONIC || eps->extraction==EPS_REFINED_HARMONIC)?PETSC_TRUE:PETSC_FALSE; ierr = IPGetOrthogonalization(eps->ip,NULL,&orthog_ref,NULL);CHKERRQ(ierr); /* Get the starting Arnoldi vector */ ierr = EPSGetStartVector(eps,0,eps->V[0],NULL);CHKERRQ(ierr); /* Restart loop */ while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; /* Compute an nv-step Arnoldi factorization */ nv = PetscMin(eps->nconv+eps->mpd,eps->ncv); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,0);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_A,&H);CHKERRQ(ierr); if (!arnoldi->delayed) { ierr = EPSBasicArnoldi(eps,PETSC_FALSE,H,ld,eps->V,eps->nconv,&nv,f,&beta,&breakdown);CHKERRQ(ierr); H[nv+(nv-1)*ld] = beta; } else if (orthog_ref == IP_ORTHOG_REFINE_NEVER) { ierr = EPSDelayedArnoldi1(eps,H,ld,eps->V,eps->nconv,&nv,f,&beta,&breakdown);CHKERRQ(ierr); } else { ierr = EPSDelayedArnoldi(eps,H,ld,eps->V,eps->nconv,&nv,f,&beta,&breakdown);CHKERRQ(ierr); } ierr = DSRestoreArray(eps->ds,DS_MAT_A,&H);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); /* Compute translation of Krylov decomposition if harmonic extraction used */ if (harmonic) { ierr = DSTranslateHarmonic(eps->ds,eps->target,beta,PETSC_FALSE,NULL,&gamma);CHKERRQ(ierr); } /* Solve projected problem */ ierr = DSSolve(eps->ds,eps->eigr,eps->eigi);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);CHKERRQ(ierr); ierr = DSUpdateExtraRow(eps->ds);CHKERRQ(ierr); /* Check convergence */ ierr = EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,gamma,&k);CHKERRQ(ierr); if (refined) { ierr = DSGetArray(eps->ds,DS_MAT_X,&X);CHKERRQ(ierr); ierr = SlepcVecMAXPBY(eps->V[k],0.0,1.0,nv,X+k*ld,eps->V);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_X,&X);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_Q,&U);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,PetscMin(k,nv),U,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&U);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,0,NULL,k,NULL,eps->V,eps->V[k],NULL,NULL,NULL);CHKERRQ(ierr); } else { ierr = DSGetArray(eps->ds,DS_MAT_Q,&U);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,PetscMin(k+1,nv),U,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&U);CHKERRQ(ierr); } eps->nconv = k; ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,nv);CHKERRQ(ierr); if (breakdown) { ierr = PetscInfo2(eps,"Breakdown in Arnoldi method (it=%D norm=%G)\n",eps->its,beta);CHKERRQ(ierr); ierr = EPSGetStartVector(eps,k,eps->V[k],&breakdown);CHKERRQ(ierr); if (breakdown) { eps->reason = EPS_DIVERGED_BREAKDOWN; ierr = PetscInfo(eps,"Unable to generate more start vectors\n");CHKERRQ(ierr); } } if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (eps->nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL; } /* truncate Schur decomposition and change the state to raw so that PSVectors() computes eigenvectors from scratch */ ierr = DSSetDimensions(eps->ds,eps->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_Arnoldi" PetscErrorCode EPSSetFromOptions_Arnoldi(EPS eps) { PetscErrorCode ierr; PetscBool set,val; EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data; PetscFunctionBegin; ierr = PetscOptionsHead("EPS Arnoldi Options");CHKERRQ(ierr); ierr = PetscOptionsBool("-eps_arnoldi_delayed","Arnoldi with delayed reorthogonalization","EPSArnoldiSetDelayed",arnoldi->delayed,&val,&set);CHKERRQ(ierr); if (set) { ierr = EPSArnoldiSetDelayed(eps,val);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSArnoldiSetDelayed_Arnoldi" static PetscErrorCode EPSArnoldiSetDelayed_Arnoldi(EPS eps,PetscBool delayed) { EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data; PetscFunctionBegin; arnoldi->delayed = delayed; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSArnoldiSetDelayed" /*@ EPSArnoldiSetDelayed - Activates or deactivates delayed reorthogonalization in the Arnoldi iteration. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - delayed - boolean flag Options Database Key: . -eps_arnoldi_delayed - Activates delayed reorthogonalization in Arnoldi Note: Delayed reorthogonalization is an aggressive optimization for the Arnoldi eigensolver than may provide better scalability, but sometimes makes the solver converge less than the default algorithm. Level: advanced .seealso: EPSArnoldiGetDelayed() @*/ PetscErrorCode EPSArnoldiSetDelayed(EPS eps,PetscBool delayed) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,delayed,2); ierr = PetscTryMethod(eps,"EPSArnoldiSetDelayed_C",(EPS,PetscBool),(eps,delayed));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSArnoldiGetDelayed_Arnoldi" static PetscErrorCode EPSArnoldiGetDelayed_Arnoldi(EPS eps,PetscBool *delayed) { EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data; PetscFunctionBegin; *delayed = arnoldi->delayed; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSArnoldiGetDelayed" /*@C EPSArnoldiGetDelayed - Gets the type of reorthogonalization used during the Arnoldi iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Input Parameter: . delayed - boolean flag indicating if delayed reorthogonalization has been enabled Level: advanced .seealso: EPSArnoldiSetDelayed() @*/ PetscErrorCode EPSArnoldiGetDelayed(EPS eps,PetscBool *delayed) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(delayed,2); ierr = PetscTryMethod(eps,"EPSArnoldiGetDelayed_C",(EPS,PetscBool*),(eps,delayed));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_Arnoldi" PetscErrorCode EPSDestroy_Arnoldi(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiSetDelayed_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiGetDelayed_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_Arnoldi" PetscErrorCode EPSView_Arnoldi(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; PetscBool isascii; EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { if (arnoldi->delayed) { ierr = PetscViewerASCIIPrintf(viewer," Arnoldi: using delayed reorthogonalization\n");CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_Arnoldi" PETSC_EXTERN PetscErrorCode EPSCreate_Arnoldi(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_ARNOLDI,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_Arnoldi; eps->ops->setfromoptions = EPSSetFromOptions_Arnoldi; eps->ops->destroy = EPSDestroy_Arnoldi; eps->ops->reset = EPSReset_Default; eps->ops->view = EPSView_Arnoldi; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Schur; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiSetDelayed_C",EPSArnoldiSetDelayed_Arnoldi);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiGetDelayed_C",EPSArnoldiGetDelayed_Arnoldi);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/arnoldi.c.html0000644000175000017500000011005612211062077023655 0ustar gladkgladk

Actual source code: arnoldi.c

  1: /*

  3:    SLEPc eigensolver: "arnoldi"

  5:    Method: Explicitly Restarted Arnoldi

  7:    Algorithm:

  9:        Arnoldi method with explicit restart and deflation.

 11:    References:

 13:        [1] "Arnoldi Methods in SLEPc", SLEPc Technical Report STR-4,
 14:            available at http://www.grycap.upv.es/slepc.

 16:    Last update: Feb 2009

 18:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 20:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 22:    This file is part of SLEPc.

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

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

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

 38: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 39: #include <slepcblaslapack.h>

 41: PetscErrorCode EPSSolve_Arnoldi(EPS);

 43: typedef struct {
 44:   PetscBool delayed;
 45: } EPS_ARNOLDI;

 49: PetscErrorCode EPSSetUp_Arnoldi(EPS eps)
 50: {

 54:   if (eps->ncv) { /* ncv set */
 55:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev");
 56:   } else if (eps->mpd) { /* mpd set */
 57:     eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 58:   } else { /* neither set: defaults depend on nev being small or large */
 59:     if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15));
 60:     else {
 61:       eps->mpd = 500;
 62:       eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 63:     }
 64:   }
 65:   if (!eps->mpd) eps->mpd = eps->ncv;
 66:   if (eps->ncv>eps->nev+eps->mpd) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must not be larger than nev+mpd");
 67:   if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
 68:   if (!eps->which) { EPSSetWhichEigenpairs_Default(eps); }
 69:   if (eps->ishermitian && (eps->which==EPS_LARGEST_IMAGINARY || eps->which==EPS_SMALLEST_IMAGINARY)) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");

 71:   if (!eps->extraction) {
 72:     EPSSetExtraction(eps,EPS_RITZ);
 73:   }
 74:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

 76:   EPSAllocateSolution(eps);
 77:   DSSetType(eps->ds,DSNHEP);
 78:   if (eps->extraction==EPS_REFINED || eps->extraction==EPS_REFINED_HARMONIC) {
 79:     DSSetRefined(eps->ds,PETSC_TRUE);
 80:   }
 81:   DSSetExtraRow(eps->ds,PETSC_TRUE);
 82:   DSAllocate(eps->ds,eps->ncv+1);
 83:   EPSSetWorkVecs(eps,1);

 85:   /* dispatch solve method */
 86:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
 87:   if (eps->isgeneralized && eps->ishermitian && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method does not work for indefinite problems");
 88:   eps->ops->solve = EPSSolve_Arnoldi;
 89:   return(0);
 90: }

 94: /*
 95:    EPSDelayedArnoldi - This function is equivalent to EPSBasicArnoldi but
 96:    performs the computation in a different way. The main idea is that
 97:    reorthogonalization is delayed to the next Arnoldi step. This version is
 98:    more scalable but in some cases convergence may stagnate.
 99: */
100: PetscErrorCode EPSDelayedArnoldi(EPS eps,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)
101: {
103:   PetscInt       i,j,m=*M;
104:   Vec            u,t;
105:   PetscScalar    shh[100],*lhh,dot,dot2;
106:   PetscReal      norm1=0.0,norm2;

109:   if (m<=100) lhh = shh;
110:   else {
111:     PetscMalloc(m*sizeof(PetscScalar),&lhh);
112:   }
113:   VecDuplicate(f,&u);
114:   VecDuplicate(f,&t);

116:   for (j=k;j<m;j++) {
117:     STApply(eps->st,V[j],f);
118:     IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,f,NULL,NULL,NULL);

120:     IPMInnerProductBegin(eps->ip,f,j+1,V,H+ldh*j);
121:     if (j>k) {
122:       IPMInnerProductBegin(eps->ip,V[j],j,V,lhh);
123:       IPInnerProductBegin(eps->ip,V[j],V[j],&dot);
124:     }
125:     if (j>k+1) {
126:       IPNormBegin(eps->ip,u,&norm2);
127:       VecDotBegin(u,V[j-2],&dot2);
128:     }

130:     IPMInnerProductEnd(eps->ip,f,j+1,V,H+ldh*j);
131:     if (j>k) {
132:       IPMInnerProductEnd(eps->ip,V[j],j,V,lhh);
133:       IPInnerProductEnd(eps->ip,V[j],V[j],&dot);
134:     }
135:     if (j>k+1) {
136:       IPNormEnd(eps->ip,u,&norm2);
137:       VecDotEnd(u,V[j-2],&dot2);
138:       if (PetscAbsScalar(dot2/norm2) > PETSC_MACHINE_EPSILON) {
139:         *breakdown = PETSC_TRUE;
140:         *M = j-1;
141:         *beta = norm2;

143:         if (m>100) { PetscFree(lhh); }
144:         VecDestroy(&u);
145:         VecDestroy(&t);
146:         return(0);
147:       }
148:     }

150:     if (j>k) {
151:       norm1 = PetscSqrtReal(PetscRealPart(dot));
152:       for (i=0;i<j;i++)
153:         H[ldh*j+i] = H[ldh*j+i]/norm1;
154:       H[ldh*j+j] = H[ldh*j+j]/dot;

156:       VecCopy(V[j],t);
157:       VecScale(V[j],1.0/norm1);
158:       VecScale(f,1.0/norm1);
159:     }

161:     SlepcVecMAXPBY(f,1.0,-1.0,j+1,H+ldh*j,V);

163:     if (j>k) {
164:       SlepcVecMAXPBY(t,1.0,-1.0,j,lhh,V);
165:       for (i=0;i<j;i++)
166:         H[ldh*(j-1)+i] += lhh[i];
167:     }

169:     if (j>k+1) {
170:       VecCopy(u,V[j-1]);
171:       VecScale(V[j-1],1.0/norm2);
172:       H[ldh*(j-2)+j-1] = norm2;
173:     }

175:     if (j<m-1) {
176:       VecCopy(f,V[j+1]);
177:       VecCopy(t,u);
178:     }
179:   }

181:   IPNorm(eps->ip,t,&norm2);
182:   VecScale(t,1.0/norm2);
183:   VecCopy(t,V[m-1]);
184:   H[ldh*(m-2)+m-1] = norm2;

186:   IPMInnerProduct(eps->ip,f,m,V,lhh);

188:   SlepcVecMAXPBY(f,1.0,-1.0,m,lhh,V);
189:   for (i=0;i<m;i++)
190:     H[ldh*(m-1)+i] += lhh[i];

192:   IPNorm(eps->ip,f,beta);
193:   VecScale(f,1.0 / *beta);
194:   *breakdown = PETSC_FALSE;

196:   if (m>100) { PetscFree(lhh); }
197:   VecDestroy(&u);
198:   VecDestroy(&t);
199:   return(0);
200: }

204: /*
205:    EPSDelayedArnoldi1 - This function is similar to EPSDelayedArnoldi1,
206:    but without reorthogonalization (only delayed normalization).
207: */
208: PetscErrorCode EPSDelayedArnoldi1(EPS eps,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)
209: {
211:   PetscInt       i,j,m=*M;
212:   PetscScalar    dot;
213:   PetscReal      norm=0.0;

216:   for (j=k;j<m;j++) {
217:     STApply(eps->st,V[j],f);
218:     IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,f,NULL,NULL,NULL);

220:     IPMInnerProductBegin(eps->ip,f,j+1,V,H+ldh*j);
221:     if (j>k) {
222:       IPInnerProductBegin(eps->ip,V[j],V[j],&dot);
223:     }

225:     IPMInnerProductEnd(eps->ip,f,j+1,V,H+ldh*j);
226:     if (j>k) {
227:       IPInnerProductEnd(eps->ip,V[j],V[j],&dot);
228:     }

230:     if (j>k) {
231:       norm = PetscSqrtReal(PetscRealPart(dot));
232:       VecScale(V[j],1.0/norm);
233:       H[ldh*(j-1)+j] = norm;

235:       for (i=0;i<j;i++)
236:         H[ldh*j+i] = H[ldh*j+i]/norm;
237:       H[ldh*j+j] = H[ldh*j+j]/dot;
238:       VecScale(f,1.0/norm);
239:     }

241:     SlepcVecMAXPBY(f,1.0,-1.0,j+1,H+ldh*j,V);

243:     if (j<m-1) {
244:       VecCopy(f,V[j+1]);
245:     }
246:   }

248:   IPNorm(eps->ip,f,beta);
249:   VecScale(f,1.0 / *beta);
250:   *breakdown = PETSC_FALSE;
251:   return(0);
252: }

256: PetscErrorCode EPSSolve_Arnoldi(EPS eps)
257: {
258:   PetscErrorCode     ierr;
259:   PetscInt           k,nv,ld;
260:   Vec                f=eps->work[0];
261:   PetscScalar        *H,*U,*X;
262:   PetscReal          beta,gamma=1.0;
263:   PetscBool          breakdown,harmonic,refined;
264:   IPOrthogRefineType orthog_ref;
265:   EPS_ARNOLDI        *arnoldi = (EPS_ARNOLDI*)eps->data;

268:   DSGetLeadingDimension(eps->ds,&ld);
269:   DSGetRefined(eps->ds,&refined);
270:   harmonic = (eps->extraction==EPS_HARMONIC || eps->extraction==EPS_REFINED_HARMONIC)?PETSC_TRUE:PETSC_FALSE;
271:   IPGetOrthogonalization(eps->ip,NULL,&orthog_ref,NULL);

273:   /* Get the starting Arnoldi vector */
274:   EPSGetStartVector(eps,0,eps->V[0],NULL);

276:   /* Restart loop */
277:   while (eps->reason == EPS_CONVERGED_ITERATING) {
278:     eps->its++;

280:     /* Compute an nv-step Arnoldi factorization */
281:     nv = PetscMin(eps->nconv+eps->mpd,eps->ncv);
282:     DSSetDimensions(eps->ds,nv,0,eps->nconv,0);
283:     DSGetArray(eps->ds,DS_MAT_A,&H);
284:     if (!arnoldi->delayed) {
285:       EPSBasicArnoldi(eps,PETSC_FALSE,H,ld,eps->V,eps->nconv,&nv,f,&beta,&breakdown);
286:       H[nv+(nv-1)*ld] = beta;
287:     } else if (orthog_ref == IP_ORTHOG_REFINE_NEVER) {
288:       EPSDelayedArnoldi1(eps,H,ld,eps->V,eps->nconv,&nv,f,&beta,&breakdown);
289:     } else {
290:       EPSDelayedArnoldi(eps,H,ld,eps->V,eps->nconv,&nv,f,&beta,&breakdown);
291:     }
292:     DSRestoreArray(eps->ds,DS_MAT_A,&H);
293:     DSSetState(eps->ds,DS_STATE_INTERMEDIATE);

295:     /* Compute translation of Krylov decomposition if harmonic extraction used */
296:     if (harmonic) {
297:       DSTranslateHarmonic(eps->ds,eps->target,beta,PETSC_FALSE,NULL,&gamma);
298:     }

300:     /* Solve projected problem */
301:     DSSolve(eps->ds,eps->eigr,eps->eigi);
302:     DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);
303:     DSUpdateExtraRow(eps->ds);

305:     /* Check convergence */
306:     EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,gamma,&k);
307:     if (refined) {
308:       DSGetArray(eps->ds,DS_MAT_X,&X);
309:       SlepcVecMAXPBY(eps->V[k],0.0,1.0,nv,X+k*ld,eps->V);
310:       DSRestoreArray(eps->ds,DS_MAT_X,&X);
311:       DSGetArray(eps->ds,DS_MAT_Q,&U);
312:       SlepcUpdateVectors(nv,eps->V,eps->nconv,PetscMin(k,nv),U,ld,PETSC_FALSE);
313:       DSRestoreArray(eps->ds,DS_MAT_Q,&U);
314:       IPOrthogonalize(eps->ip,0,NULL,k,NULL,eps->V,eps->V[k],NULL,NULL,NULL);
315:     } else {
316:       DSGetArray(eps->ds,DS_MAT_Q,&U);
317:       SlepcUpdateVectors(nv,eps->V,eps->nconv,PetscMin(k+1,nv),U,ld,PETSC_FALSE);
318:       DSRestoreArray(eps->ds,DS_MAT_Q,&U);
319:     }
320:     eps->nconv = k;

322:     EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,nv);
323:     if (breakdown) {
324:       PetscInfo2(eps,"Breakdown in Arnoldi method (it=%D norm=%G)\n",eps->its,beta);
325:       EPSGetStartVector(eps,k,eps->V[k],&breakdown);
326:       if (breakdown) {
327:         eps->reason = EPS_DIVERGED_BREAKDOWN;
328:         PetscInfo(eps,"Unable to generate more start vectors\n");
329:       }
330:     }
331:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
332:     if (eps->nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL;
333:   }

335:   /* truncate Schur decomposition and change the state to raw so that
336:      PSVectors() computes eigenvectors from scratch */
337:   DSSetDimensions(eps->ds,eps->nconv,0,0,0);
338:   DSSetState(eps->ds,DS_STATE_RAW);
339:   return(0);
340: }

344: PetscErrorCode EPSSetFromOptions_Arnoldi(EPS eps)
345: {
347:   PetscBool      set,val;
348:   EPS_ARNOLDI    *arnoldi = (EPS_ARNOLDI*)eps->data;

351:   PetscOptionsHead("EPS Arnoldi Options");
352:   PetscOptionsBool("-eps_arnoldi_delayed","Arnoldi with delayed reorthogonalization","EPSArnoldiSetDelayed",arnoldi->delayed,&val,&set);
353:   if (set) {
354:     EPSArnoldiSetDelayed(eps,val);
355:   }
356:   PetscOptionsTail();
357:   return(0);
358: }

362: static PetscErrorCode EPSArnoldiSetDelayed_Arnoldi(EPS eps,PetscBool delayed)
363: {
364:   EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data;

367:   arnoldi->delayed = delayed;
368:   return(0);
369: }

373: /*@
374:    EPSArnoldiSetDelayed - Activates or deactivates delayed reorthogonalization
375:    in the Arnoldi iteration.

377:    Logically Collective on EPS

379:    Input Parameters:
380: +  eps - the eigenproblem solver context
381: -  delayed - boolean flag

383:    Options Database Key:
384: .  -eps_arnoldi_delayed - Activates delayed reorthogonalization in Arnoldi

386:    Note:
387:    Delayed reorthogonalization is an aggressive optimization for the Arnoldi
388:    eigensolver than may provide better scalability, but sometimes makes the
389:    solver converge less than the default algorithm.

391:    Level: advanced

393: .seealso: EPSArnoldiGetDelayed()
394: @*/
395: PetscErrorCode EPSArnoldiSetDelayed(EPS eps,PetscBool delayed)
396: {

402:   PetscTryMethod(eps,"EPSArnoldiSetDelayed_C",(EPS,PetscBool),(eps,delayed));
403:   return(0);
404: }

408: static PetscErrorCode EPSArnoldiGetDelayed_Arnoldi(EPS eps,PetscBool *delayed)
409: {
410:   EPS_ARNOLDI *arnoldi = (EPS_ARNOLDI*)eps->data;

413:   *delayed = arnoldi->delayed;
414:   return(0);
415: }

419: /*@C
420:    EPSArnoldiGetDelayed - Gets the type of reorthogonalization used during the Arnoldi
421:    iteration.

423:    Not Collective

425:    Input Parameter:
426: .  eps - the eigenproblem solver context

428:    Input Parameter:
429: .  delayed - boolean flag indicating if delayed reorthogonalization has been enabled

431:    Level: advanced

433: .seealso: EPSArnoldiSetDelayed()
434: @*/
435: PetscErrorCode EPSArnoldiGetDelayed(EPS eps,PetscBool *delayed)
436: {

442:   PetscTryMethod(eps,"EPSArnoldiGetDelayed_C",(EPS,PetscBool*),(eps,delayed));
443:   return(0);
444: }

448: PetscErrorCode EPSDestroy_Arnoldi(EPS eps)
449: {

453:   PetscFree(eps->data);
454:   PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiSetDelayed_C",NULL);
455:   PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiGetDelayed_C",NULL);
456:   return(0);
457: }

461: PetscErrorCode EPSView_Arnoldi(EPS eps,PetscViewer viewer)
462: {
464:   PetscBool      isascii;
465:   EPS_ARNOLDI    *arnoldi = (EPS_ARNOLDI*)eps->data;

468:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
469:   if (isascii) {
470:     if (arnoldi->delayed) {
471:       PetscViewerASCIIPrintf(viewer,"  Arnoldi: using delayed reorthogonalization\n");
472:     }
473:   }
474:   return(0);
475: }

479: PETSC_EXTERN PetscErrorCode EPSCreate_Arnoldi(EPS eps)
480: {

484:   PetscNewLog(eps,EPS_ARNOLDI,&eps->data);
485:   eps->ops->setup                = EPSSetUp_Arnoldi;
486:   eps->ops->setfromoptions       = EPSSetFromOptions_Arnoldi;
487:   eps->ops->destroy              = EPSDestroy_Arnoldi;
488:   eps->ops->reset                = EPSReset_Default;
489:   eps->ops->view                 = EPSView_Arnoldi;
490:   eps->ops->backtransform        = EPSBackTransform_Default;
491:   eps->ops->computevectors       = EPSComputeVectors_Schur;
492:   PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiSetDelayed_C",EPSArnoldiSetDelayed_Arnoldi);
493:   PetscObjectComposeFunction((PetscObject)eps,"EPSArnoldiGetDelayed_C",EPSArnoldiGetDelayed_Arnoldi);
494:   return(0);
495: }

slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/ftn-auto/0000755000175000017500000000000012214143515022650 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/ftn-auto/makefile0000644000175000017500000000035512211062077024353 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = arnoldif.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/krylov/arnoldi/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/arnoldi/ftn-auto/arnoldif.c0000644000175000017500000000205512211062077024614 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* arnoldi.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsarnoldisetdelayed_ EPSARNOLDISETDELAYED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsarnoldisetdelayed_ epsarnoldisetdelayed #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsarnoldisetdelayed_(EPS *eps,PetscBool *delayed, int *__ierr ){ *__ierr = EPSArnoldiSetDelayed(*eps,*delayed); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/0000755000175000017500000000000012214143515022056 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ks-symm.c.html0000644000175000017500000002225212211062077024570 0ustar gladkgladk
Actual source code: ks-symm.c

  1: /*

  3:    SLEPc eigensolver: "krylovschur"

  5:    Method: Krylov-Schur for symmetric eigenproblems

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

 11:    This file is part of SLEPc.

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

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

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

 27: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 28: #include <slepcblaslapack.h>
 29:  #include krylovschur.h

 33: PetscErrorCode EPSSolve_KrylovSchur_Symm(EPS eps)
 34: {
 35:   PetscErrorCode  ierr;
 36:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;
 37:   PetscInt        k,l,ld,nv;
 38:   Vec             u=eps->work[0];
 39:   PetscScalar     *Q;
 40:   PetscReal       *a,*b,beta;
 41:   PetscBool       breakdown;

 44:   DSGetLeadingDimension(eps->ds,&ld);

 46:   /* Get the starting Lanczos vector */
 47:   EPSGetStartVector(eps,0,eps->V[0],NULL);
 48:   l = 0;

 50:   /* Restart loop */
 51:   while (eps->reason == EPS_CONVERGED_ITERATING) {
 52:     eps->its++;

 54:     /* Compute an nv-step Lanczos factorization */
 55:     nv = PetscMin(eps->nconv+eps->mpd,eps->ncv);
 56:     DSGetArrayReal(eps->ds,DS_MAT_T,&a);
 57:     b = a + ld;
 58:     EPSFullLanczos(eps,a,b,eps->V,eps->nconv+l,&nv,u,&breakdown);
 59:     beta = b[nv-1];
 60:     DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
 61:     DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);
 62:     if (l==0) {
 63:       DSSetState(eps->ds,DS_STATE_INTERMEDIATE);
 64:     } else {
 65:       DSSetState(eps->ds,DS_STATE_RAW);
 66:     }

 68:     /* Solve projected problem */
 69:     DSSolve(eps->ds,eps->eigr,NULL);
 70:     if (eps->arbitrary) { EPSGetArbitraryValues(eps,eps->rr,eps->ri); }
 71:     DSSort(eps->ds,eps->eigr,NULL,eps->rr,eps->ri,NULL);
 72:     DSUpdateExtraRow(eps->ds);

 74:     /* Check convergence */
 75:     EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,1.0,&k);
 76:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
 77:     if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL;

 79:     /* Update l */
 80:     if (eps->reason != EPS_CONVERGED_ITERATING || breakdown) l = 0;
 81:     else l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep));

 83:     if (eps->reason == EPS_CONVERGED_ITERATING) {
 84:       if (breakdown) {
 85:         /* Start a new Lanczos factorization */
 86:         PetscInfo2(eps,"Breakdown in Krylov-Schur method (it=%D norm=%G)\n",eps->its,beta);
 87:         EPSGetStartVector(eps,k,eps->V[k],&breakdown);
 88:         if (breakdown) {
 89:           eps->reason = EPS_DIVERGED_BREAKDOWN;
 90:           PetscInfo(eps,"Unable to generate more start vectors\n");
 91:         }
 92:       } else {
 93:         /* Prepare the Rayleigh quotient for restart */
 94:         DSTruncate(eps->ds,k+l);
 95:       }
 96:     }
 97:     /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
 98:     DSGetArray(eps->ds,DS_MAT_Q,&Q);
 99:     SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);
100:     DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
101:     /* Normalize u and append it to V */
102:     if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) {
103:       VecAXPBY(eps->V[k+l],1.0/beta,0.0,u);
104:     }

106:     EPSMonitor(eps,eps->its,k,eps->eigr,eps->eigi,eps->errest,nv);
107:     eps->nconv = k;
108:   }
109:   return(0);
110: }

slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ks-indef.c.html0000644000175000017500000003633112211062077024673 0ustar gladkgladk
Actual source code: ks-indef.c

  1: /*

  3:    SLEPc eigensolver: "krylovschur"

  5:    Method: Krylov-Schur for symmetric-indefinite eigenproblems

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

 11:    This file is part of SLEPc.

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

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

 22:    You  should have received a copy of the GNU Lesser General  Public  License
 23:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 24:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 25: */
 26: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 27: #include <slepcblaslapack.h>
 28:  #include krylovschur.h

 32: static PetscErrorCode EPSFullLanczosIndef(EPS eps,PetscReal *alpha,PetscReal *beta,PetscReal *omega,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal *cos,Vec w)
 33: {
 35:   PetscInt       j,m = *M;
 36:   PetscScalar    *hwork,lhwork[100];
 37:   PetscReal      norm,norm1,norm2,t;

 40:   if (cos) *cos=1.0;
 41:   if (m > 100) {
 42:     PetscMalloc((eps->nds+m)*sizeof(PetscScalar),&hwork);
 43:   } else hwork = lhwork;

 45:   for (j=k;j<m-1;j++) {
 46:     STApply(eps->st,V[j],V[j+1]);
 47:     IPPseudoOrthogonalize(eps->ip,j+1,V,omega,V[j+1],hwork,&norm,breakdown);
 48:     VecScale(V[j+1],1.0/norm);
 49:     alpha[j] = PetscRealPart(hwork[j]);
 50:     beta[j] = PetscAbsReal(norm);
 51:     omega[j+1] = (norm<0.0)?-1.0:1.0;
 52:     /* */
 53:     VecNorm(V[j+1],NORM_2,&norm1);
 54:     IPApplyMatrix(eps->ip,V[j+1],w);
 55:     VecNorm(w,NORM_2,&norm2);
 56:     t=1/(norm1*norm2);
 57:     if (cos && *cos>t) *cos = t;
 58:   }
 59:   STApply(eps->st,V[m-1],f);
 60:   IPPseudoOrthogonalize(eps->ip,m,V,omega,f,hwork,&norm,NULL);
 61:   VecScale(f,1.0/norm);
 62:   alpha[m-1] = PetscRealPart(hwork[m-1]);
 63:   beta[m-1] =PetscAbsReal(norm);
 64:   omega[m] = (norm<0.0)?-1:1;
 65:   if (m > 100) {
 66:     PetscFree(hwork);
 67:   }
 68:   return(0);
 69: }

 73: PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS eps)
 74: {
 75:   PetscErrorCode  ierr;
 76:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;
 77:   PetscInt        i,k,l,ld,nv,t;
 78:   Vec             u=eps->work[0],w=eps->work[1];
 79:   PetscScalar     *Q;
 80:   PetscReal       *a,*b,*r,beta,beta1,beta2,norm,*omega;
 81:   PetscBool       breakdown=PETSC_FALSE;

 84:   DSGetLeadingDimension(eps->ds,&ld);

 86:   /* Get the starting Lanczos vector */
 87:   SlepcVecSetRandom(eps->V[0],eps->rand);
 88:   IPNorm(eps->ip,eps->V[0],&norm);
 89:   if (norm==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Initial vector is zero or belongs to the deflation space");
 90:   DSGetArrayReal(eps->ds,DS_MAT_D,&omega);
 91:   omega[0] = (norm > 0)?1.0:-1.0;
 92:   beta = PetscAbsReal(norm);
 93:   DSRestoreArrayReal(eps->ds,DS_MAT_D,&omega);
 94:   VecScale(eps->V[0],1.0/norm);
 95:   l = 0;

 97:   /* Restart loop */
 98:   while (eps->reason == EPS_CONVERGED_ITERATING) {
 99:     eps->its++;

101:     /* Compute an nv-step Lanczos factorization */
102:     nv = PetscMin(eps->nconv+eps->mpd,eps->ncv);
103:     DSGetArrayReal(eps->ds,DS_MAT_T,&a);
104:     b = a + ld;
105:     DSGetArrayReal(eps->ds,DS_MAT_D,&omega);
106:     EPSFullLanczosIndef(eps,a,b,omega,eps->V,eps->nconv+l,&nv,u,&breakdown,NULL,w);
107:     beta = b[nv-1];
108:     DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
109:     DSRestoreArrayReal(eps->ds,DS_MAT_D,&omega);
110:     DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);
111:     if (l==0) {
112:       DSSetState(eps->ds,DS_STATE_INTERMEDIATE);
113:     } else {
114:       DSSetState(eps->ds,DS_STATE_RAW);
115:     }
116:     /* Solve projected problem */
117:     DSSolve(eps->ds,eps->eigr,eps->eigi);
118:     DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);

120:     /* Check convergence */
121:     DSGetDimensions(eps->ds,NULL,NULL,NULL,NULL,&t);
122:     VecNorm(u,NORM_2,&beta1);
123:     IPApplyMatrix(eps->ip,u,w);
124:     VecNorm(w,NORM_2,&beta2);
125:     beta1 = PetscMax(beta1,beta2);
126:     EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,t-eps->nconv,eps->V,nv,beta*beta1,1.0,&k);
127:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
128:     if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL;

130:     /* Update l */
131:     if (eps->reason != EPS_CONVERGED_ITERATING || breakdown) l = 0;
132:     else {
133:       l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep));
134:       l = PetscMin(l,t);
135:       DSGetArrayReal(eps->ds,DS_MAT_T,&a);
136:       if (*(a+ld+k+l-1)!=0) {
137:         if (k+l<t-1) l = l+1;
138:         else l = l-1;
139:       }
140:       DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
141:     }

143:     if (eps->reason == EPS_CONVERGED_ITERATING) {
144:       if (breakdown) {
145:         SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_CONV_FAILED,"Breakdown in Indefinite Krylov-Schur (beta=%g)",beta);
146:       } else {
147:         /* Prepare the Rayleigh quotient for restart */
148:         DSGetArray(eps->ds,DS_MAT_Q,&Q);
149:         DSGetArrayReal(eps->ds,DS_MAT_T,&a);
150:         DSGetArrayReal(eps->ds,DS_MAT_D,&omega);
151:         b = a + ld;
152:         r = a + 2*ld;
153:         for (i=k;i<k+l;i++) {
154:           r[i] = PetscRealPart(Q[nv-1+i*ld]*beta);
155:         }
156:         b[k+l-1] = r[k+l-1];
157:         omega[k+l] = omega[nv];
158:         DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
159:         DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
160:         DSRestoreArrayReal(eps->ds,DS_MAT_D,&omega);
161:       }
162:     }
163:     /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
164:     DSGetArray(eps->ds,DS_MAT_Q,&Q);
165:     SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);
166:     DSRestoreArray(eps->ds,DS_MAT_Q,&Q);

168:     /* Append u to V */
169:     if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) {
170:       VecCopy(u,eps->V[k+l]);
171:     }

173:     EPSMonitor(eps,eps->its,k,eps->eigr,eps->eigi,eps->errest,nv);
174:     eps->nconv = k;
175:   }
176:   DSSetDimensions(eps->ds,eps->nconv,0,0,0);
177:   DSSetState(eps->ds,DS_STATE_RAW);
178:   return(0);
179: }

slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/makefile0000644000175000017500000000224012211062077023554 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = krylovschur.c ks-symm.c ks-slice.c ks-indef.c SOURCEF = SOURCEH = krylovschur.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/krylov/krylovschur/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ks-indef.c0000644000175000017500000001601712211062077023727 0ustar gladkgladk/* SLEPc eigensolver: "krylovschur" Method: Krylov-Schur for symmetric-indefinite eigenproblems - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #include "krylovschur.h" #undef __FUNCT__ #define __FUNCT__ "EPSFullLanczosIndef" static PetscErrorCode EPSFullLanczosIndef(EPS eps,PetscReal *alpha,PetscReal *beta,PetscReal *omega,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal *cos,Vec w) { PetscErrorCode ierr; PetscInt j,m = *M; PetscScalar *hwork,lhwork[100]; PetscReal norm,norm1,norm2,t; PetscFunctionBegin; if (cos) *cos=1.0; if (m > 100) { ierr = PetscMalloc((eps->nds+m)*sizeof(PetscScalar),&hwork);CHKERRQ(ierr); } else hwork = lhwork; for (j=k;jst,V[j],V[j+1]);CHKERRQ(ierr); ierr = IPPseudoOrthogonalize(eps->ip,j+1,V,omega,V[j+1],hwork,&norm,breakdown);CHKERRQ(ierr); ierr = VecScale(V[j+1],1.0/norm);CHKERRQ(ierr); alpha[j] = PetscRealPart(hwork[j]); beta[j] = PetscAbsReal(norm); omega[j+1] = (norm<0.0)?-1.0:1.0; /* */ ierr = VecNorm(V[j+1],NORM_2,&norm1);CHKERRQ(ierr); ierr = IPApplyMatrix(eps->ip,V[j+1],w);CHKERRQ(ierr); ierr = VecNorm(w,NORM_2,&norm2);CHKERRQ(ierr); t=1/(norm1*norm2); if (cos && *cos>t) *cos = t; } ierr = STApply(eps->st,V[m-1],f);CHKERRQ(ierr); ierr = IPPseudoOrthogonalize(eps->ip,m,V,omega,f,hwork,&norm,NULL);CHKERRQ(ierr); ierr = VecScale(f,1.0/norm);CHKERRQ(ierr); alpha[m-1] = PetscRealPart(hwork[m-1]); beta[m-1] =PetscAbsReal(norm); omega[m] = (norm<0.0)?-1:1; if (m > 100) { ierr = PetscFree(hwork);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_KrylovSchur_Indefinite" PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS eps) { PetscErrorCode ierr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscInt i,k,l,ld,nv,t; Vec u=eps->work[0],w=eps->work[1]; PetscScalar *Q; PetscReal *a,*b,*r,beta,beta1,beta2,norm,*omega; PetscBool breakdown=PETSC_FALSE; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); /* Get the starting Lanczos vector */ ierr = SlepcVecSetRandom(eps->V[0],eps->rand);CHKERRQ(ierr); ierr = IPNorm(eps->ip,eps->V[0],&norm);CHKERRQ(ierr); if (norm==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Initial vector is zero or belongs to the deflation space"); ierr = DSGetArrayReal(eps->ds,DS_MAT_D,&omega);CHKERRQ(ierr); omega[0] = (norm > 0)?1.0:-1.0; beta = PetscAbsReal(norm); ierr = DSRestoreArrayReal(eps->ds,DS_MAT_D,&omega);CHKERRQ(ierr); ierr = VecScale(eps->V[0],1.0/norm);CHKERRQ(ierr); l = 0; /* Restart loop */ while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; /* Compute an nv-step Lanczos factorization */ nv = PetscMin(eps->nconv+eps->mpd,eps->ncv); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); b = a + ld; ierr = DSGetArrayReal(eps->ds,DS_MAT_D,&omega);CHKERRQ(ierr); ierr = EPSFullLanczosIndef(eps,a,b,omega,eps->V,eps->nconv+l,&nv,u,&breakdown,NULL,w);CHKERRQ(ierr); beta = b[nv-1]; ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSRestoreArrayReal(eps->ds,DS_MAT_D,&omega);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(eps->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); } /* Solve projected problem */ ierr = DSSolve(eps->ds,eps->eigr,eps->eigi);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);CHKERRQ(ierr); /* Check convergence */ ierr = DSGetDimensions(eps->ds,NULL,NULL,NULL,NULL,&t);CHKERRQ(ierr); ierr = VecNorm(u,NORM_2,&beta1);CHKERRQ(ierr); ierr = IPApplyMatrix(eps->ip,u,w);CHKERRQ(ierr); ierr = VecNorm(w,NORM_2,&beta2);CHKERRQ(ierr); beta1 = PetscMax(beta1,beta2); ierr = EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,t-eps->nconv,eps->V,nv,beta*beta1,1.0,&k);CHKERRQ(ierr); if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL; /* Update l */ if (eps->reason != EPS_CONVERGED_ITERATING || breakdown) l = 0; else { l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep)); l = PetscMin(l,t); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); if (*(a+ld+k+l-1)!=0) { if (k+lds,DS_MAT_T,&a);CHKERRQ(ierr); } if (eps->reason == EPS_CONVERGED_ITERATING) { if (breakdown) { SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_CONV_FAILED,"Breakdown in Indefinite Krylov-Schur (beta=%g)",beta); } else { /* Prepare the Rayleigh quotient for restart */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSGetArrayReal(eps->ds,DS_MAT_D,&omega);CHKERRQ(ierr); b = a + ld; r = a + 2*ld; for (i=k;ids,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = DSRestoreArrayReal(eps->ds,DS_MAT_D,&omega);CHKERRQ(ierr); } } /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); /* Append u to V */ if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) { ierr = VecCopy(u,eps->V[k+l]);CHKERRQ(ierr); } ierr = EPSMonitor(eps,eps->its,k,eps->eigr,eps->eigi,eps->errest,nv);CHKERRQ(ierr); eps->nconv = k; } ierr = DSSetDimensions(eps->ds,eps->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/krylovschur.h0000644000175000017500000000641312211062077024626 0ustar gladkgladk/* Private header for Krylov-Schur. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__KRYLOVSCHUR_H) #define __KRYLOVSCHUR_H PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Default(EPS); PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Symm(EPS); PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS); PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS); PETSC_INTERN PetscErrorCode EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*); /* Structure characterizing a shift in spectrum slicing */ typedef struct _n_shift *shift; struct _n_shift { PetscReal value; PetscInt inertia; PetscBool comp[2]; /* Shows completion of subintervals (left and right) */ shift neighb[2]; /* Adjacent shifts */ PetscInt index; /* Index in eig where found values are stored */ PetscInt neigs; /* Number of values found */ PetscReal ext[2]; /* Limits for accepted values */ PetscInt nsch[2]; /* Number of missing values for each subinterval */ PetscInt nconv[2]; /* Converged on each side (accepted or not) */ }; /* Structure for storing the state of spectrum slicing */ struct _n_SR { PetscReal int0,int1; /* Extremes of the interval */ PetscInt dir; /* Determines the order of values in eig (+1 incr, -1 decr) */ PetscBool hasEnd; /* Tells whether the interval has an end */ PetscInt inertia0,inertia1; Vec *V; PetscScalar *eig,*eigi,*monit,*back; PetscReal *errest; PetscInt *perm; /* Permutation for keeping the eigenvalues in order */ PetscInt numEigs; /* Number of eigenvalues in the interval */ PetscInt indexEig; shift sPres; /* Present shift */ shift *pending; /* Pending shifts array */ PetscInt nPend; /* Number of pending shifts */ PetscInt maxPend; /* Size of "pending" array */ Vec *VDef; /* Vector for deflation */ PetscInt *idxDef; /* For deflation */ PetscInt nMAXCompl; PetscInt iterCompl; PetscInt itsKs; /* Krylovschur restarts */ PetscInt nleap; shift s0; /* Initial shift */ PetscScalar *S; /* Matrix for projected problem */ PetscInt nS; PetscReal beta; shift sPrev; }; typedef struct _n_SR *SR; typedef struct { PetscReal keep; SR sr; } EPS_KRYLOVSCHUR; #endif slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/makefile.html0000644000175000017500000000403412211062077024522 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = krylovschur.c ks-symm.c ks-slice.c ks-indef.c
SOURCEF  =
SOURCEH  = krylovschur.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/krylov/krylovschur/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/index.html0000644000175000017500000000243212211062077024054 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

krylovschur.h
krylovschur.c
ks-symm.c
ks-slice.c
ks-indef.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/krylovschur.h.html0000644000175000017500000001623012211062077025567 0ustar gladkgladk

Actual source code: krylovschur.h

  1: /*
  2:    Private header for Krylov-Schur.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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


 27: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Default(EPS);
 28: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Symm(EPS);
 29: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS);
 30: PETSC_INTERN PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS);
 31: PETSC_INTERN PetscErrorCode EPSGetArbitraryValues(EPS,PetscScalar*,PetscScalar*);

 33: /* Structure characterizing a shift in spectrum slicing */
 34: typedef struct _n_shift *shift;
 35: struct _n_shift {
 36:   PetscReal     value;
 37:   PetscInt      inertia;
 38:   PetscBool     comp[2];    /* Shows completion of subintervals (left and right) */
 39:   shift         neighb[2];  /* Adjacent shifts */
 40:   PetscInt      index;      /* Index in eig where found values are stored */
 41:   PetscInt      neigs;      /* Number of values found */
 42:   PetscReal     ext[2];     /* Limits for accepted values */
 43:   PetscInt      nsch[2];    /* Number of missing values for each subinterval */
 44:   PetscInt      nconv[2];   /* Converged on each side (accepted or not) */
 45: };

 47: /* Structure for storing the state of spectrum slicing */
 48: struct _n_SR {
 49:   PetscReal     int0,int1;  /* Extremes of the interval */
 50:   PetscInt      dir;        /* Determines the order of values in eig (+1 incr, -1 decr) */
 51:   PetscBool     hasEnd;     /* Tells whether the interval has an end */
 52:   PetscInt      inertia0,inertia1;
 53:   Vec           *V;
 54:   PetscScalar   *eig,*eigi,*monit,*back;
 55:   PetscReal     *errest;
 56:   PetscInt      *perm;      /* Permutation for keeping the eigenvalues in order */
 57:   PetscInt      numEigs;    /* Number of eigenvalues in the interval */
 58:   PetscInt      indexEig;
 59:   shift         sPres;      /* Present shift */
 60:   shift         *pending;   /* Pending shifts array */
 61:   PetscInt      nPend;      /* Number of pending shifts */
 62:   PetscInt      maxPend;    /* Size of "pending" array */
 63:   Vec           *VDef;      /* Vector for deflation */
 64:   PetscInt      *idxDef;    /* For deflation */
 65:   PetscInt      nMAXCompl;
 66:   PetscInt      iterCompl;
 67:   PetscInt      itsKs;      /* Krylovschur restarts */
 68:   PetscInt      nleap;
 69:   shift         s0;         /* Initial shift */
 70:   PetscScalar   *S;         /* Matrix for projected problem */
 71:   PetscInt      nS;
 72:   PetscReal     beta;
 73:   shift         sPrev;
 74: };
 75: typedef struct _n_SR  *SR;

 77: typedef struct {
 78:   PetscReal     keep;
 79:   SR            sr;
 80: } EPS_KRYLOVSCHUR;

 82: #endif
slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/krylovschur.c0000644000175000017500000004446112211062077024626 0ustar gladkgladk/* SLEPc eigensolver: "krylovschur" Method: Krylov-Schur Algorithm: Single-vector Krylov-Schur method for non-symmetric problems, including harmonic extraction. References: [1] "Krylov-Schur Methods in SLEPc", SLEPc Technical Report STR-7, available at http://www.grycap.upv.es/slepc. [2] G.W. Stewart, "A Krylov-Schur Algorithm for Large Eigenproblems", SIAM J. Matrix Anal. App. 23(3):601-614, 2001. [3] "Practical Implementation of Harmonic Krylov-Schur", SLEPc Technical Report STR-9, available at http://www.grycap.upv.es/slepc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #include "krylovschur.h" #undef __FUNCT__ #define __FUNCT__ "EPSGetArbitraryValues" PetscErrorCode EPSGetArbitraryValues(EPS eps,PetscScalar *rr,PetscScalar *ri) { PetscErrorCode ierr; PetscInt i,newi,ld,n,l; Vec xr=eps->work[1],xi=eps->work[2]; PetscScalar re,im,*Zr,*Zi,*X; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = DSGetDimensions(eps->ds,&n,NULL,&l,NULL,NULL);CHKERRQ(ierr); for (i=l;ieigr[i]; im = eps->eigi[i]; ierr = STBackTransform(eps->st,1,&re,&im);CHKERRQ(ierr); newi = i; ierr = DSVectors(eps->ds,DS_MAT_X,&newi,NULL);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_X,&X);CHKERRQ(ierr); Zr = X+i*ld; if (newi==i+1) Zi = X+newi*ld; else Zi = NULL; ierr = EPSComputeRitzVector(eps,Zr,Zi,eps->V,n,xr,xi);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_X,&X);CHKERRQ(ierr); ierr = (*eps->arbitrary)(re,im,xr,xi,rr+i,ri+i,eps->arbitraryctx);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_KrylovSchur" PetscErrorCode EPSSetUp_KrylovSchur(EPS eps) { PetscErrorCode ierr; PetscBool issinv; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; enum { EPS_KS_DEFAULT,EPS_KS_SYMM,EPS_KS_SLICE,EPS_KS_INDEF } variant; PetscFunctionBegin; /* spectrum slicing requires special treatment of default values */ if (eps->which==EPS_ALL) { if (eps->inta==0.0 && eps->intb==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Must define a computational interval when using EPS_ALL"); if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Spectrum slicing only available for symmetric/Hermitian eigenproblems"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs cannot be used with spectrum slicing"); if (!((PetscObject)(eps->st))->type_name) { /* default to shift-and-invert */ ierr = STSetType(eps->st,STSINVERT);CHKERRQ(ierr); } ierr = PetscObjectTypeCompareAny((PetscObject)eps->st,&issinv,STSINVERT,STCAYLEY,"");CHKERRQ(ierr); if (!issinv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Shift-and-invert or Cayley ST is needed for spectrum slicing"); #if defined(PETSC_USE_REAL_DOUBLE) if (eps->tol==PETSC_DEFAULT) eps->tol = 1e-10; /* use tighter tolerance */ #endif if (eps->intb >= PETSC_MAX_REAL) { /* right-open interval */ if (eps->inta <= PETSC_MIN_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"The defined computational interval should have at least one of their sides bounded"); ierr = STSetDefaultShift(eps->st,eps->inta);CHKERRQ(ierr); } else { ierr = STSetDefaultShift(eps->st,eps->intb);CHKERRQ(ierr); } if (eps->nev==1) eps->nev = 40; /* nev not set, use default value */ if (eps->nev<10) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"nev cannot be less than 10 in spectrum slicing runs"); eps->ops->backtransform = NULL; } if (eps->isgeneralized && eps->ishermitian && !eps->ispositive && eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not implemented for indefinite problems"); /* proceed with the general case */ if (eps->ncv) { /* ncv set */ if (eps->ncvnev+1) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev+1"); } else if (eps->mpd) { /* mpd set */ eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15)); else { eps->mpd = 500; eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } } if (!eps->mpd) eps->mpd = eps->ncv; if (eps->ncv>eps->nev+eps->mpd) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must not be larger than nev+mpd"); if (!eps->max_it) { if (eps->which==EPS_ALL) eps->max_it = 100; /* special case for spectrum slicing */ else eps->max_it = PetscMax(100,2*eps->n/eps->ncv); } if (!eps->which) { ierr = EPSSetWhichEigenpairs_Default(eps);CHKERRQ(ierr); } if (eps->ishermitian && (eps->which==EPS_LARGEST_IMAGINARY || eps->which==EPS_SMALLEST_IMAGINARY)) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (!eps->extraction) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } else if (eps->extraction!=EPS_RITZ && eps->extraction!=EPS_HARMONIC) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); if (!ctx->keep) ctx->keep = 0.5; ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); if (eps->arbitrary) { ierr = EPSSetWorkVecs(eps,3);CHKERRQ(ierr); } else if (eps->ishermitian && !eps->ispositive){ ierr = EPSSetWorkVecs(eps,2);CHKERRQ(ierr); } else { ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); } /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); if (eps->ishermitian) { if (eps->which==EPS_ALL) { if (eps->isgeneralized && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Spectrum slicing not implemented for indefinite problems"); else variant = EPS_KS_SLICE; } else if (eps->isgeneralized && !eps->ispositive) { variant = EPS_KS_INDEF; } else { switch (eps->extraction) { case EPS_RITZ: variant = EPS_KS_SYMM; break; case EPS_HARMONIC: variant = EPS_KS_DEFAULT; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); } } } else { switch (eps->extraction) { case EPS_RITZ: variant = EPS_KS_DEFAULT; break; case EPS_HARMONIC: variant = EPS_KS_DEFAULT; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); } } switch (variant) { case EPS_KS_DEFAULT: eps->ops->solve = EPSSolve_KrylovSchur_Default; ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); break; case EPS_KS_SYMM: eps->ops->solve = EPSSolve_KrylovSchur_Symm; ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); ierr = DSSetCompact(eps->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSSetExtraRow(eps->ds,PETSC_TRUE);CHKERRQ(ierr); break; case EPS_KS_SLICE: eps->ops->solve = EPSSolve_KrylovSchur_Slice; ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); ierr = DSSetCompact(eps->ds,PETSC_TRUE);CHKERRQ(ierr); break; case EPS_KS_INDEF: eps->ops->solve = EPSSolve_KrylovSchur_Indefinite; ierr = DSSetType(eps->ds,DSGHIEP);CHKERRQ(ierr); ierr = DSSetCompact(eps->ds,PETSC_TRUE);CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error"); } ierr = DSAllocate(eps->ds,eps->ncv+1);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_KrylovSchur_Default" PetscErrorCode EPSSolve_KrylovSchur_Default(EPS eps) { PetscErrorCode ierr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscInt i,j,*pj,k,l,nv,ld; Vec u=eps->work[0]; PetscScalar *S,*Q,*g; PetscReal beta,gamma=1.0; PetscBool breakdown,harmonic; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); harmonic = (eps->extraction==EPS_HARMONIC || eps->extraction==EPS_REFINED_HARMONIC)?PETSC_TRUE:PETSC_FALSE; if (harmonic) { ierr = PetscMalloc(ld*sizeof(PetscScalar),&g);CHKERRQ(ierr); } if (eps->arbitrary) pj = &j; else pj = NULL; /* Get the starting Arnoldi vector */ ierr = EPSGetStartVector(eps,0,eps->V[0],NULL);CHKERRQ(ierr); l = 0; /* Restart loop */ while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; /* Compute an nv-step Arnoldi factorization */ nv = PetscMin(eps->nconv+eps->mpd,eps->ncv); ierr = DSGetArray(eps->ds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = EPSBasicArnoldi(eps,PETSC_FALSE,S,ld,eps->V,eps->nconv+l,&nv,u,&beta,&breakdown);CHKERRQ(ierr); ierr = VecScale(u,1.0/beta);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(eps->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); } /* Compute translation of Krylov decomposition if harmonic extraction used */ if (harmonic) { ierr = DSTranslateHarmonic(eps->ds,eps->target,beta,PETSC_FALSE,g,&gamma);CHKERRQ(ierr); } /* Solve projected problem */ ierr = DSSolve(eps->ds,eps->eigr,eps->eigi);CHKERRQ(ierr); if (eps->arbitrary) { ierr = EPSGetArbitraryValues(eps,eps->rr,eps->ri);CHKERRQ(ierr); j=1; } ierr = DSSort(eps->ds,eps->eigr,eps->eigi,eps->rr,eps->ri,pj);CHKERRQ(ierr); /* Check convergence */ ierr = EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,gamma,&k);CHKERRQ(ierr); if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL; /* Update l */ if (eps->reason != EPS_CONVERGED_ITERATING || breakdown) l = 0; else { l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep)); #if !defined(PETSC_USE_COMPLEX) ierr = DSGetArray(eps->ds,DS_MAT_A,&S);CHKERRQ(ierr); if (S[k+l+(k+l-1)*ld] != 0.0) { if (k+lds,DS_MAT_A,&S);CHKERRQ(ierr); #endif } if (eps->reason == EPS_CONVERGED_ITERATING) { if (breakdown) { /* Start a new Arnoldi factorization */ ierr = PetscInfo2(eps,"Breakdown in Krylov-Schur method (it=%D norm=%G)\n",eps->its,beta);CHKERRQ(ierr); ierr = EPSGetStartVector(eps,k,eps->V[k],&breakdown);CHKERRQ(ierr); if (breakdown) { eps->reason = EPS_DIVERGED_BREAKDOWN; ierr = PetscInfo(eps,"Unable to generate more start vectors\n");CHKERRQ(ierr); } } else { /* Undo translation of Krylov decomposition */ if (harmonic) { ierr = DSSetDimensions(eps->ds,nv,0,k,l);CHKERRQ(ierr); ierr = DSTranslateHarmonic(eps->ds,0.0,beta,PETSC_TRUE,g,&gamma);CHKERRQ(ierr); /* gamma u^ = u - U*g~ */ ierr = SlepcVecMAXPBY(u,1.0,-1.0,nv,g,eps->V);CHKERRQ(ierr); ierr = VecScale(u,1.0/gamma);CHKERRQ(ierr); } /* Prepare the Rayleigh quotient for restart */ ierr = DSGetArray(eps->ds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); for (i=k;ids,DS_MAT_A,&S);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); } } /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) { ierr = VecCopy(u,eps->V[k+l]);CHKERRQ(ierr); } eps->nconv = k; ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,nv);CHKERRQ(ierr); } if (harmonic) { ierr = PetscFree(g);CHKERRQ(ierr); } /* truncate Schur decomposition and change the state to raw so that PSVectors() computes eigenvectors from scratch */ ierr = DSSetDimensions(eps->ds,eps->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSKrylovSchurSetRestart_KrylovSchur" static PetscErrorCode EPSKrylovSchurSetRestart_KrylovSchur(EPS eps,PetscReal keep) { EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; if (keep==PETSC_DEFAULT) ctx->keep = 0.5; else { if (keep<0.1 || keep>0.9) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The keep argument must be in the range [0.1,0.9]"); ctx->keep = keep; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSKrylovSchurSetRestart" /*@ EPSKrylovSchurSetRestart - Sets the restart parameter for the Krylov-Schur method, in particular the proportion of basis vectors that must be kept after restart. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - keep - the number of vectors to be kept at restart Options Database Key: . -eps_krylovschur_restart - Sets the restart parameter Notes: Allowed values are in the range [0.1,0.9]. The default is 0.5. Level: advanced .seealso: EPSKrylovSchurGetRestart() @*/ PetscErrorCode EPSKrylovSchurSetRestart(EPS eps,PetscReal keep) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveReal(eps,keep,2); ierr = PetscTryMethod(eps,"EPSKrylovSchurSetRestart_C",(EPS,PetscReal),(eps,keep));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSKrylovSchurGetRestart_KrylovSchur" static PetscErrorCode EPSKrylovSchurGetRestart_KrylovSchur(EPS eps,PetscReal *keep) { EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; *keep = ctx->keep; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSKrylovSchurGetRestart" /*@ EPSKrylovSchurGetRestart - Gets the restart parameter used in the Krylov-Schur method. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . keep - the restart parameter Level: advanced .seealso: EPSKrylovSchurSetRestart() @*/ PetscErrorCode EPSKrylovSchurGetRestart(EPS eps,PetscReal *keep) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(keep,2); ierr = PetscTryMethod(eps,"EPSKrylovSchurGetRestart_C",(EPS,PetscReal*),(eps,keep));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_KrylovSchur" PetscErrorCode EPSSetFromOptions_KrylovSchur(EPS eps) { PetscErrorCode ierr; PetscBool flg; PetscReal keep; PetscFunctionBegin; ierr = PetscOptionsHead("EPS Krylov-Schur Options");CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_krylovschur_restart","Proportion of vectors kept after restart","EPSKrylovSchurSetRestart",0.5,&keep,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSKrylovSchurSetRestart(eps,keep);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_KrylovSchur" PetscErrorCode EPSView_KrylovSchur(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscBool isascii; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," Krylov-Schur: %d%% of basis vectors kept after restart\n",(int)(100*ctx->keep));CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_KrylovSchur" PetscErrorCode EPSReset_KrylovSchur(EPS eps) { PetscErrorCode ierr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; ctx->keep = 0.0; ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_KrylovSchur" PetscErrorCode EPSDestroy_KrylovSchur(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurSetRestart_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurGetRestart_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_KrylovSchur" PETSC_EXTERN PetscErrorCode EPSCreate_KrylovSchur(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_KRYLOVSCHUR,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_KrylovSchur; eps->ops->setfromoptions = EPSSetFromOptions_KrylovSchur; eps->ops->destroy = EPSDestroy_KrylovSchur; eps->ops->reset = EPSReset_KrylovSchur; eps->ops->view = EPSView_KrylovSchur; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Schur; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurSetRestart_C",EPSKrylovSchurSetRestart_KrylovSchur);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurGetRestart_C",EPSKrylovSchurGetRestart_KrylovSchur);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ks-symm.c0000644000175000017500000001030612211062077023622 0ustar gladkgladk/* SLEPc eigensolver: "krylovschur" Method: Krylov-Schur for symmetric eigenproblems - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #include "krylovschur.h" #undef __FUNCT__ #define __FUNCT__ "EPSSolve_KrylovSchur_Symm" PetscErrorCode EPSSolve_KrylovSchur_Symm(EPS eps) { PetscErrorCode ierr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscInt k,l,ld,nv; Vec u=eps->work[0]; PetscScalar *Q; PetscReal *a,*b,beta; PetscBool breakdown; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); /* Get the starting Lanczos vector */ ierr = EPSGetStartVector(eps,0,eps->V[0],NULL);CHKERRQ(ierr); l = 0; /* Restart loop */ while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; /* Compute an nv-step Lanczos factorization */ nv = PetscMin(eps->nconv+eps->mpd,eps->ncv); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); b = a + ld; ierr = EPSFullLanczos(eps,a,b,eps->V,eps->nconv+l,&nv,u,&breakdown);CHKERRQ(ierr); beta = b[nv-1]; ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(eps->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); } /* Solve projected problem */ ierr = DSSolve(eps->ds,eps->eigr,NULL);CHKERRQ(ierr); if (eps->arbitrary) { ierr = EPSGetArbitraryValues(eps,eps->rr,eps->ri);CHKERRQ(ierr); } ierr = DSSort(eps->ds,eps->eigr,NULL,eps->rr,eps->ri,NULL);CHKERRQ(ierr); ierr = DSUpdateExtraRow(eps->ds);CHKERRQ(ierr); /* Check convergence */ ierr = EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,1.0,&k);CHKERRQ(ierr); if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL; /* Update l */ if (eps->reason != EPS_CONVERGED_ITERATING || breakdown) l = 0; else l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep)); if (eps->reason == EPS_CONVERGED_ITERATING) { if (breakdown) { /* Start a new Lanczos factorization */ ierr = PetscInfo2(eps,"Breakdown in Krylov-Schur method (it=%D norm=%G)\n",eps->its,beta);CHKERRQ(ierr); ierr = EPSGetStartVector(eps,k,eps->V[k],&breakdown);CHKERRQ(ierr); if (breakdown) { eps->reason = EPS_DIVERGED_BREAKDOWN; ierr = PetscInfo(eps,"Unable to generate more start vectors\n");CHKERRQ(ierr); } } else { /* Prepare the Rayleigh quotient for restart */ ierr = DSTruncate(eps->ds,k+l);CHKERRQ(ierr); } } /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); /* Normalize u and append it to V */ if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) { ierr = VecAXPBY(eps->V[k+l],1.0/beta,0.0,u);CHKERRQ(ierr); } ierr = EPSMonitor(eps,eps->its,k,eps->eigr,eps->eigi,eps->errest,nv);CHKERRQ(ierr); eps->nconv = k; } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ks-slice.c0000644000175000017500000007165312211062077023750 0ustar gladkgladk/* SLEPc eigensolver: "krylovschur" Method: Krylov-Schur with spectrum slicing for symmetric eigenproblems References: [1] R.G. Grimes et al., "A shifted block Lanczos algorithm for solving sparse symmetric generalized eigenproblems", SIAM J. Matrix Anal. Appl. 15(1):228-272, 1994. [2] C. Campos and J.E. Roman, "Spectrum slicing strategies based on restarted Lanczos methods", Numer. Algor. 60(2):279-295, 2012. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #include "krylovschur.h" /* Fills the fields of a shift structure */ #undef __FUNCT__ #define __FUNCT__ "EPSCreateShift" static PetscErrorCode EPSCreateShift(EPS eps,PetscReal val,shift neighb0,shift neighb1) { PetscErrorCode ierr; shift s,*pending2; PetscInt i; SR sr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; sr = ctx->sr; ierr = PetscMalloc(sizeof(struct _n_shift),&s);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,sizeof(struct _n_shift));CHKERRQ(ierr); s->value = val; s->neighb[0] = neighb0; if (neighb0) neighb0->neighb[1] = s; s->neighb[1] = neighb1; if (neighb1) neighb1->neighb[0] = s; s->comp[0] = PETSC_FALSE; s->comp[1] = PETSC_FALSE; s->index = -1; s->neigs = 0; s->nconv[0] = s->nconv[1] = 0; s->nsch[0] = s->nsch[1]=0; /* Inserts in the stack of pending shifts */ /* If needed, the array is resized */ if (sr->nPend >= sr->maxPend) { sr->maxPend *= 2; ierr = PetscMalloc((sr->maxPend)*sizeof(shift),&pending2);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,sizeof(shift));CHKERRQ(ierr); for (i=0;inPend;i++) pending2[i] = sr->pending[i]; ierr = PetscFree(sr->pending);CHKERRQ(ierr); sr->pending = pending2; } sr->pending[sr->nPend++]=s; PetscFunctionReturn(0); } /* Provides next shift to be computed */ #undef __FUNCT__ #define __FUNCT__ "EPSExtractShift" static PetscErrorCode EPSExtractShift(EPS eps) { PetscErrorCode ierr; PetscInt iner,dir,i,k,ld; PetscScalar *A; Mat F; PC pc; KSP ksp; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; SR sr; PetscFunctionBegin; sr = ctx->sr; if (sr->nPend > 0) { sr->sPrev = sr->sPres; sr->sPres = sr->pending[--sr->nPend]; ierr = STSetShift(eps->st,sr->sPres->value);CHKERRQ(ierr); ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = PCFactorGetMatrix(pc,&F);CHKERRQ(ierr); ierr = MatGetInertia(F,&iner,NULL,NULL);CHKERRQ(ierr); sr->sPres->inertia = iner; eps->target = sr->sPres->value; eps->reason = EPS_CONVERGED_ITERATING; eps->its = 0; /* For rational Krylov */ if (sr->nS>0 && (sr->sPrev == sr->sPres->neighb[0] || sr->sPrev == sr->sPres->neighb[1])) { ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); dir = (sr->sPres->neighb[0] == sr->sPrev)?1:-1; dir*=sr->dir; k = 0; for (i=0;inS;i++) { if (dir*PetscRealPart(sr->S[i])>0.0) { sr->S[k] = sr->S[i]; sr->S[sr->nS+k] = sr->S[sr->nS+i]; ierr = VecCopy(eps->V[eps->nconv+i],eps->V[k++]);CHKERRQ(ierr); if (k>=sr->nS/2)break; } } /* Copy to DS */ ierr = DSGetArray(eps->ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = PetscMemzero(A,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;iS[i]; A[k+i*ld] = sr->S[sr->nS+i]; } sr->nS = k; ierr = DSRestoreArray(eps->ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,0,0,0,k);CHKERRQ(ierr); /* Normalize u and append it to V */ ierr = VecAXPBY(eps->V[sr->nS],1.0/sr->beta,0.0,eps->work[0]);CHKERRQ(ierr); } eps->nconv = 0; } else sr->sPres = NULL; PetscFunctionReturn(0); } /* Symmetric KrylovSchur adapted to spectrum slicing: Allows searching an specific amount of eigenvalues in the subintervals left and right. Returns whether the search has succeeded */ #undef __FUNCT__ #define __FUNCT__ "EPSKrylovSchur_Slice" static PetscErrorCode EPSKrylovSchur_Slice(EPS eps) { PetscErrorCode ierr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscInt i,conv,k,l,ld,nv,*iwork,j,p; Vec u=eps->work[0]; PetscScalar *Q,*A,nu,rtmp; PetscReal *a,*b,beta; PetscBool breakdown; PetscInt count0,count1; PetscReal lambda; shift sPres; PetscBool complIterating,iscayley; PetscBool sch0,sch1; PetscInt iterCompl=0,n0,n1,aux,auxc; SR sr; PetscFunctionBegin; /* Spectrum slicing data */ sr = ctx->sr; sPres = sr->sPres; complIterating =PETSC_FALSE; sch1 = sch0 = PETSC_TRUE; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = PetscMalloc(2*ld*sizeof(PetscInt),&iwork);CHKERRQ(ierr); count0=0;count1=0; /* Found on both sides */ /* filling in values for the monitor */ if (eps->numbermonitors >0) { ierr = PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&iscayley);CHKERRQ(ierr); if (iscayley) { ierr = STCayleyGetAntishift(eps->st,&nu);CHKERRQ(ierr); for (i=0;iindexEig;i++) { sr->monit[i]=(nu + sr->eig[i])/(sr->eig[i] - sPres->value); } } else { for (i=0;iindexEig;i++) { sr->monit[i]=1.0/(sr->eig[i] - sPres->value); } } } if (sr->nS > 0 && (sPres->neighb[0] == sr->sPrev || sPres->neighb[1] == sr->sPrev)) { /* Rational Krylov */ ierr = DSTranslateRKS(eps->ds,sr->sPrev->value-sPres->value);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = DSGetDimensions(eps->ds,NULL,NULL,NULL,&l,NULL);CHKERRQ(ierr); ierr = SlepcUpdateVectors(l+1,eps->V,0,l+1,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); } else { /* Get the starting Lanczos vector */ ierr = EPSGetStartVector(eps,0,eps->V[0],NULL);CHKERRQ(ierr); l = 0; } /* Restart loop */ while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; sr->itsKs++; /* Compute an nv-step Lanczos factorization */ nv = PetscMin(eps->nconv+eps->mpd,eps->ncv); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); b = a + ld; ierr = EPSFullLanczos(eps,a,b,eps->V,eps->nconv+l,&nv,u,&breakdown);CHKERRQ(ierr); beta = b[nv-1]; ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(eps->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); } /* Solve projected problem and compute residual norm estimates */ if (eps->its == 1 && l > 0) {/* After rational update */ ierr = DSGetArray(eps->ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); b = a + ld; k = eps->nconv+l; A[k*ld+k-1] = A[(k-1)*ld+k]; A[k*ld+k] = a[k]; for (j=k+1; j< nv; j++) { A[j*ld+j] = a[j]; A[j*ld+j-1] = b[j-1] ; A[(j-1)*ld+j] = b[j-1]; } ierr = DSRestoreArray(eps->ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSSolve(eps->ds,eps->eigr,NULL);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,NULL,NULL,NULL,NULL);CHKERRQ(ierr); ierr = DSSetCompact(eps->ds,PETSC_TRUE);CHKERRQ(ierr); } else { /* Restart */ ierr = DSSolve(eps->ds,eps->eigr,NULL);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,NULL,NULL,NULL,NULL);CHKERRQ(ierr); } /* Residual */ ierr = EPSKrylovConvergence(eps,PETSC_TRUE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,1.0,&k);CHKERRQ(ierr); /* Check convergence */ ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); b = a + ld; conv = 0; j = k = eps->nconv; for (i=eps->nconv;ierrest[i] < eps->tol) conv++; for (i=eps->nconv;ierrest[i] < eps->tol) { iwork[j++]=i; } else iwork[conv+k++]=i; } for (i=eps->nconv;ieigr[i]); b[i]=eps->errest[i]; } for (i=eps->nconv;ieigr[i] = a[iwork[i]]; eps->errest[i] = b[iwork[i]]; } for (i=eps->nconv;ieigr[i]); b[i]=eps->errest[i]; } ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); for (i=eps->nconv;ids,DS_MAT_Q,&Q);CHKERRQ(ierr); k=eps->nconv+conv; /* Checking values obtained for completing */ for (i=0;iback[i]=eps->eigr[i]; } ierr = STBackTransform(eps->st,k,sr->back,eps->eigi);CHKERRQ(ierr); count0=count1=0; for (i=0;iback[i]); if (((sr->dir)*(sPres->value - lambda) > 0) && ((sr->dir)*(lambda - sPres->ext[0]) > 0)) count0++; if (((sr->dir)*(lambda - sPres->value) > 0) && ((sr->dir)*(sPres->ext[1] - lambda) > 0)) count1++; } /* Checks completion */ if ((!sch0||count0 >= sPres->nsch[0]) && (!sch1 ||count1 >= sPres->nsch[1])) { eps->reason = EPS_CONVERGED_TOL; } else { if (!complIterating && eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (complIterating) { if (--iterCompl <= 0) eps->reason = EPS_DIVERGED_ITS; } else if (k >= eps->nev) { n0 = sPres->nsch[0]-count0; n1 = sPres->nsch[1]-count1; if (sr->iterCompl>0 && ((n0>0 && n0<= sr->nMAXCompl)||(n1>0&&n1<=sr->nMAXCompl))) { /* Iterating for completion*/ complIterating = PETSC_TRUE; if (n0 >sr->nMAXCompl)sch0 = PETSC_FALSE; if (n1 >sr->nMAXCompl)sch1 = PETSC_FALSE; iterCompl = sr->iterCompl; } else eps->reason = EPS_CONVERGED_TOL; } } /* Update l */ if (eps->reason == EPS_CONVERGED_ITERATING) l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep)); else l = nv-k; if (breakdown) l=0; if (eps->reason == EPS_CONVERGED_ITERATING) { if (breakdown) { /* Start a new Lanczos factorization */ ierr = PetscInfo2(eps,"Breakdown in Krylov-Schur method (it=%D norm=%G)\n",eps->its,beta);CHKERRQ(ierr); ierr = EPSGetStartVector(eps,k,eps->V[k],&breakdown);CHKERRQ(ierr); if (breakdown) { eps->reason = EPS_DIVERGED_BREAKDOWN; ierr = PetscInfo(eps,"Unable to generate more start vectors\n");CHKERRQ(ierr); } } else { /* Prepare the Rayleigh quotient for restart */ ierr = DSGetArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); b = a + ld; for (i=k;ieigr[i]); b[i] = PetscRealPart(Q[nv-1+i*ld]*beta); } ierr = DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); } } /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); /* Normalize u and append it to V */ if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) { ierr = VecAXPBY(eps->V[k+l],1.0/beta,0.0,u);CHKERRQ(ierr); } /* Monitor */ if (eps->numbermonitors >0) { aux = auxc = 0; for (i=0;iback[i]=eps->eigr[i]; } ierr = STBackTransform(eps->st,nv,sr->back,eps->eigi);CHKERRQ(ierr); for (i=0;iback[i]); if (((sr->dir)*(lambda - sPres->ext[0]) > 0)&& ((sr->dir)*(sPres->ext[1] - lambda) > 0)) { sr->monit[sr->indexEig+aux]=eps->eigr[i]; sr->errest[sr->indexEig+aux]=eps->errest[i]; aux++; if (eps->errest[i] < eps->tol)auxc++; } } ierr = EPSMonitor(eps,eps->its,auxc+sr->indexEig,sr->monit,sr->eigi,sr->errest,sr->indexEig+aux);CHKERRQ(ierr); } eps->nconv = k; if (eps->reason != EPS_CONVERGED_ITERATING) { /* Store approximated values for next shift */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); sr->nS = l; for (i=0;iS[i] = eps->eigr[i+k];/* Diagonal elements */ sr->S[i+l] = Q[nv-1+(i+k)*ld]*beta; /* Out of diagonal elements */ } sr->beta = beta; ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); } } /* Check for completion */ for (i=0;i< eps->nconv; i++) { if ((sr->dir)*PetscRealPart(eps->eigr[i])>0) sPres->nconv[1]++; else sPres->nconv[0]++; } sPres->comp[0] = (count0 >= sPres->nsch[0])?PETSC_TRUE:PETSC_FALSE; sPres->comp[1] = (count1 >= sPres->nsch[1])?PETSC_TRUE:PETSC_FALSE; if (count0 > sPres->nsch[0] || count1 > sPres->nsch[1])SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing!\nMismatch between number of values found and information from inertia"); ierr = PetscFree(iwork);CHKERRQ(ierr); PetscFunctionReturn(0); } /* Obtains value of subsequent shift */ #undef __FUNCT__ #define __FUNCT__ "EPSGetNewShiftValue" static PetscErrorCode EPSGetNewShiftValue(EPS eps,PetscInt side,PetscReal *newS) { PetscReal lambda,d_prev; PetscInt i,idxP; SR sr; shift sPres,s; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; sr = ctx->sr; sPres = sr->sPres; if (sPres->neighb[side]) { /* Completing a previous interval */ if (!sPres->neighb[side]->neighb[side] && sPres->neighb[side]->nconv[side]==0) { /* One of the ends might be too far from eigenvalues */ if (side) *newS = (sPres->value + PetscRealPart(sr->eig[sr->perm[sr->indexEig-1]]))/2; else *newS = (sPres->value + PetscRealPart(sr->eig[sr->perm[0]]))/2; } else *newS=(sPres->value + sPres->neighb[side]->value)/2; } else { /* (Only for side=1). Creating a new interval. */ if (sPres->neigs==0) {/* No value has been accepted*/ if (sPres->neighb[0]) { /* Multiplying by 10 the previous distance */ *newS = sPres->value + 10*(sr->dir)*PetscAbsReal(sPres->value - sPres->neighb[0]->value); sr->nleap++; /* Stops when the interval is open and no values are found in the last 5 shifts (there might be infinite eigenvalues) */ if (!sr->hasEnd && sr->nleap > 5) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unable to compute the wanted eigenvalues with open interval"); } else { /* First shift */ if (eps->nconv != 0) { /* Unaccepted values give information for next shift */ idxP=0;/* Number of values left from shift */ for (i=0;inconv;i++) { lambda = PetscRealPart(eps->eigr[i]); if ((sr->dir)*(lambda - sPres->value) <0) idxP++; else break; } /* Avoiding subtraction of eigenvalues (might be the same).*/ if (idxP>0) { d_prev = PetscAbsReal(sPres->value - PetscRealPart(eps->eigr[0]))/(idxP+0.3); } else { d_prev = PetscAbsReal(sPres->value - PetscRealPart(eps->eigr[eps->nconv-1]))/(eps->nconv+0.3); } *newS = sPres->value + ((sr->dir)*d_prev*eps->nev)/2; } else { /* No values found, no information for next shift */ SETERRQ(PetscObjectComm((PetscObject)eps),1,"First shift renders no information"); } } } else { /* Accepted values found */ sr->nleap = 0; /* Average distance of values in previous subinterval */ s = sPres->neighb[0]; while (s && PetscAbs(s->inertia - sPres->inertia)==0) { s = s->neighb[0];/* Looking for previous shifts with eigenvalues within */ } if (s) { d_prev = PetscAbsReal((sPres->value - s->value)/(sPres->inertia - s->inertia)); } else { /* First shift. Average distance obtained with values in this shift */ /* first shift might be too far from first wanted eigenvalue (no values found outside the interval)*/ if ((sr->dir)*(PetscRealPart(sr->eig[0])-sPres->value)>0 && PetscAbsReal((PetscRealPart(sr->eig[sr->indexEig-1]) - PetscRealPart(sr->eig[0]))/PetscRealPart(sr->eig[0])) > PetscSqrtReal(eps->tol)) { d_prev = PetscAbsReal((PetscRealPart(sr->eig[sr->indexEig-1]) - PetscRealPart(sr->eig[0])))/(sPres->neigs+0.3); } else { d_prev = PetscAbsReal(PetscRealPart(sr->eig[sr->indexEig-1]) - sPres->value)/(sPres->neigs+0.3); } } /* Average distance is used for next shift by adding it to value on the right or to shift */ if ((sr->dir)*(PetscRealPart(sr->eig[sPres->index + sPres->neigs -1]) - sPres->value)>0) { *newS = PetscRealPart(sr->eig[sPres->index + sPres->neigs -1])+ ((sr->dir)*d_prev*(eps->nev))/2; } else { /* Last accepted value is on the left of shift. Adding to shift */ *newS = sPres->value + ((sr->dir)*d_prev*(eps->nev))/2; } } /* End of interval can not be surpassed */ if ((sr->dir)*(sr->int1 - *newS) < 0) *newS = sr->int1; }/* of neighb[side]==null */ PetscFunctionReturn(0); } /* Function for sorting an array of real values */ #undef __FUNCT__ #define __FUNCT__ "sortRealEigenvalues" static PetscErrorCode sortRealEigenvalues(PetscScalar *r,PetscInt *perm,PetscInt nr,PetscBool prev,PetscInt dir) { PetscReal re; PetscInt i,j,tmp; PetscFunctionBegin; if (!prev) for (i=0;i=0 && dir*(re - PetscRealPart(r[perm[j]])) <= 0) { tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; j--; } } PetscFunctionReturn(0); } /* Stores the pairs obtained since the last shift in the global arrays */ #undef __FUNCT__ #define __FUNCT__ "EPSStoreEigenpairs" static PetscErrorCode EPSStoreEigenpairs(EPS eps) { PetscErrorCode ierr; PetscReal lambda,err,norm; PetscInt i,count; PetscBool iscayley; SR sr; shift sPres; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; sr = ctx->sr; sPres = sr->sPres; sPres->index = sr->indexEig; count = sr->indexEig; /* Back-transform */ ierr = EPSBackTransform_Default(eps);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&iscayley);CHKERRQ(ierr); /* Sort eigenvalues */ ierr = sortRealEigenvalues(eps->eigr,eps->perm,eps->nconv,PETSC_FALSE,sr->dir);CHKERRQ(ierr); /* Values stored in global array */ for (i=0;inconv;i++) { lambda = PetscRealPart(eps->eigr[eps->perm[i]]); err = eps->errest[eps->perm[i]]; if ((sr->dir)*(lambda - sPres->ext[0]) > 0 && (sr->dir)*(sPres->ext[1] - lambda) > 0) {/* Valid value */ if (count>=sr->numEigs) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing"); sr->eig[count] = lambda; sr->errest[count] = err; /* Explicit purification */ ierr = STApply(eps->st,eps->V[eps->perm[i]],sr->V[count]);CHKERRQ(ierr); ierr = IPNorm(eps->ip,sr->V[count],&norm);CHKERRQ(ierr); ierr = VecScale(sr->V[count],1.0/norm);CHKERRQ(ierr); count++; } } sPres->neigs = count - sr->indexEig; sr->indexEig = count; /* Global ordering array updating */ ierr = sortRealEigenvalues(sr->eig,sr->perm,count,PETSC_TRUE,sr->dir);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSLookForDeflation" static PetscErrorCode EPSLookForDeflation(EPS eps) { PetscReal val; PetscInt i,count0=0,count1=0; shift sPres; PetscInt ini,fin,k,idx0,idx1; SR sr; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; sr = ctx->sr; sPres = sr->sPres; if (sPres->neighb[0]) ini = (sr->dir)*(sPres->neighb[0]->inertia - sr->inertia0); else ini = 0; fin = sr->indexEig; /* Selection of ends for searching new values */ if (!sPres->neighb[0]) sPres->ext[0] = sr->int0;/* First shift */ else sPres->ext[0] = sPres->neighb[0]->value; if (!sPres->neighb[1]) { if (sr->hasEnd) sPres->ext[1] = sr->int1; else sPres->ext[1] = (sr->dir > 0)?PETSC_MAX_REAL:PETSC_MIN_REAL; } else sPres->ext[1] = sPres->neighb[1]->value; /* Selection of values between right and left ends */ for (i=ini;ieig[sr->perm[i]]); /* Values to the right of left shift */ if ((sr->dir)*(val - sPres->ext[1]) < 0) { if ((sr->dir)*(val - sPres->value) < 0) count0++; else count1++; } else break; } /* The number of values on each side are found */ if (sPres->neighb[0]) { sPres->nsch[0] = (sr->dir)*(sPres->inertia - sPres->neighb[0]->inertia)-count0; if (sPres->nsch[0]<0)SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing!\nMismatch between number of values found and information from inertia"); } else sPres->nsch[0] = 0; if (sPres->neighb[1]) { sPres->nsch[1] = (sr->dir)*(sPres->neighb[1]->inertia - sPres->inertia) - count1; if (sPres->nsch[1]<0)SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing!\nMismatch between number of values found and information from inertia"); } else sPres->nsch[1] = (sr->dir)*(sr->inertia1 - sPres->inertia); /* Completing vector of indexes for deflation */ idx0 = ini; idx1 = ini+count0+count1; k=0; for (i=idx0;iidxDef[k++]=sr->perm[i]; for (i=0;iVDef[i]=sr->V[sr->idxDef[i]]; eps->defl = sr->VDef; eps->nds = k; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_KrylovSchur_Slice" PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS eps) { PetscErrorCode ierr; PetscInt i,lds; PetscReal newS; KSP ksp; PC pc; Mat F; PetscReal *errest_left; Vec t; SR sr; shift s; EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct _n_SR),&sr);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,sizeof(struct _n_SR));CHKERRQ(ierr); ctx->sr = sr; sr->itsKs = 0; sr->nleap = 0; sr->nMAXCompl = eps->nev/4; sr->iterCompl = eps->max_it/4; sr->sPres = NULL; sr->nS = 0; lds = PetscMin(eps->mpd,eps->ncv); /* Checking presence of ends and finding direction */ if (eps->inta > PETSC_MIN_REAL) { sr->int0 = eps->inta; sr->int1 = eps->intb; sr->dir = 1; if (eps->intb >= PETSC_MAX_REAL) { /* Right-open interval */ sr->hasEnd = PETSC_FALSE; sr->inertia1 = eps->n; } else sr->hasEnd = PETSC_TRUE; } else { /* Left-open interval */ sr->int0 = eps->intb; sr->int1 = eps->inta; sr->dir = -1; sr->hasEnd = PETSC_FALSE; sr->inertia1 = 0; } /* Array of pending shifts */ sr->maxPend = 100;/* Initial size */ ierr = PetscMalloc((sr->maxPend)*sizeof(shift),&sr->pending);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,(sr->maxPend)*sizeof(shift));CHKERRQ(ierr); if (sr->hasEnd) { ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = PCFactorGetMatrix(pc,&F);CHKERRQ(ierr); /* Not looking for values in b (just inertia).*/ ierr = MatGetInertia(F,&sr->inertia1,NULL,NULL);CHKERRQ(ierr); ierr = PCReset(pc);CHKERRQ(ierr); /* avoiding memory leak */ } sr->nPend = 0; ierr = EPSCreateShift(eps,sr->int0,NULL,NULL);CHKERRQ(ierr); ierr = EPSExtractShift(eps);CHKERRQ(ierr); sr->s0 = sr->sPres; sr->inertia0 = sr->s0->inertia; sr->numEigs = (sr->dir)*(sr->inertia1 - sr->inertia0); sr->indexEig = 0; /* Only with eigenvalues present in the interval ...*/ if (sr->numEigs==0) { eps->reason = EPS_CONVERGED_TOL; ierr = PetscFree(sr->s0);CHKERRQ(ierr); ierr = PetscFree(sr->pending);CHKERRQ(ierr); ierr = PetscFree(sr);CHKERRQ(ierr); PetscFunctionReturn(0); } /* Memory reservation for eig, V and perm */ ierr = PetscMalloc(lds*lds*sizeof(PetscScalar),&sr->S);CHKERRQ(ierr); ierr = PetscMemzero(sr->S,lds*lds*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMalloc(sr->numEigs*sizeof(PetscScalar),&sr->eig);CHKERRQ(ierr); ierr = PetscMalloc(sr->numEigs*sizeof(PetscScalar),&sr->eigi);CHKERRQ(ierr); ierr = PetscMalloc((sr->numEigs+eps->ncv)*sizeof(PetscReal),&sr->errest);CHKERRQ(ierr); ierr = PetscMalloc((sr->numEigs+eps->ncv)*sizeof(PetscReal),&errest_left);CHKERRQ(ierr); ierr = PetscMalloc((sr->numEigs+eps->ncv)*sizeof(PetscScalar),&sr->monit);CHKERRQ(ierr); ierr = PetscMalloc((eps->ncv)*sizeof(PetscScalar),&sr->back);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,(lds*lds+3*sr->numEigs+eps->ncv)*sizeof(PetscScalar)+2*(sr->numEigs+eps->ncv)*sizeof(PetscReal));CHKERRQ(ierr); for (i=0;inumEigs;i++) { sr->eig[i] = 0.0; sr->eigi[i] = 0.0; } for (i=0;inumEigs+eps->ncv;i++) { errest_left[i] = 0.0; sr->errest[i] = 0.0; sr->monit[i] = 0.0; } ierr = VecCreateMPI(PetscObjectComm((PetscObject)eps),eps->nloc,PETSC_DECIDE,&t);CHKERRQ(ierr); ierr = VecDuplicateVecs(t,sr->numEigs,&sr->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,sr->numEigs,sr->V);CHKERRQ(ierr); ierr = VecDestroy(&t);CHKERRQ(ierr); /* Vector for maintaining order of eigenvalues */ ierr = PetscMalloc(sr->numEigs*sizeof(PetscInt),&sr->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,sr->numEigs*sizeof(PetscInt));CHKERRQ(ierr); for (i=0;i< sr->numEigs;i++) sr->perm[i]=i; /* Vectors for deflation */ ierr = PetscMalloc(sr->numEigs*sizeof(PetscInt),&sr->idxDef);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,sr->numEigs*sizeof(PetscInt));CHKERRQ(ierr); ierr = PetscMalloc(sr->numEigs*sizeof(Vec),&sr->VDef);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,sr->numEigs*sizeof(Vec));CHKERRQ(ierr); sr->indexEig = 0; /* Main loop */ while (sr->sPres) { /* Search for deflation */ ierr = EPSLookForDeflation(eps);CHKERRQ(ierr); /* KrylovSchur */ ierr = EPSKrylovSchur_Slice(eps);CHKERRQ(ierr); ierr = EPSStoreEigenpairs(eps);CHKERRQ(ierr); /* Select new shift */ if (!sr->sPres->comp[1]) { ierr = EPSGetNewShiftValue(eps,1,&newS);CHKERRQ(ierr); ierr = EPSCreateShift(eps,newS,sr->sPres,sr->sPres->neighb[1]);CHKERRQ(ierr); } if (!sr->sPres->comp[0]) { /* Completing earlier interval */ ierr = EPSGetNewShiftValue(eps,0,&newS);CHKERRQ(ierr); ierr = EPSCreateShift(eps,newS,sr->sPres->neighb[0],sr->sPres);CHKERRQ(ierr); } /* Preparing for a new search of values */ ierr = EPSExtractShift(eps);CHKERRQ(ierr); } /* Updating eps values prior to exit */ ierr = VecDestroyVecs(eps->allocated_ncv,&eps->V);CHKERRQ(ierr); eps->V = sr->V; ierr = PetscFree(sr->S);CHKERRQ(ierr); ierr = PetscFree(eps->eigr);CHKERRQ(ierr); ierr = PetscFree(eps->eigi);CHKERRQ(ierr); ierr = PetscFree(eps->errest);CHKERRQ(ierr); ierr = PetscFree(eps->errest_left);CHKERRQ(ierr); ierr = PetscFree(eps->perm);CHKERRQ(ierr); eps->eigr = sr->eig; eps->eigi = sr->eigi; eps->errest = sr->errest; eps->errest_left = errest_left; eps->perm = sr->perm; eps->ncv = eps->allocated_ncv = sr->numEigs; eps->nconv = sr->indexEig; eps->reason = EPS_CONVERGED_TOL; eps->its = sr->itsKs; eps->nds = 0; eps->defl = NULL; eps->evecsavailable = PETSC_TRUE; ierr = PetscFree(sr->VDef);CHKERRQ(ierr); ierr = PetscFree(sr->idxDef);CHKERRQ(ierr); ierr = PetscFree(sr->pending);CHKERRQ(ierr); ierr = PetscFree(sr->monit);CHKERRQ(ierr); ierr = PetscFree(sr->back);CHKERRQ(ierr); /* Reviewing list of shifts to free memory */ s = sr->s0; if (s) { while (s->neighb[1]) { s = s->neighb[1]; ierr = PetscFree(s->neighb[0]);CHKERRQ(ierr); } ierr = PetscFree(s);CHKERRQ(ierr); } ierr = PetscFree(sr);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ks-slice.c.html0000644000175000017500000017060412211062077024707 0ustar gladkgladk
Actual source code: ks-slice.c

  1: /*

  3:    SLEPc eigensolver: "krylovschur"

  5:    Method: Krylov-Schur with spectrum slicing for symmetric eigenproblems

  7:    References:

  9:        [1] R.G. Grimes et al., "A shifted block Lanczos algorithm for
 10:            solving sparse symmetric generalized eigenproblems", SIAM J.
 11:            Matrix Anal. Appl. 15(1):228-272, 1994.

 13:        [2] C. Campos and J.E. Roman, "Spectrum slicing strategies based
 14:            on restarted Lanczos methods", Numer. Algor. 60(2):279-295,
 15:            2012.

 17:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 18:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 19:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 21:    This file is part of SLEPc.

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

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

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

 37: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 38: #include <slepcblaslapack.h>
 39:  #include krylovschur.h

 41: /*
 42:    Fills the fields of a shift structure

 44: */
 47: static PetscErrorCode EPSCreateShift(EPS eps,PetscReal val,shift neighb0,shift neighb1)
 48: {
 49:   PetscErrorCode   ierr;
 50:   shift            s,*pending2;
 51:   PetscInt         i;
 52:   SR               sr;
 53:   EPS_KRYLOVSCHUR  *ctx = (EPS_KRYLOVSCHUR*)eps->data;

 56:   sr = ctx->sr;
 57:   PetscMalloc(sizeof(struct _n_shift),&s);
 58:   PetscLogObjectMemory(eps,sizeof(struct _n_shift));
 59:   s->value = val;
 60:   s->neighb[0] = neighb0;
 61:   if (neighb0) neighb0->neighb[1] = s;
 62:   s->neighb[1] = neighb1;
 63:   if (neighb1) neighb1->neighb[0] = s;
 64:   s->comp[0] = PETSC_FALSE;
 65:   s->comp[1] = PETSC_FALSE;
 66:   s->index = -1;
 67:   s->neigs = 0;
 68:   s->nconv[0] = s->nconv[1] = 0;
 69:   s->nsch[0] = s->nsch[1]=0;
 70:   /* Inserts in the stack of pending shifts */
 71:   /* If needed, the array is resized */
 72:   if (sr->nPend >= sr->maxPend) {
 73:     sr->maxPend *= 2;
 74:     PetscMalloc((sr->maxPend)*sizeof(shift),&pending2);
 75:     PetscLogObjectMemory(eps,sizeof(shift));
 76:     for (i=0;i<sr->nPend;i++) pending2[i] = sr->pending[i];
 77:     PetscFree(sr->pending);
 78:     sr->pending = pending2;
 79:   }
 80:   sr->pending[sr->nPend++]=s;
 81:   return(0);
 82: }

 84: /* Provides next shift to be computed */
 87: static PetscErrorCode EPSExtractShift(EPS eps)
 88: {
 89:   PetscErrorCode   ierr;
 90:   PetscInt         iner,dir,i,k,ld;
 91:   PetscScalar      *A;
 92:   Mat              F;
 93:   PC               pc;
 94:   KSP              ksp;
 95:   EPS_KRYLOVSCHUR  *ctx = (EPS_KRYLOVSCHUR*)eps->data;
 96:   SR               sr;

 99:   sr = ctx->sr;
100:   if (sr->nPend > 0) {
101:     sr->sPrev = sr->sPres;
102:     sr->sPres = sr->pending[--sr->nPend];
103:     STSetShift(eps->st,sr->sPres->value);
104:     STGetKSP(eps->st,&ksp);
105:     KSPGetPC(ksp,&pc);
106:     PCFactorGetMatrix(pc,&F);
107:     MatGetInertia(F,&iner,NULL,NULL);
108:     sr->sPres->inertia = iner;
109:     eps->target = sr->sPres->value;
110:     eps->reason = EPS_CONVERGED_ITERATING;
111:     eps->its = 0;
112:     /* For rational Krylov */
113:     if (sr->nS>0 && (sr->sPrev == sr->sPres->neighb[0] || sr->sPrev == sr->sPres->neighb[1])) {
114:       DSGetLeadingDimension(eps->ds,&ld);
115:       dir = (sr->sPres->neighb[0] == sr->sPrev)?1:-1;
116:       dir*=sr->dir;
117:       k = 0;
118:       for (i=0;i<sr->nS;i++) {
119:         if (dir*PetscRealPart(sr->S[i])>0.0) {
120:           sr->S[k] = sr->S[i];
121:           sr->S[sr->nS+k] = sr->S[sr->nS+i];
122:           VecCopy(eps->V[eps->nconv+i],eps->V[k++]);
123:           if (k>=sr->nS/2)break;
124:         }
125:       }
126:       /* Copy to DS */
127:       DSGetArray(eps->ds,DS_MAT_A,&A);
128:       PetscMemzero(A,ld*ld*sizeof(PetscScalar));
129:       for (i=0;i<k;i++) {
130:         A[i*(1+ld)] = sr->S[i];
131:         A[k+i*ld] = sr->S[sr->nS+i];
132:       }
133:       sr->nS = k;
134:       DSRestoreArray(eps->ds,DS_MAT_A,&A);
135:       DSSetDimensions(eps->ds,0,0,0,k);
136:       /* Normalize u and append it to V */
137:       VecAXPBY(eps->V[sr->nS],1.0/sr->beta,0.0,eps->work[0]);
138:     }
139:     eps->nconv = 0;
140:   } else sr->sPres = NULL;
141:   return(0);
142: }

144: /*
145:    Symmetric KrylovSchur adapted to spectrum slicing:
146:    Allows searching an specific amount of eigenvalues in the subintervals left and right.
147:    Returns whether the search has succeeded
148: */
151: static PetscErrorCode EPSKrylovSchur_Slice(EPS eps)
152: {
153:   PetscErrorCode  ierr;
154:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;
155:   PetscInt        i,conv,k,l,ld,nv,*iwork,j,p;
156:   Vec             u=eps->work[0];
157:   PetscScalar     *Q,*A,nu,rtmp;
158:   PetscReal       *a,*b,beta;
159:   PetscBool       breakdown;
160:   PetscInt        count0,count1;
161:   PetscReal       lambda;
162:   shift           sPres;
163:   PetscBool       complIterating,iscayley;
164:   PetscBool       sch0,sch1;
165:   PetscInt        iterCompl=0,n0,n1,aux,auxc;
166:   SR              sr;

169:   /* Spectrum slicing data */
170:   sr = ctx->sr;
171:   sPres = sr->sPres;
172:   complIterating =PETSC_FALSE;
173:   sch1 = sch0 = PETSC_TRUE;
174:   DSGetLeadingDimension(eps->ds,&ld);
175:   PetscMalloc(2*ld*sizeof(PetscInt),&iwork);
176:   count0=0;count1=0; /* Found on both sides */
177:   /* filling in values for the monitor */
178:   if (eps->numbermonitors >0) {
179:     PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&iscayley);
180:     if (iscayley) {
181:       STCayleyGetAntishift(eps->st,&nu);
182:       for (i=0;i<sr->indexEig;i++) {
183:         sr->monit[i]=(nu + sr->eig[i])/(sr->eig[i] - sPres->value);
184:       }
185:     } else {
186:       for (i=0;i<sr->indexEig;i++) {
187:         sr->monit[i]=1.0/(sr->eig[i] - sPres->value);
188:       }
189:     }
190:   }
191:   if (sr->nS > 0 && (sPres->neighb[0] == sr->sPrev || sPres->neighb[1] == sr->sPrev)) {
192:     /* Rational Krylov */
193:     DSTranslateRKS(eps->ds,sr->sPrev->value-sPres->value);
194:     DSGetArray(eps->ds,DS_MAT_Q,&Q);
195:     DSGetDimensions(eps->ds,NULL,NULL,NULL,&l,NULL);
196:     SlepcUpdateVectors(l+1,eps->V,0,l+1,Q,ld,PETSC_FALSE);
197:     DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
198:   } else {
199:     /* Get the starting Lanczos vector */
200:     EPSGetStartVector(eps,0,eps->V[0],NULL);
201:     l = 0;
202:   }
203:   /* Restart loop */
204:   while (eps->reason == EPS_CONVERGED_ITERATING) {
205:     eps->its++; sr->itsKs++;
206:     /* Compute an nv-step Lanczos factorization */
207:     nv = PetscMin(eps->nconv+eps->mpd,eps->ncv);
208:     DSGetArrayReal(eps->ds,DS_MAT_T,&a);
209:     b = a + ld;
210:     EPSFullLanczos(eps,a,b,eps->V,eps->nconv+l,&nv,u,&breakdown);
211:     beta = b[nv-1];
212:     DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
213:     DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);
214:     if (l==0) {
215:       DSSetState(eps->ds,DS_STATE_INTERMEDIATE);
216:     } else {
217:       DSSetState(eps->ds,DS_STATE_RAW);
218:     }

220:     /* Solve projected problem and compute residual norm estimates */
221:     if (eps->its == 1 && l > 0) {/* After rational update */
222:       DSGetArray(eps->ds,DS_MAT_A,&A);
223:       DSGetArrayReal(eps->ds,DS_MAT_T,&a);
224:       b = a + ld;
225:       k = eps->nconv+l;
226:       A[k*ld+k-1] = A[(k-1)*ld+k];
227:       A[k*ld+k] = a[k];
228:       for (j=k+1; j< nv; j++) {
229:         A[j*ld+j] = a[j];
230:         A[j*ld+j-1] = b[j-1] ;
231:         A[(j-1)*ld+j] = b[j-1];
232:       }
233:       DSRestoreArray(eps->ds,DS_MAT_A,&A);
234:       DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
235:       DSSolve(eps->ds,eps->eigr,NULL);
236:       DSSort(eps->ds,eps->eigr,NULL,NULL,NULL,NULL);
237:       DSSetCompact(eps->ds,PETSC_TRUE);
238:     } else { /* Restart */
239:       DSSolve(eps->ds,eps->eigr,NULL);
240:       DSSort(eps->ds,eps->eigr,NULL,NULL,NULL,NULL);
241:     }
242:     /* Residual */
243:     EPSKrylovConvergence(eps,PETSC_TRUE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,1.0,&k);

245:     /* Check convergence */
246:     DSGetArrayReal(eps->ds,DS_MAT_T,&a);
247:     b = a + ld;
248:     conv = 0;
249:     j = k = eps->nconv;
250:     for (i=eps->nconv;i<nv;i++) if (eps->errest[i] < eps->tol) conv++;
251:     for (i=eps->nconv;i<nv;i++) {
252:       if (eps->errest[i] < eps->tol) {
253:         iwork[j++]=i;
254:       } else iwork[conv+k++]=i;
255:     }
256:     for (i=eps->nconv;i<nv;i++) {
257:       a[i]=PetscRealPart(eps->eigr[i]);
258:       b[i]=eps->errest[i];
259:     }
260:     for (i=eps->nconv;i<nv;i++) {
261:       eps->eigr[i] = a[iwork[i]];
262:       eps->errest[i] = b[iwork[i]];
263:     }
264:     for (i=eps->nconv;i<nv;i++) {
265:       a[i]=PetscRealPart(eps->eigr[i]);
266:       b[i]=eps->errest[i];
267:     }
268:     DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
269:     DSGetArray(eps->ds,DS_MAT_Q,&Q);
270:     for (i=eps->nconv;i<nv;i++) {
271:       p=iwork[i];
272:       if (p!=i) {
273:         j=i+1;
274:         while (iwork[j]!=i) j++;
275:         iwork[j]=p;iwork[i]=i;
276:         for (k=0;k<nv;k++) {
277:           rtmp=Q[k+p*ld];Q[k+p*ld]=Q[k+i*ld];Q[k+i*ld]=rtmp;
278:         }
279:       }
280:     }
281:     DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
282:     k=eps->nconv+conv;

284:     /* Checking values obtained for completing */
285:     for (i=0;i<k;i++) {
286:       sr->back[i]=eps->eigr[i];
287:     }
288:     STBackTransform(eps->st,k,sr->back,eps->eigi);
289:     count0=count1=0;
290:     for (i=0;i<k;i++) {
291:       lambda = PetscRealPart(sr->back[i]);
292:       if (((sr->dir)*(sPres->value - lambda) > 0) && ((sr->dir)*(lambda - sPres->ext[0]) > 0)) count0++;
293:       if (((sr->dir)*(lambda - sPres->value) > 0) && ((sr->dir)*(sPres->ext[1] - lambda) > 0)) count1++;
294:     }

296:     /* Checks completion */
297:     if ((!sch0||count0 >= sPres->nsch[0]) && (!sch1 ||count1 >= sPres->nsch[1])) {
298:       eps->reason = EPS_CONVERGED_TOL;
299:     } else {
300:       if (!complIterating && eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
301:       if (complIterating) {
302:         if (--iterCompl <= 0) eps->reason = EPS_DIVERGED_ITS;
303:       } else if (k >= eps->nev) {
304:         n0 = sPres->nsch[0]-count0;
305:         n1 = sPres->nsch[1]-count1;
306:         if (sr->iterCompl>0 && ((n0>0 && n0<= sr->nMAXCompl)||(n1>0&&n1<=sr->nMAXCompl))) {
307:           /* Iterating for completion*/
308:           complIterating = PETSC_TRUE;
309:           if (n0 >sr->nMAXCompl)sch0 = PETSC_FALSE;
310:           if (n1 >sr->nMAXCompl)sch1 = PETSC_FALSE;
311:           iterCompl = sr->iterCompl;
312:         } else eps->reason = EPS_CONVERGED_TOL;
313:       }
314:     }
315:     /* Update l */
316:     if (eps->reason == EPS_CONVERGED_ITERATING) l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep));
317:     else l = nv-k;
318:     if (breakdown) l=0;

320:     if (eps->reason == EPS_CONVERGED_ITERATING) {
321:       if (breakdown) {
322:         /* Start a new Lanczos factorization */
323:         PetscInfo2(eps,"Breakdown in Krylov-Schur method (it=%D norm=%G)\n",eps->its,beta);
324:         EPSGetStartVector(eps,k,eps->V[k],&breakdown);
325:         if (breakdown) {
326:           eps->reason = EPS_DIVERGED_BREAKDOWN;
327:           PetscInfo(eps,"Unable to generate more start vectors\n");
328:         }
329:       } else {
330:         /* Prepare the Rayleigh quotient for restart */
331:         DSGetArrayReal(eps->ds,DS_MAT_T,&a);
332:         DSGetArray(eps->ds,DS_MAT_Q,&Q);
333:         b = a + ld;
334:         for (i=k;i<k+l;i++) {
335:           a[i] = PetscRealPart(eps->eigr[i]);
336:           b[i] = PetscRealPart(Q[nv-1+i*ld]*beta);
337:         }
338:         DSRestoreArrayReal(eps->ds,DS_MAT_T,&a);
339:         DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
340:       }
341:     }
342:     /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
343:     DSGetArray(eps->ds,DS_MAT_Q,&Q);
344:     SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);
345:     DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
346:     /* Normalize u and append it to V */
347:     if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) {
348:       VecAXPBY(eps->V[k+l],1.0/beta,0.0,u);
349:     }
350:     /* Monitor */
351:     if (eps->numbermonitors >0) {
352:       aux = auxc = 0;
353:       for (i=0;i<nv;i++) {
354:         sr->back[i]=eps->eigr[i];
355:       }
356:       STBackTransform(eps->st,nv,sr->back,eps->eigi);
357:       for (i=0;i<nv;i++) {
358:         lambda = PetscRealPart(sr->back[i]);
359:         if (((sr->dir)*(lambda - sPres->ext[0]) > 0)&& ((sr->dir)*(sPres->ext[1] - lambda) > 0)) {
360:           sr->monit[sr->indexEig+aux]=eps->eigr[i];
361:           sr->errest[sr->indexEig+aux]=eps->errest[i];
362:           aux++;
363:           if (eps->errest[i] < eps->tol)auxc++;
364:         }
365:       }
366:       EPSMonitor(eps,eps->its,auxc+sr->indexEig,sr->monit,sr->eigi,sr->errest,sr->indexEig+aux);
367:     }
368:     eps->nconv = k;
369:     if (eps->reason != EPS_CONVERGED_ITERATING) {
370:       /* Store approximated values for next shift */
371:       DSGetArray(eps->ds,DS_MAT_Q,&Q);
372:       sr->nS = l;
373:       for (i=0;i<l;i++) {
374:         sr->S[i] = eps->eigr[i+k];/* Diagonal elements */
375:         sr->S[i+l] = Q[nv-1+(i+k)*ld]*beta; /* Out of diagonal elements */
376:       }
377:       sr->beta = beta;
378:       DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
379:     }
380:   }
381:   /* Check for completion */
382:   for (i=0;i< eps->nconv; i++) {
383:     if ((sr->dir)*PetscRealPart(eps->eigr[i])>0) sPres->nconv[1]++;
384:     else sPres->nconv[0]++;
385:   }
386:   sPres->comp[0] = (count0 >= sPres->nsch[0])?PETSC_TRUE:PETSC_FALSE;
387:   sPres->comp[1] = (count1 >= sPres->nsch[1])?PETSC_TRUE:PETSC_FALSE;
388:   if (count0 > sPres->nsch[0] || count1 > sPres->nsch[1])SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing!\nMismatch between number of values found and information from inertia");
389:   PetscFree(iwork);
390:   return(0);
391: }

393: /*
394:   Obtains value of subsequent shift
395: */
398: static PetscErrorCode EPSGetNewShiftValue(EPS eps,PetscInt side,PetscReal *newS)
399: {
400:   PetscReal       lambda,d_prev;
401:   PetscInt        i,idxP;
402:   SR              sr;
403:   shift           sPres,s;
404:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

407:   sr = ctx->sr;
408:   sPres = sr->sPres;
409:   if (sPres->neighb[side]) {
410:   /* Completing a previous interval */
411:     if (!sPres->neighb[side]->neighb[side] && sPres->neighb[side]->nconv[side]==0) { /* One of the ends might be too far from eigenvalues */
412:       if (side) *newS = (sPres->value + PetscRealPart(sr->eig[sr->perm[sr->indexEig-1]]))/2;
413:       else *newS = (sPres->value + PetscRealPart(sr->eig[sr->perm[0]]))/2;
414:     } else *newS=(sPres->value + sPres->neighb[side]->value)/2;
415:   } else { /* (Only for side=1). Creating a new interval. */
416:     if (sPres->neigs==0) {/* No value has been accepted*/
417:       if (sPres->neighb[0]) {
418:         /* Multiplying by 10 the previous distance */
419:         *newS = sPres->value + 10*(sr->dir)*PetscAbsReal(sPres->value - sPres->neighb[0]->value);
420:         sr->nleap++;
421:         /* Stops when the interval is open and no values are found in the last 5 shifts (there might be infinite eigenvalues) */
422:         if (!sr->hasEnd && sr->nleap > 5) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unable to compute the wanted eigenvalues with open interval");
423:       } else { /* First shift */
424:         if (eps->nconv != 0) {
425:           /* Unaccepted values give information for next shift */
426:           idxP=0;/* Number of values left from shift */
427:           for (i=0;i<eps->nconv;i++) {
428:             lambda = PetscRealPart(eps->eigr[i]);
429:             if ((sr->dir)*(lambda - sPres->value) <0) idxP++;
430:             else break;
431:           }
432:           /* Avoiding subtraction of eigenvalues (might be the same).*/
433:           if (idxP>0) {
434:             d_prev = PetscAbsReal(sPres->value - PetscRealPart(eps->eigr[0]))/(idxP+0.3);
435:           } else {
436:             d_prev = PetscAbsReal(sPres->value - PetscRealPart(eps->eigr[eps->nconv-1]))/(eps->nconv+0.3);
437:           }
438:           *newS = sPres->value + ((sr->dir)*d_prev*eps->nev)/2;
439:         } else { /* No values found, no information for next shift */
440:           SETERRQ(PetscObjectComm((PetscObject)eps),1,"First shift renders no information");
441:         }
442:       }
443:     } else { /* Accepted values found */
444:       sr->nleap = 0;
445:       /* Average distance of values in previous subinterval */
446:       s = sPres->neighb[0];
447:       while (s && PetscAbs(s->inertia - sPres->inertia)==0) {
448:         s = s->neighb[0];/* Looking for previous shifts with eigenvalues within */
449:       }
450:       if (s) {
451:         d_prev = PetscAbsReal((sPres->value - s->value)/(sPres->inertia - s->inertia));
452:       } else { /* First shift. Average distance obtained with values in this shift */
453:         /* first shift might be too far from first wanted eigenvalue (no values found outside the interval)*/
454:         if ((sr->dir)*(PetscRealPart(sr->eig[0])-sPres->value)>0 && PetscAbsReal((PetscRealPart(sr->eig[sr->indexEig-1]) - PetscRealPart(sr->eig[0]))/PetscRealPart(sr->eig[0])) > PetscSqrtReal(eps->tol)) {
455:           d_prev =  PetscAbsReal((PetscRealPart(sr->eig[sr->indexEig-1]) - PetscRealPart(sr->eig[0])))/(sPres->neigs+0.3);
456:         } else {
457:           d_prev = PetscAbsReal(PetscRealPart(sr->eig[sr->indexEig-1]) - sPres->value)/(sPres->neigs+0.3);
458:         }
459:       }
460:       /* Average distance is used for next shift by adding it to value on the right or to shift */
461:       if ((sr->dir)*(PetscRealPart(sr->eig[sPres->index + sPres->neigs -1]) - sPres->value)>0) {
462:         *newS = PetscRealPart(sr->eig[sPres->index + sPres->neigs -1])+ ((sr->dir)*d_prev*(eps->nev))/2;
463:       } else { /* Last accepted value is on the left of shift. Adding to shift */
464:         *newS = sPres->value + ((sr->dir)*d_prev*(eps->nev))/2;
465:       }
466:     }
467:     /* End of interval can not be surpassed */
468:     if ((sr->dir)*(sr->int1 - *newS) < 0) *newS = sr->int1;
469:   }/* of neighb[side]==null */
470:   return(0);
471: }

473: /*
474:   Function for sorting an array of real values
475: */
478: static PetscErrorCode sortRealEigenvalues(PetscScalar *r,PetscInt *perm,PetscInt nr,PetscBool prev,PetscInt dir)
479: {
480:   PetscReal      re;
481:   PetscInt       i,j,tmp;

484:   if (!prev) for (i=0;i<nr;i++) perm[i] = i;
485:   /* Insertion sort */
486:   for (i=1;i<nr;i++) {
487:     re = PetscRealPart(r[perm[i]]);
488:     j = i-1;
489:     while (j>=0 && dir*(re - PetscRealPart(r[perm[j]])) <= 0) {
490:       tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; j--;
491:     }
492:   }
493:   return(0);
494: }

496: /* Stores the pairs obtained since the last shift in the global arrays */
499: static PetscErrorCode EPSStoreEigenpairs(EPS eps)
500: {
501:   PetscErrorCode  ierr;
502:   PetscReal       lambda,err,norm;
503:   PetscInt        i,count;
504:   PetscBool       iscayley;
505:   SR              sr;
506:   shift           sPres;
507:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

510:   sr = ctx->sr;
511:   sPres = sr->sPres;
512:   sPres->index = sr->indexEig;
513:   count = sr->indexEig;
514:   /* Back-transform */
515:   EPSBackTransform_Default(eps);
516:   PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&iscayley);
517:   /* Sort eigenvalues */
518:   sortRealEigenvalues(eps->eigr,eps->perm,eps->nconv,PETSC_FALSE,sr->dir);
519:   /* Values stored in global array */
520:   for (i=0;i<eps->nconv;i++) {
521:     lambda = PetscRealPart(eps->eigr[eps->perm[i]]);
522:     err = eps->errest[eps->perm[i]];

524:     if ((sr->dir)*(lambda - sPres->ext[0]) > 0 && (sr->dir)*(sPres->ext[1] - lambda) > 0) {/* Valid value */
525:       if (count>=sr->numEigs) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing");
526:       sr->eig[count] = lambda;
527:       sr->errest[count] = err;
528:       /* Explicit purification */
529:       STApply(eps->st,eps->V[eps->perm[i]],sr->V[count]);
530:       IPNorm(eps->ip,sr->V[count],&norm);
531:       VecScale(sr->V[count],1.0/norm);
532:       count++;
533:     }
534:   }
535:   sPres->neigs = count - sr->indexEig;
536:   sr->indexEig = count;
537:   /* Global ordering array updating */
538:   sortRealEigenvalues(sr->eig,sr->perm,count,PETSC_TRUE,sr->dir);
539:   return(0);
540: }

544: static PetscErrorCode EPSLookForDeflation(EPS eps)
545: {
546:   PetscReal       val;
547:   PetscInt        i,count0=0,count1=0;
548:   shift           sPres;
549:   PetscInt        ini,fin,k,idx0,idx1;
550:   SR              sr;
551:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

554:   sr = ctx->sr;
555:   sPres = sr->sPres;

557:   if (sPres->neighb[0]) ini = (sr->dir)*(sPres->neighb[0]->inertia - sr->inertia0);
558:   else ini = 0;
559:   fin = sr->indexEig;
560:   /* Selection of ends for searching new values */
561:   if (!sPres->neighb[0]) sPres->ext[0] = sr->int0;/* First shift */
562:   else sPres->ext[0] = sPres->neighb[0]->value;
563:   if (!sPres->neighb[1]) {
564:     if (sr->hasEnd) sPres->ext[1] = sr->int1;
565:     else sPres->ext[1] = (sr->dir > 0)?PETSC_MAX_REAL:PETSC_MIN_REAL;
566:   } else sPres->ext[1] = sPres->neighb[1]->value;
567:   /* Selection of values between right and left ends */
568:   for (i=ini;i<fin;i++) {
569:     val=PetscRealPart(sr->eig[sr->perm[i]]);
570:     /* Values to the right of left shift */
571:     if ((sr->dir)*(val - sPres->ext[1]) < 0) {
572:       if ((sr->dir)*(val - sPres->value) < 0) count0++;
573:       else count1++;
574:     } else break;
575:   }
576:   /* The number of values on each side are found */
577:   if (sPres->neighb[0]) {
578:     sPres->nsch[0] = (sr->dir)*(sPres->inertia - sPres->neighb[0]->inertia)-count0;
579:     if (sPres->nsch[0]<0)SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing!\nMismatch between number of values found and information from inertia");
580:   } else sPres->nsch[0] = 0;

582:   if (sPres->neighb[1]) {
583:     sPres->nsch[1] = (sr->dir)*(sPres->neighb[1]->inertia - sPres->inertia) - count1;
584:     if (sPres->nsch[1]<0)SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error in Spectrum Slicing!\nMismatch between number of values found and information from inertia");
585:   } else sPres->nsch[1] = (sr->dir)*(sr->inertia1 - sPres->inertia);

587:   /* Completing vector of indexes for deflation */
588:   idx0 = ini;
589:   idx1 = ini+count0+count1;
590:   k=0;
591:   for (i=idx0;i<idx1;i++) sr->idxDef[k++]=sr->perm[i];
592:   for (i=0;i<k;i++) sr->VDef[i]=sr->V[sr->idxDef[i]];
593:   eps->defl = sr->VDef;
594:   eps->nds = k;
595:   return(0);
596: }

600: PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS eps)
601: {
602:   PetscErrorCode  ierr;
603:   PetscInt        i,lds;
604:   PetscReal       newS;
605:   KSP             ksp;
606:   PC              pc;
607:   Mat             F;
608:   PetscReal       *errest_left;
609:   Vec             t;
610:   SR              sr;
611:   shift           s;
612:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

615:   PetscMalloc(sizeof(struct _n_SR),&sr);
616:   PetscLogObjectMemory(eps,sizeof(struct _n_SR));
617:   ctx->sr = sr;
618:   sr->itsKs = 0;
619:   sr->nleap = 0;
620:   sr->nMAXCompl = eps->nev/4;
621:   sr->iterCompl = eps->max_it/4;
622:   sr->sPres = NULL;
623:   sr->nS = 0;
624:   lds = PetscMin(eps->mpd,eps->ncv);
625:   /* Checking presence of ends and finding direction */
626:   if (eps->inta > PETSC_MIN_REAL) {
627:     sr->int0 = eps->inta;
628:     sr->int1 = eps->intb;
629:     sr->dir = 1;
630:     if (eps->intb >= PETSC_MAX_REAL) { /* Right-open interval */
631:       sr->hasEnd = PETSC_FALSE;
632:       sr->inertia1 = eps->n;
633:     } else sr->hasEnd = PETSC_TRUE;
634:   } else { /* Left-open interval */
635:     sr->int0 = eps->intb;
636:     sr->int1 = eps->inta;
637:     sr->dir = -1;
638:     sr->hasEnd = PETSC_FALSE;
639:     sr->inertia1 = 0;
640:   }
641:   /* Array of pending shifts */
642:   sr->maxPend = 100;/* Initial size */
643:   PetscMalloc((sr->maxPend)*sizeof(shift),&sr->pending);
644:   PetscLogObjectMemory(eps,(sr->maxPend)*sizeof(shift));
645:   if (sr->hasEnd) {
646:     STGetKSP(eps->st,&ksp);
647:     KSPGetPC(ksp,&pc);
648:     PCFactorGetMatrix(pc,&F);
649:     /* Not looking for values in b (just inertia).*/
650:     MatGetInertia(F,&sr->inertia1,NULL,NULL);
651:     PCReset(pc); /* avoiding memory leak */
652:   }
653:   sr->nPend = 0;
654:   EPSCreateShift(eps,sr->int0,NULL,NULL);
655:   EPSExtractShift(eps);
656:   sr->s0 = sr->sPres;
657:   sr->inertia0 = sr->s0->inertia;
658:   sr->numEigs = (sr->dir)*(sr->inertia1 - sr->inertia0);
659:   sr->indexEig = 0;
660:   /* Only with eigenvalues present in the interval ...*/
661:   if (sr->numEigs==0) {
662:     eps->reason = EPS_CONVERGED_TOL;
663:     PetscFree(sr->s0);
664:     PetscFree(sr->pending);
665:     PetscFree(sr);
666:     return(0);
667:   }
668:   /* Memory reservation for eig, V and perm */
669:   PetscMalloc(lds*lds*sizeof(PetscScalar),&sr->S);
670:   PetscMemzero(sr->S,lds*lds*sizeof(PetscScalar));
671:   PetscMalloc(sr->numEigs*sizeof(PetscScalar),&sr->eig);
672:   PetscMalloc(sr->numEigs*sizeof(PetscScalar),&sr->eigi);
673:   PetscMalloc((sr->numEigs+eps->ncv)*sizeof(PetscReal),&sr->errest);
674:   PetscMalloc((sr->numEigs+eps->ncv)*sizeof(PetscReal),&errest_left);
675:   PetscMalloc((sr->numEigs+eps->ncv)*sizeof(PetscScalar),&sr->monit);
676:   PetscMalloc((eps->ncv)*sizeof(PetscScalar),&sr->back);
677:   PetscLogObjectMemory(eps,(lds*lds+3*sr->numEigs+eps->ncv)*sizeof(PetscScalar)+2*(sr->numEigs+eps->ncv)*sizeof(PetscReal));
678:   for (i=0;i<sr->numEigs;i++) {
679:     sr->eig[i]  = 0.0;
680:     sr->eigi[i] = 0.0;
681:   }
682:   for (i=0;i<sr->numEigs+eps->ncv;i++) {
683:     errest_left[i] = 0.0;
684:     sr->errest[i]  = 0.0;
685:     sr->monit[i]   = 0.0;
686:   }
687:   VecCreateMPI(PetscObjectComm((PetscObject)eps),eps->nloc,PETSC_DECIDE,&t);
688:   VecDuplicateVecs(t,sr->numEigs,&sr->V);
689:   PetscLogObjectParents(eps,sr->numEigs,sr->V);
690:   VecDestroy(&t);
691:   /* Vector for maintaining order of eigenvalues */
692:   PetscMalloc(sr->numEigs*sizeof(PetscInt),&sr->perm);
693:   PetscLogObjectMemory(eps,sr->numEigs*sizeof(PetscInt));
694:   for (i=0;i< sr->numEigs;i++) sr->perm[i]=i;
695:   /* Vectors for deflation */
696:   PetscMalloc(sr->numEigs*sizeof(PetscInt),&sr->idxDef);
697:   PetscLogObjectMemory(eps,sr->numEigs*sizeof(PetscInt));
698:   PetscMalloc(sr->numEigs*sizeof(Vec),&sr->VDef);
699:   PetscLogObjectMemory(eps,sr->numEigs*sizeof(Vec));
700:   sr->indexEig = 0;
701:   /* Main loop */
702:   while (sr->sPres) {
703:     /* Search for deflation */
704:     EPSLookForDeflation(eps);
705:     /* KrylovSchur */
706:     EPSKrylovSchur_Slice(eps);

708:     EPSStoreEigenpairs(eps);
709:     /* Select new shift */
710:     if (!sr->sPres->comp[1]) {
711:       EPSGetNewShiftValue(eps,1,&newS);
712:       EPSCreateShift(eps,newS,sr->sPres,sr->sPres->neighb[1]);
713:     }
714:     if (!sr->sPres->comp[0]) {
715:       /* Completing earlier interval */
716:       EPSGetNewShiftValue(eps,0,&newS);
717:       EPSCreateShift(eps,newS,sr->sPres->neighb[0],sr->sPres);
718:     }
719:     /* Preparing for a new search of values */
720:     EPSExtractShift(eps);
721:   }

723:   /* Updating eps values prior to exit */
724:   VecDestroyVecs(eps->allocated_ncv,&eps->V);
725:   eps->V = sr->V;
726:   PetscFree(sr->S);
727:   PetscFree(eps->eigr);
728:   PetscFree(eps->eigi);
729:   PetscFree(eps->errest);
730:   PetscFree(eps->errest_left);
731:   PetscFree(eps->perm);
732:   eps->eigr = sr->eig;
733:   eps->eigi = sr->eigi;
734:   eps->errest = sr->errest;
735:   eps->errest_left = errest_left;
736:   eps->perm = sr->perm;
737:   eps->ncv = eps->allocated_ncv = sr->numEigs;
738:   eps->nconv = sr->indexEig;
739:   eps->reason = EPS_CONVERGED_TOL;
740:   eps->its = sr->itsKs;
741:   eps->nds = 0;
742:   eps->defl = NULL;
743:   eps->evecsavailable = PETSC_TRUE;
744:   PetscFree(sr->VDef);
745:   PetscFree(sr->idxDef);
746:   PetscFree(sr->pending);
747:   PetscFree(sr->monit);
748:   PetscFree(sr->back);
749:   /* Reviewing list of shifts to free memory */
750:   s = sr->s0;
751:   if (s) {
752:     while (s->neighb[1]) {
753:       s = s->neighb[1];
754:       PetscFree(s->neighb[0]);
755:     }
756:     PetscFree(s);
757:   }
758:   PetscFree(sr);
759:   return(0);
760: }
slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ftn-auto/0000755000175000017500000000000012214143515023613 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ftn-auto/makefile0000644000175000017500000000036512211062077025317 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = krylovschurf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/krylov/krylovschur/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/ftn-auto/krylovschurf.c0000644000175000017500000000267212211062077026527 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* krylovschur.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epskrylovschursetrestart_ EPSKRYLOVSCHURSETRESTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epskrylovschursetrestart_ epskrylovschursetrestart #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epskrylovschurgetrestart_ EPSKRYLOVSCHURGETRESTART #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epskrylovschurgetrestart_ epskrylovschurgetrestart #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epskrylovschursetrestart_(EPS *eps,PetscReal *keep, int *__ierr ){ *__ierr = EPSKrylovSchurSetRestart(*eps,*keep); } void PETSC_STDCALL epskrylovschurgetrestart_(EPS *eps,PetscReal *keep, int *__ierr ){ *__ierr = EPSKrylovSchurGetRestart(*eps,keep); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/krylov/krylovschur/krylovschur.c.html0000644000175000017500000011663012211062077025567 0ustar gladkgladk
Actual source code: krylovschur.c

  1: /*

  3:    SLEPc eigensolver: "krylovschur"

  5:    Method: Krylov-Schur

  7:    Algorithm:

  9:        Single-vector Krylov-Schur method for non-symmetric problems,
 10:        including harmonic extraction.

 12:    References:

 14:        [1] "Krylov-Schur Methods in SLEPc", SLEPc Technical Report STR-7,
 15:            available at http://www.grycap.upv.es/slepc.

 17:        [2] G.W. Stewart, "A Krylov-Schur Algorithm for Large Eigenproblems",
 18:            SIAM J. Matrix Anal. App. 23(3):601-614, 2001.

 20:        [3] "Practical Implementation of Harmonic Krylov-Schur", SLEPc Technical
 21:             Report STR-9, available at http://www.grycap.upv.es/slepc.

 23:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 24:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 25:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 27:    This file is part of SLEPc.

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

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

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

 43: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 44: #include <slepcblaslapack.h>
 45:  #include krylovschur.h

 49: PetscErrorCode EPSGetArbitraryValues(EPS eps,PetscScalar *rr,PetscScalar *ri)
 50: {
 52:   PetscInt       i,newi,ld,n,l;
 53:   Vec            xr=eps->work[1],xi=eps->work[2];
 54:   PetscScalar    re,im,*Zr,*Zi,*X;

 57:   DSGetLeadingDimension(eps->ds,&ld);
 58:   DSGetDimensions(eps->ds,&n,NULL,&l,NULL,NULL);
 59:   for (i=l;i<n;i++) {
 60:     re = eps->eigr[i];
 61:     im = eps->eigi[i];
 62:     STBackTransform(eps->st,1,&re,&im);
 63:     newi = i;
 64:     DSVectors(eps->ds,DS_MAT_X,&newi,NULL);
 65:     DSGetArray(eps->ds,DS_MAT_X,&X);
 66:     Zr = X+i*ld;
 67:     if (newi==i+1) Zi = X+newi*ld;
 68:     else Zi = NULL;
 69:     EPSComputeRitzVector(eps,Zr,Zi,eps->V,n,xr,xi);
 70:     DSRestoreArray(eps->ds,DS_MAT_X,&X);
 71:     (*eps->arbitrary)(re,im,xr,xi,rr+i,ri+i,eps->arbitraryctx);
 72:   }
 73:   return(0);
 74: }

 78: PetscErrorCode EPSSetUp_KrylovSchur(EPS eps)
 79: {
 80:   PetscErrorCode  ierr;
 81:   PetscBool       issinv;
 82:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;
 83:   enum { EPS_KS_DEFAULT,EPS_KS_SYMM,EPS_KS_SLICE,EPS_KS_INDEF } variant;

 86:   /* spectrum slicing requires special treatment of default values */
 87:   if (eps->which==EPS_ALL) {
 88:     if (eps->inta==0.0 && eps->intb==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Must define a computational interval when using EPS_ALL");
 89:     if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Spectrum slicing only available for symmetric/Hermitian eigenproblems");
 90:     if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs cannot be used with spectrum slicing");
 91:     if (!((PetscObject)(eps->st))->type_name) { /* default to shift-and-invert */
 92:       STSetType(eps->st,STSINVERT);
 93:     }
 94:     PetscObjectTypeCompareAny((PetscObject)eps->st,&issinv,STSINVERT,STCAYLEY,"");
 95:     if (!issinv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Shift-and-invert or Cayley ST is needed for spectrum slicing");
 96: #if defined(PETSC_USE_REAL_DOUBLE)
 97:     if (eps->tol==PETSC_DEFAULT) eps->tol = 1e-10;  /* use tighter tolerance */
 98: #endif
 99:     if (eps->intb >= PETSC_MAX_REAL) { /* right-open interval */
100:       if (eps->inta <= PETSC_MIN_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"The defined computational interval should have at least one of their sides bounded");
101:       STSetDefaultShift(eps->st,eps->inta);
102:     } else {
103:       STSetDefaultShift(eps->st,eps->intb);
104:     }

106:     if (eps->nev==1) eps->nev = 40;  /* nev not set, use default value */
107:     if (eps->nev<10) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"nev cannot be less than 10 in spectrum slicing runs");
108:     eps->ops->backtransform = NULL;
109:   }

111:   if (eps->isgeneralized && eps->ishermitian && !eps->ispositive && eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not implemented for indefinite problems");

113:   /* proceed with the general case */
114:   if (eps->ncv) { /* ncv set */
115:     if (eps->ncv<eps->nev+1) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev+1");
116:   } else if (eps->mpd) { /* mpd set */
117:     eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
118:   } else { /* neither set: defaults depend on nev being small or large */
119:     if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15));
120:     else {
121:       eps->mpd = 500;
122:       eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
123:     }
124:   }
125:   if (!eps->mpd) eps->mpd = eps->ncv;
126:   if (eps->ncv>eps->nev+eps->mpd) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must not be larger than nev+mpd");
127:   if (!eps->max_it) {
128:     if (eps->which==EPS_ALL) eps->max_it = 100;  /* special case for spectrum slicing */
129:     else eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
130:   }
131:   if (!eps->which) { EPSSetWhichEigenpairs_Default(eps); }
132:   if (eps->ishermitian && (eps->which==EPS_LARGEST_IMAGINARY || eps->which==EPS_SMALLEST_IMAGINARY)) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");

134:   if (!eps->extraction) {
135:     EPSSetExtraction(eps,EPS_RITZ);
136:   } else if (eps->extraction!=EPS_RITZ && eps->extraction!=EPS_HARMONIC)
137:     SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");

139:   if (!ctx->keep) ctx->keep = 0.5;

141:   EPSAllocateSolution(eps);
142:   if (eps->arbitrary) {
143:     EPSSetWorkVecs(eps,3);
144:   } else if (eps->ishermitian && !eps->ispositive){
145:     EPSSetWorkVecs(eps,2);
146:   } else {
147:     EPSSetWorkVecs(eps,1);
148:   }

150:   /* dispatch solve method */
151:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
152:   if (eps->ishermitian) {
153:     if (eps->which==EPS_ALL) {
154:       if (eps->isgeneralized && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Spectrum slicing not implemented for indefinite problems");
155:       else variant = EPS_KS_SLICE;
156:     } else if (eps->isgeneralized && !eps->ispositive) {
157:       variant = EPS_KS_INDEF;
158:     } else {
159:       switch (eps->extraction) {
160:         case EPS_RITZ:     variant = EPS_KS_SYMM; break;
161:         case EPS_HARMONIC: variant = EPS_KS_DEFAULT; break;
162:         default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
163:       }
164:     }
165:   } else {
166:     switch (eps->extraction) {
167:       case EPS_RITZ:     variant = EPS_KS_DEFAULT; break;
168:       case EPS_HARMONIC: variant = EPS_KS_DEFAULT; break;
169:       default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
170:     }
171:   }
172:   switch (variant) {
173:     case EPS_KS_DEFAULT:
174:       eps->ops->solve = EPSSolve_KrylovSchur_Default;
175:       DSSetType(eps->ds,DSNHEP);
176:       break;
177:     case EPS_KS_SYMM:
178:       eps->ops->solve = EPSSolve_KrylovSchur_Symm;
179:       DSSetType(eps->ds,DSHEP);
180:       DSSetCompact(eps->ds,PETSC_TRUE);
181:       DSSetExtraRow(eps->ds,PETSC_TRUE);
182:       break;
183:     case EPS_KS_SLICE:
184:       eps->ops->solve = EPSSolve_KrylovSchur_Slice;
185:       DSSetType(eps->ds,DSHEP);
186:       DSSetCompact(eps->ds,PETSC_TRUE);
187:       break;
188:     case EPS_KS_INDEF:
189:       eps->ops->solve = EPSSolve_KrylovSchur_Indefinite;
190:       DSSetType(eps->ds,DSGHIEP);
191:       DSSetCompact(eps->ds,PETSC_TRUE);
192:       break;
193:     default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unexpected error");
194:   }
195:   DSAllocate(eps->ds,eps->ncv+1);
196:   return(0);
197: }

201: PetscErrorCode EPSSolve_KrylovSchur_Default(EPS eps)
202: {
203:   PetscErrorCode  ierr;
204:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;
205:   PetscInt        i,j,*pj,k,l,nv,ld;
206:   Vec             u=eps->work[0];
207:   PetscScalar     *S,*Q,*g;
208:   PetscReal       beta,gamma=1.0;
209:   PetscBool       breakdown,harmonic;

212:   DSGetLeadingDimension(eps->ds,&ld);
213:   harmonic = (eps->extraction==EPS_HARMONIC || eps->extraction==EPS_REFINED_HARMONIC)?PETSC_TRUE:PETSC_FALSE;
214:   if (harmonic) { PetscMalloc(ld*sizeof(PetscScalar),&g); }
215:   if (eps->arbitrary) pj = &j;
216:   else pj = NULL;

218:   /* Get the starting Arnoldi vector */
219:   EPSGetStartVector(eps,0,eps->V[0],NULL);
220:   l = 0;

222:   /* Restart loop */
223:   while (eps->reason == EPS_CONVERGED_ITERATING) {
224:     eps->its++;

226:     /* Compute an nv-step Arnoldi factorization */
227:     nv = PetscMin(eps->nconv+eps->mpd,eps->ncv);
228:     DSGetArray(eps->ds,DS_MAT_A,&S);
229:     EPSBasicArnoldi(eps,PETSC_FALSE,S,ld,eps->V,eps->nconv+l,&nv,u,&beta,&breakdown);
230:     VecScale(u,1.0/beta);
231:     DSRestoreArray(eps->ds,DS_MAT_A,&S);
232:     DSSetDimensions(eps->ds,nv,0,eps->nconv,eps->nconv+l);
233:     if (l==0) {
234:       DSSetState(eps->ds,DS_STATE_INTERMEDIATE);
235:     } else {
236:       DSSetState(eps->ds,DS_STATE_RAW);
237:     }

239:     /* Compute translation of Krylov decomposition if harmonic extraction used */
240:     if (harmonic) {
241:       DSTranslateHarmonic(eps->ds,eps->target,beta,PETSC_FALSE,g,&gamma);
242:     }

244:     /* Solve projected problem */
245:     DSSolve(eps->ds,eps->eigr,eps->eigi);
246:     if (eps->arbitrary) {
247:       EPSGetArbitraryValues(eps,eps->rr,eps->ri);
248:       j=1;
249:     }
250:     DSSort(eps->ds,eps->eigr,eps->eigi,eps->rr,eps->ri,pj);

252:     /* Check convergence */
253:     EPSKrylovConvergence(eps,PETSC_FALSE,eps->nconv,nv-eps->nconv,eps->V,nv,beta,gamma,&k);
254:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
255:     if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL;

257:     /* Update l */
258:     if (eps->reason != EPS_CONVERGED_ITERATING || breakdown) l = 0;
259:     else {
260:       l = PetscMax(1,(PetscInt)((nv-k)*ctx->keep));
261: #if !defined(PETSC_USE_COMPLEX)
262:       DSGetArray(eps->ds,DS_MAT_A,&S);
263:       if (S[k+l+(k+l-1)*ld] != 0.0) {
264:         if (k+l<nv-1) l = l+1;
265:         else l = l-1;
266:       }
267:       DSRestoreArray(eps->ds,DS_MAT_A,&S);
268: #endif
269:     }

271:     if (eps->reason == EPS_CONVERGED_ITERATING) {
272:       if (breakdown) {
273:         /* Start a new Arnoldi factorization */
274:         PetscInfo2(eps,"Breakdown in Krylov-Schur method (it=%D norm=%G)\n",eps->its,beta);
275:         EPSGetStartVector(eps,k,eps->V[k],&breakdown);
276:         if (breakdown) {
277:           eps->reason = EPS_DIVERGED_BREAKDOWN;
278:           PetscInfo(eps,"Unable to generate more start vectors\n");
279:         }
280:       } else {
281:         /* Undo translation of Krylov decomposition */
282:         if (harmonic) {
283:           DSSetDimensions(eps->ds,nv,0,k,l);
284:           DSTranslateHarmonic(eps->ds,0.0,beta,PETSC_TRUE,g,&gamma);
285:           /* gamma u^ = u - U*g~ */
286:           SlepcVecMAXPBY(u,1.0,-1.0,nv,g,eps->V);
287:           VecScale(u,1.0/gamma);
288:         }
289:         /* Prepare the Rayleigh quotient for restart */
290:         DSGetArray(eps->ds,DS_MAT_A,&S);
291:         DSGetArray(eps->ds,DS_MAT_Q,&Q);
292:         for (i=k;i<k+l;i++) {
293:           S[k+l+i*ld] = Q[nv-1+i*ld]*beta*gamma;
294:         }
295:         DSRestoreArray(eps->ds,DS_MAT_A,&S);
296:         DSRestoreArray(eps->ds,DS_MAT_Q,&Q);
297:       }
298:     }
299:     /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
300:     DSGetArray(eps->ds,DS_MAT_Q,&Q);
301:     SlepcUpdateVectors(nv,eps->V,eps->nconv,k+l,Q,ld,PETSC_FALSE);
302:     DSRestoreArray(eps->ds,DS_MAT_Q,&Q);

304:     if (eps->reason == EPS_CONVERGED_ITERATING && !breakdown) {
305:       VecCopy(u,eps->V[k+l]);
306:     }
307:     eps->nconv = k;
308:     EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,nv);
309:   }

311:   if (harmonic) { PetscFree(g); }
312:   /* truncate Schur decomposition and change the state to raw so that
313:      PSVectors() computes eigenvectors from scratch */
314:   DSSetDimensions(eps->ds,eps->nconv,0,0,0);
315:   DSSetState(eps->ds,DS_STATE_RAW);
316:   return(0);
317: }

321: static PetscErrorCode EPSKrylovSchurSetRestart_KrylovSchur(EPS eps,PetscReal keep)
322: {
323:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

326:   if (keep==PETSC_DEFAULT) ctx->keep = 0.5;
327:   else {
328:     if (keep<0.1 || keep>0.9) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The keep argument must be in the range [0.1,0.9]");
329:     ctx->keep = keep;
330:   }
331:   return(0);
332: }

336: /*@
337:    EPSKrylovSchurSetRestart - Sets the restart parameter for the Krylov-Schur
338:    method, in particular the proportion of basis vectors that must be kept
339:    after restart.

341:    Logically Collective on EPS

343:    Input Parameters:
344: +  eps - the eigenproblem solver context
345: -  keep - the number of vectors to be kept at restart

347:    Options Database Key:
348: .  -eps_krylovschur_restart - Sets the restart parameter

350:    Notes:
351:    Allowed values are in the range [0.1,0.9]. The default is 0.5.

353:    Level: advanced

355: .seealso: EPSKrylovSchurGetRestart()
356: @*/
357: PetscErrorCode EPSKrylovSchurSetRestart(EPS eps,PetscReal keep)
358: {

364:   PetscTryMethod(eps,"EPSKrylovSchurSetRestart_C",(EPS,PetscReal),(eps,keep));
365:   return(0);
366: }

370: static PetscErrorCode EPSKrylovSchurGetRestart_KrylovSchur(EPS eps,PetscReal *keep)
371: {
372:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

375:   *keep = ctx->keep;
376:   return(0);
377: }

381: /*@
382:    EPSKrylovSchurGetRestart - Gets the restart parameter used in the
383:    Krylov-Schur method.

385:    Not Collective

387:    Input Parameter:
388: .  eps - the eigenproblem solver context

390:    Output Parameter:
391: .  keep - the restart parameter

393:    Level: advanced

395: .seealso: EPSKrylovSchurSetRestart()
396: @*/
397: PetscErrorCode EPSKrylovSchurGetRestart(EPS eps,PetscReal *keep)
398: {

404:   PetscTryMethod(eps,"EPSKrylovSchurGetRestart_C",(EPS,PetscReal*),(eps,keep));
405:   return(0);
406: }

410: PetscErrorCode EPSSetFromOptions_KrylovSchur(EPS eps)
411: {
413:   PetscBool      flg;
414:   PetscReal      keep;

417:   PetscOptionsHead("EPS Krylov-Schur Options");
418:   PetscOptionsReal("-eps_krylovschur_restart","Proportion of vectors kept after restart","EPSKrylovSchurSetRestart",0.5,&keep,&flg);
419:   if (flg) {
420:     EPSKrylovSchurSetRestart(eps,keep);
421:   }
422:   PetscOptionsTail();
423:   return(0);
424: }

428: PetscErrorCode EPSView_KrylovSchur(EPS eps,PetscViewer viewer)
429: {
430:   PetscErrorCode  ierr;
431:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;
432:   PetscBool       isascii;

435:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
436:   if (isascii) {
437:     PetscViewerASCIIPrintf(viewer,"  Krylov-Schur: %d%% of basis vectors kept after restart\n",(int)(100*ctx->keep));
438:   }
439:   return(0);
440: }

444: PetscErrorCode EPSReset_KrylovSchur(EPS eps)
445: {
446:   PetscErrorCode  ierr;
447:   EPS_KRYLOVSCHUR *ctx = (EPS_KRYLOVSCHUR*)eps->data;

450:   ctx->keep = 0.0;
451:   EPSReset_Default(eps);
452:   return(0);
453: }

457: PetscErrorCode EPSDestroy_KrylovSchur(EPS eps)
458: {

462:   PetscFree(eps->data);
463:   PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurSetRestart_C",NULL);
464:   PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurGetRestart_C",NULL);
465:   return(0);
466: }

470: PETSC_EXTERN PetscErrorCode EPSCreate_KrylovSchur(EPS eps)
471: {

475:   PetscNewLog(eps,EPS_KRYLOVSCHUR,&eps->data);
476:   eps->ops->setup          = EPSSetUp_KrylovSchur;
477:   eps->ops->setfromoptions = EPSSetFromOptions_KrylovSchur;
478:   eps->ops->destroy        = EPSDestroy_KrylovSchur;
479:   eps->ops->reset          = EPSReset_KrylovSchur;
480:   eps->ops->view           = EPSView_KrylovSchur;
481:   eps->ops->backtransform  = EPSBackTransform_Default;
482:   eps->ops->computevectors = EPSComputeVectors_Schur;
483:   PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurSetRestart_C",EPSKrylovSchurSetRestart_KrylovSchur);
484:   PetscObjectComposeFunction((PetscObject)eps,"EPSKrylovSchurGetRestart_C",EPSKrylovSchurGetRestart_KrylovSchur);
485:   return(0);
486: }

slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/0000755000175000017500000000000012214143515017076 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/ciss/makefile0000644000175000017500000000217112211062077020577 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresscalar complex CFLAGS = FFLAGS = SOURCEC = ciss.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/ciss/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/makefile.html0000644000175000017500000000402212211062077021537 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresscalar    complex

CFLAGS   =
FFLAGS   =
SOURCEC  = ciss.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/ciss/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/index.html0000644000175000017500000000212412211062077021072 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

ciss.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/ciss.c0000644000175000017500000014136012211062077020210 0ustar gladkgladk/* SLEPc eigensolver: "ciss" Method: Contour Integral Spectral Slicing Algorithm: Contour integral based on Sakurai-Sugiura method to construct a subspace, with various eigenpair extractions (Rayleigh-Ritz, explicit moment). Based on code contributed by Tetsuya Sakurai. References: [1] T. Sakurai and H. Sugiura, "A projection method for generalized eigenvalue problems", J. Comput. Appl. Math. 159:119-128, 2003. [2] T. Sakurai and H. Tadano, "CIRR: a Rayleigh-Ritz type method with contour integral for generalized eigenvalue problems", Hokkaido Math. J. 36:745-757, 2007. Last update: Jun 2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_CISS(EPS); typedef struct { /* parameters */ PetscScalar center; /* center of the region where to find eigenpairs (default: 0.0) */ PetscReal radius; /* radius of the region (1.0) */ PetscReal vscale; /* vertical scale of the region (1.0; 0.1 if spectrum real) */ PetscInt N; /* number of integration points (32) */ PetscInt L; /* block size (16) */ PetscInt M; /* moment degree (N/4 = 4) */ PetscReal delta; /* threshold of singular value (1e-12) */ PetscInt npart; /* number of partitions of the matrix (1) */ PetscReal *sigma; /* threshold for numerical rank */ PetscInt L_max; /* maximum number of columns of the source matrix V */ PetscReal spurious_threshold; /* discard spurious eigenpairs */ PetscBool isreal; /* A and B are real */ PetscInt refine_inner; PetscInt refine_outer; PetscInt refine_blocksize; /* private data */ PetscInt solver_comm_id; PetscInt num_solve_point; PetscScalar *weight; PetscScalar *omega; PetscScalar *pp; Vec *V; Vec *Y; Vec *S; KSP *ksp; PetscBool useconj; PetscReal est_eig; } EPS_CISS; #undef __FUNCT__ #define __FUNCT__ "SetSolverComm" static PetscErrorCode SetSolverComm(EPS eps) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt N = ctx->N; PetscFunctionBegin; if (ctx->useconj) N = N/2; ctx->solver_comm_id = 0; ctx->num_solve_point = N; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SetPathParameter" static PetscErrorCode SetPathParameter(EPS eps) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i; PetscReal theta; PetscFunctionBegin; for (i=0;iN;i++){ theta = ((2*PETSC_PI)/ctx->N)*(i+0.5); ctx->pp[i] = cos(theta) + PETSC_i*ctx->vscale*sin(theta); ctx->omega[i] = ctx->center + ctx->radius*ctx->pp[i]; ctx->weight[i] = ctx->vscale*cos(theta) + PETSC_i*sin(theta); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "CISSVecSetRandom" static PetscErrorCode CISSVecSetRandom(Vec x,PetscRandom rctx) { PetscErrorCode ierr; PetscInt j,nlocal; PetscScalar *vdata; PetscFunctionBegin; ierr = SlepcVecSetRandom(x,rctx);CHKERRQ(ierr); ierr = VecGetLocalSize(x,&nlocal);CHKERRQ(ierr); ierr = VecGetArray(x,&vdata);CHKERRQ(ierr); for (j=0;jdata; PetscInt i,j,nmat,p_id; Mat A,B,Fz; PC pc; Vec BV; PetscFunctionBegin; ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } else B = NULL; ierr = MatDuplicate(A,MAT_DO_NOT_COPY_VALUES,&Fz);CHKERRQ(ierr); ierr = VecDuplicate(ctx->V[0],&BV);CHKERRQ(ierr); for (i=0;inum_solve_point;i++) { p_id = ctx->solver_comm_id * ctx->num_solve_point + i; ierr = MatCopy(A,Fz,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); if (nmat>1) { ierr = MatAXPY(Fz,-ctx->omega[p_id],B,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); } else { ierr = MatShift(Fz,-ctx->omega[p_id]);CHKERRQ(ierr); } ierr = KSPSetOperators(ctx->ksp[i],Fz,Fz,SAME_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetType(ctx->ksp[i],KSPPREONLY);CHKERRQ(ierr); ierr = KSPGetPC(ctx->ksp[i],&pc);CHKERRQ(ierr); ierr = PCSetType(pc,PCREDUNDANT);CHKERRQ(ierr); ierr = KSPSetFromOptions(ctx->ksp[i]);CHKERRQ(ierr); for (j=0;jL;j++) { ierr = VecDuplicate(ctx->V[0],&ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); if (nmat==2) { ierr = MatMult(B,ctx->V[j],BV);CHKERRQ(ierr); ierr = KSPSolve(ctx->ksp[i],BV,ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); } else { ierr = KSPSolve(ctx->ksp[i],ctx->V[j],ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); } } } ierr = MatDestroy(&Fz);CHKERRQ(ierr); ierr = VecDestroy(&BV);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "ConstructS" static PetscErrorCode ConstructS(EPS eps,PetscInt M,Vec **S) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i,j,k; Vec v; PetscScalar *ppk; PetscFunctionBegin; ierr = VecDuplicateVecs(ctx->Y[0],M*ctx->L,S);CHKERRQ(ierr); ierr = PetscMalloc(ctx->num_solve_point*sizeof(PetscScalar),&ppk);CHKERRQ(ierr); for (i=0;inum_solve_point;i++) ppk[i] = 1; ierr = VecDuplicate(ctx->Y[0],&v);CHKERRQ(ierr); for (k=0;kL;j++) { ierr = VecSet(v,0);CHKERRQ(ierr); for (i=0;inum_solve_point; i++) { ierr = VecAXPY(v,ppk[i]*ctx->weight[ctx->solver_comm_id*ctx->num_solve_point+i]/(PetscReal)ctx->N,ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); } ierr = VecCopy(v,(*S)[k*ctx->L+j]);CHKERRQ(ierr); } for (i=0;inum_solve_point;i++) { ppk[i] *= ctx->pp[ctx->solver_comm_id*ctx->num_solve_point+i]; } } ierr = PetscFree(ppk);CHKERRQ(ierr); ierr = VecDestroy(&v); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EstimateNumberEigs" static PetscErrorCode EstimateNumberEigs(EPS eps,Vec *S1,PetscInt *L_add) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i,j,istart,p_start,p_end; PetscScalar *data,*p_data,tmp,sum = 0.0; Vec V_p; PetscReal eta; PetscFunctionBegin; ierr = VecGetOwnershipRange(ctx->V[0],&istart,NULL);CHKERRQ(ierr); ierr = VecGetOwnershipRange(S1[0],&p_start,&p_end);CHKERRQ(ierr); ierr = VecDuplicate(S1[0],&V_p);CHKERRQ(ierr); for (i=0;iL;i++) { ierr = VecGetArray(ctx->V[i],&data);CHKERRQ(ierr); ierr = VecGetArray(V_p,&p_data);CHKERRQ(ierr); for (j=p_start;jV[i],&data);CHKERRQ(ierr); ierr = VecRestoreArray(V_p,&p_data);CHKERRQ(ierr); ierr = VecDot(V_p,S1[i],&tmp);CHKERRQ(ierr); sum += tmp; } ierr = VecDestroy(&V_p);CHKERRQ(ierr); ctx->est_eig = PetscAbsScalar(ctx->radius*sum/(PetscReal)ctx->L); eta = PetscPowReal(10,-log10(eps->tol)/ctx->N); ierr = PetscInfo1(eps,"Estimation_#Eig %F\n",ctx->est_eig);CHKERRQ(ierr); *L_add = (PetscInt)ceil((ctx->est_eig*eta)/ctx->M) - ctx->L; if (*L_add < 0) *L_add = 0; if (*L_add>ctx->L_max-ctx->L) { ierr = PetscInfo(eps,"Number of eigenvalues around the contour path may be too large\n"); *L_add = ctx->L_max-ctx->L; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SetAddVector" static PetscErrorCode SetAddVector(EPS eps,PetscInt Ladd_end) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i,j,nlocal,Ladd_start=ctx->L; Vec *newV; PetscScalar *vdata; PetscFunctionBegin; ierr = PetscMalloc(Ladd_end*sizeof(Vec*),&newV);CHKERRQ(ierr); for (i=0;iL;i++) { newV[i] = ctx->V[i]; } ierr = PetscFree(ctx->V);CHKERRQ(ierr); ctx->V = newV; ierr = VecGetLocalSize(ctx->V[0],&nlocal);CHKERRQ(ierr); for (i=Ladd_start;iV[0],&ctx->V[i]);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->V[i]);CHKERRQ(ierr); ierr = CISSVecSetRandom(ctx->V[i],eps->rand);CHKERRQ(ierr); ierr = VecGetArray(ctx->V[i],&vdata);CHKERRQ(ierr); for (j=0;jV[i],&vdata);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SolveAddLinearSystem" static PetscErrorCode SolveAddLinearSystem(EPS eps,PetscInt Ladd_start,PetscInt Ladd_end) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i,j; PetscFunctionBegin; for (i=0;inum_solve_point;i++) { for (j=Ladd_start;jY[i*ctx->L_max+j]);CHKERRQ(ierr); ierr = VecDuplicate(ctx->V[0],&ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); ierr = KSPSolve(ctx->ksp[i],ctx->V[j],ctx->Y[i*ctx->L_max+j]);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "CalcMu" static PetscErrorCode CalcMu(EPS eps,PetscScalar *Mu) { PetscErrorCode ierr; PetscInt i,j,k,s; PetscInt rank_region,icolor,ikey; PetscScalar *temp,*temp2,*ppk,alp; MPI_Comm Row_Comm; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)eps),&rank_region);CHKERRQ(ierr); icolor = rank_region % ctx->npart; ikey = rank_region / ctx->npart; ierr = MPI_Comm_split(PetscObjectComm((PetscObject)eps),icolor,ikey,&Row_Comm);CHKERRQ(ierr); ierr = PetscMalloc(ctx->num_solve_point*ctx->L*ctx->L*sizeof(PetscScalar),&temp);CHKERRQ(ierr); ierr = PetscMalloc(2*ctx->M*ctx->L*ctx->L*sizeof(PetscScalar),&temp2);CHKERRQ(ierr); ierr = PetscMalloc(ctx->num_solve_point*sizeof(PetscScalar),&ppk);CHKERRQ(ierr); for (i=0;i<2*ctx->M*ctx->L*ctx->L;i++) temp2[i] = 0; for (i=0; inum_solve_point;i++) { for (j=0;jL;j++) { ierr = VecMDot(ctx->Y[i*ctx->L_max+j],ctx->L,ctx->V,&temp[(j+i*ctx->L)*ctx->L]);CHKERRQ(ierr); } } for (i=0;inum_solve_point;i++) ppk[i] = 1; for (k=0;k<2*ctx->M;k++) { for (j=0;jL;j++) { for (i=0;inum_solve_point;i++) { alp = ppk[i]*ctx->weight[ctx->solver_comm_id*ctx->num_solve_point+i]/(PetscReal)ctx->N; for (s=0;sL;s++) { if (ctx->useconj) temp2[s+(j+k*ctx->L)*ctx->L] += PetscRealPart(alp*temp[s+(j+i*ctx->L)*ctx->L])*2; else temp2[s+(j+k*ctx->L)*ctx->L] += alp*temp[s+(j+i*ctx->L)*ctx->L]; } } } for (i=0;inum_solve_point;i++) ppk[i] *= ctx->pp[ctx->solver_comm_id*ctx->num_solve_point+i]; } ierr = MPI_Allreduce(temp2,Mu,2*ctx->M*ctx->L*ctx->L,MPIU_SCALAR,MPIU_SUM,Row_Comm);CHKERRQ(ierr); ierr = PetscFree(ppk);CHKERRQ(ierr); ierr = PetscFree(temp);CHKERRQ(ierr); ierr = PetscFree(temp2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "BlockHankel" static PetscErrorCode BlockHankel(EPS eps,PetscScalar *Mu,PetscInt s,Vec *H) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i,j,k,L=ctx->L,M=ctx->M; PetscScalar *H_data; PetscErrorCode ierr; PetscFunctionBegin; for (k=0;kdata; PetscInt i,j,k,ld,ml=ctx->L*ctx->M,n=eps->n; PetscScalar *R,*w,*s; DS ds; PetscFunctionBegin; if (isqr) { ierr = PetscMalloc(ml*ml*sizeof(PetscScalar),&s);CHKERRQ(ierr); ierr = PetscMemzero(s,ml*ml*sizeof(PetscScalar));CHKERRQ(ierr); ierr = IPQRDecomposition(eps->ip,Q,0,ml,s,ml);CHKERRQ(ierr); } ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSSVD);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = ml; ierr = DSAllocate(ds,ld);CHKERRQ(ierr); k = PetscMin(n,ml); ierr = DSSetDimensions(ds,k,ml,0,0);CHKERRQ(ierr); ierr = DSGetArray(ds,DS_MAT_A,&R);CHKERRQ(ierr); if (isqr) { for (i=0;isigma[i] = PetscRealPart(w[i]); if (ctx->sigma[i]/PetscMax(ctx->sigma[0],1)>ctx->delta) (*K)++; } ierr = PetscFree(w);CHKERRQ(ierr); ierr = DSDestroy(&ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "ProjectMatrix" static PetscErrorCode ProjectMatrix(Mat A,PetscInt nv,PetscInt ld,Vec *Q,PetscScalar *H,Vec w,PetscBool isherm) { PetscErrorCode ierr; PetscInt i,j; PetscFunctionBegin; if (isherm) { for (j=0;jdata; PetscInt i; PetscScalar d; PetscReal dx,dy; for (i=0;ieigr[i]-ctx->center)/ctx->radius; dx = PetscRealPart(d); dy = PetscImaginaryPart(d); if ((dx*dx+(dy*dy)/(ctx->vscale*ctx->vscale))<=1) fl[i] = PETSC_TRUE; else fl[i] = PETSC_FALSE; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_CISS" PetscErrorCode EPSSetUp_CISS(EPS eps) { PetscErrorCode ierr; PetscInt i; Vec stemp; EPS_CISS *ctx = (EPS_CISS*)eps->data; const char *prefix; PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"CISS only works for complex scalars"); #endif eps->ncv = PetscMin(eps->n,ctx->L*ctx->M); if (!eps->mpd) eps->mpd = eps->ncv; if (!eps->which) eps->which = EPS_ALL; if (!eps->extraction) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); if (ctx->isreal && PetscImaginaryPart(ctx->center) == 0.0) ctx->useconj = PETSC_TRUE; else ctx->useconj = PETSC_FALSE; if (!ctx->delta) ctx->delta = PetscMin((eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL*1e-1:eps->tol*1e-1),1e-12); if (!ctx->vscale) { if (eps->ishermitian && (eps->ispositive || !eps->isgeneralized) && PetscImaginaryPart(ctx->center) == 0.0) ctx->vscale = 0.1; else ctx->vscale = 1.0; } /* create split comm */ ierr = SetSolverComm(eps);CHKERRQ(ierr); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = PetscMalloc(ctx->N*sizeof(PetscScalar),&ctx->weight);CHKERRQ(ierr); ierr = PetscMalloc(ctx->N*sizeof(PetscScalar),&ctx->omega);CHKERRQ(ierr); ierr = PetscMalloc(ctx->N*sizeof(PetscScalar),&ctx->pp);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,3*ctx->N*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMalloc(ctx->L*ctx->M*sizeof(PetscReal),&ctx->sigma);CHKERRQ(ierr); /* create a template vector for Vecs on solver communicator */ ierr = VecCreateMPI(PetscObjectComm((PetscObject)eps),PETSC_DECIDE,eps->n,&stemp); CHKERRQ(ierr); ierr = VecDuplicateVecs(stemp,ctx->L,&ctx->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,ctx->L,ctx->V);CHKERRQ(ierr); ierr = VecDestroy(&stemp);CHKERRQ(ierr); ierr = PetscMalloc(ctx->num_solve_point*sizeof(KSP),&ctx->ksp);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ctx->num_solve_point*sizeof(KSP));CHKERRQ(ierr); for (i=0;inum_solve_point;i++) { ierr = KSPCreate(PetscObjectComm((PetscObject)eps),&ctx->ksp[i]);CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)ctx->ksp[i],(PetscObject)eps,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->ksp[i]);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(ctx->ksp[i],"eps_ciss_");CHKERRQ(ierr); ierr = EPSGetOptionsPrefix(eps,&prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(ctx->ksp[i],prefix);CHKERRQ(ierr); } ierr = PetscMalloc(ctx->num_solve_point*ctx->L_max*sizeof(Vec),&ctx->Y);CHKERRQ(ierr); ierr = PetscMemzero(ctx->Y,ctx->num_solve_point*ctx->L_max*sizeof(Vec));CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ctx->num_solve_point*ctx->L_max*sizeof(Vec));CHKERRQ(ierr); if (eps->isgeneralized) { if (eps->ishermitian && eps->ispositive) { ierr = DSSetType(eps->ds,DSGHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSGNHEP);CHKERRQ(ierr); } } else { if (eps->ishermitian) { ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); } } ierr = DSAllocate(eps->ds,eps->ncv);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,2);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_CISS; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_CISS" PetscErrorCode EPSSolve_CISS(EPS eps) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscInt i,j,k,ld,nv,nmat,nvecs,L_add=0,inner,outer,L_base=ctx->L; PetscScalar *H,*rr,*pX,*tdata,*vdata,*Mu; PetscReal *tau,s1,s2,tau_max=0.0,*temp,error,max_error; PetscBool *fl; Mat A,B; Vec w=eps->work[0],tempv=eps->work[1],*H0,aux; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } else B = NULL; ierr = SetPathParameter(eps);CHKERRQ(ierr); for (i=0;iL;i++) { ierr = CISSVecSetRandom(ctx->V[i],eps->rand);CHKERRQ(ierr); } ierr = SolveLinearSystem(eps);CHKERRQ(ierr); ierr = ConstructS(eps,1,&ctx->S);CHKERRQ(ierr); nvecs = ctx->L; ierr = EstimateNumberEigs(eps,ctx->S,&L_add);CHKERRQ(ierr); if (L_add>0) { ierr = PetscInfo2(eps,"Changing L %d -> %d by Estimate #Eig\n",ctx->L,ctx->L+L_add);CHKERRQ(ierr); ierr = SetAddVector(eps,ctx->L+L_add);CHKERRQ(ierr); ierr = SolveAddLinearSystem(eps,ctx->L,ctx->L+L_add);CHKERRQ(ierr); ctx->L += L_add; ierr = PetscFree(ctx->sigma);CHKERRQ(ierr); ierr = PetscMalloc(ctx->L*ctx->M*sizeof(PetscReal),&ctx->sigma);CHKERRQ(ierr); } for (i=0;irefine_blocksize;i++) { ierr = PetscMalloc(ctx->L*ctx->L*ctx->M*2*sizeof(PetscScalar),&Mu);CHKERRQ(ierr); ierr = CalcMu(eps,Mu);CHKERRQ(ierr); ierr = VecCreateMPI(PetscObjectComm((PetscObject)eps),PETSC_DECIDE,ctx->L*ctx->M,&aux);CHKERRQ(ierr); ierr = VecDuplicateVecs(aux,ctx->L*ctx->M,&H0);CHKERRQ(ierr); ierr = VecDestroy(&aux);CHKERRQ(ierr); ierr = BlockHankel(eps,Mu,0,H0);CHKERRQ(ierr); ierr = SVD(eps,H0,&nv,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscFree(Mu);CHKERRQ(ierr); ierr = VecDestroyVecs(ctx->L*ctx->M,&H0);CHKERRQ(ierr); if (ctx->sigma[0]<=ctx->delta || nv < ctx->L*ctx->M) break; L_add = L_base; ierr = PetscInfo2(eps,"Changing L %d -> %d by SVD(H0)\n",ctx->L,ctx->L+L_add);CHKERRQ(ierr); ierr = SetAddVector(eps,ctx->L+L_add);CHKERRQ(ierr); ierr = SolveAddLinearSystem(eps,ctx->L,ctx->L+L_add);CHKERRQ(ierr); ctx->L += L_add; ierr = PetscFree(ctx->sigma);CHKERRQ(ierr); ierr = PetscMalloc(ctx->L*ctx->M*sizeof(PetscReal),&ctx->sigma);CHKERRQ(ierr); } if (ctx->L != L_base) { eps->ncv = PetscMin(eps->n,ctx->L*ctx->M); eps->mpd = eps->ncv; ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = DSReset(eps->ds);CHKERRQ(ierr); ierr = DSSetEigenvalueComparison(eps->ds,eps->comparison,eps->comparisonctx);CHKERRQ(ierr); if (eps->isgeneralized) { if (eps->ishermitian && eps->ispositive) { ierr = DSSetType(eps->ds,DSGHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSGNHEP);CHKERRQ(ierr); } } else { if (eps->ishermitian) { ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); } } ierr = DSAllocate(eps->ds,eps->ncv);CHKERRQ(ierr); ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); } for (outer=0;outer<=ctx->refine_outer;outer++) { for (inner=0;inner<=ctx->refine_inner;inner++) { ierr = VecDestroyVecs(nvecs,&ctx->S);CHKERRQ(ierr); ierr = ConstructS(eps,ctx->M,&ctx->S);CHKERRQ(ierr); nvecs = ctx->M*ctx->L; ierr = SVD(eps,ctx->S,&nv,PETSC_TRUE);CHKERRQ(ierr); if (ctx->sigma[0]>ctx->delta && nv==ctx->L*ctx->M && inner!=ctx->refine_inner) { for (i=0;iL;i++) { ierr = VecCopy(ctx->S[i],ctx->V[i]);CHKERRQ(ierr); } ierr = SolveAddLinearSystem(eps,0,ctx->L);CHKERRQ(ierr); } else break; } eps->nconv = 0; if (nv == 0) break; ierr = DSSetDimensions(eps->ds,nv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_A,&H);CHKERRQ(ierr); ierr = ProjectMatrix(A,nv,ld,ctx->S,H,w,eps->ishermitian);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_A,&H);CHKERRQ(ierr); if (nmat>1) { ierr = DSGetArray(eps->ds,DS_MAT_B,&H);CHKERRQ(ierr); ierr = ProjectMatrix(B,nv,ld,ctx->S,H,w,eps->ishermitian);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_B,&H);CHKERRQ(ierr); } ierr = DSSolve(eps->ds,eps->eigr,NULL);CHKERRQ(ierr); ierr = PetscMalloc(nv*sizeof(PetscReal),&tau);CHKERRQ(ierr); ierr = DSVectors(eps->ds,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_X,&pX);CHKERRQ(ierr); for (i=0;isigma[j]; } tau[i] = s1/s2; tau_max = PetscMax(tau_max,tau[i]); } tau_max /= ctx->sigma[0]; ierr = DSRestoreArray(eps->ds,DS_MAT_X,&pX);CHKERRQ(ierr); for (i=0;i=ctx->spurious_threshold*tau_max) { rr[i] = 1.0; eps->nconv++; } else rr[i] = 0.0; } ierr = PetscFree(tau);CHKERRQ(ierr); ierr = PetscFree(fl);CHKERRQ(ierr); ierr = DSSetEigenvalueComparison(eps->ds,SlepcCompareLargestMagnitude,NULL);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,NULL,rr,NULL,&eps->nconv);CHKERRQ(ierr); ierr = DSSetEigenvalueComparison(eps->ds,eps->comparison,eps->comparisonctx);CHKERRQ(ierr); ierr = PetscFree(rr);CHKERRQ(ierr); for (i=0;iS[i],eps->V[i]);CHKERRQ(ierr); } ierr = DSVectors(eps->ds,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_X,&pX);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,ctx->S,0,eps->nconv,pX,ld,PETSC_FALSE);CHKERRQ(ierr); if (eps->ishermitian) { /* compute eigenvectors */ ierr = SlepcUpdateVectors(nv,eps->V,0,eps->nconv,pX,ld,PETSC_FALSE);CHKERRQ(ierr); } ierr = DSRestoreArray(eps->ds,DS_MAT_X,&pX);CHKERRQ(ierr); max_error = 0.0; for (i=0;inconv;i++) { ierr = VecNormalize(eps->V[i],NULL);CHKERRQ(ierr); ierr = VecNormalize(ctx->S[i],NULL);CHKERRQ(ierr); ierr = EPSComputeRelativeError_Private(eps,eps->eigr[i],0,ctx->S[i],NULL,&error);CHKERRQ(ierr); max_error = PetscMax(max_error,error); } if (max_error <= eps->tol || outer == ctx->refine_outer) break; ierr = PetscMalloc(ctx->L*eps->nconv*sizeof(PetscReal),&temp);CHKERRQ(ierr); for (i=0;iL*eps->nconv;i++) { ierr = PetscRandomGetValueReal(eps->rand,&temp[i]);CHKERRQ(ierr); temp[i] = 2*temp[i]-1; } for (k=0;kL;k++) { ierr = VecGetArray(tempv,&tdata);CHKERRQ(ierr); for (j=0;jnconv;j++) { ierr = VecGetArray(ctx->S[j],&vdata);CHKERRQ(ierr); for (i=0;in;i++) { if (j==0) tdata[i] = vdata[i]*temp[j+eps->nconv*k]; else tdata[i] = tdata[i]+vdata[i]*temp[j+eps->nconv*k]; } ierr = VecRestoreArray(ctx->S[j],&vdata);CHKERRQ(ierr); } ierr = VecRestoreArray(tempv,&tdata);CHKERRQ(ierr); ierr = VecCopy(tempv,ctx->V[k]);CHKERRQ(ierr); } ierr = PetscFree(temp);CHKERRQ(ierr); ierr = SolveAddLinearSystem(eps,0,ctx->L);CHKERRQ(ierr); } eps->reason = EPS_CONVERGED_TOL; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetRegion_CISS" static PetscErrorCode EPSCISSSetRegion_CISS(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; ctx->center = center; if (radius) { if (radius == PETSC_DEFAULT) { ctx->radius = 1.0; } else { if (radius<0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The radius argument must be > 0.0"); ctx->radius = radius; } } if (vscale) { if (vscale<0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The vscale argument must be > 0.0"); ctx->vscale = vscale; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetRegion" /*@ EPSCISSSetRegion - Sets the parameters defining the region where eigenvalues must be computed. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . center - center of the region . radius - radius of the region - vscale - vertical scale of the region Options Database Keys: + -eps_ciss_center - Sets the center . -eps_ciss_radius - Sets the radius - -eps_ciss_vscale - Sets the vertical scale Level: advanced .seealso: EPSCISSGetRegion() @*/ PetscErrorCode EPSCISSSetRegion(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveScalar(eps,center,2); PetscValidLogicalCollectiveReal(eps,radius,3); PetscValidLogicalCollectiveReal(eps,vscale,4); ierr = PetscTryMethod(eps,"EPSCISSSetRegion_C",(EPS,PetscScalar,PetscReal,PetscReal),(eps,center,radius,vscale));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetRegion_CISS" static PetscErrorCode EPSCISSGetRegion_CISS(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (center) *center = ctx->center; if (radius) *radius = ctx->radius; if (vscale) *vscale = ctx->vscale; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetRegion" /*@ EPSCISSGetRegion - Gets the parameters that define the region where eigenvalues must be computed. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: + center - center of the region . radius - radius of the region - vscale - vertical scale of the region Level: advanced .seealso: EPSCISSSetRegion() @*/ PetscErrorCode EPSCISSGetRegion(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSCISSGetRegion_C",(EPS,PetscScalar*,PetscReal*,PetscReal*),(eps,center,radius,vscale));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetSizes_CISS" static PetscErrorCode EPSCISSSetSizes_CISS(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (ip) { if (ip == PETSC_DECIDE || ip == PETSC_DEFAULT) { if (ctx->N!=32) { ctx->N =32; ctx->M = ctx->N/4; } } else { if (ip<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ip argument must be > 0"); if (ip%2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ip argument must be an even number"); if (ctx->N!=ip) { ctx->N = ip; ctx->M = ctx->N/4; } } } if (bs) { if (bs == PETSC_DECIDE || bs == PETSC_DEFAULT) { ctx->L = 16; } else { if (bs<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The bs argument must be > 0"); if (bs>ctx->L_max) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The bs argument must be less than or equal to the maximum number of block size"); ctx->L = bs; } } if (ms) { if (ms == PETSC_DECIDE || ms == PETSC_DEFAULT) { ctx->M = ctx->N/4; } else { if (ms<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ms argument must be > 0"); if (ms>ctx->N) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ms argument must be less than or equal to the number of integration points"); ctx->M = ms; } } if (npart) { if (npart == PETSC_DECIDE || npart == PETSC_DEFAULT) { ctx->npart = 1; } else { if (npart<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The npart argument must be > 0"); ctx->npart = npart; } } if (bsmax) { if (bsmax == PETSC_DECIDE || bsmax == PETSC_DEFAULT) { ctx->L = 256; } else { if (bsmax<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The bsmax argument must be > 0"); if (bsmaxL) ctx->L_max = ctx->L; else ctx->L_max = bsmax; } } ctx->isreal = isreal; ierr = EPSReset(eps);CHKERRQ(ierr); /* clean allocated arrays and force new setup */ PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetSizes" /*@ EPSCISSSetSizes - Sets the values of various size parameters in the CISS solver. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . ip - number of integration points . bs - block size . ms - moment size . npart - number of partitions when splitting the communicator . bsmax - max block size - isreal - A and B are real Options Database Keys: + -eps_ciss_integration_points - Sets the number of integration points . -eps_ciss_blocksize - Sets the block size . -eps_ciss_moments - Sets the moment size . -eps_ciss_partitions - Sets the number of partitions . -eps_ciss_maxblocksize - Sets the maximum block size - -eps_ciss_realmats - A and B are real Note: The default number of partitions is 1. This means the internal KSP object is shared among all processes of the EPS communicator. Otherwise, the communicator is split into npart communicators, so that npart KSP solves proceed simultaneously. Level: advanced .seealso: EPSCISSGetSizes() @*/ PetscErrorCode EPSCISSSetSizes(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,ip,2); PetscValidLogicalCollectiveInt(eps,bs,3); PetscValidLogicalCollectiveInt(eps,ms,4); PetscValidLogicalCollectiveInt(eps,npart,5); PetscValidLogicalCollectiveInt(eps,bsmax,6); PetscValidLogicalCollectiveBool(eps,isreal,7); ierr = PetscTryMethod(eps,"EPSCISSSetSizes_C",(EPS,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscBool),(eps,ip,bs,ms,npart,bsmax,isreal));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetSizes_CISS" static PetscErrorCode EPSCISSGetSizes_CISS(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (ip) *ip = ctx->N; if (bs) *bs = ctx->L; if (ms) *ms = ctx->M; if (npart) *npart = ctx->npart; if (bsmax) *bsmax = ctx->L_max; if (isreal) *isreal = ctx->isreal; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetSizes" /*@ EPSCISSGetSizes - Gets the values of various size parameters in the CISS solver. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: + ip - number of integration points . bs - block size . ms - moment size . npart - number of partitions when splitting the communicator . bsmax - max block size - isreal - A and B are real Level: advanced .seealso: EPSCISSSetSizes() @*/ PetscErrorCode EPSCISSGetSizes(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSCISSGetSizes_C",(EPS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscBool*),(eps,ip,bs,ms,npart,bsmax,isreal));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetThreshold_CISS" static PetscErrorCode EPSCISSSetThreshold_CISS(EPS eps,PetscReal delta,PetscReal spur) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (delta) { if (delta == PETSC_DEFAULT) { ctx->delta = 1e-12; } else { if (delta<=0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The delta argument must be > 0.0"); ctx->delta = delta; } } if (spur) { if (spur == PETSC_DEFAULT) { ctx->spurious_threshold = 1e-4; } else { if (spur<=0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The spurious threshold argument must be > 0.0"); ctx->spurious_threshold = spur; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetThreshold" /*@ EPSCISSSetThreshold - Sets the values of various threshold parameters in the CISS solver. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . delta - threshold for numerical rank - spur - spurious threshold (to discard spurious eigenpairs) Options Database Keys: + -eps_ciss_delta - Sets the delta - -eps_ciss_spurious_threshold - Sets the spurious threshold Level: advanced .seealso: EPSCISSGetThreshold() @*/ PetscErrorCode EPSCISSSetThreshold(EPS eps,PetscReal delta,PetscReal spur) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveReal(eps,delta,2); PetscValidLogicalCollectiveReal(eps,spur,3); ierr = PetscTryMethod(eps,"EPSCISSSetThreshold_C",(EPS,PetscReal,PetscReal),(eps,delta,spur));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetThreshold_CISS" static PetscErrorCode EPSCISSGetThreshold_CISS(EPS eps,PetscReal *delta,PetscReal *spur) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (delta) *delta = ctx->delta; if (spur) *spur = ctx->spurious_threshold; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetThreshold" /*@ EPSCISSGetThreshold - Gets the values of various threshold parameters in the CISS solver. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: + delta - threshold for numerical rank - spur - spurious threshold (to discard spurious eigenpairs) Level: advanced .seealso: EPSCISSSetThreshold() @*/ PetscErrorCode EPSCISSGetThreshold(EPS eps,PetscReal *delta,PetscReal *spur) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSCISSGetThreshold_C",(EPS,PetscReal*,PetscReal*),(eps,delta,spur));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetRefinement_CISS" static PetscErrorCode EPSCISSSetRefinement_CISS(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (inner == PETSC_DEFAULT) { ctx->refine_inner = 0; } else { if (inner<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The refine inner argument must be >= 0"); ctx->refine_inner = inner; } if (outer == PETSC_DEFAULT) { ctx->refine_outer = 0; } else { if (outer<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The refine outer argument must be >= 0"); ctx->refine_outer = outer; } if (blsize == PETSC_DEFAULT) { ctx->refine_blocksize = 0; } else { if (blsize<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The refine blocksize argument must be >= 0"); ctx->refine_blocksize = blsize; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSSetRefinement" /*@ EPSCISSSetRefinement - Sets the values of various refinement parameters in the CISS solver. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context . inner - number of iterative refinement iterations (inner loop) . outer - number of iterative refinement iterations (outer loop) - blsize - number of iterative refinement iterations (blocksize loop) Options Database Keys: + -eps_ciss_refine_inner - Sets number of inner iterations . -eps_ciss_refine_outer - Sets number of outer iterations - -eps_ciss_refine_blocksize - Sets number of blocksize iterations Level: advanced .seealso: EPSCISSGetRefinement() @*/ PetscErrorCode EPSCISSSetRefinement(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,inner,2); PetscValidLogicalCollectiveInt(eps,outer,3); PetscValidLogicalCollectiveInt(eps,blsize,4); ierr = PetscTryMethod(eps,"EPSCISSSetRefinement_C",(EPS,PetscInt,PetscInt,PetscInt),(eps,inner,outer,blsize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetRefinement_CISS" static PetscErrorCode EPSCISSGetRefinement_CISS(EPS eps,PetscInt *inner,PetscInt *outer,PetscInt *blsize) { EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; if (inner) *inner = ctx->refine_inner; if (outer) *outer = ctx->refine_outer; if (blsize) *blsize = ctx->refine_blocksize; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCISSGetRefinement" /*@ EPSCISSGetRefinement - Gets the values of various refinement parameters in the CISS solver. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameters: + inner - number of iterative refinement iterations (inner loop) . outer - number of iterative refinement iterations (outer loop) - blsize - number of iterative refinement iterations (blocksize loop) Level: advanced .seealso: EPSCISSSetRefinement() @*/ PetscErrorCode EPSCISSGetRefinement(EPS eps, PetscInt *inner, PetscInt *outer,PetscInt *blsize) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSCISSGetRefinement_C",(EPS,PetscInt*,PetscInt*,PetscInt*),(eps,inner,outer,blsize));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_CISS" PetscErrorCode EPSReset_CISS(EPS eps) { PetscErrorCode ierr; PetscInt i; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; ierr = PetscFree(ctx->weight);CHKERRQ(ierr); ierr = PetscFree(ctx->omega);CHKERRQ(ierr); ierr = PetscFree(ctx->pp);CHKERRQ(ierr); ierr = VecDestroyVecs(ctx->L,&ctx->V);CHKERRQ(ierr); for (i=0;inum_solve_point;i++) { ierr = KSPDestroy(&ctx->ksp[i]);CHKERRQ(ierr); } ierr = PetscFree(ctx->ksp);CHKERRQ(ierr); ierr = PetscFree(ctx->sigma);CHKERRQ(ierr); for (i=0;inum_solve_point*ctx->L_max;i++) { ierr = VecDestroy(&ctx->Y[i]);CHKERRQ(ierr); } ierr = PetscFree(ctx->Y);CHKERRQ(ierr); ierr = VecDestroyVecs(ctx->M*ctx->L,&ctx->S);CHKERRQ(ierr); ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_CISS" PetscErrorCode EPSSetFromOptions_CISS(EPS eps) { PetscErrorCode ierr; PetscScalar s; PetscReal r1,r2,r3,r4; PetscInt i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0; PetscBool b1=PETSC_FALSE; PetscFunctionBegin; ierr = PetscOptionsHead("EPS CISS Options");CHKERRQ(ierr); ierr = EPSCISSGetRegion(eps,&s,&r1,&r2);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_ciss_radius","CISS radius of region","EPSCISSSetRegion",r1,&r1,NULL);CHKERRQ(ierr); ierr = PetscOptionsScalar("-eps_ciss_center","CISS center of region","EPSCISSSetRegion",s,&s,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_ciss_vscale","CISS vertical scale of region","EPSCISSSetRegion",r2,&r2,NULL);CHKERRQ(ierr); ierr = EPSCISSSetRegion(eps,s,r1,r2);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_integration_points","CISS number of integration points","EPSCISSSetSizes",i1,&i1,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_blocksize","CISS block size","EPSCISSSetSizes",i2,&i2,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_moments","CISS moment size","EPSCISSSetSizes",i3,&i3,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_partitions","CISS number of partitions","EPSCISSSetSizes",i4,&i4,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_maxblocksize","CISS maximum block size","EPSCISSSetSizes",i5,&i5,NULL);CHKERRQ(ierr); ierr = PetscOptionsBool("-eps_ciss_realmats","CISS A and B are real","EPSCISSSetSizes",b1,&b1,NULL);CHKERRQ(ierr); ierr = EPSCISSSetSizes(eps,i1,i2,i3,i4,i5,b1);CHKERRQ(ierr); ierr = EPSCISSGetThreshold(eps,&r3,&r4);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_ciss_delta","CISS threshold for numerical rank","EPSCISSSetThreshold",r3,&r3,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_ciss_spurious_threshold","CISS threshold for the spurious eigenpairs","EPSCISSSetThreshold",r4,&r4,NULL);CHKERRQ(ierr); ierr = EPSCISSSetThreshold(eps,r3,r4);CHKERRQ(ierr); ierr = EPSCISSGetRefinement(eps,&i6,&i7,&i8);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_refine_inner","CISS number of inner iterative refinement iterations","EPSCISSSetRefinement",i6,&i6,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_refine_outer","CISS number of outer iterative refinement iterations","EPSCISSSetRefinement",i7,&i7,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ciss_refine_blocksize","CISS number of blocksize iterative refinement iterations","EPSCISSSetRefinement",i8,&i8,NULL);CHKERRQ(ierr); ierr = EPSCISSSetRefinement(eps,i6,i7,i8);CHKERRQ(ierr); ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_CISS" PetscErrorCode EPSDestroy_CISS(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRegion_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRegion_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetSizes_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetSizes_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetThreshold_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetThreshold_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRefinement_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRefinement_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_CISS" PetscErrorCode EPSView_CISS(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscBool isascii; char str[50]; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = SlepcSNPrintfScalar(str,50,ctx->center,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," CISS: region { center: %s, radius: %G, vscale: %G }\n",str,ctx->radius,ctx->vscale);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," CISS: sizes { integration points: %D, block size: %D, moment size: %D, partitions: %D, maximum block size: %D }\n",ctx->N,ctx->L,ctx->M,ctx->npart,ctx->L_max);CHKERRQ(ierr); if (ctx->isreal) { ierr = PetscViewerASCIIPrintf(viewer," CISS: exploiting symmetry of integration points\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," CISS: threshold { delta: %G, spurious threshold: %G }\n",ctx->delta,ctx->spurious_threshold);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," CISS: iterative refinement { inner: %D, outer: %D, blocksize: %D }\n",ctx->refine_inner,ctx->refine_outer, ctx->refine_blocksize);CHKERRQ(ierr); ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = KSPView(ctx->ksp[0],viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_CISS" PETSC_EXTERN PetscErrorCode EPSCreate_CISS(EPS eps) { PetscErrorCode ierr; EPS_CISS *ctx = (EPS_CISS*)eps->data; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_CISS,&ctx);CHKERRQ(ierr); eps->data = ctx; eps->ops->setup = EPSSetUp_CISS; eps->ops->setfromoptions = EPSSetFromOptions_CISS; eps->ops->destroy = EPSDestroy_CISS; eps->ops->reset = EPSReset_CISS; eps->ops->view = EPSView_CISS; eps->ops->backtransform = PETSC_NULL; eps->ops->computevectors = EPSComputeVectors_Schur; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRegion_C",EPSCISSSetRegion_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRegion_C",EPSCISSGetRegion_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetSizes_C",EPSCISSSetSizes_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetSizes_C",EPSCISSGetSizes_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetThreshold_C",EPSCISSSetThreshold_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetThreshold_C",EPSCISSGetThreshold_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRefinement_C",EPSCISSSetRefinement_CISS);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRefinement_C",EPSCISSGetRefinement_CISS);CHKERRQ(ierr); /* set default values of parameters */ ctx->center = 0.0; ctx->radius = 1.0; ctx->vscale = 0.0; ctx->N = 32; ctx->L = 16; ctx->M = ctx->N/4; ctx->delta = 0; ctx->npart = 1; ctx->L_max = 128; ctx->spurious_threshold = 1e-4; ctx->isreal = PETSC_FALSE; ctx->refine_outer = 1; ctx->refine_inner = 1; ctx->refine_blocksize = 1; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/ciss.c.html0000644000175000017500000030522212211062077021152 0ustar gladkgladk

Actual source code: ciss.c

  1: /*

  3:    SLEPc eigensolver: "ciss"

  5:    Method: Contour Integral Spectral Slicing

  7:    Algorithm:

  9:        Contour integral based on Sakurai-Sugiura method to construct a
 10:        subspace, with various eigenpair extractions (Rayleigh-Ritz,
 11:        explicit moment).

 13:    Based on code contributed by Tetsuya Sakurai.

 15:    References:

 17:        [1] T. Sakurai and H. Sugiura, "A projection method for generalized
 18:            eigenvalue problems", J. Comput. Appl. Math. 159:119-128, 2003.

 20:        [2] T. Sakurai and H. Tadano, "CIRR: a Rayleigh-Ritz type method with
 21:            contour integral for generalized eigenvalue problems", Hokkaido
 22:            Math. J. 36:745-757, 2007.

 24:    Last update: Jun 2013

 26:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 27:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 28:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 30:    This file is part of SLEPc.

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

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

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

 46: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 47: #include <slepcblaslapack.h>

 49: PetscErrorCode EPSSolve_CISS(EPS);

 51: typedef struct {
 52:   /* parameters */
 53:   PetscScalar center;     /* center of the region where to find eigenpairs (default: 0.0) */
 54:   PetscReal   radius;     /* radius of the region (1.0) */
 55:   PetscReal   vscale;     /* vertical scale of the region (1.0; 0.1 if spectrum real) */
 56:   PetscInt    N;          /* number of integration points (32) */
 57:   PetscInt    L;          /* block size (16) */
 58:   PetscInt    M;          /* moment degree (N/4 = 4) */
 59:   PetscReal   delta;      /* threshold of singular value (1e-12) */
 60:   PetscInt    npart;      /* number of partitions of the matrix (1) */
 61:   PetscReal   *sigma;     /* threshold for numerical rank */
 62:   PetscInt    L_max;      /* maximum number of columns of the source matrix V */
 63:   PetscReal   spurious_threshold; /* discard spurious eigenpairs */
 64:   PetscBool   isreal;     /* A and B are real */
 65:   PetscInt    refine_inner;
 66:   PetscInt    refine_outer;
 67:   PetscInt    refine_blocksize;
 68:   /* private data */
 69:   PetscInt    solver_comm_id;
 70:   PetscInt    num_solve_point;
 71:   PetscScalar *weight;
 72:   PetscScalar *omega;
 73:   PetscScalar *pp;
 74:   Vec         *V;
 75:   Vec         *Y;
 76:   Vec         *S;
 77:   KSP         *ksp;
 78:   PetscBool   useconj;
 79:   PetscReal   est_eig;
 80: } EPS_CISS;

 84: static PetscErrorCode SetSolverComm(EPS eps)
 85: {
 86:   EPS_CISS *ctx = (EPS_CISS*)eps->data;
 87:   PetscInt N = ctx->N;

 90:   if (ctx->useconj) N = N/2;
 91:   ctx->solver_comm_id = 0;
 92:   ctx->num_solve_point = N;
 93:   return(0);
 94: }

 98: static PetscErrorCode SetPathParameter(EPS eps)
 99: {
100:   EPS_CISS  *ctx = (EPS_CISS*)eps->data;
101:   PetscInt  i;
102:   PetscReal theta;

105:   for (i=0;i<ctx->N;i++){
106:     theta = ((2*PETSC_PI)/ctx->N)*(i+0.5);
107:     ctx->pp[i] = cos(theta) + PETSC_i*ctx->vscale*sin(theta);
108:     ctx->omega[i] = ctx->center + ctx->radius*ctx->pp[i];
109:     ctx->weight[i] = ctx->vscale*cos(theta) + PETSC_i*sin(theta);
110:   }
111:   return(0);
112: }

116: static PetscErrorCode CISSVecSetRandom(Vec x,PetscRandom rctx)
117: {
119:   PetscInt       j,nlocal;
120:   PetscScalar    *vdata;

123:   SlepcVecSetRandom(x,rctx);
124:   VecGetLocalSize(x,&nlocal);
125:   VecGetArray(x,&vdata);
126:   for (j=0;j<nlocal;j++) {
127:     vdata[j] = PetscRealPart(vdata[j]);
128:     if (PetscRealPart(vdata[j]) < 0.5) vdata[j] = -1.0;
129:     else vdata[j] = 1.0;
130:   }
131:   VecRestoreArray(x,&vdata);
132:   return(0);
133: }

137: static PetscErrorCode SolveLinearSystem(EPS eps)
138: {
140:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
141:   PetscInt       i,j,nmat,p_id;
142:   Mat            A,B,Fz;
143:   PC             pc;
144:   Vec            BV;

147:   STGetNumMatrices(eps->st,&nmat);
148:   STGetOperators(eps->st,0,&A);
149:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
150:   else B = NULL;
151:   MatDuplicate(A,MAT_DO_NOT_COPY_VALUES,&Fz);
152:   VecDuplicate(ctx->V[0],&BV);

154:   for (i=0;i<ctx->num_solve_point;i++) {
155:     p_id = ctx->solver_comm_id * ctx->num_solve_point + i;
156:     MatCopy(A,Fz,DIFFERENT_NONZERO_PATTERN);
157:     if (nmat>1) {
158:       MatAXPY(Fz,-ctx->omega[p_id],B,DIFFERENT_NONZERO_PATTERN);
159:     } else {
160:       MatShift(Fz,-ctx->omega[p_id]);
161:     }
162:     KSPSetOperators(ctx->ksp[i],Fz,Fz,SAME_NONZERO_PATTERN);
163:     KSPSetType(ctx->ksp[i],KSPPREONLY);
164:     KSPGetPC(ctx->ksp[i],&pc);
165:     PCSetType(pc,PCREDUNDANT);
166:     KSPSetFromOptions(ctx->ksp[i]);
167:     for (j=0;j<ctx->L;j++) {
168:       VecDuplicate(ctx->V[0],&ctx->Y[i*ctx->L_max+j]);
169:       PetscLogObjectParent(eps,ctx->Y[i*ctx->L_max+j]);
170:       if (nmat==2) {
171:         MatMult(B,ctx->V[j],BV);
172:         KSPSolve(ctx->ksp[i],BV,ctx->Y[i*ctx->L_max+j]);
173:       } else {
174:         KSPSolve(ctx->ksp[i],ctx->V[j],ctx->Y[i*ctx->L_max+j]);
175:       }
176:     }
177:   }
178:   MatDestroy(&Fz);
179:   VecDestroy(&BV);
180:   return(0);
181: }

185: static PetscErrorCode ConstructS(EPS eps,PetscInt M,Vec **S)
186: {
188:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
189:   PetscInt       i,j,k;
190:   Vec            v;
191:   PetscScalar    *ppk;

194:   VecDuplicateVecs(ctx->Y[0],M*ctx->L,S);
195:   PetscMalloc(ctx->num_solve_point*sizeof(PetscScalar),&ppk);
196:   for (i=0;i<ctx->num_solve_point;i++) ppk[i] = 1;
197:   VecDuplicate(ctx->Y[0],&v);
198:   for (k=0;k<M;k++) {
199:     for (j=0;j<ctx->L;j++) {
200:       VecSet(v,0);
201:       for (i=0;i<ctx->num_solve_point; i++) {
202:         VecAXPY(v,ppk[i]*ctx->weight[ctx->solver_comm_id*ctx->num_solve_point+i]/(PetscReal)ctx->N,ctx->Y[i*ctx->L_max+j]);
203:       }
204:       VecCopy(v,(*S)[k*ctx->L+j]);
205:     }
206:     for (i=0;i<ctx->num_solve_point;i++) {
207:       ppk[i] *= ctx->pp[ctx->solver_comm_id*ctx->num_solve_point+i];
208:     }
209:   }
210:   PetscFree(ppk);
211:   VecDestroy(&v);
212:   return(0);
213: }

217: static PetscErrorCode EstimateNumberEigs(EPS eps,Vec *S1,PetscInt *L_add)
218: {
220:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
221:   PetscInt       i,j,istart,p_start,p_end;
222:   PetscScalar    *data,*p_data,tmp,sum = 0.0;
223:   Vec            V_p;
224:   PetscReal      eta;

227:   VecGetOwnershipRange(ctx->V[0],&istart,NULL);
228:   VecGetOwnershipRange(S1[0],&p_start,&p_end);

230:   VecDuplicate(S1[0],&V_p);
231:   for (i=0;i<ctx->L;i++) {
232:     VecGetArray(ctx->V[i],&data);
233:     VecGetArray(V_p,&p_data);
234:     for (j=p_start;j<p_end;j++) p_data[j-p_start] = data[j-istart];
235:     VecRestoreArray(ctx->V[i],&data);
236:     VecRestoreArray(V_p,&p_data);
237:     VecDot(V_p,S1[i],&tmp);
238:     sum += tmp;
239:   }
240:   VecDestroy(&V_p);
241:   ctx->est_eig = PetscAbsScalar(ctx->radius*sum/(PetscReal)ctx->L);
242:   eta = PetscPowReal(10,-log10(eps->tol)/ctx->N);
243:   PetscInfo1(eps,"Estimation_#Eig %F\n",ctx->est_eig);
244:   *L_add = (PetscInt)ceil((ctx->est_eig*eta)/ctx->M) - ctx->L;
245:   if (*L_add < 0) *L_add = 0;
246:   if (*L_add>ctx->L_max-ctx->L) {
247:     PetscInfo(eps,"Number of eigenvalues around the contour path may be too large\n");
248:     *L_add = ctx->L_max-ctx->L;
249:   }
250:   return(0);
251: }

255: static PetscErrorCode SetAddVector(EPS eps,PetscInt Ladd_end)
256: {
258:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
259:   PetscInt       i,j,nlocal,Ladd_start=ctx->L;
260:   Vec            *newV;
261:   PetscScalar    *vdata;

264:   PetscMalloc(Ladd_end*sizeof(Vec*),&newV);
265:   for (i=0;i<ctx->L;i++) { newV[i] = ctx->V[i]; }
266:   PetscFree(ctx->V);
267:   ctx->V = newV;
268:   VecGetLocalSize(ctx->V[0],&nlocal);
269:   for (i=Ladd_start;i<Ladd_end;i++) {
270:     VecDuplicate(ctx->V[0],&ctx->V[i]);
271:     PetscLogObjectParent(eps,ctx->V[i]);
272:     CISSVecSetRandom(ctx->V[i],eps->rand);
273:     VecGetArray(ctx->V[i],&vdata);
274:     for (j=0;j<nlocal;j++) {
275:       vdata[j] = PetscRealPart(vdata[j]);
276:       if (PetscRealPart(vdata[j]) < 0.5) vdata[j] = -1.0;
277:       else vdata[j] = 1.0;
278:     }
279:     VecRestoreArray(ctx->V[i],&vdata);
280:   }
281:   return(0);
282: }

286: static PetscErrorCode SolveAddLinearSystem(EPS eps,PetscInt Ladd_start,PetscInt Ladd_end)
287: {
289:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
290:   PetscInt       i,j;

293:   for (i=0;i<ctx->num_solve_point;i++) {
294:     for (j=Ladd_start;j<Ladd_end;j++) {
295:       VecDestroy(&ctx->Y[i*ctx->L_max+j]);
296:       VecDuplicate(ctx->V[0],&ctx->Y[i*ctx->L_max+j]);
297:       PetscLogObjectParent(eps,ctx->Y[i*ctx->L_max+j]);
298:       KSPSolve(ctx->ksp[i],ctx->V[j],ctx->Y[i*ctx->L_max+j]);
299:     }
300:   }
301:   return(0);
302: }

306: static PetscErrorCode CalcMu(EPS eps,PetscScalar *Mu)
307: {
309:   PetscInt       i,j,k,s;
310:   PetscInt       rank_region,icolor,ikey;
311:   PetscScalar    *temp,*temp2,*ppk,alp;
312:   MPI_Comm       Row_Comm;
313:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;

316:   MPI_Comm_rank(PetscObjectComm((PetscObject)eps),&rank_region);
317:   icolor = rank_region % ctx->npart;
318:   ikey = rank_region / ctx->npart;
319:   MPI_Comm_split(PetscObjectComm((PetscObject)eps),icolor,ikey,&Row_Comm);

321:   PetscMalloc(ctx->num_solve_point*ctx->L*ctx->L*sizeof(PetscScalar),&temp);
322:   PetscMalloc(2*ctx->M*ctx->L*ctx->L*sizeof(PetscScalar),&temp2);
323:   PetscMalloc(ctx->num_solve_point*sizeof(PetscScalar),&ppk);
324:   for (i=0;i<2*ctx->M*ctx->L*ctx->L;i++) temp2[i] = 0;
325:   for (i=0; i<ctx->num_solve_point;i++) {
326:     for (j=0;j<ctx->L;j++) {
327:       VecMDot(ctx->Y[i*ctx->L_max+j],ctx->L,ctx->V,&temp[(j+i*ctx->L)*ctx->L]);
328:     }
329:   }

331:   for (i=0;i<ctx->num_solve_point;i++) ppk[i] = 1;
332:   for (k=0;k<2*ctx->M;k++) {
333:     for (j=0;j<ctx->L;j++) {
334:       for (i=0;i<ctx->num_solve_point;i++) {
335:           alp = ppk[i]*ctx->weight[ctx->solver_comm_id*ctx->num_solve_point+i]/(PetscReal)ctx->N;
336:         for (s=0;s<ctx->L;s++) {
337:           if (ctx->useconj) temp2[s+(j+k*ctx->L)*ctx->L] += PetscRealPart(alp*temp[s+(j+i*ctx->L)*ctx->L])*2;
338:           else temp2[s+(j+k*ctx->L)*ctx->L] += alp*temp[s+(j+i*ctx->L)*ctx->L];
339:         }
340:       }
341:     }
342:     for (i=0;i<ctx->num_solve_point;i++)
343:       ppk[i] *= ctx->pp[ctx->solver_comm_id*ctx->num_solve_point+i];
344:   }
345:   MPI_Allreduce(temp2,Mu,2*ctx->M*ctx->L*ctx->L,MPIU_SCALAR,MPIU_SUM,Row_Comm);

347:   PetscFree(ppk);
348:   PetscFree(temp);
349:   PetscFree(temp2);
350:   return(0);
351: }

355: static PetscErrorCode BlockHankel(EPS eps,PetscScalar *Mu,PetscInt s,Vec *H)
356: {
357:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
358:   PetscInt       i,j,k,L=ctx->L,M=ctx->M;
359:   PetscScalar    *H_data;

363:   for (k=0;k<L*M;k++) {
364:     VecGetArray(H[k],&H_data);
365:     for (j=0;j<M;j++)
366:       for (i=0;i<L;i++)
367:         H_data[j*L+i] = Mu[i+k*L+(j+s)*L*L];
368:     VecRestoreArray(H[k],&H_data);
369:   }
370:   return(0);
371: }

375: static PetscErrorCode SVD(EPS eps,Vec *Q,PetscInt *K,PetscBool isqr)
376: {
378:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
379:   PetscInt       i,j,k,ld,ml=ctx->L*ctx->M,n=eps->n;
380:   PetscScalar    *R,*w,*s;
381:   DS             ds;

384:   if (isqr) {
385:     PetscMalloc(ml*ml*sizeof(PetscScalar),&s);
386:     PetscMemzero(s,ml*ml*sizeof(PetscScalar));
387:     IPQRDecomposition(eps->ip,Q,0,ml,s,ml);
388:   }

390:   DSCreate(PETSC_COMM_WORLD,&ds);
391:   DSSetType(ds,DSSVD);
392:   DSSetFromOptions(ds);
393:   ld = ml;
394:   DSAllocate(ds,ld);
395:   k = PetscMin(n,ml);
396:   DSSetDimensions(ds,k,ml,0,0);
397:   DSGetArray(ds,DS_MAT_A,&R);
398:   if (isqr) {
399:     for (i=0;i<ml;i++)
400:       for (j=0;j<k;j++)
401:         R[i*ld+j] = s[i*ml+j];
402:   } else {
403:     for (i=0;i<ml;i++) {
404:       VecGetArray(Q[i],&s);
405:       for (j=0;j<k;j++) {
406:         R[i*ld+j] = s[j];
407:       }
408:       VecRestoreArray(Q[i],&s);
409:     }
410:   }
411:   DSRestoreArray(ds,DS_MAT_A,&R);
412:   if (isqr) { PetscFree(s); }
413:   DSSetState(ds,DS_STATE_RAW);
414:   PetscMalloc(k*sizeof(PetscScalar),&w);
415:   DSSetEigenvalueComparison(ds,SlepcCompareLargestReal,NULL);
416:   DSSolve(ds,w,NULL);
417:   DSSort(ds,w,NULL,NULL,NULL,NULL);
418:   (*K) = 0;
419:   for (i=0;i<k;i++) {
420:     ctx->sigma[i] = PetscRealPart(w[i]);
421:     if (ctx->sigma[i]/PetscMax(ctx->sigma[0],1)>ctx->delta) (*K)++;
422:   }
423:   PetscFree(w);
424:   DSDestroy(&ds);
425:   return(0);
426: }

430: static PetscErrorCode ProjectMatrix(Mat A,PetscInt nv,PetscInt ld,Vec *Q,PetscScalar *H,Vec w,PetscBool isherm)
431: {
433:   PetscInt       i,j;

436:   if (isherm) {
437:     for (j=0;j<nv;j++) {
438:       MatMult(A,Q[j],w);
439:       VecMDot(w,j+1,Q,H+j*ld);
440:       for (i=0;i<j;i++)
441:         H[j+i*ld] = PetscConj(H[i+j*ld]);
442:     }
443:   } else {
444:     for (j=0;j<nv;j++) {
445:       MatMult(A,Q[j],w);
446:       VecMDot(w,nv,Q,H+j*ld);
447:     }
448:   }
449:   return(0);
450: }

454: static PetscErrorCode isInsideGamma(EPS eps,PetscInt nv,PetscBool *fl)
455: {
456:   EPS_CISS    *ctx = (EPS_CISS*)eps->data;
457:   PetscInt    i;
458:   PetscScalar d;
459:   PetscReal   dx,dy;
460:   for (i=0;i<nv;i++) {
461:     d = (eps->eigr[i]-ctx->center)/ctx->radius;
462:     dx = PetscRealPart(d);
463:     dy = PetscImaginaryPart(d);
464:     if ((dx*dx+(dy*dy)/(ctx->vscale*ctx->vscale))<=1) fl[i] = PETSC_TRUE;
465:     else fl[i] = PETSC_FALSE;
466:   }
467:   return(0);
468: }

472: PetscErrorCode EPSSetUp_CISS(EPS eps)
473: {
475:   PetscInt       i;
476:   Vec            stemp;
477:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
478:   const char     *prefix;

481: #if !defined(PETSC_USE_COMPLEX)
482:   SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"CISS only works for complex scalars");
483: #endif
484:   eps->ncv = PetscMin(eps->n,ctx->L*ctx->M);
485:   if (!eps->mpd) eps->mpd = eps->ncv;
486:   if (!eps->which) eps->which = EPS_ALL;
487:   if (!eps->extraction) {
488:     EPSSetExtraction(eps,EPS_RITZ);
489:   } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
490:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

492:   if (ctx->isreal && PetscImaginaryPart(ctx->center) == 0.0) ctx->useconj = PETSC_TRUE;
493:   else ctx->useconj = PETSC_FALSE;

495:   if (!ctx->delta) ctx->delta = PetscMin((eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL*1e-1:eps->tol*1e-1),1e-12);

497:   if (!ctx->vscale) {
498:     if (eps->ishermitian && (eps->ispositive || !eps->isgeneralized) && PetscImaginaryPart(ctx->center) == 0.0) ctx->vscale = 0.1;
499:     else ctx->vscale = 1.0;
500:   }

502:   /* create split comm */
503:   SetSolverComm(eps);

505:   EPSAllocateSolution(eps);
506:   PetscMalloc(ctx->N*sizeof(PetscScalar),&ctx->weight);
507:   PetscMalloc(ctx->N*sizeof(PetscScalar),&ctx->omega);
508:   PetscMalloc(ctx->N*sizeof(PetscScalar),&ctx->pp);
509:   PetscLogObjectMemory(eps,3*ctx->N*sizeof(PetscScalar));
510:   PetscMalloc(ctx->L*ctx->M*sizeof(PetscReal),&ctx->sigma);

512:   /* create a template vector for Vecs on solver communicator */
513:   VecCreateMPI(PetscObjectComm((PetscObject)eps),PETSC_DECIDE,eps->n,&stemp);
514:   VecDuplicateVecs(stemp,ctx->L,&ctx->V);
515:   PetscLogObjectParents(eps,ctx->L,ctx->V);
516:   VecDestroy(&stemp);

518:   PetscMalloc(ctx->num_solve_point*sizeof(KSP),&ctx->ksp);
519:   PetscLogObjectMemory(eps,ctx->num_solve_point*sizeof(KSP));
520:   for (i=0;i<ctx->num_solve_point;i++) {
521:     KSPCreate(PetscObjectComm((PetscObject)eps),&ctx->ksp[i]);
522:     PetscObjectIncrementTabLevel((PetscObject)ctx->ksp[i],(PetscObject)eps,1);
523:     PetscLogObjectParent(eps,ctx->ksp[i]);
524:     KSPAppendOptionsPrefix(ctx->ksp[i],"eps_ciss_");
525:     EPSGetOptionsPrefix(eps,&prefix);
526:     KSPAppendOptionsPrefix(ctx->ksp[i],prefix);
527:   }
528:   PetscMalloc(ctx->num_solve_point*ctx->L_max*sizeof(Vec),&ctx->Y);
529:   PetscMemzero(ctx->Y,ctx->num_solve_point*ctx->L_max*sizeof(Vec));
530:   PetscLogObjectMemory(eps,ctx->num_solve_point*ctx->L_max*sizeof(Vec));

532:   if (eps->isgeneralized) {
533:     if (eps->ishermitian && eps->ispositive) {
534:       DSSetType(eps->ds,DSGHEP);
535:     } else {
536:       DSSetType(eps->ds,DSGNHEP);
537:     }
538:   } else {
539:     if (eps->ishermitian) {
540:       DSSetType(eps->ds,DSHEP);
541:     } else {
542:       DSSetType(eps->ds,DSNHEP);
543:     }
544:   }
545:   DSAllocate(eps->ds,eps->ncv);
546:   EPSSetWorkVecs(eps,2);

548:   /* dispatch solve method */
549:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
550:   eps->ops->solve = EPSSolve_CISS;
551:   return(0);
552: }

556: PetscErrorCode EPSSolve_CISS(EPS eps)
557: {
559:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
560:   PetscInt       i,j,k,ld,nv,nmat,nvecs,L_add=0,inner,outer,L_base=ctx->L;
561:   PetscScalar    *H,*rr,*pX,*tdata,*vdata,*Mu;
562:   PetscReal      *tau,s1,s2,tau_max=0.0,*temp,error,max_error;
563:   PetscBool      *fl;
564:   Mat            A,B;
565:   Vec            w=eps->work[0],tempv=eps->work[1],*H0,aux;

568:   DSGetLeadingDimension(eps->ds,&ld);
569:   STGetNumMatrices(eps->st,&nmat);
570:   STGetOperators(eps->st,0,&A);
571:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
572:   else B = NULL;

574:   SetPathParameter(eps);
575:   for (i=0;i<ctx->L;i++) {
576:     CISSVecSetRandom(ctx->V[i],eps->rand);
577:   }
578:   SolveLinearSystem(eps);
579:   ConstructS(eps,1,&ctx->S);
580:   nvecs = ctx->L;
581:   EstimateNumberEigs(eps,ctx->S,&L_add);

583:   if (L_add>0) {
584:     PetscInfo2(eps,"Changing L %d -> %d by Estimate #Eig\n",ctx->L,ctx->L+L_add);
585:     SetAddVector(eps,ctx->L+L_add);
586:     SolveAddLinearSystem(eps,ctx->L,ctx->L+L_add);
587:     ctx->L += L_add;
588:     PetscFree(ctx->sigma);
589:     PetscMalloc(ctx->L*ctx->M*sizeof(PetscReal),&ctx->sigma);
590:   }

592:   for (i=0;i<ctx->refine_blocksize;i++) {
593:     PetscMalloc(ctx->L*ctx->L*ctx->M*2*sizeof(PetscScalar),&Mu);
594:     CalcMu(eps,Mu);
595:     VecCreateMPI(PetscObjectComm((PetscObject)eps),PETSC_DECIDE,ctx->L*ctx->M,&aux);
596:     VecDuplicateVecs(aux,ctx->L*ctx->M,&H0);
597:     VecDestroy(&aux);
598:     BlockHankel(eps,Mu,0,H0);
599:     SVD(eps,H0,&nv,PETSC_FALSE);
600:     PetscFree(Mu);
601:     VecDestroyVecs(ctx->L*ctx->M,&H0);
602:     if (ctx->sigma[0]<=ctx->delta || nv < ctx->L*ctx->M) break;
603:     L_add = L_base;
604:     PetscInfo2(eps,"Changing L %d -> %d by SVD(H0)\n",ctx->L,ctx->L+L_add);
605:     SetAddVector(eps,ctx->L+L_add);
606:     SolveAddLinearSystem(eps,ctx->L,ctx->L+L_add);
607:     ctx->L += L_add;
608:     PetscFree(ctx->sigma);
609:     PetscMalloc(ctx->L*ctx->M*sizeof(PetscReal),&ctx->sigma);
610:   }

612:   if (ctx->L != L_base) {
613:     eps->ncv = PetscMin(eps->n,ctx->L*ctx->M);
614:     eps->mpd = eps->ncv;
615:     EPSAllocateSolution(eps);
616:     DSReset(eps->ds);
617:     DSSetEigenvalueComparison(eps->ds,eps->comparison,eps->comparisonctx);
618:     if (eps->isgeneralized) {
619:       if (eps->ishermitian && eps->ispositive) {
620:         DSSetType(eps->ds,DSGHEP);
621:       } else {
622:         DSSetType(eps->ds,DSGNHEP);
623:       }
624:     } else {
625:       if (eps->ishermitian) {
626:         DSSetType(eps->ds,DSHEP);
627:       } else {
628:         DSSetType(eps->ds,DSNHEP);
629:       }
630:     }
631:     DSAllocate(eps->ds,eps->ncv);
632:     DSGetLeadingDimension(eps->ds,&ld);
633:   }

635:   for (outer=0;outer<=ctx->refine_outer;outer++) {
636:     for (inner=0;inner<=ctx->refine_inner;inner++) {
637:       VecDestroyVecs(nvecs,&ctx->S);
638:       ConstructS(eps,ctx->M,&ctx->S);
639:       nvecs = ctx->M*ctx->L;
640:       SVD(eps,ctx->S,&nv,PETSC_TRUE);
641:       if (ctx->sigma[0]>ctx->delta && nv==ctx->L*ctx->M && inner!=ctx->refine_inner) {
642:         for (i=0;i<ctx->L;i++) {
643:           VecCopy(ctx->S[i],ctx->V[i]);
644:         }
645:         SolveAddLinearSystem(eps,0,ctx->L);
646:       } else break;
647:     }
648:     eps->nconv = 0;
649:     if (nv == 0) break;
650:     DSSetDimensions(eps->ds,nv,0,0,0);
651:     DSSetState(eps->ds,DS_STATE_RAW);

653:     DSGetArray(eps->ds,DS_MAT_A,&H);
654:     ProjectMatrix(A,nv,ld,ctx->S,H,w,eps->ishermitian);
655:     DSRestoreArray(eps->ds,DS_MAT_A,&H);
656: 
657:     if (nmat>1) {
658:       DSGetArray(eps->ds,DS_MAT_B,&H);
659:       ProjectMatrix(B,nv,ld,ctx->S,H,w,eps->ishermitian);
660:       DSRestoreArray(eps->ds,DS_MAT_B,&H);
661:     }
662: 
663:     DSSolve(eps->ds,eps->eigr,NULL);

665:     PetscMalloc(nv*sizeof(PetscReal),&tau);
666:     DSVectors(eps->ds,DS_MAT_X,NULL,NULL);
667:     DSGetArray(eps->ds,DS_MAT_X,&pX);
668:     for (i=0;i<nv;i++) {
669:       s1 = 0;
670:       s2 = 0;
671:       for (j=0;j<nv;j++) {
672:         s1 += PetscAbsScalar(PetscPowScalar(pX[i*ld+j],2));
673:         s2 += PetscPowScalar(PetscAbsScalar(pX[i*ld+j]),2)/ctx->sigma[j];
674:       }
675:       tau[i] = s1/s2;
676:       tau_max = PetscMax(tau_max,tau[i]);
677:     }
678:     tau_max /= ctx->sigma[0];
679:     DSRestoreArray(eps->ds,DS_MAT_X,&pX);
680:     for (i=0;i<nv;i++) tau[i] /= tau_max;
681:     PetscMalloc(nv*sizeof(PetscBool),&fl);
682:     isInsideGamma(eps,nv,fl);
683:     PetscMalloc(nv*sizeof(PetscScalar),&rr);
684:     for (i=0;i<nv;i++) {
685:       if (fl[i] && tau[i]>=ctx->spurious_threshold*tau_max) {
686:         rr[i] = 1.0;
687:         eps->nconv++;
688:       } else rr[i] = 0.0;
689:     }

691:     PetscFree(tau);
692:     PetscFree(fl);
693:     DSSetEigenvalueComparison(eps->ds,SlepcCompareLargestMagnitude,NULL);
694:     DSSort(eps->ds,eps->eigr,NULL,rr,NULL,&eps->nconv);
695:     DSSetEigenvalueComparison(eps->ds,eps->comparison,eps->comparisonctx);
696:     PetscFree(rr);
697:     for (i=0;i<nv;i++) {
698:       VecCopy(ctx->S[i],eps->V[i]);
699:     }
700: 
701:     DSVectors(eps->ds,DS_MAT_X,NULL,NULL);
702:     DSGetArray(eps->ds,DS_MAT_X,&pX);
703:     SlepcUpdateVectors(nv,ctx->S,0,eps->nconv,pX,ld,PETSC_FALSE);
704:     if (eps->ishermitian) {  /* compute eigenvectors */
705:       SlepcUpdateVectors(nv,eps->V,0,eps->nconv,pX,ld,PETSC_FALSE);
706:     }
707:     DSRestoreArray(eps->ds,DS_MAT_X,&pX);

709:     max_error = 0.0;
710:     for (i=0;i<eps->nconv;i++) {
711:       VecNormalize(eps->V[i],NULL);
712:       VecNormalize(ctx->S[i],NULL);
713:       EPSComputeRelativeError_Private(eps,eps->eigr[i],0,ctx->S[i],NULL,&error);
714:       max_error = PetscMax(max_error,error);
715:     }
716:     if (max_error <= eps->tol || outer == ctx->refine_outer) break;
717:     PetscMalloc(ctx->L*eps->nconv*sizeof(PetscReal),&temp);
718:     for (i=0;i<ctx->L*eps->nconv;i++) {
719:       PetscRandomGetValueReal(eps->rand,&temp[i]);
720:       temp[i] = 2*temp[i]-1;
721:     }
722: 
723:     for (k=0;k<ctx->L;k++) {
724:       VecGetArray(tempv,&tdata);
725:       for (j=0;j<eps->nconv;j++) {
726:         VecGetArray(ctx->S[j],&vdata);
727:         for (i=0;i<eps->n;i++) {
728:           if (j==0) tdata[i] = vdata[i]*temp[j+eps->nconv*k];
729:           else tdata[i] = tdata[i]+vdata[i]*temp[j+eps->nconv*k];
730:         }
731:         VecRestoreArray(ctx->S[j],&vdata);
732:       }
733:       VecRestoreArray(tempv,&tdata);
734:       VecCopy(tempv,ctx->V[k]);
735:     }
736: 
737:     PetscFree(temp);
738:     SolveAddLinearSystem(eps,0,ctx->L);
739:   }
740:   eps->reason = EPS_CONVERGED_TOL;
741:   return(0);
742: }

746: static PetscErrorCode EPSCISSSetRegion_CISS(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale)
747: {
748:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

751:   ctx->center = center;
752:   if (radius) {
753:     if (radius == PETSC_DEFAULT) {
754:       ctx->radius = 1.0;
755:     } else {
756:       if (radius<0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The radius argument must be > 0.0");
757:       ctx->radius = radius;
758:     }
759:   }
760:   if (vscale) {
761:     if (vscale<0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The vscale argument must be > 0.0");
762:     ctx->vscale = vscale;
763:   }
764:   return(0);
765: }

769: /*@
770:    EPSCISSSetRegion - Sets the parameters defining the region where eigenvalues
771:    must be computed.

773:    Logically Collective on EPS

775:    Input Parameters:
776: +  eps - the eigenproblem solver context
777: .  center - center of the region
778: .  radius - radius of the region
779: -  vscale - vertical scale of the region

781:    Options Database Keys:
782: +  -eps_ciss_center - Sets the center
783: .  -eps_ciss_radius - Sets the radius
784: -  -eps_ciss_vscale - Sets the vertical scale

786:    Level: advanced

788: .seealso: EPSCISSGetRegion()
789: @*/
790: PetscErrorCode EPSCISSSetRegion(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale)
791: {

799:   PetscTryMethod(eps,"EPSCISSSetRegion_C",(EPS,PetscScalar,PetscReal,PetscReal),(eps,center,radius,vscale));
800:   return(0);
801: }

805: static PetscErrorCode EPSCISSGetRegion_CISS(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale)
806: {
807:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

810:   if (center) *center = ctx->center;
811:   if (radius) *radius = ctx->radius;
812:   if (vscale) *vscale = ctx->vscale;
813:   return(0);
814: }

818: /*@
819:    EPSCISSGetRegion - Gets the parameters that define the region where eigenvalues
820:    must be computed.

822:    Not Collective

824:    Input Parameter:
825: .  eps - the eigenproblem solver context

827:    Output Parameters:
828: +  center - center of the region
829: .  radius - radius of the region
830: -  vscale - vertical scale of the region

832:    Level: advanced

834: .seealso: EPSCISSSetRegion()
835: @*/
836: PetscErrorCode EPSCISSGetRegion(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale)
837: {

842:   PetscTryMethod(eps,"EPSCISSGetRegion_C",(EPS,PetscScalar*,PetscReal*,PetscReal*),(eps,center,radius,vscale));
843:   return(0);
844: }

848: static PetscErrorCode EPSCISSSetSizes_CISS(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal)
849: {
851:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;

854:   if (ip) {
855:     if (ip == PETSC_DECIDE || ip == PETSC_DEFAULT) {
856:       if (ctx->N!=32) { ctx->N =32; ctx->M = ctx->N/4; }
857:     } else {
858:       if (ip<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ip argument must be > 0");
859:       if (ip%2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ip argument must be an even number");
860:       if (ctx->N!=ip) { ctx->N = ip; ctx->M = ctx->N/4; }
861:     }
862:   }
863:   if (bs) {
864:     if (bs == PETSC_DECIDE || bs == PETSC_DEFAULT) {
865:       ctx->L = 16;
866:     } else {
867:       if (bs<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The bs argument must be > 0");
868:       if (bs>ctx->L_max) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The bs argument must be less than or equal to the maximum number of block size");
869:       ctx->L = bs;
870:     }
871:   }
872:   if (ms) {
873:     if (ms == PETSC_DECIDE || ms == PETSC_DEFAULT) {
874:       ctx->M = ctx->N/4;
875:     } else {
876:       if (ms<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ms argument must be > 0");
877:       if (ms>ctx->N) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The ms argument must be less than or equal to the number of integration points");
878:       ctx->M = ms;
879:     }
880:   }
881:   if (npart) {
882:     if (npart == PETSC_DECIDE || npart == PETSC_DEFAULT) {
883:       ctx->npart = 1;
884:     } else {
885:       if (npart<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The npart argument must be > 0");
886:       ctx->npart = npart;
887:     }
888:   }
889:   if (bsmax) {
890:     if (bsmax == PETSC_DECIDE || bsmax == PETSC_DEFAULT) {
891:       ctx->L = 256;
892:     } else {
893:       if (bsmax<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The bsmax argument must be > 0");
894:       if (bsmax<ctx->L) ctx->L_max = ctx->L;
895:       else ctx->L_max = bsmax;
896:     }
897:   }
898:   ctx->isreal = isreal;
899:   EPSReset(eps);   /* clean allocated arrays and force new setup */
900:   return(0);
901: }

905: /*@
906:    EPSCISSSetSizes - Sets the values of various size parameters in the CISS solver.

908:    Logically Collective on EPS

910:    Input Parameters:
911: +  eps   - the eigenproblem solver context
912: .  ip    - number of integration points
913: .  bs    - block size
914: .  ms    - moment size
915: .  npart - number of partitions when splitting the communicator
916: .  bsmax - max block size
917: -  isreal - A and B are real

919:    Options Database Keys:
920: +  -eps_ciss_integration_points - Sets the number of integration points
921: .  -eps_ciss_blocksize - Sets the block size
922: .  -eps_ciss_moments - Sets the moment size
923: .  -eps_ciss_partitions - Sets the number of partitions
924: .  -eps_ciss_maxblocksize - Sets the maximum block size
925: -  -eps_ciss_realmats - A and B are real

927:    Note:
928:    The default number of partitions is 1. This means the internal KSP object is shared
929:    among all processes of the EPS communicator. Otherwise, the communicator is split
930:    into npart communicators, so that npart KSP solves proceed simultaneously.

932:    Level: advanced

934: .seealso: EPSCISSGetSizes()
935: @*/
936: PetscErrorCode EPSCISSSetSizes(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal)
937: {

948:   PetscTryMethod(eps,"EPSCISSSetSizes_C",(EPS,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscBool),(eps,ip,bs,ms,npart,bsmax,isreal));
949:   return(0);
950: }

954: static PetscErrorCode EPSCISSGetSizes_CISS(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal)
955: {
956:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

959:   if (ip) *ip = ctx->N;
960:   if (bs) *bs = ctx->L;
961:   if (ms) *ms = ctx->M;
962:   if (npart) *npart = ctx->npart;
963:   if (bsmax) *bsmax = ctx->L_max;
964:   if (isreal) *isreal = ctx->isreal;
965:   return(0);
966: }

970: /*@
971:    EPSCISSGetSizes - Gets the values of various size parameters in the CISS solver.

973:    Not Collective

975:    Input Parameter:
976: .  eps - the eigenproblem solver context

978:    Output Parameters:
979: +  ip    - number of integration points
980: .  bs    - block size
981: .  ms    - moment size
982: .  npart - number of partitions when splitting the communicator
983: .  bsmax - max block size
984: -  isreal - A and B are real

986:    Level: advanced

988: .seealso: EPSCISSSetSizes()
989: @*/
990: PetscErrorCode EPSCISSGetSizes(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal)
991: {

996:   PetscTryMethod(eps,"EPSCISSGetSizes_C",(EPS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscBool*),(eps,ip,bs,ms,npart,bsmax,isreal));
997:   return(0);
998: }

1002: static PetscErrorCode EPSCISSSetThreshold_CISS(EPS eps,PetscReal delta,PetscReal spur)
1003: {
1004:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

1007:   if (delta) {
1008:     if (delta == PETSC_DEFAULT) {
1009:       ctx->delta = 1e-12;
1010:     } else {
1011:       if (delta<=0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The delta argument must be > 0.0");
1012:       ctx->delta = delta;
1013:     }
1014:   }
1015:   if (spur) {
1016:     if (spur == PETSC_DEFAULT) {
1017:       ctx->spurious_threshold = 1e-4;
1018:     } else {
1019:       if (spur<=0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The spurious threshold argument must be > 0.0");
1020:       ctx->spurious_threshold = spur;
1021:     }
1022:   }
1023:   return(0);
1024: }

1028: /*@
1029:    EPSCISSSetThreshold - Sets the values of various threshold parameters in
1030:    the CISS solver.

1032:    Logically Collective on EPS

1034:    Input Parameters:
1035: +  eps   - the eigenproblem solver context
1036: .  delta - threshold for numerical rank
1037: -  spur  - spurious threshold (to discard spurious eigenpairs)

1039:    Options Database Keys:
1040: +  -eps_ciss_delta - Sets the delta
1041: -  -eps_ciss_spurious_threshold - Sets the spurious threshold

1043:    Level: advanced

1045: .seealso: EPSCISSGetThreshold()
1046: @*/
1047: PetscErrorCode EPSCISSSetThreshold(EPS eps,PetscReal delta,PetscReal spur)
1048: {

1055:   PetscTryMethod(eps,"EPSCISSSetThreshold_C",(EPS,PetscReal,PetscReal),(eps,delta,spur));
1056:   return(0);
1057: }

1061: static PetscErrorCode EPSCISSGetThreshold_CISS(EPS eps,PetscReal *delta,PetscReal *spur)
1062: {
1063:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

1066:   if (delta) *delta = ctx->delta;
1067:   if (spur)  *spur = ctx->spurious_threshold;
1068:   return(0);
1069: }

1073: /*@
1074:    EPSCISSGetThreshold - Gets the values of various threshold parameters
1075:    in the CISS solver.

1077:    Not Collective

1079:    Input Parameter:
1080: .  eps - the eigenproblem solver context

1082:    Output Parameters:
1083: +  delta - threshold for numerical rank
1084: -  spur  - spurious threshold (to discard spurious eigenpairs)

1086:    Level: advanced

1088: .seealso: EPSCISSSetThreshold()
1089: @*/
1090: PetscErrorCode EPSCISSGetThreshold(EPS eps,PetscReal *delta,PetscReal *spur)
1091: {

1096:   PetscTryMethod(eps,"EPSCISSGetThreshold_C",(EPS,PetscReal*,PetscReal*),(eps,delta,spur));
1097:   return(0);
1098: }

1102: static PetscErrorCode EPSCISSSetRefinement_CISS(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize)
1103: {
1104:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

1107:   if (inner == PETSC_DEFAULT) {
1108:     ctx->refine_inner = 0;
1109:   } else {
1110:     if (inner<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The refine inner argument must be >= 0");
1111:     ctx->refine_inner = inner;
1112:   }
1113:   if (outer == PETSC_DEFAULT) {
1114:     ctx->refine_outer = 0;
1115:   } else {
1116:     if (outer<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The refine outer argument must be >= 0");
1117:     ctx->refine_outer = outer;
1118:   }
1119:   if (blsize == PETSC_DEFAULT) {
1120:     ctx->refine_blocksize = 0;
1121:   } else {
1122:     if (blsize<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The refine blocksize argument must be >= 0");
1123:     ctx->refine_blocksize = blsize;
1124:   }
1125:   return(0);
1126: }

1130: /*@
1131:    EPSCISSSetRefinement - Sets the values of various refinement parameters
1132:    in the CISS solver.

1134:    Logically Collective on EPS

1136:    Input Parameters:
1137: +  eps    - the eigenproblem solver context
1138: .  inner  - number of iterative refinement iterations (inner loop)
1139: .  outer  - number of iterative refinement iterations (outer loop)
1140: -  blsize - number of iterative refinement iterations (blocksize loop)

1142:    Options Database Keys:
1143: +  -eps_ciss_refine_inner - Sets number of inner iterations
1144: .  -eps_ciss_refine_outer - Sets number of outer iterations
1145: -  -eps_ciss_refine_blocksize - Sets number of blocksize iterations

1147:    Level: advanced

1149: .seealso: EPSCISSGetRefinement()
1150: @*/
1151: PetscErrorCode EPSCISSSetRefinement(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize)
1152: {

1160:   PetscTryMethod(eps,"EPSCISSSetRefinement_C",(EPS,PetscInt,PetscInt,PetscInt),(eps,inner,outer,blsize));
1161:   return(0);
1162: }

1166: static PetscErrorCode EPSCISSGetRefinement_CISS(EPS eps,PetscInt *inner,PetscInt *outer,PetscInt *blsize)
1167: {
1168:   EPS_CISS *ctx = (EPS_CISS*)eps->data;

1171:   if (inner)  *inner = ctx->refine_inner;
1172:   if (outer)  *outer = ctx->refine_outer;
1173:   if (blsize) *blsize = ctx->refine_blocksize;
1174:   return(0);
1175: }

1179: /*@
1180:    EPSCISSGetRefinement - Gets the values of various refinement parameters
1181:    in the CISS solver.

1183:    Not Collective

1185:    Input Parameter:
1186: .  eps - the eigenproblem solver context

1188:    Output Parameters:
1189: +  inner  - number of iterative refinement iterations (inner loop)
1190: .  outer  - number of iterative refinement iterations (outer loop)
1191: -  blsize - number of iterative refinement iterations (blocksize loop)

1193:    Level: advanced

1195: .seealso: EPSCISSSetRefinement()
1196: @*/
1197: PetscErrorCode EPSCISSGetRefinement(EPS eps, PetscInt *inner, PetscInt *outer,PetscInt *blsize)
1198: {

1203:   PetscTryMethod(eps,"EPSCISSGetRefinement_C",(EPS,PetscInt*,PetscInt*,PetscInt*),(eps,inner,outer,blsize));
1204:   return(0);
1205: }

1209: PetscErrorCode EPSReset_CISS(EPS eps)
1210: {
1212:   PetscInt       i;
1213:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;

1216:   PetscFree(ctx->weight);
1217:   PetscFree(ctx->omega);
1218:   PetscFree(ctx->pp);
1219:   VecDestroyVecs(ctx->L,&ctx->V);
1220:   for (i=0;i<ctx->num_solve_point;i++) {
1221:     KSPDestroy(&ctx->ksp[i]);
1222:   }
1223:   PetscFree(ctx->ksp);
1224:   PetscFree(ctx->sigma);
1225:   for (i=0;i<ctx->num_solve_point*ctx->L_max;i++) {
1226:     VecDestroy(&ctx->Y[i]);
1227:   }
1228:   PetscFree(ctx->Y);
1229:   VecDestroyVecs(ctx->M*ctx->L,&ctx->S);
1230:   EPSReset_Default(eps);
1231:   return(0);
1232: }

1236: PetscErrorCode EPSSetFromOptions_CISS(EPS eps)
1237: {
1239:   PetscScalar    s;
1240:   PetscReal      r1,r2,r3,r4;
1241:   PetscInt       i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0;
1242:   PetscBool      b1=PETSC_FALSE;

1245:   PetscOptionsHead("EPS CISS Options");
1246:   EPSCISSGetRegion(eps,&s,&r1,&r2);
1247:   PetscOptionsReal("-eps_ciss_radius","CISS radius of region","EPSCISSSetRegion",r1,&r1,NULL);
1248:   PetscOptionsScalar("-eps_ciss_center","CISS center of region","EPSCISSSetRegion",s,&s,NULL);
1249:   PetscOptionsReal("-eps_ciss_vscale","CISS vertical scale of region","EPSCISSSetRegion",r2,&r2,NULL);
1250:   EPSCISSSetRegion(eps,s,r1,r2);

1252:   PetscOptionsInt("-eps_ciss_integration_points","CISS number of integration points","EPSCISSSetSizes",i1,&i1,NULL);
1253:   PetscOptionsInt("-eps_ciss_blocksize","CISS block size","EPSCISSSetSizes",i2,&i2,NULL);
1254:   PetscOptionsInt("-eps_ciss_moments","CISS moment size","EPSCISSSetSizes",i3,&i3,NULL);
1255:   PetscOptionsInt("-eps_ciss_partitions","CISS number of partitions","EPSCISSSetSizes",i4,&i4,NULL);
1256:   PetscOptionsInt("-eps_ciss_maxblocksize","CISS maximum block size","EPSCISSSetSizes",i5,&i5,NULL);
1257:   PetscOptionsBool("-eps_ciss_realmats","CISS A and B are real","EPSCISSSetSizes",b1,&b1,NULL);
1258:   EPSCISSSetSizes(eps,i1,i2,i3,i4,i5,b1);

1260:   EPSCISSGetThreshold(eps,&r3,&r4);
1261:   PetscOptionsReal("-eps_ciss_delta","CISS threshold for numerical rank","EPSCISSSetThreshold",r3,&r3,NULL);
1262:   PetscOptionsReal("-eps_ciss_spurious_threshold","CISS threshold for the spurious eigenpairs","EPSCISSSetThreshold",r4,&r4,NULL);
1263:   EPSCISSSetThreshold(eps,r3,r4);

1265:   EPSCISSGetRefinement(eps,&i6,&i7,&i8);
1266:   PetscOptionsInt("-eps_ciss_refine_inner","CISS number of inner iterative refinement iterations","EPSCISSSetRefinement",i6,&i6,NULL);
1267:   PetscOptionsInt("-eps_ciss_refine_outer","CISS number of outer iterative refinement iterations","EPSCISSSetRefinement",i7,&i7,NULL);
1268:   PetscOptionsInt("-eps_ciss_refine_blocksize","CISS number of blocksize iterative refinement iterations","EPSCISSSetRefinement",i8,&i8,NULL);
1269:   EPSCISSSetRefinement(eps,i6,i7,i8);

1271:   PetscOptionsTail();
1272:   return(0);
1273: }

1277: PetscErrorCode EPSDestroy_CISS(EPS eps)
1278: {

1282:   PetscFree(eps->data);
1283:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRegion_C",NULL);
1284:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRegion_C",NULL);
1285:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetSizes_C",NULL);
1286:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetSizes_C",NULL);
1287:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetThreshold_C",NULL);
1288:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetThreshold_C",NULL);
1289:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRefinement_C",NULL);
1290:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRefinement_C",NULL);
1291:   return(0);
1292: }

1296: PetscErrorCode EPSView_CISS(EPS eps,PetscViewer viewer)
1297: {
1299:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;
1300:   PetscBool      isascii;
1301:   char           str[50];

1304:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
1305:   if (isascii) {
1306:     SlepcSNPrintfScalar(str,50,ctx->center,PETSC_FALSE);
1307:     PetscViewerASCIIPrintf(viewer,"  CISS: region { center: %s, radius: %G, vscale: %G }\n",str,ctx->radius,ctx->vscale);
1308:     PetscViewerASCIIPrintf(viewer,"  CISS: sizes { integration points: %D, block size: %D, moment size: %D, partitions: %D, maximum block size: %D }\n",ctx->N,ctx->L,ctx->M,ctx->npart,ctx->L_max);
1309:     if (ctx->isreal) {
1310:       PetscViewerASCIIPrintf(viewer,"  CISS: exploiting symmetry of integration points\n");
1311:     }
1312:     PetscViewerASCIIPrintf(viewer,"  CISS: threshold { delta: %G, spurious threshold: %G }\n",ctx->delta,ctx->spurious_threshold);
1313:     PetscViewerASCIIPrintf(viewer,"  CISS: iterative refinement  { inner: %D, outer: %D, blocksize: %D }\n",ctx->refine_inner,ctx->refine_outer, ctx->refine_blocksize);
1314:     PetscViewerASCIIPushTab(viewer);
1315:     KSPView(ctx->ksp[0],viewer);
1316:     PetscViewerASCIIPopTab(viewer);

1318:   }
1319:   return(0);
1320: }

1324: PETSC_EXTERN PetscErrorCode EPSCreate_CISS(EPS eps)
1325: {
1327:   EPS_CISS       *ctx = (EPS_CISS*)eps->data;

1330:   PetscNewLog(eps,EPS_CISS,&ctx);
1331:   eps->data = ctx;
1332:   eps->ops->setup          = EPSSetUp_CISS;
1333:   eps->ops->setfromoptions = EPSSetFromOptions_CISS;
1334:   eps->ops->destroy        = EPSDestroy_CISS;
1335:   eps->ops->reset          = EPSReset_CISS;
1336:   eps->ops->view           = EPSView_CISS;
1337:   eps->ops->backtransform  = PETSC_NULL;
1338:   eps->ops->computevectors = EPSComputeVectors_Schur;
1339:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRegion_C",EPSCISSSetRegion_CISS);
1340:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRegion_C",EPSCISSGetRegion_CISS);
1341:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetSizes_C",EPSCISSSetSizes_CISS);
1342:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetSizes_C",EPSCISSGetSizes_CISS);
1343:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetThreshold_C",EPSCISSSetThreshold_CISS);
1344:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetThreshold_C",EPSCISSGetThreshold_CISS);
1345:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSSetRefinement_C",EPSCISSSetRefinement_CISS);
1346:   PetscObjectComposeFunction((PetscObject)eps,"EPSCISSGetRefinement_C",EPSCISSGetRefinement_CISS);
1347:   /* set default values of parameters */
1348:   ctx->center  = 0.0;
1349:   ctx->radius  = 1.0;
1350:   ctx->vscale  = 0.0;
1351:   ctx->N       = 32;
1352:   ctx->L       = 16;
1353:   ctx->M       = ctx->N/4;
1354:   ctx->delta   = 0;
1355:   ctx->npart   = 1;
1356:   ctx->L_max   = 128;
1357:   ctx->spurious_threshold = 1e-4;
1358:   ctx->isreal  = PETSC_FALSE;
1359:   ctx->refine_outer = 1;
1360:   ctx->refine_inner = 1;
1361:   ctx->refine_blocksize = 1;
1362:   return(0);
1363: }

slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/ftn-auto/0000755000175000017500000000000012214143515020633 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/ciss/ftn-auto/makefile0000644000175000017500000000034012211062077022330 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = cissf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/ciss/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/ciss/ftn-auto/cissf.c0000644000175000017500000000741612211062077022116 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* ciss.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscisssetregion_ EPSCISSSETREGION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscisssetregion_ epscisssetregion #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscissgetregion_ EPSCISSGETREGION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscissgetregion_ epscissgetregion #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscisssetsizes_ EPSCISSSETSIZES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscisssetsizes_ epscisssetsizes #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscissgetsizes_ EPSCISSGETSIZES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscissgetsizes_ epscissgetsizes #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscisssetthreshold_ EPSCISSSETTHRESHOLD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscisssetthreshold_ epscisssetthreshold #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscissgetthreshold_ EPSCISSGETTHRESHOLD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscissgetthreshold_ epscissgetthreshold #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscisssetrefinement_ EPSCISSSETREFINEMENT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscisssetrefinement_ epscisssetrefinement #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscissgetrefinement_ EPSCISSGETREFINEMENT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscissgetrefinement_ epscissgetrefinement #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epscisssetregion_(EPS *eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale, int *__ierr ){ *__ierr = EPSCISSSetRegion(*eps,*center,*radius,*vscale); } void PETSC_STDCALL epscissgetregion_(EPS *eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale, int *__ierr ){ *__ierr = EPSCISSGetRegion(*eps,center,radius,vscale); } void PETSC_STDCALL epscisssetsizes_(EPS *eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal, int *__ierr ){ *__ierr = EPSCISSSetSizes(*eps,*ip,*bs,*ms,*npart,*bsmax,*isreal); } void PETSC_STDCALL epscissgetsizes_(EPS *eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal, int *__ierr ){ *__ierr = EPSCISSGetSizes(*eps,ip,bs,ms,npart,bsmax,isreal); } void PETSC_STDCALL epscisssetthreshold_(EPS *eps,PetscReal *delta,PetscReal *spur, int *__ierr ){ *__ierr = EPSCISSSetThreshold(*eps,*delta,*spur); } void PETSC_STDCALL epscissgetthreshold_(EPS *eps,PetscReal *delta,PetscReal *spur, int *__ierr ){ *__ierr = EPSCISSGetThreshold(*eps,delta,spur); } void PETSC_STDCALL epscisssetrefinement_(EPS *eps,PetscInt *inner,PetscInt *outer,PetscInt *blsize, int *__ierr ){ *__ierr = EPSCISSSetRefinement(*eps,*inner,*outer,*blsize); } void PETSC_STDCALL epscissgetrefinement_(EPS *eps,PetscInt *inner,PetscInt *outer,PetscInt *blsize, int *__ierr ){ *__ierr = EPSCISSGetRefinement(*eps,inner,outer,blsize); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/cg/0000755000175000017500000000000012214143515016526 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/0000755000175000017500000000000012211062077017462 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/rqcg.c.html0000644000175000017500000007702312211062077021536 0ustar gladkgladk
Actual source code: rqcg.c

  1: /*

  3:    SLEPc eigensolver: "rqcg"

  5:    Method: Rayleigh Quotient Conjugate Gradient

  7:    Algorithm:

  9:        Conjugate Gradient minimization of the Rayleigh quotient with
 10:        periodic Rayleigh-Ritz acceleration.

 12:    References:

 14:        [1] L. Bergamaschi et al., "Parallel preconditioned conjugate gradient
 15:            optimization of the Rayleigh quotient for the solution of sparse
 16:            eigenproblems", Appl. Math. Comput. 175(2):1694-1715, 2006.

 18:    Last update: Jul 2012

 20:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 21:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 22:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 24:    This file is part of SLEPc.

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

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

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

 40: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 41: #include <slepcblaslapack.h>

 43: PetscErrorCode EPSSolve_RQCG(EPS);

 45: typedef struct {
 46:   PetscInt nrest;
 47:   Vec      *AV,*BV,*P,*G;
 48: } EPS_RQCG;

 52: PetscErrorCode EPSSetUp_RQCG(EPS eps)
 53: {
 55:   PetscBool      precond;
 56:   PetscInt       nmat;
 57:   EPS_RQCG       *ctx = (EPS_RQCG*)eps->data;

 60:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"RQCG only works for Hermitian problems");
 61:   if (eps->ncv) { /* ncv set */
 62:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev");
 63:   }
 64:   else if (eps->mpd) { /* mpd set */
 65:     eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 66:   }
 67:   else { /* neither set: defaults depend on nev being small or large */
 68:     if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15));
 69:     else {
 70:       eps->mpd = 500;
 71:       eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 72:     }
 73:   }
 74:   if (!eps->mpd) eps->mpd = eps->ncv;
 75:   if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
 76:   if (!eps->which) eps->which = EPS_SMALLEST_REAL;
 77:   if (eps->which!=EPS_SMALLEST_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
 78:   if (!eps->extraction) {
 79:     EPSSetExtraction(eps,EPS_RITZ);
 80:   } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
 81:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");
 82:   /* Set STPrecond as the default ST */
 83:   if (!((PetscObject)eps->st)->type_name) {
 84:     STSetType(eps->st,STPRECOND);
 85:   }
 86:   PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&precond);
 87:   if (!precond) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"RQCG only works with precond ST");

 89:   if (!ctx->nrest) ctx->nrest = 20;

 91:   EPSAllocateSolution(eps);
 92:   VecDuplicateVecs(eps->t,eps->mpd,&ctx->AV);
 93:   PetscLogObjectParent(eps,ctx->AV);
 94:   STGetNumMatrices(eps->st,&nmat);
 95:   if (nmat>1) {
 96:     VecDuplicateVecs(eps->t,eps->mpd,&ctx->BV);
 97:     PetscLogObjectParent(eps,ctx->BV);
 98:   }
 99:   VecDuplicateVecs(eps->t,eps->mpd,&ctx->P);
100:   PetscLogObjectParent(eps,ctx->P);
101:   VecDuplicateVecs(eps->t,eps->mpd,&ctx->G);
102:   PetscLogObjectParent(eps,ctx->G);
103:   DSSetType(eps->ds,DSHEP);
104:   DSAllocate(eps->ds,eps->ncv);
105:   EPSSetWorkVecs(eps,1);

107:   /* dispatch solve method */
108:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
109:   eps->ops->solve = EPSSolve_RQCG;
110:   return(0);
111: }

115: PetscErrorCode EPSSolve_RQCG(EPS eps)
116: {
118:   EPS_RQCG       *ctx = (EPS_RQCG*)eps->data;
119:   PetscInt       i,j,k,ld,off,nv,ncv = eps->ncv,kini,nmat;
120:   PetscScalar    *C,*Y,*gamma,g,pap,pbp,pbx,pax,nu,mu,alpha,beta;
121:   PetscReal      resnorm,norm,a,b,c,disc,t;
122:   PetscBool      reset,breakdown;
123:   Mat            A,B;
124:   Vec            w=eps->work[0];

127:   DSGetLeadingDimension(eps->ds,&ld);
128:   STGetNumMatrices(eps->st,&nmat);
129:   STGetOperators(eps->st,0,&A);
130:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
131:   else B = NULL;
132:   PetscMalloc(eps->mpd*sizeof(PetscScalar),&gamma);

134:   kini = eps->nini;
135:   while (eps->reason == EPS_CONVERGED_ITERATING) {
136:     eps->its++;
137:     nv = PetscMin(eps->nconv+eps->mpd,ncv);
138:     DSSetDimensions(eps->ds,nv,0,eps->nconv,0);
139:     /* Generate more initial vectors if necessary */
140:     while (kini<nv) {
141:       SlepcVecSetRandom(eps->V[kini],eps->rand);
142:       IPOrthogonalize(eps->ip,eps->nds,eps->defl,kini,NULL,eps->V,eps->V[kini],NULL,&norm,&breakdown);
143:       if (norm>0.0 && !breakdown) {
144:         VecScale(eps->V[kini],1.0/norm);
145:         kini++;
146:       }
147:     }
148:     reset = (eps->its>1 && (eps->its-1)%ctx->nrest==0)? PETSC_TRUE: PETSC_FALSE;

150:     if (reset) {
151:       /* Compute Rayleigh quotient */
152:       DSGetArray(eps->ds,DS_MAT_A,&C);
153:       for (i=eps->nconv;i<nv;i++) {
154:         MatMult(A,eps->V[i],ctx->AV[i-eps->nconv]);
155:         VecMDot(ctx->AV[i-eps->nconv],i-eps->nconv+1,eps->V+eps->nconv,C+eps->nconv+i*ld);
156:         for (j=eps->nconv;j<i-1;j++) C[i+j*ld] = C[j+i*ld];
157:       }
158:       DSRestoreArray(eps->ds,DS_MAT_A,&C);
159:       DSSetState(eps->ds,DS_STATE_RAW);

161:       /* Solve projected problem */
162:       DSSolve(eps->ds,eps->eigr,eps->eigi);
163:       DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);

165:       /* Update vectors V(:,idx) = V * Y(:,idx) */
166:       DSGetArray(eps->ds,DS_MAT_Q,&Y);
167:       off = eps->nconv+eps->nconv*ld;
168:       SlepcUpdateVectors(nv-eps->nconv,ctx->AV,0,nv-eps->nconv,Y+off,ld,PETSC_FALSE);
169:       SlepcUpdateVectors(nv-eps->nconv,eps->V+eps->nconv,0,nv-eps->nconv,Y+off,ld,PETSC_FALSE);
170:       DSRestoreArray(eps->ds,DS_MAT_Q,&Y);

172:     } else {
173:       /* No need to do Rayleigh-Ritz, just take diag(V'*A*V) */
174:       for (i=eps->nconv;i<nv;i++) {
175:         MatMult(A,eps->V[i],ctx->AV[i-eps->nconv]);
176:         VecDot(ctx->AV[i-eps->nconv],eps->V[i],eps->eigr+i);
177:       }
178:     }

180:     /* Compute gradient and check convergence */
181:     k = -1;
182:     for (i=eps->nconv;i<nv;i++) {
183:       if (B) {
184:         MatMult(B,eps->V[i],ctx->BV[i-eps->nconv]);
185:         VecWAXPY(ctx->G[i-eps->nconv],-eps->eigr[i],ctx->BV[i-eps->nconv],ctx->AV[i-eps->nconv]);
186:       } else {
187:         VecWAXPY(ctx->G[i-eps->nconv],-eps->eigr[i],eps->V[i],ctx->AV[i-eps->nconv]);
188:       }
189:       VecNorm(ctx->G[i-eps->nconv],NORM_2,&resnorm);
190:       (*eps->converged)(eps,eps->eigr[i],0.0,resnorm,&eps->errest[i],eps->convergedctx);
191:       if (k==-1 && eps->errest[i] >= eps->tol) k = i;
192:     }
193:     if (k==-1) k = nv;
194:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
195:     if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL;

197:     /* The next lines are necessary to avoid DS zeroing eigr */
198:     DSGetArray(eps->ds,DS_MAT_A,&C);
199:     for (i=eps->nconv;i<k;i++) C[i+i*ld] = eps->eigr[i];
200:     DSRestoreArray(eps->ds,DS_MAT_A,&C);

202:     if (eps->reason == EPS_CONVERGED_ITERATING) {

204:       /* Search direction */
205:       for (i=0;i<nv-eps->nconv;i++) {
206:         STMatSolve(eps->st,0,ctx->G[i],w);
207:         VecDot(ctx->G[i],w,&g);
208:         beta = (!reset && eps->its>1)? g/gamma[i]: 0.0;
209:         gamma[i] = g;
210:         VecAXPBY(ctx->P[i],1.0,beta,w);
211:         IPOrthogonalize(eps->ip,eps->nds,eps->defl,i+eps->nconv,NULL,eps->V,ctx->P[i],NULL,&resnorm,&breakdown);
212:       }

214:       /* Minimization problem */
215:       for (i=eps->nconv;i<nv;i++) {
216:         VecDot(eps->V[i],ctx->AV[i-eps->nconv],&nu);
217:         VecDot(ctx->P[i-eps->nconv],ctx->AV[i-eps->nconv],&pax);
218:         MatMult(A,ctx->P[i-eps->nconv],w);
219:         VecDot(ctx->P[i-eps->nconv],w,&pap);
220:         if (B) {
221:           VecDot(eps->V[i],ctx->BV[i-eps->nconv],&mu);
222:           VecDot(ctx->P[i-eps->nconv],ctx->BV[i-eps->nconv],&pbx);
223:           MatMult(B,ctx->P[i-eps->nconv],w);
224:           VecDot(ctx->P[i-eps->nconv],w,&pbp);
225:         } else {
226:           VecDot(eps->V[i],eps->V[i],&mu);
227:           VecDot(ctx->P[i-eps->nconv],eps->V[i],&pbx);
228:           VecDot(ctx->P[i-eps->nconv],ctx->P[i-eps->nconv],&pbp);
229:         }
230:         a = PetscRealPart(pap*pbx-pax*pbp);
231:         b = PetscRealPart(nu*pbp-mu*pap);
232:         c = PetscRealPart(mu*pax-nu*pbx);
233:         t = PetscMax(PetscMax(PetscAbsReal(a),PetscAbsReal(b)),PetscAbsReal(c));
234:         if (t!=0.0) { a /= t; b /= t; c /= t; }
235:         disc = PetscSqrtReal(PetscAbsReal(b*b-4.0*a*c));
236:         if (b>=0.0 && a!=0.0) alpha = (b+disc)/(2.0*a);
237:         else if (b!=disc) alpha = 2.0*c/(b-disc);
238:         else alpha = 0;
239:         /* Next iterate */
240:         if (alpha!=0.0) {
241:           VecAXPY(eps->V[i],alpha,ctx->P[i-eps->nconv]);
242:         }
243:         IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,eps->V[i],NULL,&norm,&breakdown);
244:         if (!breakdown && norm!=0.0) {
245:           VecScale(eps->V[i],1.0/norm);
246:         }
247:       }
248:     }

250:     EPSMonitor(eps,eps->its,k,eps->eigr,eps->eigi,eps->errest,nv);
251:     eps->nconv = k;
252:   }

254:   PetscFree(gamma);
255:   /* truncate Schur decomposition and change the state to raw so that
256:      PSVectors() computes eigenvectors from scratch */
257:   DSSetDimensions(eps->ds,eps->nconv,0,0,0);
258:   DSSetState(eps->ds,DS_STATE_RAW);
259:   return(0);
260: }

264: static PetscErrorCode EPSRQCGSetReset_RQCG(EPS eps,PetscInt nrest)
265: {
266:   EPS_RQCG *ctx = (EPS_RQCG*)eps->data;

269:   ctx->nrest = nrest;
270:   return(0);
271: }

275: /*@
276:    EPSRQCGSetReset - Sets the reset parameter of the RQCG iteration. Every
277:    nrest iterations, the solver performs a Rayleigh-Ritz projection step.

279:    Logically Collective on EPS

281:    Input Parameters:
282: +  eps - the eigenproblem solver context
283: -  nrest - the number of iterations between resets

285:    Options Database Key:
286: .  -eps_rqcg_reset - Sets the reset parameter

288:    Level: advanced

290: .seealso: EPSRQCGGetReset()
291: @*/
292: PetscErrorCode EPSRQCGSetReset(EPS eps,PetscInt nrest)
293: {

299:   PetscTryMethod(eps,"EPSRQCGSetReset_C",(EPS,PetscInt),(eps,nrest));
300:   return(0);
301: }

305: static PetscErrorCode EPSRQCGGetReset_RQCG(EPS eps,PetscInt *nrest)
306: {
307:   EPS_RQCG *ctx = (EPS_RQCG*)eps->data;

310:   *nrest = ctx->nrest;
311:   return(0);
312: }

316: /*@
317:    EPSRQCGGetReset - Gets the reset parameter used in the RQCG method.

319:    Not Collective

321:    Input Parameter:
322: .  eps - the eigenproblem solver context

324:    Output Parameter:
325: .  nrest - the reset parameter

327:    Level: advanced

329: .seealso: EPSRQCGSetReset()
330: @*/
331: PetscErrorCode EPSRQCGGetReset(EPS eps,PetscInt *nrest)
332: {

338:   PetscTryMethod(eps,"EPSRQCGGetReset_C",(EPS,PetscInt*),(eps,nrest));
339:   return(0);
340: }

344: PetscErrorCode EPSReset_RQCG(EPS eps)
345: {
347:   EPS_RQCG       *ctx = (EPS_RQCG*)eps->data;

350:   VecDestroyVecs(eps->mpd,&ctx->AV);
351:   VecDestroyVecs(eps->mpd,&ctx->BV);
352:   VecDestroyVecs(eps->mpd,&ctx->P);
353:   VecDestroyVecs(eps->mpd,&ctx->G);
354:   ctx->nrest = 0;
355:   EPSReset_Default(eps);
356:   return(0);
357: }

361: PetscErrorCode EPSSetFromOptions_RQCG(EPS eps)
362: {
364:   PetscBool      flg;
365:   PetscInt       nrest;

368:   PetscOptionsHead("EPS RQCG Options");
369:   PetscOptionsInt("-eps_rqcg_reset","RQCG reset parameter","EPSRQCGSetReset",20,&nrest,&flg);
370:   if (flg) {
371:     EPSRQCGSetReset(eps,nrest);
372:   }
373:   PetscOptionsTail();
374:   return(0);
375: }

379: PetscErrorCode EPSDestroy_RQCG(EPS eps)
380: {

384:   PetscFree(eps->data);
385:   PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGSetReset_C",NULL);
386:   PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGGetReset_C",NULL);
387:   return(0);
388: }

392: PetscErrorCode EPSView_RQCG(EPS eps,PetscViewer viewer)
393: {
395:   EPS_RQCG       *ctx = (EPS_RQCG*)eps->data;
396:   PetscBool      isascii;

399:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
400:   if (isascii) {
401:     PetscViewerASCIIPrintf(viewer,"  RQCG: reset every %D iterations\n",ctx->nrest);
402:   }
403:   return(0);
404: }

408: PETSC_EXTERN PetscErrorCode EPSCreate_RQCG(EPS eps)
409: {

413:   PetscNewLog(eps,EPS_RQCG,&eps->data);
414:   eps->ops->setup          = EPSSetUp_RQCG;
415:   eps->ops->setfromoptions = EPSSetFromOptions_RQCG;
416:   eps->ops->destroy        = EPSDestroy_RQCG;
417:   eps->ops->reset          = EPSReset_RQCG;
418:   eps->ops->view           = EPSView_RQCG;
419:   eps->ops->backtransform  = EPSBackTransform_Default;
420:   eps->ops->computevectors = EPSComputeVectors_Default;
421:   STSetType(eps->st,STPRECOND);
422:   STPrecondSetKSPHasMat(eps->st,PETSC_TRUE);
423:   PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGSetReset_C",EPSRQCGSetReset_RQCG);
424:   PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGGetReset_C",EPSRQCGGetReset_RQCG);
425:   return(0);
426: }

slepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/makefile0000644000175000017500000000214012211062077021157 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = rqcg.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/cg/rqcg/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/makefile.html0000644000175000017500000000373412211062077022134 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = rqcg.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/cg/rqcg/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/index.html0000644000175000017500000000212412211062077021456 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

rqcg.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/rqcg.c0000644000175000017500000003671612211062077020577 0ustar gladkgladk/* SLEPc eigensolver: "rqcg" Method: Rayleigh Quotient Conjugate Gradient Algorithm: Conjugate Gradient minimization of the Rayleigh quotient with periodic Rayleigh-Ritz acceleration. References: [1] L. Bergamaschi et al., "Parallel preconditioned conjugate gradient optimization of the Rayleigh quotient for the solution of sparse eigenproblems", Appl. Math. Comput. 175(2):1694-1715, 2006. Last update: Jul 2012 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_RQCG(EPS); typedef struct { PetscInt nrest; Vec *AV,*BV,*P,*G; } EPS_RQCG; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_RQCG" PetscErrorCode EPSSetUp_RQCG(EPS eps) { PetscErrorCode ierr; PetscBool precond; PetscInt nmat; EPS_RQCG *ctx = (EPS_RQCG*)eps->data; PetscFunctionBegin; if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"RQCG only works for Hermitian problems"); if (eps->ncv) { /* ncv set */ if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev"); } else if (eps->mpd) { /* mpd set */ eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15)); else { eps->mpd = 500; eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } } if (!eps->mpd) eps->mpd = eps->ncv; if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv); if (!eps->which) eps->which = EPS_SMALLEST_REAL; if (eps->which!=EPS_SMALLEST_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (!eps->extraction) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); /* Set STPrecond as the default ST */ if (!((PetscObject)eps->st)->type_name) { ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); } ierr = PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&precond);CHKERRQ(ierr); if (!precond) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"RQCG only works with precond ST"); if (!ctx->nrest) ctx->nrest = 20; ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = VecDuplicateVecs(eps->t,eps->mpd,&ctx->AV);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->AV);CHKERRQ(ierr); ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); if (nmat>1) { ierr = VecDuplicateVecs(eps->t,eps->mpd,&ctx->BV);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->BV);CHKERRQ(ierr); } ierr = VecDuplicateVecs(eps->t,eps->mpd,&ctx->P);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->P);CHKERRQ(ierr); ierr = VecDuplicateVecs(eps->t,eps->mpd,&ctx->G);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ctx->G);CHKERRQ(ierr); ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); ierr = DSAllocate(eps->ds,eps->ncv);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_RQCG; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_RQCG" PetscErrorCode EPSSolve_RQCG(EPS eps) { PetscErrorCode ierr; EPS_RQCG *ctx = (EPS_RQCG*)eps->data; PetscInt i,j,k,ld,off,nv,ncv = eps->ncv,kini,nmat; PetscScalar *C,*Y,*gamma,g,pap,pbp,pbx,pax,nu,mu,alpha,beta; PetscReal resnorm,norm,a,b,c,disc,t; PetscBool reset,breakdown; Mat A,B; Vec w=eps->work[0]; PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } else B = NULL; ierr = PetscMalloc(eps->mpd*sizeof(PetscScalar),&gamma);CHKERRQ(ierr); kini = eps->nini; while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its++; nv = PetscMin(eps->nconv+eps->mpd,ncv); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,0);CHKERRQ(ierr); /* Generate more initial vectors if necessary */ while (kiniV[kini],eps->rand);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,kini,NULL,eps->V,eps->V[kini],NULL,&norm,&breakdown);CHKERRQ(ierr); if (norm>0.0 && !breakdown) { ierr = VecScale(eps->V[kini],1.0/norm);CHKERRQ(ierr); kini++; } } reset = (eps->its>1 && (eps->its-1)%ctx->nrest==0)? PETSC_TRUE: PETSC_FALSE; if (reset) { /* Compute Rayleigh quotient */ ierr = DSGetArray(eps->ds,DS_MAT_A,&C);CHKERRQ(ierr); for (i=eps->nconv;iV[i],ctx->AV[i-eps->nconv]);CHKERRQ(ierr); ierr = VecMDot(ctx->AV[i-eps->nconv],i-eps->nconv+1,eps->V+eps->nconv,C+eps->nconv+i*ld);CHKERRQ(ierr); for (j=eps->nconv;jds,DS_MAT_A,&C);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); /* Solve projected problem */ ierr = DSSolve(eps->ds,eps->eigr,eps->eigi);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);CHKERRQ(ierr); /* Update vectors V(:,idx) = V * Y(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); off = eps->nconv+eps->nconv*ld; ierr = SlepcUpdateVectors(nv-eps->nconv,ctx->AV,0,nv-eps->nconv,Y+off,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv-eps->nconv,eps->V+eps->nconv,0,nv-eps->nconv,Y+off,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&Y);CHKERRQ(ierr); } else { /* No need to do Rayleigh-Ritz, just take diag(V'*A*V) */ for (i=eps->nconv;iV[i],ctx->AV[i-eps->nconv]);CHKERRQ(ierr); ierr = VecDot(ctx->AV[i-eps->nconv],eps->V[i],eps->eigr+i);CHKERRQ(ierr); } } /* Compute gradient and check convergence */ k = -1; for (i=eps->nconv;iV[i],ctx->BV[i-eps->nconv]);CHKERRQ(ierr); ierr = VecWAXPY(ctx->G[i-eps->nconv],-eps->eigr[i],ctx->BV[i-eps->nconv],ctx->AV[i-eps->nconv]);CHKERRQ(ierr); } else { ierr = VecWAXPY(ctx->G[i-eps->nconv],-eps->eigr[i],eps->V[i],ctx->AV[i-eps->nconv]);CHKERRQ(ierr); } ierr = VecNorm(ctx->G[i-eps->nconv],NORM_2,&resnorm);CHKERRQ(ierr); ierr = (*eps->converged)(eps,eps->eigr[i],0.0,resnorm,&eps->errest[i],eps->convergedctx);CHKERRQ(ierr); if (k==-1 && eps->errest[i] >= eps->tol) k = i; } if (k==-1) k = nv; if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; if (k >= eps->nev) eps->reason = EPS_CONVERGED_TOL; /* The next lines are necessary to avoid DS zeroing eigr */ ierr = DSGetArray(eps->ds,DS_MAT_A,&C);CHKERRQ(ierr); for (i=eps->nconv;ieigr[i]; ierr = DSRestoreArray(eps->ds,DS_MAT_A,&C);CHKERRQ(ierr); if (eps->reason == EPS_CONVERGED_ITERATING) { /* Search direction */ for (i=0;inconv;i++) { ierr = STMatSolve(eps->st,0,ctx->G[i],w);CHKERRQ(ierr); ierr = VecDot(ctx->G[i],w,&g);CHKERRQ(ierr); beta = (!reset && eps->its>1)? g/gamma[i]: 0.0; gamma[i] = g; ierr = VecAXPBY(ctx->P[i],1.0,beta,w);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,i+eps->nconv,NULL,eps->V,ctx->P[i],NULL,&resnorm,&breakdown);CHKERRQ(ierr); } /* Minimization problem */ for (i=eps->nconv;iV[i],ctx->AV[i-eps->nconv],&nu);CHKERRQ(ierr); ierr = VecDot(ctx->P[i-eps->nconv],ctx->AV[i-eps->nconv],&pax);CHKERRQ(ierr); ierr = MatMult(A,ctx->P[i-eps->nconv],w);CHKERRQ(ierr); ierr = VecDot(ctx->P[i-eps->nconv],w,&pap);CHKERRQ(ierr); if (B) { ierr = VecDot(eps->V[i],ctx->BV[i-eps->nconv],&mu);CHKERRQ(ierr); ierr = VecDot(ctx->P[i-eps->nconv],ctx->BV[i-eps->nconv],&pbx);CHKERRQ(ierr); ierr = MatMult(B,ctx->P[i-eps->nconv],w);CHKERRQ(ierr); ierr = VecDot(ctx->P[i-eps->nconv],w,&pbp);CHKERRQ(ierr); } else { ierr = VecDot(eps->V[i],eps->V[i],&mu);CHKERRQ(ierr); ierr = VecDot(ctx->P[i-eps->nconv],eps->V[i],&pbx);CHKERRQ(ierr); ierr = VecDot(ctx->P[i-eps->nconv],ctx->P[i-eps->nconv],&pbp);CHKERRQ(ierr); } a = PetscRealPart(pap*pbx-pax*pbp); b = PetscRealPart(nu*pbp-mu*pap); c = PetscRealPart(mu*pax-nu*pbx); t = PetscMax(PetscMax(PetscAbsReal(a),PetscAbsReal(b)),PetscAbsReal(c)); if (t!=0.0) { a /= t; b /= t; c /= t; } disc = PetscSqrtReal(PetscAbsReal(b*b-4.0*a*c)); if (b>=0.0 && a!=0.0) alpha = (b+disc)/(2.0*a); else if (b!=disc) alpha = 2.0*c/(b-disc); else alpha = 0; /* Next iterate */ if (alpha!=0.0) { ierr = VecAXPY(eps->V[i],alpha,ctx->P[i-eps->nconv]);CHKERRQ(ierr); } ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,eps->V[i],NULL,&norm,&breakdown);CHKERRQ(ierr); if (!breakdown && norm!=0.0) { ierr = VecScale(eps->V[i],1.0/norm);CHKERRQ(ierr); } } } ierr = EPSMonitor(eps,eps->its,k,eps->eigr,eps->eigi,eps->errest,nv);CHKERRQ(ierr); eps->nconv = k; } ierr = PetscFree(gamma);CHKERRQ(ierr); /* truncate Schur decomposition and change the state to raw so that PSVectors() computes eigenvectors from scratch */ ierr = DSSetDimensions(eps->ds,eps->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSRQCGSetReset_RQCG" static PetscErrorCode EPSRQCGSetReset_RQCG(EPS eps,PetscInt nrest) { EPS_RQCG *ctx = (EPS_RQCG*)eps->data; PetscFunctionBegin; ctx->nrest = nrest; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSRQCGSetReset" /*@ EPSRQCGSetReset - Sets the reset parameter of the RQCG iteration. Every nrest iterations, the solver performs a Rayleigh-Ritz projection step. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - nrest - the number of iterations between resets Options Database Key: . -eps_rqcg_reset - Sets the reset parameter Level: advanced .seealso: EPSRQCGGetReset() @*/ PetscErrorCode EPSRQCGSetReset(EPS eps,PetscInt nrest) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,nrest,2); ierr = PetscTryMethod(eps,"EPSRQCGSetReset_C",(EPS,PetscInt),(eps,nrest));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSRQCGGetReset_RQCG" static PetscErrorCode EPSRQCGGetReset_RQCG(EPS eps,PetscInt *nrest) { EPS_RQCG *ctx = (EPS_RQCG*)eps->data; PetscFunctionBegin; *nrest = ctx->nrest; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSRQCGGetReset" /*@ EPSRQCGGetReset - Gets the reset parameter used in the RQCG method. Not Collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . nrest - the reset parameter Level: advanced .seealso: EPSRQCGSetReset() @*/ PetscErrorCode EPSRQCGGetReset(EPS eps,PetscInt *nrest) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(nrest,2); ierr = PetscTryMethod(eps,"EPSRQCGGetReset_C",(EPS,PetscInt*),(eps,nrest));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_RQCG" PetscErrorCode EPSReset_RQCG(EPS eps) { PetscErrorCode ierr; EPS_RQCG *ctx = (EPS_RQCG*)eps->data; PetscFunctionBegin; ierr = VecDestroyVecs(eps->mpd,&ctx->AV);CHKERRQ(ierr); ierr = VecDestroyVecs(eps->mpd,&ctx->BV);CHKERRQ(ierr); ierr = VecDestroyVecs(eps->mpd,&ctx->P);CHKERRQ(ierr); ierr = VecDestroyVecs(eps->mpd,&ctx->G);CHKERRQ(ierr); ctx->nrest = 0; ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_RQCG" PetscErrorCode EPSSetFromOptions_RQCG(EPS eps) { PetscErrorCode ierr; PetscBool flg; PetscInt nrest; PetscFunctionBegin; ierr = PetscOptionsHead("EPS RQCG Options");CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_rqcg_reset","RQCG reset parameter","EPSRQCGSetReset",20,&nrest,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSRQCGSetReset(eps,nrest);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_RQCG" PetscErrorCode EPSDestroy_RQCG(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGSetReset_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGGetReset_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_RQCG" PetscErrorCode EPSView_RQCG(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_RQCG *ctx = (EPS_RQCG*)eps->data; PetscBool isascii; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," RQCG: reset every %D iterations\n",ctx->nrest);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_RQCG" PETSC_EXTERN PetscErrorCode EPSCreate_RQCG(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_RQCG,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_RQCG; eps->ops->setfromoptions = EPSSetFromOptions_RQCG; eps->ops->destroy = EPSDestroy_RQCG; eps->ops->reset = EPSReset_RQCG; eps->ops->view = EPSView_RQCG; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Default; ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); ierr = STPrecondSetKSPHasMat(eps->st,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGSetReset_C",EPSRQCGSetReset_RQCG);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSRQCGGetReset_C",EPSRQCGGetReset_RQCG);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/ftn-auto/0000755000175000017500000000000012214143515021217 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/ftn-auto/makefile0000644000175000017500000000034312211062077022717 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = rqcgf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/cg/rqcg/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/cg/rqcg/ftn-auto/rqcgf.c0000644000175000017500000000251112211062077022464 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* rqcg.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsrqcgsetreset_ EPSRQCGSETRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsrqcgsetreset_ epsrqcgsetreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsrqcggetreset_ EPSRQCGGETRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsrqcggetreset_ epsrqcggetreset #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsrqcgsetreset_(EPS *eps,PetscInt *nrest, int *__ierr ){ *__ierr = EPSRQCGSetReset(*eps,*nrest); } void PETSC_STDCALL epsrqcggetreset_(EPS *eps,PetscInt *nrest, int *__ierr ){ *__ierr = EPSRQCGGetReset(*eps,nrest); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/cg/makefile0000644000175000017500000000204212211062077020224 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = rqcg LOCDIR = src/eps/impls/cg/ MANSEC = EPS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/cg/makefile.html0000644000175000017500000000363612211062077021201 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = rqcg
LOCDIR   = src/eps/impls/cg/
MANSEC   = EPS

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/cg/index.html0000644000175000017500000000211512211062077020522 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

rqcg/
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/subspace/0000755000175000017500000000000012211062077017742 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/subspace/makefile0000644000175000017500000000214512211062077021444 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = subspace.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/subspace/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/subspace/makefile.html0000644000175000017500000000374112211062077022412 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = subspace.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/subspace/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/subspace/index.html0000644000175000017500000000213412211062077021737 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

subspace.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/subspace/subspace.c.html0000644000175000017500000007005512211062077022665 0ustar gladkgladk

Actual source code: subspace.c

  1: /*

  3:    SLEPc eigensolver: "subspace"

  5:    Method: Subspace Iteration

  7:    Algorithm:

  9:        Subspace iteration with Rayleigh-Ritz projection and locking,
 10:        based on the SRRIT implementation.

 12:    References:

 14:        [1] "Subspace Iteration in SLEPc", SLEPc Technical Report STR-3,
 15:            available at http://www.grycap.upv.es/slepc.

 17:    Last update: Feb 2009

 19:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 21:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 23:    This file is part of SLEPc.

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

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

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

 39: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 40: #include <slepcblaslapack.h>

 42: PetscErrorCode EPSSolve_Subspace(EPS);

 44: typedef struct {
 45:   Vec *AV;
 46: } EPS_SUBSPACE;

 50: PetscErrorCode EPSSetUp_Subspace(EPS eps)
 51: {
 53:   EPS_SUBSPACE   *ctx = (EPS_SUBSPACE*)eps->data;

 56:   if (eps->ncv) { /* ncv set */
 57:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev");
 58:   } else if (eps->mpd) { /* mpd set */
 59:     eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 60:   } else { /* neither set: defaults depend on nev being small or large */
 61:     if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15));
 62:     else {
 63:       eps->mpd = 500;
 64:       eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd);
 65:     }
 66:   }
 67:   if (!eps->mpd) eps->mpd = eps->ncv;
 68:   if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
 69:   if (!eps->which) { EPSSetWhichEigenpairs_Default(eps); }
 70:   if (eps->which!=EPS_LARGEST_MAGNITUDE && eps->which!=EPS_TARGET_MAGNITUDE) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
 71:   if (!eps->extraction) {
 72:     EPSSetExtraction(eps,EPS_RITZ);
 73:   } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type");
 74:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

 76:   EPSAllocateSolution(eps);
 77:   VecDuplicateVecs(eps->t,eps->ncv,&ctx->AV);
 78:   PetscLogObjectParents(eps,eps->ncv,ctx->AV);
 79:   if (eps->ishermitian) {
 80:     DSSetType(eps->ds,DSHEP);
 81:   } else {
 82:     DSSetType(eps->ds,DSNHEP);
 83:   }
 84:   DSAllocate(eps->ds,eps->ncv);
 85:   EPSSetWorkVecs(eps,1);

 87:   /* dispatch solve method */
 88:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
 89:   if (eps->isgeneralized && eps->ishermitian && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method does not work for indefinite problems");
 90:   eps->ops->solve = EPSSolve_Subspace;
 91:   return(0);
 92: }

 96: /*
 97:    EPSSubspaceFindGroup - Find a group of nearly equimodular eigenvalues, provided
 98:    in arrays wr and wi, according to the tolerance grptol. Also the 2-norms
 99:    of the residuals must be passed in (rsd). Arrays are processed from index
100:    l to index m only. The output information is:

102:    ngrp - number of entries of the group
103:    ctr  - (w(l)+w(l+ngrp-1))/2
104:    ae   - average of wr(l),...,wr(l+ngrp-1)
105:    arsd - average of rsd(l),...,rsd(l+ngrp-1)
106: */
107: static PetscErrorCode EPSSubspaceFindGroup(PetscInt l,PetscInt m,PetscScalar *wr,PetscScalar *wi,PetscReal *rsd,PetscReal grptol,PetscInt *ngrp,PetscReal *ctr,PetscReal *ae,PetscReal *arsd)
108: {
109:   PetscInt  i;
110:   PetscReal rmod,rmod1;

113:   *ngrp = 0;
114:   *ctr = 0;
115:   rmod = SlepcAbsEigenvalue(wr[l],wi[l]);

117:   for (i=l;i<m;) {
118:     rmod1 = SlepcAbsEigenvalue(wr[i],wi[i]);
119:     if (PetscAbsReal(rmod-rmod1) > grptol*(rmod+rmod1)) break;
120:     *ctr = (rmod+rmod1)/2.0;
121:     if (wi[i] != 0.0) {
122:       (*ngrp)+=2;
123:       i+=2;
124:     } else {
125:       (*ngrp)++;
126:       i++;
127:     }
128:   }

130:   *ae = 0;
131:   *arsd = 0;
132:   if (*ngrp) {
133:     for (i=l;i<l+*ngrp;i++) {
134:       (*ae) += PetscRealPart(wr[i]);
135:       (*arsd) += rsd[i]*rsd[i];
136:     }
137:     *ae = *ae / *ngrp;
138:     *arsd = PetscSqrtScalar(*arsd / *ngrp);
139:   }
140:   return(0);
141: }

145: /*
146:    EPSSubspaceResidualNorms - Computes the column norms of residual vectors
147:    OP*V(1:n,l:m) - V*T(1:m,l:m), where, on entry, OP*V has been computed and
148:    stored in AV. ldt is the leading dimension of T. On exit, rsd(l) to
149:    rsd(m) contain the computed norms.
150: */
151: static PetscErrorCode EPSSubspaceResidualNorms(Vec *V,Vec *AV,PetscScalar *T,PetscInt l,PetscInt m,PetscInt ldt,Vec w,PetscReal *rsd)
152: {
154:   PetscInt       i,k;
155:   PetscScalar    t;

158:   for (i=l;i<m;i++) {
159:     if (i==m-1 || T[i+1+ldt*i]==0.0) k=i+1;
160:     else k=i+2;
161:     VecCopy(AV[i],w);
162:     SlepcVecMAXPBY(w,1.0,-1.0,k,T+ldt*i,V);
163:     VecDot(w,w,&t);
164:     rsd[i] = PetscRealPart(t);
165:   }
166:   for (i=l;i<m;i++) {
167:     if (i == m-1) {
168:       rsd[i] = PetscSqrtReal(rsd[i]);
169:     } else if (T[i+1+(ldt*i)]==0.0) {
170:       rsd[i] = PetscSqrtReal(rsd[i]);
171:     } else {
172:       rsd[i] = PetscSqrtReal((rsd[i]+rsd[i+1])/2.0);
173:       rsd[i+1] = rsd[i];
174:       i++;
175:     }
176:   }
177:   return(0);
178: }

182: PetscErrorCode EPSSolve_Subspace(EPS eps)
183: {
185:   EPS_SUBSPACE   *ctx = (EPS_SUBSPACE*)eps->data;
186:   PetscInt       i,k,ld,ngrp,nogrp,*itrsd,*itrsdold;
187:   PetscInt       nxtsrr,idsrr,idort,nxtort,nv,ncv = eps->ncv,its;
188:   PetscScalar    *T,*U;
189:   PetscReal      arsd,oarsd,ctr,octr,ae,oae,*rsd,norm,tcond=1.0;
190:   PetscBool      breakdown;
191:   /* Parameters */
192:   PetscInt       init = 5;        /* Number of initial iterations */
193:   PetscReal      stpfac = 1.5;    /* Max num of iter before next SRR step */
194:   PetscReal      alpha = 1.0;     /* Used to predict convergence of next residual */
195:   PetscReal      beta = 1.1;      /* Used to predict convergence of next residual */
196:   PetscReal      grptol = 1e-8;   /* Tolerance for EPSSubspaceFindGroup */
197:   PetscReal      cnvtol = 1e-6;   /* Convergence criterion for cnv */
198:   PetscInt       orttol = 2;      /* Number of decimal digits whose loss
199:                                      can be tolerated in orthogonalization */

202:   its = 0;
203:   PetscMalloc(sizeof(PetscReal)*ncv,&rsd);
204:   PetscMalloc(sizeof(PetscInt)*ncv,&itrsd);
205:   PetscMalloc(sizeof(PetscInt)*ncv,&itrsdold);
206:   DSGetLeadingDimension(eps->ds,&ld);

208:   for (i=0;i<ncv;i++) {
209:     rsd[i] = 0.0;
210:     itrsd[i] = -1;
211:   }

213:   /* Complete the initial basis with random vectors and orthonormalize them */
214:   k = eps->nini;
215:   while (k<ncv) {
216:     SlepcVecSetRandom(eps->V[k],eps->rand);
217:     IPOrthogonalize(eps->ip,eps->nds,eps->defl,k,NULL,eps->V,eps->V[k],NULL,&norm,&breakdown);
218:     if (norm>0.0 && !breakdown) {
219:       VecScale(eps->V[k],1.0/norm);
220:       k++;
221:     }
222:   }

224:   while (eps->its<eps->max_it) {
225:     eps->its++;
226:     nv = PetscMin(eps->nconv+eps->mpd,ncv);
227:     DSSetDimensions(eps->ds,nv,0,eps->nconv,0);

229:     /* Find group in previously computed eigenvalues */
230:     EPSSubspaceFindGroup(eps->nconv,nv,eps->eigr,eps->eigi,rsd,grptol,&nogrp,&octr,&oae,&oarsd);

232:     /* AV(:,idx) = OP * V(:,idx) */
233:     for (i=eps->nconv;i<nv;i++) {
234:       STApply(eps->st,eps->V[i],ctx->AV[i]);
235:     }

237:     /* T(:,idx) = V' * AV(:,idx) */
238:     DSGetArray(eps->ds,DS_MAT_A,&T);
239:     for (i=eps->nconv;i<nv;i++) {
240:       VecMDot(ctx->AV[i],nv,eps->V,T+i*ld);
241:     }
242:     DSRestoreArray(eps->ds,DS_MAT_A,&T);
243:     DSSetState(eps->ds,DS_STATE_RAW);

245:     /* Solve projected problem */
246:     DSSolve(eps->ds,eps->eigr,eps->eigi);
247:     DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);

249:     /* Update vectors V(:,idx) = V * U(:,idx) */
250:     DSGetArray(eps->ds,DS_MAT_Q,&U);
251:     SlepcUpdateVectors(nv,ctx->AV,eps->nconv,nv,U,ld,PETSC_FALSE);
252:     SlepcUpdateVectors(nv,eps->V,eps->nconv,nv,U,ld,PETSC_FALSE);
253:     DSRestoreArray(eps->ds,DS_MAT_Q,&U);

255:     /* Convergence check */
256:     DSGetArray(eps->ds,DS_MAT_A,&T);
257:     EPSSubspaceResidualNorms(eps->V,ctx->AV,T,eps->nconv,nv,ld,eps->work[0],rsd);
258:     DSRestoreArray(eps->ds,DS_MAT_A,&T);

260:     for (i=eps->nconv;i<nv;i++) {
261:       itrsdold[i] = itrsd[i];
262:       itrsd[i] = its;
263:       eps->errest[i] = rsd[i];
264:     }

266:     for (;;) {
267:       /* Find group in currently computed eigenvalues */
268:       EPSSubspaceFindGroup(eps->nconv,nv,eps->eigr,eps->eigi,eps->errest,grptol,&ngrp,&ctr,&ae,&arsd);
269:       if (ngrp!=nogrp) break;
270:       if (ngrp==0) break;
271:       if (PetscAbsScalar(ae-oae)>ctr*cnvtol*(itrsd[eps->nconv]-itrsdold[eps->nconv])) break;
272:       if (arsd>ctr*eps->tol) break;
273:       eps->nconv = eps->nconv + ngrp;
274:       if (eps->nconv>=nv) break;
275:     }

277:     EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,nv);
278:     if (eps->nconv>=eps->nev) break;

280:     /* Compute nxtsrr (iteration of next projection step) */
281:     nxtsrr = PetscMin(eps->max_it,PetscMax((PetscInt)floor(stpfac*its),init));

283:     if (ngrp!=nogrp || ngrp==0 || arsd>=oarsd) {
284:       idsrr = nxtsrr - its;
285:     } else {
286:       idsrr = (PetscInt)floor(alpha+beta*(itrsdold[eps->nconv]-itrsd[eps->nconv])*log(arsd/eps->tol)/log(arsd/oarsd));
287:       idsrr = PetscMax(1,idsrr);
288:     }
289:     nxtsrr = PetscMin(nxtsrr,its+idsrr);

291:     /* Compute nxtort (iteration of next orthogonalization step) */
292:     DSCond(eps->ds,&tcond);
293:     idort = PetscMax(1,(PetscInt)floor(orttol/PetscMax(1,log10(tcond))));
294:     nxtort = PetscMin(its+idort,nxtsrr);

296:     /* V(:,idx) = AV(:,idx) */
297:     for (i=eps->nconv;i<nv;i++) {
298:       VecCopy(ctx->AV[i],eps->V[i]);
299:     }
300:     its++;

302:     /* Orthogonalization loop */
303:     do {
304:       while (its<nxtort) {

306:         /* AV(:,idx) = OP * V(:,idx) */
307:         for (i=eps->nconv;i<nv;i++) {
308:           STApply(eps->st,eps->V[i],ctx->AV[i]);
309:         }

311:         /* V(:,idx) = AV(:,idx) with normalization */
312:         for (i=eps->nconv;i<nv;i++) {
313:           VecCopy(ctx->AV[i],eps->V[i]);
314:           VecNorm(eps->V[i],NORM_INFINITY,&norm);
315:           VecScale(eps->V[i],1/norm);
316:         }
317:         its++;
318:       }
319:       /* Orthonormalize vectors */
320:       for (i=eps->nconv;i<nv;i++) {
321:         IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,eps->V[i],NULL,&norm,&breakdown);
322:         if (breakdown) {
323:           SlepcVecSetRandom(eps->V[i],eps->rand);
324:           IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,eps->V[i],NULL,&norm,&breakdown);
325:         }
326:         VecScale(eps->V[i],1/norm);
327:       }
328:       nxtort = PetscMin(its+idort,nxtsrr);
329:     } while (its<nxtsrr);
330:   }

332:   PetscFree(rsd);
333:   PetscFree(itrsd);
334:   PetscFree(itrsdold);

336:   if (eps->nconv == eps->nev) eps->reason = EPS_CONVERGED_TOL;
337:   else eps->reason = EPS_DIVERGED_ITS;
338:   /* truncate Schur decomposition and change the state to raw so that
339:      PSVectors() computes eigenvectors from scratch */
340:   DSSetDimensions(eps->ds,eps->nconv,0,0,0);
341:   DSSetState(eps->ds,DS_STATE_RAW);
342:   return(0);
343: }

347: PetscErrorCode EPSReset_Subspace(EPS eps)
348: {
350:   EPS_SUBSPACE   *ctx = (EPS_SUBSPACE*)eps->data;

353:   VecDestroyVecs(eps->ncv,&ctx->AV);
354:   EPSReset_Default(eps);
355:   return(0);
356: }

360: PetscErrorCode EPSDestroy_Subspace(EPS eps)
361: {

365:   PetscFree(eps->data);
366:   return(0);
367: }

371: PETSC_EXTERN PetscErrorCode EPSCreate_Subspace(EPS eps)
372: {

376:   PetscNewLog(eps,EPS_SUBSPACE,&eps->data);
377:   eps->ops->setup                = EPSSetUp_Subspace;
378:   eps->ops->destroy              = EPSDestroy_Subspace;
379:   eps->ops->reset                = EPSReset_Subspace;
380:   eps->ops->backtransform        = EPSBackTransform_Default;
381:   eps->ops->computevectors       = EPSComputeVectors_Schur;
382:   return(0);
383: }

slepc-3.4.2.dfsg.orig/src/eps/impls/subspace/subspace.c0000644000175000017500000003265112211062077021722 0ustar gladkgladk/* SLEPc eigensolver: "subspace" Method: Subspace Iteration Algorithm: Subspace iteration with Rayleigh-Ritz projection and locking, based on the SRRIT implementation. References: [1] "Subspace Iteration in SLEPc", SLEPc Technical Report STR-3, available at http://www.grycap.upv.es/slepc. Last update: Feb 2009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_Subspace(EPS); typedef struct { Vec *AV; } EPS_SUBSPACE; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_Subspace" PetscErrorCode EPSSetUp_Subspace(EPS eps) { PetscErrorCode ierr; EPS_SUBSPACE *ctx = (EPS_SUBSPACE*)eps->data; PetscFunctionBegin; if (eps->ncv) { /* ncv set */ if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev"); } else if (eps->mpd) { /* mpd set */ eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (eps->nev<500) eps->ncv = PetscMin(eps->n,PetscMax(2*eps->nev,eps->nev+15)); else { eps->mpd = 500; eps->ncv = PetscMin(eps->n,eps->nev+eps->mpd); } } if (!eps->mpd) eps->mpd = eps->ncv; if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv); if (!eps->which) { ierr = EPSSetWhichEigenpairs_Default(eps);CHKERRQ(ierr); } if (eps->which!=EPS_LARGEST_MAGNITUDE && eps->which!=EPS_TARGET_MAGNITUDE) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (!eps->extraction) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } else if (eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Unsupported extraction type"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = VecDuplicateVecs(eps->t,eps->ncv,&ctx->AV);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,eps->ncv,ctx->AV);CHKERRQ(ierr); if (eps->ishermitian) { ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); } ierr = DSAllocate(eps->ds,eps->ncv);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); if (eps->isgeneralized && eps->ishermitian && !eps->ispositive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method does not work for indefinite problems"); eps->ops->solve = EPSSolve_Subspace; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSubspaceFindGroup" /* EPSSubspaceFindGroup - Find a group of nearly equimodular eigenvalues, provided in arrays wr and wi, according to the tolerance grptol. Also the 2-norms of the residuals must be passed in (rsd). Arrays are processed from index l to index m only. The output information is: ngrp - number of entries of the group ctr - (w(l)+w(l+ngrp-1))/2 ae - average of wr(l),...,wr(l+ngrp-1) arsd - average of rsd(l),...,rsd(l+ngrp-1) */ static PetscErrorCode EPSSubspaceFindGroup(PetscInt l,PetscInt m,PetscScalar *wr,PetscScalar *wi,PetscReal *rsd,PetscReal grptol,PetscInt *ngrp,PetscReal *ctr,PetscReal *ae,PetscReal *arsd) { PetscInt i; PetscReal rmod,rmod1; PetscFunctionBegin; *ngrp = 0; *ctr = 0; rmod = SlepcAbsEigenvalue(wr[l],wi[l]); for (i=l;i grptol*(rmod+rmod1)) break; *ctr = (rmod+rmod1)/2.0; if (wi[i] != 0.0) { (*ngrp)+=2; i+=2; } else { (*ngrp)++; i++; } } *ae = 0; *arsd = 0; if (*ngrp) { for (i=l;idata; PetscInt i,k,ld,ngrp,nogrp,*itrsd,*itrsdold; PetscInt nxtsrr,idsrr,idort,nxtort,nv,ncv = eps->ncv,its; PetscScalar *T,*U; PetscReal arsd,oarsd,ctr,octr,ae,oae,*rsd,norm,tcond=1.0; PetscBool breakdown; /* Parameters */ PetscInt init = 5; /* Number of initial iterations */ PetscReal stpfac = 1.5; /* Max num of iter before next SRR step */ PetscReal alpha = 1.0; /* Used to predict convergence of next residual */ PetscReal beta = 1.1; /* Used to predict convergence of next residual */ PetscReal grptol = 1e-8; /* Tolerance for EPSSubspaceFindGroup */ PetscReal cnvtol = 1e-6; /* Convergence criterion for cnv */ PetscInt orttol = 2; /* Number of decimal digits whose loss can be tolerated in orthogonalization */ PetscFunctionBegin; its = 0; ierr = PetscMalloc(sizeof(PetscReal)*ncv,&rsd);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscInt)*ncv,&itrsd);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscInt)*ncv,&itrsdold);CHKERRQ(ierr); ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); for (i=0;inini; while (kV[k],eps->rand);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,k,NULL,eps->V,eps->V[k],NULL,&norm,&breakdown);CHKERRQ(ierr); if (norm>0.0 && !breakdown) { ierr = VecScale(eps->V[k],1.0/norm);CHKERRQ(ierr); k++; } } while (eps->itsmax_it) { eps->its++; nv = PetscMin(eps->nconv+eps->mpd,ncv); ierr = DSSetDimensions(eps->ds,nv,0,eps->nconv,0);CHKERRQ(ierr); /* Find group in previously computed eigenvalues */ ierr = EPSSubspaceFindGroup(eps->nconv,nv,eps->eigr,eps->eigi,rsd,grptol,&nogrp,&octr,&oae,&oarsd);CHKERRQ(ierr); /* AV(:,idx) = OP * V(:,idx) */ for (i=eps->nconv;ist,eps->V[i],ctx->AV[i]);CHKERRQ(ierr); } /* T(:,idx) = V' * AV(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_A,&T);CHKERRQ(ierr); for (i=eps->nconv;iAV[i],nv,eps->V,T+i*ld);CHKERRQ(ierr); } ierr = DSRestoreArray(eps->ds,DS_MAT_A,&T);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); /* Solve projected problem */ ierr = DSSolve(eps->ds,eps->eigr,eps->eigi);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);CHKERRQ(ierr); /* Update vectors V(:,idx) = V * U(:,idx) */ ierr = DSGetArray(eps->ds,DS_MAT_Q,&U);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,ctx->AV,eps->nconv,nv,U,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,eps->V,eps->nconv,nv,U,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Q,&U);CHKERRQ(ierr); /* Convergence check */ ierr = DSGetArray(eps->ds,DS_MAT_A,&T);CHKERRQ(ierr); ierr = EPSSubspaceResidualNorms(eps->V,ctx->AV,T,eps->nconv,nv,ld,eps->work[0],rsd);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_A,&T);CHKERRQ(ierr); for (i=eps->nconv;ierrest[i] = rsd[i]; } for (;;) { /* Find group in currently computed eigenvalues */ ierr = EPSSubspaceFindGroup(eps->nconv,nv,eps->eigr,eps->eigi,eps->errest,grptol,&ngrp,&ctr,&ae,&arsd);CHKERRQ(ierr); if (ngrp!=nogrp) break; if (ngrp==0) break; if (PetscAbsScalar(ae-oae)>ctr*cnvtol*(itrsd[eps->nconv]-itrsdold[eps->nconv])) break; if (arsd>ctr*eps->tol) break; eps->nconv = eps->nconv + ngrp; if (eps->nconv>=nv) break; } ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,nv);CHKERRQ(ierr); if (eps->nconv>=eps->nev) break; /* Compute nxtsrr (iteration of next projection step) */ nxtsrr = PetscMin(eps->max_it,PetscMax((PetscInt)floor(stpfac*its),init)); if (ngrp!=nogrp || ngrp==0 || arsd>=oarsd) { idsrr = nxtsrr - its; } else { idsrr = (PetscInt)floor(alpha+beta*(itrsdold[eps->nconv]-itrsd[eps->nconv])*log(arsd/eps->tol)/log(arsd/oarsd)); idsrr = PetscMax(1,idsrr); } nxtsrr = PetscMin(nxtsrr,its+idsrr); /* Compute nxtort (iteration of next orthogonalization step) */ ierr = DSCond(eps->ds,&tcond);CHKERRQ(ierr); idort = PetscMax(1,(PetscInt)floor(orttol/PetscMax(1,log10(tcond)))); nxtort = PetscMin(its+idort,nxtsrr); /* V(:,idx) = AV(:,idx) */ for (i=eps->nconv;iAV[i],eps->V[i]);CHKERRQ(ierr); } its++; /* Orthogonalization loop */ do { while (itsnconv;ist,eps->V[i],ctx->AV[i]);CHKERRQ(ierr); } /* V(:,idx) = AV(:,idx) with normalization */ for (i=eps->nconv;iAV[i],eps->V[i]);CHKERRQ(ierr); ierr = VecNorm(eps->V[i],NORM_INFINITY,&norm);CHKERRQ(ierr); ierr = VecScale(eps->V[i],1/norm);CHKERRQ(ierr); } its++; } /* Orthonormalize vectors */ for (i=eps->nconv;iip,eps->nds,eps->defl,i,NULL,eps->V,eps->V[i],NULL,&norm,&breakdown);CHKERRQ(ierr); if (breakdown) { ierr = SlepcVecSetRandom(eps->V[i],eps->rand);CHKERRQ(ierr); ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,eps->V[i],NULL,&norm,&breakdown);CHKERRQ(ierr); } ierr = VecScale(eps->V[i],1/norm);CHKERRQ(ierr); } nxtort = PetscMin(its+idort,nxtsrr); } while (itsnconv == eps->nev) eps->reason = EPS_CONVERGED_TOL; else eps->reason = EPS_DIVERGED_ITS; /* truncate Schur decomposition and change the state to raw so that PSVectors() computes eigenvectors from scratch */ ierr = DSSetDimensions(eps->ds,eps->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(eps->ds,DS_STATE_RAW);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_Subspace" PetscErrorCode EPSReset_Subspace(EPS eps) { PetscErrorCode ierr; EPS_SUBSPACE *ctx = (EPS_SUBSPACE*)eps->data; PetscFunctionBegin; ierr = VecDestroyVecs(eps->ncv,&ctx->AV);CHKERRQ(ierr); ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_Subspace" PetscErrorCode EPSDestroy_Subspace(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_Subspace" PETSC_EXTERN PetscErrorCode EPSCreate_Subspace(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_SUBSPACE,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_Subspace; eps->ops->destroy = EPSDestroy_Subspace; eps->ops->reset = EPSReset_Subspace; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Schur; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/makefile0000644000175000017500000000212112211062077017631 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = power subspace krylov davidson cg ciss lapack external LOCDIR = src/eps/impls/ MANSEC = EPS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/makefile.html0000644000175000017500000000371512211062077020606 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = power subspace krylov davidson cg ciss lapack external
LOCDIR   = src/eps/impls/
MANSEC   = EPS

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/index.html0000644000175000017500000000247512211062077020142 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

power/
subspace/
krylov/
davidson/
cg/
ciss/
lapack/
external/
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/0000755000175000017500000000000012214143515017757 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/0000755000175000017500000000000012214143515021405 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/blzpackp.h.html0000644000175000017500000001305312211062077024331 0ustar gladkgladk

Actual source code: blzpackp.h

  1: /*
  2:    Private data structure used by the BLZPACK interface

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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


 27: typedef struct {
 28:   PetscBLASInt         block_size;      /* block size */
 29:   PetscBLASInt         slice;           /* use spectrum slicing */
 30:   PetscBLASInt         nsteps;          /* maximum number of steps per run */
 31:   PetscBLASInt         *istor;
 32:   PetscReal            *rstor;
 33:   PetscScalar          *u;
 34:   PetscScalar          *v;
 35:   PetscScalar          *eig;
 36: } EPS_BLZPACK;

 38: /*
 39:    Definition of routines from the BLZPACK package
 40: */

 42: #if defined(SLEPC_BLZPACK_HAVE_UNDERSCORE)
 43: #define SLEPC_BLZPACK(lcase,ucase) lcase##_
 44: #elif defined(SLEPC_BLZPACK_HAVE_CAPS)
 45: #define SLEPC_BLZPACK(lcase,ucase) ucase
 46: #else
 47: #define SLEPC_BLZPACK(lcase,ucase) lcase
 48: #endif

 50: /*
 51:     These are real case, current version of BLZPACK only supports real
 52:     matrices
 53: */

 55: #if defined(PETSC_USE_SINGLE)
 56: /*
 57:    For these machines we must call the single precision Fortran version
 58: */
 59: #define BLZpack_ SLEPC_BLZPACK(blzdrs,BLZDRS)
 60: #else
 61: #define BLZpack_ SLEPC_BLZPACK(blzdrd,BLZDRD)
 62: #endif

 64: #define BLZistorr_ SLEPC_BLZPACK(istorr,ISTORR)
 65: #define BLZrstorr_ SLEPC_BLZPACK(rstorr,RSTORR)

 67: PETSC_EXTERN void BLZpack_(PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*);

 69: PETSC_EXTERN PetscBLASInt BLZistorr_(PetscBLASInt*,const char*,int);
 70: PETSC_EXTERN PetscReal BLZrstorr_(PetscReal*,char*,int);

 72: #endif

slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/blzpackp.h0000644000175000017500000000452512211062077023372 0ustar gladkgladk/* Private data structure used by the BLZPACK interface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__BLZPACKP_H) #define __BLZPACKP_H typedef struct { PetscBLASInt block_size; /* block size */ PetscBLASInt slice; /* use spectrum slicing */ PetscBLASInt nsteps; /* maximum number of steps per run */ PetscBLASInt *istor; PetscReal *rstor; PetscScalar *u; PetscScalar *v; PetscScalar *eig; } EPS_BLZPACK; /* Definition of routines from the BLZPACK package */ #if defined(SLEPC_BLZPACK_HAVE_UNDERSCORE) #define SLEPC_BLZPACK(lcase,ucase) lcase##_ #elif defined(SLEPC_BLZPACK_HAVE_CAPS) #define SLEPC_BLZPACK(lcase,ucase) ucase #else #define SLEPC_BLZPACK(lcase,ucase) lcase #endif /* These are real case, current version of BLZPACK only supports real matrices */ #if defined(PETSC_USE_SINGLE) /* For these machines we must call the single precision Fortran version */ #define BLZpack_ SLEPC_BLZPACK(blzdrs,BLZDRS) #else #define BLZpack_ SLEPC_BLZPACK(blzdrd,BLZDRD) #endif #define BLZistorr_ SLEPC_BLZPACK(istorr,ISTORR) #define BLZrstorr_ SLEPC_BLZPACK(rstorr,RSTORR) PETSC_EXTERN void BLZpack_(PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*); PETSC_EXTERN PetscBLASInt BLZistorr_(PetscBLASInt*,const char*,int); PETSC_EXTERN PetscReal BLZrstorr_(PetscReal*,char*,int); #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/blzpack.c0000644000175000017500000004303212211062077023201 0ustar gladkgladk/* This file implements a wrapper to the BLZPACK package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include /*I "slepcst.h" I*/ #include <../src/eps/impls/external/blzpack/blzpackp.h> PetscErrorCode EPSSolve_BLZPACK(EPS); const char* blzpack_error[33] = { "", "illegal data, LFLAG ", "illegal data, dimension of (U), (V), (X) ", "illegal data, leading dimension of (U), (V), (X) ", "illegal data, leading dimension of (EIG) ", "illegal data, number of required eigenpairs ", "illegal data, Lanczos algorithm block size ", "illegal data, maximum number of steps ", "illegal data, number of starting vectors ", "illegal data, number of eigenpairs provided ", "illegal data, problem type flag ", "illegal data, spectrum slicing flag ", "illegal data, eigenvectors purification flag ", "illegal data, level of output ", "illegal data, output file unit ", "illegal data, LCOMM (MPI or PVM) ", "illegal data, dimension of ISTOR ", "illegal data, convergence threshold ", "illegal data, dimension of RSTOR ", "illegal data on at least one PE ", "ISTOR(3:14) must be equal on all PEs ", "RSTOR(1:3) must be equal on all PEs ", "not enough space in ISTOR to start eigensolution ", "not enough space in RSTOR to start eigensolution ", "illegal data, number of negative eigenvalues ", "illegal data, entries of V ", "illegal data, entries of X ", "failure in computational subinterval ", "file I/O error, blzpack.__.BQ ", "file I/O error, blzpack.__.BX ", "file I/O error, blzpack.__.Q ", "file I/O error, blzpack.__.X ", "parallel interface error " }; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_BLZPACK" PetscErrorCode EPSSetUp_BLZPACK(EPS eps) { PetscErrorCode ierr; PetscInt listor,lrstor,ncuv,k1,k2,k3,k4; EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscBool issinv; PetscFunctionBegin; if (eps->ncv) { if (eps->ncv < PetscMin(eps->nev+10,eps->nev*2)) SETERRQ(PetscObjectComm((PetscObject)eps),0,"Warning: BLZpack recommends that ncv be larger than min(nev+10,nev*2)"); } else eps->ncv = PetscMin(eps->nev+10,eps->nev*2); if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n); if (!blz->block_size) blz->block_size = 3; if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems"); if (eps->which==EPS_ALL) { if (eps->inta==0.0 && eps->intb==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Must define a computational interval when using EPS_ALL"); blz->slice = 1; } ierr = PetscObjectTypeCompare((PetscObject)eps->st,STSINVERT,&issinv);CHKERRQ(ierr); if (blz->slice || eps->isgeneralized) { if (!issinv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Shift-and-invert ST is needed for generalized problems or spectrum slicing"); } if (blz->slice) { if (eps->intb >= PETSC_MAX_REAL) { /* right-open interval */ if (eps->inta <= PETSC_MIN_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The defined computational interval should have at least one of their sides bounded"); ierr = STSetDefaultShift(eps->st,eps->inta);CHKERRQ(ierr); } else { ierr = STSetDefaultShift(eps->st,eps->intb);CHKERRQ(ierr); } } if (!eps->which) { if (issinv) eps->which = EPS_TARGET_REAL; else eps->which = EPS_SMALLEST_REAL; } if ((issinv && eps->which!=EPS_TARGET_REAL && eps->which!=EPS_TARGET_MAGNITUDE && eps->which!=EPS_ALL) || (!issinv && eps->which!=EPS_SMALLEST_REAL)) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); k1 = PetscMin(eps->n,180); k2 = blz->block_size; k4 = PetscMin(eps->ncv,eps->n); k3 = 484+k1*(13+k1*2+k2+PetscMax(18,k2+2))+k2*k2*3+k4*2; listor = 123+k1*12; ierr = PetscFree(blz->istor);CHKERRQ(ierr); ierr = PetscMalloc((17+listor)*sizeof(PetscBLASInt),&blz->istor);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,(17+listor)*sizeof(PetscBLASInt));CHKERRQ(ierr); ierr = PetscBLASIntCast(listor,&blz->istor[14]);CHKERRQ(ierr); if (blz->slice) lrstor = eps->nloc*(k2*4+k1*2+k4)+k3; else lrstor = eps->nloc*(k2*4+k1)+k3; lrstor*=10; ierr = PetscFree(blz->rstor);CHKERRQ(ierr); ierr = PetscMalloc((4+lrstor)*sizeof(PetscReal),&blz->rstor);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,(4+lrstor)*sizeof(PetscReal));CHKERRQ(ierr); blz->rstor[3] = lrstor; ncuv = PetscMax(3,blz->block_size); ierr = PetscFree(blz->u);CHKERRQ(ierr); ierr = PetscMalloc(ncuv*eps->nloc*sizeof(PetscScalar),&blz->u);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ncuv*eps->nloc*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscFree(blz->v);CHKERRQ(ierr); ierr = PetscMalloc(ncuv*eps->nloc*sizeof(PetscScalar),&blz->v);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ncuv*eps->nloc*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscFree(blz->eig);CHKERRQ(ierr); ierr = PetscMalloc(2*eps->ncv*sizeof(PetscReal),&blz->eig);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,2*eps->ncv*sizeof(PetscReal));CHKERRQ(ierr); if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_BLZPACK; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_BLZPACK" PetscErrorCode EPSSolve_BLZPACK(EPS eps) { PetscErrorCode ierr; EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscInt nn; PetscBLASInt i,nneig,lflag,nvopu; Vec x,y; PetscScalar sigma,*pV; Mat A; KSP ksp; PC pc; PetscFunctionBegin; ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&x);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&y);CHKERRQ(ierr); ierr = VecGetArray(eps->V[0],&pV);CHKERRQ(ierr); if (eps->isgeneralized && !blz->slice) { ierr = STGetShift(eps->st,&sigma);CHKERRQ(ierr); /* shift of origin */ blz->rstor[0] = sigma; /* lower limit of eigenvalue interval */ blz->rstor[1] = sigma; /* upper limit of eigenvalue interval */ } else { sigma = 0.0; blz->rstor[0] = eps->inta; /* lower limit of eigenvalue interval */ blz->rstor[1] = eps->intb; /* upper limit of eigenvalue interval */ } nneig = 0; /* no. of eigs less than sigma */ ierr = PetscBLASIntCast(eps->nloc,&blz->istor[0]);CHKERRQ(ierr); /* no. of rows of U, V, X */ ierr = PetscBLASIntCast(eps->nloc,&blz->istor[1]);CHKERRQ(ierr); /* leading dim of U, V, X */ ierr = PetscBLASIntCast(eps->nev,&blz->istor[2]);CHKERRQ(ierr); /* required eigenpairs */ ierr = PetscBLASIntCast(eps->ncv,&blz->istor[3]);CHKERRQ(ierr); /* working eigenpairs */ blz->istor[4] = blz->block_size; /* number of vectors in a block */ blz->istor[5] = blz->nsteps; /* maximun number of steps per run */ blz->istor[6] = 1; /* number of starting vectors as input */ blz->istor[7] = 0; /* number of eigenpairs given as input */ blz->istor[8] = (blz->slice || eps->isgeneralized) ? 1 : 0; /* problem type */ blz->istor[9] = blz->slice; /* spectrum slicing */ blz->istor[10] = eps->isgeneralized ? 1 : 0; /* solutions refinement (purify) */ blz->istor[11] = 0; /* level of printing */ blz->istor[12] = 6; /* file unit for output */ ierr = PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&blz->istor[13]);CHKERRQ(ierr); blz->rstor[2] = eps->tol; /* threshold for convergence */ lflag = 0; /* reverse communication interface flag */ do { BLZpack_(blz->istor,blz->rstor,&sigma,&nneig,blz->u,blz->v,&lflag,&nvopu,blz->eig,pV); switch (lflag) { case 1: /* compute v = OP u */ for (i=0;iu+i*eps->nloc);CHKERRQ(ierr); ierr = VecPlaceArray(y,blz->v+i*eps->nloc);CHKERRQ(ierr); if (blz->slice || eps->isgeneralized) { ierr = STMatSolve(eps->st,1,x,y);CHKERRQ(ierr); } else { ierr = STApply(eps->st,x,y);CHKERRQ(ierr); } ierr = IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,y,NULL,NULL,NULL);CHKERRQ(ierr); ierr = VecResetArray(x);CHKERRQ(ierr); ierr = VecResetArray(y);CHKERRQ(ierr); } /* monitor */ eps->nconv = BLZistorr_(blz->istor,"NTEIG",5); ierr = EPSMonitor(eps,eps->its,eps->nconv, blz->rstor+BLZistorr_(blz->istor,"IRITZ",5), eps->eigi, blz->rstor+BLZistorr_(blz->istor,"IRITZ",5)+BLZistorr_(blz->istor,"JT",2), BLZistorr_(blz->istor,"NRITZ",5));CHKERRQ(ierr); eps->its = eps->its + 1; if (eps->its >= eps->max_it || eps->nconv >= eps->nev) lflag = 5; break; case 2: /* compute v = B u */ for (i=0;iu+i*eps->nloc);CHKERRQ(ierr); ierr = VecPlaceArray(y,blz->v+i*eps->nloc);CHKERRQ(ierr); ierr = IPApplyMatrix(eps->ip,x,y);CHKERRQ(ierr); ierr = VecResetArray(x);CHKERRQ(ierr); ierr = VecResetArray(y);CHKERRQ(ierr); } break; case 3: /* update shift */ ierr = PetscInfo1(eps,"Factorization update (sigma=%g)\n",sigma);CHKERRQ(ierr); ierr = STSetShift(eps->st,sigma);CHKERRQ(ierr); ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = PCFactorGetMatrix(pc,&A);CHKERRQ(ierr); ierr = MatGetInertia(A,&nn,NULL,NULL);CHKERRQ(ierr); ierr = PetscBLASIntCast(nn,&nneig);CHKERRQ(ierr); break; case 4: /* copy the initial vector */ ierr = VecPlaceArray(x,blz->v);CHKERRQ(ierr); ierr = EPSGetStartVector(eps,0,x,NULL);CHKERRQ(ierr); ierr = VecResetArray(x);CHKERRQ(ierr); break; } } while (lflag > 0); ierr = VecRestoreArray(eps->V[0],&pV);CHKERRQ(ierr); eps->nconv = BLZistorr_(blz->istor,"NTEIG",5); eps->reason = EPS_CONVERGED_TOL; for (i=0;inconv;i++) { eps->eigr[i]=blz->eig[i]; } if (lflag!=0) { char msg[2048] = ""; for (i = 0; i < 33; i++) { if (blz->istor[15] & (1 << i)) PetscStrcat(msg,blzpack_error[i]); } SETERRQ2(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error in BLZPACK (code=%d): '%s'",blz->istor[15],msg); } ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBackTransform_BLZPACK" PetscErrorCode EPSBackTransform_BLZPACK(EPS eps) { PetscErrorCode ierr; EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscFunctionBegin; if (!blz->slice && !eps->isgeneralized) { ierr = EPSBackTransform_Default(eps);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_BLZPACK" PetscErrorCode EPSReset_BLZPACK(EPS eps) { PetscErrorCode ierr; EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscFunctionBegin; ierr = PetscFree(blz->istor);CHKERRQ(ierr); ierr = PetscFree(blz->rstor);CHKERRQ(ierr); ierr = PetscFree(blz->u);CHKERRQ(ierr); ierr = PetscFree(blz->v);CHKERRQ(ierr); ierr = PetscFree(blz->eig);CHKERRQ(ierr); ierr = EPSFreeSolution(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_BLZPACK" PetscErrorCode EPSDestroy_BLZPACK(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetNSteps_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_BLZPACK" PetscErrorCode EPSView_BLZPACK(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscBool isascii; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," BLZPACK: block size=%d\n",blz->block_size);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," BLZPACK: maximum number of steps per run=%d\n",blz->nsteps);CHKERRQ(ierr); if (blz->slice) { ierr = PetscViewerASCIIPrintf(viewer," BLZPACK: computational interval [%f,%f]\n",eps->inta,eps->intb);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_BLZPACK" PetscErrorCode EPSSetFromOptions_BLZPACK(EPS eps) { PetscErrorCode ierr; EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscInt bs,n; PetscBool flg; PetscFunctionBegin; ierr = PetscOptionsHead("EPS BLZPACK Options");CHKERRQ(ierr); bs = blz->block_size; ierr = PetscOptionsInt("-eps_blzpack_block_size","Block size","EPSBlzpackSetBlockSize",bs,&bs,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSBlzpackSetBlockSize(eps,bs);CHKERRQ(ierr); } n = blz->nsteps; ierr = PetscOptionsInt("-eps_blzpack_nsteps","Number of steps","EPSBlzpackSetNSteps",n,&n,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSBlzpackSetNSteps(eps,n);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBlzpackSetBlockSize_BLZPACK" static PetscErrorCode EPSBlzpackSetBlockSize_BLZPACK(EPS eps,PetscInt bs) { EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data;; PetscFunctionBegin; if (bs == PETSC_DEFAULT) blz->block_size = 3; else if (bs <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Block size must be positive"); else { ierr = PetscBLASIntCast(bs,&blz->block_size);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBlzpackSetBlockSize" /*@ EPSBlzpackSetBlockSize - Sets the block size for the BLZPACK package. Collective on EPS Input Parameters: + eps - the eigenproblem solver context - bs - block size Options Database Key: . -eps_blzpack_block_size - Sets the value of the block size Level: advanced @*/ PetscErrorCode EPSBlzpackSetBlockSize(EPS eps,PetscInt bs) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,bs,2); ierr = PetscTryMethod(eps,"EPSBlzpackSetBlockSize_C",(EPS,PetscInt),(eps,bs));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBlzpackSetNSteps_BLZPACK" static PetscErrorCode EPSBlzpackSetNSteps_BLZPACK(EPS eps,PetscInt nsteps) { EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data; PetscFunctionBegin; if (nsteps == PETSC_DEFAULT) blz->nsteps = 0; else { ierr = PetscBLASIntCast(nsteps,&blz->nsteps);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBlzpackSetNSteps" /*@ EPSBlzpackSetNSteps - Sets the maximum number of steps per run for the BLZPACK package. Collective on EPS Input Parameters: + eps - the eigenproblem solver context - nsteps - maximum number of steps Options Database Key: . -eps_blzpack_nsteps - Sets the maximum number of steps per run Level: advanced @*/ PetscErrorCode EPSBlzpackSetNSteps(EPS eps,PetscInt nsteps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,nsteps,2); ierr = PetscTryMethod(eps,"EPSBlzpackSetNSteps_C",(EPS,PetscInt),(eps,nsteps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_BLZPACK" PETSC_EXTERN PetscErrorCode EPSCreate_BLZPACK(EPS eps) { PetscErrorCode ierr; EPS_BLZPACK *blzpack; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_BLZPACK,&blzpack);CHKERRQ(ierr); eps->data = (void*)blzpack; eps->ops->setup = EPSSetUp_BLZPACK; eps->ops->setfromoptions = EPSSetFromOptions_BLZPACK; eps->ops->destroy = EPSDestroy_BLZPACK; eps->ops->reset = EPSReset_BLZPACK; eps->ops->view = EPSView_BLZPACK; eps->ops->backtransform = EPSBackTransform_BLZPACK; eps->ops->computevectors = EPSComputeVectors_Default; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetBlockSize_C",EPSBlzpackSetBlockSize_BLZPACK);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetNSteps_C",EPSBlzpackSetNSteps_BLZPACK);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/blzpack.c.html0000644000175000017500000010542712211062077024153 0ustar gladkgladk
Actual source code: blzpack.c

  1: /*
  2:    This file implements a wrapper to the BLZPACK package

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>    /*I "slepceps.h" I*/
 25: #include <slepc-private/stimpl.h>     /*I "slepcst.h" I*/
 26: #include <../src/eps/impls/external/blzpack/blzpackp.h>

 28: PetscErrorCode EPSSolve_BLZPACK(EPS);

 30: const char* blzpack_error[33] = {
 31:   "",
 32:   "illegal data, LFLAG ",
 33:   "illegal data, dimension of (U), (V), (X) ",
 34:   "illegal data, leading dimension of (U), (V), (X) ",
 35:   "illegal data, leading dimension of (EIG) ",
 36:   "illegal data, number of required eigenpairs ",
 37:   "illegal data, Lanczos algorithm block size ",
 38:   "illegal data, maximum number of steps ",
 39:   "illegal data, number of starting vectors ",
 40:   "illegal data, number of eigenpairs provided ",
 41:   "illegal data, problem type flag ",
 42:   "illegal data, spectrum slicing flag ",
 43:   "illegal data, eigenvectors purification flag ",
 44:   "illegal data, level of output ",
 45:   "illegal data, output file unit ",
 46:   "illegal data, LCOMM (MPI or PVM) ",
 47:   "illegal data, dimension of ISTOR ",
 48:   "illegal data, convergence threshold ",
 49:   "illegal data, dimension of RSTOR ",
 50:   "illegal data on at least one PE ",
 51:   "ISTOR(3:14) must be equal on all PEs ",
 52:   "RSTOR(1:3) must be equal on all PEs ",
 53:   "not enough space in ISTOR to start eigensolution ",
 54:   "not enough space in RSTOR to start eigensolution ",
 55:   "illegal data, number of negative eigenvalues ",
 56:   "illegal data, entries of V ",
 57:   "illegal data, entries of X ",
 58:   "failure in computational subinterval ",
 59:   "file I/O error, blzpack.__.BQ ",
 60:   "file I/O error, blzpack.__.BX ",
 61:   "file I/O error, blzpack.__.Q ",
 62:   "file I/O error, blzpack.__.X ",
 63:   "parallel interface error "
 64: };

 68: PetscErrorCode EPSSetUp_BLZPACK(EPS eps)
 69: {
 71:   PetscInt       listor,lrstor,ncuv,k1,k2,k3,k4;
 72:   EPS_BLZPACK    *blz = (EPS_BLZPACK*)eps->data;
 73:   PetscBool      issinv;

 76:   if (eps->ncv) {
 77:     if (eps->ncv < PetscMin(eps->nev+10,eps->nev*2)) SETERRQ(PetscObjectComm((PetscObject)eps),0,"Warning: BLZpack recommends that ncv be larger than min(nev+10,nev*2)");
 78:   } else eps->ncv = PetscMin(eps->nev+10,eps->nev*2);
 79:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
 80:   if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n);

 82:   if (!blz->block_size) blz->block_size = 3;
 83:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems");
 84:   if (eps->which==EPS_ALL) {
 85:     if (eps->inta==0.0 && eps->intb==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Must define a computational interval when using EPS_ALL");
 86:     blz->slice = 1;
 87:   }
 88:   PetscObjectTypeCompare((PetscObject)eps->st,STSINVERT,&issinv);
 89:   if (blz->slice || eps->isgeneralized) {
 90:     if (!issinv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Shift-and-invert ST is needed for generalized problems or spectrum slicing");
 91:   }
 92:   if (blz->slice) {
 93:     if (eps->intb >= PETSC_MAX_REAL) { /* right-open interval */
 94:       if (eps->inta <= PETSC_MIN_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The defined computational interval should have at least one of their sides bounded");
 95:       STSetDefaultShift(eps->st,eps->inta);
 96:     } else {
 97:       STSetDefaultShift(eps->st,eps->intb);
 98:     }
 99:   }
100:   if (!eps->which) {
101:     if (issinv) eps->which = EPS_TARGET_REAL;
102:     else eps->which = EPS_SMALLEST_REAL;
103:   }
104:   if ((issinv && eps->which!=EPS_TARGET_REAL && eps->which!=EPS_TARGET_MAGNITUDE && eps->which!=EPS_ALL) || (!issinv && eps->which!=EPS_SMALLEST_REAL)) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
105:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

107:   k1 = PetscMin(eps->n,180);
108:   k2 = blz->block_size;
109:   k4 = PetscMin(eps->ncv,eps->n);
110:   k3 = 484+k1*(13+k1*2+k2+PetscMax(18,k2+2))+k2*k2*3+k4*2;

112:   listor = 123+k1*12;
113:   PetscFree(blz->istor);
114:   PetscMalloc((17+listor)*sizeof(PetscBLASInt),&blz->istor);
115:   PetscLogObjectMemory(eps,(17+listor)*sizeof(PetscBLASInt));
116:   PetscBLASIntCast(listor,&blz->istor[14]);

118:   if (blz->slice) lrstor = eps->nloc*(k2*4+k1*2+k4)+k3;
119:   else lrstor = eps->nloc*(k2*4+k1)+k3;
120: lrstor*=10;
121:   PetscFree(blz->rstor);
122:   PetscMalloc((4+lrstor)*sizeof(PetscReal),&blz->rstor);
123:   PetscLogObjectMemory(eps,(4+lrstor)*sizeof(PetscReal));
124:   blz->rstor[3] = lrstor;

126:   ncuv = PetscMax(3,blz->block_size);
127:   PetscFree(blz->u);
128:   PetscMalloc(ncuv*eps->nloc*sizeof(PetscScalar),&blz->u);
129:   PetscLogObjectMemory(eps,ncuv*eps->nloc*sizeof(PetscScalar));
130:   PetscFree(blz->v);
131:   PetscMalloc(ncuv*eps->nloc*sizeof(PetscScalar),&blz->v);
132:   PetscLogObjectMemory(eps,ncuv*eps->nloc*sizeof(PetscScalar));

134:   PetscFree(blz->eig);
135:   PetscMalloc(2*eps->ncv*sizeof(PetscReal),&blz->eig);
136:   PetscLogObjectMemory(eps,2*eps->ncv*sizeof(PetscReal));

138:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

140:   EPSAllocateSolution(eps);

142:   /* dispatch solve method */
143:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
144:   eps->ops->solve = EPSSolve_BLZPACK;
145:   return(0);
146: }

150: PetscErrorCode EPSSolve_BLZPACK(EPS eps)
151: {
153:   EPS_BLZPACK    *blz = (EPS_BLZPACK*)eps->data;
154:   PetscInt       nn;
155:   PetscBLASInt   i,nneig,lflag,nvopu;
156:   Vec            x,y;
157:   PetscScalar    sigma,*pV;
158:   Mat            A;
159:   KSP            ksp;
160:   PC             pc;

163:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&x);
164:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&y);
165:   VecGetArray(eps->V[0],&pV);

167:   if (eps->isgeneralized && !blz->slice) {
168:     STGetShift(eps->st,&sigma); /* shift of origin */
169:     blz->rstor[0]  = sigma;        /* lower limit of eigenvalue interval */
170:     blz->rstor[1]  = sigma;        /* upper limit of eigenvalue interval */
171:   } else {
172:     sigma = 0.0;
173:     blz->rstor[0]  = eps->inta;    /* lower limit of eigenvalue interval */
174:     blz->rstor[1]  = eps->intb;    /* upper limit of eigenvalue interval */
175:   }
176:   nneig = 0;                       /* no. of eigs less than sigma */

178:   PetscBLASIntCast(eps->nloc,&blz->istor[0]); /* no. of rows of U, V, X */
179:   PetscBLASIntCast(eps->nloc,&blz->istor[1]); /* leading dim of U, V, X */
180:   PetscBLASIntCast(eps->nev,&blz->istor[2]);  /* required eigenpairs */
181:   PetscBLASIntCast(eps->ncv,&blz->istor[3]);  /* working eigenpairs */
182:   blz->istor[4]  = blz->block_size;    /* number of vectors in a block */
183:   blz->istor[5]  = blz->nsteps;        /* maximun number of steps per run */
184:   blz->istor[6]  = 1;                  /* number of starting vectors as input */
185:   blz->istor[7]  = 0;                  /* number of eigenpairs given as input */
186:   blz->istor[8]  = (blz->slice || eps->isgeneralized) ? 1 : 0;   /* problem type */
187:   blz->istor[9]  = blz->slice;         /* spectrum slicing */
188:   blz->istor[10] = eps->isgeneralized ? 1 : 0;   /* solutions refinement (purify) */
189:   blz->istor[11] = 0;                  /* level of printing */
190:   blz->istor[12] = 6;                  /* file unit for output */
191:   PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&blz->istor[13]);

193:   blz->rstor[2]  = eps->tol;           /* threshold for convergence */

195:   lflag = 0;           /* reverse communication interface flag */

197:   do {
198:     BLZpack_(blz->istor,blz->rstor,&sigma,&nneig,blz->u,blz->v,&lflag,&nvopu,blz->eig,pV);

200:     switch (lflag) {
201:     case 1:
202:       /* compute v = OP u */
203:       for (i=0;i<nvopu;i++) {
204:         VecPlaceArray(x,blz->u+i*eps->nloc);
205:         VecPlaceArray(y,blz->v+i*eps->nloc);
206:         if (blz->slice || eps->isgeneralized) {
207:           STMatSolve(eps->st,1,x,y);
208:         } else {
209:           STApply(eps->st,x,y);
210:         }
211:         IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,y,NULL,NULL,NULL);
212:         VecResetArray(x);
213:         VecResetArray(y);
214:       }
215:       /* monitor */
216:       eps->nconv  = BLZistorr_(blz->istor,"NTEIG",5);
217:       EPSMonitor(eps,eps->its,eps->nconv,
218:         blz->rstor+BLZistorr_(blz->istor,"IRITZ",5),
219:         eps->eigi,
220:         blz->rstor+BLZistorr_(blz->istor,"IRITZ",5)+BLZistorr_(blz->istor,"JT",2),
221:         BLZistorr_(blz->istor,"NRITZ",5));
222:       eps->its = eps->its + 1;
223:       if (eps->its >= eps->max_it || eps->nconv >= eps->nev) lflag = 5;
224:       break;
225:     case 2:
226:       /* compute v = B u */
227:       for (i=0;i<nvopu;i++) {
228:         VecPlaceArray(x,blz->u+i*eps->nloc);
229:         VecPlaceArray(y,blz->v+i*eps->nloc);
230:         IPApplyMatrix(eps->ip,x,y);
231:         VecResetArray(x);
232:         VecResetArray(y);
233:       }
234:       break;
235:     case 3:
236:       /* update shift */
237:       PetscInfo1(eps,"Factorization update (sigma=%g)\n",sigma);
238:       STSetShift(eps->st,sigma);
239:       STGetKSP(eps->st,&ksp);
240:       KSPGetPC(ksp,&pc);
241:       PCFactorGetMatrix(pc,&A);
242:       MatGetInertia(A,&nn,NULL,NULL);
243:       PetscBLASIntCast(nn,&nneig);
244:       break;
245:     case 4:
246:       /* copy the initial vector */
247:       VecPlaceArray(x,blz->v);
248:       EPSGetStartVector(eps,0,x,NULL);
249:       VecResetArray(x);
250:       break;
251:     }

253:   } while (lflag > 0);

255:   VecRestoreArray(eps->V[0],&pV);

257:   eps->nconv  = BLZistorr_(blz->istor,"NTEIG",5);
258:   eps->reason = EPS_CONVERGED_TOL;

260:   for (i=0;i<eps->nconv;i++) {
261:     eps->eigr[i]=blz->eig[i];
262:   }

264:   if (lflag!=0) {
265:     char msg[2048] = "";
266:     for (i = 0; i < 33; i++) {
267:       if (blz->istor[15] & (1 << i)) PetscStrcat(msg,blzpack_error[i]);
268:     }
269:     SETERRQ2(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error in BLZPACK (code=%d): '%s'",blz->istor[15],msg);
270:   }
271:   VecDestroy(&x);
272:   VecDestroy(&y);
273:   return(0);
274: }

278: PetscErrorCode EPSBackTransform_BLZPACK(EPS eps)
279: {
281:   EPS_BLZPACK    *blz = (EPS_BLZPACK*)eps->data;

284:   if (!blz->slice && !eps->isgeneralized) {
285:     EPSBackTransform_Default(eps);
286:   }
287:   return(0);
288: }

292: PetscErrorCode EPSReset_BLZPACK(EPS eps)
293: {
295:   EPS_BLZPACK    *blz = (EPS_BLZPACK*)eps->data;

298:   PetscFree(blz->istor);
299:   PetscFree(blz->rstor);
300:   PetscFree(blz->u);
301:   PetscFree(blz->v);
302:   PetscFree(blz->eig);
303:   EPSFreeSolution(eps);
304:   return(0);
305: }

309: PetscErrorCode EPSDestroy_BLZPACK(EPS eps)
310: {

314:   PetscFree(eps->data);
315:   PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetBlockSize_C",NULL);
316:   PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetNSteps_C",NULL);
317:   return(0);
318: }

322: PetscErrorCode EPSView_BLZPACK(EPS eps,PetscViewer viewer)
323: {
325:   EPS_BLZPACK    *blz = (EPS_BLZPACK*)eps->data;
326:   PetscBool      isascii;

329:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
330:   if (isascii) {
331:     PetscViewerASCIIPrintf(viewer,"  BLZPACK: block size=%d\n",blz->block_size);
332:     PetscViewerASCIIPrintf(viewer,"  BLZPACK: maximum number of steps per run=%d\n",blz->nsteps);
333:     if (blz->slice) {
334:       PetscViewerASCIIPrintf(viewer,"  BLZPACK: computational interval [%f,%f]\n",eps->inta,eps->intb);
335:     }
336:   }
337:   return(0);
338: }

342: PetscErrorCode EPSSetFromOptions_BLZPACK(EPS eps)
343: {
345:   EPS_BLZPACK    *blz = (EPS_BLZPACK*)eps->data;
346:   PetscInt       bs,n;
347:   PetscBool      flg;

350:   PetscOptionsHead("EPS BLZPACK Options");

352:   bs = blz->block_size;
353:   PetscOptionsInt("-eps_blzpack_block_size","Block size","EPSBlzpackSetBlockSize",bs,&bs,&flg);
354:   if (flg) {
355:     EPSBlzpackSetBlockSize(eps,bs);
356:   }

358:   n = blz->nsteps;
359:   PetscOptionsInt("-eps_blzpack_nsteps","Number of steps","EPSBlzpackSetNSteps",n,&n,&flg);
360:   if (flg) {
361:     EPSBlzpackSetNSteps(eps,n);
362:   }

364:   PetscOptionsTail();
365:   return(0);
366: }

370: static PetscErrorCode EPSBlzpackSetBlockSize_BLZPACK(EPS eps,PetscInt bs)
371: {
372:   EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data;;

375:   if (bs == PETSC_DEFAULT) blz->block_size = 3;
376:   else if (bs <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Block size must be positive");
377:   else {
378:     PetscBLASIntCast(bs,&blz->block_size);
379:   }
380:   return(0);
381: }

385: /*@
386:    EPSBlzpackSetBlockSize - Sets the block size for the BLZPACK package.

388:    Collective on EPS

390:    Input Parameters:
391: +  eps - the eigenproblem solver context
392: -  bs - block size

394:    Options Database Key:
395: .  -eps_blzpack_block_size - Sets the value of the block size

397:    Level: advanced
398: @*/
399: PetscErrorCode EPSBlzpackSetBlockSize(EPS eps,PetscInt bs)
400: {

406:   PetscTryMethod(eps,"EPSBlzpackSetBlockSize_C",(EPS,PetscInt),(eps,bs));
407:   return(0);
408: }

412: static PetscErrorCode EPSBlzpackSetNSteps_BLZPACK(EPS eps,PetscInt nsteps)
413: {
414:   EPS_BLZPACK *blz = (EPS_BLZPACK*)eps->data;

417:   if (nsteps == PETSC_DEFAULT) blz->nsteps = 0;
418:   else {
419:     PetscBLASIntCast(nsteps,&blz->nsteps);
420:   }
421:   return(0);
422: }

426: /*@
427:    EPSBlzpackSetNSteps - Sets the maximum number of steps per run for the BLZPACK
428:    package.

430:    Collective on EPS

432:    Input Parameters:
433: +  eps     - the eigenproblem solver context
434: -  nsteps  - maximum number of steps

436:    Options Database Key:
437: .  -eps_blzpack_nsteps - Sets the maximum number of steps per run

439:    Level: advanced

441: @*/
442: PetscErrorCode EPSBlzpackSetNSteps(EPS eps,PetscInt nsteps)
443: {

449:   PetscTryMethod(eps,"EPSBlzpackSetNSteps_C",(EPS,PetscInt),(eps,nsteps));
450:   return(0);
451: }

455: PETSC_EXTERN PetscErrorCode EPSCreate_BLZPACK(EPS eps)
456: {
458:   EPS_BLZPACK    *blzpack;

461:   PetscNewLog(eps,EPS_BLZPACK,&blzpack);
462:   eps->data                      = (void*)blzpack;
463:   eps->ops->setup                = EPSSetUp_BLZPACK;
464:   eps->ops->setfromoptions       = EPSSetFromOptions_BLZPACK;
465:   eps->ops->destroy              = EPSDestroy_BLZPACK;
466:   eps->ops->reset                = EPSReset_BLZPACK;
467:   eps->ops->view                 = EPSView_BLZPACK;
468:   eps->ops->backtransform        = EPSBackTransform_BLZPACK;
469:   eps->ops->computevectors       = EPSComputeVectors_Default;
470:   PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetBlockSize_C",EPSBlzpackSetBlockSize_BLZPACK);
471:   PetscObjectComposeFunction((PetscObject)eps,"EPSBlzpackSetNSteps_C",EPSBlzpackSetNSteps_BLZPACK);
472:   return(0);
473: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/makefile0000644000175000017500000000226512211062077023112 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresdefine 'SLEPC_HAVE_BLZPACK' #requiresscalar real CFLAGS = FFLAGS = SOURCEC = blzpack.c SOURCEF = SOURCEH = blzpackp.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/external/blzpack/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/makefile.html0000644000175000017500000000415312211062077024053 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresdefine  'SLEPC_HAVE_BLZPACK'
#requiresscalar   real

CFLAGS   =
FFLAGS   =
SOURCEC  = blzpack.c
SOURCEF  =
SOURCEH  = blzpackp.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/external/blzpack/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/index.html0000644000175000017500000000220712211062077023403 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

blzpackp.h
blzpack.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/ftn-auto/0000755000175000017500000000000012214143515023142 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/ftn-auto/blzpackf.c0000644000175000017500000000264012211062077025104 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* blzpack.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsblzpacksetblocksize_ EPSBLZPACKSETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsblzpacksetblocksize_ epsblzpacksetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsblzpacksetnsteps_ EPSBLZPACKSETNSTEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsblzpacksetnsteps_ epsblzpacksetnsteps #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsblzpacksetblocksize_(EPS *eps,PetscInt *bs, int *__ierr ){ *__ierr = EPSBlzpackSetBlockSize(*eps,*bs); } void PETSC_STDCALL epsblzpacksetnsteps_(EPS *eps,PetscInt *nsteps, int *__ierr ){ *__ierr = EPSBlzpackSetNSteps(*eps,*nsteps); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/blzpack/ftn-auto/makefile0000644000175000017500000000035712211062077024647 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = blzpackf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/external/blzpack/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/0000755000175000017500000000000012211062077021077 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/trlanp.h0000644000175000017500000000324612211062077022555 0ustar gladkgladk/* Private data structure used by the TRLAN interface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__TRLANP_H) #define __TRLANP_H typedef struct { PetscBLASInt maxlan; PetscBLASInt restart; PetscReal *work; PetscBLASInt lwork; } EPS_TRLAN; /* Definition of routines from the TRLAN package These are real case. TRLAN currently only has DOUBLE PRECISION version */ #if defined(SLEPC_TRLAN_HAVE_UNDERSCORE) #define TRLan_ trlan77_ #elif defined(SLEPC_TRLAN_HAVE_CAPS) #define TRLan_ TRLAN77 #else #define TRLan_ trlan77 #endif PETSC_EXTERN void TRLan_(PetscBLASInt(*op)(PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*),PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/trlan.c.html0000644000175000017500000003307212211062077023333 0ustar gladkgladk

Actual source code: trlan.c

  1: /*
  2:    This file implements a wrapper to the TRLAN package

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>          /*I "slepceps.h" I*/
 25: #include <../src/eps/impls/external/trlan/trlanp.h>

 27: PetscErrorCode EPSSolve_TRLAN(EPS);

 29: /* Nasty global variable to access EPS data from TRLan_ */
 30: static EPS globaleps;

 34: PetscErrorCode EPSSetUp_TRLAN(EPS eps)
 35: {
 37:   EPS_TRLAN      *tr = (EPS_TRLAN*)eps->data;

 40:   PetscBLASIntCast(PetscMax(7,eps->nev+PetscMin(eps->nev,6)),&tr->maxlan);
 41:   if (eps->ncv) {
 42:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev");
 43:   } else eps->ncv = tr->maxlan;
 44:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
 45:   if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n);

 47:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems");

 49:   if (eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is not available for generalized problems");

 51:   if (!eps->which) eps->which = EPS_LARGEST_REAL;
 52:   if (eps->which!=EPS_LARGEST_REAL && eps->which!=EPS_SMALLEST_REAL && eps->which!=EPS_TARGET_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
 53:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

 55:   tr->restart = 0;
 56:   if (tr->maxlan+1-eps->ncv<=0) {
 57:     PetscBLASIntCast(tr->maxlan*(tr->maxlan+10),&tr->lwork);
 58:   } else {
 59:     PetscBLASIntCast(eps->nloc*(tr->maxlan+1-eps->ncv) + tr->maxlan*(tr->maxlan+10),&tr->lwork);
 60:   }
 61:   PetscMalloc(tr->lwork*sizeof(PetscReal),&tr->work);
 62:   PetscLogObjectMemory(eps,tr->lwork*sizeof(PetscReal));

 64:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

 66:   EPSAllocateSolution(eps);

 68:   /* dispatch solve method */
 69:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
 70:   eps->ops->solve = EPSSolve_TRLAN;
 71:   return(0);
 72: }

 76: static PetscBLASInt MatMult_TRLAN(PetscBLASInt *n,PetscBLASInt *m,PetscReal *xin,PetscBLASInt *ldx,PetscReal *yout,PetscBLASInt *ldy)
 77: {
 79:   Vec            x,y;
 80:   PetscBLASInt   i;

 83:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)globaleps),1,*n,PETSC_DECIDE,NULL,&x);
 84:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)globaleps),1,*n,PETSC_DECIDE,NULL,&y);
 85:   for (i=0;i<*m;i++) {
 86:     VecPlaceArray(x,(PetscScalar*)xin+i*(*ldx));
 87:     VecPlaceArray(y,(PetscScalar*)yout+i*(*ldy));
 88:     STApply(globaleps->st,x,y);
 89:     IPOrthogonalize(globaleps->ip,0,NULL,globaleps->nds,NULL,globaleps->defl,y,NULL,NULL,NULL);
 90:     VecResetArray(x);
 91:     VecResetArray(y);
 92:   }
 93:   VecDestroy(&x);
 94:   VecDestroy(&y);
 95:   return(0);
 96: }

100: PetscErrorCode EPSSolve_TRLAN(EPS eps)
101: {
103:   PetscInt       i;
104:   PetscBLASInt   ipar[32],n,lohi,stat,ncv;
105:   EPS_TRLAN      *tr = (EPS_TRLAN*)eps->data;
106:   PetscScalar    *pV;

109:   PetscBLASIntCast(eps->ncv,&ncv);
110:   PetscBLASIntCast(eps->nloc,&n);

112:   if (eps->which==EPS_LARGEST_REAL || eps->which==EPS_TARGET_REAL) lohi = 1;
113:   else if (eps->which==EPS_SMALLEST_REAL) lohi = -1;
114:   else SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");

116:   globaleps = eps;

118:   ipar[0]  = 0;            /* stat: error flag */
119:   ipar[1]  = lohi;         /* smallest (lohi<0) or largest eigenvalues (lohi>0) */
120:   PetscBLASIntCast(eps->nev,&ipar[2]); /* number of desired eigenpairs */
121:   ipar[3]  = 0;            /* number of eigenpairs already converged */
122:   ipar[4]  = tr->maxlan;   /* maximum Lanczos basis size */
123:   ipar[5]  = tr->restart;  /* restarting scheme */
124:   PetscBLASIntCast(eps->max_it,&ipar[6]); /* maximum number of MATVECs */
125:   PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&ipar[7]);
126:   ipar[8]  = 0;            /* verboseness */
127:   ipar[9]  = 99;           /* Fortran IO unit number used to write log messages */
128:   ipar[10] = 1;            /* use supplied starting vector */
129:   ipar[11] = 0;            /* checkpointing flag */
130:   ipar[12] = 98;           /* Fortran IO unit number used to write checkpoint files */
131:   ipar[13] = 0;            /* number of flops per matvec per PE (not used) */
132:   tr->work[0] = eps->tol;  /* relative tolerance on residual norms */

134:   for (i=0;i<eps->ncv;i++) eps->eigr[i]=0.0;
135:   EPSGetStartVector(eps,0,eps->V[0],NULL);
136:   VecGetArray(eps->V[0],&pV);

138:   PetscStackCall("TRLan",TRLan_(MatMult_TRLAN,ipar,&n,&ncv,eps->eigr,pV,&n,tr->work,&tr->lwork));

140:   VecRestoreArray(eps->V[0],&pV);

142:   stat        = ipar[0];
143:   eps->nconv  = ipar[3];
144:   eps->its    = ipar[25];
145:   eps->reason = EPS_CONVERGED_TOL;

147:   if (stat!=0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error in TRLAN (code=%d)",stat);
148:   return(0);
149: }

153: PetscErrorCode EPSReset_TRLAN(EPS eps)
154: {
156:   EPS_TRLAN      *tr = (EPS_TRLAN*)eps->data;

159:   PetscFree(tr->work);
160:   EPSFreeSolution(eps);
161:   return(0);
162: }

166: PetscErrorCode EPSDestroy_TRLAN(EPS eps)
167: {

171:   PetscFree(eps->data);
172:   return(0);
173: }

177: PETSC_EXTERN PetscErrorCode EPSCreate_TRLAN(EPS eps)
178: {

182:   PetscNewLog(eps,EPS_TRLAN,&eps->data);
183:   eps->ops->setup                = EPSSetUp_TRLAN;
184:   eps->ops->destroy              = EPSDestroy_TRLAN;
185:   eps->ops->reset                = EPSReset_TRLAN;
186:   eps->ops->backtransform        = EPSBackTransform_Default;
187:   eps->ops->computevectors       = EPSComputeVectors_Default;
188:   return(0);
189: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/makefile0000644000175000017500000000225712211062077022605 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresdefine 'SLEPC_HAVE_TRLAN' #requiresscalar real CFLAGS = FFLAGS = SOURCEC = trlan.c SOURCEF = SOURCEH = trlanp.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/external/trlan/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/makefile.html0000644000175000017500000000414512211062077023546 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresdefine   'SLEPC_HAVE_TRLAN'
#requiresscalar    real

CFLAGS   =
FFLAGS   =
SOURCEC  = trlan.c
SOURCEF  =
SOURCEH  = trlanp.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/external/trlan/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/index.html0000644000175000017500000000217712211062077023103 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

trlanp.h
trlan.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/trlan.c0000644000175000017500000001665612211062077022401 0ustar gladkgladk/* This file implements a wrapper to the TRLAN package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include <../src/eps/impls/external/trlan/trlanp.h> PetscErrorCode EPSSolve_TRLAN(EPS); /* Nasty global variable to access EPS data from TRLan_ */ static EPS globaleps; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_TRLAN" PetscErrorCode EPSSetUp_TRLAN(EPS eps) { PetscErrorCode ierr; EPS_TRLAN *tr = (EPS_TRLAN*)eps->data; PetscFunctionBegin; ierr = PetscBLASIntCast(PetscMax(7,eps->nev+PetscMin(eps->nev,6)),&tr->maxlan);CHKERRQ(ierr); if (eps->ncv) { if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev"); } else eps->ncv = tr->maxlan; if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n); if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems"); if (eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requested method is not available for generalized problems"); if (!eps->which) eps->which = EPS_LARGEST_REAL; if (eps->which!=EPS_LARGEST_REAL && eps->which!=EPS_SMALLEST_REAL && eps->which!=EPS_TARGET_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); tr->restart = 0; if (tr->maxlan+1-eps->ncv<=0) { ierr = PetscBLASIntCast(tr->maxlan*(tr->maxlan+10),&tr->lwork);CHKERRQ(ierr); } else { ierr = PetscBLASIntCast(eps->nloc*(tr->maxlan+1-eps->ncv) + tr->maxlan*(tr->maxlan+10),&tr->lwork);CHKERRQ(ierr); } ierr = PetscMalloc(tr->lwork*sizeof(PetscReal),&tr->work);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,tr->lwork*sizeof(PetscReal));CHKERRQ(ierr); if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_TRLAN; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_TRLAN" static PetscBLASInt MatMult_TRLAN(PetscBLASInt *n,PetscBLASInt *m,PetscReal *xin,PetscBLASInt *ldx,PetscReal *yout,PetscBLASInt *ldy) { PetscErrorCode ierr; Vec x,y; PetscBLASInt i; PetscFunctionBegin; ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)globaleps),1,*n,PETSC_DECIDE,NULL,&x);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)globaleps),1,*n,PETSC_DECIDE,NULL,&y);CHKERRQ(ierr); for (i=0;i<*m;i++) { ierr = VecPlaceArray(x,(PetscScalar*)xin+i*(*ldx));CHKERRQ(ierr); ierr = VecPlaceArray(y,(PetscScalar*)yout+i*(*ldy));CHKERRQ(ierr); ierr = STApply(globaleps->st,x,y);CHKERRQ(ierr); ierr = IPOrthogonalize(globaleps->ip,0,NULL,globaleps->nds,NULL,globaleps->defl,y,NULL,NULL,NULL);CHKERRQ(ierr); ierr = VecResetArray(x);CHKERRQ(ierr); ierr = VecResetArray(y);CHKERRQ(ierr); } ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_TRLAN" PetscErrorCode EPSSolve_TRLAN(EPS eps) { PetscErrorCode ierr; PetscInt i; PetscBLASInt ipar[32],n,lohi,stat,ncv; EPS_TRLAN *tr = (EPS_TRLAN*)eps->data; PetscScalar *pV; PetscFunctionBegin; ierr = PetscBLASIntCast(eps->ncv,&ncv);CHKERRQ(ierr); ierr = PetscBLASIntCast(eps->nloc,&n);CHKERRQ(ierr); if (eps->which==EPS_LARGEST_REAL || eps->which==EPS_TARGET_REAL) lohi = 1; else if (eps->which==EPS_SMALLEST_REAL) lohi = -1; else SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); globaleps = eps; ipar[0] = 0; /* stat: error flag */ ipar[1] = lohi; /* smallest (lohi<0) or largest eigenvalues (lohi>0) */ ierr = PetscBLASIntCast(eps->nev,&ipar[2]);CHKERRQ(ierr); /* number of desired eigenpairs */ ipar[3] = 0; /* number of eigenpairs already converged */ ipar[4] = tr->maxlan; /* maximum Lanczos basis size */ ipar[5] = tr->restart; /* restarting scheme */ ierr = PetscBLASIntCast(eps->max_it,&ipar[6]);CHKERRQ(ierr); /* maximum number of MATVECs */ ierr = PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&ipar[7]);CHKERRQ(ierr); ipar[8] = 0; /* verboseness */ ipar[9] = 99; /* Fortran IO unit number used to write log messages */ ipar[10] = 1; /* use supplied starting vector */ ipar[11] = 0; /* checkpointing flag */ ipar[12] = 98; /* Fortran IO unit number used to write checkpoint files */ ipar[13] = 0; /* number of flops per matvec per PE (not used) */ tr->work[0] = eps->tol; /* relative tolerance on residual norms */ for (i=0;incv;i++) eps->eigr[i]=0.0; ierr = EPSGetStartVector(eps,0,eps->V[0],NULL);CHKERRQ(ierr); ierr = VecGetArray(eps->V[0],&pV);CHKERRQ(ierr); PetscStackCall("TRLan",TRLan_(MatMult_TRLAN,ipar,&n,&ncv,eps->eigr,pV,&n,tr->work,&tr->lwork)); ierr = VecRestoreArray(eps->V[0],&pV);CHKERRQ(ierr); stat = ipar[0]; eps->nconv = ipar[3]; eps->its = ipar[25]; eps->reason = EPS_CONVERGED_TOL; if (stat!=0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error in TRLAN (code=%d)",stat); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_TRLAN" PetscErrorCode EPSReset_TRLAN(EPS eps) { PetscErrorCode ierr; EPS_TRLAN *tr = (EPS_TRLAN*)eps->data; PetscFunctionBegin; ierr = PetscFree(tr->work);CHKERRQ(ierr); ierr = EPSFreeSolution(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_TRLAN" PetscErrorCode EPSDestroy_TRLAN(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_TRLAN" PETSC_EXTERN PetscErrorCode EPSCreate_TRLAN(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_TRLAN,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_TRLAN; eps->ops->destroy = EPSDestroy_TRLAN; eps->ops->reset = EPSReset_TRLAN; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/trlan/trlanp.h.html0000644000175000017500000000743612211062077023525 0ustar gladkgladk

Actual source code: trlanp.h

  1: /*
  2:    Private data structure used by the TRLAN interface

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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


 27: typedef struct {
 28:   PetscBLASInt       maxlan;
 29:   PetscBLASInt       restart;
 30:   PetscReal          *work;
 31:   PetscBLASInt       lwork;
 32: } EPS_TRLAN;

 34: /*
 35:    Definition of routines from the TRLAN package
 36:    These are real case. TRLAN currently only has DOUBLE PRECISION version
 37: */

 39: #if defined(SLEPC_TRLAN_HAVE_UNDERSCORE)
 40: #define TRLan_ trlan77_
 41: #elif defined(SLEPC_TRLAN_HAVE_CAPS)
 42: #define TRLan_ TRLAN77
 43: #else
 44: #define TRLan_ trlan77
 45: #endif

 47: PETSC_EXTERN void TRLan_(PetscBLASInt(*op)(PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*),PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);

 49: #endif

slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/0000755000175000017500000000000012214143515021220 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/arpack.c.html0000644000175000017500000006770112211062077023603 0ustar gladkgladk
Actual source code: arpack.c

  1: /*
  2:    This file implements a wrapper to the ARPACK package

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>        /*I "slepceps.h" I*/
 25: #include <slepc-private/stimpl.h>         /*I "slepcst.h" I*/
 26: #include <../src/eps/impls/external/arpack/arpackp.h>

 28: PetscErrorCode EPSSolve_ARPACK(EPS);

 32: PetscErrorCode EPSSetUp_ARPACK(EPS eps)
 33: {
 35:   PetscInt       ncv;
 36:   EPS_ARPACK     *ar = (EPS_ARPACK*)eps->data;

 39:   if (eps->ncv) {
 40:     if (eps->ncv<eps->nev+2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The value of ncv must be at least nev+2");
 41:   } else eps->ncv = PetscMin(PetscMax(20,2*eps->nev+1),eps->n); /* set default value of ncv */
 42:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
 43:   if (!eps->max_it) eps->max_it = PetscMax(300,(PetscInt)(2*eps->n/eps->ncv));
 44:   if (!eps->which) eps->which = EPS_LARGEST_MAGNITUDE;

 46:   ncv = eps->ncv;
 47: #if defined(PETSC_USE_COMPLEX)
 48:   PetscFree(ar->rwork);
 49:   PetscMalloc(ncv*sizeof(PetscReal),&ar->rwork);
 50:   PetscLogObjectMemory(eps,ncv*sizeof(PetscReal));
 51:   PetscBLASIntCast(3*ncv*ncv+5*ncv,&ar->lworkl);
 52:   PetscFree(ar->workev);
 53:   PetscMalloc(3*ncv*sizeof(PetscScalar),&ar->workev);
 54:   PetscLogObjectMemory(eps,3*ncv*sizeof(PetscScalar));
 55: #else
 56:   if (eps->ishermitian) {
 57:     PetscBLASIntCast(ncv*(ncv+8),&ar->lworkl);
 58:   } else {
 59:     PetscBLASIntCast(3*ncv*ncv+6*ncv,&ar->lworkl);
 60:     PetscFree(ar->workev);
 61:     PetscMalloc(3*ncv*sizeof(PetscScalar),&ar->workev);
 62:     PetscLogObjectMemory(eps,3*ncv*sizeof(PetscScalar));
 63:   }
 64: #endif
 65:   PetscFree(ar->workl);
 66:   PetscMalloc(ar->lworkl*sizeof(PetscScalar),&ar->workl);
 67:   PetscLogObjectMemory(eps,ar->lworkl*sizeof(PetscScalar));
 68:   PetscFree(ar->select);
 69:   PetscMalloc(ncv*sizeof(PetscBool),&ar->select);
 70:   PetscLogObjectMemory(eps,ncv*sizeof(PetscBool));
 71:   PetscFree(ar->workd);
 72:   PetscMalloc(3*eps->nloc*sizeof(PetscScalar),&ar->workd);
 73:   PetscLogObjectMemory(eps,3*eps->nloc*sizeof(PetscScalar));

 75:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

 77:   if (eps->balance!=EPS_BALANCE_NONE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Balancing not supported in the Arpack interface");
 78:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

 80:   EPSAllocateSolution(eps);
 81:   EPSSetWorkVecs(eps,2);

 83:   /* dispatch solve method */
 84:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
 85:   eps->ops->solve = EPSSolve_ARPACK;
 86:   return(0);
 87: }

 91: PetscErrorCode EPSSolve_ARPACK(EPS eps)
 92: {
 94:   EPS_ARPACK     *ar = (EPS_ARPACK*)eps->data;
 95:   char           bmat[1],howmny[] = "A";
 96:   const char     *which;
 97:   PetscBLASInt   n,iparam[11],ipntr[14],ido,info,nev,ncv;
 98: #if !defined(PETSC_HAVE_MPIUNI)
 99:   PetscBLASInt   fcomm;
100: #endif
101:   PetscScalar    sigmar,*pV,*resid;
102:   Vec            x,y,w = eps->work[0];
103:   Mat            A;
104:   PetscBool      isSinv,isShift,rvec;
105: #if !defined(PETSC_USE_COMPLEX)
106:   PetscScalar    sigmai = 0.0;
107: #endif

110:   PetscBLASIntCast(eps->nev,&nev);
111:   PetscBLASIntCast(eps->ncv,&ncv);
112: #if !defined(PETSC_HAVE_MPIUNI)
113:   PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&fcomm);
114: #endif
115:   PetscBLASIntCast(eps->nloc,&n);
116:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&x);
117:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&y);
118:   VecGetArray(eps->V[0],&pV);
119:   EPSGetStartVector(eps,0,eps->work[1],NULL);
120:   VecGetArray(eps->work[1],&resid);

122:   ido  = 0;            /* first call to reverse communication interface */
123:   info = 1;            /* indicates a initial vector is provided */
124:   iparam[0] = 1;       /* use exact shifts */
125:   PetscBLASIntCast(eps->max_it,&iparam[2]);  /* max Arnoldi iterations */
126:   iparam[3] = 1;       /* blocksize */
127:   iparam[4] = 0;       /* number of converged Ritz values */

129:   /*
130:      Computational modes ([]=not supported):
131:             symmetric    non-symmetric    complex
132:         1     1  'I'        1  'I'         1  'I'
133:         2     3  'I'        3  'I'         3  'I'
134:         3     2  'G'        2  'G'         2  'G'
135:         4     3  'G'        3  'G'         3  'G'
136:         5   [ 4  'G' ]    [ 3  'G' ]
137:         6   [ 5  'G' ]    [ 4  'G' ]
138:    */
139:   PetscObjectTypeCompare((PetscObject)eps->st,STSINVERT,&isSinv);
140:   PetscObjectTypeCompare((PetscObject)eps->st,STSHIFT,&isShift);
141:   STGetShift(eps->st,&sigmar);
142:   STGetOperators(eps->st,0,&A);

144:   if (isSinv) {
145:     /* shift-and-invert mode */
146:     iparam[6] = 3;
147:     if (eps->ispositive) bmat[0] = 'G';
148:     else bmat[0] = 'I';
149:   } else if (isShift && eps->ispositive) {
150:     /* generalized shift mode with B positive definite */
151:     iparam[6] = 2;
152:     bmat[0] = 'G';
153:   } else {
154:     /* regular mode */
155:     if (eps->ishermitian && eps->isgeneralized)
156:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Spectral transformation not supported by ARPACK hermitian solver");
157:     iparam[6] = 1;
158:     bmat[0] = 'I';
159:   }

161: #if !defined(PETSC_USE_COMPLEX)
162:     if (eps->ishermitian) {
163:       switch (eps->which) {
164:         case EPS_TARGET_MAGNITUDE:
165:         case EPS_LARGEST_MAGNITUDE:  which = "LM"; break;
166:         case EPS_SMALLEST_MAGNITUDE: which = "SM"; break;
167:         case EPS_TARGET_REAL:
168:         case EPS_LARGEST_REAL:       which = "LA"; break;
169:         case EPS_SMALLEST_REAL:      which = "SA"; break;
170:         default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Wrong value of eps->which");
171:       }
172:     } else {
173: #endif
174:       switch (eps->which) {
175:         case EPS_TARGET_MAGNITUDE:
176:         case EPS_LARGEST_MAGNITUDE:  which = "LM"; break;
177:         case EPS_SMALLEST_MAGNITUDE: which = "SM"; break;
178:         case EPS_TARGET_REAL:
179:         case EPS_LARGEST_REAL:       which = "LR"; break;
180:         case EPS_SMALLEST_REAL:      which = "SR"; break;
181:         case EPS_TARGET_IMAGINARY:
182:         case EPS_LARGEST_IMAGINARY:  which = "LI"; break;
183:         case EPS_SMALLEST_IMAGINARY: which = "SI"; break;
184:         default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Wrong value of eps->which");
185:       }
186: #if !defined(PETSC_USE_COMPLEX)
187:     }
188: #endif

190:   do {

192: #if !defined(PETSC_USE_COMPLEX)
193:     if (eps->ishermitian) {
194:       PetscStackCall("ARPACKsaupd",ARPACKsaupd_(&fcomm,&ido,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info));
195:     } else {
196:       PetscStackCall("ARPACKnaupd",ARPACKnaupd_(&fcomm,&ido,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info));
197:     }
198: #else
199:     PetscStackCall("ARPACKnaupd",ARPACKnaupd_(&fcomm,&ido,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,ar->rwork,&info));
200: #endif

202:     if (ido == -1 || ido == 1 || ido == 2) {
203:       if (ido == 1 && iparam[6] == 3 && bmat[0] == 'G') {
204:         /* special case for shift-and-invert with B semi-positive definite*/
205:         VecPlaceArray(x,&ar->workd[ipntr[2]-1]);
206:       } else {
207:         VecPlaceArray(x,&ar->workd[ipntr[0]-1]);
208:       }
209:       VecPlaceArray(y,&ar->workd[ipntr[1]-1]);

211:       if (ido == -1) {
212:         /* Y = OP * X for for the initialization phase to
213:            force the starting vector into the range of OP */
214:         STApply(eps->st,x,y);
215:       } else if (ido == 2) {
216:         /* Y = B * X */
217:         IPApplyMatrix(eps->ip,x,y);
218:       } else { /* ido == 1 */
219:         if (iparam[6] == 3 && bmat[0] == 'G') {
220:           /* Y = OP * X for shift-and-invert with B semi-positive definite */
221:           STMatSolve(eps->st,1,x,y);
222:         } else if (iparam[6] == 2) {
223:           /* X=A*X Y=B^-1*X for shift with B positive definite */
224:           MatMult(A,x,y);
225:           if (sigmar != 0.0) {
226:             IPApplyMatrix(eps->ip,x,w);
227:             VecAXPY(y,sigmar,w);
228:           }
229:           VecCopy(y,x);
230:           STMatSolve(eps->st,1,x,y);
231:         } else {
232:           /* Y = OP * X */
233:           STApply(eps->st,x,y);
234:         }
235:         IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,y,NULL,NULL,NULL);
236:       }

238:       VecResetArray(x);
239:       VecResetArray(y);
240:     } else if (ido != 99) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Internal error in ARPACK reverse comunication interface (ido=%d)",ido);

242:   } while (ido != 99);

244:   eps->nconv = iparam[4];
245:   eps->its = iparam[2];

247:   if (info==3) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"No shift could be applied in xxAUPD.\nTry increasing the size of NCV relative to NEV");
248:   else if (info!=0 && info!=1) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error reported by ARPACK subroutine xxAUPD (%d)",info);

250:   rvec = PETSC_TRUE;

252:   if (eps->nconv > 0) {
253: #if !defined(PETSC_USE_COMPLEX)
254:     if (eps->ishermitian) {
255:       EPSMonitor(eps,iparam[2],iparam[4],&ar->workl[ipntr[5]-1],eps->eigi,&ar->workl[ipntr[6]-1],eps->ncv);
256:       PetscStackCall("ARPACKseupd",ARPACKseupd_(&fcomm,&rvec,howmny,ar->select,eps->eigr,pV,&n,&sigmar,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info));
257:     } else {
258:       EPSMonitor(eps,iparam[2],iparam[4],&ar->workl[ipntr[5]-1],&ar->workl[ipntr[6]-1],&ar->workl[ipntr[7]-1],eps->ncv);
259:       PetscStackCall("ARPACKneupd",ARPACKneupd_(&fcomm,&rvec,howmny,ar->select,eps->eigr,eps->eigi,pV,&n,&sigmar,&sigmai,ar->workev,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info));
260:     }
261: #else
262:     EPSMonitor(eps,eps->its,iparam[4],&ar->workl[ipntr[5]-1],eps->eigi,(PetscReal*)&ar->workl[ipntr[7]-1],eps->ncv);
263:     PetscStackCall("ARPACKneupd",ARPACKneupd_(&fcomm,&rvec,howmny,ar->select,eps->eigr,pV,&n,&sigmar,ar->workev,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,ar->rwork,&info));
264: #endif
265:     if (info!=0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error reported by ARPACK subroutine xxEUPD (%d)",info);
266:   }

268:   VecRestoreArray(eps->V[0],&pV);
269:   VecRestoreArray(eps->work[1],&resid);
270:   if (eps->nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL;
271:   else eps->reason = EPS_DIVERGED_ITS;

273:   if (eps->ishermitian) {
274:     PetscMemcpy(eps->errest,&ar->workl[ipntr[8]-1],eps->nconv);
275:   } else {
276:     PetscMemcpy(eps->errest,&ar->workl[ipntr[10]-1],eps->nconv);
277:   }

279:   VecDestroy(&x);
280:   VecDestroy(&y);
281:   return(0);
282: }

286: PetscErrorCode EPSBackTransform_ARPACK(EPS eps)
287: {
289:   PetscBool      isSinv;

292:   PetscObjectTypeCompare((PetscObject)eps->st,STSINVERT,&isSinv);
293:   if (!isSinv) {
294:     EPSBackTransform_Default(eps);
295:   }
296:   return(0);
297: }

301: PetscErrorCode EPSReset_ARPACK(EPS eps)
302: {
304:   EPS_ARPACK     *ar = (EPS_ARPACK*)eps->data;

307:   PetscFree(ar->workev);
308:   PetscFree(ar->workl);
309:   PetscFree(ar->select);
310:   PetscFree(ar->workd);
311: #if defined(PETSC_USE_COMPLEX)
312:   PetscFree(ar->rwork);
313: #endif
314:   EPSReset_Default(eps);
315:   return(0);
316: }

320: PetscErrorCode EPSDestroy_ARPACK(EPS eps)
321: {

325:   PetscFree(eps->data);
326:   return(0);
327: }

331: PETSC_EXTERN PetscErrorCode EPSCreate_ARPACK(EPS eps)
332: {

336:   PetscNewLog(eps,EPS_ARPACK,&eps->data);
337:   eps->ops->setup                = EPSSetUp_ARPACK;
338:   eps->ops->destroy              = EPSDestroy_ARPACK;
339:   eps->ops->reset                = EPSReset_ARPACK;
340:   eps->ops->backtransform        = EPSBackTransform_ARPACK;
341:   eps->ops->computevectors       = EPSComputeVectors_Default;
342:   return(0);
343: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/makefile0000644000175000017500000000223212211062077022717 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresdefine 'SLEPC_HAVE_ARPACK' CFLAGS = FFLAGS = SOURCEC = arpack.c SOURCEF = SOURCEH = arpackp.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/external/arpack/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/arpackp.h0000644000175000017500000001720012211062077023012 0ustar gladkgladk/* Private data structure used by the ARPACK interface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__ARPACKP_H) #define __ARPACKP_H typedef struct { PetscBool *select; PetscScalar *workev; PetscScalar *workd; PetscScalar *workl; PetscBLASInt lworkl; PetscReal *rwork; } EPS_ARPACK; /* Definition of routines from the ARPACK package */ #if defined(PETSC_HAVE_MPIUNI) #if defined(PETSC_USE_COMPLEX) #if defined(PETSC_USE_REAL_SINGLE) #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) c##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) C##ucase #else #define SLEPC_ARPACK(lcase,ucase) c##lcase #endif #else #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) z##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) Z##ucase #else #define SLEPC_ARPACK(lcase,ucase) z##lcase #endif #endif #else #if defined(PETSC_USE_REAL_SINGLE) #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) s##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) S##ucase #else #define SLEPC_ARPACK(lcase,ucase) s##lcase #endif #else #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) d##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) D##ucase #else #define SLEPC_ARPACK(lcase,ucase) d##lcase #endif #endif #endif #else /* not MPIUNI */ #if defined(PETSC_USE_COMPLEX) #if defined(PETSC_USE_REAL_SINGLE) #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) pc##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) PC##ucase #else #define SLEPC_ARPACK(lcase,ucase) pc##lcase #endif #else #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) pz##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) PZ##ucase #else #define SLEPC_ARPACK(lcase,ucase) pz##lcase #endif #endif #else #if defined(PETSC_USE_REAL_SINGLE) #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) ps##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) PS##ucase #else #define SLEPC_ARPACK(lcase,ucase) ps##lcase #endif #else #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE) #define SLEPC_ARPACK(lcase,ucase) pd##lcase##_ #elif defined(SLEPC_ARPACK_HAVE_CAPS) #define SLEPC_ARPACK(lcase,ucase) PD##ucase #else #define SLEPC_ARPACK(lcase,ucase) pd##lcase #endif #endif #endif #endif #if defined(PETSC_HAVE_MPIUNI) #define COMM_ARG #if !defined(PETSC_USE_COMPLEX) #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(naupd,NAUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2) #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) SLEPC_ARPACK(neupd,NEUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),1,1,2) #define ARPACKsaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(saupd,SAUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2) #define ARPACKseupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w) SLEPC_ARPACK(seupd,SEUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,2) #else #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_ARPACK(naupd,NAUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,2) #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) SLEPC_ARPACK(neupd,NEUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),1,1,2) #endif #else /* not MPIUNI */ #define COMM_ARG MPI_Fint*, #if !defined(PETSC_USE_COMPLEX) #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(naupd,NAUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2) #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) SLEPC_ARPACK(neupd,NEUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),1,1,2) #define ARPACKsaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(saupd,SAUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2) #define ARPACKseupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w) SLEPC_ARPACK(seupd,SEUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,2) #else #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_ARPACK(naupd,NAUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,2) #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) SLEPC_ARPACK(neupd,NEUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),1,1,2) #endif #endif PETSC_EXTERN void SLEPC_ARPACK(saupd,SAUPD)(COMM_ARG PetscBLASInt*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int); PETSC_EXTERN void SLEPC_ARPACK(seupd,SEUPD)(COMM_ARG PetscBool*,char*,PetscBool*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int,int); #if !defined(PETSC_USE_COMPLEX) PETSC_EXTERN void SLEPC_ARPACK(naupd,NAUPD)(COMM_ARG PetscBLASInt*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int); PETSC_EXTERN void SLEPC_ARPACK(neupd,NEUPD)(COMM_ARG PetscBool*,char*,PetscBool*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int,int); #else PETSC_EXTERN void SLEPC_ARPACK(naupd,NAUPD)(COMM_ARG PetscBLASInt*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,int,int); PETSC_EXTERN void SLEPC_ARPACK(neupd,NEUPD)(COMM_ARG PetscBool*,char*,PetscBool*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,int,int,int); #endif #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/makefile.html0000644000175000017500000000406312211062077023666 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresdefine  'SLEPC_HAVE_ARPACK'

CFLAGS   =
FFLAGS   =
SOURCEC  = arpack.c
SOURCEF  =
SOURCEH  = arpackp.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/external/arpack/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/index.html0000644000175000017500000000220312211062077023212 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

arpackp.h
arpack.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/arpackp.h.html0000644000175000017500000004000712211062077023756 0ustar gladkgladk

Actual source code: arpackp.h

  1: /*
  2:    Private data structure used by the ARPACK interface

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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


 27: typedef struct {
 28:   PetscBool    *select;
 29:   PetscScalar  *workev;
 30:   PetscScalar  *workd;
 31:   PetscScalar  *workl;
 32:   PetscBLASInt lworkl;
 33:   PetscReal    *rwork;
 34: } EPS_ARPACK;

 36: /*
 37:    Definition of routines from the ARPACK package
 38: */

 40: #if defined(PETSC_HAVE_MPIUNI)

 42: #if defined(PETSC_USE_COMPLEX)

 44: #if defined(PETSC_USE_REAL_SINGLE)

 46: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
 47: #define SLEPC_ARPACK(lcase,ucase) c##lcase##_
 48: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
 49: #define SLEPC_ARPACK(lcase,ucase) C##ucase
 50: #else
 51: #define SLEPC_ARPACK(lcase,ucase) c##lcase
 52: #endif

 54: #else

 56: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
 57: #define SLEPC_ARPACK(lcase,ucase) z##lcase##_
 58: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
 59: #define SLEPC_ARPACK(lcase,ucase) Z##ucase
 60: #else
 61: #define SLEPC_ARPACK(lcase,ucase) z##lcase
 62: #endif

 64: #endif

 66: #else

 68: #if defined(PETSC_USE_REAL_SINGLE)

 70: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
 71: #define SLEPC_ARPACK(lcase,ucase) s##lcase##_
 72: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
 73: #define SLEPC_ARPACK(lcase,ucase) S##ucase
 74: #else
 75: #define SLEPC_ARPACK(lcase,ucase) s##lcase
 76: #endif

 78: #else

 80: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
 81: #define SLEPC_ARPACK(lcase,ucase) d##lcase##_
 82: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
 83: #define SLEPC_ARPACK(lcase,ucase) D##ucase
 84: #else
 85: #define SLEPC_ARPACK(lcase,ucase) d##lcase
 86: #endif

 88: #endif

 90: #endif

 92: #else  /* not MPIUNI */

 94: #if defined(PETSC_USE_COMPLEX)

 96: #if defined(PETSC_USE_REAL_SINGLE)

 98: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
 99: #define SLEPC_ARPACK(lcase,ucase) pc##lcase##_
100: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
101: #define SLEPC_ARPACK(lcase,ucase) PC##ucase
102: #else
103: #define SLEPC_ARPACK(lcase,ucase) pc##lcase
104: #endif

106: #else

108: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
109: #define SLEPC_ARPACK(lcase,ucase) pz##lcase##_
110: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
111: #define SLEPC_ARPACK(lcase,ucase) PZ##ucase
112: #else
113: #define SLEPC_ARPACK(lcase,ucase) pz##lcase
114: #endif

116: #endif

118: #else

120: #if defined(PETSC_USE_REAL_SINGLE)

122: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
123: #define SLEPC_ARPACK(lcase,ucase) ps##lcase##_
124: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
125: #define SLEPC_ARPACK(lcase,ucase) PS##ucase
126: #else
127: #define SLEPC_ARPACK(lcase,ucase) ps##lcase
128: #endif

130: #else

132: #if defined(SLEPC_ARPACK_HAVE_UNDERSCORE)
133: #define SLEPC_ARPACK(lcase,ucase) pd##lcase##_
134: #elif defined(SLEPC_ARPACK_HAVE_CAPS)
135: #define SLEPC_ARPACK(lcase,ucase) PD##ucase
136: #else
137: #define SLEPC_ARPACK(lcase,ucase) pd##lcase
138: #endif

140: #endif

142: #endif

144: #endif

146: #if defined(PETSC_HAVE_MPIUNI)

148: #define COMM_ARG

150: #if !defined(PETSC_USE_COMPLEX)

152: #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(naupd,NAUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2)
153: #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) SLEPC_ARPACK(neupd,NEUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),1,1,2)
154: #define ARPACKsaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(saupd,SAUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2)
155: #define ARPACKseupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w) SLEPC_ARPACK(seupd,SEUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,2)

157: #else

159: #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_ARPACK(naupd,NAUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,2)
160: #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) SLEPC_ARPACK(neupd,NEUPD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),1,1,2)

162: #endif

164: #else /* not MPIUNI */

166: #define COMM_ARG MPI_Fint*,

168: #if !defined(PETSC_USE_COMPLEX)

170: #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(naupd,NAUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2)
171: #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) SLEPC_ARPACK(neupd,NEUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),1,1,2)
172: #define ARPACKsaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_ARPACK(saupd,SAUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,2)
173: #define ARPACKseupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w) SLEPC_ARPACK(seupd,SEUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,2)

175: #else

177: #define ARPACKnaupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_ARPACK(naupd,NAUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,2)
178: #define ARPACKneupd_(comm,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) SLEPC_ARPACK(neupd,NEUPD) ((comm),(a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),1,1,2)

180: #endif

182: #endif

184: PETSC_EXTERN void   SLEPC_ARPACK(saupd,SAUPD)(COMM_ARG PetscBLASInt*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int);
185: PETSC_EXTERN void   SLEPC_ARPACK(seupd,SEUPD)(COMM_ARG PetscBool*,char*,PetscBool*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int,int);

187: #if !defined(PETSC_USE_COMPLEX)
188: PETSC_EXTERN void   SLEPC_ARPACK(naupd,NAUPD)(COMM_ARG PetscBLASInt*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int);
189: PETSC_EXTERN void   SLEPC_ARPACK(neupd,NEUPD)(COMM_ARG PetscBool*,char*,PetscBool*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,int,int,int);
190: #else
191: PETSC_EXTERN void   SLEPC_ARPACK(naupd,NAUPD)(COMM_ARG PetscBLASInt*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,int,int);
192: PETSC_EXTERN void   SLEPC_ARPACK(neupd,NEUPD)(COMM_ARG PetscBool*,char*,PetscBool*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,char*,PetscBLASInt*,const char*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,int,int,int);
193: #endif

195: #endif

slepc-3.4.2.dfsg.orig/src/eps/impls/external/arpack/arpack.c0000644000175000017500000003412512211062077022632 0ustar gladkgladk/* This file implements a wrapper to the ARPACK package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include /*I "slepcst.h" I*/ #include <../src/eps/impls/external/arpack/arpackp.h> PetscErrorCode EPSSolve_ARPACK(EPS); #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_ARPACK" PetscErrorCode EPSSetUp_ARPACK(EPS eps) { PetscErrorCode ierr; PetscInt ncv; EPS_ARPACK *ar = (EPS_ARPACK*)eps->data; PetscFunctionBegin; if (eps->ncv) { if (eps->ncvnev+2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The value of ncv must be at least nev+2"); } else eps->ncv = PetscMin(PetscMax(20,2*eps->nev+1),eps->n); /* set default value of ncv */ if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->max_it) eps->max_it = PetscMax(300,(PetscInt)(2*eps->n/eps->ncv)); if (!eps->which) eps->which = EPS_LARGEST_MAGNITUDE; ncv = eps->ncv; #if defined(PETSC_USE_COMPLEX) ierr = PetscFree(ar->rwork);CHKERRQ(ierr); ierr = PetscMalloc(ncv*sizeof(PetscReal),&ar->rwork);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ncv*sizeof(PetscReal));CHKERRQ(ierr); ierr = PetscBLASIntCast(3*ncv*ncv+5*ncv,&ar->lworkl);CHKERRQ(ierr); ierr = PetscFree(ar->workev);CHKERRQ(ierr); ierr = PetscMalloc(3*ncv*sizeof(PetscScalar),&ar->workev);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,3*ncv*sizeof(PetscScalar));CHKERRQ(ierr); #else if (eps->ishermitian) { ierr = PetscBLASIntCast(ncv*(ncv+8),&ar->lworkl);CHKERRQ(ierr); } else { ierr = PetscBLASIntCast(3*ncv*ncv+6*ncv,&ar->lworkl);CHKERRQ(ierr); ierr = PetscFree(ar->workev);CHKERRQ(ierr); ierr = PetscMalloc(3*ncv*sizeof(PetscScalar),&ar->workev);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,3*ncv*sizeof(PetscScalar));CHKERRQ(ierr); } #endif ierr = PetscFree(ar->workl);CHKERRQ(ierr); ierr = PetscMalloc(ar->lworkl*sizeof(PetscScalar),&ar->workl);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ar->lworkl*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscFree(ar->select);CHKERRQ(ierr); ierr = PetscMalloc(ncv*sizeof(PetscBool),&ar->select);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,ncv*sizeof(PetscBool));CHKERRQ(ierr); ierr = PetscFree(ar->workd);CHKERRQ(ierr); ierr = PetscMalloc(3*eps->nloc*sizeof(PetscScalar),&ar->workd);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,3*eps->nloc*sizeof(PetscScalar));CHKERRQ(ierr); if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } if (eps->balance!=EPS_BALANCE_NONE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Balancing not supported in the Arpack interface"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,2);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_ARPACK; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_ARPACK" PetscErrorCode EPSSolve_ARPACK(EPS eps) { PetscErrorCode ierr; EPS_ARPACK *ar = (EPS_ARPACK*)eps->data; char bmat[1],howmny[] = "A"; const char *which; PetscBLASInt n,iparam[11],ipntr[14],ido,info,nev,ncv; #if !defined(PETSC_HAVE_MPIUNI) PetscBLASInt fcomm; #endif PetscScalar sigmar,*pV,*resid; Vec x,y,w = eps->work[0]; Mat A; PetscBool isSinv,isShift,rvec; #if !defined(PETSC_USE_COMPLEX) PetscScalar sigmai = 0.0; #endif PetscFunctionBegin; ierr = PetscBLASIntCast(eps->nev,&nev);CHKERRQ(ierr); ierr = PetscBLASIntCast(eps->ncv,&ncv);CHKERRQ(ierr); #if !defined(PETSC_HAVE_MPIUNI) ierr = PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&fcomm);CHKERRQ(ierr); #endif ierr = PetscBLASIntCast(eps->nloc,&n);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&x);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&y);CHKERRQ(ierr); ierr = VecGetArray(eps->V[0],&pV);CHKERRQ(ierr); ierr = EPSGetStartVector(eps,0,eps->work[1],NULL);CHKERRQ(ierr); ierr = VecGetArray(eps->work[1],&resid);CHKERRQ(ierr); ido = 0; /* first call to reverse communication interface */ info = 1; /* indicates a initial vector is provided */ iparam[0] = 1; /* use exact shifts */ ierr = PetscBLASIntCast(eps->max_it,&iparam[2]);CHKERRQ(ierr); /* max Arnoldi iterations */ iparam[3] = 1; /* blocksize */ iparam[4] = 0; /* number of converged Ritz values */ /* Computational modes ([]=not supported): symmetric non-symmetric complex 1 1 'I' 1 'I' 1 'I' 2 3 'I' 3 'I' 3 'I' 3 2 'G' 2 'G' 2 'G' 4 3 'G' 3 'G' 3 'G' 5 [ 4 'G' ] [ 3 'G' ] 6 [ 5 'G' ] [ 4 'G' ] */ ierr = PetscObjectTypeCompare((PetscObject)eps->st,STSINVERT,&isSinv);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STSHIFT,&isShift);CHKERRQ(ierr); ierr = STGetShift(eps->st,&sigmar);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (isSinv) { /* shift-and-invert mode */ iparam[6] = 3; if (eps->ispositive) bmat[0] = 'G'; else bmat[0] = 'I'; } else if (isShift && eps->ispositive) { /* generalized shift mode with B positive definite */ iparam[6] = 2; bmat[0] = 'G'; } else { /* regular mode */ if (eps->ishermitian && eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Spectral transformation not supported by ARPACK hermitian solver"); iparam[6] = 1; bmat[0] = 'I'; } #if !defined(PETSC_USE_COMPLEX) if (eps->ishermitian) { switch (eps->which) { case EPS_TARGET_MAGNITUDE: case EPS_LARGEST_MAGNITUDE: which = "LM"; break; case EPS_SMALLEST_MAGNITUDE: which = "SM"; break; case EPS_TARGET_REAL: case EPS_LARGEST_REAL: which = "LA"; break; case EPS_SMALLEST_REAL: which = "SA"; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Wrong value of eps->which"); } } else { #endif switch (eps->which) { case EPS_TARGET_MAGNITUDE: case EPS_LARGEST_MAGNITUDE: which = "LM"; break; case EPS_SMALLEST_MAGNITUDE: which = "SM"; break; case EPS_TARGET_REAL: case EPS_LARGEST_REAL: which = "LR"; break; case EPS_SMALLEST_REAL: which = "SR"; break; case EPS_TARGET_IMAGINARY: case EPS_LARGEST_IMAGINARY: which = "LI"; break; case EPS_SMALLEST_IMAGINARY: which = "SI"; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Wrong value of eps->which"); } #if !defined(PETSC_USE_COMPLEX) } #endif do { #if !defined(PETSC_USE_COMPLEX) if (eps->ishermitian) { PetscStackCall("ARPACKsaupd",ARPACKsaupd_(&fcomm,&ido,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info)); } else { PetscStackCall("ARPACKnaupd",ARPACKnaupd_(&fcomm,&ido,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info)); } #else PetscStackCall("ARPACKnaupd",ARPACKnaupd_(&fcomm,&ido,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,ar->rwork,&info)); #endif if (ido == -1 || ido == 1 || ido == 2) { if (ido == 1 && iparam[6] == 3 && bmat[0] == 'G') { /* special case for shift-and-invert with B semi-positive definite*/ ierr = VecPlaceArray(x,&ar->workd[ipntr[2]-1]);CHKERRQ(ierr); } else { ierr = VecPlaceArray(x,&ar->workd[ipntr[0]-1]);CHKERRQ(ierr); } ierr = VecPlaceArray(y,&ar->workd[ipntr[1]-1]);CHKERRQ(ierr); if (ido == -1) { /* Y = OP * X for for the initialization phase to force the starting vector into the range of OP */ ierr = STApply(eps->st,x,y);CHKERRQ(ierr); } else if (ido == 2) { /* Y = B * X */ ierr = IPApplyMatrix(eps->ip,x,y);CHKERRQ(ierr); } else { /* ido == 1 */ if (iparam[6] == 3 && bmat[0] == 'G') { /* Y = OP * X for shift-and-invert with B semi-positive definite */ ierr = STMatSolve(eps->st,1,x,y);CHKERRQ(ierr); } else if (iparam[6] == 2) { /* X=A*X Y=B^-1*X for shift with B positive definite */ ierr = MatMult(A,x,y);CHKERRQ(ierr); if (sigmar != 0.0) { ierr = IPApplyMatrix(eps->ip,x,w);CHKERRQ(ierr); ierr = VecAXPY(y,sigmar,w);CHKERRQ(ierr); } ierr = VecCopy(y,x);CHKERRQ(ierr); ierr = STMatSolve(eps->st,1,x,y);CHKERRQ(ierr); } else { /* Y = OP * X */ ierr = STApply(eps->st,x,y);CHKERRQ(ierr); } ierr = IPOrthogonalize(eps->ip,0,NULL,eps->nds,NULL,eps->defl,y,NULL,NULL,NULL);CHKERRQ(ierr); } ierr = VecResetArray(x);CHKERRQ(ierr); ierr = VecResetArray(y);CHKERRQ(ierr); } else if (ido != 99) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Internal error in ARPACK reverse comunication interface (ido=%d)",ido); } while (ido != 99); eps->nconv = iparam[4]; eps->its = iparam[2]; if (info==3) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"No shift could be applied in xxAUPD.\nTry increasing the size of NCV relative to NEV"); else if (info!=0 && info!=1) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error reported by ARPACK subroutine xxAUPD (%d)",info); rvec = PETSC_TRUE; if (eps->nconv > 0) { #if !defined(PETSC_USE_COMPLEX) if (eps->ishermitian) { ierr = EPSMonitor(eps,iparam[2],iparam[4],&ar->workl[ipntr[5]-1],eps->eigi,&ar->workl[ipntr[6]-1],eps->ncv);CHKERRQ(ierr); PetscStackCall("ARPACKseupd",ARPACKseupd_(&fcomm,&rvec,howmny,ar->select,eps->eigr,pV,&n,&sigmar,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info)); } else { ierr = EPSMonitor(eps,iparam[2],iparam[4],&ar->workl[ipntr[5]-1],&ar->workl[ipntr[6]-1],&ar->workl[ipntr[7]-1],eps->ncv);CHKERRQ(ierr); PetscStackCall("ARPACKneupd",ARPACKneupd_(&fcomm,&rvec,howmny,ar->select,eps->eigr,eps->eigi,pV,&n,&sigmar,&sigmai,ar->workev,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,&info)); } #else ierr = EPSMonitor(eps,eps->its,iparam[4],&ar->workl[ipntr[5]-1],eps->eigi,(PetscReal*)&ar->workl[ipntr[7]-1],eps->ncv);CHKERRQ(ierr); PetscStackCall("ARPACKneupd",ARPACKneupd_(&fcomm,&rvec,howmny,ar->select,eps->eigr,pV,&n,&sigmar,ar->workev,bmat,&n,which,&nev,&eps->tol,resid,&ncv,pV,&n,iparam,ipntr,ar->workd,ar->workl,&ar->lworkl,ar->rwork,&info)); #endif if (info!=0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error reported by ARPACK subroutine xxEUPD (%d)",info); } ierr = VecRestoreArray(eps->V[0],&pV);CHKERRQ(ierr); ierr = VecRestoreArray(eps->work[1],&resid);CHKERRQ(ierr); if (eps->nconv >= eps->nev) eps->reason = EPS_CONVERGED_TOL; else eps->reason = EPS_DIVERGED_ITS; if (eps->ishermitian) { ierr = PetscMemcpy(eps->errest,&ar->workl[ipntr[8]-1],eps->nconv);CHKERRQ(ierr); } else { ierr = PetscMemcpy(eps->errest,&ar->workl[ipntr[10]-1],eps->nconv);CHKERRQ(ierr); } ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBackTransform_ARPACK" PetscErrorCode EPSBackTransform_ARPACK(EPS eps) { PetscErrorCode ierr; PetscBool isSinv; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)eps->st,STSINVERT,&isSinv);CHKERRQ(ierr); if (!isSinv) { ierr = EPSBackTransform_Default(eps);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_ARPACK" PetscErrorCode EPSReset_ARPACK(EPS eps) { PetscErrorCode ierr; EPS_ARPACK *ar = (EPS_ARPACK*)eps->data; PetscFunctionBegin; ierr = PetscFree(ar->workev);CHKERRQ(ierr); ierr = PetscFree(ar->workl);CHKERRQ(ierr); ierr = PetscFree(ar->select);CHKERRQ(ierr); ierr = PetscFree(ar->workd);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscFree(ar->rwork);CHKERRQ(ierr); #endif ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_ARPACK" PetscErrorCode EPSDestroy_ARPACK(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_ARPACK" PETSC_EXTERN PetscErrorCode EPSCreate_ARPACK(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_ARPACK,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_ARPACK; eps->ops->destroy = EPSDestroy_ARPACK; eps->ops->reset = EPSReset_ARPACK; eps->ops->backtransform = EPSBackTransform_ARPACK; eps->ops->computevectors = EPSComputeVectors_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/0000755000175000017500000000000012214143515021061 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/feastp.h0000644000175000017500000000611112211062077022513 0ustar gladkgladk/* Private data structure used by the FEAST interface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__FEASTP_H) #define __FEASTP_H typedef struct { PetscScalar *work1,*work2,*Aq,*Bq; /* workspace */ PetscBLASInt npoints; /* number of contour points */ } EPS_FEAST; /* Definition of routines from the FEAST package */ #if defined(SLEPC_FEAST_HAVE_UNDERSCORE) #define SLEPC_FEAST(lcase,ucase) lcase##_ #elif defined(SLEPC_FEAST_HAVE_CAPS) #define SLEPC_FEAST(lcase,ucase) ucase #else #define SLEPC_FEAST(lcase,ucase) lcase #endif #if defined(PETSC_USE_COMPLEX) #if defined(PETSC_USE_REAL_SINGLE) #if defined(SLEPC_FEAST_HAVE_UNDERSCORE) #define SLEPC_FEASTM(lcase,ucase) cfeast_h##lcase##_ #elif defined(SLEPC_FEAST_HAVE_CAPS) #define SLEPC_FEASTM(lcase,ucase) CFEAST_H##ucase #else #define SLEPC_FEASTM(lcase,ucase) cfeast_h##lcase #endif #else #if defined(SLEPC_FEAST_HAVE_UNDERSCORE) #define SLEPC_FEASTM(lcase,ucase) zfeast_h##lcase##_ #elif defined(SLEPC_FEAST_HAVE_CAPS) #define SLEPC_FEASTM(lcase,ucase) ZFEAST_H##ucase #else #define SLEPC_FEASTM(lcase,ucase) zfeast_h##lcase #endif #endif #else #if defined(PETSC_USE_REAL_SINGLE) #if defined(SLEPC_FEAST_HAVE_UNDERSCORE) #define SLEPC_FEASTM(lcase,ucase) sfeast_s##lcase##_ #elif defined(SLEPC_FEAST_HAVE_CAPS) #define SLEPC_FEASTM(lcase,ucase) SFEAST_S##ucase #else #define SLEPC_FEASTM(lcase,ucase) sfeast_s##lcase #endif #else #if defined(SLEPC_FEAST_HAVE_UNDERSCORE) #define SLEPC_FEASTM(lcase,ucase) dfeast_s##lcase##_ #elif defined(SLEPC_FEAST_HAVE_CAPS) #define SLEPC_FEASTM(lcase,ucase) DFEAST_S##ucase #else #define SLEPC_FEASTM(lcase,ucase) dfeast_s##lcase #endif #endif #endif #define FEASTinit_(a) SLEPC_FEAST(feastinit,FEASTINIT) ((a)) #define FEASTrci_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) SLEPC_FEASTM(rci,RCI) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r)) PETSC_EXTERN void SLEPC_FEAST(feastinit,FEASTINIT)(PetscBLASInt*); PETSC_EXTERN void SLEPC_FEASTM(rci,RCI)(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/makefile0000644000175000017500000000225712211062077022567 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresdefine 'SLEPC_HAVE_FEAST' #requiresscalar complex CFLAGS = FFLAGS = SOURCEC = feast.c SOURCEF = SOURCEH = feastp.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/external/feast/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/makefile.html0000644000175000017500000000414512211062077023530 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresdefine  'SLEPC_HAVE_FEAST'
#requiresscalar  complex

CFLAGS   =
FFLAGS   =
SOURCEC  = feast.c
SOURCEF  =
SOURCEH  = feastp.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/external/feast/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/index.html0000644000175000017500000000217712211062077023065 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

feastp.h
feast.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/feast.c0000644000175000017500000003137612211062077022341 0ustar gladkgladk/* This file implements a wrapper to the FEAST package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include <../src/eps/impls/external/feast/feastp.h> PetscErrorCode EPSSolve_FEAST(EPS); #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_FEAST" PetscErrorCode EPSSetUp_FEAST(EPS eps) { PetscErrorCode ierr; PetscInt ncv; PetscBool issinv; EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscMPIInt size; PetscFunctionBegin; ierr = MPI_Comm_size(PetscObjectComm((PetscObject)eps),&size);CHKERRQ(ierr); if (size!=1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The FEAST interface is supported for sequential runs only"); if (eps->ncv) { if (eps->ncvnev+2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The value of ncv must be at least nev+2"); } else eps->ncv = PetscMin(PetscMax(20,2*eps->nev+1),eps->n); /* set default value of ncv */ if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->max_it) eps->max_it = PetscMax(300,(PetscInt)(2*eps->n/eps->ncv)); if (!eps->which) eps->which = EPS_ALL; ncv = eps->ncv; ierr = PetscFree(ctx->work1);CHKERRQ(ierr); ierr = PetscMalloc(eps->nloc*ncv*sizeof(PetscScalar),&ctx->work1);CHKERRQ(ierr); ierr = PetscFree(ctx->work2);CHKERRQ(ierr); ierr = PetscMalloc(eps->nloc*ncv*sizeof(PetscScalar),&ctx->work2);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,2*eps->nloc*ncv*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscFree(ctx->Aq);CHKERRQ(ierr); ierr = PetscMalloc(ncv*ncv*sizeof(PetscScalar),&ctx->Aq);CHKERRQ(ierr); ierr = PetscFree(ctx->Bq);CHKERRQ(ierr); ierr = PetscMalloc(ncv*ncv*sizeof(PetscScalar),&ctx->Bq);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,2*ncv*ncv*sizeof(PetscScalar));CHKERRQ(ierr); if (!((PetscObject)(eps->st))->type_name) { /* default to shift-and-invert */ ierr = STSetType(eps->st,STSINVERT);CHKERRQ(ierr); } ierr = PetscObjectTypeCompareAny((PetscObject)eps->st,&issinv,STSINVERT,STCAYLEY,"");CHKERRQ(ierr); if (!issinv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Shift-and-invert or Cayley ST is needed for FEAST"); if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } if (eps->which!=EPS_ALL || (eps->inta==0.0 && eps->intb==0.0)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"FEAST must be used with a computational interval"); if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"FEAST only available for symmetric/Hermitian eigenproblems"); if (eps->balance!=EPS_BALANCE_NONE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Balancing not supported in the Arpack interface"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); if (!ctx->npoints) ctx->npoints = 8; ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_FEAST; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_FEAST" PetscErrorCode EPSSolve_FEAST(EPS eps) { PetscErrorCode ierr; EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscBLASInt n,fpm[64],ijob,info,nev,ncv,loop; PetscReal *evals,epsout; PetscInt i,k,nmat; PetscScalar *pV,Ze; Vec x,y,w = eps->work[0]; Mat A,B; PetscFunctionBegin; ierr = PetscBLASIntCast(eps->nev,&nev);CHKERRQ(ierr); ierr = PetscBLASIntCast(eps->ncv,&ncv);CHKERRQ(ierr); ierr = PetscBLASIntCast(eps->nloc,&n);CHKERRQ(ierr); /* parameters */ FEASTinit_(fpm); fpm[0] = (eps->numbermonitors>0)? 1: 0; /* runtime comments */ fpm[1] = ctx->npoints; /* contour points */ ierr = PetscBLASIntCast(eps->max_it,&fpm[3]);CHKERRQ(ierr); /* refinement loops */ #if !defined(PETSC_HAVE_MPIUNI) ierr = PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&fpm[8]);CHKERRQ(ierr); #endif ierr = PetscMalloc(eps->ncv*sizeof(PetscReal),&evals);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&x);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&y);CHKERRQ(ierr); ierr = VecGetArray(eps->V[0],&pV);CHKERRQ(ierr); ijob = -1; /* first call to reverse communication interface */ ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } else B = NULL; do { PetscStackCall("FEASTrci",FEASTrci_(&ijob,&n,&Ze,ctx->work1,ctx->work2,ctx->Aq,ctx->Bq,fpm,&epsout,&loop,&eps->inta,&eps->intb,&eps->ncv,evals,pV,&eps->nconv,eps->errest,&info)); if (ncv!=eps->ncv) SETERRQ1(PetscObjectComm((PetscObject)eps),1,"FEAST changed value of ncv to %d",ncv); if (ijob == 10 || ijob == 20) { /* set new quadrature point */ ierr = STSetShift(eps->st,-Ze);CHKERRQ(ierr); } else if (ijob == 11 || ijob == 21) { /* linear solve (A-sigma*B)\work2, overwrite work2 */ for (k=0;kwork2+eps->nloc*k);CHKERRQ(ierr); if (ijob == 11) { ierr = STMatSolve(eps->st,1,x,w);CHKERRQ(ierr); } else { ierr = STMatSolveTranspose(eps->st,1,x,w);CHKERRQ(ierr); } ierr = VecCopy(w,x);CHKERRQ(ierr); ierr = VecScale(x,-1.0);CHKERRQ(ierr); ierr = VecResetArray(x);CHKERRQ(ierr); } } else if (ijob == 30 || ijob == 40) { /* multiplication A*V or B*V, result in work1 */ for (k=0;knloc]);CHKERRQ(ierr); ierr = VecPlaceArray(y,&ctx->work1[(fpm[23]+k-1)*eps->nloc]);CHKERRQ(ierr); if (ijob == 30) { ierr = MatMult(A,x,y);CHKERRQ(ierr); } else if (nmat>1) { ierr = MatMult(B,x,y);CHKERRQ(ierr); } else { ierr = VecCopy(x,y);CHKERRQ(ierr); } ierr = VecResetArray(x);CHKERRQ(ierr); ierr = VecResetArray(y);CHKERRQ(ierr); } } else if (ijob != 0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Internal error in FEAST reverse comunication interface (ijob=%d)",ijob); } while (ijob != 0); eps->reason = EPS_CONVERGED_TOL; eps->its = loop; if (info!=0) { if (info==1) { /* No eigenvalue has been found in the proposed search interval */ eps->nconv = 0; } else if (info==2) { /* FEAST did not converge "yet" */ eps->reason = EPS_DIVERGED_ITS; } else SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error reported by FEAST (%d)",info); } for (i=0;inconv;i++) eps->eigr[i] = evals[i]; ierr = VecRestoreArray(eps->V[0],&pV);CHKERRQ(ierr); ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); ierr = PetscFree(evals);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_FEAST" PetscErrorCode EPSReset_FEAST(EPS eps) { PetscErrorCode ierr; EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscFunctionBegin; ierr = PetscFree(ctx->work1);CHKERRQ(ierr); ierr = PetscFree(ctx->work2);CHKERRQ(ierr); ierr = PetscFree(ctx->Aq);CHKERRQ(ierr); ierr = PetscFree(ctx->Bq);CHKERRQ(ierr); ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_FEAST" PetscErrorCode EPSDestroy_FEAST(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTSetNumPoints_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTGetNumPoints_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_FEAST" PetscErrorCode EPSSetFromOptions_FEAST(EPS eps) { PetscErrorCode ierr; EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscInt n; PetscBool flg; PetscFunctionBegin; ierr = PetscOptionsHead("EPS FEAST Options");CHKERRQ(ierr); n = ctx->npoints; ierr = PetscOptionsInt("-eps_feast_num_points","Number of contour integration points","EPSFEASTSetNumPoints",n,&n,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSFEASTSetNumPoints(eps,n);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_FEAST" PetscErrorCode EPSView_FEAST(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscBool isascii; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," FEAST: number of contour integration points=%d\n",ctx->npoints);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSFEASTSetNumPoints_FEAST" static PetscErrorCode EPSFEASTSetNumPoints_FEAST(EPS eps,PetscInt npoints) { PetscErrorCode ierr; EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscFunctionBegin; if (npoints == PETSC_DEFAULT) ctx->npoints = 8; else { ierr = PetscBLASIntCast(npoints,&ctx->npoints);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSFEASTSetNumPoints" /*@ EPSFEASTSetNumPoints - Sets the number of contour integration points for the FEAST package. Collective on EPS Input Parameters: + eps - the eigenproblem solver context - npoints - number of contour integration points Options Database Key: . -eps_feast_num_points - Sets the number of points Level: advanced .seealso: EPSFEASTGetNumPoints() @*/ PetscErrorCode EPSFEASTSetNumPoints(EPS eps,PetscInt npoints) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,npoints,2); ierr = PetscTryMethod(eps,"EPSFEASTSetNumPoints_C",(EPS,PetscInt),(eps,npoints));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSFEASTGetNumPoints_FEAST" static PetscErrorCode EPSFEASTGetNumPoints_FEAST(EPS eps,PetscInt *npoints) { EPS_FEAST *ctx = (EPS_FEAST*)eps->data; PetscFunctionBegin; if (npoints) *npoints = ctx->npoints; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSFEASTGetNumPoints" /*@ EPSFEASTGetNumPoints - Gets the number of contour integration points for the FEAST package. Collective on EPS Input Parameter: . eps - the eigenproblem solver context Output Parameter: - npoints - number of contour integration points Level: advanced .seealso: EPSFEASTSetNumPoints() @*/ PetscErrorCode EPSFEASTGetNumPoints(EPS eps,PetscInt *npoints) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSFEASTSetNumPoints_C",(EPS,PetscInt*),(eps,npoints));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_FEAST" PETSC_EXTERN PetscErrorCode EPSCreate_FEAST(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_FEAST,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_FEAST; eps->ops->setfromoptions = EPSSetFromOptions_FEAST; eps->ops->destroy = EPSDestroy_FEAST; eps->ops->reset = EPSReset_FEAST; eps->ops->view = EPSView_FEAST; eps->ops->computevectors = EPSComputeVectors_Default; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTSetNumPoints_C",EPSFEASTSetNumPoints_FEAST);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTGetNumPoints_C",EPSFEASTGetNumPoints_FEAST);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/feastp.h.html0000644000175000017500000001705012211062077023462 0ustar gladkgladk

Actual source code: feastp.h

  1: /*
  2:    Private data structure used by the FEAST interface

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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


 27: typedef struct {
 28:   PetscScalar  *work1,*work2,*Aq,*Bq;   /* workspace */
 29:   PetscBLASInt npoints;                 /* number of contour points */
 30: } EPS_FEAST;

 32: /*
 33:    Definition of routines from the FEAST package
 34: */

 36: #if defined(SLEPC_FEAST_HAVE_UNDERSCORE)
 37: #define SLEPC_FEAST(lcase,ucase) lcase##_
 38: #elif defined(SLEPC_FEAST_HAVE_CAPS)
 39: #define SLEPC_FEAST(lcase,ucase) ucase
 40: #else
 41: #define SLEPC_FEAST(lcase,ucase) lcase
 42: #endif

 44: #if defined(PETSC_USE_COMPLEX)

 46: #if defined(PETSC_USE_REAL_SINGLE)

 48: #if defined(SLEPC_FEAST_HAVE_UNDERSCORE)
 49: #define SLEPC_FEASTM(lcase,ucase) cfeast_h##lcase##_
 50: #elif defined(SLEPC_FEAST_HAVE_CAPS)
 51: #define SLEPC_FEASTM(lcase,ucase) CFEAST_H##ucase
 52: #else
 53: #define SLEPC_FEASTM(lcase,ucase) cfeast_h##lcase
 54: #endif

 56: #else

 58: #if defined(SLEPC_FEAST_HAVE_UNDERSCORE)
 59: #define SLEPC_FEASTM(lcase,ucase) zfeast_h##lcase##_
 60: #elif defined(SLEPC_FEAST_HAVE_CAPS)
 61: #define SLEPC_FEASTM(lcase,ucase) ZFEAST_H##ucase
 62: #else
 63: #define SLEPC_FEASTM(lcase,ucase) zfeast_h##lcase
 64: #endif

 66: #endif

 68: #else

 70: #if defined(PETSC_USE_REAL_SINGLE)

 72: #if defined(SLEPC_FEAST_HAVE_UNDERSCORE)
 73: #define SLEPC_FEASTM(lcase,ucase) sfeast_s##lcase##_
 74: #elif defined(SLEPC_FEAST_HAVE_CAPS)
 75: #define SLEPC_FEASTM(lcase,ucase) SFEAST_S##ucase
 76: #else
 77: #define SLEPC_FEASTM(lcase,ucase) sfeast_s##lcase
 78: #endif

 80: #else

 82: #if defined(SLEPC_FEAST_HAVE_UNDERSCORE)
 83: #define SLEPC_FEASTM(lcase,ucase) dfeast_s##lcase##_
 84: #elif defined(SLEPC_FEAST_HAVE_CAPS)
 85: #define SLEPC_FEASTM(lcase,ucase) DFEAST_S##ucase
 86: #else
 87: #define SLEPC_FEASTM(lcase,ucase) dfeast_s##lcase
 88: #endif

 90: #endif

 92: #endif

 94: #define FEASTinit_(a) SLEPC_FEAST(feastinit,FEASTINIT) ((a))
 95: #define FEASTrci_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) SLEPC_FEASTM(rci,RCI) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r))

 97: PETSC_EXTERN void   SLEPC_FEAST(feastinit,FEASTINIT)(PetscBLASInt*);
 98: PETSC_EXTERN void   SLEPC_FEASTM(rci,RCI)(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);

100: #endif

slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/ftn-auto/0000755000175000017500000000000012214143515022616 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/ftn-auto/makefile0000644000175000017500000000035312211062077024317 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = feastf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/external/feast/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/ftn-auto/feastf.c0000644000175000017500000000261612211062077024237 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* feast.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsfeastsetnumpoints_ EPSFEASTSETNUMPOINTS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsfeastsetnumpoints_ epsfeastsetnumpoints #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsfeastgetnumpoints_ EPSFEASTGETNUMPOINTS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsfeastgetnumpoints_ epsfeastgetnumpoints #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsfeastsetnumpoints_(EPS *eps,PetscInt *npoints, int *__ierr ){ *__ierr = EPSFEASTSetNumPoints(*eps,*npoints); } void PETSC_STDCALL epsfeastgetnumpoints_(EPS *eps,PetscInt *npoints, int *__ierr ){ *__ierr = EPSFEASTGetNumPoints(*eps,npoints); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/feast/feast.c.html0000644000175000017500000006172712211062077023307 0ustar gladkgladk
Actual source code: feast.c

  1: /*
  2:    This file implements a wrapper to the FEAST package

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>        /*I "slepceps.h" I*/
 25: #include <../src/eps/impls/external/feast/feastp.h>

 27: PetscErrorCode EPSSolve_FEAST(EPS);

 31: PetscErrorCode EPSSetUp_FEAST(EPS eps)
 32: {
 34:   PetscInt       ncv;
 35:   PetscBool      issinv;
 36:   EPS_FEAST      *ctx = (EPS_FEAST*)eps->data;
 37:   PetscMPIInt    size;

 40:   MPI_Comm_size(PetscObjectComm((PetscObject)eps),&size);
 41:   if (size!=1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"The FEAST interface is supported for sequential runs only");
 42:   if (eps->ncv) {
 43:     if (eps->ncv<eps->nev+2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"The value of ncv must be at least nev+2");
 44:   } else eps->ncv = PetscMin(PetscMax(20,2*eps->nev+1),eps->n); /* set default value of ncv */
 45:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
 46:   if (!eps->max_it) eps->max_it = PetscMax(300,(PetscInt)(2*eps->n/eps->ncv));
 47:   if (!eps->which) eps->which = EPS_ALL;

 49:   ncv = eps->ncv;
 50:   PetscFree(ctx->work1);
 51:   PetscMalloc(eps->nloc*ncv*sizeof(PetscScalar),&ctx->work1);
 52:   PetscFree(ctx->work2);
 53:   PetscMalloc(eps->nloc*ncv*sizeof(PetscScalar),&ctx->work2);
 54:   PetscLogObjectMemory(eps,2*eps->nloc*ncv*sizeof(PetscScalar));
 55:   PetscFree(ctx->Aq);
 56:   PetscMalloc(ncv*ncv*sizeof(PetscScalar),&ctx->Aq);
 57:   PetscFree(ctx->Bq);
 58:   PetscMalloc(ncv*ncv*sizeof(PetscScalar),&ctx->Bq);
 59:   PetscLogObjectMemory(eps,2*ncv*ncv*sizeof(PetscScalar));

 61:   if (!((PetscObject)(eps->st))->type_name) { /* default to shift-and-invert */
 62:     STSetType(eps->st,STSINVERT);
 63:   }
 64:   PetscObjectTypeCompareAny((PetscObject)eps->st,&issinv,STSINVERT,STCAYLEY,"");
 65:   if (!issinv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Shift-and-invert or Cayley ST is needed for FEAST");

 67:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

 69:   if (eps->which!=EPS_ALL || (eps->inta==0.0 && eps->intb==0.0)) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"FEAST must be used with a computational interval");
 70:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"FEAST only available for symmetric/Hermitian eigenproblems");
 71:   if (eps->balance!=EPS_BALANCE_NONE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Balancing not supported in the Arpack interface");
 72:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

 74:   if (!ctx->npoints) ctx->npoints = 8;

 76:   EPSAllocateSolution(eps);
 77:   EPSSetWorkVecs(eps,1);

 79:   /* dispatch solve method */
 80:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
 81:   eps->ops->solve = EPSSolve_FEAST;
 82:   return(0);
 83: }

 87: PetscErrorCode EPSSolve_FEAST(EPS eps)
 88: {
 90:   EPS_FEAST      *ctx = (EPS_FEAST*)eps->data;
 91:   PetscBLASInt   n,fpm[64],ijob,info,nev,ncv,loop;
 92:   PetscReal      *evals,epsout;
 93:   PetscInt       i,k,nmat;
 94:   PetscScalar    *pV,Ze;
 95:   Vec            x,y,w = eps->work[0];
 96:   Mat            A,B;

 99:   PetscBLASIntCast(eps->nev,&nev);
100:   PetscBLASIntCast(eps->ncv,&ncv);
101:   PetscBLASIntCast(eps->nloc,&n);

103:   /* parameters */
104:   FEASTinit_(fpm);
105:   fpm[0] = (eps->numbermonitors>0)? 1: 0;                      /* runtime comments */
106:   fpm[1] = ctx->npoints;                                       /* contour points */
107:   PetscBLASIntCast(eps->max_it,&fpm[3]);  /* refinement loops */
108: #if !defined(PETSC_HAVE_MPIUNI)
109:   PetscBLASIntCast(MPI_Comm_c2f(PetscObjectComm((PetscObject)eps)),&fpm[8]);
110: #endif

112:   PetscMalloc(eps->ncv*sizeof(PetscReal),&evals);
113:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&x);
114:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,PETSC_DECIDE,NULL,&y);
115:   VecGetArray(eps->V[0],&pV);

117:   ijob = -1;           /* first call to reverse communication interface */
118:   STGetNumMatrices(eps->st,&nmat);
119:   STGetOperators(eps->st,0,&A);
120:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
121:   else B = NULL;

123:   do {

125:     PetscStackCall("FEASTrci",FEASTrci_(&ijob,&n,&Ze,ctx->work1,ctx->work2,ctx->Aq,ctx->Bq,fpm,&epsout,&loop,&eps->inta,&eps->intb,&eps->ncv,evals,pV,&eps->nconv,eps->errest,&info));

127:     if (ncv!=eps->ncv) SETERRQ1(PetscObjectComm((PetscObject)eps),1,"FEAST changed value of ncv to %d",ncv);
128:     if (ijob == 10 || ijob == 20) {
129:       /* set new quadrature point */
130:       STSetShift(eps->st,-Ze);
131:     } else if (ijob == 11 || ijob == 21) {
132:       /* linear solve (A-sigma*B)\work2, overwrite work2 */
133:       for (k=0;k<ncv;k++) {
134:         VecPlaceArray(x,ctx->work2+eps->nloc*k);
135:         if (ijob == 11) {
136:           STMatSolve(eps->st,1,x,w);
137:         } else {
138:           STMatSolveTranspose(eps->st,1,x,w);
139:         }
140:         VecCopy(w,x);
141:         VecScale(x,-1.0);
142:         VecResetArray(x);
143:       }
144:     } else if (ijob == 30 || ijob == 40) {
145:       /* multiplication A*V or B*V, result in work1 */
146:       for (k=0;k<fpm[24];k++) {
147:         VecPlaceArray(x,&pV[(fpm[23]+k-1)*eps->nloc]);
148:         VecPlaceArray(y,&ctx->work1[(fpm[23]+k-1)*eps->nloc]);
149:         if (ijob == 30) {
150:           MatMult(A,x,y);
151:         } else if (nmat>1) {
152:           MatMult(B,x,y);
153:         } else {
154:           VecCopy(x,y);
155:         }
156:         VecResetArray(x);
157:         VecResetArray(y);
158:       }
159:     } else if (ijob != 0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Internal error in FEAST reverse comunication interface (ijob=%d)",ijob);

161:   } while (ijob != 0);

163:   eps->reason = EPS_CONVERGED_TOL;
164:   eps->its = loop;
165:   if (info!=0) {
166:     if (info==1) { /* No eigenvalue has been found in the proposed search interval */
167:       eps->nconv = 0;
168:     } else if (info==2) { /* FEAST did not converge "yet" */
169:       eps->reason = EPS_DIVERGED_ITS;
170:     } else SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error reported by FEAST (%d)",info);
171:   }

173:   for (i=0;i<eps->nconv;i++) eps->eigr[i] = evals[i];

175:   VecRestoreArray(eps->V[0],&pV);
176:   VecDestroy(&x);
177:   VecDestroy(&y);
178:   PetscFree(evals);
179:   return(0);
180: }

184: PetscErrorCode EPSReset_FEAST(EPS eps)
185: {
187:   EPS_FEAST      *ctx = (EPS_FEAST*)eps->data;

190:   PetscFree(ctx->work1);
191:   PetscFree(ctx->work2);
192:   PetscFree(ctx->Aq);
193:   PetscFree(ctx->Bq);
194:   EPSReset_Default(eps);
195:   return(0);
196: }

200: PetscErrorCode EPSDestroy_FEAST(EPS eps)
201: {

205:   PetscFree(eps->data);
206:   PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTSetNumPoints_C",NULL);
207:   PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTGetNumPoints_C",NULL);
208:   return(0);
209: }

213: PetscErrorCode EPSSetFromOptions_FEAST(EPS eps)
214: {
216:   EPS_FEAST      *ctx = (EPS_FEAST*)eps->data;
217:   PetscInt       n;
218:   PetscBool      flg;

221:   PetscOptionsHead("EPS FEAST Options");

223:   n = ctx->npoints;
224:   PetscOptionsInt("-eps_feast_num_points","Number of contour integration points","EPSFEASTSetNumPoints",n,&n,&flg);
225:   if (flg) {
226:     EPSFEASTSetNumPoints(eps,n);
227:   }

229:   PetscOptionsTail();
230:   return(0);
231: }

235: PetscErrorCode EPSView_FEAST(EPS eps,PetscViewer viewer)
236: {
238:   EPS_FEAST      *ctx = (EPS_FEAST*)eps->data;
239:   PetscBool      isascii;

242:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
243:   if (isascii) {
244:     PetscViewerASCIIPrintf(viewer,"  FEAST: number of contour integration points=%d\n",ctx->npoints);
245:   }
246:   return(0);
247: }

251: static PetscErrorCode EPSFEASTSetNumPoints_FEAST(EPS eps,PetscInt npoints)
252: {
254:   EPS_FEAST      *ctx = (EPS_FEAST*)eps->data;

257:   if (npoints == PETSC_DEFAULT) ctx->npoints = 8;
258:   else {
259:     PetscBLASIntCast(npoints,&ctx->npoints);
260:   }
261:   return(0);
262: }

266: /*@
267:    EPSFEASTSetNumPoints - Sets the number of contour integration points for
268:    the FEAST package.

270:    Collective on EPS

272:    Input Parameters:
273: +  eps     - the eigenproblem solver context
274: -  npoints - number of contour integration points

276:    Options Database Key:
277: .  -eps_feast_num_points - Sets the number of points

279:    Level: advanced

281: .seealso: EPSFEASTGetNumPoints()
282: @*/
283: PetscErrorCode EPSFEASTSetNumPoints(EPS eps,PetscInt npoints)
284: {

290:   PetscTryMethod(eps,"EPSFEASTSetNumPoints_C",(EPS,PetscInt),(eps,npoints));
291:   return(0);
292: }

296: static PetscErrorCode EPSFEASTGetNumPoints_FEAST(EPS eps,PetscInt *npoints)
297: {
298:   EPS_FEAST *ctx = (EPS_FEAST*)eps->data;

301:   if (npoints) *npoints = ctx->npoints;
302:   return(0);
303: }

307: /*@
308:    EPSFEASTGetNumPoints - Gets the number of contour integration points for
309:    the FEAST package.

311:    Collective on EPS

313:    Input Parameter:
314: .  eps     - the eigenproblem solver context

316:    Output Parameter:
317: -  npoints - number of contour integration points

319:    Level: advanced

321: .seealso: EPSFEASTSetNumPoints()
322: @*/
323: PetscErrorCode EPSFEASTGetNumPoints(EPS eps,PetscInt *npoints)
324: {

329:   PetscTryMethod(eps,"EPSFEASTSetNumPoints_C",(EPS,PetscInt*),(eps,npoints));
330:   return(0);
331: }

335: PETSC_EXTERN PetscErrorCode EPSCreate_FEAST(EPS eps)
336: {

340:   PetscNewLog(eps,EPS_FEAST,&eps->data);
341:   eps->ops->setup                = EPSSetUp_FEAST;
342:   eps->ops->setfromoptions       = EPSSetFromOptions_FEAST;
343:   eps->ops->destroy              = EPSDestroy_FEAST;
344:   eps->ops->reset                = EPSReset_FEAST;
345:   eps->ops->view                 = EPSView_FEAST;
346:   eps->ops->computevectors       = EPSComputeVectors_Default;
347:   PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTSetNumPoints_C",EPSFEASTSetNumPoints_FEAST);
348:   PetscObjectComposeFunction((PetscObject)eps,"EPSFEASTGetNumPoints_C",EPSFEASTGetNumPoints_FEAST);
349:   return(0);
350: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/makefile0000644000175000017500000000211412211062077021455 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = arpack blopex blzpack primme trlan feast LOCDIR = src/eps/impls/external/ MANSEC = EPS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/makefile.html0000644000175000017500000000371012211062077022423 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = arpack blopex blzpack primme trlan feast
LOCDIR   = src/eps/impls/external/
MANSEC   = EPS

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/index.html0000644000175000017500000000237112211062077021757 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

arpack/
blopex/
blzpack/
primme/
trlan/
feast/
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/0000755000175000017500000000000012214143515021250 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/petsc-interface.c.html0000644000175000017500000003337112211062077025442 0ustar gladkgladk

Actual source code: petsc-interface.c

  1: /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
  2: /* @@@ BLOPEX (version 1.1) LGPL Version 2.1 or above.See www.gnu.org. */
  3: /* @@@ Copyright 2010 BLOPEX team http://code.google.com/p/blopex/     */
  4: /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
  5: /* This code was developed by Merico Argentati, Andrew Knyazev, Ilya Lashuk and Evgueni Ovtchinnikov */

  7: #include <petscvec.h>
  8: #include <petscblaslapack.h>
  9: #include "blopex_interpreter.h"
 10: #include "blopex_temp_multivector.h"

 12: static PetscRandom LOBPCG_RandomContext = NULL;

 14: typedef struct {
 15:   double real,imag;
 16: } komplex;

 18: BlopexInt PETSC_dpotrf_interface (char *uplo,BlopexInt *n,double *a,BlopexInt * lda,BlopexInt *info)
 19: {
 20:   PetscBLASInt n_,lda_,info_;

 22:   /* type conversion */
 23:   n_ = *n;
 24:   lda_ = *lda;
 25:   info_ = *info;

 27:   LAPACKpotrf_(uplo,&n_,(PetscScalar*)a,&lda_,&info_);

 29:   *info = info_;
 30:   return 0;
 31: }

 33: BlopexInt PETSC_zpotrf_interface (char *uplo,BlopexInt *n,komplex *a,BlopexInt* lda,BlopexInt *info)
 34: {
 35:   PetscBLASInt n_,lda_,info_;

 37:   /* type conversion */
 38:   n_ = *n;
 39:   lda_ = (PetscBLASInt)*lda;

 41:   LAPACKpotrf_(uplo,&n_,(PetscScalar*)a,&lda_,&info_);

 43:   *info = info_;
 44:   return 0;
 45: }

 47: BlopexInt PETSC_dsygv_interface (BlopexInt *itype,char *jobz,char *uplo,BlopexInt *n,double *a,BlopexInt *lda,double *b,BlopexInt *ldb,double *w,double *work,BlopexInt *lwork,BlopexInt *info)
 48: {
 49: #if !defined(PETSC_USE_COMPLEX)
 50:   PetscBLASInt itype_,n_,lda_,ldb_,lwork_,info_;

 52:   itype_ = *itype;
 53:   n_ = *n;
 54:   lda_ = *lda;
 55:   ldb_ = *ldb;
 56:   lwork_ = *lwork;
 57:   info_ = *info;

 59:   LAPACKsygv_(&itype_,jobz,uplo,&n_,(PetscScalar*)a,&lda_,(PetscScalar*)b,&ldb_,(PetscScalar*)w,(PetscScalar*)work,&lwork_,&info_);

 61:   *info = info_;
 62: #endif
 63:   return 0;
 64: }

 66: BlopexInt PETSC_zsygv_interface (BlopexInt *itype,char *jobz,char *uplo,BlopexInt *n,komplex *a,BlopexInt *lda,komplex *b,BlopexInt *ldb,double *w,komplex *work,BlopexInt *lwork,double *rwork,BlopexInt *info)
 67: {
 68: #if defined(PETSC_USE_COMPLEX)
 69:   PetscBLASInt itype_,n_,lda_,ldb_,lwork_,info_;

 71:   itype_ = *itype;
 72:   n_ = *n;
 73:   lda_ = *lda;
 74:   ldb_ = *ldb;
 75:   lwork_ = *lwork;
 76:   info_ = *info;

 78:   LAPACKsygv_(&itype_,jobz,uplo,&n_,(PetscScalar*)a,&lda_,(PetscScalar*)b,&ldb_,(PetscReal*)w,(PetscScalar*)work,&lwork_,(PetscReal*)rwork,&info_);

 80:   *info = info_;
 81: #endif
 82:   return 0;
 83: }

 85: void *PETSC_MimicVector(void *vvector)
 86: {
 87:   PetscErrorCode  ierr;
 88:   Vec temp;

 90:   VecDuplicate((Vec)vvector,&temp);CHKERRABORT(PETSC_COMM_SELF,ierr);
 91:   return (void*)temp;
 92: }

 94: BlopexInt PETSC_DestroyVector(void *vvector)
 95: {
 97:   Vec v = (Vec)vvector;

 99:   VecDestroy(&v);
100:   return 0;
101: }

103: BlopexInt PETSC_InnerProd(void *x,void *y,void *result)
104: {

107:   VecDot((Vec)x,(Vec)y,(PetscScalar*)result);
108:   return 0;
109: }

111: BlopexInt PETSC_CopyVector(void *x,void *y)
112: {
113:   PetscErrorCode  ierr;

115:   VecCopy((Vec)x,(Vec)y);
116:   return 0;
117: }

119: BlopexInt PETSC_ClearVector(void *x)
120: {
121:   PetscErrorCode  ierr;

123:   VecSet((Vec)x,0.0);
124:   return 0;
125: }

127: BlopexInt PETSC_SetRandomValues(void* v,BlopexInt seed)
128: {

131:   /* note: without previous call to LOBPCG_InitRandomContext LOBPCG_RandomContext will be null,
132:     and VecSetRandom will use internal petsc random context */

134:   VecSetRandom((Vec)v,LOBPCG_RandomContext);
135:   return 0;
136: }

138: BlopexInt PETSC_ScaleVector(double alpha,void *x)
139: {

142:   VecScale((Vec)x,alpha);
143:   return 0;
144: }

146: BlopexInt PETSC_Axpy(void *alpha,void *x,void *y)
147: {

150:   VecAXPY((Vec)y,*(PetscScalar*)alpha,(Vec)x);
151:   return 0;
152: }

154: BlopexInt PETSC_VectorSize(void *x)
155: {
156:   PetscInt N;
157:   VecGetSize((Vec)x,&N);
158:   return N;
159: }

161: int LOBPCG_InitRandomContext(MPI_Comm comm,PetscRandom rand)
162: {
164:   /* PetscScalar rnd_bound = 1.0; */

166:   if (rand) {
167:     PetscObjectReference((PetscObject)rand);
168:     PetscRandomDestroy(&LOBPCG_RandomContext);
169:     LOBPCG_RandomContext = rand;
170:   } else {
171:     PetscRandomCreate(comm,&LOBPCG_RandomContext);
172:   }
173:   return 0;
174: }

176: int LOBPCG_SetFromOptionsRandomContext(void)
177: {
179:   PetscRandomSetFromOptions(LOBPCG_RandomContext);

181: #if defined(PETSC_USE_COMPLEX)
182:   PetscRandomSetInterval(LOBPCG_RandomContext,(PetscScalar)-1.0-1.0*PETSC_i,(PetscScalar)1.0+1.0*PETSC_i);
183: #else
184:   PetscRandomSetInterval(LOBPCG_RandomContext,(PetscScalar)-1.0,(PetscScalar)1.0);
185: #endif
186:   return 0;
187: }

189: int LOBPCG_DestroyRandomContext(void)
190: {

193:   PetscRandomDestroy(&LOBPCG_RandomContext);
194:   return 0;
195: }

197: int PETSCSetupInterpreter(mv_InterfaceInterpreter *i)
198: {
199:   i->CreateVector = PETSC_MimicVector;
200:   i->DestroyVector = PETSC_DestroyVector;
201:   i->InnerProd = PETSC_InnerProd;
202:   i->CopyVector = PETSC_CopyVector;
203:   i->ClearVector = PETSC_ClearVector;
204:   i->SetRandomValues = PETSC_SetRandomValues;
205:   i->ScaleVector = PETSC_ScaleVector;
206:   i->Axpy = PETSC_Axpy;
207:   i->VectorSize = PETSC_VectorSize;

209:   /* Multivector part */

211:   i->CreateMultiVector = mv_TempMultiVectorCreateFromSampleVector;
212:   i->CopyCreateMultiVector = mv_TempMultiVectorCreateCopy;
213:   i->DestroyMultiVector = mv_TempMultiVectorDestroy;

215:   i->Width = mv_TempMultiVectorWidth;
216:   i->Height = mv_TempMultiVectorHeight;
217:   i->SetMask = mv_TempMultiVectorSetMask;
218:   i->CopyMultiVector = mv_TempMultiVectorCopy;
219:   i->ClearMultiVector = mv_TempMultiVectorClear;
220:   i->SetRandomVectors = mv_TempMultiVectorSetRandom;
221:   i->Eval = mv_TempMultiVectorEval;

223: #if defined(PETSC_USE_COMPLEX)
224:   i->MultiInnerProd = mv_TempMultiVectorByMultiVector_complex;
225:   i->MultiInnerProdDiag = mv_TempMultiVectorByMultiVectorDiag_complex;
226:   i->MultiVecMat = mv_TempMultiVectorByMatrix_complex;
227:   i->MultiVecMatDiag = mv_TempMultiVectorByDiagonal_complex;
228:   i->MultiAxpy = mv_TempMultiVectorAxpy_complex;
229:   i->MultiXapy = mv_TempMultiVectorXapy_complex;
230: #else
231:   i->MultiInnerProd = mv_TempMultiVectorByMultiVector;
232:   i->MultiInnerProdDiag = mv_TempMultiVectorByMultiVectorDiag;
233:   i->MultiVecMat = mv_TempMultiVectorByMatrix;
234:   i->MultiVecMatDiag = mv_TempMultiVectorByDiagonal;
235:   i->MultiAxpy = mv_TempMultiVectorAxpy;
236:   i->MultiXapy = mv_TempMultiVectorXapy;
237: #endif

239:   return 0;
240: }
slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/slepc-interface.c.html0000644000175000017500000001477012211062077025434 0ustar gladkgladk
Actual source code: slepc-interface.c

  1: /*
  2:    Modification of the *temp* implementation of the BLOPEX multivector in order
  3:    to wrap created PETSc vectors as multivectors.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <petscvec.h>
 26: #include <stdlib.h>
 27: #include <blopex_interpreter.h>
 28: #include <blopex_temp_multivector.h>
 29: #include "slepc-interface.h"

 31: static void* mv_TempMultiVectorCreateFromPETScVector(void* ii_,BlopexInt n,void* sample)
 32: {
 33:   int i;
 34:   Vec *vecs = (Vec*)sample;

 36:   mv_TempMultiVector* x;
 37:   mv_InterfaceInterpreter* ii = (mv_InterfaceInterpreter*)ii_;

 39:   x = (mv_TempMultiVector*)malloc(sizeof(mv_TempMultiVector));
 40:   if (!x) SETERRABORT(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Allocation for x failed");

 42:   x->interpreter = ii;
 43:   x->numVectors = n;

 45:   x->vector = (void**)calloc(n,sizeof(void*));
 46:   if (!x->vector) SETERRABORT(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Allocation for x->vector failed");

 48:   x->ownsVectors = 1;
 49:   x->mask = NULL;
 50:   x->ownsMask = 0;

 52:   for (i=0;i<n;i++) {
 53:     x->vector[i] = (void*)vecs[i];
 54:   }
 55:   return x;
 56: }

 58: static void mv_TempMultiPETSCVectorDestroy(void* x_)
 59: {
 60:   mv_TempMultiVector* x = (mv_TempMultiVector*)x_;

 62:   if (!x) return;

 64:   if (x->ownsVectors && x->vector) free(x->vector);
 65:   if (x->mask && x->ownsMask) free(x->mask);
 66:   free(x);
 67: }

 69: /*
 70:     Create an InterfaceInterpreter using the PETSc implementation
 71:     but overloading CreateMultiVector that doesn't create any
 72:     new vector.
 73: */
 74: int SLEPCSetupInterpreter(mv_InterfaceInterpreter *i)
 75: {
 76:   PETSCSetupInterpreter(i);
 77:   i->CreateMultiVector = mv_TempMultiVectorCreateFromPETScVector;

 79:   return 0;
 80: }

 82: /*
 83:     Change the multivector destructor in order to destroy the multivector
 84:     structure without destroy the PETSc vectors.
 85: */
 86: void SLEPCSetupInterpreterForDignifiedDeath(mv_InterfaceInterpreter *i)
 87: {
 88:   i->DestroyMultiVector = mv_TempMultiPETSCVectorDestroy;
 89: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/blopex.c0000644000175000017500000003001112211062077022700 0ustar gladkgladk/* This file implements a wrapper to the BLOPEX package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include /*I "slepcst.h" I*/ #include "slepc-interface.h" #include #include #include #include PetscErrorCode EPSSolve_BLOPEX(EPS); typedef struct { lobpcg_Tolerance tol; lobpcg_BLASLAPACKFunctions blap_fn; mv_MultiVectorPtr eigenvectors; mv_MultiVectorPtr Y; mv_InterfaceInterpreter ii; ST st; Vec w; } EPS_BLOPEX; #undef __FUNCT__ #define __FUNCT__ "Precond_FnSingleVector" static void Precond_FnSingleVector(void *data,void *x,void *y) { PetscErrorCode ierr; EPS eps = (EPS)data; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscFunctionBegin; ierr = KSPSolve(blopex->st->ksp,(Vec)x,(Vec)y);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "Precond_FnMultiVector" static void Precond_FnMultiVector(void *data,void *x,void *y) { EPS eps = (EPS)data; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscFunctionBegin; blopex->ii.Eval(Precond_FnSingleVector,data,x,y); PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "OperatorASingleVector" static void OperatorASingleVector(void *data,void *x,void *y) { PetscErrorCode ierr; EPS eps = (EPS)data; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; Mat A,B; PetscScalar sigma; PetscInt nmat; PetscFunctionBegin; ierr = STGetNumMatrices(eps->st,&nmat);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); } ierr = MatMult(A,(Vec)x,(Vec)y);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); ierr = STGetShift(eps->st,&sigma);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); if (sigma != 0.0) { if (nmat>1) { ierr = MatMult(B,(Vec)x,blopex->w);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); } else { ierr = VecCopy((Vec)x,blopex->w);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); } ierr = VecAXPY((Vec)y,-sigma,blopex->w);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); } PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "OperatorAMultiVector" static void OperatorAMultiVector(void *data,void *x,void *y) { EPS eps = (EPS)data; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscFunctionBegin; blopex->ii.Eval(OperatorASingleVector,data,x,y); PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "OperatorBSingleVector" static void OperatorBSingleVector(void *data,void *x,void *y) { PetscErrorCode ierr; EPS eps = (EPS)data; Mat B; PetscFunctionBegin; ierr = STGetOperators(eps->st,1,&B);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); ierr = MatMult(B,(Vec)x,(Vec)y);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "OperatorBMultiVector" static void OperatorBMultiVector(void *data,void *x,void *y) { EPS eps = (EPS)data; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscFunctionBegin; blopex->ii.Eval(OperatorBSingleVector,data,x,y); PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_BLOPEX" PetscErrorCode EPSSetUp_BLOPEX(EPS eps) { #if defined(PETSC_MISSING_LAPACK_POTRF) || defined(PETSC_MISSING_LAPACK_SYGV) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"POTRF/SYGV - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscBool isPrecond; PetscFunctionBegin; if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"blopex only works for hermitian problems"); if (!eps->which) eps->which = EPS_SMALLEST_REAL; if (eps->which!=EPS_SMALLEST_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); /* Change the default sigma to inf if necessary */ if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL || eps->which == EPS_LARGEST_IMAGINARY) { ierr = STSetDefaultShift(eps->st,3e300);CHKERRQ(ierr); } ierr = STSetUp(eps->st);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&isPrecond);CHKERRQ(ierr); if (!isPrecond) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"blopex only works with STPRECOND"); blopex->st = eps->st; eps->ncv = eps->nev = PetscMin(eps->nev,eps->n); if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); ierr = EPSSetWorkVecs(eps,1);CHKERRQ(ierr); if (eps->converged == EPSConvergedEigRelative) { blopex->tol.absolute = 0.0; blopex->tol.relative = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol; } else if (eps->converged == EPSConvergedAbsolute) { blopex->tol.absolute = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol; blopex->tol.relative = 0.0; } else { SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Convergence test not supported in this solver"); } SLEPCSetupInterpreter(&blopex->ii); blopex->eigenvectors = mv_MultiVectorCreateFromSampleVector(&blopex->ii,eps->ncv,eps->V); for (i=0;incv;i++) { ierr = PetscObjectReference((PetscObject)eps->V[i]);CHKERRQ(ierr); } ierr = VecDuplicate(eps->V[0],&blopex->w);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,blopex->w);CHKERRQ(ierr); if (eps->nds > 0) { blopex->Y = mv_MultiVectorCreateFromSampleVector(&blopex->ii,eps->nds,eps->defl); for (i=0;inds;i++) { ierr = PetscObjectReference((PetscObject)eps->defl[i]);CHKERRQ(ierr); } } else blopex->Y = NULL; #if defined(PETSC_USE_COMPLEX) blopex->blap_fn.zpotrf = PETSC_zpotrf_interface; blopex->blap_fn.zhegv = PETSC_zsygv_interface; #else blopex->blap_fn.dpotrf = PETSC_dpotrf_interface; blopex->blap_fn.dsygv = PETSC_dsygv_interface; #endif if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_BLOPEX; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_BLOPEX" PetscErrorCode EPSSolve_BLOPEX(EPS eps) { EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscScalar sigma; int i,j,info,its,nconv; double *residhist=NULL; PetscErrorCode ierr; #if defined(PETSC_USE_COMPLEX) komplex *lambdahist=NULL; #else double *lambdahist=NULL; #endif PetscFunctionBegin; /* Complete the initial basis with random vectors */ for (i=eps->nini;incv;i++) { ierr = SlepcVecSetRandom(eps->V[i],eps->rand);CHKERRQ(ierr); } if (eps->numbermonitors>0) { #if defined(PETSC_USE_COMPLEX) ierr = PetscMalloc(eps->ncv*(eps->max_it+1)*sizeof(komplex),&lambdahist);CHKERRQ(ierr); #else ierr = PetscMalloc(eps->ncv*(eps->max_it+1)*sizeof(double),&lambdahist);CHKERRQ(ierr); #endif ierr = PetscMalloc(eps->ncv*(eps->max_it+1)*sizeof(double),&residhist);CHKERRQ(ierr); } #if defined(PETSC_USE_COMPLEX) info = lobpcg_solve_complex(blopex->eigenvectors,eps,OperatorAMultiVector, eps->isgeneralized?eps:NULL,eps->isgeneralized?OperatorBMultiVector:NULL, eps,Precond_FnMultiVector,blopex->Y, blopex->blap_fn,blopex->tol,eps->max_it,0,&its, (komplex*)eps->eigr,lambdahist,eps->ncv,eps->errest,residhist,eps->ncv); #else info = lobpcg_solve_double(blopex->eigenvectors,eps,OperatorAMultiVector, eps->isgeneralized?eps:NULL,eps->isgeneralized?OperatorBMultiVector:NULL, eps,Precond_FnMultiVector,blopex->Y, blopex->blap_fn,blopex->tol,eps->max_it,0,&its, eps->eigr,lambdahist,eps->ncv,eps->errest,residhist,eps->ncv); #endif if (info>0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error in blopex (code=%d)",info); if (eps->numbermonitors>0) { for (i=0;incv;j++) { if (residhist[j+i*eps->ncv]>eps->tol) break; else nconv++; } ierr = EPSMonitor(eps,i,nconv,(PetscScalar*)lambdahist+i*eps->ncv,eps->eigi,residhist+i*eps->ncv,eps->ncv);CHKERRQ(ierr); } ierr = PetscFree(lambdahist);CHKERRQ(ierr); ierr = PetscFree(residhist);CHKERRQ(ierr); } eps->its = its; eps->nconv = eps->ncv; ierr = STGetShift(eps->st,&sigma);CHKERRQ(ierr); if (sigma != 0.0) { for (i=0;inconv;i++) eps->eigr[i]+=sigma; } if (info==-1) eps->reason = EPS_DIVERGED_ITS; else eps->reason = EPS_CONVERGED_TOL; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_BLOPEX" PetscErrorCode EPSReset_BLOPEX(EPS eps) { PetscErrorCode ierr; EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data; PetscFunctionBegin; mv_MultiVectorDestroy(blopex->eigenvectors); mv_MultiVectorDestroy(blopex->Y); ierr = VecDestroy(&blopex->w);CHKERRQ(ierr); ierr = EPSReset_Default(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_BLOPEX" PetscErrorCode EPSDestroy_BLOPEX(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; LOBPCG_DestroyRandomContext(); ierr = PetscFree(eps->data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_BLOPEX" PetscErrorCode EPSSetFromOptions_BLOPEX(EPS eps) { PetscErrorCode ierr; KSP ksp; PetscFunctionBegin; ierr = PetscOptionsHead("EPS BLOPEX Options");CHKERRQ(ierr); LOBPCG_SetFromOptionsRandomContext(); /* Set STPrecond as the default ST */ if (!((PetscObject)eps->st)->type_name) { ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); } ierr = STPrecondSetKSPHasMat(eps->st,PETSC_TRUE);CHKERRQ(ierr); /* Set the default options of the KSP */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); if (!((PetscObject)ksp)->type_name) { ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_BLOPEX" PETSC_EXTERN PetscErrorCode EPSCreate_BLOPEX(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_BLOPEX,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_BLOPEX; eps->ops->setfromoptions = EPSSetFromOptions_BLOPEX; eps->ops->destroy = EPSDestroy_BLOPEX; eps->ops->reset = EPSReset_BLOPEX; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Default; LOBPCG_InitRandomContext(PetscObjectComm((PetscObject)eps),eps->rand); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/slepc-interface.c0000644000175000017500000000521612211062077024464 0ustar gladkgladk/* Modification of the *temp* implementation of the BLOPEX multivector in order to wrap created PETSc vectors as multivectors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #include #include "slepc-interface.h" static void* mv_TempMultiVectorCreateFromPETScVector(void* ii_,BlopexInt n,void* sample) { int i; Vec *vecs = (Vec*)sample; mv_TempMultiVector* x; mv_InterfaceInterpreter* ii = (mv_InterfaceInterpreter*)ii_; x = (mv_TempMultiVector*)malloc(sizeof(mv_TempMultiVector)); if (!x) SETERRABORT(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Allocation for x failed"); x->interpreter = ii; x->numVectors = n; x->vector = (void**)calloc(n,sizeof(void*)); if (!x->vector) SETERRABORT(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Allocation for x->vector failed"); x->ownsVectors = 1; x->mask = NULL; x->ownsMask = 0; for (i=0;ivector[i] = (void*)vecs[i]; } return x; } static void mv_TempMultiPETSCVectorDestroy(void* x_) { mv_TempMultiVector* x = (mv_TempMultiVector*)x_; if (!x) return; if (x->ownsVectors && x->vector) free(x->vector); if (x->mask && x->ownsMask) free(x->mask); free(x); } /* Create an InterfaceInterpreter using the PETSc implementation but overloading CreateMultiVector that doesn't create any new vector. */ int SLEPCSetupInterpreter(mv_InterfaceInterpreter *i) { PETSCSetupInterpreter(i); i->CreateMultiVector = mv_TempMultiVectorCreateFromPETScVector; return 0; } /* Change the multivector destructor in order to destroy the multivector structure without destroy the PETSc vectors. */ void SLEPCSetupInterpreterForDignifiedDeath(mv_InterfaceInterpreter *i) { i->DestroyMultiVector = mv_TempMultiPETSCVectorDestroy; } slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/petsc-interface.h0000644000175000017500000000340312211062077024475 0ustar gladkgladk/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ /* @@@ BLOPEX (version 1.1) LGPL Version 2.1 or above.See www.gnu.org. */ /* @@@ Copyright 2010 BLOPEX team http://code.google.com/p/blopex/ */ /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ #if !defined(PETSC_INTERFACE_HEADER) #define PETSC_INTERFACE_HEADER #include "blopex_interpreter.h" BlopexInt PETSC_dpotrf_interface (char *uplo, BlopexInt *n, double *a, BlopexInt * lda, BlopexInt *info); BlopexInt PETSC_dsygv_interface (BlopexInt *itype, char *jobz, char *uplo, BlopexInt * n, double *a, BlopexInt *lda, double *b, BlopexInt *ldb, double *w, double *work, BlopexInt *lwork, BlopexInt *info); BlopexInt PETSC_zpotrf_interface (char *uplo, BlopexInt *n, komplex *a, BlopexInt * lda, BlopexInt *info); BlopexInt PETSC_zsygv_interface (BlopexInt *itype, char *jobz, char *uplo, BlopexInt * n, komplex *a, BlopexInt *lda, komplex *b, BlopexInt *ldb, double *w, komplex *work, BlopexInt *lwork, double *rwork, BlopexInt *info); void * PETSC_MimicVector(void *vvector); BlopexInt PETSC_DestroyVector(void *vvector); BlopexInt PETSC_InnerProd(void *x, void *y, void *result); BlopexInt PETSC_CopyVector(void *x, void *y); BlopexInt PETSC_ClearVector(void *x); BlopexInt PETSC_SetRandomValues(void* v, BlopexInt seed); BlopexInt PETSC_ScaleVector(void *alpha, void *x); BlopexInt PETSC_Axpy(void *alpha, void *x, void *y); int LOBPCG_InitRandomContext(MPI_Comm,PetscRandom); int LOBPCG_SetFromOptionsRandomContext(void); int LOBPCG_DestroyRandomContext(void); int PETSCSetupInterpreter(mv_InterfaceInterpreter *ii); #endif /* PETSC_INTERFACE_HEADER */ slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/blopex.c.html0000644000175000017500000006017612211062077023662 0ustar gladkgladk
Actual source code: blopex.c

  1: /*
  2:    This file implements a wrapper to the BLOPEX package

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>      /*I "slepceps.h" I*/
 25: #include <slepc-private/stimpl.h>       /*I "slepcst.h" I*/
 26: #include "slepc-interface.h"
 27: #include <blopex_lobpcg.h>
 28: #include <blopex_interpreter.h>
 29: #include <blopex_multivector.h>
 30: #include <blopex_temp_multivector.h>

 32: PetscErrorCode EPSSolve_BLOPEX(EPS);

 34: typedef struct {
 35:   lobpcg_Tolerance           tol;
 36:   lobpcg_BLASLAPACKFunctions blap_fn;
 37:   mv_MultiVectorPtr          eigenvectors;
 38:   mv_MultiVectorPtr          Y;
 39:   mv_InterfaceInterpreter    ii;
 40:   ST                         st;
 41:   Vec                        w;
 42: } EPS_BLOPEX;

 46: static void Precond_FnSingleVector(void *data,void *x,void *y)
 47: {
 49:   EPS            eps = (EPS)data;
 50:   EPS_BLOPEX     *blopex = (EPS_BLOPEX*)eps->data;

 53:   KSPSolve(blopex->st->ksp,(Vec)x,(Vec)y);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 54:   PetscFunctionReturnVoid();
 55: }

 59: static void Precond_FnMultiVector(void *data,void *x,void *y)
 60: {
 61:   EPS        eps = (EPS)data;
 62:   EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data;

 65:   blopex->ii.Eval(Precond_FnSingleVector,data,x,y);
 66:   PetscFunctionReturnVoid();
 67: }

 71: static void OperatorASingleVector(void *data,void *x,void *y)
 72: {
 74:   EPS            eps = (EPS)data;
 75:   EPS_BLOPEX     *blopex = (EPS_BLOPEX*)eps->data;
 76:   Mat            A,B;
 77:   PetscScalar    sigma;
 78:   PetscInt       nmat;

 81:   STGetNumMatrices(eps->st,&nmat);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 82:   STGetOperators(eps->st,0,&A);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 83:   if (nmat>1) { STGetOperators(eps->st,1,&B);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr); }
 84:   MatMult(A,(Vec)x,(Vec)y);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 85:   STGetShift(eps->st,&sigma);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 86:   if (sigma != 0.0) {
 87:     if (nmat>1) {
 88:       MatMult(B,(Vec)x,blopex->w);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 89:     } else {
 90:       VecCopy((Vec)x,blopex->w);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 91:     }
 92:     VecAXPY((Vec)y,-sigma,blopex->w);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
 93:   }
 94:   PetscFunctionReturnVoid();
 95: }

 99: static void OperatorAMultiVector(void *data,void *x,void *y)
100: {
101:   EPS        eps = (EPS)data;
102:   EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data;

105:   blopex->ii.Eval(OperatorASingleVector,data,x,y);
106:   PetscFunctionReturnVoid();
107: }

111: static void OperatorBSingleVector(void *data,void *x,void *y)
112: {
114:   EPS            eps = (EPS)data;
115:   Mat            B;

118:   STGetOperators(eps->st,1,&B);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
119:   MatMult(B,(Vec)x,(Vec)y);CHKERRABORT(PetscObjectComm((PetscObject)eps),ierr);
120:   PetscFunctionReturnVoid();
121: }

125: static void OperatorBMultiVector(void *data,void *x,void *y)
126: {
127:   EPS        eps = (EPS)data;
128:   EPS_BLOPEX *blopex = (EPS_BLOPEX*)eps->data;

131:   blopex->ii.Eval(OperatorBSingleVector,data,x,y);
132:   PetscFunctionReturnVoid();
133: }

137: PetscErrorCode EPSSetUp_BLOPEX(EPS eps)
138: {
139: #if defined(PETSC_MISSING_LAPACK_POTRF) || defined(PETSC_MISSING_LAPACK_SYGV)
141:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"POTRF/SYGV - Lapack routine is unavailable");
142: #else
144:   PetscInt       i;
145:   EPS_BLOPEX     *blopex = (EPS_BLOPEX*)eps->data;
146:   PetscBool      isPrecond;

149:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"blopex only works for hermitian problems");
150:   if (!eps->which) eps->which = EPS_SMALLEST_REAL;
151:   if (eps->which!=EPS_SMALLEST_REAL) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");

153:   /* Change the default sigma to inf if necessary */
154:   if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL ||
155:       eps->which == EPS_LARGEST_IMAGINARY) {
156:     STSetDefaultShift(eps->st,3e300);
157:   }

159:   STSetUp(eps->st);
160:   PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&isPrecond);
161:   if (!isPrecond) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"blopex only works with STPRECOND");
162:   blopex->st = eps->st;

164:   eps->ncv = eps->nev = PetscMin(eps->nev,eps->n);
165:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
166:   if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
167:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");

169:   EPSAllocateSolution(eps);
170:   EPSSetWorkVecs(eps,1);

172:   if (eps->converged == EPSConvergedEigRelative) {
173:     blopex->tol.absolute = 0.0;
174:     blopex->tol.relative = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol;
175:   } else if (eps->converged == EPSConvergedAbsolute) {
176:     blopex->tol.absolute = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol;
177:     blopex->tol.relative = 0.0;
178:   } else {
179:     SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Convergence test not supported in this solver");
180:   }

182:   SLEPCSetupInterpreter(&blopex->ii);
183:   blopex->eigenvectors = mv_MultiVectorCreateFromSampleVector(&blopex->ii,eps->ncv,eps->V);
184:   for (i=0;i<eps->ncv;i++) { PetscObjectReference((PetscObject)eps->V[i]); }

186:   VecDuplicate(eps->V[0],&blopex->w);
187:   PetscLogObjectParent(eps,blopex->w);
188:   if (eps->nds > 0) {
189:     blopex->Y = mv_MultiVectorCreateFromSampleVector(&blopex->ii,eps->nds,eps->defl);
190:     for (i=0;i<eps->nds;i++) { PetscObjectReference((PetscObject)eps->defl[i]); }
191:   } else blopex->Y = NULL;

193: #if defined(PETSC_USE_COMPLEX)
194:   blopex->blap_fn.zpotrf = PETSC_zpotrf_interface;
195:   blopex->blap_fn.zhegv = PETSC_zsygv_interface;
196: #else
197:   blopex->blap_fn.dpotrf = PETSC_dpotrf_interface;
198:   blopex->blap_fn.dsygv = PETSC_dsygv_interface;
199: #endif

201:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

203:   /* dispatch solve method */
204:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
205:   eps->ops->solve = EPSSolve_BLOPEX;
206:   return(0);
207: #endif
208: }

212: PetscErrorCode EPSSolve_BLOPEX(EPS eps)
213: {
214:   EPS_BLOPEX     *blopex = (EPS_BLOPEX*)eps->data;
215:   PetscScalar    sigma;
216:   int            i,j,info,its,nconv;
217:   double         *residhist=NULL;
219: #if defined(PETSC_USE_COMPLEX)
220:   komplex        *lambdahist=NULL;
221: #else
222:   double         *lambdahist=NULL;
223: #endif

226:   /* Complete the initial basis with random vectors */
227:   for (i=eps->nini;i<eps->ncv;i++) {
228:     SlepcVecSetRandom(eps->V[i],eps->rand);
229:   }

231:   if (eps->numbermonitors>0) {
232: #if defined(PETSC_USE_COMPLEX)
233:     PetscMalloc(eps->ncv*(eps->max_it+1)*sizeof(komplex),&lambdahist);
234: #else
235:     PetscMalloc(eps->ncv*(eps->max_it+1)*sizeof(double),&lambdahist);
236: #endif
237:     PetscMalloc(eps->ncv*(eps->max_it+1)*sizeof(double),&residhist);
238:   }

240: #if defined(PETSC_USE_COMPLEX)
241:   info = lobpcg_solve_complex(blopex->eigenvectors,eps,OperatorAMultiVector,
242:         eps->isgeneralized?eps:NULL,eps->isgeneralized?OperatorBMultiVector:NULL,
243:         eps,Precond_FnMultiVector,blopex->Y,
244:         blopex->blap_fn,blopex->tol,eps->max_it,0,&its,
245:         (komplex*)eps->eigr,lambdahist,eps->ncv,eps->errest,residhist,eps->ncv);
246: #else
247:   info = lobpcg_solve_double(blopex->eigenvectors,eps,OperatorAMultiVector,
248:         eps->isgeneralized?eps:NULL,eps->isgeneralized?OperatorBMultiVector:NULL,
249:         eps,Precond_FnMultiVector,blopex->Y,
250:         blopex->blap_fn,blopex->tol,eps->max_it,0,&its,
251:         eps->eigr,lambdahist,eps->ncv,eps->errest,residhist,eps->ncv);
252: #endif
253:   if (info>0) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_LIB,"Error in blopex (code=%d)",info);

255:   if (eps->numbermonitors>0) {
256:     for (i=0;i<its;i++) {
257:       nconv = 0;
258:       for (j=0;j<eps->ncv;j++) {
259:         if (residhist[j+i*eps->ncv]>eps->tol) break;
260:         else nconv++;
261:       }
262:       EPSMonitor(eps,i,nconv,(PetscScalar*)lambdahist+i*eps->ncv,eps->eigi,residhist+i*eps->ncv,eps->ncv);
263:     }
264:     PetscFree(lambdahist);
265:     PetscFree(residhist);
266:   }

268:   eps->its = its;
269:   eps->nconv = eps->ncv;
270:   STGetShift(eps->st,&sigma);
271:   if (sigma != 0.0) {
272:     for (i=0;i<eps->nconv;i++) eps->eigr[i]+=sigma;
273:   }
274:   if (info==-1) eps->reason = EPS_DIVERGED_ITS;
275:   else eps->reason = EPS_CONVERGED_TOL;
276:   return(0);
277: }

281: PetscErrorCode EPSReset_BLOPEX(EPS eps)
282: {
284:   EPS_BLOPEX     *blopex = (EPS_BLOPEX*)eps->data;

287:   mv_MultiVectorDestroy(blopex->eigenvectors);
288:   mv_MultiVectorDestroy(blopex->Y);
289:   VecDestroy(&blopex->w);
290:   EPSReset_Default(eps);
291:   return(0);
292: }

296: PetscErrorCode EPSDestroy_BLOPEX(EPS eps)
297: {

301:   LOBPCG_DestroyRandomContext();
302:   PetscFree(eps->data);
303:   return(0);
304: }

308: PetscErrorCode EPSSetFromOptions_BLOPEX(EPS eps)
309: {
310:   PetscErrorCode  ierr;
311:   KSP             ksp;

314:   PetscOptionsHead("EPS BLOPEX Options");
315:   LOBPCG_SetFromOptionsRandomContext();

317:   /* Set STPrecond as the default ST */
318:   if (!((PetscObject)eps->st)->type_name) {
319:     STSetType(eps->st,STPRECOND);
320:   }
321:   STPrecondSetKSPHasMat(eps->st,PETSC_TRUE);

323:   /* Set the default options of the KSP */
324:   STGetKSP(eps->st,&ksp);
325:   if (!((PetscObject)ksp)->type_name) {
326:     KSPSetType(ksp,KSPPREONLY);
327:   }
328:   PetscOptionsTail();
329:   return(0);
330: }

334: PETSC_EXTERN PetscErrorCode EPSCreate_BLOPEX(EPS eps)
335: {

339:   PetscNewLog(eps,EPS_BLOPEX,&eps->data);
340:   eps->ops->setup                = EPSSetUp_BLOPEX;
341:   eps->ops->setfromoptions       = EPSSetFromOptions_BLOPEX;
342:   eps->ops->destroy              = EPSDestroy_BLOPEX;
343:   eps->ops->reset                = EPSReset_BLOPEX;
344:   eps->ops->backtransform        = EPSBackTransform_Default;
345:   eps->ops->computevectors       = EPSComputeVectors_Default;
346:   LOBPCG_InitRandomContext(PetscObjectComm((PetscObject)eps),eps->rand);
347:   return(0);
348: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/makefile0000644000175000017500000000243112211062077022750 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresdefine 'SLEPC_HAVE_BLOPEX' #requiresprecision double CFLAGS = ${BLOPEX_INCLUDE} -DBlopexInt=PetscInt FFLAGS = SOURCEC = blopex.c slepc-interface.c petsc-interface.c SOURCEF = SOURCEH = slepc-interface.h petsc-interface.h LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/external/blopex/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/makefile.html0000644000175000017500000000431712211062077023720 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresdefine  'SLEPC_HAVE_BLOPEX'
#requiresprecision double

CFLAGS   = ${BLOPEX_INCLUDE} -DBlopexInt=PetscInt
FFLAGS   =
SOURCEC  = blopex.c slepc-interface.c petsc-interface.c
SOURCEF  =
SOURCEH  = slepc-interface.h petsc-interface.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/external/blopex/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/index.html0000644000175000017500000000250412211062077023246 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

slepc-interface.h
petsc-interface.h
blopex.c
slepc-interface.c
petsc-interface.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/petsc-interface.h.html0000644000175000017500000001176312211062077025450 0ustar gladkgladk

Actual source code: petsc-interface.h

  1: /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
  2: /* @@@ BLOPEX (version 1.1) LGPL Version 2.1 or above.See www.gnu.org. */
  3: /* @@@ Copyright 2010 BLOPEX team http://code.google.com/p/blopex/     */
  4: /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */

  6: #if !defined(PETSC_INTERFACE_HEADER)
  7: #define PETSC_INTERFACE_HEADER

  9: #include "blopex_interpreter.h"

 11: BlopexInt PETSC_dpotrf_interface (char *uplo, BlopexInt *n, double *a, BlopexInt * lda, BlopexInt *info);

 13: BlopexInt PETSC_dsygv_interface (BlopexInt *itype, char *jobz, char *uplo, BlopexInt *
 14:                     n, double *a, BlopexInt *lda, double *b, BlopexInt *ldb,
 15:                     double *w, double *work, BlopexInt *lwork, BlopexInt *info);

 17: BlopexInt PETSC_zpotrf_interface (char *uplo, BlopexInt *n, komplex *a, BlopexInt * lda, BlopexInt *info);

 19: BlopexInt PETSC_zsygv_interface (BlopexInt *itype, char *jobz, char *uplo, BlopexInt *
 20:                     n, komplex *a, BlopexInt *lda, komplex *b, BlopexInt *ldb,
 21:                     double *w, komplex *work, BlopexInt *lwork, double *rwork, BlopexInt *info);

 23: void *
 24: PETSC_MimicVector(void *vvector);

 26: BlopexInt
 27: PETSC_DestroyVector(void *vvector);

 29: BlopexInt
 30: PETSC_InnerProd(void *x, void *y, void *result);

 32: BlopexInt
 33: PETSC_CopyVector(void *x, void *y);

 35: BlopexInt
 36: PETSC_ClearVector(void *x);

 38: BlopexInt
 39: PETSC_SetRandomValues(void* v, BlopexInt seed);

 41: BlopexInt
 42: PETSC_ScaleVector(void *alpha, void   *x);

 44: BlopexInt
 45: PETSC_Axpy(void *alpha,
 46:                 void   *x,
 47:                 void   *y);

 49: int
 50: LOBPCG_InitRandomContext(MPI_Comm,PetscRandom);

 52: int
 53: LOBPCG_SetFromOptionsRandomContext(void);

 55: int
 56: LOBPCG_DestroyRandomContext(void);

 58: int
 59: PETSCSetupInterpreter(mv_InterfaceInterpreter *ii);

 61: #endif /* PETSC_INTERFACE_HEADER */
slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/slepc-interface.h0000644000175000017500000000246712211062077024476 0ustar gladkgladk/* Modification of the *temp* implementation of the BLOPEX multivector in order to wrap created PETSc vectors as multivectors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(SLEPC_INTERFACE_HEADER) #define SLEPC_INTERFACE_HEADER #include #include "petsc-interface.h" extern int SLEPCSetupInterpreter(mv_InterfaceInterpreter *ii); extern void SLEPCSetupInterpreterForDignifiedDeath(mv_InterfaceInterpreter *i); #endif slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/petsc-interface.c0000644000175000017500000001434612211062077024500 0ustar gladkgladk/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ /* @@@ BLOPEX (version 1.1) LGPL Version 2.1 or above.See www.gnu.org. */ /* @@@ Copyright 2010 BLOPEX team http://code.google.com/p/blopex/ */ /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ /* This code was developed by Merico Argentati, Andrew Knyazev, Ilya Lashuk and Evgueni Ovtchinnikov */ #include #include #include "blopex_interpreter.h" #include "blopex_temp_multivector.h" static PetscRandom LOBPCG_RandomContext = NULL; typedef struct { double real,imag; } komplex; BlopexInt PETSC_dpotrf_interface (char *uplo,BlopexInt *n,double *a,BlopexInt * lda,BlopexInt *info) { PetscBLASInt n_,lda_,info_; /* type conversion */ n_ = *n; lda_ = *lda; info_ = *info; LAPACKpotrf_(uplo,&n_,(PetscScalar*)a,&lda_,&info_); *info = info_; return 0; } BlopexInt PETSC_zpotrf_interface (char *uplo,BlopexInt *n,komplex *a,BlopexInt* lda,BlopexInt *info) { PetscBLASInt n_,lda_,info_; /* type conversion */ n_ = *n; lda_ = (PetscBLASInt)*lda; LAPACKpotrf_(uplo,&n_,(PetscScalar*)a,&lda_,&info_); *info = info_; return 0; } BlopexInt PETSC_dsygv_interface (BlopexInt *itype,char *jobz,char *uplo,BlopexInt *n,double *a,BlopexInt *lda,double *b,BlopexInt *ldb,double *w,double *work,BlopexInt *lwork,BlopexInt *info) { #if !defined(PETSC_USE_COMPLEX) PetscBLASInt itype_,n_,lda_,ldb_,lwork_,info_; itype_ = *itype; n_ = *n; lda_ = *lda; ldb_ = *ldb; lwork_ = *lwork; info_ = *info; LAPACKsygv_(&itype_,jobz,uplo,&n_,(PetscScalar*)a,&lda_,(PetscScalar*)b,&ldb_,(PetscScalar*)w,(PetscScalar*)work,&lwork_,&info_); *info = info_; #endif return 0; } BlopexInt PETSC_zsygv_interface (BlopexInt *itype,char *jobz,char *uplo,BlopexInt *n,komplex *a,BlopexInt *lda,komplex *b,BlopexInt *ldb,double *w,komplex *work,BlopexInt *lwork,double *rwork,BlopexInt *info) { #if defined(PETSC_USE_COMPLEX) PetscBLASInt itype_,n_,lda_,ldb_,lwork_,info_; itype_ = *itype; n_ = *n; lda_ = *lda; ldb_ = *ldb; lwork_ = *lwork; info_ = *info; LAPACKsygv_(&itype_,jobz,uplo,&n_,(PetscScalar*)a,&lda_,(PetscScalar*)b,&ldb_,(PetscReal*)w,(PetscScalar*)work,&lwork_,(PetscReal*)rwork,&info_); *info = info_; #endif return 0; } void *PETSC_MimicVector(void *vvector) { PetscErrorCode ierr; Vec temp; ierr = VecDuplicate((Vec)vvector,&temp);CHKERRABORT(PETSC_COMM_SELF,ierr); return (void*)temp; } BlopexInt PETSC_DestroyVector(void *vvector) { PetscErrorCode ierr; Vec v = (Vec)vvector; ierr = VecDestroy(&v);CHKERRQ(ierr); return 0; } BlopexInt PETSC_InnerProd(void *x,void *y,void *result) { PetscErrorCode ierr; ierr = VecDot((Vec)x,(Vec)y,(PetscScalar*)result);CHKERRQ(ierr); return 0; } BlopexInt PETSC_CopyVector(void *x,void *y) { PetscErrorCode ierr; ierr = VecCopy((Vec)x,(Vec)y);CHKERRQ(ierr); return 0; } BlopexInt PETSC_ClearVector(void *x) { PetscErrorCode ierr; ierr = VecSet((Vec)x,0.0);CHKERRQ(ierr); return 0; } BlopexInt PETSC_SetRandomValues(void* v,BlopexInt seed) { PetscErrorCode ierr; /* note: without previous call to LOBPCG_InitRandomContext LOBPCG_RandomContext will be null, and VecSetRandom will use internal petsc random context */ ierr = VecSetRandom((Vec)v,LOBPCG_RandomContext);CHKERRQ(ierr); return 0; } BlopexInt PETSC_ScaleVector(double alpha,void *x) { PetscErrorCode ierr; ierr = VecScale((Vec)x,alpha);CHKERRQ(ierr); return 0; } BlopexInt PETSC_Axpy(void *alpha,void *x,void *y) { PetscErrorCode ierr; ierr = VecAXPY((Vec)y,*(PetscScalar*)alpha,(Vec)x);CHKERRQ(ierr); return 0; } BlopexInt PETSC_VectorSize(void *x) { PetscInt N; VecGetSize((Vec)x,&N); return N; } int LOBPCG_InitRandomContext(MPI_Comm comm,PetscRandom rand) { PetscErrorCode ierr; /* PetscScalar rnd_bound = 1.0; */ if (rand) { ierr = PetscObjectReference((PetscObject)rand);CHKERRQ(ierr); ierr = PetscRandomDestroy(&LOBPCG_RandomContext);CHKERRQ(ierr); LOBPCG_RandomContext = rand; } else { ierr = PetscRandomCreate(comm,&LOBPCG_RandomContext);CHKERRQ(ierr); } return 0; } int LOBPCG_SetFromOptionsRandomContext(void) { PetscErrorCode ierr; ierr = PetscRandomSetFromOptions(LOBPCG_RandomContext);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscRandomSetInterval(LOBPCG_RandomContext,(PetscScalar)-1.0-1.0*PETSC_i,(PetscScalar)1.0+1.0*PETSC_i);CHKERRQ(ierr); #else ierr = PetscRandomSetInterval(LOBPCG_RandomContext,(PetscScalar)-1.0,(PetscScalar)1.0);CHKERRQ(ierr); #endif return 0; } int LOBPCG_DestroyRandomContext(void) { PetscErrorCode ierr; ierr = PetscRandomDestroy(&LOBPCG_RandomContext);CHKERRQ(ierr); return 0; } int PETSCSetupInterpreter(mv_InterfaceInterpreter *i) { i->CreateVector = PETSC_MimicVector; i->DestroyVector = PETSC_DestroyVector; i->InnerProd = PETSC_InnerProd; i->CopyVector = PETSC_CopyVector; i->ClearVector = PETSC_ClearVector; i->SetRandomValues = PETSC_SetRandomValues; i->ScaleVector = PETSC_ScaleVector; i->Axpy = PETSC_Axpy; i->VectorSize = PETSC_VectorSize; /* Multivector part */ i->CreateMultiVector = mv_TempMultiVectorCreateFromSampleVector; i->CopyCreateMultiVector = mv_TempMultiVectorCreateCopy; i->DestroyMultiVector = mv_TempMultiVectorDestroy; i->Width = mv_TempMultiVectorWidth; i->Height = mv_TempMultiVectorHeight; i->SetMask = mv_TempMultiVectorSetMask; i->CopyMultiVector = mv_TempMultiVectorCopy; i->ClearMultiVector = mv_TempMultiVectorClear; i->SetRandomVectors = mv_TempMultiVectorSetRandom; i->Eval = mv_TempMultiVectorEval; #if defined(PETSC_USE_COMPLEX) i->MultiInnerProd = mv_TempMultiVectorByMultiVector_complex; i->MultiInnerProdDiag = mv_TempMultiVectorByMultiVectorDiag_complex; i->MultiVecMat = mv_TempMultiVectorByMatrix_complex; i->MultiVecMatDiag = mv_TempMultiVectorByDiagonal_complex; i->MultiAxpy = mv_TempMultiVectorAxpy_complex; i->MultiXapy = mv_TempMultiVectorXapy_complex; #else i->MultiInnerProd = mv_TempMultiVectorByMultiVector; i->MultiInnerProdDiag = mv_TempMultiVectorByMultiVectorDiag; i->MultiVecMat = mv_TempMultiVectorByMatrix; i->MultiVecMatDiag = mv_TempMultiVectorByDiagonal; i->MultiAxpy = mv_TempMultiVectorAxpy; i->MultiXapy = mv_TempMultiVectorXapy; #endif return 0; } slepc-3.4.2.dfsg.orig/src/eps/impls/external/blopex/slepc-interface.h.html0000644000175000017500000000630212211062077025431 0ustar gladkgladk
Actual source code: slepc-interface.h

  1: /*
  2:    Modification of the *temp* implementation of the BLOPEX multivector in order
  3:    to wrap created PETSc vectors as multivectors.

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

  9:    This file is part of SLEPc.

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

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

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


 26: #if !defined(SLEPC_INTERFACE_HEADER)
 27: #define SLEPC_INTERFACE_HEADER

 29: #include <blopex_lobpcg.h>
 30: #include "petsc-interface.h"

 32: extern int
 33: SLEPCSetupInterpreter(mv_InterfaceInterpreter *ii);

 35: extern void
 36: SLEPCSetupInterpreterForDignifiedDeath(mv_InterfaceInterpreter *i);

 38: #endif

slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/0000755000175000017500000000000012214143515021250 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/primme.c0000644000175000017500000005150212211062077022710 0ustar gladkgladk/* This file implements a wrapper to the PRIMME package - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_PRIMME(EPS); EXTERN_C_BEGIN #include EXTERN_C_END typedef struct { primme_params primme; /* param struc */ primme_preset_method method; /* primme method */ Mat A; /* problem matrix */ EPS eps; /* EPS current context */ KSP ksp; /* linear solver and preconditioner */ Vec x,y; /* auxiliary vectors */ PetscReal target; /* a copy of eps's target */ } EPS_PRIMME; EPSPRIMMEMethod methodN[] = { EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME, EPS_PRIMME_DEFAULT_MIN_MATVECS, EPS_PRIMME_ARNOLDI, EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION, EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW }; static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme); static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme); static void par_GlobalSumDouble(void *sendBuf,void *recvBuf,int *count,primme_params *primme) { PetscErrorCode ierr; ierr = MPI_Allreduce((double*)sendBuf,(double*)recvBuf,*count,MPI_DOUBLE,MPI_SUM,primme->commInfo);CHKERRABORT(primme->commInfo,ierr); } #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_PRIMME" PetscErrorCode EPSSetUp_PRIMME(EPS eps) { PetscErrorCode ierr; PetscMPIInt numProcs,procID; EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; primme_params *primme = &ops->primme; PetscBool t; PetscFunctionBegin; ierr = MPI_Comm_size(PetscObjectComm((PetscObject)eps),&numProcs);CHKERRQ(ierr); ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)eps),&procID);CHKERRQ(ierr); /* Check some constraints and set some default values */ if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n); ierr = STGetOperators(eps->st,0,&ops->A);CHKERRQ(ierr); if (!ops->A) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"The problem matrix has to be specified first"); if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME is only available for Hermitian problems"); if (eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME is not available for generalized problems"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); if (!eps->which) eps->which = EPS_LARGEST_REAL; if (eps->converged != EPSConvergedAbsolute) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME only supports absolute convergence test"); /* Change the default sigma to inf if necessary */ if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL || eps->which == EPS_LARGEST_IMAGINARY) { ierr = STSetDefaultShift(eps->st,3e300);CHKERRQ(ierr); } /* Avoid setting the automatic shift when a target is set */ ierr = STSetDefaultShift(eps->st,0.0);CHKERRQ(ierr); ierr = STSetUp(eps->st);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&t);CHKERRQ(ierr); if (!t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME only works with STPRECOND"); /* Transfer SLEPc options to PRIMME options */ primme->n = eps->n; primme->nLocal = eps->nloc; primme->numEvals = eps->nev; primme->matrix = ops; primme->commInfo = PetscObjectComm((PetscObject)eps); primme->maxMatvecs = eps->max_it; primme->eps = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol; primme->numProcs = numProcs; primme->procID = procID; primme->printLevel = 0; primme->correctionParams.precondition = 1; if (!eps->which) eps->which = EPS_LARGEST_REAL; switch (eps->which) { case EPS_LARGEST_REAL: primme->target = primme_largest; break; case EPS_SMALLEST_REAL: primme->target = primme_smallest; break; case EPS_TARGET_MAGNITUDE: case EPS_TARGET_REAL: primme->target = primme_closest_abs; primme->numTargetShifts = 1; ops->target = PetscRealPart(eps->target); primme->targetShifts = &ops->target; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"'which' value does not supported by PRIMME"); break; } if (primme_set_method(ops->method,primme) < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME method not valid"); /* If user sets ncv, maxBasisSize is modified. If not, ncv is set as maxBasisSize */ if (eps->ncv) primme->maxBasisSize = eps->ncv; else eps->ncv = primme->maxBasisSize; if (eps->ncv < eps->nev+primme->maxBlockSize) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME needs ncv >= nev+maxBlockSize"); if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } /* Set workspace */ ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); /* Setup the preconditioner */ ops->eps = eps; if (primme->correctionParams.precondition) { ierr = STGetKSP(eps->st,&ops->ksp);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)ops->ksp,KSPPREONLY,&t);CHKERRQ(ierr); if (!t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME only works with KSPPREONLY"); primme->preconditioner = NULL; primme->applyPreconditioner = applyPreconditioner_PRIMME; } /* Prepare auxiliary vectors */ ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,eps->n,NULL,&ops->x);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,eps->n,NULL,&ops->y);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ops->x);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,ops->y);CHKERRQ(ierr); /* dispatch solve method */ if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver"); eps->ops->solve = EPSSolve_PRIMME; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_PRIMME" PetscErrorCode EPSSolve_PRIMME(EPS eps) { PetscErrorCode ierr; EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; PetscScalar *a; #if defined(PETSC_USE_COMPLEX) PetscInt i; PetscReal *evals; #endif PetscFunctionBegin; /* Reset some parameters left from previous runs */ ops->primme.aNorm = 1.0; ops->primme.initSize = eps->nini; ops->primme.iseed[0] = -1; /* Call PRIMME solver */ ierr = VecGetArray(eps->V[0],&a);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) ierr = dprimme(eps->eigr,a,eps->errest,&ops->primme);CHKERRQ(ierr); #else /* PRIMME returns real eigenvalues, but SLEPc works with complex ones */ ierr = PetscMalloc(eps->ncv*sizeof(PetscReal),&evals);CHKERRQ(ierr); ierr = zprimme(evals,(Complex_Z*)a,eps->errest,&ops->primme);CHKERRQ(ierr); for (i=0;incv;i++) eps->eigr[i] = evals[i]; ierr = PetscFree(evals);CHKERRQ(ierr); #endif ierr = VecRestoreArray(eps->V[0],&a);CHKERRQ(ierr); switch (ierr) { case 0: /* Successful */ break; case -1: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: Failed to open output file"); break; case -2: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: Insufficient integer or real workspace allocated"); break; case -3: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: main_iter encountered a problem"); break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: some parameters wrong configured"); break; } eps->nconv = ops->primme.initSize >= 0 ? ops->primme.initSize : 0; eps->reason = eps->ncv >= eps->nev ? EPS_CONVERGED_TOL: EPS_DIVERGED_ITS; eps->its = ops->primme.stats.numOuterIterations; eps->st->applys = ops->primme.stats.numMatvecs; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "multMatvec_PRIMME" static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme) { PetscErrorCode ierr; PetscInt i,N = primme->n; EPS_PRIMME *ops = (EPS_PRIMME*)primme->matrix; Vec x = ops->x,y = ops->y; Mat A = ops->A; PetscFunctionBegin; for (i=0;i<*blockSize;i++) { /* build vectors using 'in' an 'out' workspace */ ierr = VecPlaceArray(x,(PetscScalar*)in+N*i);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr); ierr = VecPlaceArray(y,(PetscScalar*)out+N*i);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr); ierr = MatMult(A,x,y);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr); ierr = VecResetArray(x);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr); ierr = VecResetArray(y);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr); } PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "applyPreconditioner_PRIMME" static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme) { PetscErrorCode ierr; PetscInt i,N = primme->n,lits; EPS_PRIMME *ops = (EPS_PRIMME*)primme->matrix; Vec x = ops->x,y = ops->y; PetscFunctionBegin; for (i=0;i<*blockSize;i++) { /* build vectors using 'in' an 'out' workspace */ ierr = VecPlaceArray(x,(PetscScalar*)in+N*i);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr); ierr = VecPlaceArray(y,(PetscScalar*)out+N*i);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr); ierr = KSPSolve(ops->ksp,x,y);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr); ierr = KSPGetIterationNumber(ops->ksp,&lits);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr); ops->eps->st->lineariterations+= lits; ierr = VecResetArray(x);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr); ierr = VecResetArray(y);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr); } PetscFunctionReturnVoid(); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_PRIMME" PetscErrorCode EPSReset_PRIMME(EPS eps) { PetscErrorCode ierr; EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; PetscFunctionBegin; primme_Free(&ops->primme); ierr = VecDestroy(&ops->x);CHKERRQ(ierr); ierr = VecDestroy(&ops->y);CHKERRQ(ierr); ierr = EPSFreeSolution(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_PRIMME" PetscErrorCode EPSDestroy_PRIMME(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetMethod_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetBlockSize_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetMethod_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_PRIMME" PetscErrorCode EPSView_PRIMME(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; PetscBool isascii; primme_params *primme = &((EPS_PRIMME*)eps->data)->primme; EPSPRIMMEMethod methodn; PetscMPIInt rank; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," PRIMME: block size=%d\n",primme->maxBlockSize);CHKERRQ(ierr); ierr = EPSPRIMMEGetMethod(eps,&methodn);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," PRIMME: solver method: %s\n",EPSPRIMMEMethods[methodn]);CHKERRQ(ierr); /* Display PRIMME params */ ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)eps),&rank);CHKERRQ(ierr); if (!rank) primme_display_params(*primme); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_PRIMME" PetscErrorCode EPSSetFromOptions_PRIMME(EPS eps) { PetscErrorCode ierr; EPS_PRIMME *ctx = (EPS_PRIMME*)eps->data; PetscInt bs; EPSPRIMMEMethod meth; PetscBool flg; KSP ksp; PetscFunctionBegin; ierr = PetscOptionsHead("EPS PRIMME Options");CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_primme_block_size","Maximum block size","EPSPRIMMESetBlockSize",ctx->primme.maxBlockSize,&bs,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSPRIMMESetBlockSize(eps,bs);CHKERRQ(ierr); } ierr = PetscOptionsEnum("-eps_primme_method","Method for solving the eigenproblem","EPSPRIMMESetMethod",EPSPRIMMEMethods,(PetscEnum)ctx->method,(PetscEnum*)&meth,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSPRIMMESetMethod(eps,meth);CHKERRQ(ierr); } /* Set STPrecond as the default ST */ if (!((PetscObject)eps->st)->type_name) { ierr = STSetType(eps->st,STPRECOND);CHKERRQ(ierr); } ierr = STPrecondSetKSPHasMat(eps->st,PETSC_TRUE);CHKERRQ(ierr); /* Set the default options of the KSP */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); if (!((PetscObject)ksp)->type_name) { ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMESetBlockSize_PRIMME" static PetscErrorCode EPSPRIMMESetBlockSize_PRIMME(EPS eps,PetscInt bs) { EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; PetscFunctionBegin; if (bs == PETSC_DEFAULT) ops->primme.maxBlockSize = 1; else if (bs <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"PRIMME: block size must be positive"); else ops->primme.maxBlockSize = bs; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMESetBlockSize" /*@ EPSPRIMMESetBlockSize - The maximum block size the code will try to use. The user should set this based on the architecture specifics of the target computer, as well as any a priori knowledge of multiplicities. The code does NOT require BlockSize > 1 to find multiple eigenvalues. For some methods, keeping BlockSize = 1 yields the best overall performance. Collective on EPS Input Parameters: + eps - the eigenproblem solver context - bs - block size Options Database Key: . -eps_primme_block_size - Sets the max allowed block size value Notes: If the block size is not set, the value established by primme_initialize is used. Level: advanced .seealso: EPSPRIMMEGetBlockSize() @*/ PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,bs,2); ierr = PetscTryMethod(eps,"EPSPRIMMESetBlockSize_C",(EPS,PetscInt),(eps,bs));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMEGetBlockSize_PRIMME" static PetscErrorCode EPSPRIMMEGetBlockSize_PRIMME(EPS eps,PetscInt *bs) { EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; PetscFunctionBegin; if (bs) *bs = ops->primme.maxBlockSize; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMEGetBlockSize" /*@ EPSPRIMMEGetBlockSize - Get the maximum block size the code will try to use. Collective on EPS Input Parameters: . eps - the eigenproblem solver context Output Parameters: . bs - returned block size Level: advanced .seealso: EPSPRIMMESetBlockSize() @*/ PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSPRIMMEGetBlockSize_C",(EPS,PetscInt*),(eps,bs));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMESetMethod_PRIMME" static PetscErrorCode EPSPRIMMESetMethod_PRIMME(EPS eps,EPSPRIMMEMethod method) { EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; PetscFunctionBegin; if (method == PETSC_DEFAULT) ops->method = DEFAULT_MIN_TIME; else ops->method = (primme_preset_method)method; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMESetMethod" /*@ EPSPRIMMESetMethod - Sets the method for the PRIMME library. Collective on EPS Input Parameters: + eps - the eigenproblem solver context - method - method that will be used by PRIMME. It must be one of: EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL), EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI, EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION, EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW Options Database Key: . -eps_primme_set_method - Sets the method for the PRIMME library. Note: If not set, the method defaults to EPS_PRIMME_DEFAULT_MIN_TIME. Level: advanced .seealso: EPSPRIMMEGetMethod(), EPSPRIMMEMethod @*/ PetscErrorCode EPSPRIMMESetMethod(EPS eps,EPSPRIMMEMethod method) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,method,2); ierr = PetscTryMethod(eps,"EPSPRIMMESetMethod_C",(EPS,EPSPRIMMEMethod),(eps,method));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMEGetMethod_PRIMME" static PetscErrorCode EPSPRIMMEGetMethod_PRIMME(EPS eps,EPSPRIMMEMethod *method) { EPS_PRIMME *ops = (EPS_PRIMME*)eps->data; PetscFunctionBegin; if (method) *method = (EPSPRIMMEMethod)ops->method; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPRIMMEGetMethod" /*@C EPSPRIMMEGetMethod - Gets the method for the PRIMME library. Mon Collective on EPS Input Parameters: . eps - the eigenproblem solver context Output Parameters: . method - method that will be used by PRIMME. It must be one of: EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL), EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI, EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION, EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW Level: advanced .seealso: EPSPRIMMESetMethod(), EPSPRIMMEMethod @*/ PetscErrorCode EPSPRIMMEGetMethod(EPS eps,EPSPRIMMEMethod *method) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscTryMethod(eps,"EPSPRIMMEGetMethod_C",(EPS,EPSPRIMMEMethod*),(eps,method));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_PRIMME" PETSC_EXTERN PetscErrorCode EPSCreate_PRIMME(EPS eps) { PetscErrorCode ierr; EPS_PRIMME *primme; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_PRIMME,&primme);CHKERRQ(ierr); eps->data = (void*)primme; eps->ops->setup = EPSSetUp_PRIMME; eps->ops->setfromoptions = EPSSetFromOptions_PRIMME; eps->ops->destroy = EPSDestroy_PRIMME; eps->ops->reset = EPSReset_PRIMME; eps->ops->view = EPSView_PRIMME; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Default; primme_initialize(&primme->primme); primme->primme.matrixMatvec = multMatvec_PRIMME; primme->primme.globalSumDouble = par_GlobalSumDouble; primme->method = (primme_preset_method)EPS_PRIMME_DEFAULT_MIN_TIME; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetBlockSize_C",EPSPRIMMESetBlockSize_PRIMME);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetMethod_C",EPSPRIMMESetMethod_PRIMME);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetBlockSize_C",EPSPRIMMEGetBlockSize_PRIMME);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetMethod_C",EPSPRIMMEGetMethod_PRIMME);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/primme.c.html0000644000175000017500000012557312211062077023665 0ustar gladkgladk
Actual source code: primme.c

  1: /*
  2:    This file implements a wrapper to the PRIMME package

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>    /*I "slepceps.h" I*/
 25: #include <slepc-private/stimpl.h>

 27: PetscErrorCode EPSSolve_PRIMME(EPS);

 29: EXTERN_C_BEGIN
 30: #include <primme.h>
 31: EXTERN_C_END

 33: typedef struct {
 34:   primme_params primme;           /* param struc */
 35:   primme_preset_method method;    /* primme method */
 36:   Mat       A;                    /* problem matrix */
 37:   EPS       eps;                  /* EPS current context */
 38:   KSP       ksp;                  /* linear solver and preconditioner */
 39:   Vec       x,y;                  /* auxiliary vectors */
 40:   PetscReal target;               /* a copy of eps's target */
 41: } EPS_PRIMME;

 43: EPSPRIMMEMethod methodN[] = {
 44:   EPS_PRIMME_DYNAMIC,
 45:   EPS_PRIMME_DEFAULT_MIN_TIME,
 46:   EPS_PRIMME_DEFAULT_MIN_MATVECS,
 47:   EPS_PRIMME_ARNOLDI,
 48:   EPS_PRIMME_GD,
 49:   EPS_PRIMME_GD_PLUSK,
 50:   EPS_PRIMME_GD_OLSEN_PLUSK,
 51:   EPS_PRIMME_JD_OLSEN_PLUSK,
 52:   EPS_PRIMME_RQI,
 53:   EPS_PRIMME_JDQR,
 54:   EPS_PRIMME_JDQMR,
 55:   EPS_PRIMME_JDQMR_ETOL,
 56:   EPS_PRIMME_SUBSPACE_ITERATION,
 57:   EPS_PRIMME_LOBPCG_ORTHOBASIS,
 58:   EPS_PRIMME_LOBPCG_ORTHOBASISW
 59: };

 61: static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme);
 62: static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme);

 64: static void par_GlobalSumDouble(void *sendBuf,void *recvBuf,int *count,primme_params *primme)
 65: {
 67:   MPI_Allreduce((double*)sendBuf,(double*)recvBuf,*count,MPI_DOUBLE,MPI_SUM,primme->commInfo);CHKERRABORT(primme->commInfo,ierr);
 68: }

 72: PetscErrorCode EPSSetUp_PRIMME(EPS eps)
 73: {
 75:   PetscMPIInt    numProcs,procID;
 76:   EPS_PRIMME     *ops = (EPS_PRIMME*)eps->data;
 77:   primme_params  *primme = &ops->primme;
 78:   PetscBool      t;

 81:   MPI_Comm_size(PetscObjectComm((PetscObject)eps),&numProcs);
 82:   MPI_Comm_rank(PetscObjectComm((PetscObject)eps),&procID);

 84:   /* Check some constraints and set some default values */
 85:   if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n);
 86:   STGetOperators(eps->st,0,&ops->A);
 87:   if (!ops->A) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"The problem matrix has to be specified first");
 88:   if (!eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME is only available for Hermitian problems");
 89:   if (eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME is not available for generalized problems");
 90:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");
 91:   if (!eps->which) eps->which = EPS_LARGEST_REAL;
 92:   if (eps->converged != EPSConvergedAbsolute) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME only supports absolute convergence test");

 94:   /* Change the default sigma to inf if necessary */
 95:   if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL || eps->which == EPS_LARGEST_IMAGINARY) {
 96:     STSetDefaultShift(eps->st,3e300);
 97:   }

 99:   /* Avoid setting the automatic shift when a target is set */
100:   STSetDefaultShift(eps->st,0.0);

102:   STSetUp(eps->st);
103:   PetscObjectTypeCompare((PetscObject)eps->st,STPRECOND,&t);
104:   if (!t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME only works with STPRECOND");

106:   /* Transfer SLEPc options to PRIMME options */
107:   primme->n          = eps->n;
108:   primme->nLocal     = eps->nloc;
109:   primme->numEvals   = eps->nev;
110:   primme->matrix     = ops;
111:   primme->commInfo   = PetscObjectComm((PetscObject)eps);
112:   primme->maxMatvecs = eps->max_it;
113:   primme->eps        = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol;
114:   primme->numProcs   = numProcs;
115:   primme->procID     = procID;
116:   primme->printLevel = 0;
117:   primme->correctionParams.precondition = 1;

119:   if (!eps->which) eps->which = EPS_LARGEST_REAL;
120:   switch (eps->which) {
121:     case EPS_LARGEST_REAL:
122:       primme->target = primme_largest;
123:       break;
124:     case EPS_SMALLEST_REAL:
125:       primme->target = primme_smallest;
126:       break;
127:     case EPS_TARGET_MAGNITUDE:
128:     case EPS_TARGET_REAL:
129:       primme->target = primme_closest_abs;
130:       primme->numTargetShifts = 1;
131:       ops->target = PetscRealPart(eps->target);
132:       primme->targetShifts = &ops->target;
133:       break;
134:     default:
135:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"'which' value does not supported by PRIMME");
136:       break;
137:   }

139:   if (primme_set_method(ops->method,primme) < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME method not valid");

141:   /* If user sets ncv, maxBasisSize is modified. If not, ncv is set as maxBasisSize */
142:   if (eps->ncv) primme->maxBasisSize = eps->ncv;
143:   else eps->ncv = primme->maxBasisSize;
144:   if (eps->ncv < eps->nev+primme->maxBlockSize)  SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME needs ncv >= nev+maxBlockSize");
145:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }

147:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

149:   /* Set workspace */
150:   EPSAllocateSolution(eps);

152:   /* Setup the preconditioner */
153:   ops->eps = eps;
154:   if (primme->correctionParams.precondition) {
155:     STGetKSP(eps->st,&ops->ksp);
156:     PetscObjectTypeCompare((PetscObject)ops->ksp,KSPPREONLY,&t);
157:     if (!t) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME only works with KSPPREONLY");
158:     primme->preconditioner = NULL;
159:     primme->applyPreconditioner = applyPreconditioner_PRIMME;
160:   }

162:   /* Prepare auxiliary vectors */
163:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,eps->n,NULL,&ops->x);
164:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)eps),1,eps->nloc,eps->n,NULL,&ops->y);
165:   PetscLogObjectParent(eps,ops->x);
166:   PetscLogObjectParent(eps,ops->y);

168:   /* dispatch solve method */
169:   if (eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Left vectors not supported in this solver");
170:   eps->ops->solve = EPSSolve_PRIMME;
171:   return(0);
172: }

176: PetscErrorCode EPSSolve_PRIMME(EPS eps)
177: {
179:   EPS_PRIMME     *ops = (EPS_PRIMME*)eps->data;
180:   PetscScalar    *a;
181: #if defined(PETSC_USE_COMPLEX)
182:   PetscInt       i;
183:   PetscReal      *evals;
184: #endif

187:   /* Reset some parameters left from previous runs */
188:   ops->primme.aNorm    = 1.0;
189:   ops->primme.initSize = eps->nini;
190:   ops->primme.iseed[0] = -1;

192:   /* Call PRIMME solver */
193:   VecGetArray(eps->V[0],&a);
194: #if !defined(PETSC_USE_COMPLEX)
195:   dprimme(eps->eigr,a,eps->errest,&ops->primme);
196: #else
197:   /* PRIMME returns real eigenvalues, but SLEPc works with complex ones */
198:   PetscMalloc(eps->ncv*sizeof(PetscReal),&evals);
199:   zprimme(evals,(Complex_Z*)a,eps->errest,&ops->primme);
200:   for (i=0;i<eps->ncv;i++)
201:     eps->eigr[i] = evals[i];
202:   PetscFree(evals);
203: #endif
204:   VecRestoreArray(eps->V[0],&a);

206:   switch (ierr) {
207:     case 0: /* Successful */
208:       break;
209:     case -1:
210:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: Failed to open output file");
211:       break;
212:     case -2:
213:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: Insufficient integer or real workspace allocated");
214:       break;
215:     case -3:
216:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: main_iter encountered a problem");
217:       break;
218:     default:
219:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"PRIMME: some parameters wrong configured");
220:       break;
221:   }

223:   eps->nconv      = ops->primme.initSize >= 0 ? ops->primme.initSize : 0;
224:   eps->reason     = eps->ncv >= eps->nev ? EPS_CONVERGED_TOL: EPS_DIVERGED_ITS;
225:   eps->its        = ops->primme.stats.numOuterIterations;
226:   eps->st->applys = ops->primme.stats.numMatvecs;
227:   return(0);
228: }

232: static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme)
233: {
235:   PetscInt       i,N = primme->n;
236:   EPS_PRIMME     *ops = (EPS_PRIMME*)primme->matrix;
237:   Vec            x = ops->x,y = ops->y;
238:   Mat            A = ops->A;

241:   for (i=0;i<*blockSize;i++) {
242:     /* build vectors using 'in' an 'out' workspace */
243:     VecPlaceArray(x,(PetscScalar*)in+N*i);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr);
244:     VecPlaceArray(y,(PetscScalar*)out+N*i);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr);

246:     MatMult(A,x,y);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr);

248:     VecResetArray(x);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr);
249:     VecResetArray(y);CHKERRABORT(PetscObjectComm((PetscObject)A),ierr);
250:   }
251:   PetscFunctionReturnVoid();
252: }

256: static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme)
257: {
259:   PetscInt       i,N = primme->n,lits;
260:   EPS_PRIMME     *ops = (EPS_PRIMME*)primme->matrix;
261:   Vec            x = ops->x,y = ops->y;

264:   for (i=0;i<*blockSize;i++) {
265:     /* build vectors using 'in' an 'out' workspace */
266:     VecPlaceArray(x,(PetscScalar*)in+N*i);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr);
267:     VecPlaceArray(y,(PetscScalar*)out+N*i);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr);

269:     KSPSolve(ops->ksp,x,y);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr);
270:     KSPGetIterationNumber(ops->ksp,&lits);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr);
271:     ops->eps->st->lineariterations+= lits;

273:     VecResetArray(x);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr);
274:     VecResetArray(y);CHKERRABORT(PetscObjectComm((PetscObject)ops->ksp),ierr);
275:   }
276:   PetscFunctionReturnVoid();
277: }

281: PetscErrorCode EPSReset_PRIMME(EPS eps)
282: {
284:   EPS_PRIMME     *ops = (EPS_PRIMME*)eps->data;

287:   primme_Free(&ops->primme);
288:   VecDestroy(&ops->x);
289:   VecDestroy(&ops->y);
290:   EPSFreeSolution(eps);
291:   return(0);
292: }

296: PetscErrorCode EPSDestroy_PRIMME(EPS eps)
297: {

301:   PetscFree(eps->data);
302:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetBlockSize_C",NULL);
303:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetMethod_C",NULL);
304:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetBlockSize_C",NULL);
305:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetMethod_C",NULL);
306:   return(0);
307: }

311: PetscErrorCode EPSView_PRIMME(EPS eps,PetscViewer viewer)
312: {
313:   PetscErrorCode  ierr;
314:   PetscBool       isascii;
315:   primme_params   *primme = &((EPS_PRIMME*)eps->data)->primme;
316:   EPSPRIMMEMethod methodn;
317:   PetscMPIInt     rank;

320:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
321:   if (isascii) {
322:     PetscViewerASCIIPrintf(viewer,"  PRIMME: block size=%d\n",primme->maxBlockSize);
323:     EPSPRIMMEGetMethod(eps,&methodn);
324:     PetscViewerASCIIPrintf(viewer,"  PRIMME: solver method: %s\n",EPSPRIMMEMethods[methodn]);

326:     /* Display PRIMME params */
327:     MPI_Comm_rank(PetscObjectComm((PetscObject)eps),&rank);
328:     if (!rank) primme_display_params(*primme);
329:   }
330:   return(0);
331: }

335: PetscErrorCode EPSSetFromOptions_PRIMME(EPS eps)
336: {
337:   PetscErrorCode  ierr;
338:   EPS_PRIMME      *ctx = (EPS_PRIMME*)eps->data;
339:   PetscInt        bs;
340:   EPSPRIMMEMethod meth;
341:   PetscBool       flg;
342:   KSP             ksp;

345:   PetscOptionsHead("EPS PRIMME Options");
346:   PetscOptionsInt("-eps_primme_block_size","Maximum block size","EPSPRIMMESetBlockSize",ctx->primme.maxBlockSize,&bs,&flg);
347:   if (flg) {
348:     EPSPRIMMESetBlockSize(eps,bs);
349:   }
350:   PetscOptionsEnum("-eps_primme_method","Method for solving the eigenproblem","EPSPRIMMESetMethod",EPSPRIMMEMethods,(PetscEnum)ctx->method,(PetscEnum*)&meth,&flg);
351:   if (flg) {
352:     EPSPRIMMESetMethod(eps,meth);
353:   }

355:   /* Set STPrecond as the default ST */
356:   if (!((PetscObject)eps->st)->type_name) {
357:     STSetType(eps->st,STPRECOND);
358:   }
359:   STPrecondSetKSPHasMat(eps->st,PETSC_TRUE);

361:   /* Set the default options of the KSP */
362:   STGetKSP(eps->st,&ksp);
363:   if (!((PetscObject)ksp)->type_name) {
364:     KSPSetType(ksp,KSPPREONLY);
365:   }
366:   PetscOptionsTail();
367:   return(0);
368: }

372: static PetscErrorCode EPSPRIMMESetBlockSize_PRIMME(EPS eps,PetscInt bs)
373: {
374:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

377:   if (bs == PETSC_DEFAULT) ops->primme.maxBlockSize = 1;
378:   else if (bs <= 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"PRIMME: block size must be positive");
379:   else ops->primme.maxBlockSize = bs;
380:   return(0);
381: }

385: /*@
386:    EPSPRIMMESetBlockSize - The maximum block size the code will try to use.
387:    The user should set
388:    this based on the architecture specifics of the target computer,
389:    as well as any a priori knowledge of multiplicities. The code does
390:    NOT require BlockSize > 1 to find multiple eigenvalues.  For some
391:    methods, keeping BlockSize = 1 yields the best overall performance.

393:    Collective on EPS

395:    Input Parameters:
396: +  eps - the eigenproblem solver context
397: -  bs - block size

399:    Options Database Key:
400: .  -eps_primme_block_size - Sets the max allowed block size value

402:    Notes:
403:    If the block size is not set, the value established by primme_initialize
404:    is used.

406:    Level: advanced
407: .seealso: EPSPRIMMEGetBlockSize()
408: @*/
409: PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs)
410: {

416:   PetscTryMethod(eps,"EPSPRIMMESetBlockSize_C",(EPS,PetscInt),(eps,bs));
417:   return(0);
418: }

422: static PetscErrorCode EPSPRIMMEGetBlockSize_PRIMME(EPS eps,PetscInt *bs)
423: {
424:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

427:   if (bs) *bs = ops->primme.maxBlockSize;
428:   return(0);
429: }

433: /*@
434:    EPSPRIMMEGetBlockSize - Get the maximum block size the code will try to use.

436:    Collective on EPS

438:    Input Parameters:
439: .  eps - the eigenproblem solver context

441:    Output Parameters:
442: .  bs - returned block size

444:    Level: advanced
445: .seealso: EPSPRIMMESetBlockSize()
446: @*/
447: PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs)
448: {

453:   PetscTryMethod(eps,"EPSPRIMMEGetBlockSize_C",(EPS,PetscInt*),(eps,bs));
454:   return(0);
455: }

459: static PetscErrorCode EPSPRIMMESetMethod_PRIMME(EPS eps,EPSPRIMMEMethod method)
460: {
461:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

464:   if (method == PETSC_DEFAULT) ops->method = DEFAULT_MIN_TIME;
465:   else ops->method = (primme_preset_method)method;
466:   return(0);
467: }

471: /*@
472:    EPSPRIMMESetMethod - Sets the method for the PRIMME library.

474:    Collective on EPS

476:    Input Parameters:
477: +  eps - the eigenproblem solver context
478: -  method - method that will be used by PRIMME. It must be one of:
479:     EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL),
480:     EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI,
481:     EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK,
482:     EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR,
483:     EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION,
484:     EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW

486:    Options Database Key:
487: .  -eps_primme_set_method - Sets the method for the PRIMME library.

489:    Note:
490:    If not set, the method defaults to EPS_PRIMME_DEFAULT_MIN_TIME.

492:    Level: advanced

494: .seealso: EPSPRIMMEGetMethod(), EPSPRIMMEMethod
495: @*/
496: PetscErrorCode EPSPRIMMESetMethod(EPS eps,EPSPRIMMEMethod method)
497: {

503:   PetscTryMethod(eps,"EPSPRIMMESetMethod_C",(EPS,EPSPRIMMEMethod),(eps,method));
504:   return(0);
505: }

509: static PetscErrorCode EPSPRIMMEGetMethod_PRIMME(EPS eps,EPSPRIMMEMethod *method)
510: {
511:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

514:   if (method) *method = (EPSPRIMMEMethod)ops->method;
515:   return(0);
516: }

520: /*@C
521:     EPSPRIMMEGetMethod - Gets the method for the PRIMME library.

523:     Mon Collective on EPS

525:    Input Parameters:
526: .  eps - the eigenproblem solver context

528:    Output Parameters:
529: .  method - method that will be used by PRIMME. It must be one of:
530:     EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL),
531:     EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI,
532:     EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK,
533:     EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR,
534:     EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION,
535:     EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW

537:     Level: advanced

539: .seealso: EPSPRIMMESetMethod(), EPSPRIMMEMethod
540: @*/
541: PetscErrorCode EPSPRIMMEGetMethod(EPS eps,EPSPRIMMEMethod *method)
542: {

547:   PetscTryMethod(eps,"EPSPRIMMEGetMethod_C",(EPS,EPSPRIMMEMethod*),(eps,method));
548:   return(0);
549: }

553: PETSC_EXTERN PetscErrorCode EPSCreate_PRIMME(EPS eps)
554: {
556:   EPS_PRIMME     *primme;

559:   PetscNewLog(eps,EPS_PRIMME,&primme);
560:   eps->data                      = (void*)primme;
561:   eps->ops->setup                = EPSSetUp_PRIMME;
562:   eps->ops->setfromoptions       = EPSSetFromOptions_PRIMME;
563:   eps->ops->destroy              = EPSDestroy_PRIMME;
564:   eps->ops->reset                = EPSReset_PRIMME;
565:   eps->ops->view                 = EPSView_PRIMME;
566:   eps->ops->backtransform        = EPSBackTransform_Default;
567:   eps->ops->computevectors       = EPSComputeVectors_Default;

569:   primme_initialize(&primme->primme);
570:   primme->primme.matrixMatvec = multMatvec_PRIMME;
571:   primme->primme.globalSumDouble = par_GlobalSumDouble;
572:   primme->method = (primme_preset_method)EPS_PRIMME_DEFAULT_MIN_TIME;

574:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetBlockSize_C",EPSPRIMMESetBlockSize_PRIMME);
575:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMESetMethod_C",EPSPRIMMESetMethod_PRIMME);
576:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetBlockSize_C",EPSPRIMMEGetBlockSize_PRIMME);
577:   PetscObjectComposeFunction((PetscObject)eps,"EPSPRIMMEGetMethod_C",EPSPRIMMEGetMethod_PRIMME);
578:   return(0);
579: }

slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/makefile0000644000175000017500000000224112211062077022747 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib #requiresdefine 'SLEPC_HAVE_PRIMME' CFLAGS = ${PRIMME_FLAGS} FFLAGS = SOURCEC = primme.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/external/primme/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/makefile.html0000644000175000017500000000407212211062077023716 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

#requiresdefine   'SLEPC_HAVE_PRIMME'

CFLAGS   = ${PRIMME_FLAGS}
FFLAGS   =
SOURCEC  = primme.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/external/primme/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/index.html0000644000175000017500000000213012211062077023241 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

primme.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/ftn-custom/0000755000175000017500000000000012214143515023347 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/ftn-custom/makefile0000644000175000017500000000221312211062077025045 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zprimmef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/external/primme/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/ftn-custom/zprimmef.c0000644000175000017500000000246012211062077025346 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define epsprimmegetmethod_ EPSPRIMMEGETMETHOD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define epsprimmegetmethod_ epsprimmegetmethod #endif PETSC_EXTERN void PETSC_STDCALL epsprimmegetmethod_(EPS *eps,EPSPRIMMEMethod *method,PetscErrorCode *ierr) { *ierr = EPSPRIMMEGetMethod(*eps,method); } slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/ftn-auto/0000755000175000017500000000000012214143515023005 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/ftn-auto/makefile0000644000175000017500000000035512211062077024510 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = primmef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/external/primme/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/external/primme/ftn-auto/primmef.c0000644000175000017500000000334512211062077024615 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* primme.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsprimmesetblocksize_ EPSPRIMMESETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsprimmesetblocksize_ epsprimmesetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsprimmegetblocksize_ EPSPRIMMEGETBLOCKSIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsprimmegetblocksize_ epsprimmegetblocksize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsprimmesetmethod_ EPSPRIMMESETMETHOD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsprimmesetmethod_ epsprimmesetmethod #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsprimmesetblocksize_(EPS *eps,PetscInt *bs, int *__ierr ){ *__ierr = EPSPRIMMESetBlockSize(*eps,*bs); } void PETSC_STDCALL epsprimmegetblocksize_(EPS *eps,PetscInt *bs, int *__ierr ){ *__ierr = EPSPRIMMEGetBlockSize(*eps,bs); } void PETSC_STDCALL epsprimmesetmethod_(EPS *eps,EPSPRIMMEMethod *method, int *__ierr ){ *__ierr = EPSPRIMMESetMethod(*eps,*method); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/power/0000755000175000017500000000000012214143515017271 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/power/makefile0000644000175000017500000000213712211062077020774 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = power.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/power/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/power/makefile.html0000644000175000017500000000373312211062077021742 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = power.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/power/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/power/power.c.html0000644000175000017500000012363112211062077021542 0ustar gladkgladk
Actual source code: power.c

  1: /*

  3:    SLEPc eigensolver: "power"

  5:    Method: Power Iteration

  7:    Algorithm:

  9:        This solver implements the power iteration for finding dominant
 10:        eigenpairs. It also includes the following well-known methods:
 11:        - Inverse Iteration: when used in combination with shift-and-invert
 12:          spectral transformation.
 13:        - Rayleigh Quotient Iteration (RQI): also with shift-and-invert plus
 14:          a variable shift.

 16:    References:

 18:        [1] "Single Vector Iteration Methods in SLEPc", SLEPc Technical Report
 19:            STR-2, available at http://www.grycap.upv.es/slepc.

 21:    Last update: Feb 2009

 23:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 24:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 25:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 27:    This file is part of SLEPc.

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

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

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

 43: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/
 44: #include <slepcblaslapack.h>

 46: PetscErrorCode EPSSolve_Power(EPS);
 47: PetscErrorCode EPSSolve_TS_Power(EPS);

 49: typedef struct {
 50:   EPSPowerShiftType shift_type;
 51: } EPS_POWER;

 55: PetscErrorCode EPSSetUp_Power(EPS eps)
 56: {
 58:   EPS_POWER      *power = (EPS_POWER*)eps->data;
 59:   PetscBool      flg;
 60:   STMatMode      mode;

 63:   if (eps->ncv) {
 64:     if (eps->ncv<eps->nev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev");
 65:   } else eps->ncv = eps->nev;
 66:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
 67:   if (!eps->max_it) eps->max_it = PetscMax(2000,100*eps->n);
 68:   if (!eps->which) { EPSSetWhichEigenpairs_Default(eps); }
 69:   if (eps->which!=EPS_LARGEST_MAGNITUDE && eps->which !=EPS_TARGET_MAGNITUDE) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
 70:   if (power->shift_type != EPS_POWER_SHIFT_CONSTANT) {
 71:     PetscObjectTypeCompareAny((PetscObject)eps->st,&flg,STSINVERT,STCAYLEY,"");
 72:     if (!flg) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Variable shifts only allowed in shift-and-invert or Cayley ST");
 73:     STGetMatMode(eps->st,&mode);
 74:     if (mode == ST_MATMODE_INPLACE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"ST matrix mode inplace does not work with variable shifts");
 75:   }
 76:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }
 77:   if (eps->balance!=EPS_BALANCE_NONE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Balancing not supported in this solver");
 78:   if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");
 79:   EPSAllocateSolution(eps);
 80:   if (eps->leftvecs) {
 81:     EPSSetWorkVecs(eps,3);
 82:   } else {
 83:     EPSSetWorkVecs(eps,2);
 84:   }

 86:   /* dispatch solve method */
 87:   if (eps->leftvecs) eps->ops->solve = EPSSolve_TS_Power;
 88:   else eps->ops->solve = EPSSolve_Power;
 89:   return(0);
 90: }

 94: PetscErrorCode EPSSolve_Power(EPS eps)
 95: {
 96: #if defined(SLEPC_MISSING_LAPACK_LAEV2)
 98:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LAEV2 - Lapack routine is unavailable");
 99: #else
101:   EPS_POWER      *power = (EPS_POWER*)eps->data;
102:   PetscInt       i;
103:   Vec            v,y,e;
104:   Mat            A;
105:   PetscReal      relerr,norm,rt1,rt2,cs1,anorm;
106:   PetscScalar    theta,rho,delta,sigma,alpha2,beta1,sn1;
107:   PetscBool      breakdown,*select = NULL,hasnorm;

110:   v = eps->V[0];
111:   y = eps->work[1];
112:   e = eps->work[0];

114:   /* prepare for selective orthogonalization of converged vectors */
115:   if (power->shift_type != EPS_POWER_SHIFT_CONSTANT && eps->nev>1) {
116:     STGetOperators(eps->st,0,&A);
117:     MatHasOperation(A,MATOP_NORM,&hasnorm);
118:     if (hasnorm) {
119:       MatNorm(A,NORM_INFINITY,&anorm);
120:       PetscMalloc(eps->nev*sizeof(PetscBool),&select);
121:     }
122:   }

124:   EPSGetStartVector(eps,0,v,NULL);
125:   STGetShift(eps->st,&sigma);    /* original shift */
126:   rho = sigma;

128:   while (eps->reason == EPS_CONVERGED_ITERATING) {
129:     eps->its = eps->its + 1;

131:     /* y = OP v */
132:     STApply(eps->st,v,y);

134:     /* theta = (v,y)_B */
135:     IPInnerProduct(eps->ip,v,y,&theta);

137:     if (power->shift_type == EPS_POWER_SHIFT_CONSTANT) { /* direct & inverse iteration */

139:       /* approximate eigenvalue is the Rayleigh quotient */
140:       eps->eigr[eps->nconv] = theta;

142:       /* compute relative error as ||y-theta v||_2/|theta| */
143:       VecCopy(y,e);
144:       VecAXPY(e,-theta,v);
145:       VecNorm(e,NORM_2,&norm);
146:       relerr = norm / PetscAbsScalar(theta);

148:     } else {  /* RQI */

150:       /* delta = ||y||_B */
151:       IPNorm(eps->ip,y,&norm);
152:       delta = norm;

154:       /* compute relative error */
155:       if (rho == 0.0) relerr = PETSC_MAX_REAL;
156:       else relerr = 1.0 / (norm*PetscAbsScalar(rho));

158:       /* approximate eigenvalue is the shift */
159:       eps->eigr[eps->nconv] = rho;

161:       /* compute new shift */
162:       if (relerr<eps->tol) {
163:         rho = sigma; /* if converged, restore original shift */
164:         STSetShift(eps->st,rho);
165:       } else {
166:         rho = rho + theta/(delta*delta);  /* Rayleigh quotient R(v) */
167:         if (power->shift_type == EPS_POWER_SHIFT_WILKINSON) {
168:           /* beta1 is the norm of the residual associated to R(v) */
169:           VecAXPY(v,-theta/(delta*delta),y);
170:           VecScale(v,1.0/delta);
171:           IPNorm(eps->ip,v,&norm);
172:           beta1 = norm;

174:           /* alpha2 = (e'*A*e)/(beta1*beta1), where e is the residual */
175:           STGetOperators(eps->st,0,&A);
176:           MatMult(A,v,e);
177:           VecDot(v,e,&alpha2);
178:           alpha2 = alpha2 / (beta1 * beta1);

180:           /* choose the eigenvalue of [rho beta1; beta1 alpha2] closest to rho */
181:           PetscFPTrapPush(PETSC_FP_TRAP_OFF);
182:           PetscStackCallBLAS("LAPACKlaev2",LAPACKlaev2_(&rho,&beta1,&alpha2,&rt1,&rt2,&cs1,&sn1));
183:           PetscFPTrapPop();
184:           if (PetscAbsScalar(rt1-rho) < PetscAbsScalar(rt2-rho)) rho = rt1;
185:           else rho = rt2;
186:         }
187:         /* update operator according to new shift */
188:         PetscPushErrorHandler(PetscIgnoreErrorHandler,NULL);
189:         STSetShift(eps->st,rho);
190:         PetscPopErrorHandler();
191:         if (ierr) {
192:           eps->eigr[eps->nconv] = rho;
193:           relerr = PETSC_MACHINE_EPSILON;
194:           rho = sigma;
195:           STSetShift(eps->st,rho);
196:         }
197:       }
198:     }

200:     eps->errest[eps->nconv] = relerr;
201:     EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,eps->nconv+1);

203:     /* purge previously converged eigenvectors */
204:     if (select) {
205:       for (i=0;i<eps->nconv;i++) {
206:         if (PetscAbsScalar(rho-eps->eigr[i])>eps->its*anorm/1000) select[i] = PETSC_TRUE;
207:         else select[i] = PETSC_FALSE;
208:       }
209:       IPOrthogonalize(eps->ip,eps->nds,eps->defl,eps->nconv,select,eps->V,y,NULL,&norm,NULL);
210:     } else {
211:       IPOrthogonalize(eps->ip,eps->nds,eps->defl,eps->nconv,NULL,eps->V,y,NULL,&norm,NULL);
212:     }

214:     /* v = y/||y||_B */
215:     VecCopy(y,v);
216:     VecScale(v,1.0/norm);

218:     /* if relerr<tol, accept eigenpair */
219:     if (relerr<eps->tol) {
220:       eps->nconv = eps->nconv + 1;
221:       if (eps->nconv==eps->nev) eps->reason = EPS_CONVERGED_TOL;
222:       else {
223:         v = eps->V[eps->nconv];
224:         EPSGetStartVector(eps,eps->nconv,v,&breakdown);
225:         if (breakdown) {
226:           eps->reason = EPS_DIVERGED_BREAKDOWN;
227:           PetscInfo(eps,"Unable to generate more start vectors\n");
228:         }
229:       }
230:     }
231:     if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS;
232:   }
233:   PetscFree(select);
234:   return(0);
235: #endif
236: }

240: PetscErrorCode EPSSolve_TS_Power(EPS eps)
241: {
242: #if defined(SLEPC_MISSING_LAPACK_LAEV2)
244:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LAEV2 - Lapack routine is unavailable");
245: #else
247:   EPS_POWER      *power = (EPS_POWER*)eps->data;
248:   Vec            v,w,y,z,e;
249:   Mat            A;
250:   PetscReal      relerr,norm,rt1,rt2,cs1;
251:   PetscScalar    theta,alpha,beta,rho,delta,sigma,alpha2,beta1,sn1;

254:   v = eps->V[0];
255:   y = eps->work[1];
256:   e = eps->work[0];
257:   w = eps->W[0];
258:   z = eps->work[2];

260:   EPSGetStartVector(eps,0,v,NULL);
261:   EPSGetStartVectorLeft(eps,0,w,NULL);
262:   STGetShift(eps->st,&sigma);    /* original shift */
263:   rho = sigma;

265:   while (eps->its<eps->max_it) {
266:     eps->its++;

268:     /* y = OP v, z = OP' w */
269:     STApply(eps->st,v,y);
270:     STApplyTranspose(eps->st,w,z);

272:     /* theta = (v,z)_B */
273:     IPInnerProduct(eps->ip,v,z,&theta);

275:     if (power->shift_type == EPS_POWER_SHIFT_CONSTANT) { /* direct & inverse iteration */

277:       /* approximate eigenvalue is the Rayleigh quotient */
278:       eps->eigr[eps->nconv] = theta;

280:       /* compute relative errors (right and left) */
281:       VecCopy(y,e);
282:       VecAXPY(e,-theta,v);
283:       VecNorm(e,NORM_2,&norm);
284:       relerr = norm / PetscAbsScalar(theta);
285:       eps->errest[eps->nconv] = relerr;
286:       VecCopy(z,e);
287:       VecAXPY(e,-theta,w);
288:       VecNorm(e,NORM_2,&norm);
289:       relerr = norm / PetscAbsScalar(theta);
290:       eps->errest_left[eps->nconv] = relerr;

292:     } else {  /* RQI */

294:       /* delta = sqrt(y,z)_B */
295:       IPInnerProduct(eps->ip,y,z,&alpha);
296:       if (alpha==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Breakdown in two-sided Power/RQI");
297:       delta = PetscSqrtScalar(alpha);

299:       /* compute relative error */
300:       if (rho == 0.0) relerr = PETSC_MAX_REAL;
301:       else relerr = 1.0 / (PetscAbsScalar(delta*rho));
302:       eps->errest[eps->nconv] = relerr;
303:       eps->errest_left[eps->nconv] = relerr;

305:       /* approximate eigenvalue is the shift */
306:       eps->eigr[eps->nconv] = rho;

308:       /* compute new shift */
309:       if (eps->errest[eps->nconv]<eps->tol && eps->errest_left[eps->nconv]<eps->tol) {
310:         rho = sigma; /* if converged, restore original shift */
311:         STSetShift(eps->st,rho);
312:       } else {
313:         rho = rho + theta/(delta*delta);  /* Rayleigh quotient R(v,w) */
314:         if (power->shift_type == EPS_POWER_SHIFT_WILKINSON) {
315:           /* beta1 is the norm of the residual associated to R(v,w) */
316:           VecAXPY(v,-theta/(delta*delta),y);
317:           VecScale(v,1.0/delta);
318:           IPNorm(eps->ip,v,&norm);
319:           beta1 = norm;

321:           /* alpha2 = (e'*A*e)/(beta1*beta1), where e is the residual */
322:           STGetOperators(eps->st,0,&A);
323:           MatMult(A,v,e);
324:           VecDot(v,e,&alpha2);
325:           alpha2 = alpha2 / (beta1 * beta1);

327:           /* choose the eigenvalue of [rho beta1; beta1 alpha2] closest to rho */
328:           PetscFPTrapPush(PETSC_FP_TRAP_OFF);
329:           PetscStackCallBLAS("LAPACKlaev2",LAPACKlaev2_(&rho,&beta1,&alpha2,&rt1,&rt2,&cs1,&sn1));
330:           PetscFPTrapPop();
331:           if (PetscAbsScalar(rt1-rho) < PetscAbsScalar(rt2-rho)) rho = rt1;
332:           else rho = rt2;
333:         }
334:         /* update operator according to new shift */
335:         PetscPushErrorHandler(PetscIgnoreErrorHandler,NULL);
336:         STSetShift(eps->st,rho);
337:         PetscPopErrorHandler();
338:         if (ierr) {
339:           eps->eigr[eps->nconv] = rho;
340:           eps->errest[eps->nconv] = PETSC_MACHINE_EPSILON;
341:           eps->errest_left[eps->nconv] = PETSC_MACHINE_EPSILON;
342:           rho = sigma;
343:           STSetShift(eps->st,rho);
344:         }
345:       }
346:     }

348:     EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,eps->nconv+1);
349:     EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest_left,eps->nconv+1);

351:     /* purge previously converged eigenvectors */
352:     IPBiOrthogonalize(eps->ip,eps->nconv,eps->V,eps->W,z,NULL,NULL);
353:     IPBiOrthogonalize(eps->ip,eps->nconv,eps->W,eps->V,y,NULL,NULL);

355:     /* normalize so that (y,z)_B=1  */
356:     VecCopy(y,v);
357:     VecCopy(z,w);
358:     IPInnerProduct(eps->ip,y,z,&alpha);
359:     if (alpha==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Breakdown in two-sided Power/RQI");
360:     delta = PetscSqrtScalar(PetscAbsScalar(alpha));
361:     beta = 1.0/PetscConj(alpha/delta);
362:     delta = 1.0/delta;
363:     VecScale(w,beta);
364:     VecScale(v,delta);

366:     /* if relerr<tol (both right and left), accept eigenpair */
367:     if (eps->errest[eps->nconv]<eps->tol && eps->errest_left[eps->nconv]<eps->tol) {
368:       eps->nconv = eps->nconv + 1;
369:       if (eps->nconv==eps->nev) break;
370:       v = eps->V[eps->nconv];
371:       EPSGetStartVector(eps,eps->nconv,v,NULL);
372:       w = eps->W[eps->nconv];
373:       EPSGetStartVectorLeft(eps,eps->nconv,w,NULL);
374:     }
375:   }
376:   if (eps->nconv == eps->nev) eps->reason = EPS_CONVERGED_TOL;
377:   else eps->reason = EPS_DIVERGED_ITS;
378:   return(0);
379: #endif
380: }

384: PetscErrorCode EPSBackTransform_Power(EPS eps)
385: {
387:   EPS_POWER      *power = (EPS_POWER*)eps->data;

390:   if (power->shift_type == EPS_POWER_SHIFT_CONSTANT) {
391:     EPSBackTransform_Default(eps);
392:   }
393:   return(0);
394: }

398: PetscErrorCode EPSSetFromOptions_Power(EPS eps)
399: {
400:   PetscErrorCode    ierr;
401:   EPS_POWER         *power = (EPS_POWER*)eps->data;
402:   PetscBool         flg;
403:   EPSPowerShiftType shift;

406:   PetscOptionsHead("EPS Power Options");
407:   PetscOptionsEnum("-eps_power_shift_type","Shift type","EPSPowerSetShiftType",EPSPowerShiftTypes,(PetscEnum)power->shift_type,(PetscEnum*)&shift,&flg);
408:   if (flg) {
409:     EPSPowerSetShiftType(eps,shift);
410:   }
411:   if (power->shift_type != EPS_POWER_SHIFT_CONSTANT) {
412:     STSetType(eps->st,STSINVERT);
413:   }
414:   PetscOptionsTail();
415:   return(0);
416: }

420: static PetscErrorCode EPSPowerSetShiftType_Power(EPS eps,EPSPowerShiftType shift)
421: {
422:   EPS_POWER *power = (EPS_POWER*)eps->data;

425:   switch (shift) {
426:     case EPS_POWER_SHIFT_CONSTANT:
427:     case EPS_POWER_SHIFT_RAYLEIGH:
428:     case EPS_POWER_SHIFT_WILKINSON:
429:       power->shift_type = shift;
430:       break;
431:     default:
432:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid shift type");
433:   }
434:   return(0);
435: }

439: /*@
440:    EPSPowerSetShiftType - Sets the type of shifts used during the power
441:    iteration. This can be used to emulate the Rayleigh Quotient Iteration
442:    (RQI) method.

444:    Logically Collective on EPS

446:    Input Parameters:
447: +  eps - the eigenproblem solver context
448: -  shift - the type of shift

450:    Options Database Key:
451: .  -eps_power_shift_type - Sets the shift type (either 'constant' or
452:                            'rayleigh' or 'wilkinson')

454:    Notes:
455:    By default, shifts are constant (EPS_POWER_SHIFT_CONSTANT) and the iteration
456:    is the simple power method (or inverse iteration if a shift-and-invert
457:    transformation is being used).

459:    A variable shift can be specified (EPS_POWER_SHIFT_RAYLEIGH or
460:    EPS_POWER_SHIFT_WILKINSON). In this case, the iteration behaves rather like
461:    a cubic converging method as RQI. See the users manual for details.

463:    Level: advanced

465: .seealso: EPSPowerGetShiftType(), STSetShift(), EPSPowerShiftType
466: @*/
467: PetscErrorCode EPSPowerSetShiftType(EPS eps,EPSPowerShiftType shift)
468: {

474:   PetscTryMethod(eps,"EPSPowerSetShiftType_C",(EPS,EPSPowerShiftType),(eps,shift));
475:   return(0);
476: }

480: static PetscErrorCode EPSPowerGetShiftType_Power(EPS eps,EPSPowerShiftType *shift)
481: {
482:   EPS_POWER  *power = (EPS_POWER*)eps->data;

485:   *shift = power->shift_type;
486:   return(0);
487: }

491: /*@C
492:    EPSPowerGetShiftType - Gets the type of shifts used during the power
493:    iteration.

495:    Not Collective

497:    Input Parameter:
498: .  eps - the eigenproblem solver context

500:    Input Parameter:
501: .  shift - the type of shift

503:    Level: advanced

505: .seealso: EPSPowerSetShiftType(), EPSPowerShiftType
506: @*/
507: PetscErrorCode EPSPowerGetShiftType(EPS eps,EPSPowerShiftType *shift)
508: {

514:   PetscTryMethod(eps,"EPSPowerGetShiftType_C",(EPS,EPSPowerShiftType*),(eps,shift));
515:   return(0);
516: }

520: PetscErrorCode EPSDestroy_Power(EPS eps)
521: {

525:   PetscFree(eps->data);
526:   PetscObjectComposeFunction((PetscObject)eps,"EPSPowerSetShiftType_C",NULL);
527:   PetscObjectComposeFunction((PetscObject)eps,"EPSPowerGetShiftType_C",NULL);
528:   return(0);
529: }

533: PetscErrorCode EPSView_Power(EPS eps,PetscViewer viewer)
534: {
536:   EPS_POWER      *power = (EPS_POWER*)eps->data;
537:   PetscBool      isascii;

540:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
541:   if (isascii) {
542:     PetscViewerASCIIPrintf(viewer,"  Power: %s shifts\n",EPSPowerShiftTypes[power->shift_type]);
543:   }
544:   return(0);
545: }

549: PETSC_EXTERN PetscErrorCode EPSCreate_Power(EPS eps)
550: {

554:   PetscNewLog(eps,EPS_POWER,&eps->data);
555:   eps->ops->setup                = EPSSetUp_Power;
556:   eps->ops->setfromoptions       = EPSSetFromOptions_Power;
557:   eps->ops->destroy              = EPSDestroy_Power;
558:   eps->ops->reset                = EPSReset_Default;
559:   eps->ops->view                 = EPSView_Power;
560:   eps->ops->backtransform        = EPSBackTransform_Power;
561:   eps->ops->computevectors       = EPSComputeVectors_Default;
562:   PetscObjectComposeFunction((PetscObject)eps,"EPSPowerSetShiftType_C",EPSPowerSetShiftType_Power);
563:   PetscObjectComposeFunction((PetscObject)eps,"EPSPowerGetShiftType_C",EPSPowerGetShiftType_Power);
564:   return(0);
565: }

slepc-3.4.2.dfsg.orig/src/eps/impls/power/index.html0000644000175000017500000000212612211062077021267 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

power.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/power/power.c0000644000175000017500000004776012211062077020607 0ustar gladkgladk/* SLEPc eigensolver: "power" Method: Power Iteration Algorithm: This solver implements the power iteration for finding dominant eigenpairs. It also includes the following well-known methods: - Inverse Iteration: when used in combination with shift-and-invert spectral transformation. - Rayleigh Quotient Iteration (RQI): also with shift-and-invert plus a variable shift. References: [1] "Single Vector Iteration Methods in SLEPc", SLEPc Technical Report STR-2, available at http://www.grycap.upv.es/slepc. Last update: Feb 2009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include PetscErrorCode EPSSolve_Power(EPS); PetscErrorCode EPSSolve_TS_Power(EPS); typedef struct { EPSPowerShiftType shift_type; } EPS_POWER; #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_Power" PetscErrorCode EPSSetUp_Power(EPS eps) { PetscErrorCode ierr; EPS_POWER *power = (EPS_POWER*)eps->data; PetscBool flg; STMatMode mode; PetscFunctionBegin; if (eps->ncv) { if (eps->ncvnev) SETERRQ(PetscObjectComm((PetscObject)eps),1,"The value of ncv must be at least nev"); } else eps->ncv = eps->nev; if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->max_it) eps->max_it = PetscMax(2000,100*eps->n); if (!eps->which) { ierr = EPSSetWhichEigenpairs_Default(eps);CHKERRQ(ierr); } if (eps->which!=EPS_LARGEST_MAGNITUDE && eps->which !=EPS_TARGET_MAGNITUDE) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); if (power->shift_type != EPS_POWER_SHIFT_CONSTANT) { ierr = PetscObjectTypeCompareAny((PetscObject)eps->st,&flg,STSINVERT,STCAYLEY,"");CHKERRQ(ierr); if (!flg) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Variable shifts only allowed in shift-and-invert or Cayley ST"); ierr = STGetMatMode(eps->st,&mode);CHKERRQ(ierr); if (mode == ST_MATMODE_INPLACE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"ST matrix mode inplace does not work with variable shifts"); } if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } if (eps->balance!=EPS_BALANCE_NONE) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Balancing not supported in this solver"); if (eps->arbitrary) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver"); ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); if (eps->leftvecs) { ierr = EPSSetWorkVecs(eps,3);CHKERRQ(ierr); } else { ierr = EPSSetWorkVecs(eps,2);CHKERRQ(ierr); } /* dispatch solve method */ if (eps->leftvecs) eps->ops->solve = EPSSolve_TS_Power; else eps->ops->solve = EPSSolve_Power; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_Power" PetscErrorCode EPSSolve_Power(EPS eps) { #if defined(SLEPC_MISSING_LAPACK_LAEV2) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LAEV2 - Lapack routine is unavailable"); #else PetscErrorCode ierr; EPS_POWER *power = (EPS_POWER*)eps->data; PetscInt i; Vec v,y,e; Mat A; PetscReal relerr,norm,rt1,rt2,cs1,anorm; PetscScalar theta,rho,delta,sigma,alpha2,beta1,sn1; PetscBool breakdown,*select = NULL,hasnorm; PetscFunctionBegin; v = eps->V[0]; y = eps->work[1]; e = eps->work[0]; /* prepare for selective orthogonalization of converged vectors */ if (power->shift_type != EPS_POWER_SHIFT_CONSTANT && eps->nev>1) { ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); ierr = MatHasOperation(A,MATOP_NORM,&hasnorm);CHKERRQ(ierr); if (hasnorm) { ierr = MatNorm(A,NORM_INFINITY,&anorm);CHKERRQ(ierr); ierr = PetscMalloc(eps->nev*sizeof(PetscBool),&select);CHKERRQ(ierr); } } ierr = EPSGetStartVector(eps,0,v,NULL);CHKERRQ(ierr); ierr = STGetShift(eps->st,&sigma);CHKERRQ(ierr); /* original shift */ rho = sigma; while (eps->reason == EPS_CONVERGED_ITERATING) { eps->its = eps->its + 1; /* y = OP v */ ierr = STApply(eps->st,v,y);CHKERRQ(ierr); /* theta = (v,y)_B */ ierr = IPInnerProduct(eps->ip,v,y,&theta);CHKERRQ(ierr); if (power->shift_type == EPS_POWER_SHIFT_CONSTANT) { /* direct & inverse iteration */ /* approximate eigenvalue is the Rayleigh quotient */ eps->eigr[eps->nconv] = theta; /* compute relative error as ||y-theta v||_2/|theta| */ ierr = VecCopy(y,e);CHKERRQ(ierr); ierr = VecAXPY(e,-theta,v);CHKERRQ(ierr); ierr = VecNorm(e,NORM_2,&norm);CHKERRQ(ierr); relerr = norm / PetscAbsScalar(theta); } else { /* RQI */ /* delta = ||y||_B */ ierr = IPNorm(eps->ip,y,&norm);CHKERRQ(ierr); delta = norm; /* compute relative error */ if (rho == 0.0) relerr = PETSC_MAX_REAL; else relerr = 1.0 / (norm*PetscAbsScalar(rho)); /* approximate eigenvalue is the shift */ eps->eigr[eps->nconv] = rho; /* compute new shift */ if (relerrtol) { rho = sigma; /* if converged, restore original shift */ ierr = STSetShift(eps->st,rho);CHKERRQ(ierr); } else { rho = rho + theta/(delta*delta); /* Rayleigh quotient R(v) */ if (power->shift_type == EPS_POWER_SHIFT_WILKINSON) { /* beta1 is the norm of the residual associated to R(v) */ ierr = VecAXPY(v,-theta/(delta*delta),y);CHKERRQ(ierr); ierr = VecScale(v,1.0/delta);CHKERRQ(ierr); ierr = IPNorm(eps->ip,v,&norm);CHKERRQ(ierr); beta1 = norm; /* alpha2 = (e'*A*e)/(beta1*beta1), where e is the residual */ ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); ierr = MatMult(A,v,e);CHKERRQ(ierr); ierr = VecDot(v,e,&alpha2);CHKERRQ(ierr); alpha2 = alpha2 / (beta1 * beta1); /* choose the eigenvalue of [rho beta1; beta1 alpha2] closest to rho */ ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKlaev2",LAPACKlaev2_(&rho,&beta1,&alpha2,&rt1,&rt2,&cs1,&sn1)); ierr = PetscFPTrapPop();CHKERRQ(ierr); if (PetscAbsScalar(rt1-rho) < PetscAbsScalar(rt2-rho)) rho = rt1; else rho = rt2; } /* update operator according to new shift */ PetscPushErrorHandler(PetscIgnoreErrorHandler,NULL); ierr = STSetShift(eps->st,rho);CHKERRQ(ierr); PetscPopErrorHandler(); if (ierr) { eps->eigr[eps->nconv] = rho; relerr = PETSC_MACHINE_EPSILON; rho = sigma; ierr = STSetShift(eps->st,rho);CHKERRQ(ierr); } } } eps->errest[eps->nconv] = relerr; ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,eps->nconv+1);CHKERRQ(ierr); /* purge previously converged eigenvectors */ if (select) { for (i=0;inconv;i++) { if (PetscAbsScalar(rho-eps->eigr[i])>eps->its*anorm/1000) select[i] = PETSC_TRUE; else select[i] = PETSC_FALSE; } ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,eps->nconv,select,eps->V,y,NULL,&norm,NULL);CHKERRQ(ierr); } else { ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,eps->nconv,NULL,eps->V,y,NULL,&norm,NULL);CHKERRQ(ierr); } /* v = y/||y||_B */ ierr = VecCopy(y,v);CHKERRQ(ierr); ierr = VecScale(v,1.0/norm);CHKERRQ(ierr); /* if relerrtol) { eps->nconv = eps->nconv + 1; if (eps->nconv==eps->nev) eps->reason = EPS_CONVERGED_TOL; else { v = eps->V[eps->nconv]; ierr = EPSGetStartVector(eps,eps->nconv,v,&breakdown);CHKERRQ(ierr); if (breakdown) { eps->reason = EPS_DIVERGED_BREAKDOWN; ierr = PetscInfo(eps,"Unable to generate more start vectors\n");CHKERRQ(ierr); } } } if (eps->its >= eps->max_it) eps->reason = EPS_DIVERGED_ITS; } ierr = PetscFree(select);CHKERRQ(ierr); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_TS_Power" PetscErrorCode EPSSolve_TS_Power(EPS eps) { #if defined(SLEPC_MISSING_LAPACK_LAEV2) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LAEV2 - Lapack routine is unavailable"); #else PetscErrorCode ierr; EPS_POWER *power = (EPS_POWER*)eps->data; Vec v,w,y,z,e; Mat A; PetscReal relerr,norm,rt1,rt2,cs1; PetscScalar theta,alpha,beta,rho,delta,sigma,alpha2,beta1,sn1; PetscFunctionBegin; v = eps->V[0]; y = eps->work[1]; e = eps->work[0]; w = eps->W[0]; z = eps->work[2]; ierr = EPSGetStartVector(eps,0,v,NULL);CHKERRQ(ierr); ierr = EPSGetStartVectorLeft(eps,0,w,NULL);CHKERRQ(ierr); ierr = STGetShift(eps->st,&sigma);CHKERRQ(ierr); /* original shift */ rho = sigma; while (eps->itsmax_it) { eps->its++; /* y = OP v, z = OP' w */ ierr = STApply(eps->st,v,y);CHKERRQ(ierr); ierr = STApplyTranspose(eps->st,w,z);CHKERRQ(ierr); /* theta = (v,z)_B */ ierr = IPInnerProduct(eps->ip,v,z,&theta);CHKERRQ(ierr); if (power->shift_type == EPS_POWER_SHIFT_CONSTANT) { /* direct & inverse iteration */ /* approximate eigenvalue is the Rayleigh quotient */ eps->eigr[eps->nconv] = theta; /* compute relative errors (right and left) */ ierr = VecCopy(y,e);CHKERRQ(ierr); ierr = VecAXPY(e,-theta,v);CHKERRQ(ierr); ierr = VecNorm(e,NORM_2,&norm);CHKERRQ(ierr); relerr = norm / PetscAbsScalar(theta); eps->errest[eps->nconv] = relerr; ierr = VecCopy(z,e);CHKERRQ(ierr); ierr = VecAXPY(e,-theta,w);CHKERRQ(ierr); ierr = VecNorm(e,NORM_2,&norm);CHKERRQ(ierr); relerr = norm / PetscAbsScalar(theta); eps->errest_left[eps->nconv] = relerr; } else { /* RQI */ /* delta = sqrt(y,z)_B */ ierr = IPInnerProduct(eps->ip,y,z,&alpha);CHKERRQ(ierr); if (alpha==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Breakdown in two-sided Power/RQI"); delta = PetscSqrtScalar(alpha); /* compute relative error */ if (rho == 0.0) relerr = PETSC_MAX_REAL; else relerr = 1.0 / (PetscAbsScalar(delta*rho)); eps->errest[eps->nconv] = relerr; eps->errest_left[eps->nconv] = relerr; /* approximate eigenvalue is the shift */ eps->eigr[eps->nconv] = rho; /* compute new shift */ if (eps->errest[eps->nconv]tol && eps->errest_left[eps->nconv]tol) { rho = sigma; /* if converged, restore original shift */ ierr = STSetShift(eps->st,rho);CHKERRQ(ierr); } else { rho = rho + theta/(delta*delta); /* Rayleigh quotient R(v,w) */ if (power->shift_type == EPS_POWER_SHIFT_WILKINSON) { /* beta1 is the norm of the residual associated to R(v,w) */ ierr = VecAXPY(v,-theta/(delta*delta),y);CHKERRQ(ierr); ierr = VecScale(v,1.0/delta);CHKERRQ(ierr); ierr = IPNorm(eps->ip,v,&norm);CHKERRQ(ierr); beta1 = norm; /* alpha2 = (e'*A*e)/(beta1*beta1), where e is the residual */ ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); ierr = MatMult(A,v,e);CHKERRQ(ierr); ierr = VecDot(v,e,&alpha2);CHKERRQ(ierr); alpha2 = alpha2 / (beta1 * beta1); /* choose the eigenvalue of [rho beta1; beta1 alpha2] closest to rho */ ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKlaev2",LAPACKlaev2_(&rho,&beta1,&alpha2,&rt1,&rt2,&cs1,&sn1)); ierr = PetscFPTrapPop();CHKERRQ(ierr); if (PetscAbsScalar(rt1-rho) < PetscAbsScalar(rt2-rho)) rho = rt1; else rho = rt2; } /* update operator according to new shift */ PetscPushErrorHandler(PetscIgnoreErrorHandler,NULL); ierr = STSetShift(eps->st,rho);CHKERRQ(ierr); PetscPopErrorHandler(); if (ierr) { eps->eigr[eps->nconv] = rho; eps->errest[eps->nconv] = PETSC_MACHINE_EPSILON; eps->errest_left[eps->nconv] = PETSC_MACHINE_EPSILON; rho = sigma; ierr = STSetShift(eps->st,rho);CHKERRQ(ierr); } } } ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,eps->nconv+1);CHKERRQ(ierr); ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest_left,eps->nconv+1);CHKERRQ(ierr); /* purge previously converged eigenvectors */ ierr = IPBiOrthogonalize(eps->ip,eps->nconv,eps->V,eps->W,z,NULL,NULL);CHKERRQ(ierr); ierr = IPBiOrthogonalize(eps->ip,eps->nconv,eps->W,eps->V,y,NULL,NULL);CHKERRQ(ierr); /* normalize so that (y,z)_B=1 */ ierr = VecCopy(y,v);CHKERRQ(ierr); ierr = VecCopy(z,w);CHKERRQ(ierr); ierr = IPInnerProduct(eps->ip,y,z,&alpha);CHKERRQ(ierr); if (alpha==0.0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Breakdown in two-sided Power/RQI"); delta = PetscSqrtScalar(PetscAbsScalar(alpha)); beta = 1.0/PetscConj(alpha/delta); delta = 1.0/delta; ierr = VecScale(w,beta);CHKERRQ(ierr); ierr = VecScale(v,delta);CHKERRQ(ierr); /* if relerrerrest[eps->nconv]tol && eps->errest_left[eps->nconv]tol) { eps->nconv = eps->nconv + 1; if (eps->nconv==eps->nev) break; v = eps->V[eps->nconv]; ierr = EPSGetStartVector(eps,eps->nconv,v,NULL);CHKERRQ(ierr); w = eps->W[eps->nconv]; ierr = EPSGetStartVectorLeft(eps,eps->nconv,w,NULL);CHKERRQ(ierr); } } if (eps->nconv == eps->nev) eps->reason = EPS_CONVERGED_TOL; else eps->reason = EPS_DIVERGED_ITS; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "EPSBackTransform_Power" PetscErrorCode EPSBackTransform_Power(EPS eps) { PetscErrorCode ierr; EPS_POWER *power = (EPS_POWER*)eps->data; PetscFunctionBegin; if (power->shift_type == EPS_POWER_SHIFT_CONSTANT) { ierr = EPSBackTransform_Default(eps);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions_Power" PetscErrorCode EPSSetFromOptions_Power(EPS eps) { PetscErrorCode ierr; EPS_POWER *power = (EPS_POWER*)eps->data; PetscBool flg; EPSPowerShiftType shift; PetscFunctionBegin; ierr = PetscOptionsHead("EPS Power Options");CHKERRQ(ierr); ierr = PetscOptionsEnum("-eps_power_shift_type","Shift type","EPSPowerSetShiftType",EPSPowerShiftTypes,(PetscEnum)power->shift_type,(PetscEnum*)&shift,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSPowerSetShiftType(eps,shift);CHKERRQ(ierr); } if (power->shift_type != EPS_POWER_SHIFT_CONSTANT) { ierr = STSetType(eps->st,STSINVERT);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPowerSetShiftType_Power" static PetscErrorCode EPSPowerSetShiftType_Power(EPS eps,EPSPowerShiftType shift) { EPS_POWER *power = (EPS_POWER*)eps->data; PetscFunctionBegin; switch (shift) { case EPS_POWER_SHIFT_CONSTANT: case EPS_POWER_SHIFT_RAYLEIGH: case EPS_POWER_SHIFT_WILKINSON: power->shift_type = shift; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid shift type"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPowerSetShiftType" /*@ EPSPowerSetShiftType - Sets the type of shifts used during the power iteration. This can be used to emulate the Rayleigh Quotient Iteration (RQI) method. Logically Collective on EPS Input Parameters: + eps - the eigenproblem solver context - shift - the type of shift Options Database Key: . -eps_power_shift_type - Sets the shift type (either 'constant' or 'rayleigh' or 'wilkinson') Notes: By default, shifts are constant (EPS_POWER_SHIFT_CONSTANT) and the iteration is the simple power method (or inverse iteration if a shift-and-invert transformation is being used). A variable shift can be specified (EPS_POWER_SHIFT_RAYLEIGH or EPS_POWER_SHIFT_WILKINSON). In this case, the iteration behaves rather like a cubic converging method as RQI. See the users manual for details. Level: advanced .seealso: EPSPowerGetShiftType(), STSetShift(), EPSPowerShiftType @*/ PetscErrorCode EPSPowerSetShiftType(EPS eps,EPSPowerShiftType shift) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,shift,2); ierr = PetscTryMethod(eps,"EPSPowerSetShiftType_C",(EPS,EPSPowerShiftType),(eps,shift));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPowerGetShiftType_Power" static PetscErrorCode EPSPowerGetShiftType_Power(EPS eps,EPSPowerShiftType *shift) { EPS_POWER *power = (EPS_POWER*)eps->data; PetscFunctionBegin; *shift = power->shift_type; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPowerGetShiftType" /*@C EPSPowerGetShiftType - Gets the type of shifts used during the power iteration. Not Collective Input Parameter: . eps - the eigenproblem solver context Input Parameter: . shift - the type of shift Level: advanced .seealso: EPSPowerSetShiftType(), EPSPowerShiftType @*/ PetscErrorCode EPSPowerGetShiftType(EPS eps,EPSPowerShiftType *shift) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(shift,2); ierr = PetscTryMethod(eps,"EPSPowerGetShiftType_C",(EPS,EPSPowerShiftType*),(eps,shift));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy_Power" PetscErrorCode EPSDestroy_Power(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(eps->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPowerSetShiftType_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPowerGetShiftType_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView_Power" PetscErrorCode EPSView_Power(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; EPS_POWER *power = (EPS_POWER*)eps->data; PetscBool isascii; PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerASCIIPrintf(viewer," Power: %s shifts\n",EPSPowerShiftTypes[power->shift_type]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_Power" PETSC_EXTERN PetscErrorCode EPSCreate_Power(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(eps,EPS_POWER,&eps->data);CHKERRQ(ierr); eps->ops->setup = EPSSetUp_Power; eps->ops->setfromoptions = EPSSetFromOptions_Power; eps->ops->destroy = EPSDestroy_Power; eps->ops->reset = EPSReset_Default; eps->ops->view = EPSView_Power; eps->ops->backtransform = EPSBackTransform_Power; eps->ops->computevectors = EPSComputeVectors_Default; ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPowerSetShiftType_C",EPSPowerSetShiftType_Power);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)eps,"EPSPowerGetShiftType_C",EPSPowerGetShiftType_Power);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/impls/power/ftn-auto/0000755000175000017500000000000012214143515021026 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/power/ftn-auto/makefile0000644000175000017500000000034212211062077022525 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = powerf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/impls/power/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/power/ftn-auto/powerf.c0000644000175000017500000000205712211062077022500 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* power.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epspowersetshifttype_ EPSPOWERSETSHIFTTYPE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epspowersetshifttype_ epspowersetshifttype #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epspowersetshifttype_(EPS *eps,EPSPowerShiftType *shift, int *__ierr ){ *__ierr = EPSPowerSetShiftType(*eps,*shift); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/impls/lapack/0000755000175000017500000000000012214143515017370 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/impls/lapack/lapack.c.html0000644000175000017500000003656612211062077021752 0ustar gladkgladk

Actual source code: lapack.c

  1: /*
  2:    This file implements a wrapper to the LAPACK eigenvalue subroutines.
  3:    Generalized problems are transformed to standard ones only if necessary.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/epsimpl.h>     /*I "slepceps.h" I*/
 26: #include <slepcblaslapack.h>

 30: PetscErrorCode EPSSetUp_LAPACK(EPS eps)
 31: {
 32:   PetscErrorCode ierr,ierra,ierrb;
 33:   PetscBool      isshift,denseok=PETSC_FALSE;
 34:   Mat            A,B,OP,Adense,Bdense;
 35:   PetscScalar    shift,*Ap,*Bp;
 36:   PetscInt       i,ld,nmat;
 37:   KSP            ksp;
 38:   PC             pc;
 39:   Vec            v;

 42:   eps->ncv = eps->n;
 43:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }
 44:   if (!eps->which) { EPSSetWhichEigenpairs_Default(eps); }
 45:   if (eps->balance!=EPS_BALANCE_NONE) { PetscInfo(eps,"Warning: balancing ignored\n"); }
 46:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }
 47:   EPSAllocateSolution(eps);

 49:   /* attempt to get dense representations of A and B separately */
 50:   PetscObjectTypeCompare((PetscObject)eps->st,STSHIFT,&isshift);
 51:   if (isshift) {
 52:     STGetNumMatrices(eps->st,&nmat);
 53:     STGetOperators(eps->st,0,&A);
 54:     if (nmat>1) { STGetOperators(eps->st,1,&B); }
 55:     PetscPushErrorHandler(PetscIgnoreErrorHandler,NULL);
 56:     ierra = SlepcMatConvertSeqDense(A,&Adense);
 57:     if (eps->isgeneralized) {
 58:       ierrb = SlepcMatConvertSeqDense(B,&Bdense);
 59:     } else {
 60:       ierrb = 0;
 61:     }
 62:     PetscPopErrorHandler();
 63:     denseok = (ierra == 0 && ierrb == 0)? PETSC_TRUE: PETSC_FALSE;
 64:   } else Adense = NULL;

 66:   /* setup DS */
 67:   if (denseok) {
 68:     if (eps->isgeneralized) {
 69:       if (eps->ishermitian) {
 70:         if (eps->ispositive) {
 71:           DSSetType(eps->ds,DSGHEP);
 72:         } else {
 73:           DSSetType(eps->ds,DSGNHEP); /* TODO: should be DSGHIEP */
 74:         }
 75:       } else {
 76:         DSSetType(eps->ds,DSGNHEP);
 77:       }
 78:     } else {
 79:       if (eps->ishermitian) {
 80:         DSSetType(eps->ds,DSHEP);
 81:       } else {
 82:         DSSetType(eps->ds,DSNHEP);
 83:       }
 84:     }
 85:   } else {
 86:     DSSetType(eps->ds,DSNHEP);
 87:   }
 88:   DSAllocate(eps->ds,eps->ncv);
 89:   DSGetLeadingDimension(eps->ds,&ld);
 90:   DSSetDimensions(eps->ds,eps->ncv,0,0,0);

 92:   if (denseok) {
 93:     STGetShift(eps->st,&shift);
 94:     if (shift != 0.0) {
 95:       MatShift(Adense,shift);
 96:     }
 97:     /* use dummy pc and ksp to avoid problems when B is not positive definite */
 98:     STGetKSP(eps->st,&ksp);
 99:     KSPSetType(ksp,KSPPREONLY);
100:     KSPGetPC(ksp,&pc);
101:     PCSetType(pc,PCNONE);
102:   } else {
103:     PetscInfo(eps,"Using slow explicit operator\n");
104:     STComputeExplicitOperator(eps->st,&OP);
105:     MatDestroy(&Adense);
106:     SlepcMatConvertSeqDense(OP,&Adense);
107:   }

109:   /* fill DS matrices */
110:   VecCreateSeqWithArray(PETSC_COMM_SELF,1,ld,NULL,&v);
111:   DSGetArray(eps->ds,DS_MAT_A,&Ap);
112:   for (i=0;i<ld;i++) {
113:     VecPlaceArray(v,Ap+i*ld);
114:     MatGetColumnVector(Adense,v,i);
115:     VecResetArray(v);
116:   }
117:   DSRestoreArray(eps->ds,DS_MAT_A,&Ap);
118:   if (denseok && eps->isgeneralized) {
119:     DSGetArray(eps->ds,DS_MAT_B,&Bp);
120:     for (i=0;i<ld;i++) {
121:       VecPlaceArray(v,Bp+i*ld);
122:       MatGetColumnVector(Bdense,v,i);
123:       VecResetArray(v);
124:     }
125:     DSRestoreArray(eps->ds,DS_MAT_B,&Bp);
126:   }
127:   VecDestroy(&v);
128:   MatDestroy(&Adense);
129:   if (!denseok) { MatDestroy(&OP); }
130:   if (denseok && eps->isgeneralized) { MatDestroy(&Bdense); }
131:   return(0);
132: }

136: PetscErrorCode EPSSolve_LAPACK(EPS eps)
137: {
139:   PetscInt       n=eps->n,i,low,high;
140:   PetscScalar    *array,*pX,*pY;

143:   DSSolve(eps->ds,eps->eigr,eps->eigi);
144:   DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);

146:   /* right eigenvectors */
147:   DSVectors(eps->ds,DS_MAT_X,NULL,NULL);
148:   DSGetArray(eps->ds,DS_MAT_X,&pX);
149:   for (i=0;i<eps->ncv;i++) {
150:     VecGetOwnershipRange(eps->V[i],&low,&high);
151:     VecGetArray(eps->V[i],&array);
152:     PetscMemcpy(array,pX+i*n+low,(high-low)*sizeof(PetscScalar));
153:     VecRestoreArray(eps->V[i],&array);
154:   }
155:   DSRestoreArray(eps->ds,DS_MAT_X,&pX);

157:   /* left eigenvectors */
158:   if (eps->leftvecs) {
159:     DSVectors(eps->ds,DS_MAT_Y,NULL,NULL);
160:     DSGetArray(eps->ds,DS_MAT_Y,&pY);
161:     for (i=0;i<eps->ncv;i++) {
162:       VecGetOwnershipRange(eps->W[i],&low,&high);
163:       VecGetArray(eps->W[i],&array);
164:       PetscMemcpy(array,pY+i*n+low,(high-low)*sizeof(PetscScalar));
165:       VecRestoreArray(eps->W[i],&array);
166:     }
167:     DSRestoreArray(eps->ds,DS_MAT_Y,&pY);
168:   }
169:   eps->nconv  = eps->ncv;
170:   eps->its    = 1;
171:   eps->reason = EPS_CONVERGED_TOL;
172:   return(0);
173: }

177: PetscErrorCode EPSReset_LAPACK(EPS eps)
178: {

182:   EPSFreeSolution(eps);
183:   return(0);
184: }

188: PETSC_EXTERN PetscErrorCode EPSCreate_LAPACK(EPS eps)
189: {
191:   eps->ops->solve                = EPSSolve_LAPACK;
192:   eps->ops->setup                = EPSSetUp_LAPACK;
193:   eps->ops->reset                = EPSReset_LAPACK;
194:   eps->ops->backtransform        = EPSBackTransform_Default;
195:   eps->ops->computevectors       = EPSComputeVectors_Default;
196:   return(0);
197: }

slepc-3.4.2.dfsg.orig/src/eps/impls/lapack/makefile0000644000175000017500000000214112211062077021066 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = lapack.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/impls/lapack/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/impls/lapack/makefile.html0000644000175000017500000000373512211062077022043 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = lapack.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/impls/lapack/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/impls/lapack/index.html0000644000175000017500000000213012211062077021361 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

lapack.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/impls/lapack/lapack.c0000644000175000017500000001632412211062077020775 0ustar gladkgladk/* This file implements a wrapper to the LAPACK eigenvalue subroutines. Generalized problems are transformed to standard ones only if necessary. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "EPSSetUp_LAPACK" PetscErrorCode EPSSetUp_LAPACK(EPS eps) { PetscErrorCode ierr,ierra,ierrb; PetscBool isshift,denseok=PETSC_FALSE; Mat A,B,OP,Adense,Bdense; PetscScalar shift,*Ap,*Bp; PetscInt i,ld,nmat; KSP ksp; PC pc; Vec v; PetscFunctionBegin; eps->ncv = eps->n; if (eps->mpd) { ierr = PetscInfo(eps,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } if (!eps->which) { ierr = EPSSetWhichEigenpairs_Default(eps);CHKERRQ(ierr); } if (eps->balance!=EPS_BALANCE_NONE) { ierr = PetscInfo(eps,"Warning: balancing ignored\n");CHKERRQ(ierr); } if (eps->extraction) { ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr); } ierr = EPSAllocateSolution(eps);CHKERRQ(ierr); /* attempt to get dense representations of A and B separately */ ierr = PetscObjectTypeCompare((PetscObject)eps->st,STSHIFT,&isshift);CHKERRQ(ierr); if (isshift) { ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } PetscPushErrorHandler(PetscIgnoreErrorHandler,NULL); ierra = SlepcMatConvertSeqDense(A,&Adense);CHKERRQ(ierr); if (eps->isgeneralized) { ierrb = SlepcMatConvertSeqDense(B,&Bdense);CHKERRQ(ierr); } else { ierrb = 0; } PetscPopErrorHandler(); denseok = (ierra == 0 && ierrb == 0)? PETSC_TRUE: PETSC_FALSE; } else Adense = NULL; /* setup DS */ if (denseok) { if (eps->isgeneralized) { if (eps->ishermitian) { if (eps->ispositive) { ierr = DSSetType(eps->ds,DSGHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSGNHEP);CHKERRQ(ierr); /* TODO: should be DSGHIEP */ } } else { ierr = DSSetType(eps->ds,DSGNHEP);CHKERRQ(ierr); } } else { if (eps->ishermitian) { ierr = DSSetType(eps->ds,DSHEP);CHKERRQ(ierr); } else { ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); } } } else { ierr = DSSetType(eps->ds,DSNHEP);CHKERRQ(ierr); } ierr = DSAllocate(eps->ds,eps->ncv);CHKERRQ(ierr); ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = DSSetDimensions(eps->ds,eps->ncv,0,0,0);CHKERRQ(ierr); if (denseok) { ierr = STGetShift(eps->st,&shift);CHKERRQ(ierr); if (shift != 0.0) { ierr = MatShift(Adense,shift);CHKERRQ(ierr); } /* use dummy pc and ksp to avoid problems when B is not positive definite */ ierr = STGetKSP(eps->st,&ksp);CHKERRQ(ierr); ierr = KSPSetType(ksp,KSPPREONLY);CHKERRQ(ierr); ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = PCSetType(pc,PCNONE);CHKERRQ(ierr); } else { ierr = PetscInfo(eps,"Using slow explicit operator\n");CHKERRQ(ierr); ierr = STComputeExplicitOperator(eps->st,&OP);CHKERRQ(ierr); ierr = MatDestroy(&Adense);CHKERRQ(ierr); ierr = SlepcMatConvertSeqDense(OP,&Adense);CHKERRQ(ierr); } /* fill DS matrices */ ierr = VecCreateSeqWithArray(PETSC_COMM_SELF,1,ld,NULL,&v);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_A,&Ap);CHKERRQ(ierr); for (i=0;ids,DS_MAT_A,&Ap);CHKERRQ(ierr); if (denseok && eps->isgeneralized) { ierr = DSGetArray(eps->ds,DS_MAT_B,&Bp);CHKERRQ(ierr); for (i=0;ids,DS_MAT_B,&Bp);CHKERRQ(ierr); } ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = MatDestroy(&Adense);CHKERRQ(ierr); if (!denseok) { ierr = MatDestroy(&OP);CHKERRQ(ierr); } if (denseok && eps->isgeneralized) { ierr = MatDestroy(&Bdense);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve_LAPACK" PetscErrorCode EPSSolve_LAPACK(EPS eps) { PetscErrorCode ierr; PetscInt n=eps->n,i,low,high; PetscScalar *array,*pX,*pY; PetscFunctionBegin; ierr = DSSolve(eps->ds,eps->eigr,eps->eigi);CHKERRQ(ierr); ierr = DSSort(eps->ds,eps->eigr,eps->eigi,NULL,NULL,NULL);CHKERRQ(ierr); /* right eigenvectors */ ierr = DSVectors(eps->ds,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_X,&pX);CHKERRQ(ierr); for (i=0;incv;i++) { ierr = VecGetOwnershipRange(eps->V[i],&low,&high);CHKERRQ(ierr); ierr = VecGetArray(eps->V[i],&array);CHKERRQ(ierr); ierr = PetscMemcpy(array,pX+i*n+low,(high-low)*sizeof(PetscScalar));CHKERRQ(ierr); ierr = VecRestoreArray(eps->V[i],&array);CHKERRQ(ierr); } ierr = DSRestoreArray(eps->ds,DS_MAT_X,&pX);CHKERRQ(ierr); /* left eigenvectors */ if (eps->leftvecs) { ierr = DSVectors(eps->ds,DS_MAT_Y,NULL,NULL);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_Y,&pY);CHKERRQ(ierr); for (i=0;incv;i++) { ierr = VecGetOwnershipRange(eps->W[i],&low,&high);CHKERRQ(ierr); ierr = VecGetArray(eps->W[i],&array);CHKERRQ(ierr); ierr = PetscMemcpy(array,pY+i*n+low,(high-low)*sizeof(PetscScalar));CHKERRQ(ierr); ierr = VecRestoreArray(eps->W[i],&array);CHKERRQ(ierr); } ierr = DSRestoreArray(eps->ds,DS_MAT_Y,&pY);CHKERRQ(ierr); } eps->nconv = eps->ncv; eps->its = 1; eps->reason = EPS_CONVERGED_TOL; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset_LAPACK" PetscErrorCode EPSReset_LAPACK(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = EPSFreeSolution(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate_LAPACK" PETSC_EXTERN PetscErrorCode EPSCreate_LAPACK(EPS eps) { PetscFunctionBegin; eps->ops->solve = EPSSolve_LAPACK; eps->ops->setup = EPSSetUp_LAPACK; eps->ops->reset = EPSReset_LAPACK; eps->ops->backtransform = EPSBackTransform_Default; eps->ops->computevectors = EPSComputeVectors_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/makefile0000644000175000017500000000214312211062077016511 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/epsimpl.h ../../include/slepceps.h DIRS = interface impls examples LOCDIR = src/eps/ MANSEC = EPS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/makefile.html0000644000175000017500000000373712211062077017466 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/epsimpl.h ../../include/slepceps.h
DIRS     = interface impls examples
LOCDIR   = src/eps/
MANSEC   = EPS

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/interface/0000755000175000017500000000000012214143515016751 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/interface/itregis.c.html0000644000175000017500000002460512211062077021535 0ustar gladkgladk
Actual source code: itregis.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/epsimpl.h>  /*I "slepceps.h" I*/

 24: PETSC_EXTERN PetscErrorCode EPSCreate_Power(EPS);
 25: PETSC_EXTERN PetscErrorCode EPSCreate_Subspace(EPS);
 26: PETSC_EXTERN PetscErrorCode EPSCreate_Arnoldi(EPS);
 27: PETSC_EXTERN PetscErrorCode EPSCreate_Lanczos(EPS);
 28: PETSC_EXTERN PetscErrorCode EPSCreate_KrylovSchur(EPS);
 29: #if defined(SLEPC_HAVE_ARPACK)
 30: PETSC_EXTERN PetscErrorCode EPSCreate_ARPACK(EPS);
 31: #endif
 32: PETSC_EXTERN PetscErrorCode EPSCreate_LAPACK(EPS);
 33: #if defined(SLEPC_HAVE_BLZPACK) && !defined(PETSC_USE_COMPLEX)
 34: PETSC_EXTERN PetscErrorCode EPSCreate_BLZPACK(EPS);
 35: #endif
 36: #if defined(SLEPC_HAVE_TRLAN) && !defined(PETSC_USE_COMPLEX)
 37: PETSC_EXTERN PetscErrorCode EPSCreate_TRLAN(EPS);
 38: #endif
 39: #if defined(SLEPC_HAVE_BLOPEX)
 40: PETSC_EXTERN PetscErrorCode EPSCreate_BLOPEX(EPS);
 41: #endif
 42: #if defined(SLEPC_HAVE_PRIMME)
 43: PETSC_EXTERN PetscErrorCode EPSCreate_PRIMME(EPS eps);
 44: #endif
 45: #if defined(SLEPC_HAVE_FEAST)
 46: PETSC_EXTERN PetscErrorCode EPSCreate_FEAST(EPS);
 47: #endif
 48: PETSC_EXTERN PetscErrorCode EPSCreate_GD(EPS eps);
 49: PETSC_EXTERN PetscErrorCode EPSCreate_JD(EPS eps);
 50: PETSC_EXTERN PetscErrorCode EPSCreate_RQCG(EPS eps);
 51: PETSC_EXTERN PetscErrorCode EPSCreate_CISS(EPS eps);

 55: /*@C
 56:   EPSRegisterAll - Registers all the eigenvalue solvers in the EPS package.

 58:   Not Collective

 60:   Level: advanced

 62: .seealso:  EPSRegister()
 63: @*/
 64: PetscErrorCode EPSRegisterAll(void)
 65: {

 69:   EPSRegisterAllCalled = PETSC_TRUE;
 70:   EPSRegister(EPSKRYLOVSCHUR,EPSCreate_KrylovSchur);
 71:   EPSRegister(EPSPOWER,EPSCreate_Power);
 72:   EPSRegister(EPSSUBSPACE,EPSCreate_Subspace);
 73:   EPSRegister(EPSARNOLDI,EPSCreate_Arnoldi);
 74:   EPSRegister(EPSLANCZOS,EPSCreate_Lanczos);
 75:   EPSRegister(EPSGD,EPSCreate_GD);
 76:   EPSRegister(EPSJD,EPSCreate_JD);
 77:   EPSRegister(EPSRQCG,EPSCreate_RQCG);
 78: #if defined(PETSC_USE_COMPLEX)
 79:   EPSRegister(EPSCISS,EPSCreate_CISS);
 80: #endif
 81:   EPSRegister(EPSLAPACK,EPSCreate_LAPACK);
 82: #if defined(SLEPC_HAVE_ARPACK)
 83:   EPSRegister(EPSARPACK,EPSCreate_ARPACK);
 84: #endif
 85: #if defined(SLEPC_HAVE_BLZPACK) && !defined(PETSC_USE_COMPLEX)
 86:   EPSRegister(EPSBLZPACK,EPSCreate_BLZPACK);
 87: #endif
 88: #if defined(SLEPC_HAVE_TRLAN) && !defined(PETSC_USE_COMPLEX)
 89:   EPSRegister(EPSTRLAN,EPSCreate_TRLAN);
 90: #endif
 91: #if defined(SLEPC_HAVE_BLOPEX)
 92:   EPSRegister(EPSBLOPEX,EPSCreate_BLOPEX);
 93: #endif
 94: #if defined(SLEPC_HAVE_PRIMME)
 95:   EPSRegister(EPSPRIMME,EPSCreate_PRIMME);
 96: #endif
 97: #if defined(SLEPC_HAVE_FEAST) && defined(PETSC_USE_COMPLEX)
 98:   EPSRegister(EPSFEAST,EPSCreate_FEAST);
 99: #endif
100:   return(0);
101: }
slepc-3.4.2.dfsg.orig/src/eps/interface/setup.c.html0000644000175000017500000012525612211062077021233 0ustar gladkgladk
Actual source code: setup.c

  1: /*
  2:       EPS routines related to problem setup.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>       /*I "slepceps.h" I*/
 25: #include <slepc-private/ipimpl.h>

 29: /*@
 30:    EPSSetUp - Sets up all the internal data structures necessary for the
 31:    execution of the eigensolver. Then calls STSetUp() for any set-up
 32:    operations associated to the ST object.

 34:    Collective on EPS

 36:    Input Parameter:
 37: .  eps   - eigenproblem solver context

 39:    Notes:
 40:    This function need not be called explicitly in most cases, since EPSSolve()
 41:    calls it. It can be useful when one wants to measure the set-up time
 42:    separately from the solve time.

 44:    Level: advanced

 46: .seealso: EPSCreate(), EPSSolve(), EPSDestroy(), STSetUp(), EPSSetInitialSpace()
 47: @*/
 48: PetscErrorCode EPSSetUp(EPS eps)
 49: {
 51:   Mat            A,B;
 52:   PetscInt       i,k,nmat;
 53:   PetscBool      flg,lindep;
 54:   Vec            *newDS;
 55:   PetscReal      norm;
 56: #if defined(PETSC_USE_COMPLEX)
 57:   PetscScalar    sigma;
 58: #endif

 62:   if (eps->setupcalled) return(0);
 63:   PetscLogEventBegin(EPS_SetUp,eps,0,0,0);

 65:   /* reset the convergence flag from the previous solves */
 66:   eps->reason = EPS_CONVERGED_ITERATING;

 68:   /* Set default solver type (EPSSetFromOptions was not called) */
 69:   if (!((PetscObject)eps)->type_name) {
 70:     EPSSetType(eps,EPSKRYLOVSCHUR);
 71:   }
 72:   if (!eps->st) { EPSGetST(eps,&eps->st); }
 73:   if (!((PetscObject)eps->st)->type_name) {
 74:     PetscObjectTypeCompareAny((PetscObject)eps,&flg,EPSGD,EPSJD,EPSRQCG,EPSBLOPEX,EPSPRIMME,"");
 75:     STSetType(eps->st,flg?STPRECOND:STSHIFT);
 76:   }
 77:   if (!eps->ip) { EPSGetIP(eps,&eps->ip); }
 78:   if (!((PetscObject)eps->ip)->type_name) {
 79:     IPSetType_Default(eps->ip);
 80:   }
 81:   if (!eps->ds) { EPSGetDS(eps,&eps->ds); }
 82:   DSReset(eps->ds);
 83:   if (!((PetscObject)eps->rand)->type_name) {
 84:     PetscRandomSetFromOptions(eps->rand);
 85:   }

 87:   /* Set problem dimensions */
 88:   STGetNumMatrices(eps->st,&nmat);
 89:   if (!nmat) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSetOperators must be called first");
 90:   STGetOperators(eps->st,0,&A);
 91:   MatGetSize(A,&eps->n,NULL);
 92:   MatGetLocalSize(A,&eps->nloc,NULL);
 93:   VecDestroy(&eps->t);
 94:   SlepcMatGetVecsTemplate(A,&eps->t,NULL);
 95:   PetscLogObjectParent(eps,eps->t);

 97:   /* Set default problem type */
 98:   if (!eps->problem_type) {
 99:     if (nmat==1) {
100:       EPSSetProblemType(eps,EPS_NHEP);
101:     } else {
102:       EPSSetProblemType(eps,EPS_GNHEP);
103:     }
104:   } else if (nmat==1 && eps->isgeneralized) {
105:     PetscInfo(eps,"Eigenproblem set as generalized but no matrix B was provided; reverting to a standard eigenproblem\n");
106:     eps->isgeneralized = PETSC_FALSE;
107:     eps->problem_type = eps->ishermitian? EPS_HEP: EPS_NHEP;
108:   } else if (nmat>1 && !eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_INCOMP,"Inconsistent EPS state");
109: #if defined(PETSC_USE_COMPLEX)
110:   STGetShift(eps->st,&sigma);
111:   if (eps->ishermitian && PetscImaginaryPart(sigma) != 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Hermitian problems are not compatible with complex shifts");
112: #endif
113:   if (eps->ishermitian && eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requesting left eigenvectors not allowed in Hermitian problems");

115:   if (eps->ispositive || (eps->isgeneralized && eps->ishermitian)) {
116:     STGetBilinearForm(eps->st,&B);
117:     IPSetMatrix(eps->ip,B);
118:     MatDestroy(&B);
119:     if (!eps->ispositive) {
120:       IPSetType(eps->ip,IPINDEFINITE);
121:     }
122:   } else {
123:     IPSetMatrix(eps->ip,NULL);
124:   }

126:   if (eps->nev > eps->n) eps->nev = eps->n;
127:   if (eps->ncv > eps->n) eps->ncv = eps->n;

129:   /* initialization of matrix norms */
130:   if (eps->nrma == PETSC_DETERMINE) {
131:     MatHasOperation(A,MATOP_NORM,&flg);
132:     if (flg) {
133:       MatNorm(A,NORM_INFINITY,&eps->nrma);
134:     } else eps->nrma = 1.0;
135:   }
136:   if (eps->nrmb == PETSC_DETERMINE) {
137:     if (nmat>1) { STGetOperators(eps->st,1,&B); }
138:     MatHasOperation(B,MATOP_NORM,&flg);
139:     if (flg) {
140:       MatNorm(B,NORM_INFINITY,&eps->nrmb);
141:     } else eps->nrmb = 1.0;
142:   }

144:   if (!eps->balance) eps->balance = EPS_BALANCE_NONE;

146:   /* call specific solver setup */
147:   (*eps->ops->setup)(eps);

149:   /* check extraction */
150:   PetscObjectTypeCompareAny((PetscObject)eps->st,&flg,STPRECOND,STSHIFT,"");
151:   if (!flg && eps->extraction && eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Cannot use a spectral transformation combined with harmonic extraction");

153:   /* set tolerance if not yet set */
154:   if (eps->tol==PETSC_DEFAULT) eps->tol = SLEPC_DEFAULT_TOL;

156:   /* set eigenvalue comparison */
157:   switch (eps->which) {
158:     case EPS_LARGEST_MAGNITUDE:
159:       eps->comparison    = SlepcCompareLargestMagnitude;
160:       eps->comparisonctx = NULL;
161:       break;
162:     case EPS_SMALLEST_MAGNITUDE:
163:       eps->comparison    = SlepcCompareSmallestMagnitude;
164:       eps->comparisonctx = NULL;
165:       break;
166:     case EPS_LARGEST_REAL:
167:       eps->comparison    = SlepcCompareLargestReal;
168:       eps->comparisonctx = NULL;
169:       break;
170:     case EPS_SMALLEST_REAL:
171:       eps->comparison    = SlepcCompareSmallestReal;
172:       eps->comparisonctx = NULL;
173:       break;
174:     case EPS_LARGEST_IMAGINARY:
175:       eps->comparison    = SlepcCompareLargestImaginary;
176:       eps->comparisonctx = NULL;
177:       break;
178:     case EPS_SMALLEST_IMAGINARY:
179:       eps->comparison    = SlepcCompareSmallestImaginary;
180:       eps->comparisonctx = NULL;
181:       break;
182:     case EPS_TARGET_MAGNITUDE:
183:       eps->comparison    = SlepcCompareTargetMagnitude;
184:       eps->comparisonctx = &eps->target;
185:       break;
186:     case EPS_TARGET_REAL:
187:       eps->comparison    = SlepcCompareTargetReal;
188:       eps->comparisonctx = &eps->target;
189:       break;
190:     case EPS_TARGET_IMAGINARY:
191:       eps->comparison    = SlepcCompareTargetImaginary;
192:       eps->comparisonctx = &eps->target;
193:       break;
194:     case EPS_ALL:
195:       eps->comparison    = SlepcCompareSmallestReal;
196:       eps->comparisonctx = NULL;
197:       break;
198:     case EPS_WHICH_USER:
199:       break;
200:   }

202:   /* Build balancing matrix if required */
203:   if (!eps->ishermitian && (eps->balance==EPS_BALANCE_ONESIDE || eps->balance==EPS_BALANCE_TWOSIDE)) {
204:     if (!eps->D) {
205:       VecDuplicate(eps->V[0],&eps->D);
206:       PetscLogObjectParent(eps,eps->D);
207:     } else {
208:       VecSet(eps->D,1.0);
209:     }
210:     EPSBuildBalance_Krylov(eps);
211:     STSetBalanceMatrix(eps->st,eps->D);
212:   }

214:   /* Setup ST */
215:   STSetUp(eps->st);

217:   PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&flg);
218:   if (flg && eps->problem_type == EPS_PGNHEP) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Cayley spectral transformation is not compatible with PGNHEP");

220:   PetscObjectTypeCompare((PetscObject)eps->st,STFOLD,&flg);
221:   if (flg && !eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Fold spectral transformation requires a Hermitian problem");

223:   if (eps->nds>0) {
224:     if (!eps->ds_ortho) {
225:       /* allocate memory and copy deflation basis vectors into defl */
226:       VecDuplicateVecs(eps->t,eps->nds,&newDS);
227:       for (i=0;i<eps->nds;i++) {
228:         VecCopy(eps->defl[i],newDS[i]);
229:         VecDestroy(&eps->defl[i]);
230:       }
231:       PetscFree(eps->defl);
232:       eps->defl = newDS;
233:       PetscLogObjectParents(eps,eps->nds,eps->defl);
234:       /* orthonormalize vectors in defl */
235:       k = 0;
236:       for (i=0;i<eps->nds;i++) {
237:         IPOrthogonalize(eps->ip,0,NULL,k,NULL,eps->defl,eps->defl[k],NULL,&norm,&lindep);
238:         if (norm==0.0 || lindep) {
239:           PetscInfo(eps,"Linearly dependent deflation vector found, removing...\n");
240:         } else {
241:           VecScale(eps->defl[k],1.0/norm);
242:           k++;
243:         }
244:       }
245:       for (i=k;i<eps->nds;i++) { VecDestroy(&eps->defl[i]); }
246:       eps->nds = k;
247:       eps->ds_ortho = PETSC_TRUE;
248:     }
249:   }
250:   STCheckNullSpace(eps->st,eps->nds,eps->defl);

252:   /* process initial vectors */
253:   if (eps->nini<0) {
254:     eps->nini = -eps->nini;
255:     if (eps->nini>eps->ncv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"The number of initial vectors is larger than ncv");
256:     IPOrthonormalizeBasis_Private(eps->ip,&eps->nini,&eps->IS,eps->V);
257:   }
258:   if (eps->ninil<0) {
259:     if (!eps->leftvecs) {
260:       PetscInfo(eps,"Ignoring initial left vectors\n");
261:     } else {
262:       eps->ninil = -eps->ninil;
263:       if (eps->ninil>eps->ncv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"The number of initial left vectors is larger than ncv");
264:       IPOrthonormalizeBasis_Private(eps->ip,&eps->ninil,&eps->ISL,eps->W);
265:     }
266:   }

268:   PetscLogEventEnd(EPS_SetUp,eps,0,0,0);
269:   eps->setupcalled = 1;
270:   return(0);
271: }

275: /*@
276:    EPSSetOperators - Sets the matrices associated with the eigenvalue problem.

278:    Collective on EPS and Mat

280:    Input Parameters:
281: +  eps - the eigenproblem solver context
282: .  A  - the matrix associated with the eigensystem
283: -  B  - the second matrix in the case of generalized eigenproblems

285:    Notes:
286:    To specify a standard eigenproblem, use NULL for parameter B.

288:    It must be called after EPSSetUp(). If it is called again after EPSSetUp() then
289:    the EPS object is reset.

291:    Level: beginner

293: .seealso: EPSSolve(), EPSSetUp(), EPSReset(), EPSGetST(), STGetOperators()
294: @*/
295: PetscErrorCode EPSSetOperators(EPS eps,Mat A,Mat B)
296: {
298:   PetscInt       m,n,m0,nmat;
299:   Mat            mat[2];


308:   /* Check for square matrices */
309:   MatGetSize(A,&m,&n);
310:   if (m!=n) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"A is a non-square matrix");
311:   if (B) {
312:     MatGetSize(B,&m0,&n);
313:     if (m0!=n) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"B is a non-square matrix");
314:     if (m!=m0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_INCOMP,"Dimensions of A and B do not match");
315:   }

317:   if (eps->setupcalled) { EPSReset(eps); }
318:   if (!eps->st) { EPSGetST(eps,&eps->st); }
319:   mat[0] = A;
320:   if (B) {
321:     mat[1] = B;
322:     nmat = 2;
323:   } else nmat = 1;
324:   STSetOperators(eps->st,nmat,mat);
325:   return(0);
326: }

330: /*@C
331:    EPSGetOperators - Gets the matrices associated with the eigensystem.

333:    Collective on EPS and Mat

335:    Input Parameter:
336: .  eps - the EPS context

338:    Output Parameters:
339: +  A  - the matrix associated with the eigensystem
340: -  B  - the second matrix in the case of generalized eigenproblems

342:    Level: intermediate

344: .seealso: EPSSolve(), EPSGetST(), STGetOperators(), STSetOperators()
345: @*/
346: PetscErrorCode EPSGetOperators(EPS eps,Mat *A,Mat *B)
347: {
349:   ST             st;
350:   PetscInt       k;

354:   EPSGetST(eps,&st);
355:   if (A) { STGetOperators(st,0,A); }
356:   if (B) {
357:     STGetNumMatrices(st,&k);
358:     if (k==1) B = NULL;
359:     else {
360:       STGetOperators(st,1,B);
361:     }
362:   }
363:   return(0);
364: }

368: /*@
369:    EPSSetDeflationSpace - Specify a basis of vectors that constitute
370:    the deflation space.

372:    Collective on EPS and Vec

374:    Input Parameter:
375: +  eps   - the eigenproblem solver context
376: .  n     - number of vectors
377: -  v     - set of basis vectors of the deflation space

379:    Notes:
380:    When a deflation space is given, the eigensolver seeks the eigensolution
381:    in the restriction of the problem to the orthogonal complement of this
382:    space. This can be used for instance in the case that an invariant
383:    subspace is known beforehand (such as the nullspace of the matrix).

385:    Basis vectors set by a previous call to EPSSetDeflationSpace() are
386:    replaced.

388:    The vectors do not need to be mutually orthonormal, since they are explicitly
389:    orthonormalized internally.

391:    These vectors persist from one EPSSolve() call to the other, use
392:    EPSRemoveDeflationSpace() to eliminate them.

394:    Level: intermediate

396: .seealso: EPSRemoveDeflationSpace()
397: @*/
398: PetscErrorCode EPSSetDeflationSpace(EPS eps,PetscInt n,Vec *v)
399: {
401:   PetscInt       i;

406:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument n out of range");

408:   /* free previous vectors */
409:   EPSRemoveDeflationSpace(eps);

411:   /* get references of passed vectors */
412:   if (n>0) {
413:     PetscMalloc(n*sizeof(Vec),&eps->defl);
414:     PetscLogObjectMemory(eps,n*sizeof(Vec));
415:     for (i=0;i<n;i++) {
416:       PetscObjectReference((PetscObject)v[i]);
417:       eps->defl[i] = v[i];
418:     }
419:     eps->setupcalled = 0;
420:     eps->ds_ortho = PETSC_FALSE;
421:   }

423:   eps->nds = n;
424:   return(0);
425: }

429: /*@
430:    EPSRemoveDeflationSpace - Removes the deflation space.

432:    Collective on EPS

434:    Input Parameter:
435: .  eps   - the eigenproblem solver context

437:    Level: intermediate

439: .seealso: EPSSetDeflationSpace()
440: @*/
441: PetscErrorCode EPSRemoveDeflationSpace(EPS eps)
442: {

447:   VecDestroyVecs(eps->nds,&eps->defl);
448:   eps->nds = 0;
449:   eps->setupcalled = 0;
450:   eps->ds_ortho = PETSC_FALSE;
451:   return(0);
452: }

456: /*@
457:    EPSSetInitialSpace - Specify a basis of vectors that constitute the initial
458:    space, that is, the subspace from which the solver starts to iterate.

460:    Collective on EPS and Vec

462:    Input Parameter:
463: +  eps   - the eigenproblem solver context
464: .  n     - number of vectors
465: -  is    - set of basis vectors of the initial space

467:    Notes:
468:    Some solvers start to iterate on a single vector (initial vector). In that case,
469:    the other vectors are ignored.

471:    In contrast to EPSSetDeflationSpace(), these vectors do not persist from one
472:    EPSSolve() call to the other, so the initial space should be set every time.

474:    The vectors do not need to be mutually orthonormal, since they are explicitly
475:    orthonormalized internally.

477:    Common usage of this function is when the user can provide a rough approximation
478:    of the wanted eigenspace. Then, convergence may be faster.

480:    Level: intermediate

482: .seealso: EPSSetInitialSpaceLeft(), EPSSetDeflationSpace()
483: @*/
484: PetscErrorCode EPSSetInitialSpace(EPS eps,PetscInt n,Vec *is)
485: {

491:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
492:   SlepcBasisReference_Private(n,is,&eps->nini,&eps->IS);
493:   if (n>0) eps->setupcalled = 0;
494:   return(0);
495: }

499: /*@
500:    EPSSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial
501:    left space, that is, the subspace from which the solver starts to iterate for
502:    building the left subspace (in methods that work with two subspaces).

504:    Collective on EPS and Vec

506:    Input Parameter:
507: +  eps   - the eigenproblem solver context
508: .  n     - number of vectors
509: -  is    - set of basis vectors of the initial left space

511:    Notes:
512:    Some solvers start to iterate on a single vector (initial left vector). In that case,
513:    the other vectors are ignored.

515:    In contrast to EPSSetDeflationSpace(), these vectors do not persist from one
516:    EPSSolve() call to the other, so the initial left space should be set every time.

518:    The vectors do not need to be mutually orthonormal, since they are explicitly
519:    orthonormalized internally.

521:    Common usage of this function is when the user can provide a rough approximation
522:    of the wanted left eigenspace. Then, convergence may be faster.

524:    Level: intermediate

526: .seealso: EPSSetInitialSpace(), EPSSetDeflationSpace()
527: @*/
528: PetscErrorCode EPSSetInitialSpaceLeft(EPS eps,PetscInt n,Vec *is)
529: {

535:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
536:   SlepcBasisReference_Private(n,is,&eps->ninil,&eps->ISL);
537:   if (n>0) eps->setupcalled = 0;
538:   return(0);
539: }

slepc-3.4.2.dfsg.orig/src/eps/interface/setup.c0000644000175000017500000004466612211062077020275 0ustar gladkgladk/* EPS routines related to problem setup. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "EPSSetUp" /*@ EPSSetUp - Sets up all the internal data structures necessary for the execution of the eigensolver. Then calls STSetUp() for any set-up operations associated to the ST object. Collective on EPS Input Parameter: . eps - eigenproblem solver context Notes: This function need not be called explicitly in most cases, since EPSSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time. Level: advanced .seealso: EPSCreate(), EPSSolve(), EPSDestroy(), STSetUp(), EPSSetInitialSpace() @*/ PetscErrorCode EPSSetUp(EPS eps) { PetscErrorCode ierr; Mat A,B; PetscInt i,k,nmat; PetscBool flg,lindep; Vec *newDS; PetscReal norm; #if defined(PETSC_USE_COMPLEX) PetscScalar sigma; #endif PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (eps->setupcalled) PetscFunctionReturn(0); ierr = PetscLogEventBegin(EPS_SetUp,eps,0,0,0);CHKERRQ(ierr); /* reset the convergence flag from the previous solves */ eps->reason = EPS_CONVERGED_ITERATING; /* Set default solver type (EPSSetFromOptions was not called) */ if (!((PetscObject)eps)->type_name) { ierr = EPSSetType(eps,EPSKRYLOVSCHUR);CHKERRQ(ierr); } if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } if (!((PetscObject)eps->st)->type_name) { ierr = PetscObjectTypeCompareAny((PetscObject)eps,&flg,EPSGD,EPSJD,EPSRQCG,EPSBLOPEX,EPSPRIMME,"");CHKERRQ(ierr); ierr = STSetType(eps->st,flg?STPRECOND:STSHIFT);CHKERRQ(ierr); } if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); } if (!((PetscObject)eps->ip)->type_name) { ierr = IPSetType_Default(eps->ip);CHKERRQ(ierr); } if (!eps->ds) { ierr = EPSGetDS(eps,&eps->ds);CHKERRQ(ierr); } ierr = DSReset(eps->ds);CHKERRQ(ierr); if (!((PetscObject)eps->rand)->type_name) { ierr = PetscRandomSetFromOptions(eps->rand);CHKERRQ(ierr); } /* Set problem dimensions */ ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); if (!nmat) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSetOperators must be called first"); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); ierr = MatGetSize(A,&eps->n,NULL);CHKERRQ(ierr); ierr = MatGetLocalSize(A,&eps->nloc,NULL);CHKERRQ(ierr); ierr = VecDestroy(&eps->t);CHKERRQ(ierr); ierr = SlepcMatGetVecsTemplate(A,&eps->t,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,eps->t);CHKERRQ(ierr); /* Set default problem type */ if (!eps->problem_type) { if (nmat==1) { ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); } else { ierr = EPSSetProblemType(eps,EPS_GNHEP);CHKERRQ(ierr); } } else if (nmat==1 && eps->isgeneralized) { ierr = PetscInfo(eps,"Eigenproblem set as generalized but no matrix B was provided; reverting to a standard eigenproblem\n");CHKERRQ(ierr); eps->isgeneralized = PETSC_FALSE; eps->problem_type = eps->ishermitian? EPS_HEP: EPS_NHEP; } else if (nmat>1 && !eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_INCOMP,"Inconsistent EPS state"); #if defined(PETSC_USE_COMPLEX) ierr = STGetShift(eps->st,&sigma);CHKERRQ(ierr); if (eps->ishermitian && PetscImaginaryPart(sigma) != 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Hermitian problems are not compatible with complex shifts"); #endif if (eps->ishermitian && eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Requesting left eigenvectors not allowed in Hermitian problems"); if (eps->ispositive || (eps->isgeneralized && eps->ishermitian)) { ierr = STGetBilinearForm(eps->st,&B);CHKERRQ(ierr); ierr = IPSetMatrix(eps->ip,B);CHKERRQ(ierr); ierr = MatDestroy(&B);CHKERRQ(ierr); if (!eps->ispositive) { ierr = IPSetType(eps->ip,IPINDEFINITE);CHKERRQ(ierr); } } else { ierr = IPSetMatrix(eps->ip,NULL);CHKERRQ(ierr); } if (eps->nev > eps->n) eps->nev = eps->n; if (eps->ncv > eps->n) eps->ncv = eps->n; /* initialization of matrix norms */ if (eps->nrma == PETSC_DETERMINE) { ierr = MatHasOperation(A,MATOP_NORM,&flg);CHKERRQ(ierr); if (flg) { ierr = MatNorm(A,NORM_INFINITY,&eps->nrma);CHKERRQ(ierr); } else eps->nrma = 1.0; } if (eps->nrmb == PETSC_DETERMINE) { if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } ierr = MatHasOperation(B,MATOP_NORM,&flg);CHKERRQ(ierr); if (flg) { ierr = MatNorm(B,NORM_INFINITY,&eps->nrmb);CHKERRQ(ierr); } else eps->nrmb = 1.0; } if (!eps->balance) eps->balance = EPS_BALANCE_NONE; /* call specific solver setup */ ierr = (*eps->ops->setup)(eps);CHKERRQ(ierr); /* check extraction */ ierr = PetscObjectTypeCompareAny((PetscObject)eps->st,&flg,STPRECOND,STSHIFT,"");CHKERRQ(ierr); if (!flg && eps->extraction && eps->extraction!=EPS_RITZ) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Cannot use a spectral transformation combined with harmonic extraction"); /* set tolerance if not yet set */ if (eps->tol==PETSC_DEFAULT) eps->tol = SLEPC_DEFAULT_TOL; /* set eigenvalue comparison */ switch (eps->which) { case EPS_LARGEST_MAGNITUDE: eps->comparison = SlepcCompareLargestMagnitude; eps->comparisonctx = NULL; break; case EPS_SMALLEST_MAGNITUDE: eps->comparison = SlepcCompareSmallestMagnitude; eps->comparisonctx = NULL; break; case EPS_LARGEST_REAL: eps->comparison = SlepcCompareLargestReal; eps->comparisonctx = NULL; break; case EPS_SMALLEST_REAL: eps->comparison = SlepcCompareSmallestReal; eps->comparisonctx = NULL; break; case EPS_LARGEST_IMAGINARY: eps->comparison = SlepcCompareLargestImaginary; eps->comparisonctx = NULL; break; case EPS_SMALLEST_IMAGINARY: eps->comparison = SlepcCompareSmallestImaginary; eps->comparisonctx = NULL; break; case EPS_TARGET_MAGNITUDE: eps->comparison = SlepcCompareTargetMagnitude; eps->comparisonctx = &eps->target; break; case EPS_TARGET_REAL: eps->comparison = SlepcCompareTargetReal; eps->comparisonctx = &eps->target; break; case EPS_TARGET_IMAGINARY: eps->comparison = SlepcCompareTargetImaginary; eps->comparisonctx = &eps->target; break; case EPS_ALL: eps->comparison = SlepcCompareSmallestReal; eps->comparisonctx = NULL; break; case EPS_WHICH_USER: break; } /* Build balancing matrix if required */ if (!eps->ishermitian && (eps->balance==EPS_BALANCE_ONESIDE || eps->balance==EPS_BALANCE_TWOSIDE)) { if (!eps->D) { ierr = VecDuplicate(eps->V[0],&eps->D);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,eps->D);CHKERRQ(ierr); } else { ierr = VecSet(eps->D,1.0);CHKERRQ(ierr); } ierr = EPSBuildBalance_Krylov(eps);CHKERRQ(ierr); ierr = STSetBalanceMatrix(eps->st,eps->D);CHKERRQ(ierr); } /* Setup ST */ ierr = STSetUp(eps->st);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&flg);CHKERRQ(ierr); if (flg && eps->problem_type == EPS_PGNHEP) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Cayley spectral transformation is not compatible with PGNHEP"); ierr = PetscObjectTypeCompare((PetscObject)eps->st,STFOLD,&flg);CHKERRQ(ierr); if (flg && !eps->ishermitian) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Fold spectral transformation requires a Hermitian problem"); if (eps->nds>0) { if (!eps->ds_ortho) { /* allocate memory and copy deflation basis vectors into defl */ ierr = VecDuplicateVecs(eps->t,eps->nds,&newDS);CHKERRQ(ierr); for (i=0;inds;i++) { ierr = VecCopy(eps->defl[i],newDS[i]);CHKERRQ(ierr); ierr = VecDestroy(&eps->defl[i]);CHKERRQ(ierr); } ierr = PetscFree(eps->defl);CHKERRQ(ierr); eps->defl = newDS; ierr = PetscLogObjectParents(eps,eps->nds,eps->defl);CHKERRQ(ierr); /* orthonormalize vectors in defl */ k = 0; for (i=0;inds;i++) { ierr = IPOrthogonalize(eps->ip,0,NULL,k,NULL,eps->defl,eps->defl[k],NULL,&norm,&lindep);CHKERRQ(ierr); if (norm==0.0 || lindep) { ierr = PetscInfo(eps,"Linearly dependent deflation vector found, removing...\n");CHKERRQ(ierr); } else { ierr = VecScale(eps->defl[k],1.0/norm);CHKERRQ(ierr); k++; } } for (i=k;inds;i++) { ierr = VecDestroy(&eps->defl[i]);CHKERRQ(ierr); } eps->nds = k; eps->ds_ortho = PETSC_TRUE; } } ierr = STCheckNullSpace(eps->st,eps->nds,eps->defl);CHKERRQ(ierr); /* process initial vectors */ if (eps->nini<0) { eps->nini = -eps->nini; if (eps->nini>eps->ncv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"The number of initial vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(eps->ip,&eps->nini,&eps->IS,eps->V);CHKERRQ(ierr); } if (eps->ninil<0) { if (!eps->leftvecs) { ierr = PetscInfo(eps,"Ignoring initial left vectors\n");CHKERRQ(ierr); } else { eps->ninil = -eps->ninil; if (eps->ninil>eps->ncv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"The number of initial left vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(eps->ip,&eps->ninil,&eps->ISL,eps->W);CHKERRQ(ierr); } } ierr = PetscLogEventEnd(EPS_SetUp,eps,0,0,0);CHKERRQ(ierr); eps->setupcalled = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetOperators" /*@ EPSSetOperators - Sets the matrices associated with the eigenvalue problem. Collective on EPS and Mat Input Parameters: + eps - the eigenproblem solver context . A - the matrix associated with the eigensystem - B - the second matrix in the case of generalized eigenproblems Notes: To specify a standard eigenproblem, use NULL for parameter B. It must be called after EPSSetUp(). If it is called again after EPSSetUp() then the EPS object is reset. Level: beginner .seealso: EPSSolve(), EPSSetUp(), EPSReset(), EPSGetST(), STGetOperators() @*/ PetscErrorCode EPSSetOperators(EPS eps,Mat A,Mat B) { PetscErrorCode ierr; PetscInt m,n,m0,nmat; Mat mat[2]; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidHeaderSpecific(A,MAT_CLASSID,2); if (B) PetscValidHeaderSpecific(B,MAT_CLASSID,3); PetscCheckSameComm(eps,1,A,2); if (B) PetscCheckSameComm(eps,1,B,3); /* Check for square matrices */ ierr = MatGetSize(A,&m,&n);CHKERRQ(ierr); if (m!=n) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"A is a non-square matrix"); if (B) { ierr = MatGetSize(B,&m0,&n);CHKERRQ(ierr); if (m0!=n) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"B is a non-square matrix"); if (m!=m0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_INCOMP,"Dimensions of A and B do not match"); } if (eps->setupcalled) { ierr = EPSReset(eps);CHKERRQ(ierr); } if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } mat[0] = A; if (B) { mat[1] = B; nmat = 2; } else nmat = 1; ierr = STSetOperators(eps->st,nmat,mat);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetOperators" /*@C EPSGetOperators - Gets the matrices associated with the eigensystem. Collective on EPS and Mat Input Parameter: . eps - the EPS context Output Parameters: + A - the matrix associated with the eigensystem - B - the second matrix in the case of generalized eigenproblems Level: intermediate .seealso: EPSSolve(), EPSGetST(), STGetOperators(), STSetOperators() @*/ PetscErrorCode EPSGetOperators(EPS eps,Mat *A,Mat *B) { PetscErrorCode ierr; ST st; PetscInt k; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = EPSGetST(eps,&st);CHKERRQ(ierr); if (A) { ierr = STGetOperators(st,0,A);CHKERRQ(ierr); } if (B) { ierr = STGetNumMatrices(st,&k);CHKERRQ(ierr); if (k==1) B = NULL; else { ierr = STGetOperators(st,1,B);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetDeflationSpace" /*@ EPSSetDeflationSpace - Specify a basis of vectors that constitute the deflation space. Collective on EPS and Vec Input Parameter: + eps - the eigenproblem solver context . n - number of vectors - v - set of basis vectors of the deflation space Notes: When a deflation space is given, the eigensolver seeks the eigensolution in the restriction of the problem to the orthogonal complement of this space. This can be used for instance in the case that an invariant subspace is known beforehand (such as the nullspace of the matrix). Basis vectors set by a previous call to EPSSetDeflationSpace() are replaced. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. These vectors persist from one EPSSolve() call to the other, use EPSRemoveDeflationSpace() to eliminate them. Level: intermediate .seealso: EPSRemoveDeflationSpace() @*/ PetscErrorCode EPSSetDeflationSpace(EPS eps,PetscInt n,Vec *v) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument n out of range"); /* free previous vectors */ ierr = EPSRemoveDeflationSpace(eps);CHKERRQ(ierr); /* get references of passed vectors */ if (n>0) { ierr = PetscMalloc(n*sizeof(Vec),&eps->defl);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,n*sizeof(Vec));CHKERRQ(ierr); for (i=0;idefl[i] = v[i]; } eps->setupcalled = 0; eps->ds_ortho = PETSC_FALSE; } eps->nds = n; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSRemoveDeflationSpace" /*@ EPSRemoveDeflationSpace - Removes the deflation space. Collective on EPS Input Parameter: . eps - the eigenproblem solver context Level: intermediate .seealso: EPSSetDeflationSpace() @*/ PetscErrorCode EPSRemoveDeflationSpace(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = VecDestroyVecs(eps->nds,&eps->defl);CHKERRQ(ierr); eps->nds = 0; eps->setupcalled = 0; eps->ds_ortho = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetInitialSpace" /*@ EPSSetInitialSpace - Specify a basis of vectors that constitute the initial space, that is, the subspace from which the solver starts to iterate. Collective on EPS and Vec Input Parameter: + eps - the eigenproblem solver context . n - number of vectors - is - set of basis vectors of the initial space Notes: Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored. In contrast to EPSSetDeflationSpace(), these vectors do not persist from one EPSSolve() call to the other, so the initial space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster. Level: intermediate .seealso: EPSSetInitialSpaceLeft(), EPSSetDeflationSpace() @*/ PetscErrorCode EPSSetInitialSpace(EPS eps,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&eps->nini,&eps->IS);CHKERRQ(ierr); if (n>0) eps->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetInitialSpaceLeft" /*@ EPSSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial left space, that is, the subspace from which the solver starts to iterate for building the left subspace (in methods that work with two subspaces). Collective on EPS and Vec Input Parameter: + eps - the eigenproblem solver context . n - number of vectors - is - set of basis vectors of the initial left space Notes: Some solvers start to iterate on a single vector (initial left vector). In that case, the other vectors are ignored. In contrast to EPSSetDeflationSpace(), these vectors do not persist from one EPSSolve() call to the other, so the initial left space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted left eigenspace. Then, convergence may be faster. Level: intermediate .seealso: EPSSetInitialSpace(), EPSSetDeflationSpace() @*/ PetscErrorCode EPSSetInitialSpaceLeft(EPS eps,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&eps->ninil,&eps->ISL);CHKERRQ(ierr); if (n>0) eps->setupcalled = 0; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/opts.c0000644000175000017500000015070112211062077020106 0ustar gladkgladk/* EPS routines related to options that can be set via the command-line or procedurally. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #undef __FUNCT__ #define __FUNCT__ "EPSSetFromOptions" /*@ EPSSetFromOptions - Sets EPS options from the options database. This routine must be called before EPSSetUp() if the user is to be allowed to set the solver type. Collective on EPS Input Parameters: . eps - the eigensolver context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode EPSSetFromOptions(EPS eps) { PetscErrorCode ierr; char type[256],monfilename[PETSC_MAX_PATH_LEN]; PetscBool flg,val; PetscReal r,nrma,nrmb,array[2]={0,0}; PetscScalar s; PetscInt i,j,k; const char *bal_list[4] = {"none","oneside","twoside","user"}; PetscViewer monviewer; SlepcConvMonitor ctx; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!EPSRegisterAllCalled) { ierr = EPSRegisterAll();CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)eps);CHKERRQ(ierr); ierr = PetscOptionsList("-eps_type","Eigenvalue Problem Solver method","EPSSetType",EPSList,(char*)(((PetscObject)eps)->type_name?((PetscObject)eps)->type_name:EPSKRYLOVSCHUR),type,256,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetType(eps,type);CHKERRQ(ierr); } /* Set the type if it was never set. */ if (!((PetscObject)eps)->type_name) { ierr = EPSSetType(eps,EPSKRYLOVSCHUR);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupBegin("-eps_hermitian","hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_gen_hermitian","generalized hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetProblemType(eps,EPS_GHEP);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_non_hermitian","non-hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_gen_non_hermitian","generalized non-hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetProblemType(eps,EPS_GNHEP);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_pos_gen_non_hermitian","generalized non-hermitian eigenvalue problem with positive semi-definite B","EPSSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetProblemType(eps,EPS_PGNHEP);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-eps_gen_indefinite","generalized hermitian-indefinite eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetProblemType(eps,EPS_GHIEP);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupBegin("-eps_ritz","Rayleigh-Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_harmonic","harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_HARMONIC);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_harmonic_relative","relative harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_HARMONIC_RELATIVE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_harmonic_right","right harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_HARMONIC_RIGHT);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_harmonic_largest","largest harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_HARMONIC_LARGEST);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_refined","refined Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_REFINED);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-eps_refined_harmonic","refined harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetExtraction(eps,EPS_REFINED_HARMONIC);CHKERRQ(ierr); } if (!eps->balance) eps->balance = EPS_BALANCE_NONE; ierr = PetscOptionsEList("-eps_balance","Balancing method","EPSSetBalance",bal_list,4,bal_list[eps->balance-EPS_BALANCE_NONE],&i,&flg);CHKERRQ(ierr); if (flg) eps->balance = (EPSBalance)(i+EPS_BALANCE_NONE); r = j = 0; ierr = PetscOptionsInt("-eps_balance_its","Number of iterations in balancing","EPSSetBalance",eps->balance_its,&j,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_balance_cutoff","Cutoff value in balancing","EPSSetBalance",eps->balance_cutoff,&r,NULL);CHKERRQ(ierr); ierr = EPSSetBalance(eps,(EPSBalance)0,j,r);CHKERRQ(ierr); r = i = 0; ierr = PetscOptionsInt("-eps_max_it","Maximum number of iterations","EPSSetTolerances",eps->max_it,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_tol","Tolerance","EPSSetTolerances",eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol,&r,NULL);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,r,i);CHKERRQ(ierr); ierr = PetscOptionsBoolGroupBegin("-eps_conv_eig","Relative error convergence test","EPSSetConvergenceTest",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetConvergenceTest(eps,EPS_CONV_EIG);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_conv_norm","Convergence test relative to the eigenvalue and the matrix norms","EPSSetConvergenceTest",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetConvergenceTest(eps,EPS_CONV_NORM);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-eps_conv_abs","Absolute error convergence test","EPSSetConvergenceTest",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetConvergenceTest(eps,EPS_CONV_ABS);CHKERRQ(ierr); } i = j = k = 0; ierr = PetscOptionsInt("-eps_nev","Number of eigenvalues to compute","EPSSetDimensions",eps->nev,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_ncv","Number of basis vectors","EPSSetDimensions",eps->ncv,&j,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-eps_mpd","Maximum dimension of projected problem","EPSSetDimensions",eps->mpd,&k,NULL);CHKERRQ(ierr); ierr = EPSSetDimensions(eps,i,j,k);CHKERRQ(ierr); /* -----------------------------------------------------------------------*/ /* Cancels all monitors hardwired into code before call to EPSSetFromOptions() */ flg = PETSC_FALSE; ierr = PetscOptionsBool("-eps_monitor_cancel","Remove any hardwired monitor routines","EPSMonitorCancel",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = EPSMonitorCancel(eps);CHKERRQ(ierr); } /* Prints approximate eigenvalues and error estimates at each iteration */ ierr = PetscOptionsString("-eps_monitor","Monitor first unconverged approximate eigenvalue and error estimate","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)eps),monfilename,&monviewer);CHKERRQ(ierr); ierr = EPSMonitorSet(eps,EPSMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-eps_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);CHKERRQ(ierr); ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)eps),monfilename,&ctx->viewer);CHKERRQ(ierr); ierr = EPSMonitorSet(eps,EPSMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-eps_monitor_all","Monitor approximate eigenvalues and error estimates","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)eps),monfilename,&monviewer);CHKERRQ(ierr); ierr = EPSMonitorSet(eps,EPSMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); ierr = EPSSetTrackAll(eps,PETSC_TRUE);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-eps_monitor_lg","Monitor first unconverged approximate eigenvalue and error estimate graphically","EPSMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = EPSMonitorSet(eps,EPSMonitorLG,NULL,NULL);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-eps_monitor_lg_all","Monitor error estimates graphically","EPSMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = EPSMonitorSet(eps,EPSMonitorLGAll,NULL,NULL);CHKERRQ(ierr); ierr = EPSSetTrackAll(eps,PETSC_TRUE);CHKERRQ(ierr); } /* -----------------------------------------------------------------------*/ ierr = PetscOptionsScalar("-eps_target","Value of the target","EPSSetTarget",eps->target,&s,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr); ierr = EPSSetTarget(eps,s);CHKERRQ(ierr); } k = 2; ierr = PetscOptionsRealArray("-eps_interval","Computational interval (two real values separated with a comma without spaces)","EPSSetInterval",array,&k,&flg);CHKERRQ(ierr); if (flg) { if (k<2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_SIZ,"Must pass two values in -eps_interval (comma-separated without spaces)"); ierr = EPSSetWhichEigenpairs(eps,EPS_ALL);CHKERRQ(ierr); ierr = EPSSetInterval(eps,array[0],array[1]);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupBegin("-eps_largest_magnitude","compute largest eigenvalues in magnitude","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_smallest_magnitude","compute smallest eigenvalues in magnitude","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_largest_real","compute largest real parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_smallest_real","compute smallest real parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_largest_imaginary","compute largest imaginary parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_smallest_imaginary","compute smallest imaginary parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_target_magnitude","compute nearest eigenvalues to target","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_target_real","compute eigenvalues with real parts close to target","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-eps_target_imaginary","compute eigenvalues with imaginary parts close to target","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-eps_all","compute all eigenvalues in an interval","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetWhichEigenpairs(eps,EPS_ALL);CHKERRQ(ierr); } ierr = PetscOptionsBool("-eps_left_vectors","Compute left eigenvectors also","EPSSetLeftVectorsWanted",eps->leftvecs,&val,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetLeftVectorsWanted(eps,val);CHKERRQ(ierr); } ierr = PetscOptionsBool("-eps_true_residual","Compute true residuals explicitly","EPSSetTrueResidual",eps->trueres,&val,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetTrueResidual(eps,val);CHKERRQ(ierr); } nrma = nrmb = 0; ierr = PetscOptionsReal("-eps_norm_a","Norm of matrix A","EPSSetMatrixNorms",eps->nrma,&nrma,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-eps_norm_b","Norm of matrix B","EPSSetMatrixNorms",eps->nrmb,&nrmb,NULL);CHKERRQ(ierr); ierr = EPSSetMatrixNorms(eps,nrma,nrmb,eps->adaptive);CHKERRQ(ierr); ierr = PetscOptionsBool("-eps_norms_adaptive","Update the value of matrix norms adaptively","EPSSetMatrixNorms",eps->adaptive,&val,&flg);CHKERRQ(ierr); if (flg) { ierr = EPSSetMatrixNorms(eps,0,0,val);CHKERRQ(ierr); } ierr = PetscOptionsName("-eps_view","Print detailed information on solver used","EPSView",0);CHKERRQ(ierr); ierr = PetscOptionsName("-eps_plot_eigs","Make a plot of the computed eigenvalues","EPSSolve",0);CHKERRQ(ierr); if (eps->ops->setfromoptions) { ierr = (*eps->ops->setfromoptions)(eps);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)eps);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); } ierr = IPSetFromOptions(eps->ip);CHKERRQ(ierr); if (!eps->ds) { ierr = EPSGetDS(eps,&eps->ds);CHKERRQ(ierr); } ierr = DSSetFromOptions(eps->ds);CHKERRQ(ierr); ierr = STSetFromOptions(eps->st);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(eps->rand);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetTolerances" /*@ EPSGetTolerances - Gets the tolerance and maximum iteration count used by the EPS convergence tests. Not Collective Input Parameter: . eps - the eigensolver context Output Parameters: + tol - the convergence tolerance - maxits - maximum number of iterations Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: EPSSetTolerances() @*/ PetscErrorCode EPSGetTolerances(EPS eps,PetscReal *tol,PetscInt *maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (tol) *tol = eps->tol; if (maxits) *maxits = eps->max_it; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetTolerances" /*@ EPSSetTolerances - Sets the tolerance and maximum iteration count used by the EPS convergence tests. Logically Collective on EPS Input Parameters: + eps - the eigensolver context . tol - the convergence tolerance - maxits - maximum number of iterations to use Options Database Keys: + -eps_tol - Sets the convergence tolerance - -eps_max_it - Sets the maximum number of iterations allowed Notes: Pass 0 for an argument that need not be changed. Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method. Level: intermediate .seealso: EPSGetTolerances() @*/ PetscErrorCode EPSSetTolerances(EPS eps,PetscReal tol,PetscInt maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveReal(eps,tol,2); PetscValidLogicalCollectiveInt(eps,maxits,3); if (tol) { if (tol == PETSC_DEFAULT) { eps->tol = PETSC_DEFAULT; } else { if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0"); eps->tol = tol; } } if (maxits) { if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) { eps->max_it = 0; eps->setupcalled = 0; } else { if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0"); eps->max_it = maxits; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetDimensions" /*@ EPSGetDimensions - Gets the number of eigenvalues to compute and the dimension of the subspace. Not Collective Input Parameter: . eps - the eigensolver context Output Parameters: + nev - number of eigenvalues to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: EPSSetDimensions() @*/ PetscErrorCode EPSGetDimensions(EPS eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (nev) *nev = eps->nev; if (ncv) *ncv = eps->ncv; if (mpd) *mpd = eps->mpd; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetDimensions" /*@ EPSSetDimensions - Sets the number of eigenvalues to compute and the dimension of the subspace. Logically Collective on EPS Input Parameters: + eps - the eigensolver context . nev - number of eigenvalues to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Options Database Keys: + -eps_nev - Sets the number of eigenvalues . -eps_ncv - Sets the dimension of the subspace - -eps_mpd - Sets the maximum projected dimension Notes: Pass 0 to retain the previous value of any parameter. Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method. The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and (b) in cases where nev is large, the user sets mpd. The value of ncv should always be between nev and (nev+mpd), typically ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise a smaller value should be used. When computing all eigenvalues in an interval, see EPSSetInterval(), the meaning of nev changes. In that case, the number of eigenvalues in the interval is not known a priori; the meaning of nev is then the number of eigenvalues that are computed at a time when sweeping the interval from one end to the other. The value of nev in this case may have an impact on overall performance. The value of ncv should not be assigned in this case. Level: intermediate .seealso: EPSGetDimensions(), EPSSetInterval() @*/ PetscErrorCode EPSSetDimensions(EPS eps,PetscInt nev,PetscInt ncv,PetscInt mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,nev,2); PetscValidLogicalCollectiveInt(eps,ncv,3); PetscValidLogicalCollectiveInt(eps,mpd,4); if (nev) { if (nev<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0"); eps->nev = nev; eps->setupcalled = 0; } if (ncv) { if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) { eps->ncv = 0; } else { if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0"); eps->ncv = ncv; } eps->setupcalled = 0; } if (mpd) { if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) { eps->mpd = 0; } else { if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0"); eps->mpd = mpd; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetWhichEigenpairs" /*@ EPSSetWhichEigenpairs - Specifies which portion of the spectrum is to be sought. Logically Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() - which - the portion of the spectrum to be sought Possible values: The parameter 'which' can have one of these values + EPS_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default) . EPS_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude . EPS_LARGEST_REAL - largest real parts . EPS_SMALLEST_REAL - smallest real parts . EPS_LARGEST_IMAGINARY - largest imaginary parts . EPS_SMALLEST_IMAGINARY - smallest imaginary parts . EPS_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude) . EPS_TARGET_REAL - eigenvalues with real part closest to target . EPS_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target . EPS_ALL - all eigenvalues contained in a given interval - EPS_WHICH_USER - user defined ordering set with EPSSetEigenvalueComparison() Options Database Keys: + -eps_largest_magnitude - Sets largest eigenvalues in magnitude . -eps_smallest_magnitude - Sets smallest eigenvalues in magnitude . -eps_largest_real - Sets largest real parts . -eps_smallest_real - Sets smallest real parts . -eps_largest_imaginary - Sets largest imaginary parts . -eps_smallest_imaginary - Sets smallest imaginary parts . -eps_target_magnitude - Sets eigenvalues closest to target . -eps_target_real - Sets real parts closest to target . -eps_target_imaginary - Sets imaginary parts closest to target - -eps_all - Sets all eigenvalues in an interval Notes: Not all eigensolvers implemented in EPS account for all the possible values stated above. Also, some values make sense only for certain types of problems. If SLEPc is compiled for real numbers EPS_LARGEST_IMAGINARY and EPS_SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection. The target is a scalar value provided with EPSSetTarget(). The criterion EPS_TARGET_IMAGINARY is available only in case PETSc and SLEPc have been built with complex scalars. EPS_ALL is intended for use in combination with an interval (see EPSSetInterval()), when all eigenvalues within the interval are requested. In that case, the number of eigenvalues is unknown, so the nev parameter has a different sense, see EPSSetDimensions(). Level: intermediate .seealso: EPSGetWhichEigenpairs(), EPSSetTarget(), EPSSetInterval(), EPSSetDimensions(), EPSSetEigenvalueComparison(), EPSSortEigenvalues(), EPSWhich @*/ PetscErrorCode EPSSetWhichEigenpairs(EPS eps,EPSWhich which) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,which,2); if (which) { if (which==PETSC_DECIDE || which==PETSC_DEFAULT) eps->which = (EPSWhich)0; else switch (which) { case EPS_LARGEST_MAGNITUDE: case EPS_SMALLEST_MAGNITUDE: case EPS_LARGEST_REAL: case EPS_SMALLEST_REAL: case EPS_LARGEST_IMAGINARY: case EPS_SMALLEST_IMAGINARY: case EPS_TARGET_MAGNITUDE: case EPS_TARGET_REAL: #if defined(PETSC_USE_COMPLEX) case EPS_TARGET_IMAGINARY: #endif case EPS_ALL: case EPS_WHICH_USER: if (eps->which != which) { eps->setupcalled = 0; eps->which = which; } break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value"); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetWhichEigenpairs" /*@C EPSGetWhichEigenpairs - Returns which portion of the spectrum is to be sought. Not Collective Input Parameter: . eps - eigensolver context obtained from EPSCreate() Output Parameter: . which - the portion of the spectrum to be sought Notes: See EPSSetWhichEigenpairs() for possible values of 'which'. Level: intermediate .seealso: EPSSetWhichEigenpairs(), EPSWhich @*/ PetscErrorCode EPSGetWhichEigenpairs(EPS eps,EPSWhich *which) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(which,2); *which = eps->which; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetLeftVectorsWanted" /*@ EPSSetLeftVectorsWanted - Specifies which eigenvectors are required. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - leftvecs - whether left eigenvectors are required or not Options Database Keys: . -eps_left_vectors - Sets/resets the boolean flag 'leftvecs' Notes: If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of the algorithm that computes both right and left eigenvectors. This is usually much more costly. This option is not available in all solvers. Level: intermediate .seealso: EPSGetLeftVectorsWanted(), EPSGetEigenvectorLeft() @*/ PetscErrorCode EPSSetLeftVectorsWanted(EPS eps,PetscBool leftvecs) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,leftvecs,2); if (eps->leftvecs != leftvecs) { eps->leftvecs = leftvecs; eps->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetLeftVectorsWanted" /*@ EPSGetLeftVectorsWanted - Returns the flag indicating whether left eigenvectors are required or not. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . leftvecs - the returned flag Level: intermediate .seealso: EPSSetLeftVectorsWanted(), EPSWhich @*/ PetscErrorCode EPSGetLeftVectorsWanted(EPS eps,PetscBool *leftvecs) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(leftvecs,2); *leftvecs = eps->leftvecs; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetMatrixNorms" /*@ EPSSetMatrixNorms - Gives the reference values of the matrix norms and specifies whether these values should be improved adaptively. Logically Collective on EPS Input Parameters: + eps - the eigensolver context . nrma - a reference value for the norm of matrix A . nrmb - a reference value for the norm of matrix B - adaptive - whether matrix norms are improved adaptively Options Database Keys: + -eps_norm_a - norm of A . -eps_norm_b - norm of B - -eps_norms_adaptive - Sets/resets the boolean flag 'adaptive' Notes: If the user sets adaptive=PETSC_FALSE then the solver uses the values of nrma and nrmb for the matrix norms, and these values do not change throughout the iteration. If the user sets adaptive=PETSC_TRUE then the solver tries to adaptively improve the supplied values, with the numerical information generated during the iteration. This option is not available in all solvers. If a passed value is PETSC_DEFAULT, the corresponding norm will be set to 1. If a passed value is PETSC_DETERMINE, the corresponding norm will be computed as the NORM_INFINITY with MatNorm(). Level: intermediate .seealso: EPSGetMatrixNorms() @*/ PetscErrorCode EPSSetMatrixNorms(EPS eps,PetscReal nrma,PetscReal nrmb,PetscBool adaptive) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveReal(eps,nrma,2); PetscValidLogicalCollectiveReal(eps,nrmb,3); PetscValidLogicalCollectiveBool(eps,adaptive,4); if (nrma) { if (nrma == PETSC_DEFAULT) eps->nrma = 1.0; else if (nrma == PETSC_DETERMINE) { eps->nrma = nrma; eps->setupcalled = 0; } else { if (nrma < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nrma. Must be > 0"); eps->nrma = nrma; } } if (nrmb) { if (!eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Norm of B only allowed in generalized problems"); if (nrmb == PETSC_DEFAULT) eps->nrmb = 1.0; else if (nrmb == PETSC_DETERMINE) { eps->nrmb = nrmb; eps->setupcalled = 0; } else { if (nrmb < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nrmb. Must be > 0"); eps->nrmb = nrmb; } } if (eps->adaptive != adaptive) { eps->adaptive = adaptive; eps->setupcalled = 0; if (adaptive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Sorry, adaptive norms are not implemented in this release"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetMatrixNorms" /*@ EPSGetMatrixNorms - Returns the value of the matrix norms (either set by the user or estimated by the solver) and the flag indicating whether the norms are being adaptively improved. Not Collective Input Parameter: . eps - the eigensolver context Output Parameters: + nrma - the norm of matrix A . nrmb - the norm of matrix B - adaptive - whether matrix norms are improved adaptively Level: intermediate .seealso: EPSSetMatrixNorms() @*/ PetscErrorCode EPSGetMatrixNorms(EPS eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (nrma) *nrma = eps->nrma; if (nrmb) *nrmb = eps->nrmb; if (adaptive) *adaptive = eps->adaptive; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetEigenvalueComparison" /*@C EPSSetEigenvalueComparison - Specifies the eigenvalue comparison function when EPSSetWhichEigenpairs() is set to EPS_WHICH_USER. Logically Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() . func - a pointer to the comparison function - ctx - a context pointer (the last parameter to the comparison function) Calling Sequence of func: $ func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx) + ar - real part of the 1st eigenvalue . ai - imaginary part of the 1st eigenvalue . br - real part of the 2nd eigenvalue . bi - imaginary part of the 2nd eigenvalue . res - result of comparison - ctx - optional context, as set by EPSSetEigenvalueComparison() Note: The returning parameter 'res' can be: + negative - if the 1st eigenvalue is preferred to the 2st one . zero - if both eigenvalues are equally preferred - positive - if the 2st eigenvalue is preferred to the 1st one Level: advanced .seealso: EPSSetWhichEigenpairs(), EPSSortEigenvalues(), EPSWhich @*/ PetscErrorCode EPSSetEigenvalueComparison(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); eps->comparison = func; eps->comparisonctx = ctx; eps->which = EPS_WHICH_USER; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetArbitrarySelection" /*@C EPSSetArbitrarySelection - Specifies a function intended to look for eigenvalues according to an arbitrary selection criterion. This criterion can be based on a computation involving the current eigenvector approximation. Logically Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() . func - a pointer to the evaluation function - ctx - a context pointer (the last parameter to the evaluation function) Calling Sequence of func: $ func(PetscScalar er,PetscScalar ei,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx) + er - real part of the current eigenvalue approximation . ei - imaginary part of the current eigenvalue approximation . xr - real part of the current eigenvector approximation . xi - imaginary part of the current eigenvector approximation . rr - result of evaluation (real part) . ri - result of evaluation (imaginary part) - ctx - optional context, as set by EPSSetArbitrarySelection() Note: This provides a mechanism to select eigenpairs by evaluating a user-defined function. When a function has been provided, the default selection based on sorting the eigenvalues is replaced by the sorting of the results of this function (with the same sorting criterion given in EPSSortEigenvalues()). For instance, suppose you want to compute those eigenvectors that maximize a certain computable expression. Then implement the computation using the arguments xr and xi, and return the result in rr. Then set the standard sorting by magnitude so that the eigenpair with largest value of rr is selected. The result of func is expressed as a complex number so that it is possible to use the standard eigenvalue sorting functions, but normally only rr is used. Set ri to zero unless it is meaningful in your application. Level: advanced .seealso: EPSSetWhichEigenpairs(), EPSSortEigenvalues() @*/ PetscErrorCode EPSSetArbitrarySelection(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*),void* ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); eps->arbitrary = func; eps->arbitraryctx = ctx; eps->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetConvergenceTestFunction" /*@C EPSSetConvergenceTestFunction - Sets a function to compute the error estimate used in the convergence test. Logically Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() . func - a pointer to the convergence test function - ctx - a context pointer (the last parameter to the convergence test function) Calling Sequence of func: $ func(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) + eps - eigensolver context obtained from EPSCreate() . eigr - real part of the eigenvalue . eigi - imaginary part of the eigenvalue . res - residual norm associated to the eigenpair . errest - (output) computed error estimate - ctx - optional context, as set by EPSSetConvergenceTest() Note: If the error estimate returned by the convergence test function is less than the tolerance, then the eigenvalue is accepted as converged. Level: advanced .seealso: EPSSetConvergenceTest(),EPSSetTolerances() @*/ PetscErrorCode EPSSetConvergenceTestFunction(EPS eps,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); eps->converged = func; eps->convergedctx = ctx; if (func == EPSConvergedEigRelative) eps->conv = EPS_CONV_EIG; else if (func == EPSConvergedNormRelative) eps->conv = EPS_CONV_NORM; else if (func == EPSConvergedAbsolute) eps->conv = EPS_CONV_ABS; else eps->conv = EPS_CONV_USER; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetConvergenceTest" /*@ EPSSetConvergenceTest - Specifies how to compute the error estimate used in the convergence test. Logically Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() - conv - the type of convergence test Options Database Keys: + -eps_conv_abs - Sets the absolute convergence test . -eps_conv_eig - Sets the convergence test relative to the eigenvalue - -eps_conv_norm - Sets the convergence test relative to the matrix norms Note: The parameter 'conv' can have one of these values + EPS_CONV_ABS - absolute error ||r|| . EPS_CONV_EIG - error relative to the eigenvalue l, ||r||/|l| . EPS_CONV_NORM - error relative to the matrix norms, ||r||/(||A||+|l|*||B||) - EPS_CONV_USER - function set by EPSSetConvergenceTestFunction() Level: intermediate .seealso: EPSGetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv @*/ PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,conv,2); switch (conv) { case EPS_CONV_EIG: eps->converged = EPSConvergedEigRelative; break; case EPS_CONV_NORM: eps->converged = EPSConvergedNormRelative; break; case EPS_CONV_ABS: eps->converged = EPSConvergedAbsolute; break; case EPS_CONV_USER: break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'conv' value"); } eps->conv = conv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetConvergenceTest" /*@ EPSGetConvergenceTest - Gets the method used to compute the error estimate used in the convergence test. Not Collective Input Parameters: . eps - eigensolver context obtained from EPSCreate() Output Parameters: . conv - the type of convergence test Level: intermediate .seealso: EPSSetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv @*/ PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(conv,2); *conv = eps->conv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetProblemType" /*@ EPSSetProblemType - Specifies the type of the eigenvalue problem. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - type - a known type of eigenvalue problem Options Database Keys: + -eps_hermitian - Hermitian eigenvalue problem . -eps_gen_hermitian - generalized Hermitian eigenvalue problem . -eps_non_hermitian - non-Hermitian eigenvalue problem . -eps_gen_non_hermitian - generalized non-Hermitian eigenvalue problem - -eps_pos_gen_non_hermitian - generalized non-Hermitian eigenvalue problem with positive semi-definite B Notes: Allowed values for the problem type are: Hermitian (EPS_HEP), non-Hermitian (EPS_NHEP), generalized Hermitian (EPS_GHEP), generalized non-Hermitian (EPS_GNHEP), generalized non-Hermitian with positive semi-definite B (EPS_PGNHEP), and generalized Hermitian-indefinite (EPS_GHIEP). This function must be used to instruct SLEPc to exploit symmetry. If no problem type is specified, by default a non-Hermitian problem is assumed (either standard or generalized). If the user knows that the problem is Hermitian (i.e. A=A^H) or generalized Hermitian (i.e. A=A^H, B=B^H, and B positive definite) then it is recommended to set the problem type so that eigensolver can exploit these properties. Level: beginner .seealso: EPSSetOperators(), EPSSetType(), EPSGetProblemType(), EPSProblemType @*/ PetscErrorCode EPSSetProblemType(EPS eps,EPSProblemType type) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,type,2); switch (type) { case EPS_HEP: eps->isgeneralized = PETSC_FALSE; eps->ishermitian = PETSC_TRUE; eps->ispositive = PETSC_FALSE; break; case EPS_NHEP: eps->isgeneralized = PETSC_FALSE; eps->ishermitian = PETSC_FALSE; eps->ispositive = PETSC_FALSE; break; case EPS_GHEP: eps->isgeneralized = PETSC_TRUE; eps->ishermitian = PETSC_TRUE; eps->ispositive = PETSC_TRUE; break; case EPS_GNHEP: eps->isgeneralized = PETSC_TRUE; eps->ishermitian = PETSC_FALSE; eps->ispositive = PETSC_FALSE; break; case EPS_PGNHEP: eps->isgeneralized = PETSC_TRUE; eps->ishermitian = PETSC_FALSE; eps->ispositive = PETSC_TRUE; break; case EPS_GHIEP: eps->isgeneralized = PETSC_TRUE; eps->ishermitian = PETSC_TRUE; eps->ispositive = PETSC_FALSE; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type"); } eps->problem_type = type; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetProblemType" /*@C EPSGetProblemType - Gets the problem type from the EPS object. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . type - name of EPS problem type Level: intermediate .seealso: EPSSetProblemType(), EPSProblemType @*/ PetscErrorCode EPSGetProblemType(EPS eps,EPSProblemType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(type,2); *type = eps->problem_type; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetExtraction" /*@ EPSSetExtraction - Specifies the type of extraction technique to be employed by the eigensolver. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - extr - a known type of extraction Options Database Keys: + -eps_ritz - Rayleigh-Ritz extraction . -eps_harmonic - harmonic Ritz extraction . -eps_harmonic_relative - harmonic Ritz extraction relative to the eigenvalue . -eps_harmonic_right - harmonic Ritz extraction for rightmost eigenvalues . -eps_harmonic_largest - harmonic Ritz extraction for largest magnitude (without target) . -eps_refined - refined Ritz extraction - -eps_refined_harmonic - refined harmonic Ritz extraction Notes: Not all eigensolvers support all types of extraction. See the SLEPc Users Manual for details. By default, a standard Rayleigh-Ritz extraction is used. Other extractions may be useful when computing interior eigenvalues. Harmonic-type extractions are used in combination with a 'target'. Level: beginner .seealso: EPSSetTarget(), EPSGetExtraction(), EPSExtraction @*/ PetscErrorCode EPSSetExtraction(EPS eps,EPSExtraction extr) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,extr,2); eps->extraction = extr; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetExtraction" /*@C EPSGetExtraction - Gets the extraction type used by the EPS object. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . extr - name of extraction type Level: intermediate .seealso: EPSSetExtraction(), EPSExtraction @*/ PetscErrorCode EPSGetExtraction(EPS eps,EPSExtraction *extr) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(extr,2); *extr = eps->extraction; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetBalance" /*@ EPSSetBalance - Specifies the balancing technique to be employed by the eigensolver, and some parameters associated to it. Logically Collective on EPS Input Parameters: + eps - the eigensolver context . bal - the balancing method, one of EPS_BALANCE_NONE, EPS_BALANCE_ONESIDE, EPS_BALANCE_TWOSIDE, or EPS_BALANCE_USER . its - number of iterations of the balancing algorithm - cutoff - cutoff value Options Database Keys: + -eps_balance - the balancing method, where is one of 'none', 'oneside', 'twoside', or 'user' . -eps_balance_its - number of iterations - -eps_balance_cutoff - cutoff value Notes: When balancing is enabled, the solver works implicitly with matrix DAD^-1, where D is an appropriate diagonal matrix. This improves the accuracy of the computed results in some cases. See the SLEPc Users Manual for details. Balancing makes sense only for non-Hermitian problems when the required precision is high (i.e. a small tolerance such as 1e-15). By default, balancing is disabled. The two-sided method is much more effective than the one-sided counterpart, but it requires the system matrices to have the MatMultTranspose operation defined. The parameter 'its' is the number of iterations performed by the method. The cutoff value is used only in the two-side variant. Pass 0 for an argument that need not be changed. Use PETSC_DECIDE to assign a reasonably good value. User-defined balancing is allowed provided that the corresponding matrix is set via STSetBalanceMatrix. Level: intermediate .seealso: EPSGetBalance(), EPSBalance, STSetBalanceMatrix() @*/ PetscErrorCode EPSSetBalance(EPS eps,EPSBalance bal,PetscInt its,PetscReal cutoff) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveEnum(eps,bal,2); PetscValidLogicalCollectiveInt(eps,its,3); PetscValidLogicalCollectiveReal(eps,cutoff,4); if (bal) { if (bal==PETSC_DECIDE || bal==PETSC_DEFAULT) eps->balance = EPS_BALANCE_TWOSIDE; else switch (bal) { case EPS_BALANCE_NONE: case EPS_BALANCE_ONESIDE: case EPS_BALANCE_TWOSIDE: case EPS_BALANCE_USER: eps->balance = bal; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid value of argument 'bal'"); } } if (its) { if (its==PETSC_DECIDE || its==PETSC_DEFAULT) eps->balance_its = 5; else eps->balance_its = its; } if (cutoff) { if (cutoff==PETSC_DECIDE || cutoff==PETSC_DEFAULT) eps->balance_cutoff = 1e-8; else eps->balance_cutoff = cutoff; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetBalance" /*@ EPSGetBalance - Gets the balancing type used by the EPS object, and the associated parameters. Not Collective Input Parameter: . eps - the eigensolver context Output Parameters: + bal - the balancing method . its - number of iterations of the balancing algorithm - cutoff - cutoff value Level: intermediate Note: The user can specify NULL for any parameter that is not needed. .seealso: EPSSetBalance(), EPSBalance @*/ PetscErrorCode EPSGetBalance(EPS eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (bal) *bal = eps->balance; if (its) *its = eps->balance_its; if (cutoff) *cutoff = eps->balance_cutoff; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetTrueResidual" /*@ EPSSetTrueResidual - Specifies if the solver must compute the true residual explicitly or not. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - trueres - whether true residuals are required or not Options Database Keys: . -eps_true_residual - Sets/resets the boolean flag 'trueres' Notes: If the user sets trueres=PETSC_TRUE then the solver explicitly computes the true residual for each eigenpair approximation, and uses it for convergence testing. Computing the residual is usually an expensive operation. Some solvers (e.g., Krylov solvers) can avoid this computation by using a cheap estimate of the residual norm, but this may sometimes give inaccurate results (especially if a spectral transform is being used). On the contrary, preconditioned eigensolvers (e.g., Davidson solvers) do rely on computing the true residual, so this option is irrelevant for them. Level: intermediate .seealso: EPSGetTrueResidual() @*/ PetscErrorCode EPSSetTrueResidual(EPS eps,PetscBool trueres) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,trueres,2); eps->trueres = trueres; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetTrueResidual" /*@C EPSGetTrueResidual - Returns the flag indicating whether true residuals must be computed explicitly or not. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . trueres - the returned flag Level: intermediate .seealso: EPSSetTrueResidual() @*/ PetscErrorCode EPSGetTrueResidual(EPS eps,PetscBool *trueres) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(trueres,2); *trueres = eps->trueres; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetTrackAll" /*@ EPSSetTrackAll - Specifies if the solver must compute the residual norm of all approximate eigenpairs or not. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - trackall - whether to compute all residuals or not Notes: If the user sets trackall=PETSC_TRUE then the solver computes (or estimates) the residual norm for each eigenpair approximation. Computing the residual is usually an expensive operation and solvers commonly compute only the residual associated to the first unconverged eigenpair. The options '-eps_monitor_all' and '-eps_monitor_lg_all' automatically activate this option. Level: intermediate .seealso: EPSGetTrackAll() @*/ PetscErrorCode EPSSetTrackAll(EPS eps,PetscBool trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveBool(eps,trackall,2); eps->trackall = trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetTrackAll" /*@ EPSGetTrackAll - Returns the flag indicating whether all residual norms must be computed or not. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . trackall - the returned flag Level: intermediate .seealso: EPSSetTrackAll() @*/ PetscErrorCode EPSGetTrackAll(EPS eps,PetscBool *trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(trackall,2); *trackall = eps->trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetOptionsPrefix" /*@C EPSSetOptionsPrefix - Sets the prefix used for searching for all EPS options in the database. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - prefix - the prefix string to prepend to all EPS option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different EPS contexts, one could call .vb EPSSetOptionsPrefix(eps1,"eig1_") EPSSetOptionsPrefix(eps2,"eig2_") .ve Level: advanced .seealso: EPSAppendOptionsPrefix(), EPSGetOptionsPrefix() @*/ PetscErrorCode EPSSetOptionsPrefix(EPS eps,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } ierr = STSetOptionsPrefix(eps->st,prefix);CHKERRQ(ierr); if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(eps->ip,prefix);CHKERRQ(ierr); if (!eps->ds) { ierr = EPSGetDS(eps,&eps->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(eps->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectSetOptionsPrefix((PetscObject)eps,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSAppendOptionsPrefix" /*@C EPSAppendOptionsPrefix - Appends to the prefix used for searching for all EPS options in the database. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - prefix - the prefix string to prepend to all EPS option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: EPSSetOptionsPrefix(), EPSGetOptionsPrefix() @*/ PetscErrorCode EPSAppendOptionsPrefix(EPS eps,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } ierr = STAppendOptionsPrefix(eps->st,prefix);CHKERRQ(ierr); if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(eps->ip,prefix);CHKERRQ(ierr); if (!eps->ds) { ierr = EPSGetDS(eps,&eps->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(eps->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectAppendOptionsPrefix((PetscObject)eps,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetOptionsPrefix" /*@C EPSGetOptionsPrefix - Gets the prefix used for searching for all EPS options in the database. Not Collective Input Parameters: . eps - the eigensolver context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: EPSSetOptionsPrefix(), EPSAppendOptionsPrefix() @*/ PetscErrorCode EPSGetOptionsPrefix(EPS eps,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)eps,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/itregis.c0000644000175000017500000000735712211062077020577 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ PETSC_EXTERN PetscErrorCode EPSCreate_Power(EPS); PETSC_EXTERN PetscErrorCode EPSCreate_Subspace(EPS); PETSC_EXTERN PetscErrorCode EPSCreate_Arnoldi(EPS); PETSC_EXTERN PetscErrorCode EPSCreate_Lanczos(EPS); PETSC_EXTERN PetscErrorCode EPSCreate_KrylovSchur(EPS); #if defined(SLEPC_HAVE_ARPACK) PETSC_EXTERN PetscErrorCode EPSCreate_ARPACK(EPS); #endif PETSC_EXTERN PetscErrorCode EPSCreate_LAPACK(EPS); #if defined(SLEPC_HAVE_BLZPACK) && !defined(PETSC_USE_COMPLEX) PETSC_EXTERN PetscErrorCode EPSCreate_BLZPACK(EPS); #endif #if defined(SLEPC_HAVE_TRLAN) && !defined(PETSC_USE_COMPLEX) PETSC_EXTERN PetscErrorCode EPSCreate_TRLAN(EPS); #endif #if defined(SLEPC_HAVE_BLOPEX) PETSC_EXTERN PetscErrorCode EPSCreate_BLOPEX(EPS); #endif #if defined(SLEPC_HAVE_PRIMME) PETSC_EXTERN PetscErrorCode EPSCreate_PRIMME(EPS eps); #endif #if defined(SLEPC_HAVE_FEAST) PETSC_EXTERN PetscErrorCode EPSCreate_FEAST(EPS); #endif PETSC_EXTERN PetscErrorCode EPSCreate_GD(EPS eps); PETSC_EXTERN PetscErrorCode EPSCreate_JD(EPS eps); PETSC_EXTERN PetscErrorCode EPSCreate_RQCG(EPS eps); PETSC_EXTERN PetscErrorCode EPSCreate_CISS(EPS eps); #undef __FUNCT__ #define __FUNCT__ "EPSRegisterAll" /*@C EPSRegisterAll - Registers all the eigenvalue solvers in the EPS package. Not Collective Level: advanced .seealso: EPSRegister() @*/ PetscErrorCode EPSRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; EPSRegisterAllCalled = PETSC_TRUE; ierr = EPSRegister(EPSKRYLOVSCHUR,EPSCreate_KrylovSchur);CHKERRQ(ierr); ierr = EPSRegister(EPSPOWER,EPSCreate_Power);CHKERRQ(ierr); ierr = EPSRegister(EPSSUBSPACE,EPSCreate_Subspace);CHKERRQ(ierr); ierr = EPSRegister(EPSARNOLDI,EPSCreate_Arnoldi);CHKERRQ(ierr); ierr = EPSRegister(EPSLANCZOS,EPSCreate_Lanczos);CHKERRQ(ierr); ierr = EPSRegister(EPSGD,EPSCreate_GD);CHKERRQ(ierr); ierr = EPSRegister(EPSJD,EPSCreate_JD);CHKERRQ(ierr); ierr = EPSRegister(EPSRQCG,EPSCreate_RQCG);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = EPSRegister(EPSCISS,EPSCreate_CISS);CHKERRQ(ierr); #endif ierr = EPSRegister(EPSLAPACK,EPSCreate_LAPACK);CHKERRQ(ierr); #if defined(SLEPC_HAVE_ARPACK) ierr = EPSRegister(EPSARPACK,EPSCreate_ARPACK);CHKERRQ(ierr); #endif #if defined(SLEPC_HAVE_BLZPACK) && !defined(PETSC_USE_COMPLEX) ierr = EPSRegister(EPSBLZPACK,EPSCreate_BLZPACK);CHKERRQ(ierr); #endif #if defined(SLEPC_HAVE_TRLAN) && !defined(PETSC_USE_COMPLEX) ierr = EPSRegister(EPSTRLAN,EPSCreate_TRLAN);CHKERRQ(ierr); #endif #if defined(SLEPC_HAVE_BLOPEX) ierr = EPSRegister(EPSBLOPEX,EPSCreate_BLOPEX);CHKERRQ(ierr); #endif #if defined(SLEPC_HAVE_PRIMME) ierr = EPSRegister(EPSPRIMME,EPSCreate_PRIMME);CHKERRQ(ierr); #endif #if defined(SLEPC_HAVE_FEAST) && defined(PETSC_USE_COMPLEX) ierr = EPSRegister(EPSFEAST,EPSCreate_FEAST);CHKERRQ(ierr); #endif PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/makefile0000644000175000017500000000223012211062077020446 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = monitor.c basic.c default.c itregis.c opts.c setup.c solve.c mem.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = EPS LOCDIR = src/eps/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/interface/monitor.c0000644000175000017500000003776112211062077020622 0ustar gladkgladk/* EPS routines related to monitors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "EPSMonitor" /* Runs the user provided monitor routines, if any. */ PetscErrorCode EPSMonitor(EPS eps,PetscInt it,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest) { PetscErrorCode ierr; PetscInt i,n = eps->numbermonitors; PetscFunctionBegin; for (i=0;imonitor[i])(eps,it,nconv,eigr,eigi,errest,nest,eps->monitorcontext[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorSet" /*@C EPSMonitorSet - Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair. Logically Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() . monitor - pointer to function (if this is NULL, it turns off monitoring) . mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired) - monitordestroy - [optional] routine that frees monitor context (may be NULL) Calling Sequence of monitor: $ monitor (EPS eps, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx) + eps - eigensolver context obtained from EPSCreate() . its - iteration number . nconv - number of converged eigenpairs . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - relative error estimates for each eigenpair . nest - number of error estimates - mctx - optional monitoring context, as set by EPSMonitorSet() Options Database Keys: + -eps_monitor - print only the first error estimate . -eps_monitor_all - print error estimates at each iteration . -eps_monitor_conv - print the eigenvalue approximations only when convergence has been reached . -eps_monitor_lg - sets line graph monitor for the first unconverged approximate eigenvalue . -eps_monitor_lg_all - sets line graph monitor for all unconverged approximate eigenvalues - -eps_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to EPSMonitorSet(), but does not cancel those set via the options database. Notes: Several different monitoring routines may be set by calling EPSMonitorSet() multiple times; all will be called in the order in which they were set. Level: intermediate .seealso: EPSMonitorFirst(), EPSMonitorAll(), EPSMonitorCancel() @*/ PetscErrorCode EPSMonitorSet(EPS eps,PetscErrorCode (*monitor)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**)) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (eps->numbermonitors >= MAXEPSMONITORS) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Too many EPS monitors set"); eps->monitor[eps->numbermonitors] = monitor; eps->monitorcontext[eps->numbermonitors] = (void*)mctx; eps->monitordestroy[eps->numbermonitors++] = monitordestroy; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorCancel" /*@ EPSMonitorCancel - Clears all monitors for an EPS object. Logically Collective on EPS Input Parameters: . eps - eigensolver context obtained from EPSCreate() Options Database Key: . -eps_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to EPSMonitorSet(), but does not cancel those set via the options database. Level: intermediate .seealso: EPSMonitorSet() @*/ PetscErrorCode EPSMonitorCancel(EPS eps) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); for (i=0; inumbermonitors; i++) { if (eps->monitordestroy[i]) { ierr = (*eps->monitordestroy[i])(&eps->monitorcontext[i]);CHKERRQ(ierr); } } eps->numbermonitors = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetMonitorContext" /*@C EPSGetMonitorContext - Gets the monitor context, as set by EPSMonitorSet() for the FIRST monitor only. Not Collective Input Parameter: . eps - eigensolver context obtained from EPSCreate() Output Parameter: . ctx - monitor context Level: intermediate .seealso: EPSMonitorSet() @*/ PetscErrorCode EPSGetMonitorContext(EPS eps,void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); *ctx = eps->monitorcontext[0]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorAll" /*@C EPSMonitorAll - Print the current approximate values and error estimates at each iteration of the eigensolver. Collective on EPS Input Parameters: + eps - eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorConverged() @*/ PetscErrorCode EPSMonitorAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscScalar er,ei; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps)); PetscFunctionBegin; if (its) { ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D EPS nconv=%D Values (Errors)",its,nconv);CHKERRQ(ierr); for (i=0;ist,1,&er,&ei);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",er);CHKERRQ(ierr); if (ei!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",ei);CHKERRQ(ierr); } #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)",(double)errest[i]);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorFirst" /*@C EPSMonitorFirst - Print the first approximate value and error estimate at each iteration of the eigensolver. Collective on EPS Input Parameters: + eps - eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: EPSMonitorSet(), EPSMonitorAll(), EPSMonitorConverged() @*/ PetscErrorCode EPSMonitorFirst(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscScalar er,ei; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps)); PetscFunctionBegin; if (its && nconvtablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D EPS nconv=%D first unconverged value (error)",its,nconv);CHKERRQ(ierr); er = eigr[nconv]; ei = eigi[nconv]; ierr = STBackTransform(eps->st,1,&er,&ei);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",er);CHKERRQ(ierr); if (ei!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",ei);CHKERRQ(ierr); } #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[nconv]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorConverged" /*@C EPSMonitorConverged - Print the approximate values and error estimates as they converge. Collective on EPS Input Parameters: + eps - eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context Note: The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT. Level: intermediate .seealso: EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorAll() @*/ PetscErrorCode EPSMonitorConverged(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscScalar er,ei; PetscViewer viewer; SlepcConvMonitor ctx = (SlepcConvMonitor)monctx; PetscFunctionBegin; if (!monctx) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Must provide a context for EPSMonitorConverged"); if (!its) { ctx->oldnconv = 0; } else { viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps)); for (i=ctx->oldnconv;itablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D EPS converged value (error) #%D",its,i);CHKERRQ(ierr); er = eigr[i]; ei = eigi[i]; ierr = STBackTransform(eps->st,1,&er,&ei);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",er);CHKERRQ(ierr); if (ei!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",ei);CHKERRQ(ierr); } #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr); } ctx->oldnconv = nconv; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorLG" PetscErrorCode EPSMonitorLG(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw,draw1; PetscDrawLG lg,lg1; PetscErrorCode ierr; PetscReal x,y,myeigr,p; PetscScalar er,ei; PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)eps)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(eps->tol)-2,0.0);CHKERRQ(ierr); } /* In the hermitian case, the eigenvalues are real and can be plotted */ if (eps->ishermitian) { ierr = PetscViewerDrawGetDraw(viewer,1,&draw1);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,1,&lg1);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw1,"Approximate eigenvalues");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw1);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg1,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg1);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);CHKERRQ(ierr); } } x = (PetscReal)its; if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0; ierr = PetscDrawLGAddPoint(lg,&x,&y);CHKERRQ(ierr); if (eps->ishermitian) { er = eigr[nconv]; ei = eigi[nconv]; ierr = STBackTransform(eps->st,1,&er,&ei);CHKERRQ(ierr); myeigr = PetscRealPart(er); ierr = PetscDrawLGAddPoint(lg1,&x,&myeigr);CHKERRQ(ierr); ierr = PetscDrawGetPause(draw1,&p);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,0);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg1);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,p);CHKERRQ(ierr); } ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitorLGAll" PetscErrorCode EPSMonitorLGAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw,draw1; PetscDrawLG lg,lg1; PetscErrorCode ierr; PetscReal *x,*y,*myeigr,p; PetscInt i,n = PetscMin(eps->nev,255); PetscScalar er,ei; PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)eps)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,n);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(eps->tol)-2,0.0);CHKERRQ(ierr); } /* In the hermitian case, the eigenvalues are real and can be plotted */ if (eps->ishermitian) { ierr = PetscViewerDrawGetDraw(viewer,1,&draw1);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,1,&lg1);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw1,"Approximate eigenvalues");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw1);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg1,n);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg1);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);CHKERRQ(ierr); } } ierr = PetscMalloc(sizeof(PetscReal)*n,&x);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscReal)*n,&y);CHKERRQ(ierr); for (i=0;i 0.0) y[i] = log10(errest[i]); else y[i] = 0.0; } ierr = PetscDrawLGAddPoint(lg,x,y);CHKERRQ(ierr); if (eps->ishermitian) { ierr = PetscMalloc(sizeof(PetscReal)*n,&myeigr);CHKERRQ(ierr); for (i=0;ist,1,&er,&ei);CHKERRQ(ierr); if (i < nest) myeigr[i] = PetscRealPart(er); else myeigr[i] = 0.0; } ierr = PetscDrawLGAddPoint(lg1,x,myeigr);CHKERRQ(ierr); ierr = PetscDrawGetPause(draw1,&p);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,0);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg1);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,p);CHKERRQ(ierr); ierr = PetscFree(myeigr);CHKERRQ(ierr); } ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); ierr = PetscFree(x);CHKERRQ(ierr); ierr = PetscFree(y);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/makefile.html0000644000175000017500000000406112211062077021415 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = monitor.c basic.c default.c itregis.c opts.c setup.c solve.c mem.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = EPS
LOCDIR   = src/eps/interface/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/eps/interface/index.html0000644000175000017500000000255512211062077020755 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

monitor.c
basic.c
default.c
itregis.c
opts.c
setup.c
solve.c
mem.c
makefile
slepc-3.4.2.dfsg.orig/src/eps/interface/mem.c.html0000644000175000017500000001567112211062077020650 0ustar gladkgladk

Actual source code: mem.c

  1: /*
  2:       EPS routines related to memory management.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>   /*I "slepceps.h" I*/

 28: /*
 29:   EPSAllocateSolution - Allocate memory storage for common variables such
 30:   as eigenvalues and eigenvectors.
 31: */
 32: PetscErrorCode EPSAllocateSolution(EPS eps)
 33: {
 35:   PetscInt       newc,cnt;

 38:   if (eps->allocated_ncv != eps->ncv) {
 39:     newc = PetscMax(0,eps->ncv-eps->allocated_ncv);
 40:     EPSFreeSolution(eps);
 41:     cnt = 0;
 42:     PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->eigr);
 43:     PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->eigi);
 44:     cnt += 2*newc*sizeof(PetscScalar);
 45:     PetscMalloc(eps->ncv*sizeof(PetscReal),&eps->errest);
 46:     PetscMalloc(eps->ncv*sizeof(PetscReal),&eps->errest_left);
 47:     cnt += 2*newc*sizeof(PetscReal);
 48:     PetscMalloc(eps->ncv*sizeof(PetscInt),&eps->perm);
 49:     cnt += newc*sizeof(PetscInt);
 50:     PetscLogObjectMemory(eps,cnt);
 51:     VecDuplicateVecs(eps->t,eps->ncv,&eps->V);
 52:     PetscLogObjectParents(eps,eps->ncv,eps->V);
 53:     if (eps->leftvecs) {
 54:       VecDuplicateVecs(eps->t,eps->ncv,&eps->W);
 55:       PetscLogObjectParents(eps,eps->ncv,eps->W);
 56:     }
 57:     eps->allocated_ncv = eps->ncv;
 58:   }
 59:   /* The following cannot go in the above if, to avoid crash when ncv did not change */
 60:   if (eps->arbitrary) {
 61:     newc = PetscMax(0,eps->ncv-eps->allocated_ncv);
 62:     PetscFree(eps->rr);
 63:     PetscFree(eps->ri);
 64:     PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->rr);
 65:     PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->ri);
 66:     PetscLogObjectMemory(eps,2*newc*sizeof(PetscScalar));
 67:   }
 68:   return(0);
 69: }

 73: /*
 74:   EPSFreeSolution - Free memory storage. This routine is related to
 75:   EPSAllocateSolution().
 76: */
 77: PetscErrorCode EPSFreeSolution(EPS eps)
 78: {

 82:   if (eps->allocated_ncv > 0) {
 83:     PetscFree(eps->eigr);
 84:     PetscFree(eps->eigi);
 85:     PetscFree(eps->errest);
 86:     PetscFree(eps->errest_left);
 87:     PetscFree(eps->perm);
 88:     PetscFree(eps->rr);
 89:     PetscFree(eps->ri);
 90:     VecDestroyVecs(eps->allocated_ncv,&eps->V);
 91:     VecDestroyVecs(eps->allocated_ncv,&eps->W);
 92:     eps->allocated_ncv = 0;
 93:   }
 94:   return(0);
 95: }
slepc-3.4.2.dfsg.orig/src/eps/interface/solve.c0000644000175000017500000013655512211062077020264 0ustar gladkgladk/* EPS routines related to the solution process. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include typedef struct { PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); void *comparisonctx; ST st; } EPSSortForSTData; #undef __FUNCT__ #define __FUNCT__ "EPSSortForSTFunc" static PetscErrorCode EPSSortForSTFunc(PetscScalar ar,PetscScalar ai, PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx) { EPSSortForSTData *data = (EPSSortForSTData*)ctx; PetscErrorCode ierr; PetscFunctionBegin; ierr = STBackTransform(data->st,1,&ar,&ai);CHKERRQ(ierr); ierr = STBackTransform(data->st,1,&br,&bi);CHKERRQ(ierr); ierr = (*data->comparison)(ar,ai,br,bi,r,data->comparisonctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSolve" /*@ EPSSolve - Solves the eigensystem. Collective on EPS Input Parameter: . eps - eigensolver context obtained from EPSCreate() Options Database Keys: + -eps_view - print information about the solver used . -eps_view_mat0 binary - save the first matrix (A) to the default binary viewer . -eps_view_mat1 binary - save the second matrix (B) to the default binary viewer - -eps_plot_eigs - plot computed eigenvalues Level: beginner .seealso: EPSCreate(), EPSSetUp(), EPSDestroy(), EPSSetTolerances() @*/ PetscErrorCode EPSSolve(EPS eps) { PetscErrorCode ierr; PetscInt i,nmat; PetscReal re,im; PetscScalar dot; PetscBool flg,isfold,iscayley; PetscViewer viewer; PetscViewerFormat format; PetscDraw draw; PetscDrawSP drawsp; STMatMode matmode; EPSSortForSTData data; Mat A,B; KSP ksp; Vec w,x; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = PetscLogEventBegin(EPS_Solve,eps,0,0,0);CHKERRQ(ierr); /* call setup */ ierr = EPSSetUp(eps);CHKERRQ(ierr); ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } eps->evecsavailable = PETSC_FALSE; eps->nconv = 0; eps->its = 0; for (i=0;incv;i++) { eps->eigr[i] = 0.0; eps->eigi[i] = 0.0; eps->errest[i] = 0.0; } ierr = EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,eps->ncv);CHKERRQ(ierr); ierr = PetscObjectTypeCompareAny((PetscObject)eps,&flg,EPSARPACK,EPSBLZPACK,EPSTRLAN,EPSBLOPEX,EPSPRIMME,"");CHKERRQ(ierr); if (!flg) { /* temporarily change eigenvalue comparison function */ data.comparison = eps->comparison; data.comparisonctx = eps->comparisonctx; data.st = eps->st; eps->comparison = (eps->which==EPS_ALL)? SlepcCompareLargestMagnitude: EPSSortForSTFunc; eps->comparisonctx = (eps->which==EPS_ALL)? NULL: &data; } ierr = DSSetEigenvalueComparison(eps->ds,eps->comparison,eps->comparisonctx);CHKERRQ(ierr); /* call solver */ ierr = (*eps->ops->solve)(eps);CHKERRQ(ierr); if (!flg) { /* restore comparison function */ eps->comparison = data.comparison; eps->comparisonctx = data.comparisonctx; } ierr = STGetMatMode(eps->st,&matmode);CHKERRQ(ierr); if (matmode == ST_MATMODE_INPLACE && eps->ispositive) { /* Purify eigenvectors before reverting operator */ ierr = (*eps->ops->computevectors)(eps);CHKERRQ(ierr); } ierr = STPostSolve(eps->st);CHKERRQ(ierr); if (!eps->reason) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason"); /* Map eigenvalues back to the original problem, necessary in some * spectral transformations */ if (eps->ops->backtransform) { ierr = (*eps->ops->backtransform)(eps);CHKERRQ(ierr); } /* Adjust left eigenvectors in generalized problems: y = B^T y */ if (eps->isgeneralized && eps->leftvecs) { ierr = KSPCreate(PetscObjectComm((PetscObject)eps),&ksp);CHKERRQ(ierr); ierr = KSPSetOperators(ksp,B,B,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr); ierr = MatGetVecs(B,NULL,&w);CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = VecCopy(eps->W[i],w);CHKERRQ(ierr); ierr = KSPSolveTranspose(ksp,w,eps->W[i]);CHKERRQ(ierr); } ierr = KSPDestroy(&ksp);CHKERRQ(ierr); ierr = VecDestroy(&w);CHKERRQ(ierr); } #if !defined(PETSC_USE_COMPLEX) /* reorder conjugate eigenvalues (positive imaginary first) */ for (i=0; inconv-1; i++) { if (eps->eigi[i] != 0) { if (eps->eigi[i] < 0) { eps->eigi[i] = -eps->eigi[i]; eps->eigi[i+1] = -eps->eigi[i+1]; if (!eps->evecsavailable) { /* the next correction only works with eigenvectors */ ierr = (*eps->ops->computevectors)(eps);CHKERRQ(ierr); } ierr = VecScale(eps->V[i+1],-1.0);CHKERRQ(ierr); } i++; } } #endif /* quick and dirty solution for FOLD: recompute eigenvalues as Rayleigh quotients */ ierr = PetscObjectTypeCompare((PetscObject)eps->st,STFOLD,&isfold);CHKERRQ(ierr); if (isfold) { ierr = MatGetVecs(A,&w,NULL);CHKERRQ(ierr); if (!eps->evecsavailable) { ierr = (*eps->ops->computevectors)(eps);CHKERRQ(ierr); } for (i=0;inconv;i++) { x = eps->V[i]; ierr = MatMult(A,x,w);CHKERRQ(ierr); ierr = VecDot(w,x,&eps->eigr[i]);CHKERRQ(ierr); if (eps->isgeneralized) { ierr = MatMult(B,x,w);CHKERRQ(ierr); ierr = VecDot(w,x,&dot);CHKERRQ(ierr); eps->eigr[i] /= dot; } } ierr = VecDestroy(&w);CHKERRQ(ierr); } /* In the case of Cayley transform, eigenvectors need to be B-normalized */ ierr = PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&iscayley);CHKERRQ(ierr); if (iscayley && eps->isgeneralized && eps->ishermitian) { ierr = MatGetVecs(B,NULL,&w);CHKERRQ(ierr); if (!eps->evecsavailable) { ierr = (*eps->ops->computevectors)(eps);CHKERRQ(ierr); } for (i=0;inconv;i++) { x = eps->V[i]; ierr = MatMult(B,x,w);CHKERRQ(ierr); ierr = VecDot(w,x,&dot);CHKERRQ(ierr); ierr = VecScale(x,1.0/PetscSqrtScalar(dot));CHKERRQ(ierr); } ierr = VecDestroy(&w);CHKERRQ(ierr); } /* sort eigenvalues according to eps->which parameter */ ierr = EPSSortEigenvalues(eps,eps->nconv,eps->eigr,eps->eigi,eps->perm);CHKERRQ(ierr); ierr = PetscLogEventEnd(EPS_Solve,eps,0,0,0);CHKERRQ(ierr); /* various viewers */ ierr = MatViewFromOptions(A,((PetscObject)eps)->prefix,"-eps_view_mat0");CHKERRQ(ierr); if (nmat>1) { ierr = MatViewFromOptions(B,((PetscObject)eps)->prefix,"-eps_view_mat1");CHKERRQ(ierr); } ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)eps),((PetscObject)eps)->prefix,"-eps_view",&viewer,&format,&flg);CHKERRQ(ierr); if (flg && !PetscPreLoadingOn) { ierr = PetscViewerPushFormat(viewer,format);CHKERRQ(ierr); ierr = EPSView(eps,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsGetBool(((PetscObject)eps)->prefix,"-eps_plot_eigs",&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);CHKERRQ(ierr); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscDrawSPCreate(draw,1,&drawsp);CHKERRQ(ierr); for (i=0;inconv;i++) { #if defined(PETSC_USE_COMPLEX) re = PetscRealPart(eps->eigr[i]); im = PetscImaginaryPart(eps->eigi[i]); #else re = eps->eigr[i]; im = eps->eigi[i]; #endif ierr = PetscDrawSPAddPoint(drawsp,&re,&im);CHKERRQ(ierr); } ierr = PetscDrawSPDraw(drawsp,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscDrawSPDestroy(&drawsp);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } /* Remove the initial subspaces */ eps->nini = 0; eps->ninil = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetIterationNumber" /*@ EPSGetIterationNumber - Gets the current iteration number. If the call to EPSSolve() is complete, then it returns the number of iterations carried out by the solution method. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . its - number of iterations Level: intermediate Note: During the i-th iteration this call returns i-1. If EPSSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call EPSGetConvergedReason() to determine if the solver converged or failed and why. .seealso: EPSGetConvergedReason(), EPSSetTolerances() @*/ PetscErrorCode EPSGetIterationNumber(EPS eps,PetscInt *its) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(its,2); *its = eps->its; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetOperationCounters" /*@ EPSGetOperationCounters - Gets the total number of operator applications, inner product operations and linear iterations used by the ST object during the last EPSSolve() call. Not Collective Input Parameter: . eps - EPS context Output Parameter: + ops - number of operator applications . dots - number of inner product operations - lits - number of linear iterations Notes: When the eigensolver algorithm invokes STApply() then a linear system must be solved (except in the case of standard eigenproblems and shift transformation). The number of iterations required in this solve is accumulated into a counter whose value is returned by this function. These counters are reset to zero at each successive call to EPSSolve(). Level: intermediate @*/ PetscErrorCode EPSGetOperationCounters(EPS eps,PetscInt* ops,PetscInt* dots,PetscInt* lits) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } ierr = STGetOperationCounters(eps->st,ops,lits);CHKERRQ(ierr); if (dots) { if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); } ierr = IPGetOperationCounters(eps->ip,dots);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetConverged" /*@ EPSGetConverged - Gets the number of converged eigenpairs. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . nconv - number of converged eigenpairs Note: This function should be called after EPSSolve() has finished. Level: beginner .seealso: EPSSetDimensions(), EPSSolve() @*/ PetscErrorCode EPSGetConverged(EPS eps,PetscInt *nconv) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(nconv,2); *nconv = eps->nconv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetConvergedReason" /*@C EPSGetConvergedReason - Gets the reason why the EPSSolve() iteration was stopped. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . reason - negative value indicates diverged, positive value converged Possible values for reason: + EPS_CONVERGED_TOL - converged up to tolerance . EPS_DIVERGED_ITS - required more than its to reach convergence - EPS_DIVERGED_BREAKDOWN - generic breakdown in method Note: Can only be called after the call to EPSSolve() is complete. Level: intermediate .seealso: EPSSetTolerances(), EPSSolve(), EPSConvergedReason @*/ PetscErrorCode EPSGetConvergedReason(EPS eps,EPSConvergedReason *reason) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidIntPointer(reason,2); *reason = eps->reason; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetInvariantSubspace" /*@ EPSGetInvariantSubspace - Gets an orthonormal basis of the computed invariant subspace. Not Collective, but vectors are shared by all processors that share the EPS Input Parameter: . eps - the eigensolver context Output Parameter: . v - an array of vectors Notes: This function should be called after EPSSolve() has finished. The user should provide in v an array of nconv vectors, where nconv is the value returned by EPSGetConverged(). The first k vectors returned in v span an invariant subspace associated with the first k computed eigenvalues (note that this is not true if the k-th eigenvalue is complex and matrix A is real; in this case the first k+1 vectors should be used). An invariant subspace X of A satisfies Ax in X for all x in X (a similar definition applies for generalized eigenproblems). Level: intermediate .seealso: EPSGetEigenpair(), EPSGetConverged(), EPSSolve(), EPSGetInvariantSubspaceLeft() @*/ PetscErrorCode EPSGetInvariantSubspace(EPS eps,Vec *v) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(v,2); PetscValidHeaderSpecific(*v,VEC_CLASSID,2); if (!eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (!eps->ishermitian && eps->evecsavailable) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSGetInvariantSubspace must be called before EPSGetEigenpair,EPSGetEigenvector,EPSComputeRelativeError or EPSComputeResidualNorm"); if (eps->balance!=EPS_BALANCE_NONE && eps->D) { for (i=0;inconv;i++) { ierr = VecPointwiseDivide(v[i],eps->V[i],eps->D);CHKERRQ(ierr); ierr = VecNormalize(v[i],NULL);CHKERRQ(ierr); } } else { for (i=0;inconv;i++) { ierr = VecCopy(eps->V[i],v[i]);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetInvariantSubspaceLeft" /*@ EPSGetInvariantSubspaceLeft - Gets an orthonormal basis of the computed left invariant subspace (only available in two-sided eigensolvers). Not Collective, but vectors are shared by all processors that share the EPS Input Parameter: . eps - the eigensolver context Output Parameter: . v - an array of vectors Notes: This function should be called after EPSSolve() has finished. The user should provide in v an array of nconv vectors, where nconv is the value returned by EPSGetConverged(). The first k vectors returned in v span a left invariant subspace associated with the first k computed eigenvalues (note that this is not true if the k-th eigenvalue is complex and matrix A is real; in this case the first k+1 vectors should be used). A left invariant subspace Y of A satisfies y'A in Y for all y in Y (a similar definition applies for generalized eigenproblems). Level: intermediate .seealso: EPSGetEigenpair(), EPSGetConverged(), EPSSolve(), EPSGetInvariantSubspace @*/ PetscErrorCode EPSGetInvariantSubspaceLeft(EPS eps,Vec *v) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(v,2); PetscValidHeaderSpecific(*v,VEC_CLASSID,2); if (!eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted"); if (!eps->W) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (!eps->ishermitian && eps->evecsavailable) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSGetInvariantSubspaceLeft must be called before EPSGetEigenpairLeft,EPSComputeRelativeErrorLeft or EPSComputeResidualNormLeft"); for (i=0;inconv;i++) { ierr = VecCopy(eps->W[i],v[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetEigenpair" /*@ EPSGetEigenpair - Gets the i-th solution of the eigenproblem as computed by EPSSolve(). The solution consists in both the eigenvalue and the eigenvector. Logically Collective on EPS Input Parameters: + eps - eigensolver context - i - index of the solution Output Parameters: + eigr - real part of eigenvalue . eigi - imaginary part of eigenvalue . Vr - real part of eigenvector - Vi - imaginary part of eigenvector Notes: If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is configured with complex scalars the eigenvalue is stored directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is set to zero). The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs(). The 2-norm of the eigenvector is one unless the problem is generalized Hermitian. In this case the eigenvector is normalized with respect to the norm defined by the B matrix. Level: beginner .seealso: EPSGetEigenvalue(), EPSGetEigenvector(), EPSGetEigenvectorLeft(), EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(), EPSGetInvariantSubspace() @*/ PetscErrorCode EPSGetEigenpair(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); if (!eps->eigr || !eps->eigi || !eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (i<0 || i>=eps->nconv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); ierr = EPSGetEigenvalue(eps,i,eigr,eigi);CHKERRQ(ierr); if (Vr || Vi) { ierr = EPSGetEigenvector(eps,i,Vr,Vi);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetEigenvalue" /*@ EPSGetEigenvalue - Gets the i-th eigenvalue as computed by EPSSolve(). Not Collective Input Parameters: + eps - eigensolver context - i - index of the solution Output Parameters: + eigr - real part of eigenvalue - eigi - imaginary part of eigenvalue Notes: If the eigenvalue is real, then eigi is set to zero. If PETSc is configured with complex scalars the eigenvalue is stored directly in eigr (eigi is set to zero). The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs(). Level: beginner .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(), EPSGetEigenpair() @*/ PetscErrorCode EPSGetEigenvalue(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi) { PetscInt k; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!eps->eigr || !eps->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (i<0 || i>=eps->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (!eps->perm) k = i; else k = eps->perm[i]; #if defined(PETSC_USE_COMPLEX) if (eigr) *eigr = eps->eigr[k]; if (eigi) *eigi = 0; #else if (eigr) *eigr = eps->eigr[k]; if (eigi) *eigi = eps->eigi[k]; #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetEigenvector" /*@ EPSGetEigenvector - Gets the i-th right eigenvector as computed by EPSSolve(). Logically Collective on EPS Input Parameters: + eps - eigensolver context - i - index of the solution Output Parameters: + Vr - real part of eigenvector - Vi - imaginary part of eigenvector Notes: If the corresponding eigenvalue is real, then Vi is set to zero. If PETSc is configured with complex scalars the eigenvector is stored directly in Vr (Vi is set to zero). The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs(). The 2-norm of the eigenvector is one unless the problem is generalized Hermitian. In this case the eigenvector is normalized with respect to the norm defined by the B matrix. Level: beginner .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(), EPSGetEigenpair(), EPSGetEigenvectorLeft() @*/ PetscErrorCode EPSGetEigenvector(EPS eps,PetscInt i,Vec Vr,Vec Vi) { PetscErrorCode ierr; PetscInt k; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidHeaderSpecific(Vr,VEC_CLASSID,3); PetscCheckSameComm(eps,1,Vr,3); if (Vi) { PetscValidHeaderSpecific(Vi,VEC_CLASSID,4); PetscCheckSameComm(eps,1,Vi,4); } if (!eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (i<0 || i>=eps->nconv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (!eps->evecsavailable) { ierr = (*eps->ops->computevectors)(eps);CHKERRQ(ierr); } if (!eps->perm) k = i; else k = eps->perm[i]; #if defined(PETSC_USE_COMPLEX) ierr = VecCopy(eps->V[k],Vr);CHKERRQ(ierr); if (Vi) { ierr = VecSet(Vi,0.0);CHKERRQ(ierr); } #else if (eps->eigi[k] > 0) { /* first value of conjugate pair */ ierr = VecCopy(eps->V[k],Vr);CHKERRQ(ierr); if (Vi) { ierr = VecCopy(eps->V[k+1],Vi);CHKERRQ(ierr); } } else if (eps->eigi[k] < 0) { /* second value of conjugate pair */ ierr = VecCopy(eps->V[k-1],Vr);CHKERRQ(ierr); if (Vi) { ierr = VecCopy(eps->V[k],Vi);CHKERRQ(ierr); ierr = VecScale(Vi,-1.0);CHKERRQ(ierr); } } else { /* real eigenvalue */ ierr = VecCopy(eps->V[k],Vr);CHKERRQ(ierr); if (Vi) { ierr = VecSet(Vi,0.0);CHKERRQ(ierr); } } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetEigenvectorLeft" /*@ EPSGetEigenvectorLeft - Gets the i-th left eigenvector as computed by EPSSolve() (only available in two-sided eigensolvers). Logically Collective on EPS Input Parameters: + eps - eigensolver context - i - index of the solution Output Parameters: + Wr - real part of eigenvector - Wi - imaginary part of eigenvector Notes: If the corresponding eigenvalue is real, then Wi is set to zero. If PETSc is configured with complex scalars the eigenvector is stored directly in Wr (Wi is set to zero). The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs(). Level: beginner .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(), EPSGetEigenpair(), EPSGetEigenvector() @*/ PetscErrorCode EPSGetEigenvectorLeft(EPS eps,PetscInt i,Vec Wr,Vec Wi) { PetscErrorCode ierr; PetscInt k; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidHeaderSpecific(Wr,VEC_CLASSID,3); PetscCheckSameComm(eps,1,Wr,3); if (Wi) { PetscValidHeaderSpecific(Wi,VEC_CLASSID,4); PetscCheckSameComm(eps,1,Wi,4); } if (!eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted"); if (!eps->W) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (i<0 || i>=eps->nconv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (!eps->evecsavailable) { ierr = (*eps->ops->computevectors)(eps);CHKERRQ(ierr); } if (!eps->perm) k = i; else k = eps->perm[i]; #if defined(PETSC_USE_COMPLEX) ierr = VecCopy(eps->W[k],Wr);CHKERRQ(ierr); if (Wi) { ierr = VecSet(Wi,0.0);CHKERRQ(ierr); } #else if (eps->eigi[k] > 0) { /* first value of conjugate pair */ ierr = VecCopy(eps->W[k],Wr);CHKERRQ(ierr); if (Wi) { ierr = VecCopy(eps->W[k+1],Wi);CHKERRQ(ierr); } } else if (eps->eigi[k] < 0) { /* second value of conjugate pair */ ierr = VecCopy(eps->W[k-1],Wr);CHKERRQ(ierr); if (Wi) { ierr = VecCopy(eps->W[k],Wi);CHKERRQ(ierr); ierr = VecScale(Wi,-1.0);CHKERRQ(ierr); } } else { /* real eigenvalue */ ierr = VecCopy(eps->W[k],Wr);CHKERRQ(ierr); if (Wi) { ierr = VecSet(Wi,0.0);CHKERRQ(ierr); } } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetErrorEstimate" /*@ EPSGetErrorEstimate - Returns the error estimate associated to the i-th computed eigenpair. Not Collective Input Parameter: + eps - eigensolver context - i - index of eigenpair Output Parameter: . errest - the error estimate Notes: This is the error estimate used internally by the eigensolver. The actual error bound can be computed with EPSComputeRelativeError(). See also the users manual for details. Level: advanced .seealso: EPSComputeRelativeError() @*/ PetscErrorCode EPSGetErrorEstimate(EPS eps,PetscInt i,PetscReal *errest) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(errest,3); if (!eps->eigr || !eps->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (i<0 || i>=eps->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (eps->perm) i = eps->perm[i]; if (errest) *errest = eps->errest[i]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetErrorEstimateLeft" /*@ EPSGetErrorEstimateLeft - Returns the left error estimate associated to the i-th computed eigenpair (only available in two-sided eigensolvers). Not Collective Input Parameter: + eps - eigensolver context - i - index of eigenpair Output Parameter: . errest - the left error estimate Notes: This is the error estimate used internally by the eigensolver. The actual error bound can be computed with EPSComputeRelativeErrorLeft(). See also the users manual for details. Level: advanced .seealso: EPSComputeRelativeErrorLeft() @*/ PetscErrorCode EPSGetErrorEstimateLeft(EPS eps,PetscInt i,PetscReal *errest) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(errest,3); if (!eps->eigr || !eps->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); if (!eps->leftvecs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted"); if (i<0 || i>=eps->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (eps->perm) i = eps->perm[i]; if (errest) *errest = eps->errest_left[i]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeResidualNorm_Private" /* EPSComputeResidualNorm_Private - Computes the norm of the residual vector associated with an eigenpair. */ PetscErrorCode EPSComputeResidualNorm_Private(EPS eps,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *norm) { PetscErrorCode ierr; PetscInt nmat; Vec u,w; Mat A,B; #if !defined(PETSC_USE_COMPLEX) Vec v; PetscReal ni,nr; #endif PetscFunctionBegin; ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } ierr = VecDuplicate(eps->V[0],&u);CHKERRQ(ierr); ierr = VecDuplicate(eps->V[0],&w);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) { #endif ierr = MatMult(A,xr,u);CHKERRQ(ierr); /* u=A*x */ if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) { if (eps->isgeneralized) { ierr = MatMult(B,xr,w);CHKERRQ(ierr); } else { ierr = VecCopy(xr,w);CHKERRQ(ierr); } /* w=B*x */ ierr = VecAXPY(u,-kr,w);CHKERRQ(ierr); /* u=A*x-k*B*x */ } ierr = VecNorm(u,NORM_2,norm);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) } else { ierr = VecDuplicate(eps->V[0],&v);CHKERRQ(ierr); ierr = MatMult(A,xr,u);CHKERRQ(ierr); /* u=A*xr */ if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) { if (eps->isgeneralized) { ierr = MatMult(B,xr,v);CHKERRQ(ierr); } else { ierr = VecCopy(xr,v);CHKERRQ(ierr); } /* v=B*xr */ ierr = VecAXPY(u,-kr,v);CHKERRQ(ierr); /* u=A*xr-kr*B*xr */ if (eps->isgeneralized) { ierr = MatMult(B,xi,w);CHKERRQ(ierr); } else { ierr = VecCopy(xi,w);CHKERRQ(ierr); } /* w=B*xi */ ierr = VecAXPY(u,ki,w);CHKERRQ(ierr); /* u=A*xr-kr*B*xr+ki*B*xi */ } ierr = VecNorm(u,NORM_2,&nr);CHKERRQ(ierr); ierr = MatMult(A,xi,u);CHKERRQ(ierr); /* u=A*xi */ if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) { ierr = VecAXPY(u,-kr,w);CHKERRQ(ierr); /* u=A*xi-kr*B*xi */ ierr = VecAXPY(u,-ki,v);CHKERRQ(ierr); /* u=A*xi-kr*B*xi-ki*B*xr */ } ierr = VecNorm(u,NORM_2,&ni);CHKERRQ(ierr); *norm = SlepcAbsEigenvalue(nr,ni); ierr = VecDestroy(&v);CHKERRQ(ierr); } #endif ierr = VecDestroy(&w);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeResidualNorm" /*@ EPSComputeResidualNorm - Computes the norm of the residual vector associated with the i-th computed eigenpair. Collective on EPS Input Parameter: + eps - the eigensolver context - i - the solution index Output Parameter: . norm - the residual norm, computed as ||Ax-kBx||_2 where k is the eigenvalue and x is the eigenvector. If k=0 then the residual norm is computed as ||Ax||_2. Notes: The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs(). Level: beginner .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs() @*/ PetscErrorCode EPSComputeResidualNorm(EPS eps,PetscInt i,PetscReal *norm) { PetscErrorCode ierr; Vec xr,xi; PetscScalar kr,ki; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidPointer(norm,3); ierr = VecDuplicate(eps->V[0],&xr);CHKERRQ(ierr); ierr = VecDuplicate(eps->V[0],&xi);CHKERRQ(ierr); ierr = EPSGetEigenpair(eps,i,&kr,&ki,xr,xi);CHKERRQ(ierr); ierr = EPSComputeResidualNorm_Private(eps,kr,ki,xr,xi,norm);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeResidualNormLeft" /*@ EPSComputeResidualNormLeft - Computes the norm of the residual vector associated with the i-th computed left eigenvector (only available in two-sided eigensolvers). Collective on EPS Input Parameter: + eps - the eigensolver context - i - the solution index Output Parameter: . norm - the residual norm, computed as ||y'A-ky'B||_2 where k is the eigenvalue and y is the left eigenvector. If k=0 then the residual norm is computed as ||y'A||_2. Notes: The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs(). Level: beginner .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs() @*/ PetscErrorCode EPSComputeResidualNormLeft(EPS eps,PetscInt i,PetscReal *norm) { PetscErrorCode ierr; Vec u,v,w,xr,xi; Mat A,B; PetscInt nmat; PetscScalar kr,ki; #if !defined(PETSC_USE_COMPLEX) PetscReal ni,nr; #endif PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidPointer(norm,3); if (!eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted"); ierr = STGetNumMatrices(eps->st,&nmat);CHKERRQ(ierr); ierr = STGetOperators(eps->st,0,&A);CHKERRQ(ierr); if (nmat>1) { ierr = STGetOperators(eps->st,1,&B);CHKERRQ(ierr); } ierr = VecDuplicate(eps->W[0],&u);CHKERRQ(ierr); ierr = VecDuplicate(eps->W[0],&v);CHKERRQ(ierr); ierr = VecDuplicate(eps->W[0],&w);CHKERRQ(ierr); ierr = VecDuplicate(eps->W[0],&xr);CHKERRQ(ierr); ierr = VecDuplicate(eps->W[0],&xi);CHKERRQ(ierr); ierr = EPSGetEigenvalue(eps,i,&kr,&ki);CHKERRQ(ierr); ierr = EPSGetEigenvectorLeft(eps,i,xr,xi);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) { #endif ierr = MatMultTranspose(A,xr,u);CHKERRQ(ierr); /* u=A'*x */ if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) { if (eps->isgeneralized) { ierr = MatMultTranspose(B,xr,w);CHKERRQ(ierr); } else { ierr = VecCopy(xr,w);CHKERRQ(ierr); } /* w=B'*x */ ierr = VecAXPY(u,-kr,w);CHKERRQ(ierr); /* u=A'*x-k*B'*x */ } ierr = VecNorm(u,NORM_2,norm);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) } else { ierr = MatMultTranspose(A,xr,u);CHKERRQ(ierr); /* u=A'*xr */ if (eps->isgeneralized) { ierr = MatMultTranspose(B,xr,v);CHKERRQ(ierr); } else { ierr = VecCopy(xr,v);CHKERRQ(ierr); } /* v=B'*xr */ ierr = VecAXPY(u,-kr,v);CHKERRQ(ierr); /* u=A'*xr-kr*B'*xr */ if (eps->isgeneralized) { ierr = MatMultTranspose(B,xi,w);CHKERRQ(ierr); } else { ierr = VecCopy(xi,w);CHKERRQ(ierr); } /* w=B'*xi */ ierr = VecAXPY(u,ki,w);CHKERRQ(ierr); /* u=A'*xr-kr*B'*xr+ki*B'*xi */ ierr = VecNorm(u,NORM_2,&nr);CHKERRQ(ierr); ierr = MatMultTranspose(A,xi,u);CHKERRQ(ierr); /* u=A'*xi */ ierr = VecAXPY(u,-kr,w);CHKERRQ(ierr); /* u=A'*xi-kr*B'*xi */ ierr = VecAXPY(u,-ki,v);CHKERRQ(ierr); /* u=A'*xi-kr*B'*xi-ki*B'*xr */ ierr = VecNorm(u,NORM_2,&ni);CHKERRQ(ierr); *norm = SlepcAbsEigenvalue(nr,ni); } #endif ierr = VecDestroy(&w);CHKERRQ(ierr); ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeRelativeError_Private" /* EPSComputeRelativeError_Private - Computes the relative error bound associated with an eigenpair. */ PetscErrorCode EPSComputeRelativeError_Private(EPS eps,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *error) { PetscErrorCode ierr; PetscReal norm,er; #if !defined(PETSC_USE_COMPLEX) PetscReal ei; #endif PetscFunctionBegin; ierr = EPSComputeResidualNorm_Private(eps,kr,ki,xr,xi,&norm);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (ki == 0) { #endif ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) } else { ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr); ierr = VecNorm(xi,NORM_2,&ei);CHKERRQ(ierr); er = SlepcAbsEigenvalue(er,ei); } #endif ierr = (*eps->converged)(eps,kr,ki,norm/er,error,eps->convergedctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeRelativeError" /*@ EPSComputeRelativeError - Computes the relative error bound associated with the i-th computed eigenpair. Collective on EPS Input Parameter: + eps - the eigensolver context - i - the solution index Output Parameter: . error - the relative error bound, computed as ||Ax-kBx||_2/||kx||_2 where k is the eigenvalue and x is the eigenvector. If k=0 the relative error is computed as ||Ax||_2/||x||_2. Level: beginner .seealso: EPSSolve(), EPSComputeResidualNorm(), EPSGetErrorEstimate() @*/ PetscErrorCode EPSComputeRelativeError(EPS eps,PetscInt i,PetscReal *error) { PetscErrorCode ierr; Vec xr,xi; PetscScalar kr,ki; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidPointer(error,3); ierr = VecDuplicate(eps->V[0],&xr);CHKERRQ(ierr); ierr = VecDuplicate(eps->V[0],&xi);CHKERRQ(ierr); ierr = EPSGetEigenpair(eps,i,&kr,&ki,xr,xi);CHKERRQ(ierr); ierr = EPSComputeRelativeError_Private(eps,kr,ki,xr,xi,error);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeRelativeErrorLeft" /*@ EPSComputeRelativeErrorLeft - Computes the relative error bound associated with the i-th computed eigenvalue and left eigenvector (only available in two-sided eigensolvers). Collective on EPS Input Parameter: + eps - the eigensolver context - i - the solution index Output Parameter: . error - the relative error bound, computed as ||y'A-ky'B||_2/||ky||_2 where k is the eigenvalue and y is the left eigenvector. If k=0 the relative error is computed as ||y'A||_2/||y||_2. Level: beginner .seealso: EPSSolve(), EPSComputeResidualNormLeft(), EPSGetErrorEstimateLeft() @*/ PetscErrorCode EPSComputeRelativeErrorLeft(EPS eps,PetscInt i,PetscReal *error) { PetscErrorCode ierr; Vec xr,xi; PetscScalar kr,ki; PetscReal norm,er; #if !defined(PETSC_USE_COMPLEX) Vec u; PetscReal ei; #endif PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); ierr = EPSComputeResidualNormLeft(eps,i,&norm);CHKERRQ(ierr); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidPointer(error,3); ierr = VecDuplicate(eps->W[0],&xr);CHKERRQ(ierr); ierr = VecDuplicate(eps->W[0],&xi);CHKERRQ(ierr); ierr = EPSGetEigenvalue(eps,i,&kr,&ki);CHKERRQ(ierr); ierr = EPSGetEigenvectorLeft(eps,i,xr,xi);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) { #endif ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr); if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) *error = norm/(PetscAbsScalar(kr)*er); else *error = norm / er; #if !defined(PETSC_USE_COMPLEX) } else { ierr = VecDuplicate(xi,&u);CHKERRQ(ierr); ierr = VecCopy(xi,u);CHKERRQ(ierr); ierr = VecAXPBY(u,kr,-ki,xr);CHKERRQ(ierr); ierr = VecNorm(u,NORM_2,&er);CHKERRQ(ierr); ierr = VecAXPBY(xi,kr,ki,xr);CHKERRQ(ierr); ierr = VecNorm(xi,NORM_2,&ei);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); *error = norm / SlepcAbsEigenvalue(er,ei); } #endif ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSortEigenvalues" /*@ EPSSortEigenvalues - Sorts a list of eigenvalues according to the criterion specified via EPSSetWhichEigenpairs(). Not Collective Input Parameters: + eps - the eigensolver context . n - number of eigenvalues in the list . eigr - pointer to the array containing the eigenvalues - eigi - imaginary part of the eigenvalues (only when using real numbers) Output Parameter: . perm - resulting permutation Note: The result is a list of indices in the original eigenvalue array corresponding to the first nev eigenvalues sorted in the specified criterion. Level: developer .seealso: EPSSetWhichEigenpairs() @*/ PetscErrorCode EPSSortEigenvalues(EPS eps,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm) { PetscErrorCode ierr; PetscScalar re,im; PetscInt i,j,result,tmp; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidScalarPointer(eigr,3); PetscValidScalarPointer(eigi,4); PetscValidIntPointer(perm,5); for (i=0; i=0; i--) { re = eigr[perm[i]]; im = eigi[perm[i]]; j = i + 1; #if !defined(PETSC_USE_COMPLEX) if (im != 0) { /* complex eigenvalue */ i--; im = eigi[perm[i]]; } #endif while (jcomparison) SETERRQ(PETSC_COMM_SELF,1,"Undefined eigenvalue comparison function"); ierr = (*eps->comparison)(ar,ai,br,bi,result,eps->comparisonctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetStartVector" /*@ EPSGetStartVector - Gets a suitable vector to be used as the starting vector for the recurrence that builds the right subspace. Collective on EPS and Vec Input Parameters: + eps - the eigensolver context - i - iteration number Output Parameters: + vec - the start vector - breakdown - flag indicating that a breakdown has occurred Notes: The start vector is computed from another vector: for the first step (i=0), the first initial vector is used (see EPSSetInitialSpace()); otherwise a random vector is created. Then this vector is forced to be in the range of OP (only for generalized definite problems) and orthonormalized with respect to all V-vectors up to i-1. The flag breakdown is set to true if either i=0 and the vector belongs to the deflation space, or i>0 and the vector is linearly dependent with respect to the V-vectors. The caller must pass a vector already allocated with dimensions conforming to the initial vector. This vector is overwritten. Level: developer .seealso: EPSSetInitialSpace() @*/ PetscErrorCode EPSGetStartVector(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown) { PetscErrorCode ierr; PetscReal norm; PetscBool lindep; Vec w; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidHeaderSpecific(vec,VEC_CLASSID,3); PetscCheckSameComm(eps,1,vec,3); ierr = VecDuplicate(eps->V[0],&w);CHKERRQ(ierr); /* For the first step, use the first initial vector, otherwise a random one */ if (i==0 && eps->nini>0) { ierr = VecCopy(eps->V[0],w);CHKERRQ(ierr); } else { ierr = SlepcVecSetRandom(w,eps->rand);CHKERRQ(ierr); } /* Force the vector to be in the range of OP for definite generalized problems */ if (eps->ispositive || (eps->isgeneralized && eps->ishermitian)) { ierr = STApply(eps->st,w,vec);CHKERRQ(ierr); } else { ierr = VecCopy(w,vec);CHKERRQ(ierr); } /* Orthonormalize the vector with respect to previous vectors */ ierr = IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,vec,NULL,&norm,&lindep);CHKERRQ(ierr); if (breakdown) *breakdown = lindep; else if (lindep || norm == 0.0) { if (i==0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Initial vector is zero or belongs to the deflation space"); else SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unable to generate more start vectors"); } ierr = VecScale(vec,1.0/norm);CHKERRQ(ierr); ierr = VecDestroy(&w);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetStartVectorLeft" /*@ EPSGetStartVectorLeft - Gets a suitable vector to be used as the starting vector in the recurrence that builds the left subspace (in methods that work with two subspaces). Collective on EPS and Vec Input Parameters: + eps - the eigensolver context - i - iteration number Output Parameter: + vec - the start vector - breakdown - flag indicating that a breakdown has occurred Notes: The start vector is computed from another vector: for the first step (i=0), the first left initial vector is used (see EPSSetInitialSpaceLeft()); otherwise a random vector is created. Then this vector is forced to be in the range of OP' and orthonormalized with respect to all W-vectors up to i-1. The flag breakdown is set to true if i>0 and the vector is linearly dependent with respect to the W-vectors. The caller must pass a vector already allocated with dimensions conforming to the left initial vector. This vector is overwritten. Level: developer .seealso: EPSSetInitialSpaceLeft() @*/ PetscErrorCode EPSGetStartVectorLeft(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown) { PetscErrorCode ierr; PetscReal norm; PetscBool lindep; Vec w; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveInt(eps,i,2); PetscValidHeaderSpecific(vec,VEC_CLASSID,3); PetscCheckSameComm(eps,1,vec,3); ierr = VecDuplicate(eps->W[0],&w);CHKERRQ(ierr); /* For the first step, use the first initial left vector, otherwise a random one */ if (i==0 && eps->ninil>0) { ierr = VecCopy(eps->W[0],w);CHKERRQ(ierr); } else { ierr = SlepcVecSetRandom(w,eps->rand);CHKERRQ(ierr); } /* Force the vector to be in the range of OP' */ ierr = STApplyTranspose(eps->st,w,vec);CHKERRQ(ierr); /* Orthonormalize the vector with respect to previous vectors */ ierr = IPOrthogonalize(eps->ip,0,NULL,i,NULL,eps->W,vec,NULL,&norm,&lindep);CHKERRQ(ierr); if (breakdown) *breakdown = lindep; else if (lindep || norm == 0.0) { if (i==0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Left initial vector is zero"); else SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unable to generate more left start vectors"); } ierr = VecScale(vec,1/norm);CHKERRQ(ierr); ierr = VecDestroy(&w);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/basic.c0000644000175000017500000010526412211062077020206 0ustar gladkgladk/* The basic EPS routines, Create, View, etc. are here. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ PetscFunctionList EPSList = 0; PetscBool EPSRegisterAllCalled = PETSC_FALSE; PetscClassId EPS_CLASSID = 0; PetscLogEvent EPS_SetUp = 0,EPS_Solve = 0; static PetscBool EPSPackageInitialized = PETSC_FALSE; const char *EPSPowerShiftTypes[] = {"CONSTANT","RAYLEIGH","WILKINSON","EPSPowerShiftType","EPS_POWER_SHIFT_",0}; const char *EPSLanczosReorthogTypes[] = {"LOCAL","FULL","SELECTIVE","PERIODIC","PARTIAL","DELAYED","EPSLanczosReorthogType","EPS_LANCZOS_REORTHOG_",0}; const char *EPSPRIMMEMethods[] = {"DYNAMIC","DEFAULT_MIN_TIME","DEFAULT_MIN_MATVECS","ARNOLDI","GD","GD_PLUSK","GD_OLSEN_PLUSK","JD_OLSEN_PLUSK","RQI","JDQR","JDQMR","JDQMR_ETOL","SUBSPACE_ITERATION","LOBPCG_ORTHOBASIS","LOBPCG_ORTHOBASISW","EPSPRIMMEMethod","EPS_PRIMME_",0}; #undef __FUNCT__ #define __FUNCT__ "EPSFinalizePackage" /*@C EPSFinalizePackage - This function destroys everything in the SLEPc interface to the EPS package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode EPSFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&EPSList);CHKERRQ(ierr); EPSPackageInitialized = PETSC_FALSE; EPSRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSInitializePackage" /*@C EPSInitializePackage - This function initializes everything in the EPS package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to EPSCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode EPSInitializePackage() { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (EPSPackageInitialized) PetscFunctionReturn(0); EPSPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Eigenvalue Problem Solver",&EPS_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = EPSRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("EPSSetUp",EPS_CLASSID,&EPS_SetUp);CHKERRQ(ierr); ierr = PetscLogEventRegister("EPSSolve",EPS_CLASSID,&EPS_Solve);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"eps",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(EPS_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"eps",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(EPS_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(EPSFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSView" /*@C EPSView - Prints the EPS data structure. Collective on EPS Input Parameters: + eps - the eigenproblem solver context - viewer - optional visualization context Options Database Key: . -eps_view - Calls EPSView() at end of EPSSolve() Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: STView(), PetscViewerASCIIOpen() @*/ PetscErrorCode EPSView(EPS eps,PetscViewer viewer) { PetscErrorCode ierr; const char *type,*extr,*bal; char str[50]; PetscBool isascii,ispower,isexternal; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(eps,1,viewer,2); #if defined(PETSC_USE_COMPLEX) #define HERM "hermitian" #else #define HERM "symmetric" #endif ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)eps,viewer,"EPS Object");CHKERRQ(ierr); if (eps->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*eps->ops->view)(eps,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } if (eps->problem_type) { switch (eps->problem_type) { case EPS_HEP: type = HERM " eigenvalue problem"; break; case EPS_GHEP: type = "generalized " HERM " eigenvalue problem"; break; case EPS_NHEP: type = "non-" HERM " eigenvalue problem"; break; case EPS_GNHEP: type = "generalized non-" HERM " eigenvalue problem"; break; case EPS_PGNHEP: type = "generalized non-" HERM " eigenvalue problem with " HERM " positive definite B"; break; case EPS_GHIEP: type = "generalized " HERM "-indefinite eigenvalue problem"; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->problem_type"); } } else type = "not yet set"; ierr = PetscViewerASCIIPrintf(viewer," problem type: %s\n",type);CHKERRQ(ierr); if (eps->extraction) { switch (eps->extraction) { case EPS_RITZ: extr = "Rayleigh-Ritz"; break; case EPS_HARMONIC: extr = "harmonic Ritz"; break; case EPS_HARMONIC_RELATIVE:extr = "relative harmonic Ritz"; break; case EPS_HARMONIC_RIGHT: extr = "right harmonic Ritz"; break; case EPS_HARMONIC_LARGEST: extr = "largest harmonic Ritz"; break; case EPS_REFINED: extr = "refined Ritz"; break; case EPS_REFINED_HARMONIC: extr = "refined harmonic Ritz"; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->extraction"); } ierr = PetscViewerASCIIPrintf(viewer," extraction type: %s\n",extr);CHKERRQ(ierr); } if (eps->balance && !eps->ishermitian && eps->balance!=EPS_BALANCE_NONE) { switch (eps->balance) { case EPS_BALANCE_ONESIDE: bal = "one-sided Krylov"; break; case EPS_BALANCE_TWOSIDE: bal = "two-sided Krylov"; break; case EPS_BALANCE_USER: bal = "user-defined matrix"; break; default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->balance"); } ierr = PetscViewerASCIIPrintf(viewer," balancing enabled: %s",bal);CHKERRQ(ierr); if (eps->balance==EPS_BALANCE_ONESIDE || eps->balance==EPS_BALANCE_TWOSIDE) { ierr = PetscViewerASCIIPrintf(viewer,", with its=%D",eps->balance_its);CHKERRQ(ierr); } if (eps->balance==EPS_BALANCE_TWOSIDE && eps->balance_cutoff!=0.0) { ierr = PetscViewerASCIIPrintf(viewer," and cutoff=%G",eps->balance_cutoff);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: ");CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,eps->target,PETSC_FALSE);CHKERRQ(ierr); if (!eps->which) { ierr = PetscViewerASCIIPrintf(viewer,"not yet set\n");CHKERRQ(ierr); } else switch (eps->which) { case EPS_WHICH_USER: ierr = PetscViewerASCIIPrintf(viewer,"user defined\n");CHKERRQ(ierr); break; case EPS_TARGET_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (in magnitude)\n",str);CHKERRQ(ierr); break; case EPS_TARGET_REAL: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the real axis)\n",str);CHKERRQ(ierr); break; case EPS_TARGET_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the imaginary axis)\n",str);CHKERRQ(ierr); break; case EPS_LARGEST_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");CHKERRQ(ierr); break; case EPS_SMALLEST_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");CHKERRQ(ierr); break; case EPS_LARGEST_REAL: ierr = PetscViewerASCIIPrintf(viewer,"largest real parts\n");CHKERRQ(ierr); break; case EPS_SMALLEST_REAL: ierr = PetscViewerASCIIPrintf(viewer,"smallest real parts\n");CHKERRQ(ierr); break; case EPS_LARGEST_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");CHKERRQ(ierr); break; case EPS_SMALLEST_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");CHKERRQ(ierr); break; case EPS_ALL: ierr = PetscViewerASCIIPrintf(viewer,"all eigenvalues in interval [%G,%G]\n",eps->inta,eps->intb);CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which"); } if (eps->leftvecs) { ierr = PetscViewerASCIIPrintf(viewer," computing left eigenvectors also\n");CHKERRQ(ierr); } if (eps->trueres) { ierr = PetscViewerASCIIPrintf(viewer," computing true residuals explicitly\n");CHKERRQ(ierr); } if (eps->trackall) { ierr = PetscViewerASCIIPrintf(viewer," computing all residuals (for tracking convergence)\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," number of eigenvalues (nev): %D\n",eps->nev);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %D\n",eps->ncv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum dimension of projected problem (mpd): %D\n",eps->mpd);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %D\n",eps->max_it);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," tolerance: %G\n",eps->tol);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," convergence test: ");CHKERRQ(ierr); switch (eps->conv) { case EPS_CONV_ABS: ierr = PetscViewerASCIIPrintf(viewer,"absolute\n");CHKERRQ(ierr);break; case EPS_CONV_EIG: ierr = PetscViewerASCIIPrintf(viewer,"relative to the eigenvalue\n");CHKERRQ(ierr);break; case EPS_CONV_NORM: ierr = PetscViewerASCIIPrintf(viewer,"relative to the eigenvalue and matrix norms\n");CHKERRQ(ierr);break; default: ierr = PetscViewerASCIIPrintf(viewer,"user-defined\n");CHKERRQ(ierr);break; } if (eps->nini) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial space: %D\n",PetscAbs(eps->nini));CHKERRQ(ierr); } if (eps->ninil) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial left space: %D\n",PetscAbs(eps->ninil));CHKERRQ(ierr); } if (eps->nds>0) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided deflation space: %D\n",eps->nds);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," estimates of matrix norms (%s): norm(A)=%G",eps->adaptive?"adaptive":"constant",eps->nrma);CHKERRQ(ierr); if (eps->isgeneralized) { ierr = PetscViewerASCIIPrintf(viewer,", norm(B)=%G",eps->nrmb);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } else { if (eps->ops->view) { ierr = (*eps->ops->view)(eps,viewer);CHKERRQ(ierr); } } ierr = PetscObjectTypeCompareAny((PetscObject)eps,&isexternal,EPSARPACK,EPSBLZPACK,EPSTRLAN,EPSBLOPEX,EPSPRIMME,"");CHKERRQ(ierr); if (!isexternal) { if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); } ierr = IPView(eps->ip,viewer);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)eps,EPSPOWER,&ispower);CHKERRQ(ierr); if (!ispower) { if (!eps->ds) { ierr = EPSGetDS(eps,&eps->ds);CHKERRQ(ierr); } ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr); ierr = DSView(eps->ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); } } if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } ierr = STView(eps->st,viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSPrintSolution" /*@ EPSPrintSolution - Prints the computed eigenvalues. Collective on EPS Input Parameters: + eps - the eigensolver context - viewer - optional visualization context Options Database Key: . -eps_terse - print only minimal information Note: By default, this function prints a table with eigenvalues and associated relative errors. With -eps_terse only the eigenvalues are printed. Level: intermediate .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode EPSPrintSolution(EPS eps,PetscViewer viewer) { PetscBool terse,errok,isascii; PetscReal error,re,im; PetscScalar kr,ki; PetscInt i,j; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(eps,1,viewer,2); if (!eps->eigr || !eps->eigi || !eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first"); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (!isascii) PetscFunctionReturn(0); ierr = PetscOptionsHasName(NULL,"-eps_terse",&terse);CHKERRQ(ierr); if (terse) { if (eps->nconvnev) { ierr = PetscViewerASCIIPrintf(viewer," Problem: less than %D eigenvalues converged\n\n",eps->nev);CHKERRQ(ierr); } else { errok = PETSC_TRUE; for (i=0;inev;i++) { ierr = EPSComputeRelativeError(eps,i,&error);CHKERRQ(ierr); errok = (errok && errortol)? PETSC_TRUE: PETSC_FALSE; } if (errok) { ierr = PetscViewerASCIIPrintf(viewer," All requested eigenvalues computed up to the required tolerance:");CHKERRQ(ierr); for (i=0;i<=(eps->nev-1)/8;i++) { ierr = PetscViewerASCIIPrintf(viewer,"\n ");CHKERRQ(ierr); for (j=0;jnev-8*i);j++) { ierr = EPSGetEigenpair(eps,8*i+j,&kr,&ki,NULL,NULL);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) re = PetscRealPart(kr); im = PetscImaginaryPart(kr); #else re = kr; im = ki; #endif if (PetscAbs(re)/PetscAbs(im)nev) { ierr = PetscViewerASCIIPrintf(viewer,", ");CHKERRQ(ierr); } } } ierr = PetscViewerASCIIPrintf(viewer,"\n\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Problem: some of the first %D relative errors are higher than the tolerance\n\n",eps->nev);CHKERRQ(ierr); } } } else { ierr = PetscViewerASCIIPrintf(viewer," Number of converged approximate eigenpairs: %D\n\n",eps->nconv);CHKERRQ(ierr); if (eps->nconv>0) { ierr = PetscViewerASCIIPrintf(viewer, " k ||Ax-k%sx||/||kx||\n" " ----------------- ------------------\n",eps->isgeneralized?"B":"");CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = EPSGetEigenpair(eps,i,&kr,&ki,NULL,NULL);CHKERRQ(ierr); ierr = EPSComputeRelativeError(eps,i,&error);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) re = PetscRealPart(kr); im = PetscImaginaryPart(kr); #else re = kr; im = ki; #endif if (im!=0.0) { ierr = PetscViewerASCIIPrintf(viewer," % 9F%+9F i %12G\n",re,im,error);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," % 12F %12G\n",re,error);CHKERRQ(ierr); } } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSCreate" /*@C EPSCreate - Creates the default EPS context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . eps - location to put the EPS context Note: The default EPS type is EPSKRYLOVSCHUR Level: beginner .seealso: EPSSetUp(), EPSSolve(), EPSDestroy(), EPS @*/ PetscErrorCode EPSCreate(MPI_Comm comm,EPS *outeps) { PetscErrorCode ierr; EPS eps; PetscFunctionBegin; PetscValidPointer(outeps,2); *outeps = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = EPSInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(eps,_p_EPS,struct _EPSOps,EPS_CLASSID,"EPS","Eigenvalue Problem Solver","EPS",comm,EPSDestroy,EPSView);CHKERRQ(ierr); eps->max_it = 0; eps->nev = 1; eps->ncv = 0; eps->mpd = 0; eps->allocated_ncv = 0; eps->nini = 0; eps->ninil = 0; eps->nds = 0; eps->tol = PETSC_DEFAULT; eps->conv = EPS_CONV_EIG; eps->converged = EPSConvergedEigRelative; eps->convergedctx = NULL; eps->which = (EPSWhich)0; eps->comparison = NULL; eps->comparisonctx = NULL; eps->arbitrary = NULL; eps->arbitraryctx = NULL; eps->leftvecs = PETSC_FALSE; eps->trueres = PETSC_FALSE; eps->trackall = PETSC_FALSE; eps->target = 0.0; eps->inta = 0.0; eps->intb = 0.0; eps->evecsavailable = PETSC_FALSE; eps->problem_type = (EPSProblemType)0; eps->extraction = (EPSExtraction)0; eps->balance = (EPSBalance)0; eps->balance_its = 5; eps->balance_cutoff = 1e-8; eps->nrma = 1.0; eps->nrmb = 1.0; eps->adaptive = PETSC_FALSE; eps->V = 0; eps->W = 0; eps->D = 0; eps->defl = 0; eps->IS = 0; eps->ISL = 0; eps->t = 0; eps->ds_ortho = PETSC_FALSE; eps->eigr = 0; eps->eigi = 0; eps->errest = 0; eps->errest_left = 0; eps->st = 0; eps->ip = 0; eps->ds = 0; eps->rand = 0; eps->data = 0; eps->nconv = 0; eps->its = 0; eps->perm = NULL; eps->nwork = 0; eps->work = 0; eps->isgeneralized = PETSC_FALSE; eps->ishermitian = PETSC_FALSE; eps->ispositive = PETSC_FALSE; eps->setupcalled = 0; eps->reason = EPS_CONVERGED_ITERATING; eps->numbermonitors = 0; ierr = PetscRandomCreate(comm,&eps->rand);CHKERRQ(ierr); ierr = PetscRandomSetSeed(eps->rand,0x12345678);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,eps->rand);CHKERRQ(ierr); *outeps = eps; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetType" /*@C EPSSetType - Selects the particular solver to be used in the EPS object. Logically Collective on EPS Input Parameters: + eps - the eigensolver context - type - a known method Options Database Key: . -eps_type - Sets the method; use -help for a list of available methods Notes: See "slepc/include/slepceps.h" for available methods. The default is EPSKRYLOVSCHUR. Normally, it is best to use the EPSSetFromOptions() command and then set the EPS type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The EPSSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database. Level: intermediate .seealso: STSetType(), EPSType @*/ PetscErrorCode EPSSetType(EPS eps,EPSType type) { PetscErrorCode ierr,(*r)(EPS); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)eps,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(EPSList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown EPS type given: %s",type); if (eps->ops->destroy) { ierr = (*eps->ops->destroy)(eps);CHKERRQ(ierr); } ierr = PetscMemzero(eps->ops,sizeof(struct _EPSOps));CHKERRQ(ierr); eps->setupcalled = 0; ierr = PetscObjectChangeTypeName((PetscObject)eps,type);CHKERRQ(ierr); ierr = (*r)(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetType" /*@C EPSGetType - Gets the EPS type as a string from the EPS object. Not Collective Input Parameter: . eps - the eigensolver context Output Parameter: . name - name of EPS method Level: intermediate .seealso: EPSSetType() @*/ PetscErrorCode EPSGetType(EPS eps,EPSType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)eps)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSRegister" /*@C EPSRegister - Adds a method to the eigenproblem solver package. Not Collective Input Parameters: + name - name of a new user-defined solver - function - routine to create the solver context Notes: EPSRegister() may be called multiple times to add several user-defined solvers. Sample usage: .vb EPSRegister("my_solver",MySolverCreate); .ve Then, your solver can be chosen with the procedural interface via $ EPSSetType(eps,"my_solver") or at runtime via the option $ -eps_type my_solver Level: advanced .seealso: EPSRegisterAll() @*/ PetscErrorCode EPSRegister(const char *name,PetscErrorCode (*function)(EPS)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&EPSList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSReset" /*@ EPSReset - Resets the EPS context to the setupcalled=0 state and removes any allocated objects. Collective on EPS Input Parameter: . eps - eigensolver context obtained from EPSCreate() Level: advanced .seealso: EPSDestroy() @*/ PetscErrorCode EPSReset(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); if (eps->ops->reset) { ierr = (eps->ops->reset)(eps);CHKERRQ(ierr); } if (eps->st) { ierr = STReset(eps->st);CHKERRQ(ierr); } if (eps->ip) { ierr = IPReset(eps->ip);CHKERRQ(ierr); } if (eps->ds) { ierr = DSReset(eps->ds);CHKERRQ(ierr); } ierr = VecDestroy(&eps->t);CHKERRQ(ierr); ierr = VecDestroy(&eps->D);CHKERRQ(ierr); eps->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSDestroy" /*@C EPSDestroy - Destroys the EPS context. Collective on EPS Input Parameter: . eps - eigensolver context obtained from EPSCreate() Level: beginner .seealso: EPSCreate(), EPSSetUp(), EPSSolve() @*/ PetscErrorCode EPSDestroy(EPS *eps) { PetscErrorCode ierr; PetscFunctionBegin; if (!*eps) PetscFunctionReturn(0); PetscValidHeaderSpecific(*eps,EPS_CLASSID,1); if (--((PetscObject)(*eps))->refct > 0) { *eps = 0; PetscFunctionReturn(0); } ierr = EPSReset(*eps);CHKERRQ(ierr); if ((*eps)->ops->destroy) { ierr = (*(*eps)->ops->destroy)(*eps);CHKERRQ(ierr); } ierr = STDestroy(&(*eps)->st);CHKERRQ(ierr); ierr = IPDestroy(&(*eps)->ip);CHKERRQ(ierr); ierr = DSDestroy(&(*eps)->ds);CHKERRQ(ierr); ierr = PetscRandomDestroy(&(*eps)->rand);CHKERRQ(ierr); /* just in case the initial vectors have not been used */ ierr = SlepcBasisDestroy_Private(&(*eps)->nini,&(*eps)->IS);CHKERRQ(ierr); ierr = SlepcBasisDestroy_Private(&(*eps)->ninil,&(*eps)->ISL);CHKERRQ(ierr); ierr = EPSRemoveDeflationSpace(*eps);CHKERRQ(ierr); ierr = EPSMonitorCancel(*eps);CHKERRQ(ierr); ierr = PetscHeaderDestroy(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetTarget" /*@ EPSSetTarget - Sets the value of the target. Logically Collective on EPS Input Parameters: + eps - eigensolver context - target - the value of the target Notes: The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with EPSSetWhichEigenpairs(). Level: beginner .seealso: EPSGetTarget(), EPSSetWhichEigenpairs() @*/ PetscErrorCode EPSSetTarget(EPS eps,PetscScalar target) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveScalar(eps,target,2); eps->target = target; if (!eps->st) { ierr = EPSGetST(eps,&eps->st);CHKERRQ(ierr); } ierr = STSetDefaultShift(eps->st,target);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetTarget" /*@ EPSGetTarget - Gets the value of the target. Not Collective Input Parameter: . eps - eigensolver context Output Parameter: . target - the value of the target Level: beginner Note: If the target was not set by the user, then zero is returned. .seealso: EPSSetTarget() @*/ PetscErrorCode EPSGetTarget(EPS eps,PetscScalar* target) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidScalarPointer(target,2); *target = eps->target; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetInterval" /*@ EPSSetInterval - Defines the computational interval for spectrum slicing. Logically Collective on EPS Input Parameters: + eps - eigensolver context . inta - left end of the interval - intb - right end of the interval Options Database Key: . -eps_interval - set [a,b] as the interval of interest Notes: Spectrum slicing is a technique employed for computing all eigenvalues of symmetric eigenproblems in a given interval. This function provides the interval to be considered. It must be used in combination with EPS_ALL, see EPSSetWhichEigenpairs(). In the command-line option, two values must be provided. For an open interval, one can give an infinite, e.g., -eps_interval 1.0,inf or -eps_interval -inf,1.0. An open interval in the programmatic interface can be specified with PETSC_MAX_REAL and -PETSC_MAX_REAL. Level: intermediate .seealso: EPSGetInterval(), EPSSetWhichEigenpairs() @*/ PetscErrorCode EPSSetInterval(EPS eps,PetscReal inta,PetscReal intb) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidLogicalCollectiveReal(eps,inta,2); PetscValidLogicalCollectiveReal(eps,intb,3); if (inta>=intb) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Badly defined interval, must be intainta = inta; eps->intb = intb; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetInterval" /*@ EPSGetInterval - Gets the computational interval for spectrum slicing. Not Collective Input Parameter: . eps - eigensolver context Output Parameters: + inta - left end of the interval - intb - right end of the interval Level: intermediate Note: If the interval was not set by the user, then zeros are returned. .seealso: EPSSetInterval() @*/ PetscErrorCode EPSGetInterval(EPS eps,PetscReal* inta,PetscReal* intb) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(inta,2); PetscValidPointer(intb,3); if (inta) *inta = eps->inta; if (intb) *intb = eps->intb; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetST" /*@ EPSSetST - Associates a spectral transformation object to the eigensolver. Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() - st - the spectral transformation object Note: Use EPSGetST() to retrieve the spectral transformation context (for example, to free it at the end of the computations). Level: developer .seealso: EPSGetST() @*/ PetscErrorCode EPSSetST(EPS eps,ST st) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidHeaderSpecific(st,ST_CLASSID,2); PetscCheckSameComm(eps,1,st,2); ierr = PetscObjectReference((PetscObject)st);CHKERRQ(ierr); ierr = STDestroy(&eps->st);CHKERRQ(ierr); eps->st = st; ierr = PetscLogObjectParent(eps,eps->st);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetST" /*@C EPSGetST - Obtain the spectral transformation (ST) object associated to the eigensolver object. Not Collective Input Parameters: . eps - eigensolver context obtained from EPSCreate() Output Parameter: . st - spectral transformation context Level: beginner .seealso: EPSSetST() @*/ PetscErrorCode EPSGetST(EPS eps,ST *st) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(st,2); if (!eps->st) { ierr = STCreate(PetscObjectComm((PetscObject)eps),&eps->st);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,eps->st);CHKERRQ(ierr); } *st = eps->st; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetIP" /*@ EPSSetIP - Associates an inner product object to the eigensolver. Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() - ip - the inner product object Note: Use EPSGetIP() to retrieve the inner product context (for example, to free it at the end of the computations). Level: advanced .seealso: EPSGetIP() @*/ PetscErrorCode EPSSetIP(EPS eps,IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidHeaderSpecific(ip,IP_CLASSID,2); PetscCheckSameComm(eps,1,ip,2); ierr = PetscObjectReference((PetscObject)ip);CHKERRQ(ierr); ierr = IPDestroy(&eps->ip);CHKERRQ(ierr); eps->ip = ip; ierr = PetscLogObjectParent(eps,eps->ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetIP" /*@C EPSGetIP - Obtain the inner product object associated to the eigensolver object. Not Collective Input Parameters: . eps - eigensolver context obtained from EPSCreate() Output Parameter: . ip - inner product context Level: advanced .seealso: EPSSetIP() @*/ PetscErrorCode EPSGetIP(EPS eps,IP *ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(ip,2); if (!eps->ip) { ierr = IPCreate(PetscObjectComm((PetscObject)eps),&eps->ip);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,eps->ip);CHKERRQ(ierr); } *ip = eps->ip; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetDS" /*@ EPSSetDS - Associates a direct solver object to the eigensolver. Collective on EPS Input Parameters: + eps - eigensolver context obtained from EPSCreate() - ds - the direct solver object Note: Use EPSGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations). Level: advanced .seealso: EPSGetDS() @*/ PetscErrorCode EPSSetDS(EPS eps,DS ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidHeaderSpecific(ds,DS_CLASSID,2); PetscCheckSameComm(eps,1,ds,2); ierr = PetscObjectReference((PetscObject)ds);CHKERRQ(ierr); ierr = DSDestroy(&eps->ds);CHKERRQ(ierr); eps->ds = ds; ierr = PetscLogObjectParent(eps,eps->ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSGetDS" /*@C EPSGetDS - Obtain the direct solver object associated to the eigensolver object. Not Collective Input Parameters: . eps - eigensolver context obtained from EPSCreate() Output Parameter: . ds - direct solver context Level: advanced .seealso: EPSSetDS() @*/ PetscErrorCode EPSGetDS(EPS eps,DS *ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(ds,2); if (!eps->ds) { ierr = DSCreate(PetscObjectComm((PetscObject)eps),&eps->ds);CHKERRQ(ierr); ierr = PetscLogObjectParent(eps,eps->ds);CHKERRQ(ierr); } *ds = eps->ds; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSIsGeneralized" /*@ EPSIsGeneralized - Ask if the EPS object corresponds to a generalized eigenvalue problem. Not collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . is - the answer Level: intermediate .seealso: EPSIsHermitian(), EPSIsPositive() @*/ PetscErrorCode EPSIsGeneralized(EPS eps,PetscBool* is) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(is,2); *is = eps->isgeneralized; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSIsHermitian" /*@ EPSIsHermitian - Ask if the EPS object corresponds to a Hermitian eigenvalue problem. Not collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . is - the answer Level: intermediate .seealso: EPSIsGeneralized(), EPSIsPositive() @*/ PetscErrorCode EPSIsHermitian(EPS eps,PetscBool* is) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(is,2); *is = eps->ishermitian; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSIsPositive" /*@ EPSIsPositive - Ask if the EPS object corresponds to an eigenvalue problem type that requires a positive (semi-) definite matrix B. Not collective Input Parameter: . eps - the eigenproblem solver context Output Parameter: . is - the answer Level: intermediate .seealso: EPSIsGeneralized(), EPSIsHermitian() @*/ PetscErrorCode EPSIsPositive(EPS eps,PetscBool* is) { PetscFunctionBegin; PetscValidHeaderSpecific(eps,EPS_CLASSID,1); PetscValidPointer(is,2); *is = eps->ispositive; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-custom/0000755000175000017500000000000012214143515021050 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/interface/ftn-custom/zepsf.c0000644000175000017500000003616512211062077022356 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define epsdestroy_ EPSDESTROY #define epsview_ EPSVIEW #define epssetoptionsprefix_ EPSSETOPTIONSPREFIX #define epsappendoptionsprefix_ EPSAPPENDOPTIONSPREFIX #define epsgetoptionsprefix_ EPSGETOPTIONSPREFIX #define epscreate_ EPSCREATE #define epssettype_ EPSSETTYPE #define epsgettype_ EPSGETTYPE #define epsgetoperators_ EPSGETOPERATORS #define epsmonitorall_ EPSMONITORALL #define epsmonitorlg_ EPSMONITORLG #define epsmonitorlgall_ EPSMONITORLGALL #define epsmonitorset_ EPSMONITORSET #define epsmonitorconverged_ EPSMONITORCONVERGED #define epsmonitorfirst_ EPSMONITORFIRST #define epsgetst_ EPSGETST #define epsgetip_ EPSGETIP #define epsgetds_ EPSGETDS #define epsgetwhicheigenpairs_ EPSGETWHICHEIGENPAIRS #define epsgetproblemtype_ EPSGETPROBLEMTYPE #define epsgetextraction_ EPSGETEXTRACTION #define epsgetconvergedreason_ EPSGETCONVERGEDREASON #define epspowergetshifttype_ EPSPOWERGETSHIFTTYPE #define epslanczosgetreorthog_ EPSLANCZOSGETREORTHOG #define epsconvergedabsolute_ EPSCONVERGEDABSOLUTE #define epsconvergedeigrelative_ EPSCONVERGEDEIGRELATIVE #define epsconvergednormrelative_ EPSCONVERGEDNORMRELATIVE #define epssetconvergencetestfunction_ EPSSETCONVERGENCETESTFUNCTION #define epsseteigenvaluecomparison_ EPSSETEIGENVALUECOMPARISON #define epssetarbitraryselection_ EPSSETARBITRARYSELECTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define epsdestroy_ epsdestroy #define epsview_ epsview #define epssetoptionsprefix_ epssetoptionsprefix #define epsappendoptionsprefix_ epsappendoptionsprefix #define epsgetoptionsprefix_ epsgetoptionsprefix #define epscreate_ epscreate #define epssettype_ epssettype #define epsgettype_ epsgettype #define epsgetoperators_ epsgetoperators #define epsmonitorall_ epsmonitorall #define epsmonitorlg_ epsmonitorlg #define epsmonitorlgall_ epsmonitorlgall #define epsmonitorset_ epsmonitorset #define epsmonitorconverged_ epsmonitorconverged #define epsmonitorfirst_ epsmonitorfirst #define epsgetst_ epsgetst #define epsgetip_ epsgetip #define epsgetds_ epsgetds #define epsgetwhicheigenpairs_ epsgetwhicheigenpairs #define epsgetproblemtype_ epsgetproblemtype #define epsgetextraction_ epsgetextraction #define epsgetconvergedreason_ epsgetconvergedreason #define epspowergetshifttype_ epspowergetshifttype #define epslanczosgetreorthog_ epslanczosgetreorthog #define epsconvergedabsolute_ epsconvergedabsolute #define epsconvergedeigrelative_ epsconvergedeigrelative #define epsconvergednormrelative_ epsconvergednormrelative #define epssetconvergencetestfunction_ epssetconvergencetestfunction #define epsseteigenvaluecomparison_ epsseteigenvaluecomparison #define epssetarbitraryselection_ epssetarbitraryselection #endif /* These are not usually called from Fortran but allow Fortran users to transparently set these monitors from .F code, hence no STDCALL */ PETSC_EXTERN void epsmonitorall_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSMonitorAll(*eps,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void epsmonitorlg_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSMonitorLG(*eps,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void epsmonitorlgall_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSMonitorLGAll(*eps,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void epsmonitorconverged_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSMonitorConverged(*eps,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void epsmonitorfirst_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSMonitorFirst(*eps,*it,*nconv,eigr,eigi,errest,*nest,ctx); } static struct { PetscFortranCallbackId monitor; PetscFortranCallbackId monitordestroy; PetscFortranCallbackId convergence; PetscFortranCallbackId comparison; PetscFortranCallbackId arbitrary; } _cb; /* These are not extern C because they are passed into non-extern C user level functions */ #undef __FUNCT__ #define __FUNCT__ "ourmonitor" static PetscErrorCode ourmonitor(EPS eps,PetscInt i,PetscInt nc,PetscScalar *er,PetscScalar *ei,PetscReal *d,PetscInt l,void* ctx) { PetscObjectUseFortranCallback(eps,_cb.monitor,(EPS*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),(&eps,&i,&nc,er,ei,d,&l,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourdestroy" static PetscErrorCode ourdestroy(void** ctx) { EPS eps = (EPS)*ctx; PetscObjectUseFortranCallback(eps,_cb.monitordestroy,(void*,PetscErrorCode*),(_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourconvergence" static PetscErrorCode ourconvergence(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) { PetscObjectUseFortranCallback(eps,_cb.convergence,(EPS*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,void*,PetscErrorCode*),(&eps,&eigr,&eigi,&res,errest,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "oureigenvaluecomparison" static PetscErrorCode oureigenvaluecomparison(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx) { EPS eps = (EPS)ctx; PetscObjectUseFortranCallback(eps,_cb.comparison,(PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*,void*,PetscErrorCode*),(&ar,&ai,&br,&bi,r,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourarbitraryfunc" static PetscErrorCode ourarbitraryfunc(PetscScalar er,PetscScalar ei,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx) { EPS eps = (EPS)ctx; PetscObjectUseFortranCallback(eps,_cb.arbitrary,(PetscScalar*,PetscScalar*,Vec*,Vec*,PetscScalar*,PetscScalar*,void*,PetscErrorCode*),(&er,&ei,&xr,&xi,rr,ri,_ctx,&ierr)); return 0; } PETSC_EXTERN void PETSC_STDCALL epsdestroy_(EPS *eps,PetscErrorCode *ierr) { *ierr = EPSDestroy(eps); } PETSC_EXTERN void PETSC_STDCALL epsview_(EPS *eps,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = EPSView(*eps,v); } PETSC_EXTERN void PETSC_STDCALL epssettype_(EPS *eps,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(type,len,t); *ierr = EPSSetType(*eps,t); FREECHAR(type,t); } PETSC_EXTERN void PETSC_STDCALL epsgettype_(EPS *eps,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { EPSType tname; *ierr = EPSGetType(*eps,&tname);if (*ierr) return; *ierr = PetscStrncpy(name,tname,len); FIXRETURNCHAR(PETSC_TRUE,name,len); } PETSC_EXTERN void PETSC_STDCALL epsgetoperators_(EPS *eps,Mat *A,Mat *B,PetscErrorCode *ierr) { CHKFORTRANNULLOBJECT(A); CHKFORTRANNULLOBJECT(B); *ierr = EPSGetOperators(*eps,A,B); } PETSC_EXTERN void PETSC_STDCALL epssetoptionsprefix_(EPS *eps,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = EPSSetOptionsPrefix(*eps,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL epsappendoptionsprefix_(EPS *eps,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = EPSAppendOptionsPrefix(*eps,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL epscreate_(MPI_Fint *comm,EPS *eps,PetscErrorCode *ierr) { *ierr = EPSCreate(MPI_Comm_f2c(*(comm)),eps); } PETSC_EXTERN void PETSC_STDCALL epsmonitorset_(EPS *eps,void (PETSC_STDCALL *monitor)(EPS*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr) { SlepcConvMonitor ctx; CHKFORTRANNULLOBJECT(mctx); CHKFORTRANNULLFUNCTION(monitordestroy); if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorall_) { *ierr = EPSMonitorSet(*eps,EPSMonitorAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorlg_) { *ierr = EPSMonitorSet(*eps,EPSMonitorLG,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorlgall_) { *ierr = EPSMonitorSet(*eps,EPSMonitorLGAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorconverged_) { if (!FORTRANNULLOBJECT(mctx)) { PetscError(PetscObjectComm((PetscObject)*eps),__LINE__,"epsmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to EPSMonitorSet"); *ierr = 1; return; } *ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx); if (*ierr) return; ctx->viewer = NULL; *ierr = EPSMonitorSet(*eps,EPSMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorfirst_) { *ierr = EPSMonitorSet(*eps,EPSMonitorFirst,0,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)monitor,mctx); if (*ierr) return; if (!monitordestroy) { *ierr = EPSMonitorSet(*eps,ourmonitor,*eps,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitordestroy,(PetscVoidFunction)monitordestroy,mctx); if (*ierr) return; *ierr = EPSMonitorSet(*eps,ourmonitor,*eps,ourdestroy); } } } PETSC_EXTERN void PETSC_STDCALL epsgetoptionsprefix_(EPS *eps,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = EPSGetOptionsPrefix(*eps,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL epsgetst_(EPS *eps,ST *st,PetscErrorCode *ierr) { *ierr = EPSGetST(*eps,st); } PETSC_EXTERN void PETSC_STDCALL epsgetip_(EPS *eps,IP *ip,PetscErrorCode *ierr) { *ierr = EPSGetIP(*eps,ip); } PETSC_EXTERN void PETSC_STDCALL epsgetds_(EPS *eps,DS *ds,PetscErrorCode *ierr) { *ierr = EPSGetDS(*eps,ds); } PETSC_EXTERN void PETSC_STDCALL epsgetwhicheigenpairs_(EPS *eps,EPSWhich *which,PetscErrorCode *ierr) { *ierr = EPSGetWhichEigenpairs(*eps,which); } PETSC_EXTERN void PETSC_STDCALL epsgetproblemtype_(EPS *eps,EPSProblemType *type,PetscErrorCode *ierr) { *ierr = EPSGetProblemType(*eps,type); } PETSC_EXTERN void PETSC_STDCALL epsgetextraction_(EPS *eps,EPSExtraction *proj,PetscErrorCode *ierr) { *ierr = EPSGetExtraction(*eps,proj); } PETSC_EXTERN void PETSC_STDCALL epsgetconvergedreason_(EPS *eps,EPSConvergedReason *reason,PetscErrorCode *ierr) { *ierr = EPSGetConvergedReason(*eps,reason); } PETSC_EXTERN void PETSC_STDCALL epspowergetshifttype_(EPS *eps,EPSPowerShiftType *shift,PetscErrorCode *ierr) { *ierr = EPSPowerGetShiftType(*eps,shift); } PETSC_EXTERN void PETSC_STDCALL epslanczosgetreorthog_(EPS *eps,EPSLanczosReorthogType *reorthog,PetscErrorCode *ierr) { *ierr = EPSLanczosGetReorthog(*eps,reorthog); } PETSC_EXTERN void PETSC_STDCALL epsconvergedabsolute_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSConvergedAbsolute(*eps,*eigr,*eigi,*res,errest,ctx); } PETSC_EXTERN void PETSC_STDCALL epsconvergedeigrelative_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSConvergedEigRelative(*eps,*eigr,*eigi,*res,errest,ctx); } PETSC_EXTERN void PETSC_STDCALL epsconvergednormrelative_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr) { *ierr = EPSConvergedNormRelative(*eps,*eigr,*eigi,*res,errest,ctx); } PETSC_EXTERN void PETSC_STDCALL epssetconvergencetestfunction_(EPS *eps,void (PETSC_STDCALL *func)(EPS*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,void*,PetscErrorCode*),void* ctx,PetscErrorCode *ierr) { CHKFORTRANNULLOBJECT(ctx); if ((PetscVoidFunction)func == (PetscVoidFunction)epsconvergedabsolute_) { *ierr = EPSSetConvergenceTest(*eps,EPS_CONV_ABS); } else if ((PetscVoidFunction)func == (PetscVoidFunction)epsconvergedeigrelative_) { *ierr = EPSSetConvergenceTest(*eps,EPS_CONV_EIG); } else if ((PetscVoidFunction)func == (PetscVoidFunction)epsconvergednormrelative_) { *ierr = EPSSetConvergenceTest(*eps,EPS_CONV_NORM); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.convergence,(PetscVoidFunction)func,ctx); if (*ierr) return; *ierr = EPSSetConvergenceTestFunction(*eps,ourconvergence,NULL); } } PETSC_EXTERN void PETSC_STDCALL epsseteigenvaluecomparison_(EPS *eps,void (PETSC_STDCALL *func)(PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*,void*),void* ctx,PetscErrorCode *ierr) { CHKFORTRANNULLOBJECT(ctx); *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.comparison,(PetscVoidFunction)func,ctx); if (*ierr) return; *ierr = EPSSetEigenvalueComparison(*eps,oureigenvaluecomparison,eps); } PETSC_EXTERN void PETSC_STDCALL epssetarbitraryselection_(EPS *eps,void (PETSC_STDCALL *func)(PetscScalar*,PetscScalar*,Vec*,Vec*,PetscScalar*,PetscScalar*,void*,PetscErrorCode*),void *ctx,PetscErrorCode *ierr) { CHKFORTRANNULLOBJECT(ctx); *ierr = PetscObjectSetFortranCallback((PetscObject)*eps,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.arbitrary,(PetscVoidFunction)func,ctx); if (*ierr) return; *ierr = EPSSetArbitrarySelection(*eps,ourarbitraryfunc,*eps); } slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-custom/makefile0000644000175000017500000000217412211062077022554 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zepsf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/interface/mem.c0000644000175000017500000000717712211062077017707 0ustar gladkgladk/* EPS routines related to memory management. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #undef __FUNCT__ #define __FUNCT__ "EPSAllocateSolution" /* EPSAllocateSolution - Allocate memory storage for common variables such as eigenvalues and eigenvectors. */ PetscErrorCode EPSAllocateSolution(EPS eps) { PetscErrorCode ierr; PetscInt newc,cnt; PetscFunctionBegin; if (eps->allocated_ncv != eps->ncv) { newc = PetscMax(0,eps->ncv-eps->allocated_ncv); ierr = EPSFreeSolution(eps);CHKERRQ(ierr); cnt = 0; ierr = PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->eigr);CHKERRQ(ierr); ierr = PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->eigi);CHKERRQ(ierr); cnt += 2*newc*sizeof(PetscScalar); ierr = PetscMalloc(eps->ncv*sizeof(PetscReal),&eps->errest);CHKERRQ(ierr); ierr = PetscMalloc(eps->ncv*sizeof(PetscReal),&eps->errest_left);CHKERRQ(ierr); cnt += 2*newc*sizeof(PetscReal); ierr = PetscMalloc(eps->ncv*sizeof(PetscInt),&eps->perm);CHKERRQ(ierr); cnt += newc*sizeof(PetscInt); ierr = PetscLogObjectMemory(eps,cnt);CHKERRQ(ierr); ierr = VecDuplicateVecs(eps->t,eps->ncv,&eps->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,eps->ncv,eps->V);CHKERRQ(ierr); if (eps->leftvecs) { ierr = VecDuplicateVecs(eps->t,eps->ncv,&eps->W);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,eps->ncv,eps->W);CHKERRQ(ierr); } eps->allocated_ncv = eps->ncv; } /* The following cannot go in the above if, to avoid crash when ncv did not change */ if (eps->arbitrary) { newc = PetscMax(0,eps->ncv-eps->allocated_ncv); ierr = PetscFree(eps->rr);CHKERRQ(ierr); ierr = PetscFree(eps->ri);CHKERRQ(ierr); ierr = PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->rr);CHKERRQ(ierr); ierr = PetscMalloc(eps->ncv*sizeof(PetscScalar),&eps->ri);CHKERRQ(ierr); ierr = PetscLogObjectMemory(eps,2*newc*sizeof(PetscScalar));CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSFreeSolution" /* EPSFreeSolution - Free memory storage. This routine is related to EPSAllocateSolution(). */ PetscErrorCode EPSFreeSolution(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; if (eps->allocated_ncv > 0) { ierr = PetscFree(eps->eigr);CHKERRQ(ierr); ierr = PetscFree(eps->eigi);CHKERRQ(ierr); ierr = PetscFree(eps->errest);CHKERRQ(ierr); ierr = PetscFree(eps->errest_left);CHKERRQ(ierr); ierr = PetscFree(eps->perm);CHKERRQ(ierr); ierr = PetscFree(eps->rr);CHKERRQ(ierr); ierr = PetscFree(eps->ri);CHKERRQ(ierr); ierr = VecDestroyVecs(eps->allocated_ncv,&eps->V);CHKERRQ(ierr); ierr = VecDestroyVecs(eps->allocated_ncv,&eps->W);CHKERRQ(ierr); eps->allocated_ncv = 0; } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/solve.c.html0000644000175000017500000033147312211062077021223 0ustar gladkgladk
Actual source code: solve.c

  1: /*
  2:       EPS routines related to the solution process.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>   /*I "slepceps.h" I*/
 25: #include <petscdraw.h>

 27: typedef struct {
 28:   PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 29:   void *comparisonctx;
 30:   ST st;
 31: } EPSSortForSTData;

 35: static PetscErrorCode EPSSortForSTFunc(PetscScalar ar,PetscScalar ai,
 36:                                 PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)
 37: {
 38:   EPSSortForSTData *data = (EPSSortForSTData*)ctx;
 39:   PetscErrorCode   ierr;

 42:   STBackTransform(data->st,1,&ar,&ai);
 43:   STBackTransform(data->st,1,&br,&bi);
 44:   (*data->comparison)(ar,ai,br,bi,r,data->comparisonctx);
 45:   return(0);
 46: }

 50: /*@
 51:    EPSSolve - Solves the eigensystem.

 53:    Collective on EPS

 55:    Input Parameter:
 56: .  eps - eigensolver context obtained from EPSCreate()

 58:    Options Database Keys:
 59: +  -eps_view - print information about the solver used
 60: .  -eps_view_mat0 binary - save the first matrix (A) to the default binary viewer
 61: .  -eps_view_mat1 binary - save the second matrix (B) to the default binary viewer
 62: -  -eps_plot_eigs - plot computed eigenvalues

 64:    Level: beginner

 66: .seealso: EPSCreate(), EPSSetUp(), EPSDestroy(), EPSSetTolerances()
 67: @*/
 68: PetscErrorCode EPSSolve(EPS eps)
 69: {
 70:   PetscErrorCode    ierr;
 71:   PetscInt          i,nmat;
 72:   PetscReal         re,im;
 73:   PetscScalar       dot;
 74:   PetscBool         flg,isfold,iscayley;
 75:   PetscViewer       viewer;
 76:   PetscViewerFormat format;
 77:   PetscDraw         draw;
 78:   PetscDrawSP       drawsp;
 79:   STMatMode         matmode;
 80:   EPSSortForSTData  data;
 81:   Mat               A,B;
 82:   KSP               ksp;
 83:   Vec               w,x;

 87:   PetscLogEventBegin(EPS_Solve,eps,0,0,0);

 89:   /* call setup */
 90:   EPSSetUp(eps);
 91:   STGetNumMatrices(eps->st,&nmat);
 92:   STGetOperators(eps->st,0,&A);
 93:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
 94:   eps->evecsavailable = PETSC_FALSE;
 95:   eps->nconv = 0;
 96:   eps->its   = 0;
 97:   for (i=0;i<eps->ncv;i++) {
 98:     eps->eigr[i]   = 0.0;
 99:     eps->eigi[i]   = 0.0;
100:     eps->errest[i] = 0.0;
101:   }
102:   EPSMonitor(eps,eps->its,eps->nconv,eps->eigr,eps->eigi,eps->errest,eps->ncv);

104:   PetscObjectTypeCompareAny((PetscObject)eps,&flg,EPSARPACK,EPSBLZPACK,EPSTRLAN,EPSBLOPEX,EPSPRIMME,"");
105:   if (!flg) {
106:     /* temporarily change eigenvalue comparison function */
107:     data.comparison    = eps->comparison;
108:     data.comparisonctx = eps->comparisonctx;
109:     data.st            = eps->st;
110:     eps->comparison    = (eps->which==EPS_ALL)? SlepcCompareLargestMagnitude: EPSSortForSTFunc;
111:     eps->comparisonctx = (eps->which==EPS_ALL)? NULL: &data;
112:   }
113:   DSSetEigenvalueComparison(eps->ds,eps->comparison,eps->comparisonctx);

115:   /* call solver */
116:   (*eps->ops->solve)(eps);

118:   if (!flg) {
119:     /* restore comparison function */
120:     eps->comparison    = data.comparison;
121:     eps->comparisonctx = data.comparisonctx;
122:   }

124:   STGetMatMode(eps->st,&matmode);
125:   if (matmode == ST_MATMODE_INPLACE && eps->ispositive) {
126:     /* Purify eigenvectors before reverting operator */
127:     (*eps->ops->computevectors)(eps);
128:   }
129:   STPostSolve(eps->st);

131:   if (!eps->reason) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason");

133:   /* Map eigenvalues back to the original problem, necessary in some
134:   * spectral transformations */
135:   if (eps->ops->backtransform) {
136:     (*eps->ops->backtransform)(eps);
137:   }

139:   /* Adjust left eigenvectors in generalized problems: y = B^T y */
140:   if (eps->isgeneralized && eps->leftvecs) {
141:     KSPCreate(PetscObjectComm((PetscObject)eps),&ksp);
142:     KSPSetOperators(ksp,B,B,DIFFERENT_NONZERO_PATTERN);
143:     KSPSetFromOptions(ksp);
144:     MatGetVecs(B,NULL,&w);
145:     for (i=0;i<eps->nconv;i++) {
146:       VecCopy(eps->W[i],w);
147:       KSPSolveTranspose(ksp,w,eps->W[i]);
148:     }
149:     KSPDestroy(&ksp);
150:     VecDestroy(&w);
151:   }

153: #if !defined(PETSC_USE_COMPLEX)
154:   /* reorder conjugate eigenvalues (positive imaginary first) */
155:   for (i=0; i<eps->nconv-1; i++) {
156:     if (eps->eigi[i] != 0) {
157:       if (eps->eigi[i] < 0) {
158:         eps->eigi[i] = -eps->eigi[i];
159:         eps->eigi[i+1] = -eps->eigi[i+1];
160:         if (!eps->evecsavailable) {
161:           /* the next correction only works with eigenvectors */
162:           (*eps->ops->computevectors)(eps);
163:         }
164:         VecScale(eps->V[i+1],-1.0);
165:       }
166:       i++;
167:     }
168:   }
169: #endif

171:   /* quick and dirty solution for FOLD: recompute eigenvalues as Rayleigh quotients */
172:   PetscObjectTypeCompare((PetscObject)eps->st,STFOLD,&isfold);
173:   if (isfold) {
174:     MatGetVecs(A,&w,NULL);
175:     if (!eps->evecsavailable) { (*eps->ops->computevectors)(eps); }
176:     for (i=0;i<eps->nconv;i++) {
177:       x = eps->V[i];
178:       MatMult(A,x,w);
179:       VecDot(w,x,&eps->eigr[i]);
180:       if (eps->isgeneralized) {
181:         MatMult(B,x,w);
182:         VecDot(w,x,&dot);
183:         eps->eigr[i] /= dot;
184:       }
185:     }
186:     VecDestroy(&w);
187:   }

189:   /* In the case of Cayley transform, eigenvectors need to be B-normalized */
190:   PetscObjectTypeCompare((PetscObject)eps->st,STCAYLEY,&iscayley);
191:   if (iscayley && eps->isgeneralized && eps->ishermitian) {
192:     MatGetVecs(B,NULL,&w);
193:     if (!eps->evecsavailable) { (*eps->ops->computevectors)(eps); }
194:     for (i=0;i<eps->nconv;i++) {
195:       x = eps->V[i];
196:       MatMult(B,x,w);
197:       VecDot(w,x,&dot);
198:       VecScale(x,1.0/PetscSqrtScalar(dot));
199:     }
200:     VecDestroy(&w);
201:   }

203:   /* sort eigenvalues according to eps->which parameter */
204:   EPSSortEigenvalues(eps,eps->nconv,eps->eigr,eps->eigi,eps->perm);

206:   PetscLogEventEnd(EPS_Solve,eps,0,0,0);

208:   /* various viewers */
209:   MatViewFromOptions(A,((PetscObject)eps)->prefix,"-eps_view_mat0");
210:   if (nmat>1) { MatViewFromOptions(B,((PetscObject)eps)->prefix,"-eps_view_mat1"); }

212:   PetscOptionsGetViewer(PetscObjectComm((PetscObject)eps),((PetscObject)eps)->prefix,"-eps_view",&viewer,&format,&flg);
213:   if (flg && !PetscPreLoadingOn) {
214:     PetscViewerPushFormat(viewer,format);
215:     EPSView(eps,viewer);
216:     PetscViewerPopFormat(viewer);
217:     PetscViewerDestroy(&viewer);
218:   }

220:   flg = PETSC_FALSE;
221:   PetscOptionsGetBool(((PetscObject)eps)->prefix,"-eps_plot_eigs",&flg,NULL);
222:   if (flg) {
223:     PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);
224:     PetscViewerDrawGetDraw(viewer,0,&draw);
225:     PetscDrawSPCreate(draw,1,&drawsp);
226:     for (i=0;i<eps->nconv;i++) {
227: #if defined(PETSC_USE_COMPLEX)
228:       re = PetscRealPart(eps->eigr[i]);
229:       im = PetscImaginaryPart(eps->eigi[i]);
230: #else
231:       re = eps->eigr[i];
232:       im = eps->eigi[i];
233: #endif
234:       PetscDrawSPAddPoint(drawsp,&re,&im);
235:     }
236:     PetscDrawSPDraw(drawsp,PETSC_TRUE);
237:     PetscDrawSPDestroy(&drawsp);
238:     PetscViewerDestroy(&viewer);
239:   }

241:   /* Remove the initial subspaces */
242:   eps->nini = 0;
243:   eps->ninil = 0;
244:   return(0);
245: }

249: /*@
250:    EPSGetIterationNumber - Gets the current iteration number. If the
251:    call to EPSSolve() is complete, then it returns the number of iterations
252:    carried out by the solution method.

254:    Not Collective

256:    Input Parameter:
257: .  eps - the eigensolver context

259:    Output Parameter:
260: .  its - number of iterations

262:    Level: intermediate

264:    Note:
265:    During the i-th iteration this call returns i-1. If EPSSolve() is
266:    complete, then parameter "its" contains either the iteration number at
267:    which convergence was successfully reached, or failure was detected.
268:    Call EPSGetConvergedReason() to determine if the solver converged or
269:    failed and why.

271: .seealso: EPSGetConvergedReason(), EPSSetTolerances()
272: @*/
273: PetscErrorCode EPSGetIterationNumber(EPS eps,PetscInt *its)
274: {
278:   *its = eps->its;
279:   return(0);
280: }

284: /*@
285:    EPSGetOperationCounters - Gets the total number of operator applications,
286:    inner product operations and linear iterations used by the ST object
287:    during the last EPSSolve() call.

289:    Not Collective

291:    Input Parameter:
292: .  eps - EPS context

294:    Output Parameter:
295: +  ops  - number of operator applications
296: .  dots - number of inner product operations
297: -  lits - number of linear iterations

299:    Notes:
300:    When the eigensolver algorithm invokes STApply() then a linear system
301:    must be solved (except in the case of standard eigenproblems and shift
302:    transformation). The number of iterations required in this solve is
303:    accumulated into a counter whose value is returned by this function.

305:    These counters are reset to zero at each successive call to EPSSolve().

307:    Level: intermediate

309: @*/
310: PetscErrorCode EPSGetOperationCounters(EPS eps,PetscInt* ops,PetscInt* dots,PetscInt* lits)
311: {

316:   if (!eps->st) { EPSGetST(eps,&eps->st); }
317:   STGetOperationCounters(eps->st,ops,lits);
318:   if (dots) {
319:     if (!eps->ip) { EPSGetIP(eps,&eps->ip); }
320:     IPGetOperationCounters(eps->ip,dots);
321:   }
322:   return(0);
323: }

327: /*@
328:    EPSGetConverged - Gets the number of converged eigenpairs.

330:    Not Collective

332:    Input Parameter:
333: .  eps - the eigensolver context

335:    Output Parameter:
336: .  nconv - number of converged eigenpairs

338:    Note:
339:    This function should be called after EPSSolve() has finished.

341:    Level: beginner

343: .seealso: EPSSetDimensions(), EPSSolve()
344: @*/
345: PetscErrorCode EPSGetConverged(EPS eps,PetscInt *nconv)
346: {
350:   *nconv = eps->nconv;
351:   return(0);
352: }

356: /*@C
357:    EPSGetConvergedReason - Gets the reason why the EPSSolve() iteration was
358:    stopped.

360:    Not Collective

362:    Input Parameter:
363: .  eps - the eigensolver context

365:    Output Parameter:
366: .  reason - negative value indicates diverged, positive value converged

368:    Possible values for reason:
369: +  EPS_CONVERGED_TOL - converged up to tolerance
370: .  EPS_DIVERGED_ITS - required more than its to reach convergence
371: -  EPS_DIVERGED_BREAKDOWN - generic breakdown in method

373:    Note:
374:    Can only be called after the call to EPSSolve() is complete.

376:    Level: intermediate

378: .seealso: EPSSetTolerances(), EPSSolve(), EPSConvergedReason
379: @*/
380: PetscErrorCode EPSGetConvergedReason(EPS eps,EPSConvergedReason *reason)
381: {
385:   *reason = eps->reason;
386:   return(0);
387: }

391: /*@
392:    EPSGetInvariantSubspace - Gets an orthonormal basis of the computed invariant
393:    subspace.

395:    Not Collective, but vectors are shared by all processors that share the EPS

397:    Input Parameter:
398: .  eps - the eigensolver context

400:    Output Parameter:
401: .  v - an array of vectors

403:    Notes:
404:    This function should be called after EPSSolve() has finished.

406:    The user should provide in v an array of nconv vectors, where nconv is
407:    the value returned by EPSGetConverged().

409:    The first k vectors returned in v span an invariant subspace associated
410:    with the first k computed eigenvalues (note that this is not true if the
411:    k-th eigenvalue is complex and matrix A is real; in this case the first
412:    k+1 vectors should be used). An invariant subspace X of A satisfies Ax
413:    in X for all x in X (a similar definition applies for generalized
414:    eigenproblems).

416:    Level: intermediate

418: .seealso: EPSGetEigenpair(), EPSGetConverged(), EPSSolve(), EPSGetInvariantSubspaceLeft()
419: @*/
420: PetscErrorCode EPSGetInvariantSubspace(EPS eps,Vec *v)
421: {
423:   PetscInt       i;

429:   if (!eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
430:   if (!eps->ishermitian && eps->evecsavailable) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSGetInvariantSubspace must be called before EPSGetEigenpair,EPSGetEigenvector,EPSComputeRelativeError or EPSComputeResidualNorm");
431:   if (eps->balance!=EPS_BALANCE_NONE && eps->D) {
432:     for (i=0;i<eps->nconv;i++) {
433:       VecPointwiseDivide(v[i],eps->V[i],eps->D);
434:       VecNormalize(v[i],NULL);
435:     }
436:   } else {
437:     for (i=0;i<eps->nconv;i++) {
438:       VecCopy(eps->V[i],v[i]);
439:     }
440:   }
441:   return(0);
442: }

446: /*@
447:    EPSGetInvariantSubspaceLeft - Gets an orthonormal basis of the computed left
448:    invariant subspace (only available in two-sided eigensolvers).

450:    Not Collective, but vectors are shared by all processors that share the EPS

452:    Input Parameter:
453: .  eps - the eigensolver context

455:    Output Parameter:
456: .  v - an array of vectors

458:    Notes:
459:    This function should be called after EPSSolve() has finished.

461:    The user should provide in v an array of nconv vectors, where nconv is
462:    the value returned by EPSGetConverged().

464:    The first k vectors returned in v span a left invariant subspace associated
465:    with the first k computed eigenvalues (note that this is not true if the
466:    k-th eigenvalue is complex and matrix A is real; in this case the first
467:    k+1 vectors should be used). A left invariant subspace Y of A satisfies y'A
468:    in Y for all y in Y (a similar definition applies for generalized
469:    eigenproblems).

471:    Level: intermediate

473: .seealso: EPSGetEigenpair(), EPSGetConverged(), EPSSolve(), EPSGetInvariantSubspace
474: @*/
475: PetscErrorCode EPSGetInvariantSubspaceLeft(EPS eps,Vec *v)
476: {
478:   PetscInt       i;

484:   if (!eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted");
485:   if (!eps->W) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
486:   if (!eps->ishermitian && eps->evecsavailable) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSGetInvariantSubspaceLeft must be called before EPSGetEigenpairLeft,EPSComputeRelativeErrorLeft or EPSComputeResidualNormLeft");
487:   for (i=0;i<eps->nconv;i++) {
488:     VecCopy(eps->W[i],v[i]);
489:   }
490:   return(0);
491: }

495: /*@
496:    EPSGetEigenpair - Gets the i-th solution of the eigenproblem as computed by
497:    EPSSolve(). The solution consists in both the eigenvalue and the eigenvector.

499:    Logically Collective on EPS

501:    Input Parameters:
502: +  eps - eigensolver context
503: -  i   - index of the solution

505:    Output Parameters:
506: +  eigr - real part of eigenvalue
507: .  eigi - imaginary part of eigenvalue
508: .  Vr   - real part of eigenvector
509: -  Vi   - imaginary part of eigenvector

511:    Notes:
512:    If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is
513:    configured with complex scalars the eigenvalue is stored
514:    directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is
515:    set to zero).

517:    The index i should be a value between 0 and nconv-1 (see EPSGetConverged()).
518:    Eigenpairs are indexed according to the ordering criterion established
519:    with EPSSetWhichEigenpairs().

521:    The 2-norm of the eigenvector is one unless the problem is generalized
522:    Hermitian. In this case the eigenvector is normalized with respect to the
523:    norm defined by the B matrix.

525:    Level: beginner

527: .seealso: EPSGetEigenvalue(), EPSGetEigenvector(), EPSGetEigenvectorLeft(), EPSSolve(),
528:           EPSGetConverged(), EPSSetWhichEigenpairs(), EPSGetInvariantSubspace()
529: @*/
530: PetscErrorCode EPSGetEigenpair(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi)
531: {

537:   if (!eps->eigr || !eps->eigi || !eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
538:   if (i<0 || i>=eps->nconv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
539:   EPSGetEigenvalue(eps,i,eigr,eigi);
540:   if (Vr || Vi) { EPSGetEigenvector(eps,i,Vr,Vi); }
541:   return(0);
542: }

546: /*@
547:    EPSGetEigenvalue - Gets the i-th eigenvalue as computed by EPSSolve().

549:    Not Collective

551:    Input Parameters:
552: +  eps - eigensolver context
553: -  i   - index of the solution

555:    Output Parameters:
556: +  eigr - real part of eigenvalue
557: -  eigi - imaginary part of eigenvalue

559:    Notes:
560:    If the eigenvalue is real, then eigi is set to zero. If PETSc is
561:    configured with complex scalars the eigenvalue is stored
562:    directly in eigr (eigi is set to zero).

564:    The index i should be a value between 0 and nconv-1 (see EPSGetConverged()).
565:    Eigenpairs are indexed according to the ordering criterion established
566:    with EPSSetWhichEigenpairs().

568:    Level: beginner

570: .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(),
571:           EPSGetEigenpair()
572: @*/
573: PetscErrorCode EPSGetEigenvalue(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi)
574: {
575:   PetscInt       k;

579:   if (!eps->eigr || !eps->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
580:   if (i<0 || i>=eps->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
581:   if (!eps->perm) k = i;
582:   else k = eps->perm[i];
583: #if defined(PETSC_USE_COMPLEX)
584:   if (eigr) *eigr = eps->eigr[k];
585:   if (eigi) *eigi = 0;
586: #else
587:   if (eigr) *eigr = eps->eigr[k];
588:   if (eigi) *eigi = eps->eigi[k];
589: #endif
590:   return(0);
591: }

595: /*@
596:    EPSGetEigenvector - Gets the i-th right eigenvector as computed by EPSSolve().

598:    Logically Collective on EPS

600:    Input Parameters:
601: +  eps - eigensolver context
602: -  i   - index of the solution

604:    Output Parameters:
605: +  Vr   - real part of eigenvector
606: -  Vi   - imaginary part of eigenvector

608:    Notes:
609:    If the corresponding eigenvalue is real, then Vi is set to zero. If PETSc is
610:    configured with complex scalars the eigenvector is stored
611:    directly in Vr (Vi is set to zero).

613:    The index i should be a value between 0 and nconv-1 (see EPSGetConverged()).
614:    Eigenpairs are indexed according to the ordering criterion established
615:    with EPSSetWhichEigenpairs().

617:    The 2-norm of the eigenvector is one unless the problem is generalized
618:    Hermitian. In this case the eigenvector is normalized with respect to the
619:    norm defined by the B matrix.

621:    Level: beginner

623: .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(),
624:           EPSGetEigenpair(), EPSGetEigenvectorLeft()
625: @*/
626: PetscErrorCode EPSGetEigenvector(EPS eps,PetscInt i,Vec Vr,Vec Vi)
627: {
629:   PetscInt       k;

637:   if (!eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
638:   if (i<0 || i>=eps->nconv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
639:   if (!eps->evecsavailable) {
640:     (*eps->ops->computevectors)(eps);
641:   }
642:   if (!eps->perm) k = i;
643:   else k = eps->perm[i];
644: #if defined(PETSC_USE_COMPLEX)
645:   VecCopy(eps->V[k],Vr);
646:   if (Vi) { VecSet(Vi,0.0); }
647: #else
648:   if (eps->eigi[k] > 0) { /* first value of conjugate pair */
649:     VecCopy(eps->V[k],Vr);
650:     if (Vi) {
651:       VecCopy(eps->V[k+1],Vi);
652:     }
653:   } else if (eps->eigi[k] < 0) { /* second value of conjugate pair */
654:     VecCopy(eps->V[k-1],Vr);
655:     if (Vi) {
656:       VecCopy(eps->V[k],Vi);
657:       VecScale(Vi,-1.0);
658:     }
659:   } else { /* real eigenvalue */
660:     VecCopy(eps->V[k],Vr);
661:     if (Vi) { VecSet(Vi,0.0); }
662:   }
663: #endif
664:   return(0);
665: }

669: /*@
670:    EPSGetEigenvectorLeft - Gets the i-th left eigenvector as computed by EPSSolve()
671:    (only available in two-sided eigensolvers).

673:    Logically Collective on EPS

675:    Input Parameters:
676: +  eps - eigensolver context
677: -  i   - index of the solution

679:    Output Parameters:
680: +  Wr   - real part of eigenvector
681: -  Wi   - imaginary part of eigenvector

683:    Notes:
684:    If the corresponding eigenvalue is real, then Wi is set to zero. If PETSc is
685:    configured with complex scalars the eigenvector is stored
686:    directly in Wr (Wi is set to zero).

688:    The index i should be a value between 0 and nconv-1 (see EPSGetConverged()).
689:    Eigenpairs are indexed according to the ordering criterion established
690:    with EPSSetWhichEigenpairs().

692:    Level: beginner

694: .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(),
695:           EPSGetEigenpair(), EPSGetEigenvector()
696: @*/
697: PetscErrorCode EPSGetEigenvectorLeft(EPS eps,PetscInt i,Vec Wr,Vec Wi)
698: {
700:   PetscInt       k;

708:   if (!eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted");
709:   if (!eps->W) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
710:   if (i<0 || i>=eps->nconv) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
711:   if (!eps->evecsavailable) {
712:     (*eps->ops->computevectors)(eps);
713:   }
714:   if (!eps->perm) k = i;
715:   else k = eps->perm[i];
716: #if defined(PETSC_USE_COMPLEX)
717:   VecCopy(eps->W[k],Wr);
718:   if (Wi) { VecSet(Wi,0.0); }
719: #else
720:   if (eps->eigi[k] > 0) { /* first value of conjugate pair */
721:     VecCopy(eps->W[k],Wr);
722:     if (Wi) {
723:       VecCopy(eps->W[k+1],Wi);
724:     }
725:   } else if (eps->eigi[k] < 0) { /* second value of conjugate pair */
726:     VecCopy(eps->W[k-1],Wr);
727:     if (Wi) {
728:       VecCopy(eps->W[k],Wi);
729:       VecScale(Wi,-1.0);
730:     }
731:   } else { /* real eigenvalue */
732:     VecCopy(eps->W[k],Wr);
733:     if (Wi) { VecSet(Wi,0.0); }
734:   }
735: #endif
736:   return(0);
737: }

741: /*@
742:    EPSGetErrorEstimate - Returns the error estimate associated to the i-th
743:    computed eigenpair.

745:    Not Collective

747:    Input Parameter:
748: +  eps - eigensolver context
749: -  i   - index of eigenpair

751:    Output Parameter:
752: .  errest - the error estimate

754:    Notes:
755:    This is the error estimate used internally by the eigensolver. The actual
756:    error bound can be computed with EPSComputeRelativeError(). See also the users
757:    manual for details.

759:    Level: advanced

761: .seealso: EPSComputeRelativeError()
762: @*/
763: PetscErrorCode EPSGetErrorEstimate(EPS eps,PetscInt i,PetscReal *errest)
764: {
768:   if (!eps->eigr || !eps->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
769:   if (i<0 || i>=eps->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
770:   if (eps->perm) i = eps->perm[i];
771:   if (errest) *errest = eps->errest[i];
772:   return(0);
773: }

777: /*@
778:    EPSGetErrorEstimateLeft - Returns the left error estimate associated to the i-th
779:    computed eigenpair (only available in two-sided eigensolvers).

781:    Not Collective

783:    Input Parameter:
784: +  eps - eigensolver context
785: -  i   - index of eigenpair

787:    Output Parameter:
788: .  errest - the left error estimate

790:    Notes:
791:    This is the error estimate used internally by the eigensolver. The actual
792:    error bound can be computed with EPSComputeRelativeErrorLeft(). See also the users
793:    manual for details.

795:    Level: advanced

797: .seealso: EPSComputeRelativeErrorLeft()
798: @*/
799: PetscErrorCode EPSGetErrorEstimateLeft(EPS eps,PetscInt i,PetscReal *errest)
800: {
804:   if (!eps->eigr || !eps->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
805:   if (!eps->leftvecs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted");
806:   if (i<0 || i>=eps->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
807:   if (eps->perm) i = eps->perm[i];
808:   if (errest) *errest = eps->errest_left[i];
809:   return(0);
810: }

814: /*
815:    EPSComputeResidualNorm_Private - Computes the norm of the residual vector
816:    associated with an eigenpair.
817: */
818: PetscErrorCode EPSComputeResidualNorm_Private(EPS eps,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *norm)
819: {
821:   PetscInt       nmat;
822:   Vec            u,w;
823:   Mat            A,B;
824: #if !defined(PETSC_USE_COMPLEX)
825:   Vec            v;
826:   PetscReal      ni,nr;
827: #endif

830:   STGetNumMatrices(eps->st,&nmat);
831:   STGetOperators(eps->st,0,&A);
832:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
833:   VecDuplicate(eps->V[0],&u);
834:   VecDuplicate(eps->V[0],&w);

836: #if !defined(PETSC_USE_COMPLEX)
837:   if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
838: #endif
839:     MatMult(A,xr,u);                             /* u=A*x */
840:     if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) {
841:       if (eps->isgeneralized) { MatMult(B,xr,w); }
842:       else { VecCopy(xr,w); }                    /* w=B*x */
843:       VecAXPY(u,-kr,w);                          /* u=A*x-k*B*x */
844:     }
845:     VecNorm(u,NORM_2,norm);
846: #if !defined(PETSC_USE_COMPLEX)
847:   } else {
848:     VecDuplicate(eps->V[0],&v);
849:     MatMult(A,xr,u);                             /* u=A*xr */
850:     if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) {
851:       if (eps->isgeneralized) { MatMult(B,xr,v); }
852:       else { VecCopy(xr,v); }                    /* v=B*xr */
853:       VecAXPY(u,-kr,v);                          /* u=A*xr-kr*B*xr */
854:       if (eps->isgeneralized) { MatMult(B,xi,w); }
855:       else { VecCopy(xi,w); }                    /* w=B*xi */
856:       VecAXPY(u,ki,w);                           /* u=A*xr-kr*B*xr+ki*B*xi */
857:     }
858:     VecNorm(u,NORM_2,&nr);
859:     MatMult(A,xi,u);                             /* u=A*xi */
860:     if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) {
861:       VecAXPY(u,-kr,w);                          /* u=A*xi-kr*B*xi */
862:       VecAXPY(u,-ki,v);                          /* u=A*xi-kr*B*xi-ki*B*xr */
863:     }
864:     VecNorm(u,NORM_2,&ni);
865:     *norm = SlepcAbsEigenvalue(nr,ni);
866:     VecDestroy(&v);
867:   }
868: #endif

870:   VecDestroy(&w);
871:   VecDestroy(&u);
872:   return(0);
873: }

877: /*@
878:    EPSComputeResidualNorm - Computes the norm of the residual vector associated with
879:    the i-th computed eigenpair.

881:    Collective on EPS

883:    Input Parameter:
884: +  eps - the eigensolver context
885: -  i   - the solution index

887:    Output Parameter:
888: .  norm - the residual norm, computed as ||Ax-kBx||_2 where k is the
889:    eigenvalue and x is the eigenvector.
890:    If k=0 then the residual norm is computed as ||Ax||_2.

892:    Notes:
893:    The index i should be a value between 0 and nconv-1 (see EPSGetConverged()).
894:    Eigenpairs are indexed according to the ordering criterion established
895:    with EPSSetWhichEigenpairs().

897:    Level: beginner

899: .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs()
900: @*/
901: PetscErrorCode EPSComputeResidualNorm(EPS eps,PetscInt i,PetscReal *norm)
902: {
904:   Vec            xr,xi;
905:   PetscScalar    kr,ki;

911:   VecDuplicate(eps->V[0],&xr);
912:   VecDuplicate(eps->V[0],&xi);
913:   EPSGetEigenpair(eps,i,&kr,&ki,xr,xi);
914:   EPSComputeResidualNorm_Private(eps,kr,ki,xr,xi,norm);
915:   VecDestroy(&xr);
916:   VecDestroy(&xi);
917:   return(0);
918: }

922: /*@
923:    EPSComputeResidualNormLeft - Computes the norm of the residual vector associated with
924:    the i-th computed left eigenvector (only available in two-sided eigensolvers).

926:    Collective on EPS

928:    Input Parameter:
929: +  eps - the eigensolver context
930: -  i   - the solution index

932:    Output Parameter:
933: .  norm - the residual norm, computed as ||y'A-ky'B||_2 where k is the
934:    eigenvalue and y is the left eigenvector.
935:    If k=0 then the residual norm is computed as ||y'A||_2.

937:    Notes:
938:    The index i should be a value between 0 and nconv-1 (see EPSGetConverged()).
939:    Eigenpairs are indexed according to the ordering criterion established
940:    with EPSSetWhichEigenpairs().

942:    Level: beginner

944: .seealso: EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs()
945: @*/
946: PetscErrorCode EPSComputeResidualNormLeft(EPS eps,PetscInt i,PetscReal *norm)
947: {
949:   Vec            u,v,w,xr,xi;
950:   Mat            A,B;
951:   PetscInt       nmat;
952:   PetscScalar    kr,ki;
953: #if !defined(PETSC_USE_COMPLEX)
954:   PetscReal      ni,nr;
955: #endif

961:   if (!eps->leftvecs) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"Must request left vectors with EPSSetLeftVectorsWanted");
962:   STGetNumMatrices(eps->st,&nmat);
963:   STGetOperators(eps->st,0,&A);
964:   if (nmat>1) { STGetOperators(eps->st,1,&B); }
965:   VecDuplicate(eps->W[0],&u);
966:   VecDuplicate(eps->W[0],&v);
967:   VecDuplicate(eps->W[0],&w);
968:   VecDuplicate(eps->W[0],&xr);
969:   VecDuplicate(eps->W[0],&xi);
970:   EPSGetEigenvalue(eps,i,&kr,&ki);
971:   EPSGetEigenvectorLeft(eps,i,xr,xi);

973: #if !defined(PETSC_USE_COMPLEX)
974:   if (ki == 0 ||
975:     PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
976: #endif
977:     MatMultTranspose(A,xr,u); /* u=A'*x */
978:     if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) {
979:       if (eps->isgeneralized) { MatMultTranspose(B,xr,w); }
980:       else { VecCopy(xr,w); } /* w=B'*x */
981:       VecAXPY(u,-kr,w); /* u=A'*x-k*B'*x */
982:     }
983:     VecNorm(u,NORM_2,norm);
984: #if !defined(PETSC_USE_COMPLEX)
985:   } else {
986:     MatMultTranspose(A,xr,u); /* u=A'*xr */
987:     if (eps->isgeneralized) { MatMultTranspose(B,xr,v); }
988:     else { VecCopy(xr,v); } /* v=B'*xr */
989:     VecAXPY(u,-kr,v); /* u=A'*xr-kr*B'*xr */
990:     if (eps->isgeneralized) { MatMultTranspose(B,xi,w); }
991:     else { VecCopy(xi,w); } /* w=B'*xi */
992:     VecAXPY(u,ki,w); /* u=A'*xr-kr*B'*xr+ki*B'*xi */
993:     VecNorm(u,NORM_2,&nr);
994:     MatMultTranspose(A,xi,u); /* u=A'*xi */
995:     VecAXPY(u,-kr,w); /* u=A'*xi-kr*B'*xi */
996:     VecAXPY(u,-ki,v); /* u=A'*xi-kr*B'*xi-ki*B'*xr */
997:     VecNorm(u,NORM_2,&ni);
998:     *norm = SlepcAbsEigenvalue(nr,ni);
999:   }
1000: #endif

1002:   VecDestroy(&w);
1003:   VecDestroy(&v);
1004:   VecDestroy(&u);
1005:   VecDestroy(&xr);
1006:   VecDestroy(&xi);
1007:   return(0);
1008: }

1012: /*
1013:    EPSComputeRelativeError_Private - Computes the relative error bound
1014:    associated with an eigenpair.
1015: */
1016: PetscErrorCode EPSComputeRelativeError_Private(EPS eps,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *error)
1017: {
1019:   PetscReal      norm,er;
1020: #if !defined(PETSC_USE_COMPLEX)
1021:   PetscReal      ei;
1022: #endif

1025:   EPSComputeResidualNorm_Private(eps,kr,ki,xr,xi,&norm);

1027: #if !defined(PETSC_USE_COMPLEX)
1028:   if (ki == 0) {
1029: #endif
1030:     VecNorm(xr,NORM_2,&er);
1031: #if !defined(PETSC_USE_COMPLEX)
1032:   } else {
1033:     VecNorm(xr,NORM_2,&er);
1034:     VecNorm(xi,NORM_2,&ei);
1035:     er = SlepcAbsEigenvalue(er,ei);
1036:   }
1037: #endif
1038:   (*eps->converged)(eps,kr,ki,norm/er,error,eps->convergedctx);
1039:   return(0);
1040: }

1044: /*@
1045:    EPSComputeRelativeError - Computes the relative error bound associated
1046:    with the i-th computed eigenpair.

1048:    Collective on EPS

1050:    Input Parameter:
1051: +  eps - the eigensolver context
1052: -  i   - the solution index

1054:    Output Parameter:
1055: .  error - the relative error bound, computed as ||Ax-kBx||_2/||kx||_2 where
1056:    k is the eigenvalue and x is the eigenvector.
1057:    If k=0 the relative error is computed as ||Ax||_2/||x||_2.

1059:    Level: beginner

1061: .seealso: EPSSolve(), EPSComputeResidualNorm(), EPSGetErrorEstimate()
1062: @*/
1063: PetscErrorCode EPSComputeRelativeError(EPS eps,PetscInt i,PetscReal *error)
1064: {
1066:   Vec            xr,xi;
1067:   PetscScalar    kr,ki;

1073:   VecDuplicate(eps->V[0],&xr);
1074:   VecDuplicate(eps->V[0],&xi);
1075:   EPSGetEigenpair(eps,i,&kr,&ki,xr,xi);
1076:   EPSComputeRelativeError_Private(eps,kr,ki,xr,xi,error);
1077:   VecDestroy(&xr);
1078:   VecDestroy(&xi);
1079:   return(0);
1080: }

1084: /*@
1085:    EPSComputeRelativeErrorLeft - Computes the relative error bound associated
1086:    with the i-th computed eigenvalue and left eigenvector (only available in
1087:    two-sided eigensolvers).

1089:    Collective on EPS

1091:    Input Parameter:
1092: +  eps - the eigensolver context
1093: -  i   - the solution index

1095:    Output Parameter:
1096: .  error - the relative error bound, computed as ||y'A-ky'B||_2/||ky||_2 where
1097:    k is the eigenvalue and y is the left eigenvector.
1098:    If k=0 the relative error is computed as ||y'A||_2/||y||_2.

1100:    Level: beginner

1102: .seealso: EPSSolve(), EPSComputeResidualNormLeft(), EPSGetErrorEstimateLeft()
1103: @*/
1104: PetscErrorCode EPSComputeRelativeErrorLeft(EPS eps,PetscInt i,PetscReal *error)
1105: {
1107:   Vec            xr,xi;
1108:   PetscScalar    kr,ki;
1109:   PetscReal      norm,er;
1110: #if !defined(PETSC_USE_COMPLEX)
1111:   Vec            u;
1112:   PetscReal      ei;
1113: #endif

1117:   EPSComputeResidualNormLeft(eps,i,&norm);
1120:   VecDuplicate(eps->W[0],&xr);
1121:   VecDuplicate(eps->W[0],&xi);
1122:   EPSGetEigenvalue(eps,i,&kr,&ki);
1123:   EPSGetEigenvectorLeft(eps,i,xr,xi);

1125: #if !defined(PETSC_USE_COMPLEX)
1126:   if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
1127: #endif
1128:     VecNorm(xr,NORM_2,&er);
1129:     if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) *error = norm/(PetscAbsScalar(kr)*er);
1130:     else *error = norm / er;
1131: #if !defined(PETSC_USE_COMPLEX)
1132:   } else {
1133:     VecDuplicate(xi,&u);
1134:     VecCopy(xi,u);
1135:     VecAXPBY(u,kr,-ki,xr);
1136:     VecNorm(u,NORM_2,&er);
1137:     VecAXPBY(xi,kr,ki,xr);
1138:     VecNorm(xi,NORM_2,&ei);
1139:     VecDestroy(&u);
1140:     *error = norm / SlepcAbsEigenvalue(er,ei);
1141:   }
1142: #endif

1144:   VecDestroy(&xr);
1145:   VecDestroy(&xi);
1146:   return(0);
1147: }

1151: /*@
1152:    EPSSortEigenvalues - Sorts a list of eigenvalues according to the criterion
1153:    specified via EPSSetWhichEigenpairs().

1155:    Not Collective

1157:    Input Parameters:
1158: +  eps   - the eigensolver context
1159: .  n     - number of eigenvalues in the list
1160: .  eigr  - pointer to the array containing the eigenvalues
1161: -  eigi  - imaginary part of the eigenvalues (only when using real numbers)

1163:    Output Parameter:
1164: .  perm  - resulting permutation

1166:    Note:
1167:    The result is a list of indices in the original eigenvalue array
1168:    corresponding to the first nev eigenvalues sorted in the specified
1169:    criterion.

1171:    Level: developer

1173: .seealso: EPSSetWhichEigenpairs()
1174: @*/
1175: PetscErrorCode EPSSortEigenvalues(EPS eps,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)
1176: {
1178:   PetscScalar    re,im;
1179:   PetscInt       i,j,result,tmp;

1186:   for (i=0; i<n; i++) { perm[i] = i; }
1187:   /* insertion sort */
1188:   for (i=n-1; i>=0; i--) {
1189:     re = eigr[perm[i]];
1190:     im = eigi[perm[i]];
1191:     j = i + 1;
1192: #if !defined(PETSC_USE_COMPLEX)
1193:     if (im != 0) {
1194:       /* complex eigenvalue */
1195:       i--;
1196:       im = eigi[perm[i]];
1197:     }
1198: #endif
1199:     while (j<n) {
1200:       EPSCompareEigenvalues(eps,re,im,eigr[perm[j]],eigi[perm[j]],&result);
1201:       if (result < 0) break;
1202: #if !defined(PETSC_USE_COMPLEX)
1203:       /* keep together every complex conjugated eigenpair */
1204:       if (im == 0) {
1205:         if (eigi[perm[j]] == 0) {
1206: #endif
1207:           tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = tmp;
1208:           j++;
1209: #if !defined(PETSC_USE_COMPLEX)
1210:         } else {
1211:           tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp;
1212:           j+=2;
1213:         }
1214:       } else {
1215:         if (eigi[perm[j]] == 0) {
1216:           tmp = perm[j-2]; perm[j-2] = perm[j]; perm[j] = perm[j-1]; perm[j-1] = tmp;
1217:           j++;
1218:         } else {
1219:           tmp = perm[j-2]; perm[j-2] = perm[j]; perm[j] = tmp;
1220:           tmp = perm[j-1]; perm[j-1] = perm[j+1]; perm[j+1] = tmp;
1221:           j+=2;
1222:         }
1223:       }
1224: #endif
1225:     }
1226:   }
1227:   return(0);
1228: }

1232: /*@
1233:    EPSCompareEigenvalues - Compares two (possibly complex) eigenvalues according
1234:    to a certain criterion.

1236:    Not Collective

1238:    Input Parameters:
1239: +  eps   - the eigensolver context
1240: .  ar     - real part of the 1st eigenvalue
1241: .  ai     - imaginary part of the 1st eigenvalue
1242: .  br     - real part of the 2nd eigenvalue
1243: -  bi     - imaginary part of the 2nd eigenvalue

1245:    Output Parameter:
1246: .  res    - result of comparison

1248:    Notes:
1249:    The returning parameter 'res' can be:
1250: +  negative - if the 1st eigenvalue is preferred to the 2st one
1251: .  zero     - if both eigenvalues are equally preferred
1252: -  positive - if the 2st eigenvalue is preferred to the 1st one

1254:    The criterion of comparison is related to the 'which' parameter set with
1255:    EPSSetWhichEigenpairs().

1257:    Level: developer

1259: .seealso: EPSSortEigenvalues(), EPSSetWhichEigenpairs()
1260: @*/
1261: PetscErrorCode EPSCompareEigenvalues(EPS eps,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)
1262: {

1268:   if (!eps->comparison) SETERRQ(PETSC_COMM_SELF,1,"Undefined eigenvalue comparison function");
1269:   (*eps->comparison)(ar,ai,br,bi,result,eps->comparisonctx);
1270:   return(0);
1271: }

1275: /*@
1276:    EPSGetStartVector - Gets a suitable vector to be used as the starting vector
1277:    for the recurrence that builds the right subspace.

1279:    Collective on EPS and Vec

1281:    Input Parameters:
1282: +  eps - the eigensolver context
1283: -  i   - iteration number

1285:    Output Parameters:
1286: +  vec - the start vector
1287: -  breakdown - flag indicating that a breakdown has occurred

1289:    Notes:
1290:    The start vector is computed from another vector: for the first step (i=0),
1291:    the first initial vector is used (see EPSSetInitialSpace()); otherwise a random
1292:    vector is created. Then this vector is forced to be in the range of OP (only
1293:    for generalized definite problems) and orthonormalized with respect to all
1294:    V-vectors up to i-1.

1296:    The flag breakdown is set to true if either i=0 and the vector belongs to the
1297:    deflation space, or i>0 and the vector is linearly dependent with respect
1298:    to the V-vectors.

1300:    The caller must pass a vector already allocated with dimensions conforming
1301:    to the initial vector. This vector is overwritten.

1303:    Level: developer

1305: .seealso: EPSSetInitialSpace()
1306: @*/
1307: PetscErrorCode EPSGetStartVector(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown)
1308: {
1310:   PetscReal      norm;
1311:   PetscBool      lindep;
1312:   Vec            w;


1320:   VecDuplicate(eps->V[0],&w);

1322:   /* For the first step, use the first initial vector, otherwise a random one */
1323:   if (i==0 && eps->nini>0) {
1324:     VecCopy(eps->V[0],w);
1325:   } else {
1326:     SlepcVecSetRandom(w,eps->rand);
1327:   }

1329:   /* Force the vector to be in the range of OP for definite generalized problems */
1330:   if (eps->ispositive || (eps->isgeneralized && eps->ishermitian)) {
1331:     STApply(eps->st,w,vec);
1332:   } else {
1333:     VecCopy(w,vec);
1334:   }

1336:   /* Orthonormalize the vector with respect to previous vectors */
1337:   IPOrthogonalize(eps->ip,eps->nds,eps->defl,i,NULL,eps->V,vec,NULL,&norm,&lindep);
1338:   if (breakdown) *breakdown = lindep;
1339:   else if (lindep || norm == 0.0) {
1340:     if (i==0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Initial vector is zero or belongs to the deflation space");
1341:     else SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unable to generate more start vectors");
1342:   }
1343:   VecScale(vec,1.0/norm);

1345:   VecDestroy(&w);
1346:   return(0);
1347: }

1351: /*@
1352:    EPSGetStartVectorLeft - Gets a suitable vector to be used as the starting vector
1353:    in the recurrence that builds the left subspace (in methods that work with two
1354:    subspaces).

1356:    Collective on EPS and Vec

1358:    Input Parameters:
1359: +  eps - the eigensolver context
1360: -  i   - iteration number

1362:    Output Parameter:
1363: +  vec - the start vector
1364: -  breakdown - flag indicating that a breakdown has occurred

1366:    Notes:
1367:    The start vector is computed from another vector: for the first step (i=0),
1368:    the first left initial vector is used (see EPSSetInitialSpaceLeft()); otherwise
1369:    a random vector is created. Then this vector is forced to be in the range
1370:    of OP' and orthonormalized with respect to all W-vectors up to i-1.

1372:    The flag breakdown is set to true if i>0 and the vector is linearly dependent
1373:    with respect to the W-vectors.

1375:    The caller must pass a vector already allocated with dimensions conforming
1376:    to the left initial vector. This vector is overwritten.

1378:    Level: developer

1380: .seealso: EPSSetInitialSpaceLeft()
1381: @*/
1382: PetscErrorCode EPSGetStartVectorLeft(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown)
1383: {
1385:   PetscReal      norm;
1386:   PetscBool      lindep;
1387:   Vec            w;


1395:   VecDuplicate(eps->W[0],&w);

1397:   /* For the first step, use the first initial left vector, otherwise a random one */
1398:   if (i==0 && eps->ninil>0) {
1399:     VecCopy(eps->W[0],w);
1400:   } else {
1401:     SlepcVecSetRandom(w,eps->rand);
1402:   }

1404:   /* Force the vector to be in the range of OP' */
1405:   STApplyTranspose(eps->st,w,vec);

1407:   /* Orthonormalize the vector with respect to previous vectors */
1408:   IPOrthogonalize(eps->ip,0,NULL,i,NULL,eps->W,vec,NULL,&norm,&lindep);
1409:   if (breakdown) *breakdown = lindep;
1410:   else if (lindep || norm == 0.0) {
1411:     if (i==0) SETERRQ(PetscObjectComm((PetscObject)eps),1,"Left initial vector is zero");
1412:     else SETERRQ(PetscObjectComm((PetscObject)eps),1,"Unable to generate more left start vectors");
1413:   }
1414:   VecScale(vec,1/norm);

1416:   VecDestroy(&w);
1417:   return(0);
1418: }
slepc-3.4.2.dfsg.orig/src/eps/interface/basic.c.html0000644000175000017500000024721012211062077021147 0ustar gladkgladk
Actual source code: basic.c

  1: /*
  2:      The basic EPS routines, Create, View, etc. are here.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>      /*I "slepceps.h" I*/

 26: PetscFunctionList EPSList = 0;
 27: PetscBool         EPSRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      EPS_CLASSID = 0;
 29: PetscLogEvent     EPS_SetUp = 0,EPS_Solve = 0;
 30: static PetscBool  EPSPackageInitialized = PETSC_FALSE;

 32: const char *EPSPowerShiftTypes[] = {"CONSTANT","RAYLEIGH","WILKINSON","EPSPowerShiftType","EPS_POWER_SHIFT_",0};
 33: const char *EPSLanczosReorthogTypes[] = {"LOCAL","FULL","SELECTIVE","PERIODIC","PARTIAL","DELAYED","EPSLanczosReorthogType","EPS_LANCZOS_REORTHOG_",0};
 34: const char *EPSPRIMMEMethods[] = {"DYNAMIC","DEFAULT_MIN_TIME","DEFAULT_MIN_MATVECS","ARNOLDI","GD","GD_PLUSK","GD_OLSEN_PLUSK","JD_OLSEN_PLUSK","RQI","JDQR","JDQMR","JDQMR_ETOL","SUBSPACE_ITERATION","LOBPCG_ORTHOBASIS","LOBPCG_ORTHOBASISW","EPSPRIMMEMethod","EPS_PRIMME_",0};

 38: /*@C
 39:   EPSFinalizePackage - This function destroys everything in the SLEPc interface
 40:   to the EPS package. It is called from SlepcFinalize().

 42:   Level: developer

 44: .seealso: SlepcFinalize()
 45: @*/
 46: PetscErrorCode EPSFinalizePackage(void)
 47: {

 51:   PetscFunctionListDestroy(&EPSList);
 52:   EPSPackageInitialized = PETSC_FALSE;
 53:   EPSRegisterAllCalled  = PETSC_FALSE;
 54:   return(0);
 55: }

 59: /*@C
 60:   EPSInitializePackage - This function initializes everything in the EPS package.
 61:   It is called from PetscDLLibraryRegister() when using dynamic libraries, and
 62:   on the first call to EPSCreate() when using static libraries.

 64:   Level: developer

 66: .seealso: SlepcInitialize()
 67: @*/
 68: PetscErrorCode EPSInitializePackage()
 69: {
 70:   char           logList[256];
 71:   char           *className;
 72:   PetscBool      opt;

 76:   if (EPSPackageInitialized) return(0);
 77:   EPSPackageInitialized = PETSC_TRUE;
 78:   /* Register Classes */
 79:   PetscClassIdRegister("Eigenvalue Problem Solver",&EPS_CLASSID);
 80:   /* Register Constructors */
 81:   EPSRegisterAll();
 82:   /* Register Events */
 83:   PetscLogEventRegister("EPSSetUp",EPS_CLASSID,&EPS_SetUp);
 84:   PetscLogEventRegister("EPSSolve",EPS_CLASSID,&EPS_Solve);
 85:   /* Process info exclusions */
 86:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 87:   if (opt) {
 88:     PetscStrstr(logList,"eps",&className);
 89:     if (className) {
 90:       PetscInfoDeactivateClass(EPS_CLASSID);
 91:     }
 92:   }
 93:   /* Process summary exclusions */
 94:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 95:   if (opt) {
 96:     PetscStrstr(logList,"eps",&className);
 97:     if (className) {
 98:       PetscLogEventDeactivateClass(EPS_CLASSID);
 99:     }
100:   }
101:   PetscRegisterFinalize(EPSFinalizePackage);
102:   return(0);
103: }

107: /*@C
108:    EPSView - Prints the EPS data structure.

110:    Collective on EPS

112:    Input Parameters:
113: +  eps - the eigenproblem solver context
114: -  viewer - optional visualization context

116:    Options Database Key:
117: .  -eps_view -  Calls EPSView() at end of EPSSolve()

119:    Note:
120:    The available visualization contexts include
121: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
122: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
123:          output where only the first processor opens
124:          the file.  All other processors send their
125:          data to the first processor to print.

127:    The user can open an alternative visualization context with
128:    PetscViewerASCIIOpen() - output to a specified file.

130:    Level: beginner

132: .seealso: STView(), PetscViewerASCIIOpen()
133: @*/
134: PetscErrorCode EPSView(EPS eps,PetscViewer viewer)
135: {
137:   const char     *type,*extr,*bal;
138:   char           str[50];
139:   PetscBool      isascii,ispower,isexternal;

143:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps));

147: #if defined(PETSC_USE_COMPLEX)
148: #define HERM "hermitian"
149: #else
150: #define HERM "symmetric"
151: #endif
152:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
153:   if (isascii) {
154:     PetscObjectPrintClassNamePrefixType((PetscObject)eps,viewer,"EPS Object");
155:     if (eps->ops->view) {
156:       PetscViewerASCIIPushTab(viewer);
157:       (*eps->ops->view)(eps,viewer);
158:       PetscViewerASCIIPopTab(viewer);
159:     }
160:     if (eps->problem_type) {
161:       switch (eps->problem_type) {
162:         case EPS_HEP:   type = HERM " eigenvalue problem"; break;
163:         case EPS_GHEP:  type = "generalized " HERM " eigenvalue problem"; break;
164:         case EPS_NHEP:  type = "non-" HERM " eigenvalue problem"; break;
165:         case EPS_GNHEP: type = "generalized non-" HERM " eigenvalue problem"; break;
166:         case EPS_PGNHEP: type = "generalized non-" HERM " eigenvalue problem with " HERM " positive definite B"; break;
167:         case EPS_GHIEP: type = "generalized " HERM "-indefinite eigenvalue problem"; break;
168:         default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->problem_type");
169:       }
170:     } else type = "not yet set";
171:     PetscViewerASCIIPrintf(viewer,"  problem type: %s\n",type);
172:     if (eps->extraction) {
173:       switch (eps->extraction) {
174:         case EPS_RITZ:             extr = "Rayleigh-Ritz"; break;
175:         case EPS_HARMONIC:         extr = "harmonic Ritz"; break;
176:         case EPS_HARMONIC_RELATIVE:extr = "relative harmonic Ritz"; break;
177:         case EPS_HARMONIC_RIGHT:   extr = "right harmonic Ritz"; break;
178:         case EPS_HARMONIC_LARGEST: extr = "largest harmonic Ritz"; break;
179:         case EPS_REFINED:          extr = "refined Ritz"; break;
180:         case EPS_REFINED_HARMONIC: extr = "refined harmonic Ritz"; break;
181:         default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->extraction");
182:       }
183:       PetscViewerASCIIPrintf(viewer,"  extraction type: %s\n",extr);
184:     }
185:     if (eps->balance && !eps->ishermitian && eps->balance!=EPS_BALANCE_NONE) {
186:       switch (eps->balance) {
187:         case EPS_BALANCE_ONESIDE:   bal = "one-sided Krylov"; break;
188:         case EPS_BALANCE_TWOSIDE:   bal = "two-sided Krylov"; break;
189:         case EPS_BALANCE_USER:      bal = "user-defined matrix"; break;
190:         default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->balance");
191:       }
192:       PetscViewerASCIIPrintf(viewer,"  balancing enabled: %s",bal);
193:       if (eps->balance==EPS_BALANCE_ONESIDE || eps->balance==EPS_BALANCE_TWOSIDE) {
194:         PetscViewerASCIIPrintf(viewer,", with its=%D",eps->balance_its);
195:       }
196:       if (eps->balance==EPS_BALANCE_TWOSIDE && eps->balance_cutoff!=0.0) {
197:         PetscViewerASCIIPrintf(viewer," and cutoff=%G",eps->balance_cutoff);
198:       }
199:       PetscViewerASCIIPrintf(viewer,"\n");
200:     }
201:     PetscViewerASCIIPrintf(viewer,"  selected portion of the spectrum: ");
202:     SlepcSNPrintfScalar(str,50,eps->target,PETSC_FALSE);
203:     if (!eps->which) {
204:       PetscViewerASCIIPrintf(viewer,"not yet set\n");
205:     } else switch (eps->which) {
206:       case EPS_WHICH_USER:
207:         PetscViewerASCIIPrintf(viewer,"user defined\n");
208:         break;
209:       case EPS_TARGET_MAGNITUDE:
210:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (in magnitude)\n",str);
211:         break;
212:       case EPS_TARGET_REAL:
213:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the real axis)\n",str);
214:         break;
215:       case EPS_TARGET_IMAGINARY:
216:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the imaginary axis)\n",str);
217:         break;
218:       case EPS_LARGEST_MAGNITUDE:
219:         PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");
220:         break;
221:       case EPS_SMALLEST_MAGNITUDE:
222:         PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");
223:         break;
224:       case EPS_LARGEST_REAL:
225:         PetscViewerASCIIPrintf(viewer,"largest real parts\n");
226:         break;
227:       case EPS_SMALLEST_REAL:
228:         PetscViewerASCIIPrintf(viewer,"smallest real parts\n");
229:         break;
230:       case EPS_LARGEST_IMAGINARY:
231:         PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");
232:         break;
233:       case EPS_SMALLEST_IMAGINARY:
234:         PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");
235:         break;
236:       case EPS_ALL:
237:         PetscViewerASCIIPrintf(viewer,"all eigenvalues in interval [%G,%G]\n",eps->inta,eps->intb);
238:         break;
239:       default: SETERRQ(PetscObjectComm((PetscObject)eps),1,"Wrong value of eps->which");
240:     }
241:     if (eps->leftvecs) {
242:       PetscViewerASCIIPrintf(viewer,"  computing left eigenvectors also\n");
243:     }
244:     if (eps->trueres) {
245:       PetscViewerASCIIPrintf(viewer,"  computing true residuals explicitly\n");
246:     }
247:     if (eps->trackall) {
248:       PetscViewerASCIIPrintf(viewer,"  computing all residuals (for tracking convergence)\n");
249:     }
250:     PetscViewerASCIIPrintf(viewer,"  number of eigenvalues (nev): %D\n",eps->nev);
251:     PetscViewerASCIIPrintf(viewer,"  number of column vectors (ncv): %D\n",eps->ncv);
252:     PetscViewerASCIIPrintf(viewer,"  maximum dimension of projected problem (mpd): %D\n",eps->mpd);
253:     PetscViewerASCIIPrintf(viewer,"  maximum number of iterations: %D\n",eps->max_it);
254:     PetscViewerASCIIPrintf(viewer,"  tolerance: %G\n",eps->tol);
255:     PetscViewerASCIIPrintf(viewer,"  convergence test: ");
256:     switch (eps->conv) {
257:     case EPS_CONV_ABS:
258:       PetscViewerASCIIPrintf(viewer,"absolute\n");break;
259:     case EPS_CONV_EIG:
260:       PetscViewerASCIIPrintf(viewer,"relative to the eigenvalue\n");break;
261:     case EPS_CONV_NORM:
262:       PetscViewerASCIIPrintf(viewer,"relative to the eigenvalue and matrix norms\n");break;
263:     default:
264:       PetscViewerASCIIPrintf(viewer,"user-defined\n");break;
265:     }
266:     if (eps->nini) {
267:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial space: %D\n",PetscAbs(eps->nini));
268:     }
269:     if (eps->ninil) {
270:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial left space: %D\n",PetscAbs(eps->ninil));
271:     }
272:     if (eps->nds>0) {
273:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided deflation space: %D\n",eps->nds);
274:     }
275:     PetscViewerASCIIPrintf(viewer,"  estimates of matrix norms (%s): norm(A)=%G",eps->adaptive?"adaptive":"constant",eps->nrma);
276:     if (eps->isgeneralized) {
277:       PetscViewerASCIIPrintf(viewer,", norm(B)=%G",eps->nrmb);
278:     }
279:     PetscViewerASCIIPrintf(viewer,"\n");
280:   } else {
281:     if (eps->ops->view) {
282:       (*eps->ops->view)(eps,viewer);
283:     }
284:   }
285:   PetscObjectTypeCompareAny((PetscObject)eps,&isexternal,EPSARPACK,EPSBLZPACK,EPSTRLAN,EPSBLOPEX,EPSPRIMME,"");
286:   if (!isexternal) {
287:     if (!eps->ip) { EPSGetIP(eps,&eps->ip); }
288:     IPView(eps->ip,viewer);
289:     PetscObjectTypeCompare((PetscObject)eps,EPSPOWER,&ispower);
290:     if (!ispower) {
291:       if (!eps->ds) { EPSGetDS(eps,&eps->ds); }
292:       PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);
293:       DSView(eps->ds,viewer);
294:       PetscViewerPopFormat(viewer);
295:     }
296:   }
297:   if (!eps->st) { EPSGetST(eps,&eps->st); }
298:   STView(eps->st,viewer);
299:   return(0);
300: }

304: /*@
305:    EPSPrintSolution - Prints the computed eigenvalues.

307:    Collective on EPS

309:    Input Parameters:
310: +  eps - the eigensolver context
311: -  viewer - optional visualization context

313:    Options Database Key:
314: .  -eps_terse - print only minimal information

316:    Note:
317:    By default, this function prints a table with eigenvalues and associated
318:    relative errors. With -eps_terse only the eigenvalues are printed.

320:    Level: intermediate

322: .seealso: PetscViewerASCIIOpen()
323: @*/
324: PetscErrorCode EPSPrintSolution(EPS eps,PetscViewer viewer)
325: {
326:   PetscBool      terse,errok,isascii;
327:   PetscReal      error,re,im;
328:   PetscScalar    kr,ki;
329:   PetscInt       i,j;

334:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps));
337:   if (!eps->eigr || !eps->eigi || !eps->V) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONGSTATE,"EPSSolve must be called first");
338:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
339:   if (!isascii) return(0);

341:   PetscOptionsHasName(NULL,"-eps_terse",&terse);
342:   if (terse) {
343:     if (eps->nconv<eps->nev) {
344:       PetscViewerASCIIPrintf(viewer," Problem: less than %D eigenvalues converged\n\n",eps->nev);
345:     } else {
346:       errok = PETSC_TRUE;
347:       for (i=0;i<eps->nev;i++) {
348:         EPSComputeRelativeError(eps,i,&error);
349:         errok = (errok && error<eps->tol)? PETSC_TRUE: PETSC_FALSE;
350:       }
351:       if (errok) {
352:         PetscViewerASCIIPrintf(viewer," All requested eigenvalues computed up to the required tolerance:");
353:         for (i=0;i<=(eps->nev-1)/8;i++) {
354:           PetscViewerASCIIPrintf(viewer,"\n     ");
355:           for (j=0;j<PetscMin(8,eps->nev-8*i);j++) {
356:             EPSGetEigenpair(eps,8*i+j,&kr,&ki,NULL,NULL);
357: #if defined(PETSC_USE_COMPLEX)
358:             re = PetscRealPart(kr);
359:             im = PetscImaginaryPart(kr);
360: #else
361:             re = kr;
362:             im = ki;
363: #endif
364:             if (PetscAbs(re)/PetscAbs(im)<PETSC_SMALL) re = 0.0;
365:             if (PetscAbs(im)/PetscAbs(re)<PETSC_SMALL) im = 0.0;
366:             if (im!=0.0) {
367:               PetscViewerASCIIPrintf(viewer,"%.5F%+.5Fi",re,im);
368:             } else {
369:               PetscViewerASCIIPrintf(viewer,"%.5F",re);
370:             }
371:             if (8*i+j+1<eps->nev) { PetscViewerASCIIPrintf(viewer,", "); }
372:           }
373:         }
374:         PetscViewerASCIIPrintf(viewer,"\n\n");
375:       } else {
376:         PetscViewerASCIIPrintf(viewer," Problem: some of the first %D relative errors are higher than the tolerance\n\n",eps->nev);
377:       }
378:     }
379:   } else {
380:     PetscViewerASCIIPrintf(viewer," Number of converged approximate eigenpairs: %D\n\n",eps->nconv);
381:     if (eps->nconv>0) {
382:       PetscViewerASCIIPrintf(viewer,
383:            "           k          ||Ax-k%sx||/||kx||\n"
384:            "   ----------------- ------------------\n",eps->isgeneralized?"B":"");
385:       for (i=0;i<eps->nconv;i++) {
386:         EPSGetEigenpair(eps,i,&kr,&ki,NULL,NULL);
387:         EPSComputeRelativeError(eps,i,&error);
388: #if defined(PETSC_USE_COMPLEX)
389:         re = PetscRealPart(kr);
390:         im = PetscImaginaryPart(kr);
391: #else
392:         re = kr;
393:         im = ki;
394: #endif
395:         if (im!=0.0) {
396:           PetscViewerASCIIPrintf(viewer," % 9F%+9F i %12G\n",re,im,error);
397:         } else {
398:           PetscViewerASCIIPrintf(viewer,"   % 12F       %12G\n",re,error);
399:         }
400:       }
401:       PetscViewerASCIIPrintf(viewer,"\n");
402:     }
403:   }
404:   return(0);
405: }

409: /*@C
410:    EPSCreate - Creates the default EPS context.

412:    Collective on MPI_Comm

414:    Input Parameter:
415: .  comm - MPI communicator

417:    Output Parameter:
418: .  eps - location to put the EPS context

420:    Note:
421:    The default EPS type is EPSKRYLOVSCHUR

423:    Level: beginner

425: .seealso: EPSSetUp(), EPSSolve(), EPSDestroy(), EPS
426: @*/
427: PetscErrorCode EPSCreate(MPI_Comm comm,EPS *outeps)
428: {
430:   EPS            eps;

434:   *outeps = 0;
435: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
436:   EPSInitializePackage();
437: #endif

439:   SlepcHeaderCreate(eps,_p_EPS,struct _EPSOps,EPS_CLASSID,"EPS","Eigenvalue Problem Solver","EPS",comm,EPSDestroy,EPSView);

441:   eps->max_it          = 0;
442:   eps->nev             = 1;
443:   eps->ncv             = 0;
444:   eps->mpd             = 0;
445:   eps->allocated_ncv   = 0;
446:   eps->nini            = 0;
447:   eps->ninil           = 0;
448:   eps->nds             = 0;
449:   eps->tol             = PETSC_DEFAULT;
450:   eps->conv            = EPS_CONV_EIG;
451:   eps->converged       = EPSConvergedEigRelative;
452:   eps->convergedctx    = NULL;
453:   eps->which           = (EPSWhich)0;
454:   eps->comparison      = NULL;
455:   eps->comparisonctx   = NULL;
456:   eps->arbitrary       = NULL;
457:   eps->arbitraryctx    = NULL;
458:   eps->leftvecs        = PETSC_FALSE;
459:   eps->trueres         = PETSC_FALSE;
460:   eps->trackall        = PETSC_FALSE;
461:   eps->target          = 0.0;
462:   eps->inta            = 0.0;
463:   eps->intb            = 0.0;
464:   eps->evecsavailable  = PETSC_FALSE;
465:   eps->problem_type    = (EPSProblemType)0;
466:   eps->extraction      = (EPSExtraction)0;
467:   eps->balance         = (EPSBalance)0;
468:   eps->balance_its     = 5;
469:   eps->balance_cutoff  = 1e-8;
470:   eps->nrma            = 1.0;
471:   eps->nrmb            = 1.0;
472:   eps->adaptive        = PETSC_FALSE;

474:   eps->V               = 0;
475:   eps->W               = 0;
476:   eps->D               = 0;
477:   eps->defl            = 0;
478:   eps->IS              = 0;
479:   eps->ISL             = 0;
480:   eps->t               = 0;
481:   eps->ds_ortho        = PETSC_FALSE;
482:   eps->eigr            = 0;
483:   eps->eigi            = 0;
484:   eps->errest          = 0;
485:   eps->errest_left     = 0;
486:   eps->st              = 0;
487:   eps->ip              = 0;
488:   eps->ds              = 0;
489:   eps->rand            = 0;
490:   eps->data            = 0;
491:   eps->nconv           = 0;
492:   eps->its             = 0;
493:   eps->perm            = NULL;

495:   eps->nwork           = 0;
496:   eps->work            = 0;
497:   eps->isgeneralized   = PETSC_FALSE;
498:   eps->ishermitian     = PETSC_FALSE;
499:   eps->ispositive      = PETSC_FALSE;
500:   eps->setupcalled     = 0;
501:   eps->reason          = EPS_CONVERGED_ITERATING;
502:   eps->numbermonitors  = 0;

504:   PetscRandomCreate(comm,&eps->rand);
505:   PetscRandomSetSeed(eps->rand,0x12345678);
506:   PetscLogObjectParent(eps,eps->rand);
507:   *outeps = eps;
508:   return(0);
509: }

513: /*@C
514:    EPSSetType - Selects the particular solver to be used in the EPS object.

516:    Logically Collective on EPS

518:    Input Parameters:
519: +  eps  - the eigensolver context
520: -  type - a known method

522:    Options Database Key:
523: .  -eps_type <method> - Sets the method; use -help for a list
524:     of available methods

526:    Notes:
527:    See "slepc/include/slepceps.h" for available methods. The default
528:    is EPSKRYLOVSCHUR.

530:    Normally, it is best to use the EPSSetFromOptions() command and
531:    then set the EPS type from the options database rather than by using
532:    this routine.  Using the options database provides the user with
533:    maximum flexibility in evaluating the different available methods.
534:    The EPSSetType() routine is provided for those situations where it
535:    is necessary to set the iterative solver independently of the command
536:    line or options database.

538:    Level: intermediate

540: .seealso: STSetType(), EPSType
541: @*/
542: PetscErrorCode EPSSetType(EPS eps,EPSType type)
543: {
544:   PetscErrorCode ierr,(*r)(EPS);
545:   PetscBool      match;


551:   PetscObjectTypeCompare((PetscObject)eps,type,&match);
552:   if (match) return(0);

554:   PetscFunctionListFind(EPSList,type,&r);
555:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown EPS type given: %s",type);

557:   if (eps->ops->destroy) { (*eps->ops->destroy)(eps); }
558:   PetscMemzero(eps->ops,sizeof(struct _EPSOps));

560:   eps->setupcalled = 0;
561:   PetscObjectChangeTypeName((PetscObject)eps,type);
562:   (*r)(eps);
563:   return(0);
564: }

568: /*@C
569:    EPSGetType - Gets the EPS type as a string from the EPS object.

571:    Not Collective

573:    Input Parameter:
574: .  eps - the eigensolver context

576:    Output Parameter:
577: .  name - name of EPS method

579:    Level: intermediate

581: .seealso: EPSSetType()
582: @*/
583: PetscErrorCode EPSGetType(EPS eps,EPSType *type)
584: {
588:   *type = ((PetscObject)eps)->type_name;
589:   return(0);
590: }

594: /*@C
595:    EPSRegister - Adds a method to the eigenproblem solver package.

597:    Not Collective

599:    Input Parameters:
600: +  name - name of a new user-defined solver
601: -  function - routine to create the solver context

603:    Notes:
604:    EPSRegister() may be called multiple times to add several user-defined solvers.

606:    Sample usage:
607: .vb
608:    EPSRegister("my_solver",MySolverCreate);
609: .ve

611:    Then, your solver can be chosen with the procedural interface via
612: $     EPSSetType(eps,"my_solver")
613:    or at runtime via the option
614: $     -eps_type my_solver

616:    Level: advanced

618: .seealso: EPSRegisterAll()
619: @*/
620: PetscErrorCode EPSRegister(const char *name,PetscErrorCode (*function)(EPS))
621: {

625:   PetscFunctionListAdd(&EPSList,name,function);
626:   return(0);
627: }

631: /*@
632:    EPSReset - Resets the EPS context to the setupcalled=0 state and removes any
633:    allocated objects.

635:    Collective on EPS

637:    Input Parameter:
638: .  eps - eigensolver context obtained from EPSCreate()

640:    Level: advanced

642: .seealso: EPSDestroy()
643: @*/
644: PetscErrorCode EPSReset(EPS eps)
645: {

650:   if (eps->ops->reset) { (eps->ops->reset)(eps); }
651:   if (eps->st) { STReset(eps->st); }
652:   if (eps->ip) { IPReset(eps->ip); }
653:   if (eps->ds) { DSReset(eps->ds); }
654:   VecDestroy(&eps->t);
655:   VecDestroy(&eps->D);
656:   eps->setupcalled = 0;
657:   return(0);
658: }

662: /*@C
663:    EPSDestroy - Destroys the EPS context.

665:    Collective on EPS

667:    Input Parameter:
668: .  eps - eigensolver context obtained from EPSCreate()

670:    Level: beginner

672: .seealso: EPSCreate(), EPSSetUp(), EPSSolve()
673: @*/
674: PetscErrorCode EPSDestroy(EPS *eps)
675: {

679:   if (!*eps) return(0);
681:   if (--((PetscObject)(*eps))->refct > 0) { *eps = 0; return(0); }
682:   EPSReset(*eps);
683:   if ((*eps)->ops->destroy) { (*(*eps)->ops->destroy)(*eps); }
684:   STDestroy(&(*eps)->st);
685:   IPDestroy(&(*eps)->ip);
686:   DSDestroy(&(*eps)->ds);
687:   PetscRandomDestroy(&(*eps)->rand);
688:   /* just in case the initial vectors have not been used */
689:   SlepcBasisDestroy_Private(&(*eps)->nini,&(*eps)->IS);
690:   SlepcBasisDestroy_Private(&(*eps)->ninil,&(*eps)->ISL);
691:   EPSRemoveDeflationSpace(*eps);
692:   EPSMonitorCancel(*eps);
693:   PetscHeaderDestroy(eps);
694:   return(0);
695: }

699: /*@
700:    EPSSetTarget - Sets the value of the target.

702:    Logically Collective on EPS

704:    Input Parameters:
705: +  eps    - eigensolver context
706: -  target - the value of the target

708:    Notes:
709:    The target is a scalar value used to determine the portion of the spectrum
710:    of interest. It is used in combination with EPSSetWhichEigenpairs().

712:    Level: beginner

714: .seealso: EPSGetTarget(), EPSSetWhichEigenpairs()
715: @*/
716: PetscErrorCode EPSSetTarget(EPS eps,PetscScalar target)
717: {

723:   eps->target = target;
724:   if (!eps->st) { EPSGetST(eps,&eps->st); }
725:   STSetDefaultShift(eps->st,target);
726:   return(0);
727: }

731: /*@
732:    EPSGetTarget - Gets the value of the target.

734:    Not Collective

736:    Input Parameter:
737: .  eps - eigensolver context

739:    Output Parameter:
740: .  target - the value of the target

742:    Level: beginner

744:    Note:
745:    If the target was not set by the user, then zero is returned.

747: .seealso: EPSSetTarget()
748: @*/
749: PetscErrorCode EPSGetTarget(EPS eps,PetscScalar* target)
750: {
754:   *target = eps->target;
755:   return(0);
756: }

760: /*@
761:    EPSSetInterval - Defines the computational interval for spectrum slicing.

763:    Logically Collective on EPS

765:    Input Parameters:
766: +  eps  - eigensolver context
767: .  inta - left end of the interval
768: -  intb - right end of the interval

770:    Options Database Key:
771: .  -eps_interval <a,b> - set [a,b] as the interval of interest

773:    Notes:
774:    Spectrum slicing is a technique employed for computing all eigenvalues of
775:    symmetric eigenproblems in a given interval. This function provides the
776:    interval to be considered. It must be used in combination with EPS_ALL, see
777:    EPSSetWhichEigenpairs().

779:    In the command-line option, two values must be provided. For an open interval,
780:    one can give an infinite, e.g., -eps_interval 1.0,inf or -eps_interval -inf,1.0.
781:    An open interval in the programmatic interface can be specified with
782:    PETSC_MAX_REAL and -PETSC_MAX_REAL.

784:    Level: intermediate

786: .seealso: EPSGetInterval(), EPSSetWhichEigenpairs()
787: @*/
788: PetscErrorCode EPSSetInterval(EPS eps,PetscReal inta,PetscReal intb)
789: {
794:   if (inta>=intb) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Badly defined interval, must be inta<intb");
795:   eps->inta = inta;
796:   eps->intb = intb;
797:   return(0);
798: }

802: /*@
803:    EPSGetInterval - Gets the computational interval for spectrum slicing.

805:    Not Collective

807:    Input Parameter:
808: .  eps - eigensolver context

810:    Output Parameters:
811: +  inta - left end of the interval
812: -  intb - right end of the interval

814:    Level: intermediate

816:    Note:
817:    If the interval was not set by the user, then zeros are returned.

819: .seealso: EPSSetInterval()
820: @*/
821: PetscErrorCode EPSGetInterval(EPS eps,PetscReal* inta,PetscReal* intb)
822: {
827:   if (inta) *inta = eps->inta;
828:   if (intb) *intb = eps->intb;
829:   return(0);
830: }

834: /*@
835:    EPSSetST - Associates a spectral transformation object to the eigensolver.

837:    Collective on EPS

839:    Input Parameters:
840: +  eps - eigensolver context obtained from EPSCreate()
841: -  st   - the spectral transformation object

843:    Note:
844:    Use EPSGetST() to retrieve the spectral transformation context (for example,
845:    to free it at the end of the computations).

847:    Level: developer

849: .seealso: EPSGetST()
850: @*/
851: PetscErrorCode EPSSetST(EPS eps,ST st)
852: {

859:   PetscObjectReference((PetscObject)st);
860:   STDestroy(&eps->st);
861:   eps->st = st;
862:   PetscLogObjectParent(eps,eps->st);
863:   return(0);
864: }

868: /*@C
869:    EPSGetST - Obtain the spectral transformation (ST) object associated
870:    to the eigensolver object.

872:    Not Collective

874:    Input Parameters:
875: .  eps - eigensolver context obtained from EPSCreate()

877:    Output Parameter:
878: .  st - spectral transformation context

880:    Level: beginner

882: .seealso: EPSSetST()
883: @*/
884: PetscErrorCode EPSGetST(EPS eps,ST *st)
885: {

891:   if (!eps->st) {
892:     STCreate(PetscObjectComm((PetscObject)eps),&eps->st);
893:     PetscLogObjectParent(eps,eps->st);
894:   }
895:   *st = eps->st;
896:   return(0);
897: }

901: /*@
902:    EPSSetIP - Associates an inner product object to the eigensolver.

904:    Collective on EPS

906:    Input Parameters:
907: +  eps - eigensolver context obtained from EPSCreate()
908: -  ip  - the inner product object

910:    Note:
911:    Use EPSGetIP() to retrieve the inner product context (for example,
912:    to free it at the end of the computations).

914:    Level: advanced

916: .seealso: EPSGetIP()
917: @*/
918: PetscErrorCode EPSSetIP(EPS eps,IP ip)
919: {

926:   PetscObjectReference((PetscObject)ip);
927:   IPDestroy(&eps->ip);
928:   eps->ip = ip;
929:   PetscLogObjectParent(eps,eps->ip);
930:   return(0);
931: }

935: /*@C
936:    EPSGetIP - Obtain the inner product object associated to the eigensolver object.

938:    Not Collective

940:    Input Parameters:
941: .  eps - eigensolver context obtained from EPSCreate()

943:    Output Parameter:
944: .  ip - inner product context

946:    Level: advanced

948: .seealso: EPSSetIP()
949: @*/
950: PetscErrorCode EPSGetIP(EPS eps,IP *ip)
951: {

957:   if (!eps->ip) {
958:     IPCreate(PetscObjectComm((PetscObject)eps),&eps->ip);
959:     PetscLogObjectParent(eps,eps->ip);
960:   }
961:   *ip = eps->ip;
962:   return(0);
963: }

967: /*@
968:    EPSSetDS - Associates a direct solver object to the eigensolver.

970:    Collective on EPS

972:    Input Parameters:
973: +  eps - eigensolver context obtained from EPSCreate()
974: -  ds  - the direct solver object

976:    Note:
977:    Use EPSGetDS() to retrieve the direct solver context (for example,
978:    to free it at the end of the computations).

980:    Level: advanced

982: .seealso: EPSGetDS()
983: @*/
984: PetscErrorCode EPSSetDS(EPS eps,DS ds)
985: {

992:   PetscObjectReference((PetscObject)ds);
993:   DSDestroy(&eps->ds);
994:   eps->ds = ds;
995:   PetscLogObjectParent(eps,eps->ds);
996:   return(0);
997: }

1001: /*@C
1002:    EPSGetDS - Obtain the direct solver object associated to the eigensolver object.

1004:    Not Collective

1006:    Input Parameters:
1007: .  eps - eigensolver context obtained from EPSCreate()

1009:    Output Parameter:
1010: .  ds - direct solver context

1012:    Level: advanced

1014: .seealso: EPSSetDS()
1015: @*/
1016: PetscErrorCode EPSGetDS(EPS eps,DS *ds)
1017: {

1023:   if (!eps->ds) {
1024:     DSCreate(PetscObjectComm((PetscObject)eps),&eps->ds);
1025:     PetscLogObjectParent(eps,eps->ds);
1026:   }
1027:   *ds = eps->ds;
1028:   return(0);
1029: }

1033: /*@
1034:    EPSIsGeneralized - Ask if the EPS object corresponds to a generalized
1035:    eigenvalue problem.

1037:    Not collective

1039:    Input Parameter:
1040: .  eps - the eigenproblem solver context

1042:    Output Parameter:
1043: .  is - the answer

1045:    Level: intermediate

1047: .seealso: EPSIsHermitian(), EPSIsPositive()
1048: @*/
1049: PetscErrorCode EPSIsGeneralized(EPS eps,PetscBool* is)
1050: {
1054:   *is = eps->isgeneralized;
1055:   return(0);
1056: }

1060: /*@
1061:    EPSIsHermitian - Ask if the EPS object corresponds to a Hermitian
1062:    eigenvalue problem.

1064:    Not collective

1066:    Input Parameter:
1067: .  eps - the eigenproblem solver context

1069:    Output Parameter:
1070: .  is - the answer

1072:    Level: intermediate

1074: .seealso: EPSIsGeneralized(), EPSIsPositive()
1075: @*/
1076: PetscErrorCode EPSIsHermitian(EPS eps,PetscBool* is)
1077: {
1081:   *is = eps->ishermitian;
1082:   return(0);
1083: }

1087: /*@
1088:    EPSIsPositive - Ask if the EPS object corresponds to an eigenvalue
1089:    problem type that requires a positive (semi-) definite matrix B.

1091:    Not collective

1093:    Input Parameter:
1094: .  eps - the eigenproblem solver context

1096:    Output Parameter:
1097: .  is - the answer

1099:    Level: intermediate

1101: .seealso: EPSIsGeneralized(), EPSIsHermitian()
1102: @*/
1103: PetscErrorCode EPSIsPositive(EPS eps,PetscBool* is)
1104: {
1108:   *is = eps->ispositive;
1109:   return(0);
1110: }
slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/0000755000175000017500000000000012214143515020506 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/optsf.c0000644000175000017500000001646112211062077022015 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* opts.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetfromoptions_ EPSSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetfromoptions_ epssetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgettolerances_ EPSGETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgettolerances_ epsgettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssettolerances_ EPSSETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssettolerances_ epssettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetdimensions_ EPSGETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetdimensions_ epsgetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetdimensions_ EPSSETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetdimensions_ epssetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetwhicheigenpairs_ EPSSETWHICHEIGENPAIRS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetwhicheigenpairs_ epssetwhicheigenpairs #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetleftvectorswanted_ EPSSETLEFTVECTORSWANTED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetleftvectorswanted_ epssetleftvectorswanted #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetleftvectorswanted_ EPSGETLEFTVECTORSWANTED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetleftvectorswanted_ epsgetleftvectorswanted #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetmatrixnorms_ EPSSETMATRIXNORMS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetmatrixnorms_ epssetmatrixnorms #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetmatrixnorms_ EPSGETMATRIXNORMS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetmatrixnorms_ epsgetmatrixnorms #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetconvergencetest_ EPSSETCONVERGENCETEST #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetconvergencetest_ epssetconvergencetest #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetconvergencetest_ EPSGETCONVERGENCETEST #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetconvergencetest_ epsgetconvergencetest #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetproblemtype_ EPSSETPROBLEMTYPE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetproblemtype_ epssetproblemtype #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetextraction_ EPSSETEXTRACTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetextraction_ epssetextraction #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetbalance_ EPSSETBALANCE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetbalance_ epssetbalance #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetbalance_ EPSGETBALANCE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetbalance_ epsgetbalance #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssettrueresidual_ EPSSETTRUERESIDUAL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssettrueresidual_ epssettrueresidual #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssettrackall_ EPSSETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssettrackall_ epssettrackall #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgettrackall_ EPSGETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgettrackall_ epsgettrackall #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epssetfromoptions_(EPS *eps, int *__ierr ){ *__ierr = EPSSetFromOptions(*eps); } void PETSC_STDCALL epsgettolerances_(EPS *eps,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = EPSGetTolerances(*eps,tol,maxits); } void PETSC_STDCALL epssettolerances_(EPS *eps,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = EPSSetTolerances(*eps,*tol,*maxits); } void PETSC_STDCALL epsgetdimensions_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = EPSGetDimensions(*eps,nev,ncv,mpd); } void PETSC_STDCALL epssetdimensions_(EPS *eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = EPSSetDimensions(*eps,*nev,*ncv,*mpd); } void PETSC_STDCALL epssetwhicheigenpairs_(EPS *eps,EPSWhich *which, int *__ierr ){ *__ierr = EPSSetWhichEigenpairs(*eps,*which); } void PETSC_STDCALL epssetleftvectorswanted_(EPS *eps,PetscBool *leftvecs, int *__ierr ){ *__ierr = EPSSetLeftVectorsWanted(*eps,*leftvecs); } void PETSC_STDCALL epsgetleftvectorswanted_(EPS *eps,PetscBool *leftvecs, int *__ierr ){ *__ierr = EPSGetLeftVectorsWanted(*eps,leftvecs); } void PETSC_STDCALL epssetmatrixnorms_(EPS *eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive, int *__ierr ){ *__ierr = EPSSetMatrixNorms(*eps,*nrma,*nrmb,*adaptive); } void PETSC_STDCALL epsgetmatrixnorms_(EPS *eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive, int *__ierr ){ *__ierr = EPSGetMatrixNorms(*eps,nrma,nrmb,adaptive); } void PETSC_STDCALL epssetconvergencetest_(EPS *eps,EPSConv *conv, int *__ierr ){ *__ierr = EPSSetConvergenceTest(*eps,*conv); } void PETSC_STDCALL epsgetconvergencetest_(EPS *eps,EPSConv *conv, int *__ierr ){ *__ierr = EPSGetConvergenceTest(*eps, (EPSConv* )PetscToPointer((conv) )); } void PETSC_STDCALL epssetproblemtype_(EPS *eps,EPSProblemType *type, int *__ierr ){ *__ierr = EPSSetProblemType(*eps,*type); } void PETSC_STDCALL epssetextraction_(EPS *eps,EPSExtraction *extr, int *__ierr ){ *__ierr = EPSSetExtraction(*eps,*extr); } void PETSC_STDCALL epssetbalance_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff, int *__ierr ){ *__ierr = EPSSetBalance(*eps,*bal,*its,*cutoff); } void PETSC_STDCALL epsgetbalance_(EPS *eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff, int *__ierr ){ *__ierr = EPSGetBalance(*eps, (EPSBalance* )PetscToPointer((bal) ),its,cutoff); } void PETSC_STDCALL epssettrueresidual_(EPS *eps,PetscBool *trueres, int *__ierr ){ *__ierr = EPSSetTrueResidual(*eps,*trueres); } void PETSC_STDCALL epssettrackall_(EPS *eps,PetscBool *trackall, int *__ierr ){ *__ierr = EPSSetTrackAll(*eps,*trackall); } void PETSC_STDCALL epsgettrackall_(EPS *eps,PetscBool *trackall, int *__ierr ){ *__ierr = EPSGetTrackAll(*eps,trackall); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/monitorf.c0000644000175000017500000000177112211062077022515 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* monitor.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsmonitorcancel_ EPSMONITORCANCEL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsmonitorcancel_ epsmonitorcancel #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsmonitorcancel_(EPS *eps, int *__ierr ){ *__ierr = EPSMonitorCancel(*eps); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/makefile0000644000175000017500000000042012211062077022202 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = basicf.c defaultf.c monitorf.c optsf.c setupf.c solvef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/eps/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/setupf.c0000644000175000017500000000527512211062077022171 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* setup.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetup_ EPSSETUP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetup_ epssetup #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetoperators_ EPSSETOPERATORS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetoperators_ epssetoperators #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetdeflationspace_ EPSSETDEFLATIONSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetdeflationspace_ epssetdeflationspace #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsremovedeflationspace_ EPSREMOVEDEFLATIONSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsremovedeflationspace_ epsremovedeflationspace #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetinitialspace_ EPSSETINITIALSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetinitialspace_ epssetinitialspace #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetinitialspaceleft_ EPSSETINITIALSPACELEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetinitialspaceleft_ epssetinitialspaceleft #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epssetup_(EPS *eps, int *__ierr ){ *__ierr = EPSSetUp(*eps); } void PETSC_STDCALL epssetoperators_(EPS *eps,Mat A,Mat B, int *__ierr ){ *__ierr = EPSSetOperators(*eps, (Mat)PetscToPointer((A) ), (Mat)PetscToPointer((B) )); } void PETSC_STDCALL epssetdeflationspace_(EPS *eps,PetscInt *n,Vec *v, int *__ierr ){ *__ierr = EPSSetDeflationSpace(*eps,*n,v); } void PETSC_STDCALL epsremovedeflationspace_(EPS *eps, int *__ierr ){ *__ierr = EPSRemoveDeflationSpace(*eps); } void PETSC_STDCALL epssetinitialspace_(EPS *eps,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = EPSSetInitialSpace(*eps,*n,is); } void PETSC_STDCALL epssetinitialspaceleft_(EPS *eps,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = EPSSetInitialSpaceLeft(*eps,*n,is); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/solvef.c0000644000175000017500000002031012211062077022144 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* solve.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssolve_ EPSSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssolve_ epssolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetiterationnumber_ EPSGETITERATIONNUMBER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetiterationnumber_ epsgetiterationnumber #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetoperationcounters_ EPSGETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetoperationcounters_ epsgetoperationcounters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetconverged_ EPSGETCONVERGED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetconverged_ epsgetconverged #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetinvariantsubspace_ EPSGETINVARIANTSUBSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetinvariantsubspace_ epsgetinvariantsubspace #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetinvariantsubspaceleft_ EPSGETINVARIANTSUBSPACELEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetinvariantsubspaceleft_ epsgetinvariantsubspaceleft #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgeteigenpair_ EPSGETEIGENPAIR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgeteigenpair_ epsgeteigenpair #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgeteigenvalue_ EPSGETEIGENVALUE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgeteigenvalue_ epsgeteigenvalue #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgeteigenvector_ EPSGETEIGENVECTOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgeteigenvector_ epsgeteigenvector #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgeteigenvectorleft_ EPSGETEIGENVECTORLEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgeteigenvectorleft_ epsgeteigenvectorleft #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgeterrorestimate_ EPSGETERRORESTIMATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgeterrorestimate_ epsgeterrorestimate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgeterrorestimateleft_ EPSGETERRORESTIMATELEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgeterrorestimateleft_ epsgeterrorestimateleft #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscomputeresidualnorm_ EPSCOMPUTERESIDUALNORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscomputeresidualnorm_ epscomputeresidualnorm #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscomputeresidualnormleft_ EPSCOMPUTERESIDUALNORMLEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscomputeresidualnormleft_ epscomputeresidualnormleft #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscomputerelativeerror_ EPSCOMPUTERELATIVEERROR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscomputerelativeerror_ epscomputerelativeerror #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscomputerelativeerrorleft_ EPSCOMPUTERELATIVEERRORLEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscomputerelativeerrorleft_ epscomputerelativeerrorleft #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssorteigenvalues_ EPSSORTEIGENVALUES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssorteigenvalues_ epssorteigenvalues #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epscompareeigenvalues_ EPSCOMPAREEIGENVALUES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epscompareeigenvalues_ epscompareeigenvalues #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetstartvector_ EPSGETSTARTVECTOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetstartvector_ epsgetstartvector #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetstartvectorleft_ EPSGETSTARTVECTORLEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetstartvectorleft_ epsgetstartvectorleft #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epssolve_(EPS *eps, int *__ierr ){ *__ierr = EPSSolve(*eps); } void PETSC_STDCALL epsgetiterationnumber_(EPS *eps,PetscInt *its, int *__ierr ){ *__ierr = EPSGetIterationNumber(*eps,its); } void PETSC_STDCALL epsgetoperationcounters_(EPS *eps,PetscInt* ops,PetscInt* dots,PetscInt* lits, int *__ierr ){ *__ierr = EPSGetOperationCounters(*eps,ops,dots,lits); } void PETSC_STDCALL epsgetconverged_(EPS *eps,PetscInt *nconv, int *__ierr ){ *__ierr = EPSGetConverged(*eps,nconv); } void PETSC_STDCALL epsgetinvariantsubspace_(EPS *eps,Vec *v, int *__ierr ){ *__ierr = EPSGetInvariantSubspace(*eps,v); } void PETSC_STDCALL epsgetinvariantsubspaceleft_(EPS *eps,Vec *v, int *__ierr ){ *__ierr = EPSGetInvariantSubspaceLeft(*eps,v); } void PETSC_STDCALL epsgeteigenpair_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi, int *__ierr ){ *__ierr = EPSGetEigenpair(*eps,*i,eigr,eigi, (Vec)PetscToPointer((Vr) ), (Vec)PetscToPointer((Vi) )); } void PETSC_STDCALL epsgeteigenvalue_(EPS *eps,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi, int *__ierr ){ *__ierr = EPSGetEigenvalue(*eps,*i,eigr,eigi); } void PETSC_STDCALL epsgeteigenvector_(EPS *eps,PetscInt *i,Vec Vr,Vec Vi, int *__ierr ){ *__ierr = EPSGetEigenvector(*eps,*i, (Vec)PetscToPointer((Vr) ), (Vec)PetscToPointer((Vi) )); } void PETSC_STDCALL epsgeteigenvectorleft_(EPS *eps,PetscInt *i,Vec Wr,Vec Wi, int *__ierr ){ *__ierr = EPSGetEigenvectorLeft(*eps,*i, (Vec)PetscToPointer((Wr) ), (Vec)PetscToPointer((Wi) )); } void PETSC_STDCALL epsgeterrorestimate_(EPS *eps,PetscInt *i,PetscReal *errest, int *__ierr ){ *__ierr = EPSGetErrorEstimate(*eps,*i,errest); } void PETSC_STDCALL epsgeterrorestimateleft_(EPS *eps,PetscInt *i,PetscReal *errest, int *__ierr ){ *__ierr = EPSGetErrorEstimateLeft(*eps,*i,errest); } void PETSC_STDCALL epscomputeresidualnorm_(EPS *eps,PetscInt *i,PetscReal *norm, int *__ierr ){ *__ierr = EPSComputeResidualNorm(*eps,*i,norm); } void PETSC_STDCALL epscomputeresidualnormleft_(EPS *eps,PetscInt *i,PetscReal *norm, int *__ierr ){ *__ierr = EPSComputeResidualNormLeft(*eps,*i,norm); } void PETSC_STDCALL epscomputerelativeerror_(EPS *eps,PetscInt *i,PetscReal *error, int *__ierr ){ *__ierr = EPSComputeRelativeError(*eps,*i,error); } void PETSC_STDCALL epscomputerelativeerrorleft_(EPS *eps,PetscInt *i,PetscReal *error, int *__ierr ){ *__ierr = EPSComputeRelativeErrorLeft(*eps,*i,error); } void PETSC_STDCALL epssorteigenvalues_(EPS *eps,PetscInt *n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm, int *__ierr ){ *__ierr = EPSSortEigenvalues(*eps,*n,eigr,eigi,perm); } void PETSC_STDCALL epscompareeigenvalues_(EPS *eps,PetscScalar *ar,PetscScalar *ai,PetscScalar *br,PetscScalar *bi,PetscInt *result, int *__ierr ){ *__ierr = EPSCompareEigenvalues(*eps,*ar,*ai,*br,*bi,result); } void PETSC_STDCALL epsgetstartvector_(EPS *eps,PetscInt *i,Vec vec,PetscBool *breakdown, int *__ierr ){ *__ierr = EPSGetStartVector(*eps,*i, (Vec)PetscToPointer((vec) ),breakdown); } void PETSC_STDCALL epsgetstartvectorleft_(EPS *eps,PetscInt *i,Vec vec,PetscBool *breakdown, int *__ierr ){ *__ierr = EPSGetStartVectorLeft(*eps,*i, (Vec)PetscToPointer((vec) ),breakdown); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/basicf.c0000644000175000017500000001042412211062077022102 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* basic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsprintsolution_ EPSPRINTSOLUTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsprintsolution_ epsprintsolution #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsreset_ EPSRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsreset_ epsreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssettarget_ EPSSETTARGET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssettarget_ epssettarget #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgettarget_ EPSGETTARGET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgettarget_ epsgettarget #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetinterval_ EPSSETINTERVAL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetinterval_ epssetinterval #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsgetinterval_ EPSGETINTERVAL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsgetinterval_ epsgetinterval #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetst_ EPSSETST #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetst_ epssetst #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetip_ EPSSETIP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetip_ epssetip #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetds_ EPSSETDS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetds_ epssetds #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsisgeneralized_ EPSISGENERALIZED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsisgeneralized_ epsisgeneralized #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsishermitian_ EPSISHERMITIAN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsishermitian_ epsishermitian #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define epsispositive_ EPSISPOSITIVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epsispositive_ epsispositive #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epsprintsolution_(EPS *eps,PetscViewer viewer, int *__ierr ){ *__ierr = EPSPrintSolution(*eps, (PetscViewer)PetscToPointer((viewer) )); } void PETSC_STDCALL epsreset_(EPS *eps, int *__ierr ){ *__ierr = EPSReset(*eps); } void PETSC_STDCALL epssettarget_(EPS *eps,PetscScalar *target, int *__ierr ){ *__ierr = EPSSetTarget(*eps,*target); } void PETSC_STDCALL epsgettarget_(EPS *eps,PetscScalar* target, int *__ierr ){ *__ierr = EPSGetTarget(*eps,target); } void PETSC_STDCALL epssetinterval_(EPS *eps,PetscReal *inta,PetscReal *intb, int *__ierr ){ *__ierr = EPSSetInterval(*eps,*inta,*intb); } void PETSC_STDCALL epsgetinterval_(EPS *eps,PetscReal* inta,PetscReal* intb, int *__ierr ){ *__ierr = EPSGetInterval(*eps,inta,intb); } void PETSC_STDCALL epssetst_(EPS *eps,ST *st, int *__ierr ){ *__ierr = EPSSetST(*eps,*st); } void PETSC_STDCALL epssetip_(EPS *eps,IP *ip, int *__ierr ){ *__ierr = EPSSetIP(*eps,*ip); } void PETSC_STDCALL epssetds_(EPS *eps,DS *ds, int *__ierr ){ *__ierr = EPSSetDS(*eps,*ds); } void PETSC_STDCALL epsisgeneralized_(EPS *eps,PetscBool* is, int *__ierr ){ *__ierr = EPSIsGeneralized(*eps,is); } void PETSC_STDCALL epsishermitian_(EPS *eps,PetscBool* is, int *__ierr ){ *__ierr = EPSIsHermitian(*eps,is); } void PETSC_STDCALL epsispositive_(EPS *eps,PetscBool* is, int *__ierr ){ *__ierr = EPSIsPositive(*eps,is); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/interface/ftn-auto/defaultf.c0000644000175000017500000000177612211062077022457 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* default.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define epssetworkvecs_ EPSSETWORKVECS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define epssetworkvecs_ epssetworkvecs #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL epssetworkvecs_(EPS *eps,PetscInt *nw, int *__ierr ){ *__ierr = EPSSetWorkVecs(*eps,*nw); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/eps/interface/default.c.html0000644000175000017500000007363312211062077021520 0ustar gladkgladk
Actual source code: default.c

  1: /*
  2:      This file contains some simple default routines for common operations.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>   /*I "slepceps.h" I*/
 25: #include <slepcblaslapack.h>

 29: PetscErrorCode EPSReset_Default(EPS eps)
 30: {

 34:   VecDestroyVecs(eps->nwork,&eps->work);
 35:   eps->nwork = 0;
 36:   EPSFreeSolution(eps);
 37:   return(0);
 38: }

 42: PetscErrorCode EPSBackTransform_Default(EPS eps)
 43: {

 47:   STBackTransform(eps->st,eps->nconv,eps->eigr,eps->eigi);
 48:   return(0);
 49: }

 53: /*
 54:   EPSComputeVectors_Default - Compute eigenvectors from the vectors
 55:   provided by the eigensolver. This version just copies the vectors
 56:   and is intended for solvers such as power that provide the eigenvector.
 57:  */
 58: PetscErrorCode EPSComputeVectors_Default(EPS eps)
 59: {
 61:   eps->evecsavailable = PETSC_TRUE;
 62:   return(0);
 63: }

 67: /*
 68:   EPSComputeVectors_Hermitian - Copies the Lanczos vectors as eigenvectors
 69:   using purification for generalized eigenproblems.
 70:  */
 71: PetscErrorCode EPSComputeVectors_Hermitian(EPS eps)
 72: {
 74:   PetscInt       i;
 75:   PetscReal      norm;
 76:   Vec            w;

 79:   if (eps->isgeneralized) {
 80:     /* Purify eigenvectors */
 81:     VecDuplicate(eps->V[0],&w);
 82:     for (i=0;i<eps->nconv;i++) {
 83:       VecCopy(eps->V[i],w);
 84:       STApply(eps->st,w,eps->V[i]);
 85:       IPNorm(eps->ip,eps->V[i],&norm);
 86:       VecScale(eps->V[i],1.0/norm);
 87:     }
 88:     VecDestroy(&w);
 89:   }
 90:   eps->evecsavailable = PETSC_TRUE;
 91:   return(0);
 92: }

 96: /*
 97:   EPSComputeVectors_Indefinite - similar to the Schur version but
 98:   for indefinite problems
 99:  */
100: PetscErrorCode EPSComputeVectors_Indefinite(EPS eps)
101: {
103:   PetscInt       n,ld,i;
104:   PetscScalar    *Z;
105:   Vec            v;
106: #if !defined(PETSC_USE_COMPLEX)
107:   PetscScalar    tmp;
108:   PetscReal      norm,normi;
109: #endif

112:   DSGetLeadingDimension(eps->ds,&ld);
113:   DSGetDimensions(eps->ds,&n,NULL,NULL,NULL,NULL);
114:   DSVectors(eps->ds,DS_MAT_X,NULL,NULL);
115:   DSGetArray(eps->ds,DS_MAT_X,&Z);
116:   SlepcUpdateVectors(n,eps->V,0,n,Z,ld,PETSC_FALSE);
117:   DSRestoreArray(eps->ds,DS_MAT_X,&Z);
118:   /* purification */
119:   VecDuplicate(eps->V[0],&v);
120:   for (i=0;i<eps->nconv;i++) {
121:     VecCopy(eps->V[i],v);
122:     STApply(eps->st,v,eps->V[i]);
123:   }
124:   VecDestroy(&v);
125:   /* normalization */
126:   for (i=0;i<n;i++) {
127: #if !defined(PETSC_USE_COMPLEX)
128:     if (eps->eigi[i] != 0.0) {
129:       VecNorm(eps->V[i],NORM_2,&norm);
130:       VecNorm(eps->V[i+1],NORM_2,&normi);
131:       tmp = 1.0 / SlepcAbsEigenvalue(norm,normi);
132:       VecScale(eps->V[i],tmp);
133:       VecScale(eps->V[i+1],tmp);
134:       i++;
135:     } else
136: #endif
137:     {
138:       VecNormalize(eps->V[i],NULL);
139:     }
140:   }
141:   eps->evecsavailable = PETSC_TRUE;
142:   return(0);
143: }

147: /*
148:   EPSComputeVectors_Schur - Compute eigenvectors from the vectors
149:   provided by the eigensolver. This version is intended for solvers
150:   that provide Schur vectors. Given the partial Schur decomposition
151:   OP*V=V*T, the following steps are performed:
152:       1) compute eigenvectors of T: T*Z=Z*D
153:       2) compute eigenvectors of OP: X=V*Z
154:   If left eigenvectors are required then also do Z'*T=D*Z', Y=W*Z
155:  */
156: PetscErrorCode EPSComputeVectors_Schur(EPS eps)
157: {
159:   PetscInt       n,i,ld;
160:   PetscScalar    *Z;
161: #if !defined(PETSC_USE_COMPLEX)
162:   PetscScalar    tmp;
163:   PetscReal      norm,normi;
164: #endif
165:   Vec            w;

168:   if (eps->ishermitian) {
169:     if (eps->isgeneralized && !eps->ispositive) {
170:        EPSComputeVectors_Indefinite(eps);
171:     } else {
172:       EPSComputeVectors_Hermitian(eps);
173:     }
174:     return(0);
175:   }
176:   DSGetLeadingDimension(eps->ds,&ld);
177:   DSGetDimensions(eps->ds,&n,NULL,NULL,NULL,NULL);

179:   /* right eigenvectors */
180:   DSVectors(eps->ds,DS_MAT_X,NULL,NULL);

182:   /* V = V * Z */
183:   DSGetArray(eps->ds,DS_MAT_X,&Z);
184:   SlepcUpdateVectors(n,eps->V,0,n,Z,ld,PETSC_FALSE);
185:   DSRestoreArray(eps->ds,DS_MAT_X,&Z);

187:   /* Purify eigenvectors */
188:   if (eps->ispositive) {
189:     VecDuplicate(eps->V[0],&w);
190:     for (i=0;i<n;i++) {
191:       VecCopy(eps->V[i],w);
192:       STApply(eps->st,w,eps->V[i]);
193:     }
194:     VecDestroy(&w);
195:   }

197:   /* Fix eigenvectors if balancing was used */
198:   if (eps->balance!=EPS_BALANCE_NONE && eps->D) {
199:     for (i=0;i<n;i++) {
200:       VecPointwiseDivide(eps->V[i],eps->V[i],eps->D);
201:     }
202:   }

204:   /* normalize eigenvectors (when using purification or balancing) */
205:   if (eps->ispositive || (eps->balance!=EPS_BALANCE_NONE && eps->D)) {
206:     for (i=0;i<n;i++) {
207: #if !defined(PETSC_USE_COMPLEX)
208:       if (eps->eigi[i] != 0.0) {
209:         VecNorm(eps->V[i],NORM_2,&norm);
210:         VecNorm(eps->V[i+1],NORM_2,&normi);
211:         tmp = 1.0 / SlepcAbsEigenvalue(norm,normi);
212:         VecScale(eps->V[i],tmp);
213:         VecScale(eps->V[i+1],tmp);
214:         i++;
215:       } else
216: #endif
217:       {
218:         VecNormalize(eps->V[i],NULL);
219:       }
220:     }
221:   }

223:   /* left eigenvectors */
224:   if (eps->leftvecs) {
225:     DSVectors(eps->ds,DS_MAT_Y,NULL,NULL);
226:     /* W = W * Z */
227:     DSGetArray(eps->ds,DS_MAT_Y,&Z);
228:     SlepcUpdateVectors(n,eps->W,0,n,Z,ld,PETSC_FALSE);
229:     DSRestoreArray(eps->ds,DS_MAT_Y,&Z);
230:   }
231:   eps->evecsavailable = PETSC_TRUE;
232:   return(0);
233: }

237: /*@
238:    EPSSetWorkVecs - Sets a number of work vectors into a EPS object

240:    Collective on EPS

242:    Input Parameters:
243: +  eps - eigensolver context
244: -  nw  - number of work vectors to allocate

246:    Developers Note:
247:    This is PETSC_EXTERN because it may be required by user plugin EPS
248:    implementations.

250:    Level: developer
251: @*/
252: PetscErrorCode EPSSetWorkVecs(EPS eps,PetscInt nw)
253: {

257:   if (eps->nwork != nw) {
258:     VecDestroyVecs(eps->nwork,&eps->work);
259:     eps->nwork = nw;
260:     VecDuplicateVecs(eps->t,nw,&eps->work);
261:     PetscLogObjectParents(eps,nw,eps->work);
262:   }
263:   return(0);
264: }

268: /*
269:   EPSSetWhichEigenpairs_Default - Sets the default value for which,
270:   depending on the ST.
271:  */
272: PetscErrorCode EPSSetWhichEigenpairs_Default(EPS eps)
273: {
274:   PetscBool      target;

278:   PetscObjectTypeCompareAny((PetscObject)eps->st,&target,STSINVERT,STCAYLEY,STFOLD,"");
279:   if (target) eps->which = EPS_TARGET_MAGNITUDE;
280:   else eps->which = EPS_LARGEST_MAGNITUDE;
281:   return(0);
282: }

286: /*
287:   EPSConvergedEigRelative - Checks convergence relative to the eigenvalue.
288: */
289: PetscErrorCode EPSConvergedEigRelative(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
290: {
291:   PetscReal w;

294:   w = SlepcAbsEigenvalue(eigr,eigi);
295:   *errest = res/w;
296:   return(0);
297: }

301: /*
302:   EPSConvergedAbsolute - Checks convergence absolutely.
303: */
304: PetscErrorCode EPSConvergedAbsolute(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
305: {
307:   *errest = res;
308:   return(0);
309: }

313: /*
314:   EPSConvergedNormRelative - Checks convergence relative to the eigenvalue and
315:   the matrix norms.
316: */
317: PetscErrorCode EPSConvergedNormRelative(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
318: {
319:   PetscReal w;

322:   w = SlepcAbsEigenvalue(eigr,eigi);
323:   *errest = res / (eps->nrma + w*eps->nrmb);
324:   return(0);
325: }

329: /*
330:   EPSComputeRitzVector - Computes the current Ritz vector.

332:   Simple case (complex scalars or real scalars with Zi=NULL):
333:     x = V*Zr  (V is an array of nv vectors, Zr has length nv)

335:   Split case:
336:     x = V*Zr  y = V*Zi  (Zr and Zi have length nv)
337: */
338: PetscErrorCode EPSComputeRitzVector(EPS eps,PetscScalar *Zr,PetscScalar *Zi,Vec *V,PetscInt nv,Vec x,Vec y)
339: {
341:   PetscReal      norm;
342: #if !defined(PETSC_USE_COMPLEX)
343:   Vec            z;
344: #endif

347:   /* compute eigenvector */
348:   SlepcVecMAXPBY(x,0.0,1.0,nv,Zr,V);

350:   /* purify eigenvector in positive generalized problems */
351:   if (eps->ispositive) {
352:     STApply(eps->st,x,y);
353:     if (eps->ishermitian) {
354:       IPNorm(eps->ip,y,&norm);
355:     } else {
356:       VecNorm(y,NORM_2,&norm);
357:     }
358:     VecScale(y,1.0/norm);
359:     VecCopy(y,x);
360:   }
361:   /* fix eigenvector if balancing is used */
362:   if (!eps->ishermitian && eps->balance!=EPS_BALANCE_NONE && eps->D) {
363:     VecPointwiseDivide(x,x,eps->D);
364:     VecNormalize(x,&norm);
365:   }
366: #if !defined(PETSC_USE_COMPLEX)
367:   /* compute imaginary part of eigenvector */
368:   if (Zi) {
369:     SlepcVecMAXPBY(y,0.0,1.0,nv,Zi,V);
370:     if (eps->ispositive) {
371:       VecDuplicate(V[0],&z);
372:       STApply(eps->st,y,z);
373:       VecNorm(z,NORM_2,&norm);
374:       VecScale(z,1.0/norm);
375:       VecCopy(z,y);
376:       VecDestroy(&z);
377:     }
378:     if (eps->balance!=EPS_BALANCE_NONE && eps->D) {
379:       VecPointwiseDivide(y,y,eps->D);
380:       VecNormalize(y,&norm);
381:     }
382:   } else
383: #endif
384:   { VecSet(y,0.0); }
385:   return(0);
386: }

390: /*
391:   EPSBuildBalance_Krylov - uses a Krylov subspace method to compute the
392:   diagonal matrix to be applied for balancing in non-Hermitian problems.
393: */
394: PetscErrorCode EPSBuildBalance_Krylov(EPS eps)
395: {
396:   Vec               z,p,r;
397:   PetscInt          i,j;
398:   PetscReal         norma;
399:   PetscScalar       *pz,*pD;
400:   const PetscScalar *pr,*pp;
401:   PetscErrorCode    ierr;

404:   VecDuplicate(eps->V[0],&r);
405:   VecDuplicate(eps->V[0],&p);
406:   VecDuplicate(eps->V[0],&z);
407:   VecSet(eps->D,1.0);

409:   for (j=0;j<eps->balance_its;j++) {

411:     /* Build a random vector of +-1's */
412:     SlepcVecSetRandom(z,eps->rand);
413:     VecGetArray(z,&pz);
414:     for (i=0;i<eps->nloc;i++) {
415:       if (PetscRealPart(pz[i])<0.5) pz[i]=-1.0;
416:       else pz[i]=1.0;
417:     }
418:     VecRestoreArray(z,&pz);

420:     /* Compute p=DA(D\z) */
421:     VecPointwiseDivide(r,z,eps->D);
422:     STApply(eps->st,r,p);
423:     VecPointwiseMult(p,p,eps->D);
424:     if (j==0) {
425:       /* Estimate the matrix inf-norm */
426:       VecAbs(p);
427:       VecMax(p,NULL,&norma);
428:     }
429:     if (eps->balance == EPS_BALANCE_TWOSIDE) {
430:       /* Compute r=D\(A'Dz) */
431:       VecPointwiseMult(z,z,eps->D);
432:       STApplyTranspose(eps->st,z,r);
433:       VecPointwiseDivide(r,r,eps->D);
434:     }

436:     /* Adjust values of D */
437:     VecGetArrayRead(r,&pr);
438:     VecGetArrayRead(p,&pp);
439:     VecGetArray(eps->D,&pD);
440:     for (i=0;i<eps->nloc;i++) {
441:       if (eps->balance == EPS_BALANCE_TWOSIDE) {
442:         if (PetscAbsScalar(pp[i])>eps->balance_cutoff*norma && pr[i]!=0.0)
443:           pD[i] *= PetscSqrtReal(PetscAbsScalar(pr[i]/pp[i]));
444:       } else {
445:         if (pp[i]!=0.0) pD[i] *= 1.0/PetscAbsScalar(pp[i]);
446:       }
447:     }
448:     VecRestoreArrayRead(r,&pr);
449:     VecRestoreArrayRead(p,&pp);
450:     VecRestoreArray(eps->D,&pD);
451:   }

453:   VecDestroy(&r);
454:   VecDestroy(&p);
455:   VecDestroy(&z);
456:   return(0);
457: }

slepc-3.4.2.dfsg.orig/src/eps/interface/default.c0000644000175000017500000003360212211062077020545 0ustar gladkgladk/* This file contains some simple default routines for common operations. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepceps.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "EPSReset_Default" PetscErrorCode EPSReset_Default(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDestroyVecs(eps->nwork,&eps->work);CHKERRQ(ierr); eps->nwork = 0; ierr = EPSFreeSolution(eps);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBackTransform_Default" PetscErrorCode EPSBackTransform_Default(EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; ierr = STBackTransform(eps->st,eps->nconv,eps->eigr,eps->eigi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeVectors_Default" /* EPSComputeVectors_Default - Compute eigenvectors from the vectors provided by the eigensolver. This version just copies the vectors and is intended for solvers such as power that provide the eigenvector. */ PetscErrorCode EPSComputeVectors_Default(EPS eps) { PetscFunctionBegin; eps->evecsavailable = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeVectors_Hermitian" /* EPSComputeVectors_Hermitian - Copies the Lanczos vectors as eigenvectors using purification for generalized eigenproblems. */ PetscErrorCode EPSComputeVectors_Hermitian(EPS eps) { PetscErrorCode ierr; PetscInt i; PetscReal norm; Vec w; PetscFunctionBegin; if (eps->isgeneralized) { /* Purify eigenvectors */ ierr = VecDuplicate(eps->V[0],&w);CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = VecCopy(eps->V[i],w);CHKERRQ(ierr); ierr = STApply(eps->st,w,eps->V[i]);CHKERRQ(ierr); ierr = IPNorm(eps->ip,eps->V[i],&norm);CHKERRQ(ierr); ierr = VecScale(eps->V[i],1.0/norm);CHKERRQ(ierr); } ierr = VecDestroy(&w);CHKERRQ(ierr); } eps->evecsavailable = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeVectors_Indefinite" /* EPSComputeVectors_Indefinite - similar to the Schur version but for indefinite problems */ PetscErrorCode EPSComputeVectors_Indefinite(EPS eps) { PetscErrorCode ierr; PetscInt n,ld,i; PetscScalar *Z; Vec v; #if !defined(PETSC_USE_COMPLEX) PetscScalar tmp; PetscReal norm,normi; #endif PetscFunctionBegin; ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = DSGetDimensions(eps->ds,&n,NULL,NULL,NULL,NULL);CHKERRQ(ierr); ierr = DSVectors(eps->ds,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); ierr = DSGetArray(eps->ds,DS_MAT_X,&Z);CHKERRQ(ierr); ierr = SlepcUpdateVectors(n,eps->V,0,n,Z,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_X,&Z);CHKERRQ(ierr); /* purification */ ierr = VecDuplicate(eps->V[0],&v);CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = VecCopy(eps->V[i],v);CHKERRQ(ierr); ierr = STApply(eps->st,v,eps->V[i]);CHKERRQ(ierr); } ierr = VecDestroy(&v);CHKERRQ(ierr); /* normalization */ for (i=0;ieigi[i] != 0.0) { ierr = VecNorm(eps->V[i],NORM_2,&norm);CHKERRQ(ierr); ierr = VecNorm(eps->V[i+1],NORM_2,&normi);CHKERRQ(ierr); tmp = 1.0 / SlepcAbsEigenvalue(norm,normi); ierr = VecScale(eps->V[i],tmp);CHKERRQ(ierr); ierr = VecScale(eps->V[i+1],tmp);CHKERRQ(ierr); i++; } else #endif { ierr = VecNormalize(eps->V[i],NULL);CHKERRQ(ierr); } } eps->evecsavailable = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeVectors_Schur" /* EPSComputeVectors_Schur - Compute eigenvectors from the vectors provided by the eigensolver. This version is intended for solvers that provide Schur vectors. Given the partial Schur decomposition OP*V=V*T, the following steps are performed: 1) compute eigenvectors of T: T*Z=Z*D 2) compute eigenvectors of OP: X=V*Z If left eigenvectors are required then also do Z'*T=D*Z', Y=W*Z */ PetscErrorCode EPSComputeVectors_Schur(EPS eps) { PetscErrorCode ierr; PetscInt n,i,ld; PetscScalar *Z; #if !defined(PETSC_USE_COMPLEX) PetscScalar tmp; PetscReal norm,normi; #endif Vec w; PetscFunctionBegin; if (eps->ishermitian) { if (eps->isgeneralized && !eps->ispositive) { ierr = EPSComputeVectors_Indefinite(eps);CHKERRQ(ierr); } else { ierr = EPSComputeVectors_Hermitian(eps);CHKERRQ(ierr); } PetscFunctionReturn(0); } ierr = DSGetLeadingDimension(eps->ds,&ld);CHKERRQ(ierr); ierr = DSGetDimensions(eps->ds,&n,NULL,NULL,NULL,NULL);CHKERRQ(ierr); /* right eigenvectors */ ierr = DSVectors(eps->ds,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); /* V = V * Z */ ierr = DSGetArray(eps->ds,DS_MAT_X,&Z);CHKERRQ(ierr); ierr = SlepcUpdateVectors(n,eps->V,0,n,Z,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_X,&Z);CHKERRQ(ierr); /* Purify eigenvectors */ if (eps->ispositive) { ierr = VecDuplicate(eps->V[0],&w);CHKERRQ(ierr); for (i=0;iV[i],w);CHKERRQ(ierr); ierr = STApply(eps->st,w,eps->V[i]);CHKERRQ(ierr); } ierr = VecDestroy(&w);CHKERRQ(ierr); } /* Fix eigenvectors if balancing was used */ if (eps->balance!=EPS_BALANCE_NONE && eps->D) { for (i=0;iV[i],eps->V[i],eps->D);CHKERRQ(ierr); } } /* normalize eigenvectors (when using purification or balancing) */ if (eps->ispositive || (eps->balance!=EPS_BALANCE_NONE && eps->D)) { for (i=0;ieigi[i] != 0.0) { ierr = VecNorm(eps->V[i],NORM_2,&norm);CHKERRQ(ierr); ierr = VecNorm(eps->V[i+1],NORM_2,&normi);CHKERRQ(ierr); tmp = 1.0 / SlepcAbsEigenvalue(norm,normi); ierr = VecScale(eps->V[i],tmp);CHKERRQ(ierr); ierr = VecScale(eps->V[i+1],tmp);CHKERRQ(ierr); i++; } else #endif { ierr = VecNormalize(eps->V[i],NULL);CHKERRQ(ierr); } } } /* left eigenvectors */ if (eps->leftvecs) { ierr = DSVectors(eps->ds,DS_MAT_Y,NULL,NULL);CHKERRQ(ierr); /* W = W * Z */ ierr = DSGetArray(eps->ds,DS_MAT_Y,&Z);CHKERRQ(ierr); ierr = SlepcUpdateVectors(n,eps->W,0,n,Z,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(eps->ds,DS_MAT_Y,&Z);CHKERRQ(ierr); } eps->evecsavailable = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetWorkVecs" /*@ EPSSetWorkVecs - Sets a number of work vectors into a EPS object Collective on EPS Input Parameters: + eps - eigensolver context - nw - number of work vectors to allocate Developers Note: This is PETSC_EXTERN because it may be required by user plugin EPS implementations. Level: developer @*/ PetscErrorCode EPSSetWorkVecs(EPS eps,PetscInt nw) { PetscErrorCode ierr; PetscFunctionBegin; if (eps->nwork != nw) { ierr = VecDestroyVecs(eps->nwork,&eps->work);CHKERRQ(ierr); eps->nwork = nw; ierr = VecDuplicateVecs(eps->t,nw,&eps->work);CHKERRQ(ierr); ierr = PetscLogObjectParents(eps,nw,eps->work);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSSetWhichEigenpairs_Default" /* EPSSetWhichEigenpairs_Default - Sets the default value for which, depending on the ST. */ PetscErrorCode EPSSetWhichEigenpairs_Default(EPS eps) { PetscBool target; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscObjectTypeCompareAny((PetscObject)eps->st,&target,STSINVERT,STCAYLEY,STFOLD,"");CHKERRQ(ierr); if (target) eps->which = EPS_TARGET_MAGNITUDE; else eps->which = EPS_LARGEST_MAGNITUDE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSConvergedEigRelative" /* EPSConvergedEigRelative - Checks convergence relative to the eigenvalue. */ PetscErrorCode EPSConvergedEigRelative(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) { PetscReal w; PetscFunctionBegin; w = SlepcAbsEigenvalue(eigr,eigi); *errest = res/w; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSConvergedAbsolute" /* EPSConvergedAbsolute - Checks convergence absolutely. */ PetscErrorCode EPSConvergedAbsolute(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) { PetscFunctionBegin; *errest = res; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSConvergedNormRelative" /* EPSConvergedNormRelative - Checks convergence relative to the eigenvalue and the matrix norms. */ PetscErrorCode EPSConvergedNormRelative(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) { PetscReal w; PetscFunctionBegin; w = SlepcAbsEigenvalue(eigr,eigi); *errest = res / (eps->nrma + w*eps->nrmb); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSComputeRitzVector" /* EPSComputeRitzVector - Computes the current Ritz vector. Simple case (complex scalars or real scalars with Zi=NULL): x = V*Zr (V is an array of nv vectors, Zr has length nv) Split case: x = V*Zr y = V*Zi (Zr and Zi have length nv) */ PetscErrorCode EPSComputeRitzVector(EPS eps,PetscScalar *Zr,PetscScalar *Zi,Vec *V,PetscInt nv,Vec x,Vec y) { PetscErrorCode ierr; PetscReal norm; #if !defined(PETSC_USE_COMPLEX) Vec z; #endif PetscFunctionBegin; /* compute eigenvector */ ierr = SlepcVecMAXPBY(x,0.0,1.0,nv,Zr,V);CHKERRQ(ierr); /* purify eigenvector in positive generalized problems */ if (eps->ispositive) { ierr = STApply(eps->st,x,y);CHKERRQ(ierr); if (eps->ishermitian) { ierr = IPNorm(eps->ip,y,&norm);CHKERRQ(ierr); } else { ierr = VecNorm(y,NORM_2,&norm);CHKERRQ(ierr); } ierr = VecScale(y,1.0/norm);CHKERRQ(ierr); ierr = VecCopy(y,x);CHKERRQ(ierr); } /* fix eigenvector if balancing is used */ if (!eps->ishermitian && eps->balance!=EPS_BALANCE_NONE && eps->D) { ierr = VecPointwiseDivide(x,x,eps->D);CHKERRQ(ierr); ierr = VecNormalize(x,&norm);CHKERRQ(ierr); } #if !defined(PETSC_USE_COMPLEX) /* compute imaginary part of eigenvector */ if (Zi) { ierr = SlepcVecMAXPBY(y,0.0,1.0,nv,Zi,V);CHKERRQ(ierr); if (eps->ispositive) { ierr = VecDuplicate(V[0],&z);CHKERRQ(ierr); ierr = STApply(eps->st,y,z);CHKERRQ(ierr); ierr = VecNorm(z,NORM_2,&norm);CHKERRQ(ierr); ierr = VecScale(z,1.0/norm);CHKERRQ(ierr); ierr = VecCopy(z,y);CHKERRQ(ierr); ierr = VecDestroy(&z);CHKERRQ(ierr); } if (eps->balance!=EPS_BALANCE_NONE && eps->D) { ierr = VecPointwiseDivide(y,y,eps->D);CHKERRQ(ierr); ierr = VecNormalize(y,&norm);CHKERRQ(ierr); } } else #endif { ierr = VecSet(y,0.0);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSBuildBalance_Krylov" /* EPSBuildBalance_Krylov - uses a Krylov subspace method to compute the diagonal matrix to be applied for balancing in non-Hermitian problems. */ PetscErrorCode EPSBuildBalance_Krylov(EPS eps) { Vec z,p,r; PetscInt i,j; PetscReal norma; PetscScalar *pz,*pD; const PetscScalar *pr,*pp; PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDuplicate(eps->V[0],&r);CHKERRQ(ierr); ierr = VecDuplicate(eps->V[0],&p);CHKERRQ(ierr); ierr = VecDuplicate(eps->V[0],&z);CHKERRQ(ierr); ierr = VecSet(eps->D,1.0);CHKERRQ(ierr); for (j=0;jbalance_its;j++) { /* Build a random vector of +-1's */ ierr = SlepcVecSetRandom(z,eps->rand);CHKERRQ(ierr); ierr = VecGetArray(z,&pz);CHKERRQ(ierr); for (i=0;inloc;i++) { if (PetscRealPart(pz[i])<0.5) pz[i]=-1.0; else pz[i]=1.0; } ierr = VecRestoreArray(z,&pz);CHKERRQ(ierr); /* Compute p=DA(D\z) */ ierr = VecPointwiseDivide(r,z,eps->D);CHKERRQ(ierr); ierr = STApply(eps->st,r,p);CHKERRQ(ierr); ierr = VecPointwiseMult(p,p,eps->D);CHKERRQ(ierr); if (j==0) { /* Estimate the matrix inf-norm */ ierr = VecAbs(p);CHKERRQ(ierr); ierr = VecMax(p,NULL,&norma);CHKERRQ(ierr); } if (eps->balance == EPS_BALANCE_TWOSIDE) { /* Compute r=D\(A'Dz) */ ierr = VecPointwiseMult(z,z,eps->D);CHKERRQ(ierr); ierr = STApplyTranspose(eps->st,z,r);CHKERRQ(ierr); ierr = VecPointwiseDivide(r,r,eps->D);CHKERRQ(ierr); } /* Adjust values of D */ ierr = VecGetArrayRead(r,&pr);CHKERRQ(ierr); ierr = VecGetArrayRead(p,&pp);CHKERRQ(ierr); ierr = VecGetArray(eps->D,&pD);CHKERRQ(ierr); for (i=0;inloc;i++) { if (eps->balance == EPS_BALANCE_TWOSIDE) { if (PetscAbsScalar(pp[i])>eps->balance_cutoff*norma && pr[i]!=0.0) pD[i] *= PetscSqrtReal(PetscAbsScalar(pr[i]/pp[i])); } else { if (pp[i]!=0.0) pD[i] *= 1.0/PetscAbsScalar(pp[i]); } } ierr = VecRestoreArrayRead(r,&pr);CHKERRQ(ierr); ierr = VecRestoreArrayRead(p,&pp);CHKERRQ(ierr); ierr = VecRestoreArray(eps->D,&pD);CHKERRQ(ierr); } ierr = VecDestroy(&r);CHKERRQ(ierr); ierr = VecDestroy(&p);CHKERRQ(ierr); ierr = VecDestroy(&z);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/eps/interface/opts.c.html0000644000175000017500000040324112211062077021051 0ustar gladkgladk
Actual source code: opts.c

  1: /*
  2:       EPS routines related to options that can be set via the command-line
  3:       or procedurally.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/epsimpl.h>   /*I "slepceps.h" I*/

 29: /*@
 30:    EPSSetFromOptions - Sets EPS options from the options database.
 31:    This routine must be called before EPSSetUp() if the user is to be
 32:    allowed to set the solver type.

 34:    Collective on EPS

 36:    Input Parameters:
 37: .  eps - the eigensolver context

 39:    Notes:
 40:    To see all options, run your program with the -help option.

 42:    Level: beginner
 43: @*/
 44: PetscErrorCode EPSSetFromOptions(EPS eps)
 45: {
 46:   PetscErrorCode   ierr;
 47:   char             type[256],monfilename[PETSC_MAX_PATH_LEN];
 48:   PetscBool        flg,val;
 49:   PetscReal        r,nrma,nrmb,array[2]={0,0};
 50:   PetscScalar      s;
 51:   PetscInt         i,j,k;
 52:   const char       *bal_list[4] = {"none","oneside","twoside","user"};
 53:   PetscViewer      monviewer;
 54:   SlepcConvMonitor ctx;

 58:   if (!EPSRegisterAllCalled) { EPSRegisterAll(); }
 59:   PetscObjectOptionsBegin((PetscObject)eps);
 60:     PetscOptionsList("-eps_type","Eigenvalue Problem Solver method","EPSSetType",EPSList,(char*)(((PetscObject)eps)->type_name?((PetscObject)eps)->type_name:EPSKRYLOVSCHUR),type,256,&flg);
 61:     if (flg) {
 62:       EPSSetType(eps,type);
 63:     }
 64:     /*
 65:       Set the type if it was never set.
 66:     */
 67:     if (!((PetscObject)eps)->type_name) {
 68:       EPSSetType(eps,EPSKRYLOVSCHUR);
 69:     }

 71:     PetscOptionsBoolGroupBegin("-eps_hermitian","hermitian eigenvalue problem","EPSSetProblemType",&flg);
 72:     if (flg) { EPSSetProblemType(eps,EPS_HEP); }
 73:     PetscOptionsBoolGroup("-eps_gen_hermitian","generalized hermitian eigenvalue problem","EPSSetProblemType",&flg);
 74:     if (flg) { EPSSetProblemType(eps,EPS_GHEP); }
 75:     PetscOptionsBoolGroup("-eps_non_hermitian","non-hermitian eigenvalue problem","EPSSetProblemType",&flg);
 76:     if (flg) { EPSSetProblemType(eps,EPS_NHEP); }
 77:     PetscOptionsBoolGroup("-eps_gen_non_hermitian","generalized non-hermitian eigenvalue problem","EPSSetProblemType",&flg);
 78:     if (flg) { EPSSetProblemType(eps,EPS_GNHEP); }
 79:     PetscOptionsBoolGroup("-eps_pos_gen_non_hermitian","generalized non-hermitian eigenvalue problem with positive semi-definite B","EPSSetProblemType",&flg);
 80:     if (flg) { EPSSetProblemType(eps,EPS_PGNHEP); }
 81:     PetscOptionsBoolGroupEnd("-eps_gen_indefinite","generalized hermitian-indefinite eigenvalue problem","EPSSetProblemType",&flg);
 82:     if (flg) { EPSSetProblemType(eps,EPS_GHIEP); }

 84:     PetscOptionsBoolGroupBegin("-eps_ritz","Rayleigh-Ritz extraction","EPSSetExtraction",&flg);
 85:     if (flg) { EPSSetExtraction(eps,EPS_RITZ); }
 86:     PetscOptionsBoolGroup("-eps_harmonic","harmonic Ritz extraction","EPSSetExtraction",&flg);
 87:     if (flg) { EPSSetExtraction(eps,EPS_HARMONIC); }
 88:     PetscOptionsBoolGroup("-eps_harmonic_relative","relative harmonic Ritz extraction","EPSSetExtraction",&flg);
 89:     if (flg) { EPSSetExtraction(eps,EPS_HARMONIC_RELATIVE); }
 90:     PetscOptionsBoolGroup("-eps_harmonic_right","right harmonic Ritz extraction","EPSSetExtraction",&flg);
 91:     if (flg) { EPSSetExtraction(eps,EPS_HARMONIC_RIGHT); }
 92:     PetscOptionsBoolGroup("-eps_harmonic_largest","largest harmonic Ritz extraction","EPSSetExtraction",&flg);
 93:     if (flg) { EPSSetExtraction(eps,EPS_HARMONIC_LARGEST); }
 94:     PetscOptionsBoolGroup("-eps_refined","refined Ritz extraction","EPSSetExtraction",&flg);
 95:     if (flg) { EPSSetExtraction(eps,EPS_REFINED); }
 96:     PetscOptionsBoolGroupEnd("-eps_refined_harmonic","refined harmonic Ritz extraction","EPSSetExtraction",&flg);
 97:     if (flg) { EPSSetExtraction(eps,EPS_REFINED_HARMONIC); }

 99:     if (!eps->balance) eps->balance = EPS_BALANCE_NONE;
100:     PetscOptionsEList("-eps_balance","Balancing method","EPSSetBalance",bal_list,4,bal_list[eps->balance-EPS_BALANCE_NONE],&i,&flg);
101:     if (flg) eps->balance = (EPSBalance)(i+EPS_BALANCE_NONE);
102:     r = j = 0;
103:     PetscOptionsInt("-eps_balance_its","Number of iterations in balancing","EPSSetBalance",eps->balance_its,&j,NULL);
104:     PetscOptionsReal("-eps_balance_cutoff","Cutoff value in balancing","EPSSetBalance",eps->balance_cutoff,&r,NULL);
105:     EPSSetBalance(eps,(EPSBalance)0,j,r);

107:     r = i = 0;
108:     PetscOptionsInt("-eps_max_it","Maximum number of iterations","EPSSetTolerances",eps->max_it,&i,NULL);
109:     PetscOptionsReal("-eps_tol","Tolerance","EPSSetTolerances",eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol,&r,NULL);
110:     EPSSetTolerances(eps,r,i);
111:     PetscOptionsBoolGroupBegin("-eps_conv_eig","Relative error convergence test","EPSSetConvergenceTest",&flg);
112:     if (flg) { EPSSetConvergenceTest(eps,EPS_CONV_EIG); }
113:     PetscOptionsBoolGroup("-eps_conv_norm","Convergence test relative to the eigenvalue and the matrix norms","EPSSetConvergenceTest",&flg);
114:     if (flg) { EPSSetConvergenceTest(eps,EPS_CONV_NORM); }
115:     PetscOptionsBoolGroupEnd("-eps_conv_abs","Absolute error convergence test","EPSSetConvergenceTest",&flg);
116:     if (flg) { EPSSetConvergenceTest(eps,EPS_CONV_ABS); }

118:     i = j = k = 0;
119:     PetscOptionsInt("-eps_nev","Number of eigenvalues to compute","EPSSetDimensions",eps->nev,&i,NULL);
120:     PetscOptionsInt("-eps_ncv","Number of basis vectors","EPSSetDimensions",eps->ncv,&j,NULL);
121:     PetscOptionsInt("-eps_mpd","Maximum dimension of projected problem","EPSSetDimensions",eps->mpd,&k,NULL);
122:     EPSSetDimensions(eps,i,j,k);

124:     /* -----------------------------------------------------------------------*/
125:     /*
126:       Cancels all monitors hardwired into code before call to EPSSetFromOptions()
127:     */
128:     flg  = PETSC_FALSE;
129:     PetscOptionsBool("-eps_monitor_cancel","Remove any hardwired monitor routines","EPSMonitorCancel",flg,&flg,NULL);
130:     if (flg) {
131:       EPSMonitorCancel(eps);
132:     }
133:     /*
134:       Prints approximate eigenvalues and error estimates at each iteration
135:     */
136:     PetscOptionsString("-eps_monitor","Monitor first unconverged approximate eigenvalue and error estimate","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
137:     if (flg) {
138:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)eps),monfilename,&monviewer);
139:       EPSMonitorSet(eps,EPSMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
140:     }
141:     PetscOptionsString("-eps_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
142:     if (flg) {
143:       PetscNew(struct _n_SlepcConvMonitor,&ctx);
144:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)eps),monfilename,&ctx->viewer);
145:       EPSMonitorSet(eps,EPSMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
146:     }
147:     PetscOptionsString("-eps_monitor_all","Monitor approximate eigenvalues and error estimates","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
148:     if (flg) {
149:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)eps),monfilename,&monviewer);
150:       EPSMonitorSet(eps,EPSMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
151:       EPSSetTrackAll(eps,PETSC_TRUE);
152:     }
153:     flg = PETSC_FALSE;
154:     PetscOptionsBool("-eps_monitor_lg","Monitor first unconverged approximate eigenvalue and error estimate graphically","EPSMonitorSet",flg,&flg,NULL);
155:     if (flg) {
156:       EPSMonitorSet(eps,EPSMonitorLG,NULL,NULL);
157:     }
158:     flg = PETSC_FALSE;
159:     PetscOptionsBool("-eps_monitor_lg_all","Monitor error estimates graphically","EPSMonitorSet",flg,&flg,NULL);
160:     if (flg) {
161:       EPSMonitorSet(eps,EPSMonitorLGAll,NULL,NULL);
162:       EPSSetTrackAll(eps,PETSC_TRUE);
163:     }
164:   /* -----------------------------------------------------------------------*/
165:     PetscOptionsScalar("-eps_target","Value of the target","EPSSetTarget",eps->target,&s,&flg);
166:     if (flg) {
167:       EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);
168:       EPSSetTarget(eps,s);
169:     }
170:     k = 2;
171:     PetscOptionsRealArray("-eps_interval","Computational interval (two real values separated with a comma without spaces)","EPSSetInterval",array,&k,&flg);
172:     if (flg) {
173:       if (k<2) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_SIZ,"Must pass two values in -eps_interval (comma-separated without spaces)");
174:       EPSSetWhichEigenpairs(eps,EPS_ALL);
175:       EPSSetInterval(eps,array[0],array[1]);
176:     }

178:     PetscOptionsBoolGroupBegin("-eps_largest_magnitude","compute largest eigenvalues in magnitude","EPSSetWhichEigenpairs",&flg);
179:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_LARGEST_MAGNITUDE); }
180:     PetscOptionsBoolGroup("-eps_smallest_magnitude","compute smallest eigenvalues in magnitude","EPSSetWhichEigenpairs",&flg);
181:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE); }
182:     PetscOptionsBoolGroup("-eps_largest_real","compute largest real parts","EPSSetWhichEigenpairs",&flg);
183:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL); }
184:     PetscOptionsBoolGroup("-eps_smallest_real","compute smallest real parts","EPSSetWhichEigenpairs",&flg);
185:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL); }
186:     PetscOptionsBoolGroup("-eps_largest_imaginary","compute largest imaginary parts","EPSSetWhichEigenpairs",&flg);
187:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_LARGEST_IMAGINARY); }
188:     PetscOptionsBoolGroup("-eps_smallest_imaginary","compute smallest imaginary parts","EPSSetWhichEigenpairs",&flg);
189:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_SMALLEST_IMAGINARY); }
190:     PetscOptionsBoolGroup("-eps_target_magnitude","compute nearest eigenvalues to target","EPSSetWhichEigenpairs",&flg);
191:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE); }
192:     PetscOptionsBoolGroup("-eps_target_real","compute eigenvalues with real parts close to target","EPSSetWhichEigenpairs",&flg);
193:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_TARGET_REAL); }
194:     PetscOptionsBoolGroup("-eps_target_imaginary","compute eigenvalues with imaginary parts close to target","EPSSetWhichEigenpairs",&flg);
195:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_TARGET_IMAGINARY); }
196:     PetscOptionsBoolGroupEnd("-eps_all","compute all eigenvalues in an interval","EPSSetWhichEigenpairs",&flg);
197:     if (flg) { EPSSetWhichEigenpairs(eps,EPS_ALL); }

199:     PetscOptionsBool("-eps_left_vectors","Compute left eigenvectors also","EPSSetLeftVectorsWanted",eps->leftvecs,&val,&flg);
200:     if (flg) {
201:       EPSSetLeftVectorsWanted(eps,val);
202:     }
203:     PetscOptionsBool("-eps_true_residual","Compute true residuals explicitly","EPSSetTrueResidual",eps->trueres,&val,&flg);
204:     if (flg) {
205:       EPSSetTrueResidual(eps,val);
206:     }

208:     nrma = nrmb = 0;
209:     PetscOptionsReal("-eps_norm_a","Norm of matrix A","EPSSetMatrixNorms",eps->nrma,&nrma,NULL);
210:     PetscOptionsReal("-eps_norm_b","Norm of matrix B","EPSSetMatrixNorms",eps->nrmb,&nrmb,NULL);
211:     EPSSetMatrixNorms(eps,nrma,nrmb,eps->adaptive);
212:     PetscOptionsBool("-eps_norms_adaptive","Update the value of matrix norms adaptively","EPSSetMatrixNorms",eps->adaptive,&val,&flg);
213:     if (flg) {
214:       EPSSetMatrixNorms(eps,0,0,val);
215:     }

217:     PetscOptionsName("-eps_view","Print detailed information on solver used","EPSView",0);
218:     PetscOptionsName("-eps_plot_eigs","Make a plot of the computed eigenvalues","EPSSolve",0);

220:     if (eps->ops->setfromoptions) {
221:       (*eps->ops->setfromoptions)(eps);
222:     }
223:     PetscObjectProcessOptionsHandlers((PetscObject)eps);
224:   PetscOptionsEnd();

226:   if (!eps->ip) { EPSGetIP(eps,&eps->ip); }
227:   IPSetFromOptions(eps->ip);
228:   if (!eps->ds) { EPSGetDS(eps,&eps->ds); }
229:   DSSetFromOptions(eps->ds);
230:   STSetFromOptions(eps->st);
231:   PetscRandomSetFromOptions(eps->rand);
232:   return(0);
233: }

237: /*@
238:    EPSGetTolerances - Gets the tolerance and maximum iteration count used
239:    by the EPS convergence tests.

241:    Not Collective

243:    Input Parameter:
244: .  eps - the eigensolver context

246:    Output Parameters:
247: +  tol - the convergence tolerance
248: -  maxits - maximum number of iterations

250:    Notes:
251:    The user can specify NULL for any parameter that is not needed.

253:    Level: intermediate

255: .seealso: EPSSetTolerances()
256: @*/
257: PetscErrorCode EPSGetTolerances(EPS eps,PetscReal *tol,PetscInt *maxits)
258: {
261:   if (tol)    *tol    = eps->tol;
262:   if (maxits) *maxits = eps->max_it;
263:   return(0);
264: }

268: /*@
269:    EPSSetTolerances - Sets the tolerance and maximum iteration count used
270:    by the EPS convergence tests.

272:    Logically Collective on EPS

274:    Input Parameters:
275: +  eps - the eigensolver context
276: .  tol - the convergence tolerance
277: -  maxits - maximum number of iterations to use

279:    Options Database Keys:
280: +  -eps_tol <tol> - Sets the convergence tolerance
281: -  -eps_max_it <maxits> - Sets the maximum number of iterations allowed

283:    Notes:
284:    Pass 0 for an argument that need not be changed.

286:    Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
287:    dependent on the solution method.

289:    Level: intermediate

291: .seealso: EPSGetTolerances()
292: @*/
293: PetscErrorCode EPSSetTolerances(EPS eps,PetscReal tol,PetscInt maxits)
294: {
299:   if (tol) {
300:     if (tol == PETSC_DEFAULT) {
301:       eps->tol = PETSC_DEFAULT;
302:     } else {
303:       if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
304:       eps->tol = tol;
305:     }
306:   }
307:   if (maxits) {
308:     if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
309:       eps->max_it = 0;
310:       eps->setupcalled = 0;
311:     } else {
312:       if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
313:       eps->max_it = maxits;
314:     }
315:   }
316:   return(0);
317: }

321: /*@
322:    EPSGetDimensions - Gets the number of eigenvalues to compute
323:    and the dimension of the subspace.

325:    Not Collective

327:    Input Parameter:
328: .  eps - the eigensolver context

330:    Output Parameters:
331: +  nev - number of eigenvalues to compute
332: .  ncv - the maximum dimension of the subspace to be used by the solver
333: -  mpd - the maximum dimension allowed for the projected problem

335:    Notes:
336:    The user can specify NULL for any parameter that is not needed.

338:    Level: intermediate

340: .seealso: EPSSetDimensions()
341: @*/
342: PetscErrorCode EPSGetDimensions(EPS eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
343: {
346:   if (nev) *nev = eps->nev;
347:   if (ncv) *ncv = eps->ncv;
348:   if (mpd) *mpd = eps->mpd;
349:   return(0);
350: }

354: /*@
355:    EPSSetDimensions - Sets the number of eigenvalues to compute
356:    and the dimension of the subspace.

358:    Logically Collective on EPS

360:    Input Parameters:
361: +  eps - the eigensolver context
362: .  nev - number of eigenvalues to compute
363: .  ncv - the maximum dimension of the subspace to be used by the solver
364: -  mpd - the maximum dimension allowed for the projected problem

366:    Options Database Keys:
367: +  -eps_nev <nev> - Sets the number of eigenvalues
368: .  -eps_ncv <ncv> - Sets the dimension of the subspace
369: -  -eps_mpd <mpd> - Sets the maximum projected dimension

371:    Notes:
372:    Pass 0 to retain the previous value of any parameter.

374:    Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
375:    dependent on the solution method.

377:    The parameters ncv and mpd are intimately related, so that the user is advised
378:    to set one of them at most. Normal usage is that
379:    (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and
380:    (b) in cases where nev is large, the user sets mpd.

382:    The value of ncv should always be between nev and (nev+mpd), typically
383:    ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise
384:    a smaller value should be used.

386:    When computing all eigenvalues in an interval, see EPSSetInterval(), the
387:    meaning of nev changes. In that case, the number of eigenvalues in the
388:    interval is not known a priori; the meaning of nev is then the number of
389:    eigenvalues that are computed at a time when sweeping the interval from one
390:    end to the other. The value of nev in this case may have an impact on overall
391:    performance. The value of ncv should not be assigned in this case.

393:    Level: intermediate

395: .seealso: EPSGetDimensions(), EPSSetInterval()
396: @*/
397: PetscErrorCode EPSSetDimensions(EPS eps,PetscInt nev,PetscInt ncv,PetscInt mpd)
398: {
404:   if (nev) {
405:     if (nev<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0");
406:     eps->nev = nev;
407:     eps->setupcalled = 0;
408:   }
409:   if (ncv) {
410:     if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
411:       eps->ncv = 0;
412:     } else {
413:       if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
414:       eps->ncv = ncv;
415:     }
416:     eps->setupcalled = 0;
417:   }
418:   if (mpd) {
419:     if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
420:       eps->mpd = 0;
421:     } else {
422:       if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
423:       eps->mpd = mpd;
424:     }
425:   }
426:   return(0);
427: }

431: /*@
432:    EPSSetWhichEigenpairs - Specifies which portion of the spectrum is
433:    to be sought.

435:    Logically Collective on EPS

437:    Input Parameters:
438: +  eps   - eigensolver context obtained from EPSCreate()
439: -  which - the portion of the spectrum to be sought

441:    Possible values:
442:    The parameter 'which' can have one of these values

444: +     EPS_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
445: .     EPS_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
446: .     EPS_LARGEST_REAL - largest real parts
447: .     EPS_SMALLEST_REAL - smallest real parts
448: .     EPS_LARGEST_IMAGINARY - largest imaginary parts
449: .     EPS_SMALLEST_IMAGINARY - smallest imaginary parts
450: .     EPS_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
451: .     EPS_TARGET_REAL - eigenvalues with real part closest to target
452: .     EPS_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target
453: .     EPS_ALL - all eigenvalues contained in a given interval
454: -     EPS_WHICH_USER - user defined ordering set with EPSSetEigenvalueComparison()

456:    Options Database Keys:
457: +   -eps_largest_magnitude - Sets largest eigenvalues in magnitude
458: .   -eps_smallest_magnitude - Sets smallest eigenvalues in magnitude
459: .   -eps_largest_real - Sets largest real parts
460: .   -eps_smallest_real - Sets smallest real parts
461: .   -eps_largest_imaginary - Sets largest imaginary parts
462: .   -eps_smallest_imaginary - Sets smallest imaginary parts
463: .   -eps_target_magnitude - Sets eigenvalues closest to target
464: .   -eps_target_real - Sets real parts closest to target
465: .   -eps_target_imaginary - Sets imaginary parts closest to target
466: -   -eps_all - Sets all eigenvalues in an interval

468:    Notes:
469:    Not all eigensolvers implemented in EPS account for all the possible values
470:    stated above. Also, some values make sense only for certain types of
471:    problems. If SLEPc is compiled for real numbers EPS_LARGEST_IMAGINARY
472:    and EPS_SMALLEST_IMAGINARY use the absolute value of the imaginary part
473:    for eigenvalue selection.

475:    The target is a scalar value provided with EPSSetTarget().

477:    The criterion EPS_TARGET_IMAGINARY is available only in case PETSc and
478:    SLEPc have been built with complex scalars.

480:    EPS_ALL is intended for use in combination with an interval (see
481:    EPSSetInterval()), when all eigenvalues within the interval are requested.
482:    In that case, the number of eigenvalues is unknown, so the nev parameter
483:    has a different sense, see EPSSetDimensions().

485:    Level: intermediate

487: .seealso: EPSGetWhichEigenpairs(), EPSSetTarget(), EPSSetInterval(),
488:           EPSSetDimensions(), EPSSetEigenvalueComparison(),
489:           EPSSortEigenvalues(), EPSWhich
490: @*/
491: PetscErrorCode EPSSetWhichEigenpairs(EPS eps,EPSWhich which)
492: {
496:   if (which) {
497:     if (which==PETSC_DECIDE || which==PETSC_DEFAULT) eps->which = (EPSWhich)0;
498:     else switch (which) {
499:       case EPS_LARGEST_MAGNITUDE:
500:       case EPS_SMALLEST_MAGNITUDE:
501:       case EPS_LARGEST_REAL:
502:       case EPS_SMALLEST_REAL:
503:       case EPS_LARGEST_IMAGINARY:
504:       case EPS_SMALLEST_IMAGINARY:
505:       case EPS_TARGET_MAGNITUDE:
506:       case EPS_TARGET_REAL:
507: #if defined(PETSC_USE_COMPLEX)
508:       case EPS_TARGET_IMAGINARY:
509: #endif
510:       case EPS_ALL:
511:       case EPS_WHICH_USER:
512:         if (eps->which != which) {
513:           eps->setupcalled = 0;
514:           eps->which = which;
515:         }
516:         break;
517:       default:
518:         SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value");
519:     }
520:   }
521:   return(0);
522: }

526: /*@C
527:    EPSGetWhichEigenpairs - Returns which portion of the spectrum is to be
528:    sought.

530:    Not Collective

532:    Input Parameter:
533: .  eps - eigensolver context obtained from EPSCreate()

535:    Output Parameter:
536: .  which - the portion of the spectrum to be sought

538:    Notes:
539:    See EPSSetWhichEigenpairs() for possible values of 'which'.

541:    Level: intermediate

543: .seealso: EPSSetWhichEigenpairs(), EPSWhich
544: @*/
545: PetscErrorCode EPSGetWhichEigenpairs(EPS eps,EPSWhich *which)
546: {
550:   *which = eps->which;
551:   return(0);
552: }

556: /*@
557:    EPSSetLeftVectorsWanted - Specifies which eigenvectors are required.

559:    Logically Collective on EPS

561:    Input Parameters:
562: +  eps      - the eigensolver context
563: -  leftvecs - whether left eigenvectors are required or not

565:    Options Database Keys:
566: .  -eps_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'

568:    Notes:
569:    If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of
570:    the algorithm that computes both right and left eigenvectors. This is
571:    usually much more costly. This option is not available in all solvers.

573:    Level: intermediate

575: .seealso: EPSGetLeftVectorsWanted(), EPSGetEigenvectorLeft()
576: @*/
577: PetscErrorCode EPSSetLeftVectorsWanted(EPS eps,PetscBool leftvecs)
578: {
582:   if (eps->leftvecs != leftvecs) {
583:     eps->leftvecs = leftvecs;
584:     eps->setupcalled = 0;
585:   }
586:   return(0);
587: }

591: /*@
592:    EPSGetLeftVectorsWanted - Returns the flag indicating whether left
593:    eigenvectors are required or not.

595:    Not Collective

597:    Input Parameter:
598: .  eps - the eigensolver context

600:    Output Parameter:
601: .  leftvecs - the returned flag

603:    Level: intermediate

605: .seealso: EPSSetLeftVectorsWanted(), EPSWhich
606: @*/
607: PetscErrorCode EPSGetLeftVectorsWanted(EPS eps,PetscBool *leftvecs)
608: {
612:   *leftvecs = eps->leftvecs;
613:   return(0);
614: }

618: /*@
619:    EPSSetMatrixNorms - Gives the reference values of the matrix norms
620:    and specifies whether these values should be improved adaptively.

622:    Logically Collective on EPS

624:    Input Parameters:
625: +  eps      - the eigensolver context
626: .  nrma     - a reference value for the norm of matrix A
627: .  nrmb     - a reference value for the norm of matrix B
628: -  adaptive - whether matrix norms are improved adaptively

630:    Options Database Keys:
631: +  -eps_norm_a <nrma> - norm of A
632: .  -eps_norm_b <nrma> - norm of B
633: -  -eps_norms_adaptive <boolean> - Sets/resets the boolean flag 'adaptive'

635:    Notes:
636:    If the user sets adaptive=PETSC_FALSE then the solver uses the values
637:    of nrma and nrmb for the matrix norms, and these values do not change
638:    throughout the iteration.

640:    If the user sets adaptive=PETSC_TRUE then the solver tries to adaptively
641:    improve the supplied values, with the numerical information generated
642:    during the iteration. This option is not available in all solvers.

644:    If a passed value is PETSC_DEFAULT, the corresponding norm will be set to 1.
645:    If a passed value is PETSC_DETERMINE, the corresponding norm will be computed
646:    as the NORM_INFINITY with MatNorm().

648:    Level: intermediate

650: .seealso: EPSGetMatrixNorms()
651: @*/
652: PetscErrorCode EPSSetMatrixNorms(EPS eps,PetscReal nrma,PetscReal nrmb,PetscBool adaptive)
653: {
659:   if (nrma) {
660:     if (nrma == PETSC_DEFAULT) eps->nrma = 1.0;
661:     else if (nrma == PETSC_DETERMINE) {
662:       eps->nrma = nrma;
663:       eps->setupcalled = 0;
664:     } else {
665:       if (nrma < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nrma. Must be > 0");
666:       eps->nrma = nrma;
667:     }
668:   }
669:   if (nrmb) {
670:     if (!eps->isgeneralized) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Norm of B only allowed in generalized problems");
671:     if (nrmb == PETSC_DEFAULT) eps->nrmb = 1.0;
672:     else if (nrmb == PETSC_DETERMINE) {
673:       eps->nrmb = nrmb;
674:       eps->setupcalled = 0;
675:     } else {
676:       if (nrmb < 0.0) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nrmb. Must be > 0");
677:       eps->nrmb = nrmb;
678:     }
679:   }
680:   if (eps->adaptive != adaptive) {
681:     eps->adaptive = adaptive;
682:     eps->setupcalled = 0;
683:     if (adaptive) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"Sorry, adaptive norms are not implemented in this release");
684:   }
685:   return(0);
686: }

690: /*@
691:    EPSGetMatrixNorms - Returns the value of the matrix norms (either set
692:    by the user or estimated by the solver) and the flag indicating whether
693:    the norms are being adaptively improved.

695:    Not Collective

697:    Input Parameter:
698: .  eps - the eigensolver context

700:    Output Parameters:
701: +  nrma     - the norm of matrix A
702: .  nrmb     - the norm of matrix B
703: -  adaptive - whether matrix norms are improved adaptively

705:    Level: intermediate

707: .seealso: EPSSetMatrixNorms()
708: @*/
709: PetscErrorCode EPSGetMatrixNorms(EPS eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive)
710: {
713:   if (nrma) *nrma = eps->nrma;
714:   if (nrmb) *nrmb = eps->nrmb;
715:   if (adaptive) *adaptive = eps->adaptive;
716:   return(0);
717: }

721: /*@C
722:    EPSSetEigenvalueComparison - Specifies the eigenvalue comparison function
723:    when EPSSetWhichEigenpairs() is set to EPS_WHICH_USER.

725:    Logically Collective on EPS

727:    Input Parameters:
728: +  eps  - eigensolver context obtained from EPSCreate()
729: .  func - a pointer to the comparison function
730: -  ctx  - a context pointer (the last parameter to the comparison function)

732:    Calling Sequence of func:
733: $   func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

735: +   ar     - real part of the 1st eigenvalue
736: .   ai     - imaginary part of the 1st eigenvalue
737: .   br     - real part of the 2nd eigenvalue
738: .   bi     - imaginary part of the 2nd eigenvalue
739: .   res    - result of comparison
740: -   ctx    - optional context, as set by EPSSetEigenvalueComparison()

742:    Note:
743:    The returning parameter 'res' can be:
744: +  negative - if the 1st eigenvalue is preferred to the 2st one
745: .  zero     - if both eigenvalues are equally preferred
746: -  positive - if the 2st eigenvalue is preferred to the 1st one

748:    Level: advanced

750: .seealso: EPSSetWhichEigenpairs(), EPSSortEigenvalues(), EPSWhich
751: @*/
752: PetscErrorCode EPSSetEigenvalueComparison(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)
753: {
756:   eps->comparison    = func;
757:   eps->comparisonctx = ctx;
758:   eps->which         = EPS_WHICH_USER;
759:   return(0);
760: }

764: /*@C
765:    EPSSetArbitrarySelection - Specifies a function intended to look for
766:    eigenvalues according to an arbitrary selection criterion. This criterion
767:    can be based on a computation involving the current eigenvector approximation.

769:    Logically Collective on EPS

771:    Input Parameters:
772: +  eps  - eigensolver context obtained from EPSCreate()
773: .  func - a pointer to the evaluation function
774: -  ctx  - a context pointer (the last parameter to the evaluation function)

776:    Calling Sequence of func:
777: $   func(PetscScalar er,PetscScalar ei,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx)

779: +   er     - real part of the current eigenvalue approximation
780: .   ei     - imaginary part of the current eigenvalue approximation
781: .   xr     - real part of the current eigenvector approximation
782: .   xi     - imaginary part of the current eigenvector approximation
783: .   rr     - result of evaluation (real part)
784: .   ri     - result of evaluation (imaginary part)
785: -   ctx    - optional context, as set by EPSSetArbitrarySelection()

787:    Note:
788:    This provides a mechanism to select eigenpairs by evaluating a user-defined
789:    function. When a function has been provided, the default selection based on
790:    sorting the eigenvalues is replaced by the sorting of the results of this
791:    function (with the same sorting criterion given in EPSSortEigenvalues()).

793:    For instance, suppose you want to compute those eigenvectors that maximize
794:    a certain computable expression. Then implement the computation using
795:    the arguments xr and xi, and return the result in rr. Then set the standard
796:    sorting by magnitude so that the eigenpair with largest value of rr is
797:    selected.

799:    The result of func is expressed as a complex number so that it is possible to
800:    use the standard eigenvalue sorting functions, but normally only rr is used.
801:    Set ri to zero unless it is meaningful in your application.

803:    Level: advanced

805: .seealso: EPSSetWhichEigenpairs(), EPSSortEigenvalues()
806: @*/
807: PetscErrorCode EPSSetArbitrarySelection(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*),void* ctx)
808: {
811:   eps->arbitrary    = func;
812:   eps->arbitraryctx = ctx;
813:   eps->setupcalled  = 0;
814:   return(0);
815: }

819: /*@C
820:    EPSSetConvergenceTestFunction - Sets a function to compute the error estimate
821:    used in the convergence test.

823:    Logically Collective on EPS

825:    Input Parameters:
826: +  eps  - eigensolver context obtained from EPSCreate()
827: .  func - a pointer to the convergence test function
828: -  ctx  - a context pointer (the last parameter to the convergence test function)

830:    Calling Sequence of func:
831: $   func(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)

833: +   eps    - eigensolver context obtained from EPSCreate()
834: .   eigr   - real part of the eigenvalue
835: .   eigi   - imaginary part of the eigenvalue
836: .   res    - residual norm associated to the eigenpair
837: .   errest - (output) computed error estimate
838: -   ctx    - optional context, as set by EPSSetConvergenceTest()

840:    Note:
841:    If the error estimate returned by the convergence test function is less than
842:    the tolerance, then the eigenvalue is accepted as converged.

844:    Level: advanced

846: .seealso: EPSSetConvergenceTest(),EPSSetTolerances()
847: @*/
848: PetscErrorCode EPSSetConvergenceTestFunction(EPS eps,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)
849: {
852:   eps->converged    = func;
853:   eps->convergedctx = ctx;
854:   if (func == EPSConvergedEigRelative) eps->conv = EPS_CONV_EIG;
855:   else if (func == EPSConvergedNormRelative) eps->conv = EPS_CONV_NORM;
856:   else if (func == EPSConvergedAbsolute) eps->conv = EPS_CONV_ABS;
857:   else eps->conv = EPS_CONV_USER;
858:   return(0);
859: }

863: /*@
864:    EPSSetConvergenceTest - Specifies how to compute the error estimate
865:    used in the convergence test.

867:    Logically Collective on EPS

869:    Input Parameters:
870: +  eps   - eigensolver context obtained from EPSCreate()
871: -  conv  - the type of convergence test

873:    Options Database Keys:
874: +  -eps_conv_abs - Sets the absolute convergence test
875: .  -eps_conv_eig - Sets the convergence test relative to the eigenvalue
876: -  -eps_conv_norm - Sets the convergence test relative to the matrix norms

878:    Note:
879:    The parameter 'conv' can have one of these values
880: +     EPS_CONV_ABS - absolute error ||r||
881: .     EPS_CONV_EIG - error relative to the eigenvalue l, ||r||/|l|
882: .     EPS_CONV_NORM - error relative to the matrix norms, ||r||/(||A||+|l|*||B||)
883: -     EPS_CONV_USER - function set by EPSSetConvergenceTestFunction()

885:    Level: intermediate

887: .seealso: EPSGetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv
888: @*/
889: PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv)
890: {
894:   switch (conv) {
895:     case EPS_CONV_EIG:  eps->converged = EPSConvergedEigRelative; break;
896:     case EPS_CONV_NORM: eps->converged = EPSConvergedNormRelative; break;
897:     case EPS_CONV_ABS:  eps->converged = EPSConvergedAbsolute; break;
898:     case EPS_CONV_USER: break;
899:     default:
900:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'conv' value");
901:   }
902:   eps->conv = conv;
903:   return(0);
904: }

908: /*@
909:    EPSGetConvergenceTest - Gets the method used to compute the error estimate
910:    used in the convergence test.

912:    Not Collective

914:    Input Parameters:
915: .  eps   - eigensolver context obtained from EPSCreate()

917:    Output Parameters:
918: .  conv  - the type of convergence test

920:    Level: intermediate

922: .seealso: EPSSetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv
923: @*/
924: PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv)
925: {
929:   *conv = eps->conv;
930:   return(0);
931: }

935: /*@
936:    EPSSetProblemType - Specifies the type of the eigenvalue problem.

938:    Logically Collective on EPS

940:    Input Parameters:
941: +  eps      - the eigensolver context
942: -  type     - a known type of eigenvalue problem

944:    Options Database Keys:
945: +  -eps_hermitian - Hermitian eigenvalue problem
946: .  -eps_gen_hermitian - generalized Hermitian eigenvalue problem
947: .  -eps_non_hermitian - non-Hermitian eigenvalue problem
948: .  -eps_gen_non_hermitian - generalized non-Hermitian eigenvalue problem
949: -  -eps_pos_gen_non_hermitian - generalized non-Hermitian eigenvalue problem
950:    with positive semi-definite B

952:    Notes:
953:    Allowed values for the problem type are: Hermitian (EPS_HEP), non-Hermitian
954:    (EPS_NHEP), generalized Hermitian (EPS_GHEP), generalized non-Hermitian
955:    (EPS_GNHEP), generalized non-Hermitian with positive semi-definite B
956:    (EPS_PGNHEP), and generalized Hermitian-indefinite (EPS_GHIEP).

958:    This function must be used to instruct SLEPc to exploit symmetry. If no
959:    problem type is specified, by default a non-Hermitian problem is assumed
960:    (either standard or generalized). If the user knows that the problem is
961:    Hermitian (i.e. A=A^H) or generalized Hermitian (i.e. A=A^H, B=B^H, and
962:    B positive definite) then it is recommended to set the problem type so
963:    that eigensolver can exploit these properties.

965:    Level: beginner

967: .seealso: EPSSetOperators(), EPSSetType(), EPSGetProblemType(), EPSProblemType
968: @*/
969: PetscErrorCode EPSSetProblemType(EPS eps,EPSProblemType type)
970: {
974:   switch (type) {
975:     case EPS_HEP:
976:       eps->isgeneralized = PETSC_FALSE;
977:       eps->ishermitian = PETSC_TRUE;
978:       eps->ispositive = PETSC_FALSE;
979:       break;
980:     case EPS_NHEP:
981:       eps->isgeneralized = PETSC_FALSE;
982:       eps->ishermitian = PETSC_FALSE;
983:       eps->ispositive = PETSC_FALSE;
984:       break;
985:     case EPS_GHEP:
986:       eps->isgeneralized = PETSC_TRUE;
987:       eps->ishermitian = PETSC_TRUE;
988:       eps->ispositive = PETSC_TRUE;
989:       break;
990:     case EPS_GNHEP:
991:       eps->isgeneralized = PETSC_TRUE;
992:       eps->ishermitian = PETSC_FALSE;
993:       eps->ispositive = PETSC_FALSE;
994:       break;
995:     case EPS_PGNHEP:
996:       eps->isgeneralized = PETSC_TRUE;
997:       eps->ishermitian = PETSC_FALSE;
998:       eps->ispositive = PETSC_TRUE;
999:       break;
1000:     case EPS_GHIEP:
1001:       eps->isgeneralized = PETSC_TRUE;
1002:       eps->ishermitian = PETSC_TRUE;
1003:       eps->ispositive = PETSC_FALSE;
1004:       break;
1005:     default:
1006:       SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type");
1007:   }
1008:   eps->problem_type = type;
1009:   return(0);
1010: }

1014: /*@C
1015:    EPSGetProblemType - Gets the problem type from the EPS object.

1017:    Not Collective

1019:    Input Parameter:
1020: .  eps - the eigensolver context

1022:    Output Parameter:
1023: .  type - name of EPS problem type

1025:    Level: intermediate

1027: .seealso: EPSSetProblemType(), EPSProblemType
1028: @*/
1029: PetscErrorCode EPSGetProblemType(EPS eps,EPSProblemType *type)
1030: {
1034:   *type = eps->problem_type;
1035:   return(0);
1036: }

1040: /*@
1041:    EPSSetExtraction - Specifies the type of extraction technique to be employed
1042:    by the eigensolver.

1044:    Logically Collective on EPS

1046:    Input Parameters:
1047: +  eps  - the eigensolver context
1048: -  extr - a known type of extraction

1050:    Options Database Keys:
1051: +  -eps_ritz - Rayleigh-Ritz extraction
1052: .  -eps_harmonic - harmonic Ritz extraction
1053: .  -eps_harmonic_relative - harmonic Ritz extraction relative to the eigenvalue
1054: .  -eps_harmonic_right - harmonic Ritz extraction for rightmost eigenvalues
1055: .  -eps_harmonic_largest - harmonic Ritz extraction for largest magnitude
1056:    (without target)
1057: .  -eps_refined - refined Ritz extraction
1058: -  -eps_refined_harmonic - refined harmonic Ritz extraction

1060:    Notes:
1061:    Not all eigensolvers support all types of extraction. See the SLEPc
1062:    Users Manual for details.

1064:    By default, a standard Rayleigh-Ritz extraction is used. Other extractions
1065:    may be useful when computing interior eigenvalues.

1067:    Harmonic-type extractions are used in combination with a 'target'.

1069:    Level: beginner

1071: .seealso: EPSSetTarget(), EPSGetExtraction(), EPSExtraction
1072: @*/
1073: PetscErrorCode EPSSetExtraction(EPS eps,EPSExtraction extr)
1074: {
1078:   eps->extraction = extr;
1079:   return(0);
1080: }

1084: /*@C
1085:    EPSGetExtraction - Gets the extraction type used by the EPS object.

1087:    Not Collective

1089:    Input Parameter:
1090: .  eps - the eigensolver context

1092:    Output Parameter:
1093: .  extr - name of extraction type

1095:    Level: intermediate

1097: .seealso: EPSSetExtraction(), EPSExtraction
1098: @*/
1099: PetscErrorCode EPSGetExtraction(EPS eps,EPSExtraction *extr)
1100: {
1104:   *extr = eps->extraction;
1105:   return(0);
1106: }

1110: /*@
1111:    EPSSetBalance - Specifies the balancing technique to be employed by the
1112:    eigensolver, and some parameters associated to it.

1114:    Logically Collective on EPS

1116:    Input Parameters:
1117: +  eps    - the eigensolver context
1118: .  bal    - the balancing method, one of EPS_BALANCE_NONE, EPS_BALANCE_ONESIDE,
1119:             EPS_BALANCE_TWOSIDE, or EPS_BALANCE_USER
1120: .  its    - number of iterations of the balancing algorithm
1121: -  cutoff - cutoff value

1123:    Options Database Keys:
1124: +  -eps_balance <method> - the balancing method, where <method> is one of
1125:                            'none', 'oneside', 'twoside', or 'user'
1126: .  -eps_balance_its <its> - number of iterations
1127: -  -eps_balance_cutoff <cutoff> - cutoff value

1129:    Notes:
1130:    When balancing is enabled, the solver works implicitly with matrix DAD^-1,
1131:    where D is an appropriate diagonal matrix. This improves the accuracy of
1132:    the computed results in some cases. See the SLEPc Users Manual for details.

1134:    Balancing makes sense only for non-Hermitian problems when the required
1135:    precision is high (i.e. a small tolerance such as 1e-15).

1137:    By default, balancing is disabled. The two-sided method is much more
1138:    effective than the one-sided counterpart, but it requires the system
1139:    matrices to have the MatMultTranspose operation defined.

1141:    The parameter 'its' is the number of iterations performed by the method. The
1142:    cutoff value is used only in the two-side variant. Pass 0 for an argument
1143:    that need not be changed. Use PETSC_DECIDE to assign a reasonably good value.

1145:    User-defined balancing is allowed provided that the corresponding matrix
1146:    is set via STSetBalanceMatrix.

1148:    Level: intermediate

1150: .seealso: EPSGetBalance(), EPSBalance, STSetBalanceMatrix()
1151: @*/
1152: PetscErrorCode EPSSetBalance(EPS eps,EPSBalance bal,PetscInt its,PetscReal cutoff)
1153: {
1159:   if (bal) {
1160:     if (bal==PETSC_DECIDE || bal==PETSC_DEFAULT) eps->balance = EPS_BALANCE_TWOSIDE;
1161:     else switch (bal) {
1162:       case EPS_BALANCE_NONE:
1163:       case EPS_BALANCE_ONESIDE:
1164:       case EPS_BALANCE_TWOSIDE:
1165:       case EPS_BALANCE_USER:
1166:         eps->balance = bal;
1167:         break;
1168:       default:
1169:         SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Invalid value of argument 'bal'");
1170:     }
1171:   }
1172:   if (its) {
1173:     if (its==PETSC_DECIDE || its==PETSC_DEFAULT) eps->balance_its = 5;
1174:     else eps->balance_its = its;
1175:   }
1176:   if (cutoff) {
1177:     if (cutoff==PETSC_DECIDE || cutoff==PETSC_DEFAULT) eps->balance_cutoff = 1e-8;
1178:     else eps->balance_cutoff = cutoff;
1179:   }
1180:   return(0);
1181: }

1185: /*@
1186:    EPSGetBalance - Gets the balancing type used by the EPS object, and the associated
1187:    parameters.

1189:    Not Collective

1191:    Input Parameter:
1192: .  eps - the eigensolver context

1194:    Output Parameters:
1195: +  bal    - the balancing method
1196: .  its    - number of iterations of the balancing algorithm
1197: -  cutoff - cutoff value

1199:    Level: intermediate

1201:    Note:
1202:    The user can specify NULL for any parameter that is not needed.

1204: .seealso: EPSSetBalance(), EPSBalance
1205: @*/
1206: PetscErrorCode EPSGetBalance(EPS eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff)
1207: {
1210:   if (bal)    *bal = eps->balance;
1211:   if (its)    *its = eps->balance_its;
1212:   if (cutoff) *cutoff = eps->balance_cutoff;
1213:   return(0);
1214: }

1218: /*@
1219:    EPSSetTrueResidual - Specifies if the solver must compute the true residual
1220:    explicitly or not.

1222:    Logically Collective on EPS

1224:    Input Parameters:
1225: +  eps     - the eigensolver context
1226: -  trueres - whether true residuals are required or not

1228:    Options Database Keys:
1229: .  -eps_true_residual <boolean> - Sets/resets the boolean flag 'trueres'

1231:    Notes:
1232:    If the user sets trueres=PETSC_TRUE then the solver explicitly computes
1233:    the true residual for each eigenpair approximation, and uses it for
1234:    convergence testing. Computing the residual is usually an expensive
1235:    operation. Some solvers (e.g., Krylov solvers) can avoid this computation
1236:    by using a cheap estimate of the residual norm, but this may sometimes
1237:    give inaccurate results (especially if a spectral transform is being
1238:    used). On the contrary, preconditioned eigensolvers (e.g., Davidson solvers)
1239:    do rely on computing the true residual, so this option is irrelevant for them.

1241:    Level: intermediate

1243: .seealso: EPSGetTrueResidual()
1244: @*/
1245: PetscErrorCode EPSSetTrueResidual(EPS eps,PetscBool trueres)
1246: {
1250:   eps->trueres = trueres;
1251:   return(0);
1252: }

1256: /*@C
1257:    EPSGetTrueResidual - Returns the flag indicating whether true
1258:    residuals must be computed explicitly or not.

1260:    Not Collective

1262:    Input Parameter:
1263: .  eps - the eigensolver context

1265:    Output Parameter:
1266: .  trueres - the returned flag

1268:    Level: intermediate

1270: .seealso: EPSSetTrueResidual()
1271: @*/
1272: PetscErrorCode EPSGetTrueResidual(EPS eps,PetscBool *trueres)
1273: {
1277:   *trueres = eps->trueres;
1278:   return(0);
1279: }

1283: /*@
1284:    EPSSetTrackAll - Specifies if the solver must compute the residual norm of all
1285:    approximate eigenpairs or not.

1287:    Logically Collective on EPS

1289:    Input Parameters:
1290: +  eps      - the eigensolver context
1291: -  trackall - whether to compute all residuals or not

1293:    Notes:
1294:    If the user sets trackall=PETSC_TRUE then the solver computes (or estimates)
1295:    the residual norm for each eigenpair approximation. Computing the residual is
1296:    usually an expensive operation and solvers commonly compute only the residual
1297:    associated to the first unconverged eigenpair.

1299:    The options '-eps_monitor_all' and '-eps_monitor_lg_all' automatically
1300:    activate this option.

1302:    Level: intermediate

1304: .seealso: EPSGetTrackAll()
1305: @*/
1306: PetscErrorCode EPSSetTrackAll(EPS eps,PetscBool trackall)
1307: {
1311:   eps->trackall = trackall;
1312:   return(0);
1313: }

1317: /*@
1318:    EPSGetTrackAll - Returns the flag indicating whether all residual norms must
1319:    be computed or not.

1321:    Not Collective

1323:    Input Parameter:
1324: .  eps - the eigensolver context

1326:    Output Parameter:
1327: .  trackall - the returned flag

1329:    Level: intermediate

1331: .seealso: EPSSetTrackAll()
1332: @*/
1333: PetscErrorCode EPSGetTrackAll(EPS eps,PetscBool *trackall)
1334: {
1338:   *trackall = eps->trackall;
1339:   return(0);
1340: }

1344: /*@C
1345:    EPSSetOptionsPrefix - Sets the prefix used for searching for all
1346:    EPS options in the database.

1348:    Logically Collective on EPS

1350:    Input Parameters:
1351: +  eps - the eigensolver context
1352: -  prefix - the prefix string to prepend to all EPS option requests

1354:    Notes:
1355:    A hyphen (-) must NOT be given at the beginning of the prefix name.
1356:    The first character of all runtime options is AUTOMATICALLY the
1357:    hyphen.

1359:    For example, to distinguish between the runtime options for two
1360:    different EPS contexts, one could call
1361: .vb
1362:       EPSSetOptionsPrefix(eps1,"eig1_")
1363:       EPSSetOptionsPrefix(eps2,"eig2_")
1364: .ve

1366:    Level: advanced

1368: .seealso: EPSAppendOptionsPrefix(), EPSGetOptionsPrefix()
1369: @*/
1370: PetscErrorCode EPSSetOptionsPrefix(EPS eps,const char *prefix)
1371: {

1376:   if (!eps->st) { EPSGetST(eps,&eps->st); }
1377:   STSetOptionsPrefix(eps->st,prefix);
1378:   if (!eps->ip) { EPSGetIP(eps,&eps->ip); }
1379:   IPSetOptionsPrefix(eps->ip,prefix);
1380:   if (!eps->ds) { EPSGetDS(eps,&eps->ds); }
1381:   DSSetOptionsPrefix(eps->ds,prefix);
1382:   PetscObjectSetOptionsPrefix((PetscObject)eps,prefix);
1383:   return(0);
1384: }

1388: /*@C
1389:    EPSAppendOptionsPrefix - Appends to the prefix used for searching for all
1390:    EPS options in the database.

1392:    Logically Collective on EPS

1394:    Input Parameters:
1395: +  eps - the eigensolver context
1396: -  prefix - the prefix string to prepend to all EPS option requests

1398:    Notes:
1399:    A hyphen (-) must NOT be given at the beginning of the prefix name.
1400:    The first character of all runtime options is AUTOMATICALLY the hyphen.

1402:    Level: advanced

1404: .seealso: EPSSetOptionsPrefix(), EPSGetOptionsPrefix()
1405: @*/
1406: PetscErrorCode EPSAppendOptionsPrefix(EPS eps,const char *prefix)
1407: {

1412:   if (!eps->st) { EPSGetST(eps,&eps->st); }
1413:   STAppendOptionsPrefix(eps->st,prefix);
1414:   if (!eps->ip) { EPSGetIP(eps,&eps->ip); }
1415:   IPSetOptionsPrefix(eps->ip,prefix);
1416:   if (!eps->ds) { EPSGetDS(eps,&eps->ds); }
1417:   DSSetOptionsPrefix(eps->ds,prefix);
1418:   PetscObjectAppendOptionsPrefix((PetscObject)eps,prefix);
1419:   return(0);
1420: }

1424: /*@C
1425:    EPSGetOptionsPrefix - Gets the prefix used for searching for all
1426:    EPS options in the database.

1428:    Not Collective

1430:    Input Parameters:
1431: .  eps - the eigensolver context

1433:    Output Parameters:
1434: .  prefix - pointer to the prefix string used is returned

1436:    Notes: On the fortran side, the user should pass in a string 'prefix' of
1437:    sufficient length to hold the prefix.

1439:    Level: advanced

1441: .seealso: EPSSetOptionsPrefix(), EPSAppendOptionsPrefix()
1442: @*/
1443: PetscErrorCode EPSGetOptionsPrefix(EPS eps,const char *prefix[])
1444: {

1450:   PetscObjectGetOptionsPrefix((PetscObject)eps,prefix);
1451:   return(0);
1452: }
slepc-3.4.2.dfsg.orig/src/eps/interface/monitor.c.html0000644000175000017500000010410012211062077021543 0ustar gladkgladk
Actual source code: monitor.c

  1: /*
  2:       EPS routines related to monitors.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/epsimpl.h>   /*I "slepceps.h" I*/
 25: #include <petscdraw.h>

 29: /*
 30:    Runs the user provided monitor routines, if any.
 31: */
 32: PetscErrorCode EPSMonitor(EPS eps,PetscInt it,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest)
 33: {
 35:   PetscInt       i,n = eps->numbermonitors;

 38:   for (i=0;i<n;i++) {
 39:     (*eps->monitor[i])(eps,it,nconv,eigr,eigi,errest,nest,eps->monitorcontext[i]);
 40:   }
 41:   return(0);
 42: }

 46: /*@C
 47:    EPSMonitorSet - Sets an ADDITIONAL function to be called at every
 48:    iteration to monitor the error estimates for each requested eigenpair.

 50:    Logically Collective on EPS

 52:    Input Parameters:
 53: +  eps     - eigensolver context obtained from EPSCreate()
 54: .  monitor - pointer to function (if this is NULL, it turns off monitoring)
 55: .  mctx    - [optional] context for private data for the
 56:              monitor routine (use NULL if no context is desired)
 57: -  monitordestroy - [optional] routine that frees monitor context (may be NULL)

 59:    Calling Sequence of monitor:
 60: $     monitor (EPS eps, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx)

 62: +  eps    - eigensolver context obtained from EPSCreate()
 63: .  its    - iteration number
 64: .  nconv  - number of converged eigenpairs
 65: .  eigr   - real part of the eigenvalues
 66: .  eigi   - imaginary part of the eigenvalues
 67: .  errest - relative error estimates for each eigenpair
 68: .  nest   - number of error estimates
 69: -  mctx   - optional monitoring context, as set by EPSMonitorSet()

 71:    Options Database Keys:
 72: +    -eps_monitor        - print only the first error estimate
 73: .    -eps_monitor_all    - print error estimates at each iteration
 74: .    -eps_monitor_conv   - print the eigenvalue approximations only when
 75:       convergence has been reached
 76: .    -eps_monitor_lg     - sets line graph monitor for the first unconverged
 77:       approximate eigenvalue
 78: .    -eps_monitor_lg_all - sets line graph monitor for all unconverged
 79:       approximate eigenvalues
 80: -    -eps_monitor_cancel - cancels all monitors that have been hardwired into
 81:       a code by calls to EPSMonitorSet(), but does not cancel those set via
 82:       the options database.

 84:    Notes:
 85:    Several different monitoring routines may be set by calling
 86:    EPSMonitorSet() multiple times; all will be called in the
 87:    order in which they were set.

 89:    Level: intermediate

 91: .seealso: EPSMonitorFirst(), EPSMonitorAll(), EPSMonitorCancel()
 92: @*/
 93: PetscErrorCode EPSMonitorSet(EPS eps,PetscErrorCode (*monitor)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
 94: {
 97:   if (eps->numbermonitors >= MAXEPSMONITORS) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_OUTOFRANGE,"Too many EPS monitors set");
 98:   eps->monitor[eps->numbermonitors]           = monitor;
 99:   eps->monitorcontext[eps->numbermonitors]    = (void*)mctx;
100:   eps->monitordestroy[eps->numbermonitors++]  = monitordestroy;
101:   return(0);
102: }

106: /*@
107:    EPSMonitorCancel - Clears all monitors for an EPS object.

109:    Logically Collective on EPS

111:    Input Parameters:
112: .  eps - eigensolver context obtained from EPSCreate()

114:    Options Database Key:
115: .    -eps_monitor_cancel - Cancels all monitors that have been hardwired
116:       into a code by calls to EPSMonitorSet(),
117:       but does not cancel those set via the options database.

119:    Level: intermediate

121: .seealso: EPSMonitorSet()
122: @*/
123: PetscErrorCode EPSMonitorCancel(EPS eps)
124: {
126:   PetscInt       i;

130:   for (i=0; i<eps->numbermonitors; i++) {
131:     if (eps->monitordestroy[i]) {
132:       (*eps->monitordestroy[i])(&eps->monitorcontext[i]);
133:     }
134:   }
135:   eps->numbermonitors = 0;
136:   return(0);
137: }

141: /*@C
142:    EPSGetMonitorContext - Gets the monitor context, as set by
143:    EPSMonitorSet() for the FIRST monitor only.

145:    Not Collective

147:    Input Parameter:
148: .  eps - eigensolver context obtained from EPSCreate()

150:    Output Parameter:
151: .  ctx - monitor context

153:    Level: intermediate

155: .seealso: EPSMonitorSet()
156: @*/
157: PetscErrorCode EPSGetMonitorContext(EPS eps,void **ctx)
158: {
161:   *ctx = eps->monitorcontext[0];
162:   return(0);
163: }

167: /*@C
168:    EPSMonitorAll - Print the current approximate values and
169:    error estimates at each iteration of the eigensolver.

171:    Collective on EPS

173:    Input Parameters:
174: +  eps    - eigensolver context
175: .  its    - iteration number
176: .  nconv  - number of converged eigenpairs so far
177: .  eigr   - real part of the eigenvalues
178: .  eigi   - imaginary part of the eigenvalues
179: .  errest - error estimates
180: .  nest   - number of error estimates to display
181: -  monctx - monitor context (contains viewer, can be NULL)

183:    Level: intermediate

185: .seealso: EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorConverged()
186: @*/
187: PetscErrorCode EPSMonitorAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
188: {
190:   PetscInt       i;
191:   PetscScalar    er,ei;
192:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps));

195:   if (its) {
196:     PetscViewerASCIIAddTab(viewer,((PetscObject)eps)->tablevel);
197:     PetscViewerASCIIPrintf(viewer,"%3D EPS nconv=%D Values (Errors)",its,nconv);
198:     for (i=0;i<nest;i++) {
199:       er = eigr[i]; ei = eigi[i];
200:       STBackTransform(eps->st,1,&er,&ei);
201: #if defined(PETSC_USE_COMPLEX)
202:       PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));
203: #else
204:       PetscViewerASCIIPrintf(viewer," %G",er);
205:       if (ei!=0.0) { PetscViewerASCIIPrintf(viewer,"%+Gi",ei); }
206: #endif
207:       PetscViewerASCIIPrintf(viewer," (%10.8e)",(double)errest[i]);
208:     }
209:     PetscViewerASCIIPrintf(viewer,"\n");
210:     PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);
211:   }
212:   return(0);
213: }

217: /*@C
218:    EPSMonitorFirst - Print the first approximate value and
219:    error estimate at each iteration of the eigensolver.

221:    Collective on EPS

223:    Input Parameters:
224: +  eps    - eigensolver context
225: .  its    - iteration number
226: .  nconv  - number of converged eigenpairs so far
227: .  eigr   - real part of the eigenvalues
228: .  eigi   - imaginary part of the eigenvalues
229: .  errest - error estimates
230: .  nest   - number of error estimates to display
231: -  monctx - monitor context (contains viewer, can be NULL)

233:    Level: intermediate

235: .seealso: EPSMonitorSet(), EPSMonitorAll(), EPSMonitorConverged()
236: @*/
237: PetscErrorCode EPSMonitorFirst(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
238: {
240:   PetscScalar    er,ei;
241:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps));

244:   if (its && nconv<nest) {
245:     PetscViewerASCIIAddTab(viewer,((PetscObject)eps)->tablevel);
246:     PetscViewerASCIIPrintf(viewer,"%3D EPS nconv=%D first unconverged value (error)",its,nconv);
247:     er = eigr[nconv]; ei = eigi[nconv];
248:     STBackTransform(eps->st,1,&er,&ei);
249: #if defined(PETSC_USE_COMPLEX)
250:     PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));
251: #else
252:     PetscViewerASCIIPrintf(viewer," %G",er);
253:     if (ei!=0.0) { PetscViewerASCIIPrintf(viewer,"%+Gi",ei); }
254: #endif
255:     PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[nconv]);
256:     PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);
257:   }
258:   return(0);
259: }

263: /*@C
264:    EPSMonitorConverged - Print the approximate values and
265:    error estimates as they converge.

267:    Collective on EPS

269:    Input Parameters:
270: +  eps    - eigensolver context
271: .  its    - iteration number
272: .  nconv  - number of converged eigenpairs so far
273: .  eigr   - real part of the eigenvalues
274: .  eigi   - imaginary part of the eigenvalues
275: .  errest - error estimates
276: .  nest   - number of error estimates to display
277: -  monctx - monitor context

279:    Note:
280:    The monitor context must contain a struct with a PetscViewer and a
281:    PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

283:    Level: intermediate

285: .seealso: EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorAll()
286: @*/
287: PetscErrorCode EPSMonitorConverged(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
288: {
289:   PetscErrorCode   ierr;
290:   PetscInt         i;
291:   PetscScalar      er,ei;
292:   PetscViewer      viewer;
293:   SlepcConvMonitor ctx = (SlepcConvMonitor)monctx;

296:   if (!monctx) SETERRQ(PetscObjectComm((PetscObject)eps),PETSC_ERR_ARG_WRONG,"Must provide a context for EPSMonitorConverged");
297:   if (!its) {
298:     ctx->oldnconv = 0;
299:   } else {
300:     viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)eps));
301:     for (i=ctx->oldnconv;i<nconv;i++) {
302:       PetscViewerASCIIAddTab(viewer,((PetscObject)eps)->tablevel);
303:       PetscViewerASCIIPrintf(viewer,"%3D EPS converged value (error) #%D",its,i);
304:       er = eigr[i]; ei = eigi[i];
305:       STBackTransform(eps->st,1,&er,&ei);
306: #if defined(PETSC_USE_COMPLEX)
307:       PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));
308: #else
309:       PetscViewerASCIIPrintf(viewer," %G",er);
310:       if (ei!=0.0) { PetscViewerASCIIPrintf(viewer,"%+Gi",ei); }
311: #endif
312:       PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);
313:       PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);
314:     }
315:     ctx->oldnconv = nconv;
316:   }
317:   return(0);
318: }

322: PetscErrorCode EPSMonitorLG(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
323: {
324:   PetscViewer    viewer = (PetscViewer)monctx;
325:   PetscDraw      draw,draw1;
326:   PetscDrawLG    lg,lg1;
328:   PetscReal      x,y,myeigr,p;
329:   PetscScalar    er,ei;

332:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)eps));
333:   PetscViewerDrawGetDraw(viewer,0,&draw);
334:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
335:   if (!its) {
336:     PetscDrawSetTitle(draw,"Error estimates");
337:     PetscDrawSetDoubleBuffer(draw);
338:     PetscDrawLGSetDimension(lg,1);
339:     PetscDrawLGReset(lg);
340:     PetscDrawLGSetLimits(lg,0,1.0,log10(eps->tol)-2,0.0);
341:   }

343:   /* In the hermitian case, the eigenvalues are real and can be plotted */
344:   if (eps->ishermitian) {
345:     PetscViewerDrawGetDraw(viewer,1,&draw1);
346:     PetscViewerDrawGetDrawLG(viewer,1,&lg1);
347:     if (!its) {
348:       PetscDrawSetTitle(draw1,"Approximate eigenvalues");
349:       PetscDrawSetDoubleBuffer(draw1);
350:       PetscDrawLGSetDimension(lg1,1);
351:       PetscDrawLGReset(lg1);
352:       PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);
353:     }
354:   }

356:   x = (PetscReal)its;
357:   if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0;
358:   PetscDrawLGAddPoint(lg,&x,&y);
359:   if (eps->ishermitian) {
360:     er = eigr[nconv]; ei = eigi[nconv];
361:     STBackTransform(eps->st,1,&er,&ei);
362:     myeigr = PetscRealPart(er);
363:     PetscDrawLGAddPoint(lg1,&x,&myeigr);
364:     PetscDrawGetPause(draw1,&p);
365:     PetscDrawSetPause(draw1,0);
366:     PetscDrawLGDraw(lg1);
367:     PetscDrawSetPause(draw1,p);
368:   }
369:   PetscDrawLGDraw(lg);
370:   return(0);
371: }

375: PetscErrorCode EPSMonitorLGAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
376: {
377:   PetscViewer    viewer = (PetscViewer)monctx;
378:   PetscDraw      draw,draw1;
379:   PetscDrawLG    lg,lg1;
381:   PetscReal      *x,*y,*myeigr,p;
382:   PetscInt       i,n = PetscMin(eps->nev,255);
383:   PetscScalar    er,ei;

386:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)eps));
387:   PetscViewerDrawGetDraw(viewer,0,&draw);
388:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
389:   if (!its) {
390:     PetscDrawSetTitle(draw,"Error estimates");
391:     PetscDrawSetDoubleBuffer(draw);
392:     PetscDrawLGSetDimension(lg,n);
393:     PetscDrawLGReset(lg);
394:     PetscDrawLGSetLimits(lg,0,1.0,log10(eps->tol)-2,0.0);
395:   }

397:   /* In the hermitian case, the eigenvalues are real and can be plotted */
398:   if (eps->ishermitian) {
399:     PetscViewerDrawGetDraw(viewer,1,&draw1);
400:     PetscViewerDrawGetDrawLG(viewer,1,&lg1);
401:     if (!its) {
402:       PetscDrawSetTitle(draw1,"Approximate eigenvalues");
403:       PetscDrawSetDoubleBuffer(draw1);
404:       PetscDrawLGSetDimension(lg1,n);
405:       PetscDrawLGReset(lg1);
406:       PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);
407:     }
408:   }

410:   PetscMalloc(sizeof(PetscReal)*n,&x);
411:   PetscMalloc(sizeof(PetscReal)*n,&y);
412:   for (i=0;i<n;i++) {
413:     x[i] = (PetscReal)its;
414:     if (i < nest && errest[i] > 0.0) y[i] = log10(errest[i]);
415:     else y[i] = 0.0;
416:   }
417:   PetscDrawLGAddPoint(lg,x,y);
418:   if (eps->ishermitian) {
419:     PetscMalloc(sizeof(PetscReal)*n,&myeigr);
420:     for (i=0;i<n;i++) {
421:       er = eigr[i]; ei = eigi[i];
422:       STBackTransform(eps->st,1,&er,&ei);
423:       if (i < nest) myeigr[i] = PetscRealPart(er);
424:       else myeigr[i] = 0.0;
425:     }
426:     PetscDrawLGAddPoint(lg1,x,myeigr);
427:     PetscDrawGetPause(draw1,&p);
428:     PetscDrawSetPause(draw1,0);
429:     PetscDrawLGDraw(lg1);
430:     PetscDrawSetPause(draw1,p);
431:     PetscFree(myeigr);
432:   }
433:   PetscDrawLGDraw(lg);
434:   PetscFree(x);
435:   PetscFree(y);
436:   return(0);
437: }

slepc-3.4.2.dfsg.orig/src/eps/index.html0000644000175000017500000000251112211062077017005 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

interface/
impls/
examples/
../../include/slepc-private/epsimpl.h
../../include/slepceps.h
makefile
slepc-3.4.2.dfsg.orig/src/ip/0000755000175000017500000000000012214143515014632 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ip/ipbasic.c0000644000175000017500000005040112211062077016410 0ustar gladkgladk/* Basic routines - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcip.h" I*/ PetscFunctionList IPList = 0; PetscBool IPRegisterAllCalled = PETSC_FALSE; PetscClassId IP_CLASSID = 0; PetscLogEvent IP_InnerProduct = 0,IP_Orthogonalize = 0,IP_ApplyMatrix = 0; static PetscBool IPPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "IPFinalizePackage" /*@C IPFinalizePackage - This function destroys everything in the Slepc interface to the IP package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode IPFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&IPList);CHKERRQ(ierr); IPPackageInitialized = PETSC_FALSE; IPRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInitializePackage" /*@C IPInitializePackage - This function initializes everything in the IP package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to IPCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode IPInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (IPPackageInitialized) PetscFunctionReturn(0); IPPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Inner product",&IP_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = IPRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("IPOrthogonalize",IP_CLASSID,&IP_Orthogonalize);CHKERRQ(ierr); ierr = PetscLogEventRegister("IPInnerProduct",IP_CLASSID,&IP_InnerProduct);CHKERRQ(ierr); ierr = PetscLogEventRegister("IPApplyMatrix",IP_CLASSID,&IP_ApplyMatrix);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"ip",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(IP_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"ip",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(IP_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(IPFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPCreate" /*@C IPCreate - Creates an IP context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . newip - location to put the IP context Level: beginner Note: IP objects are not intended for normal users but only for advanced user that for instance implement their own solvers. .seealso: IPDestroy(), IP @*/ PetscErrorCode IPCreate(MPI_Comm comm,IP *newip) { IP ip; PetscErrorCode ierr; PetscFunctionBegin; PetscValidPointer(newip,2); *newip = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = IPInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(ip,_p_IP,struct _IPOps,IP_CLASSID,"IP","Inner Product","IP",comm,IPDestroy,IPView);CHKERRQ(ierr); ip->orthog_type = IP_ORTHOG_CGS; ip->orthog_ref = IP_ORTHOG_REFINE_IFNEEDED; ip->orthog_eta = 0.7071; ip->innerproducts = 0; ip->matrix = NULL; ip->Bx = NULL; ip->xid = 0; ip->xstate = 0; ip->work = NULL; ip->lwork = 0; *newip = ip; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPSetOptionsPrefix" /*@C IPSetOptionsPrefix - Sets the prefix used for searching for all IP options in the database. Logically Collective on IP Input Parameters: + ip - the inner product context - prefix - the prefix string to prepend to all IP option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: IPAppendOptionsPrefix() @*/ PetscErrorCode IPSetOptionsPrefix(IP ip,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); ierr = PetscObjectSetOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPAppendOptionsPrefix" /*@C IPAppendOptionsPrefix - Appends to the prefix used for searching for all IP options in the database. Logically Collective on IP Input Parameters: + ip - the inner product context - prefix - the prefix string to prepend to all IP option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: IPSetOptionsPrefix() @*/ PetscErrorCode IPAppendOptionsPrefix(IP ip,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); ierr = PetscObjectAppendOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPGetOptionsPrefix" /*@C IPGetOptionsPrefix - Gets the prefix used for searching for all IP options in the database. Not Collective Input Parameters: . ip - the inner product context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: IPSetOptionsPrefix(), IPAppendOptionsPrefix() @*/ PetscErrorCode IPGetOptionsPrefix(IP ip,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)ip,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPSetType" /*@C IPSetType - Selects the type for the IP object. Logically Collective on IP Input Parameter: + ip - the inner product context - type - a known type Notes: Three types are available: IPBILINEAR, IPSESQUILINEAR, and IPINDEFINITE. For complex scalars, the default is a sesquilinear form (x,y)=x^H*M*y and it is also possible to choose a bilinear form (x,y)=x^T*M*y (without complex conjugation). The latter could be useful e.g. in complex-symmetric eigensolvers. In the case of real scalars, only the bilinear form (x,y)=x^T*M*y is available. The indefinite inner product is reserved for the case of an indefinite matrix M. This is used for instance in symmetric-indefinite eigenproblems. Level: advanced .seealso: IPGetType() @*/ PetscErrorCode IPSetType(IP ip,IPType type) { PetscErrorCode ierr,(*r)(IP); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)ip,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(IPList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested IP type %s",type); ierr = PetscMemzero(ip->ops,sizeof(struct _IPOps));CHKERRQ(ierr); ierr = PetscObjectChangeTypeName((PetscObject)ip,type);CHKERRQ(ierr); ierr = (*r)(ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPGetType" /*@C IPGetType - Gets the IP type name (as a string) from the IP context. Not Collective Input Parameter: . ip - the inner product context Output Parameter: . name - name of the inner product Level: advanced .seealso: IPSetType() @*/ PetscErrorCode IPGetType(IP ip,IPType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)ip)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPSetType_Default" /* Sets the default IP type, depending on whether complex arithmetic is used or not. */ PetscErrorCode IPSetType_Default(IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); #if defined(PETSC_USE_COMPLEX) ierr = IPSetType(ip,IPSESQUILINEAR);CHKERRQ(ierr); #else ierr = IPSetType(ip,IPBILINEAR);CHKERRQ(ierr); #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPSetFromOptions" /*@ IPSetFromOptions - Sets IP options from the options database. Collective on IP Input Parameters: . ip - the inner product context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode IPSetFromOptions(IP ip) { const char *orth_list[2] = {"mgs","cgs"}; const char *ref_list[3] = {"never","ifneeded","always"}; PetscReal r; PetscInt i,j; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); if (!IPRegisterAllCalled) { ierr = IPRegisterAll();CHKERRQ(ierr); } /* Set default type (we do not allow changing it with -ip_type) */ if (!((PetscObject)ip)->type_name) { ierr = IPSetType_Default(ip);CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)ip);CHKERRQ(ierr); i = ip->orthog_type; ierr = PetscOptionsEList("-ip_orthog_type","Orthogonalization method","IPSetOrthogonalization",orth_list,2,orth_list[i],&i,NULL);CHKERRQ(ierr); j = ip->orthog_ref; ierr = PetscOptionsEList("-ip_orthog_refine","Iterative refinement mode during orthogonalization","IPSetOrthogonalization",ref_list,3,ref_list[j],&j,NULL);CHKERRQ(ierr); r = ip->orthog_eta; ierr = PetscOptionsReal("-ip_orthog_eta","Parameter of iterative refinement during orthogonalization","IPSetOrthogonalization",r,&r,NULL);CHKERRQ(ierr); ierr = IPSetOrthogonalization(ip,(IPOrthogType)i,(IPOrthogRefineType)j,r);CHKERRQ(ierr); ierr = PetscObjectProcessOptionsHandlers((PetscObject)ip);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPSetOrthogonalization" /*@ IPSetOrthogonalization - Specifies the type of orthogonalization technique to be used (classical or modified Gram-Schmidt with or without refinement). Logically Collective on IP Input Parameters: + ip - the inner product context . type - the type of orthogonalization technique . refine - type of refinement - eta - parameter for selective refinement Options Database Keys: + -orthog_type - Where is cgs for Classical Gram-Schmidt orthogonalization (default) or mgs for Modified Gram-Schmidt orthogonalization . -orthog_refine - Where is one of never, ifneeded (default) or always - -orthog_eta - For setting the value of eta Notes: The default settings work well for most problems. The parameter eta should be a real value between 0 and 1 (or PETSC_DEFAULT). The value of eta is used only when the refinement type is "ifneeded". When using several processors, MGS is likely to result in bad scalability. Level: advanced .seealso: IPOrthogonalize(), IPGetOrthogonalization(), IPOrthogType, IPOrthogRefineType @*/ PetscErrorCode IPSetOrthogonalization(IP ip,IPOrthogType type,IPOrthogRefineType refine,PetscReal eta) { PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidLogicalCollectiveEnum(ip,type,2); PetscValidLogicalCollectiveEnum(ip,refine,3); PetscValidLogicalCollectiveReal(ip,eta,4); switch (type) { case IP_ORTHOG_CGS: case IP_ORTHOG_MGS: ip->orthog_type = type; break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type"); } switch (refine) { case IP_ORTHOG_REFINE_NEVER: case IP_ORTHOG_REFINE_IFNEEDED: case IP_ORTHOG_REFINE_ALWAYS: ip->orthog_ref = refine; break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown refinement type"); } if (eta == PETSC_DEFAULT) { ip->orthog_eta = 0.7071; } else { if (eta <= 0.0 || eta > 1.0) SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_OUTOFRANGE,"Invalid eta value"); ip->orthog_eta = eta; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPGetOrthogonalization" /*@C IPGetOrthogonalization - Gets the orthogonalization settings from the IP object. Not Collective Input Parameter: . ip - inner product context Output Parameter: + type - type of orthogonalization technique . refine - type of refinement - eta - parameter for selective refinement Level: advanced .seealso: IPOrthogonalize(), IPSetOrthogonalization(), IPOrthogType, IPOrthogRefineType @*/ PetscErrorCode IPGetOrthogonalization(IP ip,IPOrthogType *type,IPOrthogRefineType *refine,PetscReal *eta) { PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); if (type) *type = ip->orthog_type; if (refine) *refine = ip->orthog_ref; if (eta) *eta = ip->orthog_eta; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPView" /*@C IPView - Prints the IP data structure. Collective on IP Input Parameters: + ip - the inner product context - viewer - optional visualization context Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: EPSView(), SVDView(), PetscViewerASCIIOpen() @*/ PetscErrorCode IPView(IP ip,PetscViewer viewer) { PetscBool isascii; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ip)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(ip,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)ip,viewer,"IP Object");CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," orthogonalization method: ");CHKERRQ(ierr); switch (ip->orthog_type) { case IP_ORTHOG_MGS: ierr = PetscViewerASCIIPrintf(viewer,"modified Gram-Schmidt\n");CHKERRQ(ierr); break; case IP_ORTHOG_CGS: ierr = PetscViewerASCIIPrintf(viewer,"classical Gram-Schmidt\n");CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)ip),1,"Wrong value of ip->orth_type"); } ierr = PetscViewerASCIIPrintf(viewer," orthogonalization refinement: ");CHKERRQ(ierr); switch (ip->orthog_ref) { case IP_ORTHOG_REFINE_NEVER: ierr = PetscViewerASCIIPrintf(viewer,"never\n");CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_IFNEEDED: ierr = PetscViewerASCIIPrintf(viewer,"if needed (eta: %G)\n",ip->orthog_eta);CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_ALWAYS: ierr = PetscViewerASCIIPrintf(viewer,"always\n");CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)ip),1,"Wrong value of ip->orth_ref"); } if (ip->matrix) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr); ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = MatView(ip->matrix,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPReset" /*@ IPReset - Resets the IP context to the initial state. Collective on IP Input Parameter: . ip - the inner product context Level: advanced .seealso: IPDestroy() @*/ PetscErrorCode IPReset(IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); ierr = MatDestroy(&ip->matrix);CHKERRQ(ierr); ierr = VecDestroy(&ip->Bx);CHKERRQ(ierr); ip->xid = 0; ip->xstate = 0; ierr = PetscFree(ip->work);CHKERRQ(ierr); ip->lwork = 0; ierr = IPResetOperationCounters(ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPDestroy" /*@C IPDestroy - Destroys IP context that was created with IPCreate(). Collective on IP Input Parameter: . ip - the inner product context Level: beginner .seealso: IPCreate() @*/ PetscErrorCode IPDestroy(IP *ip) { PetscErrorCode ierr; PetscFunctionBegin; if (!*ip) PetscFunctionReturn(0); PetscValidHeaderSpecific(*ip,IP_CLASSID,1); if (--((PetscObject)(*ip))->refct > 0) { *ip = 0; PetscFunctionReturn(0); } ierr = IPReset(*ip);CHKERRQ(ierr); ierr = PetscHeaderDestroy(ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPGetOperationCounters" /*@ IPGetOperationCounters - Gets the total number of inner product operations made by the IP object. Not Collective Input Parameter: . ip - the inner product context Output Parameter: . dots - number of inner product operations Level: intermediate .seealso: IPResetOperationCounters() @*/ PetscErrorCode IPGetOperationCounters(IP ip,PetscInt *dots) { PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidPointer(dots,2); *dots = ip->innerproducts; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPResetOperationCounters" /*@ IPResetOperationCounters - Resets the counters for inner product operations made by of the IP object. Logically Collective on IP Input Parameter: . ip - the inner product context Level: intermediate .seealso: IPGetOperationCounters() @*/ PetscErrorCode IPResetOperationCounters(IP ip) { PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); ip->innerproducts = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPRegister" /*@C IPRegister - Adds an inner product to the IP package. Not collective Input Parameters: + name - name of a new user-defined IP - function - routine to create context Notes: IPRegister() may be called multiple times to add several user-defined inner products. Level: advanced .seealso: IPRegisterAll() @*/ PetscErrorCode IPRegister(const char *name,PetscErrorCode (*function)(IP)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&IPList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } PETSC_EXTERN PetscErrorCode IPCreate_Bilinear(IP); #if defined(PETSC_USE_COMPLEX) PETSC_EXTERN PetscErrorCode IPCreate_Sesquilin(IP); #endif PETSC_EXTERN PetscErrorCode IPCreate_Indefinite(IP); #undef __FUNCT__ #define __FUNCT__ "IPRegisterAll" /*@C IPRegisterAll - Registers all of the inner products in the IP package. Not Collective Level: advanced @*/ PetscErrorCode IPRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; IPRegisterAllCalled = PETSC_TRUE; ierr = IPRegister(IPBILINEAR,IPCreate_Bilinear);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = IPRegister(IPSESQUILINEAR,IPCreate_Sesquilin);CHKERRQ(ierr); #endif ierr = IPRegister(IPINDEFINITE,IPCreate_Indefinite);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ip/ipform.c0000644000175000017500000000764612211062077016307 0ustar gladkgladk/* Routines for setting the matrix representation of the inner product. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcip.h" I*/ #undef __FUNCT__ #define __FUNCT__ "IPSetMatrix" /*@ IPSetMatrix - Specifies the matrix representation of the inner product. Collective on IP Input Parameters: + ip - the inner product context - mat - the matrix (may be NULL) Notes: A NULL has the same effect as if the identity matrix was passed. This function is called by EPSSetProblemType() and usually need not be called by the user. Level: developer .seealso: IPGetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType() @*/ PetscErrorCode IPSetMatrix(IP ip,Mat mat) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); if (mat) { PetscValidHeaderSpecific(mat,MAT_CLASSID,2); PetscObjectReference((PetscObject)mat); } ierr = IPReset(ip);CHKERRQ(ierr); ip->matrix = mat; if (mat) { ierr = MatGetVecs(mat,&ip->Bx,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(ip,ip->Bx);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPGetMatrix" /*@C IPGetMatrix - Retrieves the matrix representation of the inner product. Not collective, though a parallel Mat may be returned Input Parameter: . ip - the inner product context Output Parameter: . mat - the matrix of the inner product (may be NULL) Level: developer .seealso: IPSetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType() @*/ PetscErrorCode IPGetMatrix(IP ip,Mat* mat) { PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidPointer(mat,2); *mat = ip->matrix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPApplyMatrix_Private" PetscErrorCode IPApplyMatrix_Private(IP ip,Vec x) { PetscErrorCode ierr; PetscFunctionBegin; if (((PetscObject)x)->id != ip->xid || ((PetscObject)x)->state != ip->xstate) { ierr = PetscLogEventBegin(IP_ApplyMatrix,ip,0,0,0);CHKERRQ(ierr); ierr = MatMult(ip->matrix,x,ip->Bx);CHKERRQ(ierr); ip->xid = ((PetscObject)x)->id; ip->xstate = ((PetscObject)x)->state; ierr = PetscLogEventEnd(IP_ApplyMatrix,ip,0,0,0);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPApplyMatrix" /*@ IPApplyMatrix - Multiplies a vector by the matrix representing the IP. Neighbor-wise Collective on IP and Vec Input Parameters: + ip - the inner product context - x - the vector Output Parameter: . y - the result Note: If no matrix was specified this function copies the vector. Level: developer .seealso: IPSetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType() @*/ PetscErrorCode IPApplyMatrix(IP ip,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); if (ip->matrix) { ierr = IPApplyMatrix_Private(ip,x);CHKERRQ(ierr); ierr = VecCopy(ip->Bx,y);CHKERRQ(ierr); } else { ierr = VecCopy(x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ip/ipform.c.html0000644000175000017500000002332112211062077017236 0ustar gladkgladk

Actual source code: ipform.c

  1: /*
  2:      Routines for setting the matrix representation of the inner product.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/ipimpl.h>      /*I "slepcip.h" I*/

 28: /*@
 29:    IPSetMatrix - Specifies the matrix representation of the inner product.

 31:    Collective on IP

 33:    Input Parameters:
 34: +  ip    - the inner product context
 35: -  mat   - the matrix (may be NULL)

 37:    Notes:
 38:    A NULL has the same effect as if the identity matrix was passed.

 40:    This function is called by EPSSetProblemType() and usually need not be
 41:    called by the user.

 43:    Level: developer

 45: .seealso: IPGetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType()
 46: @*/
 47: PetscErrorCode IPSetMatrix(IP ip,Mat mat)
 48: {

 53:   if (mat) {
 55:     PetscObjectReference((PetscObject)mat);
 56:   }
 57:   IPReset(ip);
 58:   ip->matrix = mat;
 59:   if (mat) {
 60:     MatGetVecs(mat,&ip->Bx,NULL);
 61:     PetscLogObjectParent(ip,ip->Bx);
 62:   }
 63:   return(0);
 64: }

 68: /*@C
 69:    IPGetMatrix - Retrieves the matrix representation of the inner product.

 71:    Not collective, though a parallel Mat may be returned

 73:    Input Parameter:
 74: .  ip    - the inner product context

 76:    Output Parameter:
 77: .  mat   - the matrix of the inner product (may be NULL)

 79:    Level: developer

 81: .seealso: IPSetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType()
 82: @*/
 83: PetscErrorCode IPGetMatrix(IP ip,Mat* mat)
 84: {
 88:   *mat  = ip->matrix;
 89:   return(0);
 90: }

 94: PetscErrorCode IPApplyMatrix_Private(IP ip,Vec x)
 95: {

 99:   if (((PetscObject)x)->id != ip->xid || ((PetscObject)x)->state != ip->xstate) {
100:     PetscLogEventBegin(IP_ApplyMatrix,ip,0,0,0);
101:     MatMult(ip->matrix,x,ip->Bx);
102:     ip->xid = ((PetscObject)x)->id;
103:     ip->xstate = ((PetscObject)x)->state;
104:     PetscLogEventEnd(IP_ApplyMatrix,ip,0,0,0);
105:   }
106:   return(0);
107: }

111: /*@
112:    IPApplyMatrix - Multiplies a vector by the matrix representing the IP.

114:    Neighbor-wise Collective on IP and Vec

116:    Input Parameters:
117: +  ip    - the inner product context
118: -  x     - the vector

120:    Output Parameter:
121: .  y     - the result

123:    Note:
124:    If no matrix was specified this function copies the vector.

126:    Level: developer

128: .seealso: IPSetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType()
129: @*/
130: PetscErrorCode IPApplyMatrix(IP ip,Vec x,Vec y)
131: {

136:   if (ip->matrix) {
137:     IPApplyMatrix_Private(ip,x);
138:     VecCopy(ip->Bx,y);
139:   } else {
140:     VecCopy(x,y);
141:   }
142:   return(0);
143: }
slepc-3.4.2.dfsg.orig/src/ip/ipborthog.c.html0000644000175000017500000004751212211062077017747 0ustar gladkgladk
Actual source code: ipborthog.c

  1: /*
  2:      Routines related to orthogonalization.
  3:      See the SLEPc Technical Report STR-1 for a detailed explanation.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/ipimpl.h>      /*I "slepcip.h" I*/
 26: #include <slepcblaslapack.h>
 27: #include <../src/eps/impls/davidson/common/davidson.h>

 29: #define MyPetscSqrtReal(alpha) (PetscSign(PetscRealPart(alpha))*PetscSqrtReal(PetscAbs(PetscRealPart(alpha))))

 31: /*
 32:    IPOrthogonalizeCGS1 - Compute |v'| (estimated), |v| and one step of CGS with only one global synchronization
 33: */
 36: PetscErrorCode IPBOrthogonalizeCGS1(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *onorm,PetscReal *norm)
 37: {
 39:   PetscInt       i,j;
 40:   PetscScalar    alpha;

 43:   /* h = [defl V]^* Bv ; alpha = (Bv, v) */
 44:   VecsMultIa(H,0,nds,defl,0,nds,&Bv,0,1);
 45:   j = nds;
 46:   if (!which) {
 47:     VecsMultIa(H+j,0,n,V,0,n,&Bv,0,1);
 48:     j+= n;
 49:   } else {
 50:     for (i=0; i<n; i++) {
 51:       if (which[i]) {
 52:         VecsMultIa(H+j,0,1,V+i,0,1,&Bv,0,1);
 53:         j++;
 54:       }
 55:     }
 56:   }
 57:   if (onorm || norm) {
 58:     VecsMultIa(H+j,0,1,&v,0,1,&Bv,0,1);
 59:     j++;
 60:   }
 61:   VecsMultIb(H,0,j,j,1,NULL,v);
 62:   if (onorm || norm) alpha = H[j-1];

 64:   /* h = J * h */
 65:   if (BDSnorms && defl) for (i=0; i<nds; i++) H[i]*= BDSnorms[i];
 66:   if (BVnorms && V) {
 67:     if (!which) {
 68:       for (i=0; i<n; i++) H[i+nds]*= BVnorms[i];
 69:     } else {
 70:       for (i=j=0; i<n; i++) {
 71:         if (which[i]) H[j++]*= BVnorms[i];
 72:       }
 73:     }
 74:   }

 76:   /* v = v - V h */
 77:   SlepcVecMAXPBY(v,1.0,-1.0,nds,H,defl);
 78:   if (which) {
 79:     for (j=0; j<n; j++)
 80:       if (which[j]) { VecAXPBY(v,-H[nds+j],1.0,V[j]); }
 81:   } else {
 82:     SlepcVecMAXPBY(v,1.0,-1.0,n,H+nds,V);
 83:   }

 85:   /* Bv = Bv - BV h */
 86:   SlepcVecMAXPBY(Bv,1.0,-1.0,nds,H,BDS);
 87:   if (which) {
 88:     for (j=0; j<n; j++)
 89:       if (which[j]) { VecAXPBY(Bv,-H[nds+j],1.0,BV[j]); }
 90:   } else {
 91:     SlepcVecMAXPBY(Bv,1.0,-1.0,n,H+nds,BV);
 92:   }

 94:   /* compute |v| */
 95:   if (onorm) *onorm = MyPetscSqrtReal(alpha);

 97:   /* compute |v'| */
 98:   if (norm) {
 99:     VecDot(Bv,v,&alpha);
100:     *norm = MyPetscSqrtReal(alpha);
101:   }
102:   return(0);
103: }

105: /*
106:   IPOrthogonalizeCGS - Orthogonalize with classical Gram-Schmidt
107: */
110: static PetscErrorCode IPBOrthogonalizeCGS(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
111: {
113:   PetscScalar    *h,*c,alpha;
114:   PetscReal      onrm,nrm;
115:   PetscInt       sz=0,sz1,j,k;

118:   /* allocate h and c if needed */
119:   if (!H || nds>0) sz = nds+n;
120:   sz1 = sz;
121:   if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) sz += nds+n;
122:   if (sz>ip->lwork) {
123:     PetscFree(ip->work);
124:     PetscMalloc(sz*sizeof(PetscScalar),&ip->work);
125:     PetscLogObjectMemory(ip,(sz-ip->lwork)*sizeof(PetscScalar));
126:     ip->lwork = sz;
127:   }
128:   if (!H || nds>0) h = ip->work;
129:   else h = H;
130:   if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) c = ip->work + sz1;

132:   /* orthogonalize and compute onorm */
133:   switch (ip->orthog_ref) {

135:   case IP_ORTHOG_REFINE_NEVER:
136:     IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,h,NULL,NULL);
137:     /* compute |v| */
138:     if (norm) {
139:       VecDot(Bv,v,&alpha);
140:       *norm = MyPetscSqrtReal(alpha);
141:     }
142:     /* linear dependence check does not work without refinement */
143:     if (lindep) *lindep = PETSC_FALSE;
144:     break;

146:   case IP_ORTHOG_REFINE_ALWAYS:
147:     IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,h,NULL,NULL);
148:     if (lindep) {
149:       IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,&onrm,&nrm);
150:       if (norm) *norm = nrm;
151:       if (PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE;
152:       else *lindep = PETSC_FALSE;
153:     } else {
154:       IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,NULL,norm);
155:     }
156:     for (j=0;j<n;j++)
157:       if (!which || which[j]) h[nds+j] += c[nds+j];
158:     break;

160:   case IP_ORTHOG_REFINE_IFNEEDED:
161:     IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,h,&onrm,&nrm);
162:     /* ||q|| < eta ||h|| */
163:     k = 1;
164:     while (k<3 && PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) {
165:       k++;
166:       if (!ip->matrix) {
167:         IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,&onrm,&nrm);
168:       } else {
169:         onrm = nrm;
170:         IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,NULL,&nrm);
171:       }
172:       for (j=0;j<n;j++)
173:         if (!which || which[j]) h[nds+j] += c[nds+j];
174:     }
175:     if (norm) *norm = nrm;
176:     if (lindep) {
177:       if (PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE;
178:       else *lindep = PETSC_FALSE;
179:     }
180:     break;

182:   default:
183:     SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement");
184:   }

186:   /* recover H from workspace */
187:   if (H && nds>0) {
188:     for (j=0;j<n;j++)
189:       if (!which || which[j]) H[j] = h[nds+j];
190:   }
191:   return(0);
192: }

196: /*@
197:    IPBOrthogonalize - B-Orthogonalize a vector with respect to two set of vectors.

199:    Collective on IP

201:    Input Parameters:
202: +  ip     - the inner product (IP) context
203: .  nds    - number of columns of defl
204: .  defl   - first set of vectors
205: .  BDS    - B * defl
206: .  BDSnorms - DS_i' * B * DS_i
207: .  n      - number of columns of V
208: .  which  - logical array indicating columns of V to be used
209: .  V      - second set of vectors
210: .  BV     - B * V
211: -  BVnorms - V_i' * B * V_i

213:    Input/Output Parameter:
214: +  v      - (input) vector to be orthogonalized and (output) result of
215:             orthogonalization
216: -  Bv     - (input/output) B * v

218:    Output Parameter:
219: +  H      - coefficients computed during orthogonalization with V, of size nds+n
220:             if norm == NULL, and nds+n+1 otherwise.
221: .  norm   - norm of the vector after being orthogonalized
222: -  lindep - flag indicating that refinement did not improve the quality
223:             of orthogonalization

225:    Notes:
226:    This function applies an orthogonal projector to project vector v onto the
227:    orthogonal complement of the span of the columns of defl and V.

229:    On exit, v0 = [V v]*H, where v0 is the original vector v.

231:    This routine does not normalize the resulting vector.

233:    Level: developer

235: .seealso: IPSetOrthogonalization(), IPBiOrthogonalize()
236: @*/
237: PetscErrorCode IPBOrthogonalize(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
238: {
240:   PetscScalar    alpha;

246:   PetscLogEventBegin(IP_Orthogonalize,ip,0,0,0);

248:   /* Bv <- B * v */
249:   PetscLogEventBegin(IP_ApplyMatrix,ip,0,0,0);
250:   MatMult(ip->matrix,v,Bv);
251:   PetscLogEventEnd(IP_ApplyMatrix,ip,0,0,0);

253:   if (!nds && !n) {
254:     if (norm) {
255:       VecDot(Bv,v,&alpha);
256:       *norm = MyPetscSqrtReal(alpha);
257:     }
258:     if (lindep) *lindep = PETSC_FALSE;
259:   } else {
260:     switch (ip->orthog_type) {
261:     case IP_ORTHOG_CGS:
262:       IPBOrthogonalizeCGS(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,H,norm,lindep);
263:       break;
264:     case IP_ORTHOG_MGS:
265:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unsupported orthogonalization type");
266:       break;
267:     default:
268:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type");
269:     }
270:   }
271:   PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);
272:   return(0);
273: }


slepc-3.4.2.dfsg.orig/src/ip/ipbiorthog.c.html0000644000175000017500000006735612211062077020130 0ustar gladkgladk
Actual source code: ipbiorthog.c

  1: /*
  2:      Routines related to bi-orthogonalization.
  3:      See the SLEPc Technical Report STR-1 for a detailed explanation.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/ipimpl.h>      /*I "slepcip.h" I*/
 26: #include <slepcblaslapack.h>

 28: /*
 29:     Biorthogonalization routine using classical Gram-Schmidt with refinement.
 30:  */
 33: static PetscErrorCode IPCGSBiOrthogonalization(IP ip,PetscInt n_,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *hnorm,PetscReal *norm)
 34: {
 35: #if defined(SLEPC_MISSING_LAPACK_GELQF) || defined(SLEPC_MISSING_LAPACK_ORMLQ)
 37:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GELQF/ORMLQ - Lapack routine is unavailable");
 38: #else
 40:   PetscBLASInt   j,ione=1,lwork,info,n=n_;
 41:   PetscScalar    shh[100],*lhh,*vw,*tau,one=1.0,*work;

 44:   /* Don't allocate small arrays */
 45:   if (n<=100) lhh = shh;
 46:   else {
 47:     PetscMalloc(n*sizeof(PetscScalar),&lhh);
 48:   }
 49:   PetscMalloc(n*n*sizeof(PetscScalar),&vw);

 51:   for (j=0;j<n;j++) {
 52:     IPMInnerProduct(ip,V[j],n,W,vw+j*n);
 53:   }
 54:   lwork = n;
 55:   PetscMalloc(n*sizeof(PetscScalar),&tau);
 56:   PetscMalloc(lwork*sizeof(PetscScalar),&work);
 57:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
 58:   PetscStackCallBLAS("LAPACKgelqf",LAPACKgelqf_(&n,&n,vw,&n,tau,work,&lwork,&info));
 59:   PetscFPTrapPop();
 60:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ip),PETSC_ERR_LIB,"Error in Lapack xGELQF %d",info);

 62:   /*** First orthogonalization ***/

 64:   /* h = W^* v */
 65:   /* q = v - V h */
 66:   IPMInnerProduct(ip,v,n,W,H);
 67:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
 68:   PetscStackCallBLAS("BLAStrsm",BLAStrsm_("L","L","N","N",&n,&ione,&one,vw,&n,H,&n));
 69:   PetscStackCallBLAS("LAPACKormlq",LAPACKormlq_("L","N",&n,&ione,&n,vw,&n,tau,H,&n,work,&lwork,&info));
 70:   PetscFPTrapPop();
 71:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ip),PETSC_ERR_LIB,"Error in Lapack xORMLQ %d",info);
 72:   SlepcVecMAXPBY(v,1.0,-1.0,n,H,V);

 74:   /* compute norm of v */
 75:   if (norm) { IPNorm(ip,v,norm); }

 77:   if (n>100) { PetscFree(lhh); }
 78:   PetscFree(vw);
 79:   PetscFree(tau);
 80:   PetscFree(work);
 81:   return(0);
 82: #endif
 83: }

 87: /*@
 88:    IPBiOrthogonalize - Bi-orthogonalize a vector with respect to a set of vectors.

 90:    Collective on IP and Vec

 92:    Input Parameters:
 93: +  ip - the inner product context
 94: .  n - number of columns of V
 95: .  V - set of vectors
 96: -  W - set of vectors

 98:    Input/Output Parameter:
 99: .  v - vector to be orthogonalized

101:    Output Parameter:
102: +  H  - coefficients computed during orthogonalization
103: -  norm - norm of the vector after being orthogonalized

105:    Notes:
106:    This function applies an oblique projector to project vector v onto the
107:    span of the columns of V along the orthogonal complement of the column
108:    space of W.

110:    On exit, v0 = [V v]*H, where v0 is the original vector v.

112:    This routine does not normalize the resulting vector.

114:    Level: developer

116: .seealso: IPSetOrthogonalization(), IPOrthogonalize()
117: @*/
118: PetscErrorCode IPBiOrthogonalize(IP ip,PetscInt n,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *norm)
119: {
121:   PetscScalar    lh[100],*h;
122:   PetscBool      allocated = PETSC_FALSE;
123:   PetscReal      lhnrm,*hnrm,lnrm,*nrm;

128:   if (!n) {
129:     if (norm) { IPNorm(ip,v,norm); }
130:   } else {
131:     PetscLogEventBegin(IP_Orthogonalize,ip,0,0,0);
132:     /* allocate H if needed */
133:     if (!H) {
134:       if (n<=100) h = lh;
135:       else {
136:         PetscMalloc(n*sizeof(PetscScalar),&h);
137:         allocated = PETSC_TRUE;
138:       }
139:     } else h = H;

141:     /* retrieve hnrm and nrm for linear dependence check or conditional refinement */
142:     if (ip->orthog_ref == IP_ORTHOG_REFINE_IFNEEDED) {
143:       hnrm = &lhnrm;
144:       if (norm) nrm = norm;
145:       else nrm = &lnrm;
146:     } else {
147:       hnrm = NULL;
148:       nrm = norm;
149:     }

151:     switch (ip->orthog_type) {
152:       case IP_ORTHOG_CGS:
153:         IPCGSBiOrthogonalization(ip,n,V,W,v,h,hnrm,nrm);
154:         break;
155:       default:
156:         SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type");
157:     }

159:     if (allocated) { PetscFree(h); }
160:     PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);
161:   }
162:   return(0);
163: }

165: /*
166:    IPPseudoOrthogonalizeCGS1 - Compute |v'| (estimated), |v| and one step of CGS with only one global synchronization (indefinite)
167: */
170: PetscErrorCode IPPseudoOrthogonalizeCGS1(IP ip,PetscInt n,Vec *V,PetscReal* omega,Vec v,PetscScalar *H,PetscReal *onorm,PetscReal *norm)
171: {
173:   PetscInt       j;
174:   PetscScalar    alpha;
175:   PetscReal      sum;

178:   /* h = W^* v ; alpha = (v , v) */
179:   if (!onorm && !norm) {
180:     /* use simpler function */
181:     IPMInnerProduct(ip,v,n,V,H);
182:   } else {
183:     /* merge comunications */
184:     IPMInnerProductBegin(ip,v,n,V,H);
185:     if (onorm || (norm && !ip->matrix)) {
186:       IPInnerProductBegin(ip,v,v,&alpha);
187:     }

189:     IPMInnerProductEnd(ip,v,n,V,H);
190:     if (onorm || (norm && !ip->matrix)) {
191:       IPInnerProductEnd(ip,v,v,&alpha);
192:     }
193:   }

195:   /* q = v - V h */
196:   for (j=0;j<n;j++) H[j] /= omega[j];  /* apply inverse of signature */
197:   SlepcVecMAXPBY(v,1.0,-1.0,n,H,V);
198:   for (j=0;j<n;j++) H[j] *= omega[j];  /* revert signature */

200:   /* compute |v| */
201:   if (onorm) {
202:     if (PetscRealPart(alpha)>0.0) *onorm = PetscSqrtReal(PetscRealPart(alpha));
203:     else *onorm = -PetscSqrtReal(-PetscRealPart(alpha));
204:   }

206:   if (norm) {
207:     if (!ip->matrix) {
208:       /* estimate |v'| from |v| */
209:       sum = 0.0;
210:       for (j=0; j<n; j++)
211:         sum += PetscRealPart(H[j] * PetscConj(H[j]));
212:       *norm = PetscRealPart(alpha)-sum;
213:       if (*norm <= 0.0) {
214:         IPNorm(ip,v,norm);
215:       } else *norm = PetscSqrtReal(*norm);
216:     } else {
217:       /* compute |v'| */
218:       IPNorm(ip,v,norm);
219:     }
220:   }
221:   return(0);
222: }

224: /*
225:   IPPseudoOrthogonalizeCGS - Orthogonalize with classical Gram-Schmidt (indefinite)
226: */
229: static PetscErrorCode IPPseudoOrthogonalizeCGS(IP ip,PetscInt n,Vec *V,PetscReal *omega,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
230: {
232:   PetscScalar    *h,*c;
233:   PetscReal      onrm,nrm;
234:   PetscInt       sz=0,sz1,j,k;

237:   /* allocate h and c if needed */
238:   if (!H) sz = n;
239:   sz1 = sz;
240:   if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) sz += n;
241:   if (sz>ip->lwork) {
242:     PetscFree(ip->work);
243:     PetscMalloc(sz*sizeof(PetscScalar),&ip->work);
244:     PetscLogObjectMemory(ip,(sz-ip->lwork)*sizeof(PetscScalar));
245:     ip->lwork = sz;
246:   }
247:   if (!H) h = ip->work;
248:   else h = H;
249:   if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) c = ip->work + sz1;

251:   /* orthogonalize and compute onorm */
252:   switch (ip->orthog_ref) {

254:   case IP_ORTHOG_REFINE_NEVER:
255:     IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,h,NULL,NULL);
256:     /* compute |v| */
257:     if (norm) { IPNorm(ip,v,norm); }
258:     /* linear dependence check does not work without refinement */
259:     if (lindep) *lindep = PETSC_FALSE;
260:     break;

262:   case IP_ORTHOG_REFINE_ALWAYS:
263:     IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,h,NULL,NULL);
264:     if (lindep) {
265:       IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,&onrm,&nrm);
266:       if (norm) *norm = nrm;
267:       if (PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE;
268:       else *lindep = PETSC_FALSE;
269:     } else {
270:       IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,NULL,norm);
271:     }
272:     for (j=0;j<n;j++)
273:       h[j] += c[j];
274:     break;

276:   case IP_ORTHOG_REFINE_IFNEEDED:
277:     IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,h,&onrm,&nrm);
278:     /* ||q|| < eta ||h|| */
279:     k = 1;
280:     while (k<3 && PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) {
281:       k++;
282:       if (!ip->matrix) {
283:         IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,&onrm,&nrm);
284:       } else {
285:         onrm = nrm;
286:         IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,NULL,&nrm);
287:       }
288:       for (j=0;j<n;j++)
289:         h[j] += c[j];
290:     }
291:     if (norm) *norm = nrm;
292:     if (lindep) {
293:       if (PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE;
294:       else *lindep = PETSC_FALSE;
295:     }
296:     break;

298:   default:
299:     SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement");
300:   }

302:   /* recover H from workspace */
303:   if (H) {
304:     for (j=0;j<n;j++)
305:       H[j] = h[j];
306:   }
307:   return(0);
308: }

312: /*@
313:    IPPseudoOrthogonalize - Orthogonalize a vector with respect to two set of vectors
314:    in the sense of a pseudo-inner product.

316:    Collective on IP and Vec

318:    Input Parameters:
319: +  ip     - the inner product (IP) context
320: .  n      - number of columns of V
321: .  V      - set of vectors
322: -  omega  - set of signs that define a signature matrix

324:    Input/Output Parameter:
325: .  v      - (input) vector to be orthogonalized and (output) result of
326:             orthogonalization

328:    Output Parameter:
329: +  H      - coefficients computed during orthogonalization
330: .  norm   - norm of the vector after being orthogonalized
331: -  lindep - flag indicating that refinement did not improve the quality
332:             of orthogonalization

334:    Notes:
335:    This function is the analogue of IPOrthogonalize, but for the indefinite
336:    case. When using an indefinite IP the norm is not well defined, so we
337:    take the convention of having negative norms in such cases. The
338:    orthogonalization is then defined by a set of vectors V satisfying
339:    V'*B*V=Omega, where Omega is a signature matrix diag([+/-1,...,+/-1]).

341:    On exit, v = v0 - V*Omega*H, where v0 is the original vector v.

343:    This routine does not normalize the resulting vector. The output
344:    argument 'norm' may be negative.

346:    Level: developer

348: .seealso: IPSetOrthogonalization(), IPOrthogonalize()
349: @*/
350: PetscErrorCode IPPseudoOrthogonalize(IP ip,PetscInt n,Vec *V,PetscReal *omega,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
351: {

357:   PetscLogEventBegin(IP_Orthogonalize,ip,0,0,0);
358:   if (n==0) {
359:     if (norm) { IPNorm(ip,v,norm); }
360:     if (lindep) *lindep = PETSC_FALSE;
361:   } else {
362:     switch (ip->orthog_type) {
363:     case IP_ORTHOG_CGS:
364:       IPPseudoOrthogonalizeCGS(ip,n,V,omega,v,H,norm,lindep);
365:       break;
366:     case IP_ORTHOG_MGS:
367:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_SUP,"Modified Gram-Schmidt not implemented for indefinite case");
368:       break;
369:     default:
370:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type");
371:     }
372:   }
373:   PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);
374:   return(0);
375: }


slepc-3.4.2.dfsg.orig/src/ip/iporthog.c.html0000644000175000017500000010120312211062077017571 0ustar gladkgladk
Actual source code: iporthog.c

  1: /*
  2:      Routines related to orthogonalization.
  3:      See the SLEPc Technical Report STR-1 for a detailed explanation.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/ipimpl.h>      /*I "slepcip.h" I*/
 26: #include <slepcblaslapack.h>

 28: /*
 29:    IPOrthogonalizeMGS1 - Compute one step of Modified Gram-Schmidt
 30: */
 33: static PetscErrorCode IPOrthogonalizeMGS1(IP ip,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H)
 34: {
 36:   PetscInt       j;
 37:   PetscScalar    dot;

 40:   for (j=0; j<n; j++)
 41:     if (!which || which[j]) {
 42:       /* h_j = ( v, v_j ) */
 43:       IPInnerProduct(ip,v,V[j],&dot);
 44:       /* v <- v - h_j v_j */
 45:       VecAXPY(v,-dot,V[j]);
 46:       if (H) H[j] += dot;
 47:     }
 48:   return(0);
 49: }

 51: /*
 52:    IPOrthogonalizeCGS1 - Compute |v'| (estimated), |v| and one step of CGS with only one global synchronization
 53: */
 56: PetscErrorCode IPOrthogonalizeCGS1(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *onorm,PetscReal *norm)
 57: {
 59:   PetscInt       j;
 60:   PetscScalar    alpha;
 61:   PetscReal      sum;

 64:   /* h = W^* v ; alpha = (v, v) */
 65:   if (!nds && !which && !onorm && !norm) {
 66:     /* use simpler function */
 67:     IPMInnerProduct(ip,v,n,V,H);
 68:   } else {
 69:     /* merge comunications */
 70:     IPMInnerProductBegin(ip,v,nds,defl,H);
 71:     if (which) { /* use select array */
 72:       for (j=0;j<n;j++)
 73:         if (which[j]) {
 74:           IPInnerProductBegin(ip,v,V[j],H+nds+j);
 75:         }
 76:     } else {
 77:       IPMInnerProductBegin(ip,v,n,V,H+nds);
 78:     }
 79:     if (onorm || (norm && !ip->matrix)) {
 80:       IPInnerProductBegin(ip,v,v,&alpha);
 81:     }

 83:     IPMInnerProductEnd(ip,v,nds,defl,H);
 84:     if (which) { /* use select array */
 85:       for (j=0;j<n;j++)
 86:         if (which[j]) {
 87:           IPInnerProductEnd(ip,v,V[j],H+nds+j);
 88:         }
 89:     } else {
 90:       IPMInnerProductEnd(ip,v,n,V,H+nds);
 91:     }
 92:     if (onorm || (norm && !ip->matrix)) {
 93:       IPInnerProductEnd(ip,v,v,&alpha);
 94:     }
 95:   }

 97:   /* q = v - V h */
 98:   SlepcVecMAXPBY(v,1.0,-1.0,nds,H,defl);
 99:   if (which) {
100:     for (j=0;j<n;j++)
101:       if (which[j]) {
102:         VecAXPBY(v,-H[nds+j],1.0,V[j]);
103:       }
104:   } else {
105:     SlepcVecMAXPBY(v,1.0,-1.0,n,H+nds,V);
106:   }

108:   /* compute |v| */
109:   if (onorm) *onorm = PetscSqrtReal(PetscRealPart(alpha));

111:   if (norm) {
112:     if (!ip->matrix) {
113:       /* estimate |v'| from |v| */
114:       sum = 0.0;
115:       for (j=0; j<nds; j++)
116:         sum += PetscRealPart(H[j] * PetscConj(H[j]));
117:       for (j=0; j<n; j++)
118:         if (!which || which[j])
119:           sum += PetscRealPart(H[nds+j] * PetscConj(H[nds+j]));
120:       *norm = PetscRealPart(alpha)-sum;
121:       if (*norm <= 0.0) {
122:         IPNorm(ip,v,norm);
123:       } else *norm = PetscSqrtReal(*norm);
124:     } else {
125:       /* compute |v'| */
126:       IPNorm(ip,v,norm);
127:     }
128:   }
129:   return(0);
130: }

132: /*
133:   IPOrthogonalizeMGS - Orthogonalize with modified Gram-Schmidt
134: */
137: static PetscErrorCode IPOrthogonalizeMGS(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
138: {
140:   PetscInt       i,k;
141:   PetscReal      onrm,nrm;

144:   if (H) {
145:     for (i=0;i<n;i++) H[i] = 0;
146:   }

148:   switch (ip->orthog_ref) {

150:   case IP_ORTHOG_REFINE_NEVER:
151:     IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);
152:     IPOrthogonalizeMGS1(ip,n,which,V,v,H);
153:     /* compute |v| */
154:     if (norm) { IPNorm(ip,v,norm); }
155:     /* linear dependence check does not work without refinement */
156:     if (lindep) *lindep = PETSC_FALSE;
157:     break;

159:   case IP_ORTHOG_REFINE_ALWAYS:
160:     /* first step */
161:     IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);
162:     IPOrthogonalizeMGS1(ip,n,which,V,v,H);
163:     if (lindep) { IPNorm(ip,v,&onrm); }
164:     /* second step */
165:     IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);
166:     IPOrthogonalizeMGS1(ip,n,which,V,v,H);
167:     if (lindep || norm) { IPNorm(ip,v,&nrm); }
168:     if (lindep) {
169:       if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE;
170:       else *lindep = PETSC_FALSE;
171:     }
172:     if (norm) *norm = nrm;
173:     break;

175:   case IP_ORTHOG_REFINE_IFNEEDED:
176:     /* first step */
177:     IPNorm(ip,v,&onrm);
178:     IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);
179:     IPOrthogonalizeMGS1(ip,n,which,V,v,H);
180:     IPNorm(ip,v,&nrm);
181:     /* ||q|| < eta ||h|| */
182:     k = 1;
183:     while (k<3 && nrm < ip->orthog_eta * onrm) {
184:       k++;
185:       onrm = nrm;
186:       IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);
187:       IPOrthogonalizeMGS1(ip,n,which,V,v,H);
188:       IPNorm(ip,v,&nrm);
189:     }
190:     if (lindep) {
191:       if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE;
192:       else *lindep = PETSC_FALSE;
193:     }
194:     if (norm) *norm = nrm;
195:     break;

197:   default:
198:     SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement");
199:   }
200:   return(0);
201: }

203: /*
204:   IPOrthogonalizeCGS - Orthogonalize with classical Gram-Schmidt
205: */
208: static PetscErrorCode IPOrthogonalizeCGS(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
209: {
211:   PetscScalar    *h,*c;
212:   PetscReal      onrm,nrm;
213:   PetscInt       sz=0,sz1,j,k;

216:   /* allocate h and c if needed */
217:   if (!H || nds>0) sz = nds+n;
218:   sz1 = sz;
219:   if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) sz += nds+n;
220:   if (sz>ip->lwork) {
221:     PetscFree(ip->work);
222:     PetscMalloc(sz*sizeof(PetscScalar),&ip->work);
223:     PetscLogObjectMemory(ip,(sz-ip->lwork)*sizeof(PetscScalar));
224:     ip->lwork = sz;
225:   }
226:   if (!H || nds>0) h = ip->work;
227:   else h = H;
228:   if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) c = ip->work + sz1;

230:   /* orthogonalize and compute onorm */
231:   switch (ip->orthog_ref) {

233:   case IP_ORTHOG_REFINE_NEVER:
234:     IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,h,NULL,NULL);
235:     /* compute |v| */
236:     if (norm) { IPNorm(ip,v,norm); }
237:     /* linear dependence check does not work without refinement */
238:     if (lindep) *lindep = PETSC_FALSE;
239:     break;

241:   case IP_ORTHOG_REFINE_ALWAYS:
242:     IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,h,NULL,NULL);
243:     if (lindep) {
244:       IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,&onrm,&nrm);
245:       if (norm) *norm = nrm;
246:       if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE;
247:       else *lindep = PETSC_FALSE;
248:     } else {
249:       IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,NULL,norm);
250:     }
251:     for (j=0;j<n;j++)
252:       if (!which || which[j]) h[nds+j] += c[nds+j];
253:     break;

255:   case IP_ORTHOG_REFINE_IFNEEDED:
256:     IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,h,&onrm,&nrm);
257:     /* ||q|| < eta ||h|| */
258:     k = 1;
259:     while (k<3 && nrm < ip->orthog_eta * onrm) {
260:       k++;
261:       if (!ip->matrix) {
262:         IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,&onrm,&nrm);
263:       } else {
264:         onrm = nrm;
265:         IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,NULL,&nrm);
266:       }
267:       for (j=0;j<n;j++)
268:         if (!which || which[j]) h[nds+j] += c[nds+j];
269:     }
270:     if (norm) *norm = nrm;
271:     if (lindep) {
272:       if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE;
273:       else *lindep = PETSC_FALSE;
274:     }
275:     break;

277:   default:
278:     SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement");
279:   }

281:   /* recover H from workspace */
282:   if (H && nds>0) {
283:     for (j=0;j<n;j++)
284:       if (!which || which[j]) H[j] = h[nds+j];
285:   }
286:   return(0);
287: }

291: /*@
292:    IPOrthogonalize - Orthogonalize a vector with respect to a set of vectors.

294:    Collective on IP and Vec

296:    Input Parameters:
297: +  ip     - the inner product (IP) context
298: .  nds    - number of columns of defl
299: .  defl   - first set of vectors
300: .  n      - number of columns of V
301: .  which  - logical array indicating columns of V to be used
302: -  V      - second set of vectors

304:    Input/Output Parameter:
305: .  v      - (input) vector to be orthogonalized and (output) result of
306:             orthogonalization

308:    Output Parameter:
309: +  H      - coefficients computed during orthogonalization with V
310: .  norm   - norm of the vector after being orthogonalized
311: -  lindep - flag indicating that refinement did not improve the quality
312:             of orthogonalization

314:    Notes:
315:    This function applies an orthogonal projector to project vector v onto the
316:    orthogonal complement of the span of the columns of defl and V. The columns
317:    of defl and V are assumed to be mutually orthonormal.

319:    On exit, v = v0 - V*H, where v0 is the original vector v.

321:    This routine does not normalize the resulting vector.

323:    Level: developer

325: .seealso: IPSetOrthogonalization(), IPBiOrthogonalize()
326: @*/
327: PetscErrorCode IPOrthogonalize(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
328: {

335:   PetscLogEventBegin(IP_Orthogonalize,ip,0,0,0);
336:   if (!nds && !n) {
337:     if (norm) { IPNorm(ip,v,norm); }
338:     if (lindep) *lindep = PETSC_FALSE;
339:   } else {
340:     switch (ip->orthog_type) {
341:     case IP_ORTHOG_CGS:
342:       IPOrthogonalizeCGS(ip,nds,defl,n,which,V,v,H,norm,lindep);
343:       break;
344:     case IP_ORTHOG_MGS:
345:       IPOrthogonalizeMGS(ip,nds,defl,n,which,V,v,H,norm,lindep);
346:       break;
347:     default:
348:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type");
349:     }
350:   }
351:   PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);
352:   return(0);
353: }

357: /*@
358:    IPQRDecomposition - Compute the QR factorization of a set of vectors.

360:    Collective on IP and Vec

362:    Input Parameters:
363: +  ip - the eigenproblem solver context
364: .  V - set of vectors
365: .  m - starting column
366: .  n - ending column
367: -  ldr - leading dimension of R

369:    Output Parameter:
370: .  R  - triangular matrix of QR factorization

372:    Notes:
373:    This routine orthonormalizes the columns of V so that V'*V=I up to
374:    working precision. It assumes that the first m columns (from 0 to m-1)
375:    are already orthonormal. The coefficients of the orthogonalization are
376:    stored in R so that V*R is equal to the original V.

378:    In some cases, this routine makes V B-orthonormal, that is, V'*B*V=I.

380:    If one of the vectors is linearly dependent wrt the rest (at working
381:    precision) then it is replaced by a random vector.

383:    Level: developer

385: .seealso: IPOrthogonalize(), IPNorm(), IPInnerProduct().
386: @*/
387: PetscErrorCode IPQRDecomposition(IP ip,Vec *V,PetscInt m,PetscInt n,PetscScalar *R,PetscInt ldr)
388: {
390:   PetscInt       k;
391:   PetscReal      norm;
392:   PetscBool      lindep;
393:   PetscRandom    rctx=NULL;

396:   for (k=m; k<n; k++) {

398:     /* orthogonalize v_k with respect to v_0, ..., v_{k-1} */
399:     if (R) {
400:       IPOrthogonalize(ip,0,NULL,k,NULL,V,V[k],&R[0+ldr*k],&norm,&lindep);
401:     } else {
402:       IPOrthogonalize(ip,0,NULL,k,NULL,V,V[k],NULL,&norm,&lindep);
403:     }

405:     /* normalize v_k: r_{k,k} = ||v_k||_2; v_k = v_k/r_{k,k} */
406:     if (norm==0.0 || lindep) {
407:       PetscInfo(ip,"Linearly dependent vector found, generating a new random vector\n");
408:       if (!rctx) {
409:         PetscRandomCreate(PetscObjectComm((PetscObject)ip),&rctx);
410:         PetscRandomSetSeed(rctx,0x12345678);
411:         PetscRandomSetFromOptions(rctx);
412:       }
413:       SlepcVecSetRandom(V[k],rctx);
414:       IPNorm(ip,V[k],&norm);
415:     }
416:     VecScale(V[k],1.0/norm);
417:     if (R) R[k+ldr*k] = norm;

419:   }
420:   PetscRandomDestroy(&rctx);
421:   return(0);
422: }

426: /*
427:    Given m vectors in W, this function transfers them to V while
428:    orthonormalizing them with respect to ip.
429:    The original vectors in W are destroyed.
430:  */
431: PetscErrorCode IPOrthonormalizeBasis_Private(IP ip,PetscInt *m,Vec **W,Vec *V)
432: {
434:   PetscInt       i,k;
435:   PetscBool      lindep;
436:   PetscReal      norm;

439:   k = 0;
440:   for (i=0;i<*m;i++) {
441:     VecCopy((*W)[i],V[k]);
442:     VecDestroy(&(*W)[i]);
443:     IPOrthogonalize(ip,0,NULL,k,NULL,V,V[k],NULL,&norm,&lindep);
444:     if (norm==0.0 || lindep) { PetscInfo(ip,"Linearly dependent vector found, removing...\n"); }
445:     else {
446:       VecScale(V[k],1.0/norm);
447:       k++;
448:     }
449:   }
450:   *m = k;
451:   PetscFree(*W);
452:   return(0);
453: }

slepc-3.4.2.dfsg.orig/src/ip/examples/0000755000175000017500000000000012214143515016450 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ip/examples/makefile0000644000175000017500000000177212211062077020157 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/ip/examples/ DIRS = tests include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ip/examples/tests/0000755000175000017500000000000012211062077017612 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ip/examples/tests/output/0000755000175000017500000000000012214143515021152 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ip/examples/tests/output/test4_1.out0000644000175000017500000000071512211062077023171 0ustar gladkgladkPseudo-orthogonalization of 6 random vectors of length 15. IP Object: 1 MPI processes type: indefinite orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) Matrix Object: 1 MPI processes type: seqaij rows=15, cols=15 total: nonzeros=15, allocated nonzeros=75 total number of mallocs used during MatSetValues calls =0 not using I-node routines Level of orthogonality: 8.70415e-14 slepc-3.4.2.dfsg.orig/src/ip/examples/tests/output/test2_1.out0000644000175000017500000000075412211062077023172 0ustar gladkgladkV(:,3:4) = V*Q(:,3:4) for random vectors of length 15 (V has 6 columns). With regular storage. Test gave correct result. V(:,3:4) = V*Q(3:4,:)' for random vectors of length 15 (V has 6 columns). With regular storage. Test gave correct result. V(:,3:4) = V*Q(:,3:4) for random vectors of length 15 (V has 6 columns). With contiguous storage. Test gave correct result. V(:,3:4) = V*Q(3:4,:)' for random vectors of length 15 (V has 6 columns). With contiguous storage. Test gave correct result. slepc-3.4.2.dfsg.orig/src/ip/examples/tests/output/test3_1.out0000644000175000017500000000066612211062077023175 0ustar gladkgladkIndefinite norm of a random vector of length 15. IP Object: 1 MPI processes type: indefinite orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) Matrix Object: 1 MPI processes type: seqaij rows=15, cols=15 total: nonzeros=15, allocated nonzeros=75 total number of mallocs used during MatSetValues calls =0 not using I-node routines Computed norm=-1.77074 slepc-3.4.2.dfsg.orig/src/ip/examples/tests/output/test1_1.out0000644000175000017500000000203012211062077023156 0ustar gladkgladkQR decomposition of 6 random vectors of length 15. IP Object: 1 MPI processes type: bilinear orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) With regular storage. Level of orthogonality below 100*eps QR decomposition of 6 random vectors of length 15. IP Object: 1 MPI processes type: bilinear orthogonalization method: modified Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) With regular storage. Level of orthogonality below 100*eps QR decomposition of 6 random vectors of length 15. IP Object: 1 MPI processes type: bilinear orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) With contiguous storage. Level of orthogonality below 100*eps QR decomposition of 6 random vectors of length 15. IP Object: 1 MPI processes type: bilinear orthogonalization method: modified Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) With contiguous storage. Level of orthogonality below 100*eps slepc-3.4.2.dfsg.orig/src/ip/examples/tests/test4.c0000644000175000017500000001002512211062077021017 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test IPPseudoOrthogonalize.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; Mat B; IP ip; Vec *V,t; PetscInt i,j,n=15,k=6,Istart,Iend; PetscRandom rctx; PetscReal lev,norm,*omega; PetscScalar *vals; PetscBool lindep; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-k",&k,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Pseudo-orthogonalization of %D random vectors of length %D.\n",k,n);CHKERRQ(ierr); /* Create sip matrix (standard involutionary permutation) */ ierr = MatCreate(PETSC_COMM_WORLD,&B);CHKERRQ(ierr); ierr = MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(B);CHKERRQ(ierr); ierr = MatSetUp(B);CHKERRQ(ierr); ierr = MatGetOwnershipRange(B,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/ip/examples/tests/ EXAMPLESC = test1.c test2.c test3.c test4.c EXAMPLESF = MANSEC = IP TESTS = test1 test2 test3 test4 TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \ = test2.PETSc runtest2_1 test2.rm \ = test3.PETSc runtest3_1 test3.rm \ = test4.PETSc runtest4_1 test4.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o test3: test3.o chkopts -${CLINKER} -o test3 test3.o ${SLEPC_LIB} ${RM} test3.o test4: test4.o chkopts -${CLINKER} -o test4 test4.o ${SLEPC_LIB} ${RM} test4.o #------------------------------------------------------------------------------------ runtest1_1: -@${MPIEXEC} -np 1 ./test1 -ip_orthog_type cgs > test1_1.tmp 2>&1; \ ${MPIEXEC} -np 1 ./test1 -ip_orthog_type mgs >> test1_1.tmp 2>&1; \ ${MPIEXEC} -np 1 ./test1 -ip_orthog_type cgs -contiguous >> test1_1.tmp 2>&1; \ ${MPIEXEC} -np 1 ./test1 -ip_orthog_type mgs -contiguous >> test1_1.tmp 2>&1; \ if (${DIFF} output/test1_1.out test1_1.tmp) then true; \ else echo "Possible problem with test1_1, diffs above"; fi; \ ${RM} -f test1_1.tmp runtest2_1: -@${MPIEXEC} -np 1 ./test2 > test2_1.tmp 2>&1; \ ${MPIEXEC} -np 1 ./test2 -qtrans >> test2_1.tmp 2>&1; \ ${MPIEXEC} -np 1 ./test2 -contiguous >> test2_1.tmp 2>&1; \ ${MPIEXEC} -np 1 ./test2 -qtrans -contiguous >> test2_1.tmp 2>&1; \ if (${DIFF} output/test2_1.out test2_1.tmp) then true; \ else echo "Possible problem with test2_1, diffs above"; fi; \ ${RM} -f test2_1.tmp runtest3_1: -@${MPIEXEC} -np 1 ./test3 > test3_1.tmp 2>&1; \ if (${DIFF} output/test3_1.out test3_1.tmp) then true; \ else echo "Possible problem with test3_1, diffs above"; fi; \ ${RM} -f test3_1.tmp runtest4_1: -@${MPIEXEC} -np 1 ./test4 > test4_1.tmp 2>&1; \ if (${DIFF} output/test4_1.out test4_1.tmp) then true; \ else echo "Possible problem with test4_1, diffs above"; fi; \ ${RM} -f test4_1.tmp slepc-3.4.2.dfsg.orig/src/ip/examples/tests/test1.c0000644000175000017500000000601512211062077021020 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test IPQRDecomposition.\n\n"; #include #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; IP ip; Vec *V,t; PetscInt i,n=15,k=6; PetscRandom rctx; PetscReal lev; PetscBool cont; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-k",&k,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"QR decomposition of %D random vectors of length %D.\n",k,n);CHKERRQ(ierr); ierr = PetscRandomCreate(PETSC_COMM_WORLD,&rctx);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(rctx);CHKERRQ(ierr); ierr = VecCreate(PETSC_COMM_WORLD,&t);CHKERRQ(ierr); ierr = VecSetSizes(t,n,PETSC_DECIDE);CHKERRQ(ierr); ierr = VecSetFromOptions(t);CHKERRQ(ierr); ierr = IPCreate(PETSC_COMM_WORLD,&ip);CHKERRQ(ierr); ierr = IPSetFromOptions(ip);CHKERRQ(ierr); ierr = IPView(ip,NULL);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-contiguous",&cont);CHKERRQ(ierr); /* with/without contiguous storage */ if (cont) { ierr = SlepcVecSetTemplate(t);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With contiguous storage.\n");CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD,"With regular storage.\n");CHKERRQ(ierr); } ierr = VecDuplicateVecs(t,k,&V);CHKERRQ(ierr); /* check orthogonality of QR of random vectors */ for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test indefinite IP.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; Mat A; IP ip; Vec v; PetscInt i,n=15,Istart,Iend; PetscRandom rctx; PetscReal norm; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Indefinite norm of a random vector of length %D.\n",n);CHKERRQ(ierr); /* Create sip matrix (standard involutionary permutation) */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test SlepcUpdateVectors.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; Vec *V,t; Mat A,B,C,M; PetscInt i,j,n=15,k=6,s=3,e=5; PetscRandom rctx; PetscBool cont,qtrans=PETSC_FALSE; PetscScalar *Q,*pa,*pv; PetscReal nrm; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-k",&k,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-s",&s,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-e",&e,NULL);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-qtrans",&qtrans);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"V(:,%D:%D) = V*",s,e-1);CHKERRQ(ierr); if (qtrans) { ierr = PetscPrintf(PETSC_COMM_WORLD,"Q(%D:%D,:)'",s,e-1);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD,"Q(:,%D:%D)",s,e-1);CHKERRQ(ierr); } ierr = PetscPrintf(PETSC_COMM_WORLD," for random vectors of length %D (V has %D columns).\n",n,k);CHKERRQ(ierr); ierr = PetscRandomCreate(PETSC_COMM_WORLD,&rctx);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(rctx);CHKERRQ(ierr); ierr = VecCreate(PETSC_COMM_WORLD,&t);CHKERRQ(ierr); ierr = VecSetSizes(t,n,PETSC_DECIDE);CHKERRQ(ierr); ierr = VecSetFromOptions(t);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*k*k,&Q);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-contiguous",&cont);CHKERRQ(ierr); /* with/without contiguous storage */ if (cont) { ierr = SlepcVecSetTemplate(t);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With contiguous storage.\n");CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD,"With regular storage.\n");CHKERRQ(ierr); } ierr = VecDuplicateVecs(t,k,&V);CHKERRQ(ierr); /* fill with random values */ for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcip.h" I*/ #include #include <../src/eps/impls/davidson/common/davidson.h> #define MyPetscSqrtReal(alpha) (PetscSign(PetscRealPart(alpha))*PetscSqrtReal(PetscAbs(PetscRealPart(alpha)))) /* IPOrthogonalizeCGS1 - Compute |v'| (estimated), |v| and one step of CGS with only one global synchronization */ #undef __FUNCT__ #define __FUNCT__ "IPBOrthogonalizeCGS1" PetscErrorCode IPBOrthogonalizeCGS1(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *onorm,PetscReal *norm) { PetscErrorCode ierr; PetscInt i,j; PetscScalar alpha; PetscFunctionBegin; /* h = [defl V]^* Bv ; alpha = (Bv, v) */ ierr = VecsMultIa(H,0,nds,defl,0,nds,&Bv,0,1);CHKERRQ(ierr); j = nds; if (!which) { ierr = VecsMultIa(H+j,0,n,V,0,n,&Bv,0,1);CHKERRQ(ierr); j+= n; } else { for (i=0; i0) sz = nds+n; sz1 = sz; if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) sz += nds+n; if (sz>ip->lwork) { ierr = PetscFree(ip->work);CHKERRQ(ierr); ierr = PetscMalloc(sz*sizeof(PetscScalar),&ip->work);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ip,(sz-ip->lwork)*sizeof(PetscScalar));CHKERRQ(ierr); ip->lwork = sz; } if (!H || nds>0) h = ip->work; else h = H; if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) c = ip->work + sz1; /* orthogonalize and compute onorm */ switch (ip->orthog_ref) { case IP_ORTHOG_REFINE_NEVER: ierr = IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,h,NULL,NULL);CHKERRQ(ierr); /* compute |v| */ if (norm) { ierr = VecDot(Bv,v,&alpha);CHKERRQ(ierr); *norm = MyPetscSqrtReal(alpha); } /* linear dependence check does not work without refinement */ if (lindep) *lindep = PETSC_FALSE; break; case IP_ORTHOG_REFINE_ALWAYS: ierr = IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,h,NULL,NULL);CHKERRQ(ierr); if (lindep) { ierr = IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,&onrm,&nrm);CHKERRQ(ierr); if (norm) *norm = nrm; if (PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } else { ierr = IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,NULL,norm);CHKERRQ(ierr); } for (j=0;jorthog_eta * PetscAbs(onrm)) { k++; if (!ip->matrix) { ierr = IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,&onrm,&nrm);CHKERRQ(ierr); } else { onrm = nrm; ierr = IPBOrthogonalizeCGS1(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,c,NULL,&nrm);CHKERRQ(ierr); } for (j=0;jorthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement"); } /* recover H from workspace */ if (H && nds>0) { for (j=0;jmatrix,v,Bv);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_ApplyMatrix,ip,0,0,0);CHKERRQ(ierr); if (!nds && !n) { if (norm) { ierr = VecDot(Bv,v,&alpha);CHKERRQ(ierr); *norm = MyPetscSqrtReal(alpha); } if (lindep) *lindep = PETSC_FALSE; } else { switch (ip->orthog_type) { case IP_ORTHOG_CGS: ierr = IPBOrthogonalizeCGS(ip,nds,defl,BDS,BDSnorms,n,which,V,BV,BVnorms,v,Bv,H,norm,lindep);CHKERRQ(ierr); break; case IP_ORTHOG_MGS: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unsupported orthogonalization type"); break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type"); } } ierr = PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ip/iporthog.c0000644000175000017500000003463612211062077016645 0ustar gladkgladk/* Routines related to orthogonalization. See the SLEPc Technical Report STR-1 for a detailed explanation. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcip.h" I*/ #include /* IPOrthogonalizeMGS1 - Compute one step of Modified Gram-Schmidt */ #undef __FUNCT__ #define __FUNCT__ "IPOrthogonalizeMGS1" static PetscErrorCode IPOrthogonalizeMGS1(IP ip,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H) { PetscErrorCode ierr; PetscInt j; PetscScalar dot; PetscFunctionBegin; for (j=0; jmatrix)) { ierr = IPInnerProductBegin(ip,v,v,&alpha);CHKERRQ(ierr); } ierr = IPMInnerProductEnd(ip,v,nds,defl,H);CHKERRQ(ierr); if (which) { /* use select array */ for (j=0;jmatrix)) { ierr = IPInnerProductEnd(ip,v,v,&alpha);CHKERRQ(ierr); } } /* q = v - V h */ ierr = SlepcVecMAXPBY(v,1.0,-1.0,nds,H,defl);CHKERRQ(ierr); if (which) { for (j=0;jmatrix) { /* estimate |v'| from |v| */ sum = 0.0; for (j=0; jorthog_ref) { case IP_ORTHOG_REFINE_NEVER: ierr = IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);CHKERRQ(ierr); ierr = IPOrthogonalizeMGS1(ip,n,which,V,v,H);CHKERRQ(ierr); /* compute |v| */ if (norm) { ierr = IPNorm(ip,v,norm);CHKERRQ(ierr); } /* linear dependence check does not work without refinement */ if (lindep) *lindep = PETSC_FALSE; break; case IP_ORTHOG_REFINE_ALWAYS: /* first step */ ierr = IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);CHKERRQ(ierr); ierr = IPOrthogonalizeMGS1(ip,n,which,V,v,H);CHKERRQ(ierr); if (lindep) { ierr = IPNorm(ip,v,&onrm);CHKERRQ(ierr); } /* second step */ ierr = IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);CHKERRQ(ierr); ierr = IPOrthogonalizeMGS1(ip,n,which,V,v,H);CHKERRQ(ierr); if (lindep || norm) { ierr = IPNorm(ip,v,&nrm);CHKERRQ(ierr); } if (lindep) { if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } if (norm) *norm = nrm; break; case IP_ORTHOG_REFINE_IFNEEDED: /* first step */ ierr = IPNorm(ip,v,&onrm);CHKERRQ(ierr); ierr = IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);CHKERRQ(ierr); ierr = IPOrthogonalizeMGS1(ip,n,which,V,v,H);CHKERRQ(ierr); ierr = IPNorm(ip,v,&nrm);CHKERRQ(ierr); /* ||q|| < eta ||h|| */ k = 1; while (k<3 && nrm < ip->orthog_eta * onrm) { k++; onrm = nrm; ierr = IPOrthogonalizeMGS1(ip,nds,NULL,defl,v,NULL);CHKERRQ(ierr); ierr = IPOrthogonalizeMGS1(ip,n,which,V,v,H);CHKERRQ(ierr); ierr = IPNorm(ip,v,&nrm);CHKERRQ(ierr); } if (lindep) { if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } if (norm) *norm = nrm; break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement"); } PetscFunctionReturn(0); } /* IPOrthogonalizeCGS - Orthogonalize with classical Gram-Schmidt */ #undef __FUNCT__ #define __FUNCT__ "IPOrthogonalizeCGS" static PetscErrorCode IPOrthogonalizeCGS(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep) { PetscErrorCode ierr; PetscScalar *h,*c; PetscReal onrm,nrm; PetscInt sz=0,sz1,j,k; PetscFunctionBegin; /* allocate h and c if needed */ if (!H || nds>0) sz = nds+n; sz1 = sz; if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) sz += nds+n; if (sz>ip->lwork) { ierr = PetscFree(ip->work);CHKERRQ(ierr); ierr = PetscMalloc(sz*sizeof(PetscScalar),&ip->work);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ip,(sz-ip->lwork)*sizeof(PetscScalar));CHKERRQ(ierr); ip->lwork = sz; } if (!H || nds>0) h = ip->work; else h = H; if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) c = ip->work + sz1; /* orthogonalize and compute onorm */ switch (ip->orthog_ref) { case IP_ORTHOG_REFINE_NEVER: ierr = IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,h,NULL,NULL);CHKERRQ(ierr); /* compute |v| */ if (norm) { ierr = IPNorm(ip,v,norm);CHKERRQ(ierr); } /* linear dependence check does not work without refinement */ if (lindep) *lindep = PETSC_FALSE; break; case IP_ORTHOG_REFINE_ALWAYS: ierr = IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,h,NULL,NULL);CHKERRQ(ierr); if (lindep) { ierr = IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,&onrm,&nrm);CHKERRQ(ierr); if (norm) *norm = nrm; if (nrm < ip->orthog_eta * onrm) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } else { ierr = IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,NULL,norm);CHKERRQ(ierr); } for (j=0;jorthog_eta * onrm) { k++; if (!ip->matrix) { ierr = IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,&onrm,&nrm);CHKERRQ(ierr); } else { onrm = nrm; ierr = IPOrthogonalizeCGS1(ip,nds,defl,n,which,V,v,c,NULL,&nrm);CHKERRQ(ierr); } for (j=0;jorthog_eta * onrm) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement"); } /* recover H from workspace */ if (H && nds>0) { for (j=0;jorthog_type) { case IP_ORTHOG_CGS: ierr = IPOrthogonalizeCGS(ip,nds,defl,n,which,V,v,H,norm,lindep);CHKERRQ(ierr); break; case IP_ORTHOG_MGS: ierr = IPOrthogonalizeMGS(ip,nds,defl,n,which,V,v,H,norm,lindep);CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type"); } } ierr = PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPQRDecomposition" /*@ IPQRDecomposition - Compute the QR factorization of a set of vectors. Collective on IP and Vec Input Parameters: + ip - the eigenproblem solver context . V - set of vectors . m - starting column . n - ending column - ldr - leading dimension of R Output Parameter: . R - triangular matrix of QR factorization Notes: This routine orthonormalizes the columns of V so that V'*V=I up to working precision. It assumes that the first m columns (from 0 to m-1) are already orthonormal. The coefficients of the orthogonalization are stored in R so that V*R is equal to the original V. In some cases, this routine makes V B-orthonormal, that is, V'*B*V=I. If one of the vectors is linearly dependent wrt the rest (at working precision) then it is replaced by a random vector. Level: developer .seealso: IPOrthogonalize(), IPNorm(), IPInnerProduct(). @*/ PetscErrorCode IPQRDecomposition(IP ip,Vec *V,PetscInt m,PetscInt n,PetscScalar *R,PetscInt ldr) { PetscErrorCode ierr; PetscInt k; PetscReal norm; PetscBool lindep; PetscRandom rctx=NULL; PetscFunctionBegin; for (k=m; k. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = ipbasic.c ipdot.c iporthog.c ipborthog.c ipform.c ipbiorthog.c SOURCEF = SOURCEH = ../../include/slepc-private/ipimpl.h ../../include/slepcip.h ../eps/impls/davidson/common/davidson.h LIBBASE = libslepc DIRS = MANSEC = IP LOCDIR = src/ip/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ip/makefile.html0000644000175000017500000000414412211062077017300 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = ipbasic.c ipdot.c iporthog.c ipborthog.c ipform.c ipbiorthog.c
SOURCEF  =
SOURCEH  = ../../include/slepc-private/ipimpl.h ../../include/slepcip.h ../eps/impls/davidson/common/davidson.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = IP
LOCDIR   = src/ip/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ip/index.html0000644000175000017500000000214112211062077016625 0ustar gladkgladk Inner Product - IP

Inner Product - IP

The IP package provides auxiliary routines that are internally used by the different SLEPc solvers. It provides an abstraction of a vector inner product that can be defined in different ways, and it includes important operations such as Gram-Schmidt orthogonalization.

These routines are usually not needed by application programmers.

../../include/slepc-private/ipimpl.h
../../include/slepcip.h
../eps/impls/davidson/common/davidson.h
ipbasic.c
ipdot.c
iporthog.c
ipborthog.c
ipform.c
ipbiorthog.c
makefile
slepc-3.4.2.dfsg.orig/src/ip/ipdot.c.html0000644000175000017500000012667312211062077017077 0ustar gladkgladk

Actual source code: ipdot.c

  1: /*
  2:      Dot product routines

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/ipimpl.h>      /*I "slepcip.h" I*/

 26: /* The following definitions are intended to avoid using the "T" versions
 27:    of dot products in the case of real scalars */
 28: #if defined(PETSC_USE_COMPLEX)
 29: #define VecXDotBegin  VecTDotBegin
 30: #define VecXDotEnd    VecTDotEnd
 31: #define VecMXDotBegin VecMTDotBegin
 32: #define VecMXDotEnd   VecMTDotEnd
 33: #else
 34: #define VecXDotBegin  VecDotBegin
 35: #define VecXDotEnd    VecDotEnd
 36: #define VecMXDotBegin VecMDotBegin
 37: #define VecMXDotEnd   VecMDotEnd
 38: #endif

 42: /*@
 43:    IPNorm - Computes the norm of a vector as the square root of the inner
 44:    product (x,x) as defined by IPInnerProduct().

 46:    Collective on IP and Vec

 48:    Input Parameters:
 49: +  ip - the inner product context
 50: -  x  - input vector

 52:    Output Parameter:
 53: .  norm - the computed norm

 55:    Notes:
 56:    This function will usually compute the 2-norm of a vector, ||x||_2. But
 57:    this behaviour may be different if using a non-standard inner product changed
 58:    via IPSetMatrix(). For example, if using the B-inner product for
 59:    positive definite B, (x,y)_B=y^H Bx, then the computed norm is ||x||_B =
 60:    sqrt(x^H Bx).

 62:    In an indefinite inner product, matrix B is indefinite and the norm is
 63:    defined as s*sqrt(abs(x^H Bx)), where s = sign(x^H Bx).

 65:    Level: developer

 67: .seealso: IPInnerProduct()
 68: @*/
 69: PetscErrorCode IPNorm(IP ip,Vec x,PetscReal *norm)
 70: {

 77:   (*ip->ops->normbegin)(ip,x,norm);
 78:   (*ip->ops->normend)(ip,x,norm);
 79:   return(0);
 80: }

 84: PetscErrorCode IPNormBegin_Bilinear(IP ip,Vec x,PetscReal *norm)
 85: {
 87:   PetscScalar    p;

 90:   IPInnerProductBegin(ip,x,x,&p);
 91:   return(0);
 92: }

 96: PetscErrorCode IPNormBegin_Sesquilin(IP ip,Vec x,PetscReal *norm)
 97: {
 99:   PetscScalar    p;

102:   if (!ip->matrix) {
103:     VecNormBegin(x,NORM_2,norm);
104:   } else {
105:     IPInnerProductBegin(ip,x,x,&p);
106:   }
107:   return(0);
108: }

112: PetscErrorCode IPNormBegin_Indefinite(IP ip,Vec x,PetscReal *norm)
113: {
115:   PetscScalar    p;

118:   if (!ip->matrix) {
119:     VecNormBegin(x,NORM_2,norm);
120:   } else {
121:     IPInnerProductBegin(ip,x,x,&p);
122:   }
123:   return(0);
124: }

128: /*@
129:    IPNormBegin - Starts a split phase norm computation.

131:    Collective on IP and Vec

133:    Input Parameters:
134: +  ip   - the inner product context
135: .  x    - input vector
136: -  norm - where the result will go

138:    Level: developer

140:    Notes:
141:    Each call to IPNormBegin() should be paired with a call to IPNormEnd().

143: .seealso: IPNormEnd(), IPNorm(), IPInnerProduct(), IPMInnerProduct(),
144:           IPInnerProductBegin(), IPInnerProductEnd()
145: @*/
146: PetscErrorCode IPNormBegin(IP ip,Vec x,PetscReal *norm)
147: {

154:   (*ip->ops->normbegin)(ip,x,norm);
155:   return(0);
156: }

160: PetscErrorCode IPNormEnd_Bilinear(IP ip,Vec x,PetscReal *norm)
161: {
163:   PetscScalar    p;

166:   IPInnerProductEnd(ip,x,x,&p);
167:   if (PetscAbsScalar(p)<PETSC_MACHINE_EPSILON)
168:     PetscInfo(ip,"Zero norm, either the vector is zero or a semi-inner product is being used\n");
169: #if defined(PETSC_USE_COMPLEX)
170:   if (PetscRealPart(p)<0.0 || PetscAbsReal(PetscImaginaryPart(p))>PETSC_MACHINE_EPSILON)
171:     SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined");
172:   *norm = PetscSqrtScalar(PetscRealPart(p));
173: #else
174:   if (p<0.0) SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined");
175:   *norm = PetscSqrtScalar(p);
176: #endif
177:   return(0);
178: }

182: PetscErrorCode IPNormEnd_Sesquilin(IP ip,Vec x,PetscReal *norm)
183: {
185:   PetscScalar    p;

188:   if (!ip->matrix) {
189:     VecNormEnd(x,NORM_2,norm);
190:   } else {
191:     IPInnerProductEnd(ip,x,x,&p);
192:     if (PetscAbsScalar(p)<PETSC_MACHINE_EPSILON)
193:       PetscInfo(ip,"Zero norm, either the vector is zero or a semi-inner product is being used\n");
194:     if (PetscRealPart(p)<0.0 || PetscAbsReal(PetscImaginaryPart(p))/PetscAbsScalar(p)>PETSC_MACHINE_EPSILON)
195:       SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined");
196:     *norm = PetscSqrtScalar(PetscRealPart(p));
197:   }
198:   return(0);
199: }

203: PetscErrorCode IPNormEnd_Indefinite(IP ip,Vec x,PetscReal *norm)
204: {
206:   PetscScalar    p;

209:   if (!ip->matrix) {
210:     VecNormEnd(x,NORM_2,norm);
211:   } else {
212:     IPInnerProductEnd(ip,x,x,&p);
213:     if (PetscAbsScalar(p)<PETSC_MACHINE_EPSILON)
214:       PetscInfo(ip,"Zero norm, either the vector is zero or a semi-inner product is being used\n");
215:     if (PetscAbsReal(PetscImaginaryPart(p))/PetscAbsScalar(p)>PETSC_SQRT_MACHINE_EPSILON)
216:       SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined");
217:     if (PetscRealPart(p)<0.0) *norm = -PetscSqrtScalar(-PetscRealPart(p));
218:     else *norm = PetscSqrtScalar(PetscRealPart(p));
219:   }
220:   return(0);
221: }

225: /*@
226:    IPNormEnd - Ends a split phase norm computation.

228:    Collective on IP and Vec

230:    Input Parameters:
231: +  ip   - the inner product context
232: -  x    - input vector

234:    Output Parameter:
235: .  norm - the computed norm

237:    Level: developer

239:    Notes:
240:    Each call to IPNormBegin() should be paired with a call to IPNormEnd().

242: .seealso: IPNormBegin(), IPNorm(), IPInnerProduct(), IPMInnerProduct(),
243:           IPInnerProductBegin(), IPInnerProductEnd()
244: @*/
245: PetscErrorCode IPNormEnd(IP ip,Vec x,PetscReal *norm)
246: {

253:   (*ip->ops->normend)(ip,x,norm);
254:   return(0);
255: }

259: /*@
260:    IPInnerProduct - Computes the inner product of two vectors.

262:    Collective on IP and Vec

264:    Input Parameters:
265: +  ip - the inner product context
266: .  x  - input vector
267: -  y  - input vector

269:    Output Parameter:
270: .  p - result of the inner product

272:    Notes:
273:    This function will usually compute the standard dot product of vectors
274:    x and y, (x,y)=y^H x. However this behaviour may be different if changed
275:    via IPSetMatrix(). This allows use of other inner products such as
276:    the indefinite product y^T x for complex symmetric problems or the
277:    B-inner product for positive definite B, (x,y)_B=y^H Bx.

279:    Level: developer

281: .seealso: IPSetMatrix(), VecDot(), IPMInnerProduct()
282: @*/
283: PetscErrorCode IPInnerProduct(IP ip,Vec x,Vec y,PetscScalar *p)
284: {

292:   PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);
293:   ip->innerproducts++;
294:   (*ip->ops->innerproductbegin)(ip,x,y,p);
295:   (*ip->ops->innerproductend)(ip,x,y,p);
296:   PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);
297:   return(0);
298: }

302: PetscErrorCode IPInnerProductBegin_Bilinear(IP ip,Vec x,Vec y,PetscScalar *p)
303: {

307:   if (ip->matrix) {
308:     IPApplyMatrix_Private(ip,x);
309:     VecXDotBegin(ip->Bx,y,p);
310:   } else {
311:     VecXDotBegin(x,y,p);
312:   }
313:   return(0);
314: }

318: PetscErrorCode IPInnerProductBegin_Sesquilin(IP ip,Vec x,Vec y,PetscScalar *p)
319: {

323:   if (ip->matrix) {
324:     IPApplyMatrix_Private(ip,x);
325:     VecDotBegin(ip->Bx,y,p);
326:   } else {
327:     VecDotBegin(x,y,p);
328:   }
329:   return(0);
330: }

334: /*@
335:    IPInnerProductBegin - Starts a split phase inner product computation.

337:    Collective on IP and Vec

339:    Input Parameters:
340: +  ip - the inner product context
341: .  x  - the first vector
342: .  y  - the second vector
343: -  p  - where the result will go

345:    Level: developer

347:    Notes:
348:    Each call to IPInnerProductBegin() should be paired with a call to IPInnerProductEnd().

350: .seealso: IPInnerProductEnd(), IPInnerProduct(), IPNorm(), IPNormBegin(),
351:           IPNormEnd(), IPMInnerProduct()
352: @*/
353: PetscErrorCode IPInnerProductBegin(IP ip,Vec x,Vec y,PetscScalar *p)
354: {

362:   PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);
363:   ip->innerproducts++;
364:   (*ip->ops->innerproductbegin)(ip,x,y,p);
365:   PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);
366:   return(0);
367: }

371: PetscErrorCode IPInnerProductEnd_Bilinear(IP ip,Vec x,Vec y,PetscScalar *p)
372: {

376:   if (ip->matrix) {
377:     VecXDotEnd(ip->Bx,y,p);
378:   } else {
379:     VecXDotEnd(x,y,p);
380:   }
381:   return(0);
382: }

386: PetscErrorCode IPInnerProductEnd_Sesquilin(IP ip,Vec x,Vec y,PetscScalar *p)
387: {

391:   if (ip->matrix) {
392:     VecDotEnd(ip->Bx,y,p);
393:   } else {
394:     VecDotEnd(x,y,p);
395:   }
396:   return(0);
397: }

401: /*@
402:    IPInnerProductEnd - Ends a split phase inner product computation.

404:    Collective on IP and Vec

406:    Input Parameters:
407: +  ip - the inner product context
408: .  x  - the first vector
409: -  y  - the second vector

411:    Output Parameter:
412: .  p  - result of the inner product

414:    Level: developer

416:    Notes:
417:    Each call to IPInnerProductBegin() should be paired with a call to IPInnerProductEnd().

419: .seealso: IPInnerProductBegin(), IPInnerProduct(), IPNorm(), IPNormBegin(),
420:           IPNormEnd(), IPMInnerProduct()
421: @*/
422: PetscErrorCode IPInnerProductEnd(IP ip,Vec x,Vec y,PetscScalar *p)
423: {

431:   PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);
432:   (*ip->ops->innerproductend)(ip,x,y,p);
433:   PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);
434:   return(0);
435: }

439: /*@
440:    IPMInnerProduct - Computes the inner products a vector x with a set of
441:    vectors (columns of Y).

443:    Collective on IP and Vec

445:    Input Parameters:
446: +  ip - the inner product context
447: .  x  - the first input vector
448: .  n  - number of vectors in y
449: -  y  - array of vectors

451:    Output Parameter:
452: .  p - result of the inner products

454:    Notes:
455:    This function will usually compute the standard dot product of x and y_i,
456:    (x,y_i)=y_i^H x, for each column of Y. However this behaviour may be different
457:    if changed via IPSetMatrix(). This allows use of other inner products
458:    such as the indefinite product y_i^T x for complex symmetric problems or the
459:    B-inner product for positive definite B, (x,y_i)_B=y_i^H Bx.

461:    Level: developer

463: .seealso: IPSetMatrix(), VecMDot(), IPInnerProduct()
464: @*/
465: PetscErrorCode IPMInnerProduct(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
466: {

475:   PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);
476:   ip->innerproducts += n;
477:   (*ip->ops->minnerproductbegin)(ip,x,n,y,p);
478:   (*ip->ops->minnerproductend)(ip,x,n,y,p);
479:   PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);
480:   return(0);
481: }

485: PetscErrorCode IPMInnerProductBegin_Bilinear(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
486: {

490:   if (ip->matrix) {
491:     IPApplyMatrix_Private(ip,x);
492:     VecMXDotBegin(ip->Bx,n,y,p);
493:   } else {
494:     VecMXDotBegin(x,n,y,p);
495:   }
496:   return(0);
497: }

501: PetscErrorCode IPMInnerProductBegin_Sesquilin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
502: {

506:   if (ip->matrix) {
507:     IPApplyMatrix_Private(ip,x);
508:     VecMDotBegin(ip->Bx,n,y,p);
509:   } else {
510:     VecMDotBegin(x,n,y,p);
511:   }
512:   return(0);
513: }

517: /*@
518:    IPMInnerProductBegin - Starts a split phase multiple inner product computation.

520:    Collective on IP and Vec

522:    Input Parameters:
523: +  ip - the inner product context
524: .  x  - the first input vector
525: .  n  - number of vectors in y
526: .  y  - array of vectors
527: -  p  - where the result will go

529:    Level: developer

531:    Notes:
532:    Each call to IPMInnerProductBegin() should be paired with a call to IPMInnerProductEnd().

534: .seealso: IPMInnerProductEnd(), IPMInnerProduct(), IPNorm(), IPNormBegin(),
535:           IPNormEnd(), IPInnerProduct()
536: @*/
537: PetscErrorCode IPMInnerProductBegin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
538: {

544:   if (n == 0) return(0);
548:   PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);
549:   ip->innerproducts += n;
550:   (*ip->ops->minnerproductbegin)(ip,x,n,y,p);
551:   PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);
552:   return(0);
553: }

557: PetscErrorCode IPMInnerProductEnd_Bilinear(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
558: {

562:   if (ip->matrix) {
563:     VecMXDotEnd(ip->Bx,n,y,p);
564:   } else {
565:     VecMXDotEnd(x,n,y,p);
566:   }
567:   return(0);
568: }

572: PetscErrorCode IPMInnerProductEnd_Sesquilin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
573: {

577:   if (ip->matrix) {
578:     VecMDotEnd(ip->Bx,n,y,p);
579:   } else {
580:     VecMDotEnd(x,n,y,p);
581:   }
582:   return(0);
583: }

587: /*@
588:    IPMInnerProductEnd - Ends a split phase multiple inner product computation.

590:    Collective on IP and Vec

592:    Input Parameters:
593: +  ip - the inner product context
594: .  x  - the first input vector
595: .  n  - number of vectors in y
596: -  y  - array of vectors

598:    Output Parameter:
599: .  p - result of the inner products

601:    Level: developer

603:    Notes:
604:    Each call to IPMInnerProductBegin() should be paired with a call to IPMInnerProductEnd().

606: .seealso: IPMInnerProductBegin(), IPMInnerProduct(), IPNorm(), IPNormBegin(),
607:           IPNormEnd(), IPInnerProduct()
608: @*/
609: PetscErrorCode IPMInnerProductEnd(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
610: {

616:   if (n == 0) return(0);
620:   PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);
621:   (*ip->ops->minnerproductend)(ip,x,n,y,p);
622:   PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);
623:   return(0);
624: }

628: PETSC_EXTERN PetscErrorCode IPCreate_Bilinear(IP ip)
629: {
631:   ip->ops->normbegin          = IPNormBegin_Bilinear;
632:   ip->ops->normend            = IPNormEnd_Bilinear;
633:   ip->ops->innerproductbegin  = IPInnerProductBegin_Bilinear;
634:   ip->ops->innerproductend    = IPInnerProductEnd_Bilinear;
635:   ip->ops->minnerproductbegin = IPMInnerProductBegin_Bilinear;
636:   ip->ops->minnerproductend   = IPMInnerProductEnd_Bilinear;
637:   return(0);
638: }

640: #if defined(PETSC_USE_COMPLEX)
643: PETSC_EXTERN PetscErrorCode IPCreate_Sesquilin(IP ip)
644: {
646:   ip->ops->normbegin          = IPNormBegin_Sesquilin;
647:   ip->ops->normend            = IPNormEnd_Sesquilin;
648:   ip->ops->innerproductbegin  = IPInnerProductBegin_Sesquilin;
649:   ip->ops->innerproductend    = IPInnerProductEnd_Sesquilin;
650:   ip->ops->minnerproductbegin = IPMInnerProductBegin_Sesquilin;
651:   ip->ops->minnerproductend   = IPMInnerProductEnd_Sesquilin;
652:   return(0);
653: }
654: #endif

658: PETSC_EXTERN PetscErrorCode IPCreate_Indefinite(IP ip)
659: {
661:   ip->ops->normbegin          = IPNormBegin_Indefinite;
662:   ip->ops->normend            = IPNormEnd_Indefinite;
663: #if defined(PETSC_USE_COMPLEX)
664:   ip->ops->innerproductbegin  = IPInnerProductBegin_Sesquilin;
665:   ip->ops->innerproductend    = IPInnerProductEnd_Sesquilin;
666:   ip->ops->minnerproductbegin = IPMInnerProductBegin_Sesquilin;
667:   ip->ops->minnerproductend   = IPMInnerProductEnd_Sesquilin;
668: #else
669:   ip->ops->innerproductbegin  = IPInnerProductBegin_Bilinear;
670:   ip->ops->innerproductend    = IPInnerProductEnd_Bilinear;
671:   ip->ops->minnerproductbegin = IPMInnerProductBegin_Bilinear;
672:   ip->ops->minnerproductend   = IPMInnerProductEnd_Bilinear;
673: #endif
674:   return(0);
675: }

slepc-3.4.2.dfsg.orig/src/ip/ftn-custom/0000755000175000017500000000000012214143515016731 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ip/ftn-custom/makefile0000644000175000017500000000216012211062077020430 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zipf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/ip/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ip/ftn-custom/zipf.c0000644000175000017500000000644012211062077020051 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define ipcreate_ IPCREATE #define ipdestroy_ IPDESTROY #define ipsetoptionsprefix_ IPSETOPTIONSPREFIX #define ipappendoptionsprefix_ IPAPPENDOPTIONSPREFIX #define ipgetoptionsprefix_ IPGETOPTIONSPREFIX #define ipgetorthogonalization_ IPGETORTHOGONALIZATION #define ipview_ IPVIEW #define ipgetmatrix_ IPGETMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define ipcreate_ ipcreate #define ipdestroy_ ipdestroy #define ipsetoptionsprefix_ ipsetoptionsprefix #define ipappendoptionsprefix_ ipappendoptionsprefix #define ipgetoptionsprefix_ ipgetoptionsprefix #define ipgetorthogonalization_ ipgetorthogonalization #define ipview_ ipview #define ipgetmatrix_ ipgetmatrix #endif PETSC_EXTERN void PETSC_STDCALL ipcreate_(MPI_Fint *comm,IP *newip,PetscErrorCode *ierr) { *ierr = IPCreate(MPI_Comm_f2c(*(comm)),newip); } PETSC_EXTERN void PETSC_STDCALL ipdestroy_(IP *ip,PetscErrorCode *ierr) { *ierr = IPDestroy(ip); } PETSC_EXTERN void PETSC_STDCALL ipsetoptionsprefix_(IP *ip,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = IPSetOptionsPrefix(*ip,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL ipappendoptionsprefix_(IP *ip,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = IPAppendOptionsPrefix(*ip,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL ipgetoptionsprefix_(IP *ip,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = IPGetOptionsPrefix(*ip,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL ipgetorthogonalization_(IP *ip,IPOrthogType *type,IPOrthogRefineType *refinement,PetscReal *eta,PetscErrorCode *ierr) { *ierr = IPGetOrthogonalization(*ip,type,refinement,eta); } PETSC_EXTERN void PETSC_STDCALL ipview_(IP *ip,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = IPView(*ip,v); } PETSC_EXTERN void PETSC_STDCALL ipgetmatrix_(IP *ip,Mat *mat,PetscErrorCode *ierr) { *ierr = IPGetMatrix(*ip,mat); } slepc-3.4.2.dfsg.orig/src/ip/ipbasic.c.html0000644000175000017500000014561312211062077017365 0ustar gladkgladk
Actual source code: ipbasic.c

  1: /*
  2:      Basic routines

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/ipimpl.h>      /*I "slepcip.h" I*/

 26: PetscFunctionList IPList = 0;
 27: PetscBool         IPRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      IP_CLASSID = 0;
 29: PetscLogEvent     IP_InnerProduct = 0,IP_Orthogonalize = 0,IP_ApplyMatrix = 0;
 30: static PetscBool  IPPackageInitialized = PETSC_FALSE;

 34: /*@C
 35:    IPFinalizePackage - This function destroys everything in the Slepc interface
 36:    to the IP package. It is called from SlepcFinalize().

 38:    Level: developer

 40: .seealso: SlepcFinalize()
 41: @*/
 42: PetscErrorCode IPFinalizePackage(void)
 43: {

 47:   PetscFunctionListDestroy(&IPList);
 48:   IPPackageInitialized = PETSC_FALSE;
 49:   IPRegisterAllCalled  = PETSC_FALSE;
 50:   return(0);
 51: }

 55: /*@C
 56:   IPInitializePackage - This function initializes everything in the IP package. It is called
 57:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to IPCreate()
 58:   when using static libraries.

 60:   Level: developer

 62: .seealso: SlepcInitialize()
 63: @*/
 64: PetscErrorCode IPInitializePackage(void)
 65: {
 66:   char             logList[256];
 67:   char             *className;
 68:   PetscBool        opt;
 69:   PetscErrorCode   ierr;

 72:   if (IPPackageInitialized) return(0);
 73:   IPPackageInitialized = PETSC_TRUE;
 74:   /* Register Classes */
 75:   PetscClassIdRegister("Inner product",&IP_CLASSID);
 76:   /* Register Constructors */
 77:   IPRegisterAll();
 78:   /* Register Events */
 79:   PetscLogEventRegister("IPOrthogonalize",IP_CLASSID,&IP_Orthogonalize);
 80:   PetscLogEventRegister("IPInnerProduct",IP_CLASSID,&IP_InnerProduct);
 81:   PetscLogEventRegister("IPApplyMatrix",IP_CLASSID,&IP_ApplyMatrix);
 82:   /* Process info exclusions */
 83:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 84:   if (opt) {
 85:     PetscStrstr(logList,"ip",&className);
 86:     if (className) {
 87:       PetscInfoDeactivateClass(IP_CLASSID);
 88:     }
 89:   }
 90:   /* Process summary exclusions */
 91:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 92:   if (opt) {
 93:     PetscStrstr(logList,"ip",&className);
 94:     if (className) {
 95:       PetscLogEventDeactivateClass(IP_CLASSID);
 96:     }
 97:   }
 98:   PetscRegisterFinalize(IPFinalizePackage);
 99:   return(0);
100: }

104: /*@C
105:    IPCreate - Creates an IP context.

107:    Collective on MPI_Comm

109:    Input Parameter:
110: .  comm - MPI communicator

112:    Output Parameter:
113: .  newip - location to put the IP context

115:    Level: beginner

117:    Note:
118:    IP objects are not intended for normal users but only for
119:    advanced user that for instance implement their own solvers.

121: .seealso: IPDestroy(), IP
122: @*/
123: PetscErrorCode IPCreate(MPI_Comm comm,IP *newip)
124: {
125:   IP             ip;

130:   *newip = 0;
131: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
132:   IPInitializePackage();
133: #endif

135:   SlepcHeaderCreate(ip,_p_IP,struct _IPOps,IP_CLASSID,"IP","Inner Product","IP",comm,IPDestroy,IPView);

137:   ip->orthog_type   = IP_ORTHOG_CGS;
138:   ip->orthog_ref    = IP_ORTHOG_REFINE_IFNEEDED;
139:   ip->orthog_eta    = 0.7071;
140:   ip->innerproducts = 0;
141:   ip->matrix        = NULL;
142:   ip->Bx            = NULL;
143:   ip->xid           = 0;
144:   ip->xstate        = 0;
145:   ip->work          = NULL;
146:   ip->lwork         = 0;

148:   *newip = ip;
149:   return(0);
150: }

154: /*@C
155:    IPSetOptionsPrefix - Sets the prefix used for searching for all
156:    IP options in the database.

158:    Logically Collective on IP

160:    Input Parameters:
161: +  ip - the inner product context
162: -  prefix - the prefix string to prepend to all IP option requests

164:    Notes:
165:    A hyphen (-) must NOT be given at the beginning of the prefix name.
166:    The first character of all runtime options is AUTOMATICALLY the
167:    hyphen.

169:    Level: advanced

171: .seealso: IPAppendOptionsPrefix()
172: @*/
173: PetscErrorCode IPSetOptionsPrefix(IP ip,const char *prefix)
174: {

179:   PetscObjectSetOptionsPrefix((PetscObject)ip,prefix);
180:   return(0);
181: }

185: /*@C
186:    IPAppendOptionsPrefix - Appends to the prefix used for searching for all
187:    IP options in the database.

189:    Logically Collective on IP

191:    Input Parameters:
192: +  ip - the inner product context
193: -  prefix - the prefix string to prepend to all IP option requests

195:    Notes:
196:    A hyphen (-) must NOT be given at the beginning of the prefix name.
197:    The first character of all runtime options is AUTOMATICALLY the hyphen.

199:    Level: advanced

201: .seealso: IPSetOptionsPrefix()
202: @*/
203: PetscErrorCode IPAppendOptionsPrefix(IP ip,const char *prefix)
204: {

209:   PetscObjectAppendOptionsPrefix((PetscObject)ip,prefix);
210:   return(0);
211: }

215: /*@C
216:    IPGetOptionsPrefix - Gets the prefix used for searching for all
217:    IP options in the database.

219:    Not Collective

221:    Input Parameters:
222: .  ip - the inner product context

224:    Output Parameters:
225: .  prefix - pointer to the prefix string used is returned

227:    Notes: On the fortran side, the user should pass in a string 'prefix' of
228:    sufficient length to hold the prefix.

230:    Level: advanced

232: .seealso: IPSetOptionsPrefix(), IPAppendOptionsPrefix()
233: @*/
234: PetscErrorCode IPGetOptionsPrefix(IP ip,const char *prefix[])
235: {

241:   PetscObjectGetOptionsPrefix((PetscObject)ip,prefix);
242:   return(0);
243: }

247: /*@C
248:    IPSetType - Selects the type for the IP object.

250:    Logically Collective on IP

252:    Input Parameter:
253: +  ip   - the inner product context
254: -  type - a known type

256:    Notes:
257:    Three types are available: IPBILINEAR, IPSESQUILINEAR, and IPINDEFINITE.

259:    For complex scalars, the default is a sesquilinear form (x,y)=x^H*M*y and it is
260:    also possible to choose a bilinear form (x,y)=x^T*M*y (without complex conjugation).
261:    The latter could be useful e.g. in complex-symmetric eigensolvers.

263:    In the case of real scalars, only the bilinear form (x,y)=x^T*M*y is available.

265:    The indefinite inner product is reserved for the case of an indefinite
266:    matrix M. This is used for instance in symmetric-indefinite eigenproblems.

268:    Level: advanced

270: .seealso: IPGetType()
271: @*/
272: PetscErrorCode IPSetType(IP ip,IPType type)
273: {
274:   PetscErrorCode ierr,(*r)(IP);
275:   PetscBool      match;


281:   PetscObjectTypeCompare((PetscObject)ip,type,&match);
282:   if (match) return(0);

284:    PetscFunctionListFind(IPList,type,&r);
285:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested IP type %s",type);

287:   PetscMemzero(ip->ops,sizeof(struct _IPOps));

289:   PetscObjectChangeTypeName((PetscObject)ip,type);
290:   (*r)(ip);
291:   return(0);
292: }

296: /*@C
297:    IPGetType - Gets the IP type name (as a string) from the IP context.

299:    Not Collective

301:    Input Parameter:
302: .  ip - the inner product context

304:    Output Parameter:
305: .  name - name of the inner product

307:    Level: advanced

309: .seealso: IPSetType()
310: @*/
311: PetscErrorCode IPGetType(IP ip,IPType *type)
312: {
316:   *type = ((PetscObject)ip)->type_name;
317:   return(0);
318: }

322: /*
323:   Sets the default IP type, depending on whether complex arithmetic
324:   is used or not.
325: */
326: PetscErrorCode IPSetType_Default(IP ip)
327: {

332: #if defined(PETSC_USE_COMPLEX)
333:   IPSetType(ip,IPSESQUILINEAR);
334: #else
335:   IPSetType(ip,IPBILINEAR);
336: #endif
337:   return(0);
338: }

342: /*@
343:    IPSetFromOptions - Sets IP options from the options database.

345:    Collective on IP

347:    Input Parameters:
348: .  ip - the inner product context

350:    Notes:
351:    To see all options, run your program with the -help option.

353:    Level: beginner
354: @*/
355: PetscErrorCode IPSetFromOptions(IP ip)
356: {
357:   const char     *orth_list[2] = {"mgs","cgs"};
358:   const char     *ref_list[3] = {"never","ifneeded","always"};
359:   PetscReal      r;
360:   PetscInt       i,j;

365:   if (!IPRegisterAllCalled) { IPRegisterAll(); }
366:   /* Set default type (we do not allow changing it with -ip_type) */
367:   if (!((PetscObject)ip)->type_name) {
368:     IPSetType_Default(ip);
369:   }
370:   PetscObjectOptionsBegin((PetscObject)ip);
371:     i = ip->orthog_type;
372:     PetscOptionsEList("-ip_orthog_type","Orthogonalization method","IPSetOrthogonalization",orth_list,2,orth_list[i],&i,NULL);
373:     j = ip->orthog_ref;
374:     PetscOptionsEList("-ip_orthog_refine","Iterative refinement mode during orthogonalization","IPSetOrthogonalization",ref_list,3,ref_list[j],&j,NULL);
375:     r = ip->orthog_eta;
376:     PetscOptionsReal("-ip_orthog_eta","Parameter of iterative refinement during orthogonalization","IPSetOrthogonalization",r,&r,NULL);
377:     IPSetOrthogonalization(ip,(IPOrthogType)i,(IPOrthogRefineType)j,r);
378:     PetscObjectProcessOptionsHandlers((PetscObject)ip);
379:   PetscOptionsEnd();
380:   return(0);
381: }

385: /*@
386:    IPSetOrthogonalization - Specifies the type of orthogonalization technique
387:    to be used (classical or modified Gram-Schmidt with or without refinement).

389:    Logically Collective on IP

391:    Input Parameters:
392: +  ip     - the inner product context
393: .  type   - the type of orthogonalization technique
394: .  refine - type of refinement
395: -  eta    - parameter for selective refinement

397:    Options Database Keys:
398: +  -orthog_type <type> - Where <type> is cgs for Classical Gram-Schmidt orthogonalization
399:                          (default) or mgs for Modified Gram-Schmidt orthogonalization
400: .  -orthog_refine <type> - Where <type> is one of never, ifneeded (default) or always
401: -  -orthog_eta <eta> -  For setting the value of eta

403:    Notes:
404:    The default settings work well for most problems.

406:    The parameter eta should be a real value between 0 and 1 (or PETSC_DEFAULT).
407:    The value of eta is used only when the refinement type is "ifneeded".

409:    When using several processors, MGS is likely to result in bad scalability.

411:    Level: advanced

413: .seealso: IPOrthogonalize(), IPGetOrthogonalization(), IPOrthogType,
414:           IPOrthogRefineType
415: @*/
416: PetscErrorCode IPSetOrthogonalization(IP ip,IPOrthogType type,IPOrthogRefineType refine,PetscReal eta)
417: {
423:   switch (type) {
424:     case IP_ORTHOG_CGS:
425:     case IP_ORTHOG_MGS:
426:       ip->orthog_type = type;
427:       break;
428:     default:
429:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type");
430:   }
431:   switch (refine) {
432:     case IP_ORTHOG_REFINE_NEVER:
433:     case IP_ORTHOG_REFINE_IFNEEDED:
434:     case IP_ORTHOG_REFINE_ALWAYS:
435:       ip->orthog_ref = refine;
436:       break;
437:     default:
438:       SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown refinement type");
439:   }
440:   if (eta == PETSC_DEFAULT) {
441:     ip->orthog_eta = 0.7071;
442:   } else {
443:     if (eta <= 0.0 || eta > 1.0) SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_OUTOFRANGE,"Invalid eta value");
444:     ip->orthog_eta = eta;
445:   }
446:   return(0);
447: }

451: /*@C
452:    IPGetOrthogonalization - Gets the orthogonalization settings from the
453:    IP object.

455:    Not Collective

457:    Input Parameter:
458: .  ip - inner product context

460:    Output Parameter:
461: +  type   - type of orthogonalization technique
462: .  refine - type of refinement
463: -  eta    - parameter for selective refinement

465:    Level: advanced

467: .seealso: IPOrthogonalize(), IPSetOrthogonalization(), IPOrthogType,
468:           IPOrthogRefineType
469: @*/
470: PetscErrorCode IPGetOrthogonalization(IP ip,IPOrthogType *type,IPOrthogRefineType *refine,PetscReal *eta)
471: {
474:   if (type)   *type   = ip->orthog_type;
475:   if (refine) *refine = ip->orthog_ref;
476:   if (eta)    *eta    = ip->orthog_eta;
477:   return(0);
478: }

482: /*@C
483:    IPView - Prints the IP data structure.

485:    Collective on IP

487:    Input Parameters:
488: +  ip - the inner product context
489: -  viewer - optional visualization context

491:    Note:
492:    The available visualization contexts include
493: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
494: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
495:          output where only the first processor opens
496:          the file.  All other processors send their
497:          data to the first processor to print.

499:    The user can open an alternative visualization context with
500:    PetscViewerASCIIOpen() - output to a specified file.

502:    Level: beginner

504: .seealso: EPSView(), SVDView(), PetscViewerASCIIOpen()
505: @*/
506: PetscErrorCode IPView(IP ip,PetscViewer viewer)
507: {
508:   PetscBool      isascii;

513:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ip));
516:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
517:   if (isascii) {
518:     PetscObjectPrintClassNamePrefixType((PetscObject)ip,viewer,"IP Object");
519:     PetscViewerASCIIPrintf(viewer,"  orthogonalization method: ");
520:     switch (ip->orthog_type) {
521:       case IP_ORTHOG_MGS:
522:         PetscViewerASCIIPrintf(viewer,"modified Gram-Schmidt\n");
523:         break;
524:       case IP_ORTHOG_CGS:
525:         PetscViewerASCIIPrintf(viewer,"classical Gram-Schmidt\n");
526:         break;
527:       default: SETERRQ(PetscObjectComm((PetscObject)ip),1,"Wrong value of ip->orth_type");
528:     }
529:     PetscViewerASCIIPrintf(viewer,"  orthogonalization refinement: ");
530:     switch (ip->orthog_ref) {
531:       case IP_ORTHOG_REFINE_NEVER:
532:         PetscViewerASCIIPrintf(viewer,"never\n");
533:         break;
534:       case IP_ORTHOG_REFINE_IFNEEDED:
535:         PetscViewerASCIIPrintf(viewer,"if needed (eta: %G)\n",ip->orthog_eta);
536:         break;
537:       case IP_ORTHOG_REFINE_ALWAYS:
538:         PetscViewerASCIIPrintf(viewer,"always\n");
539:         break;
540:       default: SETERRQ(PetscObjectComm((PetscObject)ip),1,"Wrong value of ip->orth_ref");
541:     }
542:     if (ip->matrix) {
543:       PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);
544:       PetscViewerASCIIPushTab(viewer);
545:       MatView(ip->matrix,viewer);
546:       PetscViewerASCIIPopTab(viewer);
547:       PetscViewerPopFormat(viewer);
548:     }
549:   }
550:   return(0);
551: }

555: /*@
556:    IPReset - Resets the IP context to the initial state.

558:    Collective on IP

560:    Input Parameter:
561: .  ip - the inner product context

563:    Level: advanced

565: .seealso: IPDestroy()
566: @*/
567: PetscErrorCode IPReset(IP ip)
568: {

573:   MatDestroy(&ip->matrix);
574:   VecDestroy(&ip->Bx);
575:   ip->xid    = 0;
576:   ip->xstate = 0;
577:   PetscFree(ip->work);
578:   ip->lwork  = 0;
579:   IPResetOperationCounters(ip);
580:   return(0);
581: }

585: /*@C
586:    IPDestroy - Destroys IP context that was created with IPCreate().

588:    Collective on IP

590:    Input Parameter:
591: .  ip - the inner product context

593:    Level: beginner

595: .seealso: IPCreate()
596: @*/
597: PetscErrorCode IPDestroy(IP *ip)
598: {

602:   if (!*ip) return(0);
604:   if (--((PetscObject)(*ip))->refct > 0) { *ip = 0; return(0); }
605:   IPReset(*ip);
606:   PetscHeaderDestroy(ip);
607:   return(0);
608: }

612: /*@
613:    IPGetOperationCounters - Gets the total number of inner product operations
614:    made by the IP object.

616:    Not Collective

618:    Input Parameter:
619: .  ip - the inner product context

621:    Output Parameter:
622: .  dots - number of inner product operations

624:    Level: intermediate

626: .seealso: IPResetOperationCounters()
627: @*/
628: PetscErrorCode IPGetOperationCounters(IP ip,PetscInt *dots)
629: {
633:   *dots = ip->innerproducts;
634:   return(0);
635: }

639: /*@
640:    IPResetOperationCounters - Resets the counters for inner product operations
641:    made by of the IP object.

643:    Logically Collective on IP

645:    Input Parameter:
646: .  ip - the inner product context

648:    Level: intermediate

650: .seealso: IPGetOperationCounters()
651: @*/
652: PetscErrorCode IPResetOperationCounters(IP ip)
653: {
656:   ip->innerproducts = 0;
657:   return(0);
658: }

662: /*@C
663:    IPRegister - Adds an inner product to the IP package.

665:    Not collective

667:    Input Parameters:
668: +  name - name of a new user-defined IP
669: -  function - routine to create context

671:    Notes:
672:    IPRegister() may be called multiple times to add several user-defined inner products.

674:    Level: advanced

676: .seealso: IPRegisterAll()
677: @*/
678: PetscErrorCode IPRegister(const char *name,PetscErrorCode (*function)(IP))
679: {

683:   PetscFunctionListAdd(&IPList,name,function);
684:   return(0);
685: }

687: PETSC_EXTERN PetscErrorCode IPCreate_Bilinear(IP);
688: #if defined(PETSC_USE_COMPLEX)
689: PETSC_EXTERN PetscErrorCode IPCreate_Sesquilin(IP);
690: #endif
691: PETSC_EXTERN PetscErrorCode IPCreate_Indefinite(IP);

695: /*@C
696:    IPRegisterAll - Registers all of the inner products in the IP package.

698:    Not Collective

700:    Level: advanced
701: @*/
702: PetscErrorCode IPRegisterAll(void)
703: {

707:   IPRegisterAllCalled = PETSC_TRUE;
708:   IPRegister(IPBILINEAR,IPCreate_Bilinear);
709: #if defined(PETSC_USE_COMPLEX)
710:   IPRegister(IPSESQUILINEAR,IPCreate_Sesquilin);
711: #endif
712:   IPRegister(IPINDEFINITE,IPCreate_Indefinite);
713:   return(0);
714: }

slepc-3.4.2.dfsg.orig/src/ip/ipdot.c0000644000175000017500000004733512211062077016131 0ustar gladkgladk/* Dot product routines - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcip.h" I*/ /* The following definitions are intended to avoid using the "T" versions of dot products in the case of real scalars */ #if defined(PETSC_USE_COMPLEX) #define VecXDotBegin VecTDotBegin #define VecXDotEnd VecTDotEnd #define VecMXDotBegin VecMTDotBegin #define VecMXDotEnd VecMTDotEnd #else #define VecXDotBegin VecDotBegin #define VecXDotEnd VecDotEnd #define VecMXDotBegin VecMDotBegin #define VecMXDotEnd VecMDotEnd #endif #undef __FUNCT__ #define __FUNCT__ "IPNorm" /*@ IPNorm - Computes the norm of a vector as the square root of the inner product (x,x) as defined by IPInnerProduct(). Collective on IP and Vec Input Parameters: + ip - the inner product context - x - input vector Output Parameter: . norm - the computed norm Notes: This function will usually compute the 2-norm of a vector, ||x||_2. But this behaviour may be different if using a non-standard inner product changed via IPSetMatrix(). For example, if using the B-inner product for positive definite B, (x,y)_B=y^H Bx, then the computed norm is ||x||_B = sqrt(x^H Bx). In an indefinite inner product, matrix B is indefinite and the norm is defined as s*sqrt(abs(x^H Bx)), where s = sign(x^H Bx). Level: developer .seealso: IPInnerProduct() @*/ PetscErrorCode IPNorm(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidPointer(norm,3); ierr = (*ip->ops->normbegin)(ip,x,norm);CHKERRQ(ierr); ierr = (*ip->ops->normend)(ip,x,norm);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormBegin_Bilinear" PetscErrorCode IPNormBegin_Bilinear(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscScalar p; PetscFunctionBegin; ierr = IPInnerProductBegin(ip,x,x,&p);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormBegin_Sesquilin" PetscErrorCode IPNormBegin_Sesquilin(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscScalar p; PetscFunctionBegin; if (!ip->matrix) { ierr = VecNormBegin(x,NORM_2,norm);CHKERRQ(ierr); } else { ierr = IPInnerProductBegin(ip,x,x,&p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormBegin_Indefinite" PetscErrorCode IPNormBegin_Indefinite(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscScalar p; PetscFunctionBegin; if (!ip->matrix) { ierr = VecNormBegin(x,NORM_2,norm);CHKERRQ(ierr); } else { ierr = IPInnerProductBegin(ip,x,x,&p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormBegin" /*@ IPNormBegin - Starts a split phase norm computation. Collective on IP and Vec Input Parameters: + ip - the inner product context . x - input vector - norm - where the result will go Level: developer Notes: Each call to IPNormBegin() should be paired with a call to IPNormEnd(). .seealso: IPNormEnd(), IPNorm(), IPInnerProduct(), IPMInnerProduct(), IPInnerProductBegin(), IPInnerProductEnd() @*/ PetscErrorCode IPNormBegin(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidPointer(norm,3); ierr = (*ip->ops->normbegin)(ip,x,norm);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormEnd_Bilinear" PetscErrorCode IPNormEnd_Bilinear(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscScalar p; PetscFunctionBegin; ierr = IPInnerProductEnd(ip,x,x,&p);CHKERRQ(ierr); if (PetscAbsScalar(p)PETSC_MACHINE_EPSILON) SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined"); *norm = PetscSqrtScalar(PetscRealPart(p)); #else if (p<0.0) SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined"); *norm = PetscSqrtScalar(p); #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormEnd_Sesquilin" PetscErrorCode IPNormEnd_Sesquilin(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscScalar p; PetscFunctionBegin; if (!ip->matrix) { ierr = VecNormEnd(x,NORM_2,norm);CHKERRQ(ierr); } else { ierr = IPInnerProductEnd(ip,x,x,&p);CHKERRQ(ierr); if (PetscAbsScalar(p)PETSC_MACHINE_EPSILON) SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined"); *norm = PetscSqrtScalar(PetscRealPart(p)); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormEnd_Indefinite" PetscErrorCode IPNormEnd_Indefinite(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscScalar p; PetscFunctionBegin; if (!ip->matrix) { ierr = VecNormEnd(x,NORM_2,norm);CHKERRQ(ierr); } else { ierr = IPInnerProductEnd(ip,x,x,&p);CHKERRQ(ierr); if (PetscAbsScalar(p)PETSC_SQRT_MACHINE_EPSILON) SETERRQ(PetscObjectComm((PetscObject)ip),1,"IPNorm: The inner product is not well defined"); if (PetscRealPart(p)<0.0) *norm = -PetscSqrtScalar(-PetscRealPart(p)); else *norm = PetscSqrtScalar(PetscRealPart(p)); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPNormEnd" /*@ IPNormEnd - Ends a split phase norm computation. Collective on IP and Vec Input Parameters: + ip - the inner product context - x - input vector Output Parameter: . norm - the computed norm Level: developer Notes: Each call to IPNormBegin() should be paired with a call to IPNormEnd(). .seealso: IPNormBegin(), IPNorm(), IPInnerProduct(), IPMInnerProduct(), IPInnerProductBegin(), IPInnerProductEnd() @*/ PetscErrorCode IPNormEnd(IP ip,Vec x,PetscReal *norm) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidPointer(norm,3); ierr = (*ip->ops->normend)(ip,x,norm);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProduct" /*@ IPInnerProduct - Computes the inner product of two vectors. Collective on IP and Vec Input Parameters: + ip - the inner product context . x - input vector - y - input vector Output Parameter: . p - result of the inner product Notes: This function will usually compute the standard dot product of vectors x and y, (x,y)=y^H x. However this behaviour may be different if changed via IPSetMatrix(). This allows use of other inner products such as the indefinite product y^T x for complex symmetric problems or the B-inner product for positive definite B, (x,y)_B=y^H Bx. Level: developer .seealso: IPSetMatrix(), VecDot(), IPMInnerProduct() @*/ PetscErrorCode IPInnerProduct(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidHeaderSpecific(y,VEC_CLASSID,3); PetscValidScalarPointer(p,4); ierr = PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); ip->innerproducts++; ierr = (*ip->ops->innerproductbegin)(ip,x,y,p);CHKERRQ(ierr); ierr = (*ip->ops->innerproductend)(ip,x,y,p);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProductBegin_Bilinear" PetscErrorCode IPInnerProductBegin_Bilinear(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = IPApplyMatrix_Private(ip,x);CHKERRQ(ierr); ierr = VecXDotBegin(ip->Bx,y,p);CHKERRQ(ierr); } else { ierr = VecXDotBegin(x,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProductBegin_Sesquilin" PetscErrorCode IPInnerProductBegin_Sesquilin(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = IPApplyMatrix_Private(ip,x);CHKERRQ(ierr); ierr = VecDotBegin(ip->Bx,y,p);CHKERRQ(ierr); } else { ierr = VecDotBegin(x,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProductBegin" /*@ IPInnerProductBegin - Starts a split phase inner product computation. Collective on IP and Vec Input Parameters: + ip - the inner product context . x - the first vector . y - the second vector - p - where the result will go Level: developer Notes: Each call to IPInnerProductBegin() should be paired with a call to IPInnerProductEnd(). .seealso: IPInnerProductEnd(), IPInnerProduct(), IPNorm(), IPNormBegin(), IPNormEnd(), IPMInnerProduct() @*/ PetscErrorCode IPInnerProductBegin(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidHeaderSpecific(y,VEC_CLASSID,3); PetscValidScalarPointer(p,4); ierr = PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); ip->innerproducts++; ierr = (*ip->ops->innerproductbegin)(ip,x,y,p);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProductEnd_Bilinear" PetscErrorCode IPInnerProductEnd_Bilinear(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = VecXDotEnd(ip->Bx,y,p);CHKERRQ(ierr); } else { ierr = VecXDotEnd(x,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProductEnd_Sesquilin" PetscErrorCode IPInnerProductEnd_Sesquilin(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = VecDotEnd(ip->Bx,y,p);CHKERRQ(ierr); } else { ierr = VecDotEnd(x,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPInnerProductEnd" /*@ IPInnerProductEnd - Ends a split phase inner product computation. Collective on IP and Vec Input Parameters: + ip - the inner product context . x - the first vector - y - the second vector Output Parameter: . p - result of the inner product Level: developer Notes: Each call to IPInnerProductBegin() should be paired with a call to IPInnerProductEnd(). .seealso: IPInnerProductBegin(), IPInnerProduct(), IPNorm(), IPNormBegin(), IPNormEnd(), IPMInnerProduct() @*/ PetscErrorCode IPInnerProductEnd(IP ip,Vec x,Vec y,PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidHeaderSpecific(y,VEC_CLASSID,3); PetscValidScalarPointer(p,4); ierr = PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); ierr = (*ip->ops->innerproductend)(ip,x,y,p);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProduct" /*@ IPMInnerProduct - Computes the inner products a vector x with a set of vectors (columns of Y). Collective on IP and Vec Input Parameters: + ip - the inner product context . x - the first input vector . n - number of vectors in y - y - array of vectors Output Parameter: . p - result of the inner products Notes: This function will usually compute the standard dot product of x and y_i, (x,y_i)=y_i^H x, for each column of Y. However this behaviour may be different if changed via IPSetMatrix(). This allows use of other inner products such as the indefinite product y_i^T x for complex symmetric problems or the B-inner product for positive definite B, (x,y_i)_B=y_i^H Bx. Level: developer .seealso: IPSetMatrix(), VecMDot(), IPInnerProduct() @*/ PetscErrorCode IPMInnerProduct(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,3); PetscValidPointer(y,4); PetscValidHeaderSpecific(*y,VEC_CLASSID,4); PetscValidScalarPointer(p,5); ierr = PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); ip->innerproducts += n; ierr = (*ip->ops->minnerproductbegin)(ip,x,n,y,p);CHKERRQ(ierr); ierr = (*ip->ops->minnerproductend)(ip,x,n,y,p);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProductBegin_Bilinear" PetscErrorCode IPMInnerProductBegin_Bilinear(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = IPApplyMatrix_Private(ip,x);CHKERRQ(ierr); ierr = VecMXDotBegin(ip->Bx,n,y,p);CHKERRQ(ierr); } else { ierr = VecMXDotBegin(x,n,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProductBegin_Sesquilin" PetscErrorCode IPMInnerProductBegin_Sesquilin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = IPApplyMatrix_Private(ip,x);CHKERRQ(ierr); ierr = VecMDotBegin(ip->Bx,n,y,p);CHKERRQ(ierr); } else { ierr = VecMDotBegin(x,n,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProductBegin" /*@ IPMInnerProductBegin - Starts a split phase multiple inner product computation. Collective on IP and Vec Input Parameters: + ip - the inner product context . x - the first input vector . n - number of vectors in y . y - array of vectors - p - where the result will go Level: developer Notes: Each call to IPMInnerProductBegin() should be paired with a call to IPMInnerProductEnd(). .seealso: IPMInnerProductEnd(), IPMInnerProduct(), IPNorm(), IPNormBegin(), IPNormEnd(), IPInnerProduct() @*/ PetscErrorCode IPMInnerProductBegin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,3); if (n == 0) PetscFunctionReturn(0); PetscValidPointer(y,4); PetscValidHeaderSpecific(*y,VEC_CLASSID,4); PetscValidScalarPointer(p,5); ierr = PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); ip->innerproducts += n; ierr = (*ip->ops->minnerproductbegin)(ip,x,n,y,p);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProductEnd_Bilinear" PetscErrorCode IPMInnerProductEnd_Bilinear(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = VecMXDotEnd(ip->Bx,n,y,p);CHKERRQ(ierr); } else { ierr = VecMXDotEnd(x,n,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProductEnd_Sesquilin" PetscErrorCode IPMInnerProductEnd_Sesquilin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; if (ip->matrix) { ierr = VecMDotEnd(ip->Bx,n,y,p);CHKERRQ(ierr); } else { ierr = VecMDotEnd(x,n,y,p);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPMInnerProductEnd" /*@ IPMInnerProductEnd - Ends a split phase multiple inner product computation. Collective on IP and Vec Input Parameters: + ip - the inner product context . x - the first input vector . n - number of vectors in y - y - array of vectors Output Parameter: . p - result of the inner products Level: developer Notes: Each call to IPMInnerProductBegin() should be paired with a call to IPMInnerProductEnd(). .seealso: IPMInnerProductBegin(), IPMInnerProduct(), IPNorm(), IPNormBegin(), IPNormEnd(), IPInnerProduct() @*/ PetscErrorCode IPMInnerProductEnd(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,3); if (n == 0) PetscFunctionReturn(0); PetscValidPointer(y,4); PetscValidHeaderSpecific(*y,VEC_CLASSID,4); PetscValidScalarPointer(p,5); ierr = PetscLogEventBegin(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); ierr = (*ip->ops->minnerproductend)(ip,x,n,y,p);CHKERRQ(ierr); ierr = PetscLogEventEnd(IP_InnerProduct,ip,x,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "IPCreate_Bilinear" PETSC_EXTERN PetscErrorCode IPCreate_Bilinear(IP ip) { PetscFunctionBegin; ip->ops->normbegin = IPNormBegin_Bilinear; ip->ops->normend = IPNormEnd_Bilinear; ip->ops->innerproductbegin = IPInnerProductBegin_Bilinear; ip->ops->innerproductend = IPInnerProductEnd_Bilinear; ip->ops->minnerproductbegin = IPMInnerProductBegin_Bilinear; ip->ops->minnerproductend = IPMInnerProductEnd_Bilinear; PetscFunctionReturn(0); } #if defined(PETSC_USE_COMPLEX) #undef __FUNCT__ #define __FUNCT__ "IPCreate_Sesquilin" PETSC_EXTERN PetscErrorCode IPCreate_Sesquilin(IP ip) { PetscFunctionBegin; ip->ops->normbegin = IPNormBegin_Sesquilin; ip->ops->normend = IPNormEnd_Sesquilin; ip->ops->innerproductbegin = IPInnerProductBegin_Sesquilin; ip->ops->innerproductend = IPInnerProductEnd_Sesquilin; ip->ops->minnerproductbegin = IPMInnerProductBegin_Sesquilin; ip->ops->minnerproductend = IPMInnerProductEnd_Sesquilin; PetscFunctionReturn(0); } #endif #undef __FUNCT__ #define __FUNCT__ "IPCreate_Indefinite" PETSC_EXTERN PetscErrorCode IPCreate_Indefinite(IP ip) { PetscFunctionBegin; ip->ops->normbegin = IPNormBegin_Indefinite; ip->ops->normend = IPNormEnd_Indefinite; #if defined(PETSC_USE_COMPLEX) ip->ops->innerproductbegin = IPInnerProductBegin_Sesquilin; ip->ops->innerproductend = IPInnerProductEnd_Sesquilin; ip->ops->minnerproductbegin = IPMInnerProductBegin_Sesquilin; ip->ops->minnerproductend = IPMInnerProductEnd_Sesquilin; #else ip->ops->innerproductbegin = IPInnerProductBegin_Bilinear; ip->ops->innerproductend = IPInnerProductEnd_Bilinear; ip->ops->minnerproductbegin = IPMInnerProductBegin_Bilinear; ip->ops->minnerproductend = IPMInnerProductEnd_Bilinear; #endif PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ip/ipbiorthog.c0000644000175000017500000003045712211062077017155 0ustar gladkgladk/* Routines related to bi-orthogonalization. See the SLEPc Technical Report STR-1 for a detailed explanation. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcip.h" I*/ #include /* Biorthogonalization routine using classical Gram-Schmidt with refinement. */ #undef __FUNCT__ #define __FUNCT__ "IPCGSBiOrthogonalization" static PetscErrorCode IPCGSBiOrthogonalization(IP ip,PetscInt n_,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *hnorm,PetscReal *norm) { #if defined(SLEPC_MISSING_LAPACK_GELQF) || defined(SLEPC_MISSING_LAPACK_ORMLQ) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GELQF/ORMLQ - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscBLASInt j,ione=1,lwork,info,n=n_; PetscScalar shh[100],*lhh,*vw,*tau,one=1.0,*work; PetscFunctionBegin; /* Don't allocate small arrays */ if (n<=100) lhh = shh; else { ierr = PetscMalloc(n*sizeof(PetscScalar),&lhh);CHKERRQ(ierr); } ierr = PetscMalloc(n*n*sizeof(PetscScalar),&vw);CHKERRQ(ierr); for (j=0;j100) { ierr = PetscFree(lhh);CHKERRQ(ierr); } ierr = PetscFree(vw);CHKERRQ(ierr); ierr = PetscFree(tau);CHKERRQ(ierr); ierr = PetscFree(work);CHKERRQ(ierr); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "IPBiOrthogonalize" /*@ IPBiOrthogonalize - Bi-orthogonalize a vector with respect to a set of vectors. Collective on IP and Vec Input Parameters: + ip - the inner product context . n - number of columns of V . V - set of vectors - W - set of vectors Input/Output Parameter: . v - vector to be orthogonalized Output Parameter: + H - coefficients computed during orthogonalization - norm - norm of the vector after being orthogonalized Notes: This function applies an oblique projector to project vector v onto the span of the columns of V along the orthogonal complement of the column space of W. On exit, v0 = [V v]*H, where v0 is the original vector v. This routine does not normalize the resulting vector. Level: developer .seealso: IPSetOrthogonalization(), IPOrthogonalize() @*/ PetscErrorCode IPBiOrthogonalize(IP ip,PetscInt n,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *norm) { PetscErrorCode ierr; PetscScalar lh[100],*h; PetscBool allocated = PETSC_FALSE; PetscReal lhnrm,*hnrm,lnrm,*nrm; PetscFunctionBegin; PetscValidHeaderSpecific(ip,IP_CLASSID,1); PetscValidLogicalCollectiveInt(ip,n,2); if (!n) { if (norm) { ierr = IPNorm(ip,v,norm);CHKERRQ(ierr); } } else { ierr = PetscLogEventBegin(IP_Orthogonalize,ip,0,0,0);CHKERRQ(ierr); /* allocate H if needed */ if (!H) { if (n<=100) h = lh; else { ierr = PetscMalloc(n*sizeof(PetscScalar),&h);CHKERRQ(ierr); allocated = PETSC_TRUE; } } else h = H; /* retrieve hnrm and nrm for linear dependence check or conditional refinement */ if (ip->orthog_ref == IP_ORTHOG_REFINE_IFNEEDED) { hnrm = &lhnrm; if (norm) nrm = norm; else nrm = &lnrm; } else { hnrm = NULL; nrm = norm; } switch (ip->orthog_type) { case IP_ORTHOG_CGS: ierr = IPCGSBiOrthogonalization(ip,n,V,W,v,h,hnrm,nrm);CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type"); } if (allocated) { ierr = PetscFree(h);CHKERRQ(ierr); } ierr = PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);CHKERRQ(ierr); } PetscFunctionReturn(0); } /* IPPseudoOrthogonalizeCGS1 - Compute |v'| (estimated), |v| and one step of CGS with only one global synchronization (indefinite) */ #undef __FUNCT__ #define __FUNCT__ "IPPseudoOrthogonalizeCGS1" PetscErrorCode IPPseudoOrthogonalizeCGS1(IP ip,PetscInt n,Vec *V,PetscReal* omega,Vec v,PetscScalar *H,PetscReal *onorm,PetscReal *norm) { PetscErrorCode ierr; PetscInt j; PetscScalar alpha; PetscReal sum; PetscFunctionBegin; /* h = W^* v ; alpha = (v , v) */ if (!onorm && !norm) { /* use simpler function */ ierr = IPMInnerProduct(ip,v,n,V,H);CHKERRQ(ierr); } else { /* merge comunications */ ierr = IPMInnerProductBegin(ip,v,n,V,H);CHKERRQ(ierr); if (onorm || (norm && !ip->matrix)) { ierr = IPInnerProductBegin(ip,v,v,&alpha);CHKERRQ(ierr); } ierr = IPMInnerProductEnd(ip,v,n,V,H);CHKERRQ(ierr); if (onorm || (norm && !ip->matrix)) { ierr = IPInnerProductEnd(ip,v,v,&alpha);CHKERRQ(ierr); } } /* q = v - V h */ for (j=0;j0.0) *onorm = PetscSqrtReal(PetscRealPart(alpha)); else *onorm = -PetscSqrtReal(-PetscRealPart(alpha)); } if (norm) { if (!ip->matrix) { /* estimate |v'| from |v| */ sum = 0.0; for (j=0; jorthog_ref != IP_ORTHOG_REFINE_NEVER) sz += n; if (sz>ip->lwork) { ierr = PetscFree(ip->work);CHKERRQ(ierr); ierr = PetscMalloc(sz*sizeof(PetscScalar),&ip->work);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ip,(sz-ip->lwork)*sizeof(PetscScalar));CHKERRQ(ierr); ip->lwork = sz; } if (!H) h = ip->work; else h = H; if (ip->orthog_ref != IP_ORTHOG_REFINE_NEVER) c = ip->work + sz1; /* orthogonalize and compute onorm */ switch (ip->orthog_ref) { case IP_ORTHOG_REFINE_NEVER: ierr = IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,h,NULL,NULL);CHKERRQ(ierr); /* compute |v| */ if (norm) { ierr = IPNorm(ip,v,norm);CHKERRQ(ierr); } /* linear dependence check does not work without refinement */ if (lindep) *lindep = PETSC_FALSE; break; case IP_ORTHOG_REFINE_ALWAYS: ierr = IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,h,NULL,NULL);CHKERRQ(ierr); if (lindep) { ierr = IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,&onrm,&nrm);CHKERRQ(ierr); if (norm) *norm = nrm; if (PetscAbs(nrm) < ip->orthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } else { ierr = IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,NULL,norm);CHKERRQ(ierr); } for (j=0;jorthog_eta * PetscAbs(onrm)) { k++; if (!ip->matrix) { ierr = IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,&onrm,&nrm);CHKERRQ(ierr); } else { onrm = nrm; ierr = IPPseudoOrthogonalizeCGS1(ip,n,V,omega,v,c,NULL,&nrm);CHKERRQ(ierr); } for (j=0;jorthog_eta * PetscAbs(onrm)) *lindep = PETSC_TRUE; else *lindep = PETSC_FALSE; } break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization refinement"); } /* recover H from workspace */ if (H) { for (j=0;jorthog_type) { case IP_ORTHOG_CGS: ierr = IPPseudoOrthogonalizeCGS(ip,n,V,omega,v,H,norm,lindep);CHKERRQ(ierr); break; case IP_ORTHOG_MGS: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_SUP,"Modified Gram-Schmidt not implemented for indefinite case"); break; default: SETERRQ(PetscObjectComm((PetscObject)ip),PETSC_ERR_ARG_WRONG,"Unknown orthogonalization type"); } } ierr = PetscLogEventEnd(IP_Orthogonalize,ip,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/0000755000175000017500000000000012214143515016367 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ip/ftn-auto/ipdotf.c0000644000175000017500000000763412211062077020032 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* ipdot.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcip.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipnorm_ IPNORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipnorm_ ipnorm #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipnormbegin_ IPNORMBEGIN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipnormbegin_ ipnormbegin #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipnormend_ IPNORMEND #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipnormend_ ipnormend #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipinnerproduct_ IPINNERPRODUCT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipinnerproduct_ ipinnerproduct #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipinnerproductbegin_ IPINNERPRODUCTBEGIN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipinnerproductbegin_ ipinnerproductbegin #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipinnerproductend_ IPINNERPRODUCTEND #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipinnerproductend_ ipinnerproductend #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipminnerproduct_ IPMINNERPRODUCT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipminnerproduct_ ipminnerproduct #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipminnerproductbegin_ IPMINNERPRODUCTBEGIN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipminnerproductbegin_ ipminnerproductbegin #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipminnerproductend_ IPMINNERPRODUCTEND #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipminnerproductend_ ipminnerproductend #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL ipnorm_(IP *ip,Vec x,PetscReal *norm, int *__ierr ){ *__ierr = IPNorm(*ip, (Vec)PetscToPointer((x) ),norm); } void PETSC_STDCALL ipnormbegin_(IP *ip,Vec x,PetscReal *norm, int *__ierr ){ *__ierr = IPNormBegin(*ip, (Vec)PetscToPointer((x) ),norm); } void PETSC_STDCALL ipnormend_(IP *ip,Vec x,PetscReal *norm, int *__ierr ){ *__ierr = IPNormEnd(*ip, (Vec)PetscToPointer((x) ),norm); } void PETSC_STDCALL ipinnerproduct_(IP *ip,Vec x,Vec y,PetscScalar *p, int *__ierr ){ *__ierr = IPInnerProduct(*ip, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) ),p); } void PETSC_STDCALL ipinnerproductbegin_(IP *ip,Vec x,Vec y,PetscScalar *p, int *__ierr ){ *__ierr = IPInnerProductBegin(*ip, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) ),p); } void PETSC_STDCALL ipinnerproductend_(IP *ip,Vec x,Vec y,PetscScalar *p, int *__ierr ){ *__ierr = IPInnerProductEnd(*ip, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) ),p); } void PETSC_STDCALL ipminnerproduct_(IP *ip,Vec x,PetscInt *n, Vec y[],PetscScalar *p, int *__ierr ){ *__ierr = IPMInnerProduct(*ip, (Vec)PetscToPointer((x) ),*n,y,p); } void PETSC_STDCALL ipminnerproductbegin_(IP *ip,Vec x,PetscInt *n, Vec y[],PetscScalar *p, int *__ierr ){ *__ierr = IPMInnerProductBegin(*ip, (Vec)PetscToPointer((x) ),*n,y,p); } void PETSC_STDCALL ipminnerproductend_(IP *ip,Vec x,PetscInt *n, Vec y[],PetscScalar *p, int *__ierr ){ *__ierr = IPMInnerProductEnd(*ip, (Vec)PetscToPointer((x) ),*n,y,p); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/iporthogf.c0000644000175000017500000000304212211062077020533 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* iporthog.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcip.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define iporthogonalize_ IPORTHOGONALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define iporthogonalize_ iporthogonalize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipqrdecomposition_ IPQRDECOMPOSITION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipqrdecomposition_ ipqrdecomposition #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL iporthogonalize_(IP *ip,PetscInt *nds,Vec *defl,PetscInt *n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep, int *__ierr ){ *__ierr = IPOrthogonalize(*ip,*nds,defl,*n,which,V, (Vec)PetscToPointer((v) ),H,norm,lindep); } void PETSC_STDCALL ipqrdecomposition_(IP *ip,Vec *V,PetscInt *m,PetscInt *n,PetscScalar *R,PetscInt *ldr, int *__ierr ){ *__ierr = IPQRDecomposition(*ip,V,*m,*n,R,*ldr); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/makefile0000644000175000017500000000042112211062077020064 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = ipbasicf.c ipbiorthogf.c ipborthogf.c ipdotf.c ipformf.c iporthogf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/ip/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/ipborthogf.c0000644000175000017500000000243512211062077020702 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* ipborthog.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcip.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipborthogonalize_ IPBORTHOGONALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipborthogonalize_ ipborthogonalize #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL ipborthogonalize_(IP *ip,PetscInt *nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt *n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *norm,PetscBool *lindep, int *__ierr ){ *__ierr = IPBOrthogonalize(*ip,*nds,defl,BDS,BDSnorms,*n,which,V,BV,BVnorms, (Vec)PetscToPointer((v) ), (Vec)PetscToPointer((Bv) ),H,norm,lindep); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/ipbasicf.c0000644000175000017500000000452712211062077020323 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* ipbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcip.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipsetfromoptions_ IPSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipsetfromoptions_ ipsetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipsetorthogonalization_ IPSETORTHOGONALIZATION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipsetorthogonalization_ ipsetorthogonalization #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipreset_ IPRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipreset_ ipreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipgetoperationcounters_ IPGETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipgetoperationcounters_ ipgetoperationcounters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipresetoperationcounters_ IPRESETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipresetoperationcounters_ ipresetoperationcounters #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL ipsetfromoptions_(IP *ip, int *__ierr ){ *__ierr = IPSetFromOptions(*ip); } void PETSC_STDCALL ipsetorthogonalization_(IP *ip,IPOrthogType *type,IPOrthogRefineType *refine,PetscReal *eta, int *__ierr ){ *__ierr = IPSetOrthogonalization(*ip,*type,*refine,*eta); } void PETSC_STDCALL ipreset_(IP *ip, int *__ierr ){ *__ierr = IPReset(*ip); } void PETSC_STDCALL ipgetoperationcounters_(IP *ip,PetscInt *dots, int *__ierr ){ *__ierr = IPGetOperationCounters(*ip,dots); } void PETSC_STDCALL ipresetoperationcounters_(IP *ip, int *__ierr ){ *__ierr = IPResetOperationCounters(*ip); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/ipformf.c0000644000175000017500000000253512211062077020202 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* ipform.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcip.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipsetmatrix_ IPSETMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipsetmatrix_ ipsetmatrix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipapplymatrix_ IPAPPLYMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipapplymatrix_ ipapplymatrix #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL ipsetmatrix_(IP *ip,Mat mat, int *__ierr ){ *__ierr = IPSetMatrix(*ip, (Mat)PetscToPointer((mat) )); } void PETSC_STDCALL ipapplymatrix_(IP *ip,Vec x,Vec y, int *__ierr ){ *__ierr = IPApplyMatrix(*ip, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) )); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ip/ftn-auto/ipbiorthogf.c0000644000175000017500000000310412211062077021045 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* ipbiorthog.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcip.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define ipbiorthogonalize_ IPBIORTHOGONALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ipbiorthogonalize_ ipbiorthogonalize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define ippseudoorthogonalize_ IPPSEUDOORTHOGONALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define ippseudoorthogonalize_ ippseudoorthogonalize #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL ipbiorthogonalize_(IP *ip,PetscInt *n,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *norm, int *__ierr ){ *__ierr = IPBiOrthogonalize(*ip,*n,V,W, (Vec)PetscToPointer((v) ),H,norm); } void PETSC_STDCALL ippseudoorthogonalize_(IP *ip,PetscInt *n,Vec *V,PetscReal *omega,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep, int *__ierr ){ *__ierr = IPPseudoOrthogonalize(*ip,*n,V,omega, (Vec)PetscToPointer((v) ),H,norm,lindep); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/sys/0000755000175000017500000000000012214143515015040 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/sys/slepcinit.c.html0000644000175000017500000005512212211062077020146 0ustar gladkgladk
Actual source code: slepcinit.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/slepcimpl.h>           /*I "slepcsys.h" I*/
 23: #include <slepc-private/epsimpl.h>
 24: #include <slepc-private/stimpl.h>
 25: #include <slepc-private/svdimpl.h>
 26: #include <slepc-private/qepimpl.h>
 27: #include <slepc-private/nepimpl.h>
 28: #include <slepc-private/mfnimpl.h>
 29: #include <slepc-private/ipimpl.h>
 30: #include <slepc-private/dsimpl.h>
 31: #include <slepc-private/fnimpl.h>
 32: #include <slepc-private/vecimplslepc.h>
 33: #include <stdlib.h>

 37: /*@C
 38:     SlepcGetVersion - Gets the SLEPc version information in a string.

 40:     Input Parameter:
 41: .   len - length of the string

 43:     Output Parameter:
 44: .   version - version string

 46:     Fortran Note:
 47:     This routine is not supported in Fortran.

 49:     Level: developer
 50: @*/
 51: PetscErrorCode SlepcGetVersion(char version[],size_t len)
 52: {

 56: #if (SLEPC_VERSION_RELEASE == 1)
 57:   PetscSNPrintf(version,len,"SLEPc Release Version %d.%d.%d, %s",SLEPC_VERSION_MAJOR,SLEPC_VERSION_MINOR,SLEPC_VERSION_SUBMINOR,SLEPC_VERSION_DATE);
 58: #else
 59:   PetscSNPrintf(version,len,"SLEPc Development GIT revision: %d  GIT Date: %s",SLEPC_VERSION_GIT,SLEPC_VERSION_DATE_GIT);
 60: #endif
 61:   return(0);
 62: }

 66: /*
 67:    SlepcPrintVersion - Prints SLEPc version info.

 69:    Collective on MPI_Comm
 70: */
 71: PetscErrorCode SlepcPrintVersion(MPI_Comm comm)
 72: {
 74:   char           version[256];

 77:   SlepcGetVersion(version,256);
 78:   (*PetscHelpPrintf)(comm,"--------------------------------------------------------------------------\n");
 79:   (*PetscHelpPrintf)(comm,"%s\n",version);
 80:   (*PetscHelpPrintf)(comm,SLEPC_AUTHOR_INFO);
 81:   (*PetscHelpPrintf)(comm,"See docs/manual.html for help.\n");
 82:   (*PetscHelpPrintf)(comm,"SLEPc libraries linked from %s\n",SLEPC_LIB_DIR);
 83:   return(0);
 84: }

 88: /*
 89:    SlepcPrintHelpIntro - Prints introductory SLEPc help info.

 91:    Collective on MPI_Comm
 92: */
 93: PetscErrorCode SlepcPrintHelpIntro(MPI_Comm comm)
 94: {
 95:   PetscErrorCode  ierr;

 98:   (*PetscHelpPrintf)(comm,"SLEPc help information includes that for the PETSc libraries, which provide\n");
 99:   (*PetscHelpPrintf)(comm,"low-level system infrastructure and linear algebra tools.\n");
100:   (*PetscHelpPrintf)(comm,"--------------------------------------------------------------------------\n");
101:   return(0);
102: }

104: /* ------------------------Nasty global variables -------------------------------*/
105: /*
106:    Indicates whether SLEPc started PETSc, or whether it was
107:    already started before SLEPc was initialized.
108: */
109: PetscBool SlepcBeganPetsc = PETSC_FALSE;
110: PetscBool SlepcInitializeCalled = PETSC_FALSE;

112: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)

116: /*
117:     SlepcInitialize_DynamicLibraries - Adds the default dynamic link libraries to the
118:     search path.
119: */
120: PetscErrorCode SlepcInitialize_DynamicLibraries(void)
121: {
123:   PetscBool      found;
124:   char           libs[PETSC_MAX_PATH_LEN],dlib[PETSC_MAX_PATH_LEN];

127:   PetscStrcpy(libs,SLEPC_LIB_DIR);
128:   PetscStrcat(libs,"/libslepc");
129:   PetscDLLibraryRetrieve(PETSC_COMM_WORLD,libs,dlib,1024,&found);
130:   if (found) {
131:     PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,libs);
132:   } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc dynamic library\nYou cannot move the dynamic libraries");
133:   return(0);
134: }
135: #endif

139: /*
140:     SlepcInitialize_LogEvents - Initialize log events not pertaining to any object class.
141: */
142: PetscErrorCode SlepcInitialize_LogEvents(void)
143: {

147:   PetscLogEventRegister("UpdateVectors",0,&SLEPC_UpdateVectors);
148:   PetscLogEventRegister("VecMAXPBY",0,&SLEPC_VecMAXPBY);
149:   PetscLogEventRegister("DenseMatProd",EPS_CLASSID,&SLEPC_SlepcDenseMatProd);
150:   PetscLogEventRegister("DenseMatNorm",EPS_CLASSID,&SLEPC_SlepcDenseNorm);
151:   PetscLogEventRegister("DenseCopy",EPS_CLASSID,&SLEPC_SlepcDenseCopy);
152:   PetscLogEventRegister("VecsMult",EPS_CLASSID,&SLEPC_VecsMult);
153:   return(0);
154: }

158: /*@C
159:    SlepcInitialize - Initializes the SLEPc library. SlepcInitialize() calls
160:    PetscInitialize() if that has not been called yet, so this routine should
161:    always be called near the beginning of your program.

163:    Collective on MPI_COMM_WORLD or PETSC_COMM_WORLD if it has been set

165:    Input Parameters:
166: +  argc - count of number of command line arguments
167: .  args - the command line arguments
168: .  file - [optional] PETSc database file, defaults to ~username/.petscrc
169:           (use NULL for default)
170: -  help - [optional] Help message to print, use NULL for no message

172:    Fortran Note:
173:    Fortran syntax is very similar to that of PetscInitialize()

175:    Level: beginner

177: .seealso: SlepcFinalize(), PetscInitialize()
178: @*/
179: PetscErrorCode SlepcInitialize(int *argc,char ***args,const char file[],const char help[])
180: {
182:   PetscBool      flg;

185:   if (SlepcInitializeCalled) return(0);
186:   PetscSetHelpVersionFunctions(SlepcPrintHelpIntro,SlepcPrintVersion);
187:   PetscInitialized(&flg);
188:   if (!flg) {
189:     PetscInitialize(argc,args,file,help);
190:     SlepcBeganPetsc = PETSC_TRUE;
191:   }

193: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
194:   SlepcInitialize_DynamicLibraries();
195: #endif
196:   SlepcInitialize_LogEvents();

198: #if defined(PETSC_HAVE_DRAND48)
199:   /* work-around for Cygwin drand48() initialization bug */
200:   srand48(0);
201: #endif

203:   SlepcInitializeCalled = PETSC_TRUE;
204:   PetscInfo(0,"SLEPc successfully started\n");
205:   return(0);
206: }

210: /*@
211:    SlepcFinalize - Checks for options to be called at the conclusion
212:    of the SLEPc program and calls PetscFinalize().

214:    Collective on PETSC_COMM_WORLD

216:    Level: beginner

218: .seealso: SlepcInitialize(), PetscFinalize()
219: @*/
220: PetscErrorCode SlepcFinalize(void)
221: {

225:   PetscInfo(0,"SlepcFinalize() called\n");
226:   if (SlepcBeganPetsc) {
227:     PetscFinalize();
228:   }
229:   SlepcInitializeCalled = PETSC_FALSE;
230:   return(0);
231: }

235: /*@C
236:    SlepcInitializeNoArguments - Calls SlepcInitialize() from C/C++ without
237:    the command line arguments.

239:    Collective

241:    Level: advanced

243: .seealso: SlepcInitialize(), SlepcInitializeFortran()
244: @*/
245: PetscErrorCode SlepcInitializeNoArguments(void)
246: {
248:   int            argc = 0;
249:   char           **args = 0;

252:   SlepcInitialize(&argc,&args,NULL,NULL);
253:   PetscFunctionReturn(ierr);
254: }

258: /*@
259:    SlepcInitialized - Determine whether SLEPc is initialized.

261:    Level: beginner

263: .seealso: SlepcInitialize(), SlepcInitializeFortran()
264: @*/
265: PetscErrorCode SlepcInitialized(PetscBool *isInitialized)
266: {
269:   *isInitialized = SlepcInitializeCalled;
270:   return(0);
271: }

273: PETSC_EXTERN PetscBool PetscBeganMPI;

277: /*
278:    SlepcInitializeNoPointers - Calls SlepcInitialize() from C/C++ without the pointers
279:    to argc and args (analogue to PetscInitializeNoPointers).

281:    Collective

283:    Level: advanced

285: .seealso: SlepcInitialize()
286: */
287: PetscErrorCode SlepcInitializeNoPointers(int argc,char **args,const char *filename,const char *help)
288: {
290:   int            myargc = argc;
291:   char           **myargs = args;

294:   SlepcInitialize(&myargc,&myargs,filename,help);
295:   PetscPopSignalHandler();
296:   PetscBeganMPI = PETSC_FALSE;
297:   PetscFunctionReturn(ierr);
298: }

300: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)

304: /*
305:   PetscDLLibraryRegister - This function is called when the dynamic library
306:   it is in is opened.

308:   This one registers all the EPS and ST methods in the libslepc.a
309:   library.

311:   Input Parameter:
312:   path - library path
313:  */
314: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepc(char *path)
315: {

319:   EPSInitializePackage();
320:   SVDInitializePackage();
321:   QEPInitializePackage();
322:   NEPInitializePackage();
323:   MFNInitializePackage();
324:   STInitializePackage();
325:   IPInitializePackage();
326:   DSInitializePackage();
327:   FNInitializePackage();
328:   return(0);
329: }
330: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */

slepc-3.4.2.dfsg.orig/src/sys/slepcutil.c.html0000644000175000017500000014657212211062077020172 0ustar gladkgladk
Actual source code: slepcutil.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/slepcimpl.h>            /*I "slepcsys.h" I*/
 23: #include <petsc-private/matimpl.h>

 27: /*@C
 28:    SlepcMatConvertSeqDense - Converts a parallel matrix to another one in sequential
 29:    dense format replicating the values in every processor.

 31:    Collective on Mat

 33:    Input parameters:
 34: +  A  - the source matrix
 35: -  B  - the target matrix

 37:    Level: developer
 38: @*/
 39: PetscErrorCode SlepcMatConvertSeqDense(Mat mat,Mat *newmat)
 40: {
 42:   PetscInt       m,n;
 43:   PetscMPIInt    size;
 44:   Mat            *M;
 45:   IS             isrow,iscol;

 50:   MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);
 51:   if (size > 1) {
 52:     if (!mat->ops->getsubmatrices) SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Mat type %s",((PetscObject)mat)->type_name);

 54:     /* assemble full matrix on every processor */
 55:     MatGetSize(mat,&m,&n);
 56:     ISCreateStride(PETSC_COMM_SELF,m,0,1,&isrow);
 57:     ISCreateStride(PETSC_COMM_SELF,n,0,1,&iscol);
 58:     MatGetSubMatrices(mat,1,&isrow,&iscol,MAT_INITIAL_MATRIX,&M);
 59:     ISDestroy(&isrow);
 60:     ISDestroy(&iscol);

 62:     /* Fake support for "inplace" convert */
 63:     if (*newmat == mat) {
 64:       MatDestroy(&mat);
 65:     }

 67:     /* convert matrix to MatSeqDense */
 68:     MatConvert(*M,MATSEQDENSE,MAT_INITIAL_MATRIX,newmat);
 69:     MatDestroyMatrices(1,&M);
 70:   } else {
 71:     /* convert matrix to MatSeqDense */
 72:     MatConvert(mat,MATSEQDENSE,MAT_INITIAL_MATRIX,newmat);
 73:   }
 74:   return(0);
 75: }

 79: static PetscErrorCode SlepcMatTile_SeqAIJ(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat G)
 80: {
 81:   PetscErrorCode    ierr;
 82:   PetscInt          i,j,M1,M2,N1,N2,*nnz,ncols,*scols;
 83:   PetscScalar       *svals,*buf;
 84:   const PetscInt    *cols;
 85:   const PetscScalar *vals;

 88:   MatGetSize(A,&M1,&N1);
 89:   MatGetSize(D,&M2,&N2);

 91:   PetscMalloc((M1+M2)*sizeof(PetscInt),&nnz);
 92:   PetscMemzero(nnz,(M1+M2)*sizeof(PetscInt));
 93:   /* Preallocate for A */
 94:   if (a!=0.0) {
 95:     for (i=0;i<M1;i++) {
 96:       MatGetRow(A,i,&ncols,NULL,NULL);
 97:       nnz[i] += ncols;
 98:       MatRestoreRow(A,i,&ncols,NULL,NULL);
 99:     }
100:   }
101:   /* Preallocate for B */
102:   if (b!=0.0) {
103:     for (i=0;i<M1;i++) {
104:       MatGetRow(B,i,&ncols,NULL,NULL);
105:       nnz[i] += ncols;
106:       MatRestoreRow(B,i,&ncols,NULL,NULL);
107:     }
108:   }
109:   /* Preallocate for C */
110:   if (c!=0.0) {
111:     for (i=0;i<M2;i++) {
112:       MatGetRow(C,i,&ncols,NULL,NULL);
113:       nnz[i+M1] += ncols;
114:       MatRestoreRow(C,i,&ncols,NULL,NULL);
115:     }
116:   }
117:   /* Preallocate for D */
118:   if (d!=0.0) {
119:     for (i=0;i<M2;i++) {
120:       MatGetRow(D,i,&ncols,NULL,NULL);
121:       nnz[i+M1] += ncols;
122:       MatRestoreRow(D,i,&ncols,NULL,NULL);
123:     }
124:   }
125:   MatSeqAIJSetPreallocation(G,0,nnz);
126:   PetscFree(nnz);

128:   PetscMalloc(sizeof(PetscScalar)*PetscMax(N1,N2),&buf);
129:   PetscMalloc(sizeof(PetscInt)*PetscMax(N1,N2),&scols);
130:   /* Transfer A */
131:   if (a!=0.0) {
132:     for (i=0;i<M1;i++) {
133:       MatGetRow(A,i,&ncols,&cols,&vals);
134:       if (a!=1.0) {
135:         svals=buf;
136:         for (j=0;j<ncols;j++) svals[j] = vals[j]*a;
137:       } else svals=(PetscScalar*)vals;
138:       MatSetValues(G,1,&i,ncols,cols,svals,INSERT_VALUES);
139:       MatRestoreRow(A,i,&ncols,&cols,&vals);
140:     }
141:   }
142:   /* Transfer B */
143:   if (b!=0.0) {
144:     for (i=0;i<M1;i++) {
145:       MatGetRow(B,i,&ncols,&cols,&vals);
146:       if (b!=1.0) {
147:         svals=buf;
148:         for (j=0;j<ncols;j++) svals[j] = vals[j]*b;
149:       } else svals=(PetscScalar*)vals;
150:       for (j=0;j<ncols;j++) scols[j] = cols[j]+N1;
151:       MatSetValues(G,1,&i,ncols,scols,svals,INSERT_VALUES);
152:       MatRestoreRow(B,i,&ncols,&cols,&vals);
153:     }
154:   }
155:   /* Transfer C */
156:   if (c!=0.0) {
157:     for (i=0;i<M2;i++) {
158:       MatGetRow(C,i,&ncols,&cols,&vals);
159:       if (c!=1.0) {
160:         svals=buf;
161:         for (j=0;j<ncols;j++) svals[j] = vals[j]*c;
162:       } else svals=(PetscScalar*)vals;
163:       j = i+M1;
164:       MatSetValues(G,1,&j,ncols,cols,svals,INSERT_VALUES);
165:       MatRestoreRow(C,i,&ncols,&cols,&vals);
166:     }
167:   }
168:   /* Transfer D */
169:   if (d!=0.0) {
170:     for (i=0;i<M2;i++) {
171:       MatGetRow(D,i,&ncols,&cols,&vals);
172:       if (d!=1.0) {
173:         svals=buf;
174:         for (j=0;j<ncols;j++) svals[j] = vals[j]*d;
175:       } else svals=(PetscScalar*)vals;
176:       for (j=0;j<ncols;j++) scols[j] = cols[j]+N1;
177:       j = i+M1;
178:       MatSetValues(G,1,&j,ncols,scols,svals,INSERT_VALUES);
179:       MatRestoreRow(D,i,&ncols,&cols,&vals);
180:     }
181:   }
182:   PetscFree(buf);
183:   PetscFree(scols);
184:   return(0);
185: }

189: static PetscErrorCode SlepcMatTile_MPIAIJ(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat G)
190: {
192:   PetscMPIInt       np;
193:   PetscInt          p,i,j,N1,N2,m1,m2,n1,n2,*map1,*map2;
194:   PetscInt          *dnz,*onz,ncols,*scols,start,gstart;
195:   PetscScalar       *svals,*buf;
196:   const PetscInt    *cols,*mapptr1,*mapptr2;
197:   const PetscScalar *vals;

200:   MatGetSize(A,NULL,&N1);
201:   MatGetLocalSize(A,&m1,&n1);
202:   MatGetSize(D,NULL,&N2);
203:   MatGetLocalSize(D,&m2,&n2);

205:   /* Create mappings */
206:   MPI_Comm_size(PetscObjectComm((PetscObject)G),&np);
207:   MatGetOwnershipRangesColumn(A,&mapptr1);
208:   MatGetOwnershipRangesColumn(B,&mapptr2);
209:   PetscMalloc(sizeof(PetscInt)*N1,&map1);
210:   for (p=0;p<np;p++) {
211:     for (i=mapptr1[p];i<mapptr1[p+1];i++) map1[i] = i+mapptr2[p];
212:   }
213:   PetscMalloc(sizeof(PetscInt)*N2,&map2);
214:   for (p=0;p<np;p++) {
215:     for (i=mapptr2[p];i<mapptr2[p+1];i++) map2[i] = i+mapptr1[p+1];
216:   }

218:   PetscMalloc(sizeof(PetscScalar)*PetscMax(N1,N2),&buf);
219:   PetscMalloc(sizeof(PetscInt)*PetscMax(N1,N2),&scols);

221:   MatPreallocateInitialize(PetscObjectComm((PetscObject)G),m1+m2,n1+n2,dnz,onz);
222:   MatGetOwnershipRange(G,&gstart,NULL);
223:   /* Preallocate for A */
224:   if (a!=0.0) {
225:     MatGetOwnershipRange(A,&start,NULL);
226:     for (i=0;i<m1;i++) {
227:       MatGetRow(A,i+start,&ncols,&cols,NULL);
228:       for (j=0;j<ncols;j++) scols[j] = map1[cols[j]];
229:       MatPreallocateSet(gstart+i,ncols,scols,dnz,onz);
230:       MatRestoreRow(A,i+start,&ncols,&cols,NULL);
231:     }
232:   }
233:   /* Preallocate for B */
234:   if (b!=0.0) {
235:     MatGetOwnershipRange(B,&start,NULL);
236:     for (i=0;i<m1;i++) {
237:       MatGetRow(B,i+start,&ncols,&cols,NULL);
238:       for (j=0;j<ncols;j++) scols[j] = map2[cols[j]];
239:       MatPreallocateSet(gstart+i,ncols,scols,dnz,onz);
240:       MatRestoreRow(B,i+start,&ncols,&cols,NULL);
241:     }
242:   }
243:   /* Preallocate for C */
244:   if (c!=0.0) {
245:     MatGetOwnershipRange(C,&start,NULL);
246:     for (i=0;i<m2;i++) {
247:       MatGetRow(C,i+start,&ncols,&cols,NULL);
248:       for (j=0;j<ncols;j++) scols[j] = map1[cols[j]];
249:       MatPreallocateSet(gstart+m1+i,ncols,scols,dnz,onz);
250:       MatRestoreRow(C,i+start,&ncols,&cols,NULL);
251:     }
252:   }
253:   /* Preallocate for D */
254:   if (d!=0.0) {
255:     MatGetOwnershipRange(D,&start,NULL);
256:     for (i=0;i<m2;i++) {
257:       MatGetRow(D,i+start,&ncols,&cols,NULL);
258:       for (j=0;j<ncols;j++) scols[j] = map2[cols[j]];
259:       MatPreallocateSet(gstart+m1+i,ncols,scols,dnz,onz);
260:       MatRestoreRow(D,i+start,&ncols,&cols,NULL);
261:     }
262:   }
263:   MatMPIAIJSetPreallocation(G,0,dnz,0,onz);
264:   MatPreallocateFinalize(dnz,onz);

266:   /* Transfer A */
267:   if (a!=0.0) {
268:     MatGetOwnershipRange(A,&start,NULL);
269:     for (i=0;i<m1;i++) {
270:       MatGetRow(A,i+start,&ncols,&cols,&vals);
271:       if (a!=1.0) {
272:         svals=buf;
273:         for (j=0;j<ncols;j++) svals[j] = vals[j]*a;
274:       } else svals=(PetscScalar*)vals;
275:       for (j=0;j<ncols;j++) scols[j] = map1[cols[j]];
276:       j = gstart+i;
277:       MatSetValues(G,1,&j,ncols,scols,svals,INSERT_VALUES);
278:       MatRestoreRow(A,i+start,&ncols,&cols,&vals);
279:     }
280:   }
281:   /* Transfer B */
282:   if (b!=0.0) {
283:     MatGetOwnershipRange(B,&start,NULL);
284:     for (i=0;i<m1;i++) {
285:       MatGetRow(B,i+start,&ncols,&cols,&vals);
286:       if (b!=1.0) {
287:         svals=buf;
288:         for (j=0;j<ncols;j++) svals[j] = vals[j]*b;
289:       } else svals=(PetscScalar*)vals;
290:       for (j=0;j<ncols;j++) scols[j] = map2[cols[j]];
291:       j = gstart+i;
292:       MatSetValues(G,1,&j,ncols,scols,svals,INSERT_VALUES);
293:       MatRestoreRow(B,i+start,&ncols,&cols,&vals);
294:     }
295:   }
296:   /* Transfer C */
297:   if (c!=0.0) {
298:     MatGetOwnershipRange(C,&start,NULL);
299:     for (i=0;i<m2;i++) {
300:       MatGetRow(C,i+start,&ncols,&cols,&vals);
301:       if (c!=1.0) {
302:         svals=buf;
303:         for (j=0;j<ncols;j++) svals[j] = vals[j]*c;
304:       } else svals=(PetscScalar*)vals;
305:       for (j=0;j<ncols;j++) scols[j] = map1[cols[j]];
306:       j = gstart+m1+i;
307:       MatSetValues(G,1,&j,ncols,scols,svals,INSERT_VALUES);
308:       MatRestoreRow(C,i+start,&ncols,&cols,&vals);
309:     }
310:   }
311:   /* Transfer D */
312:   if (d!=0.0) {
313:     MatGetOwnershipRange(D,&start,NULL);
314:     for (i=0;i<m2;i++) {
315:       MatGetRow(D,i+start,&ncols,&cols,&vals);
316:       if (d!=1.0) {
317:         svals=buf;
318:         for (j=0;j<ncols;j++) svals[j] = vals[j]*d;
319:       } else svals=(PetscScalar*)vals;
320:       for (j=0;j<ncols;j++) scols[j] = map2[cols[j]];
321:       j = gstart+m1+i;
322:       MatSetValues(G,1,&j,ncols,scols,svals,INSERT_VALUES);
323:       MatRestoreRow(D,i+start,&ncols,&cols,&vals);
324:     }
325:   }
326:   PetscFree(buf);
327:   PetscFree(scols);
328:   PetscFree(map1);
329:   PetscFree(map2);
330:   return(0);
331: }

335: /*@
336:    SlepcMatTile - Explicitly build a matrix from four blocks, G = [ a*A b*B; c*C d*D ].

338:    Collective on Mat

340:    Input parameters:
341: +  A - matrix for top-left block
342: .  a - scaling factor for block A
343: .  B - matrix for top-right block
344: .  b - scaling factor for block B
345: .  C - matrix for bottom-left block
346: .  c - scaling factor for block C
347: .  D - matrix for bottom-right block
348: -  d - scaling factor for block D

350:    Output parameter:
351: .  G  - the resulting matrix

353:    Notes:
354:    In the case of a parallel matrix, a permuted version of G is returned. The permutation
355:    is a perfect shuffle such that the local parts of A, B, C, D remain in the local part of
356:    G for the same process.

358:    Matrix G must be destroyed by the user.

360:    Level: developer
361: @*/
362: PetscErrorCode SlepcMatTile(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat *G)
363: {
365:   PetscInt       M1,M2,N1,N2,M,N,m1,m2,n1,n2,m,n;
366:   PetscBool      flg1,flg2;


378:   /* check row 1 */
379:   MatGetSize(A,&M1,NULL);
380:   MatGetLocalSize(A,&m1,NULL);
381:   MatGetSize(B,&M,NULL);
382:   MatGetLocalSize(B,&m,NULL);
383:   if (M!=M1 || m!=m1) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_INCOMP,"Incompatible dimensions");
384:   /* check row 2 */
385:   MatGetSize(C,&M2,NULL);
386:   MatGetLocalSize(C,&m2,NULL);
387:   MatGetSize(D,&M,NULL);
388:   MatGetLocalSize(D,&m,NULL);
389:   if (M!=M2 || m!=m2) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_INCOMP,"Incompatible dimensions");
390:   /* check column 1 */
391:   MatGetSize(A,NULL,&N1);
392:   MatGetLocalSize(A,NULL,&n1);
393:   MatGetSize(C,NULL,&N);
394:   MatGetLocalSize(C,NULL,&n);
395:   if (N!=N1 || n!=n1) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_INCOMP,"Incompatible dimensions");
396:   /* check column 2 */
397:   MatGetSize(B,NULL,&N2);
398:   MatGetLocalSize(B,NULL,&n2);
399:   MatGetSize(D,NULL,&N);
400:   MatGetLocalSize(D,NULL,&n);
401:   if (N!=N2 || n!=n2) SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_INCOMP,"Incompatible dimensions");

403:   MatCreate(PetscObjectComm((PetscObject)A),G);
404:   MatSetSizes(*G,m1+m2,n1+n2,M1+M2,N1+N2);
405:   MatSetFromOptions(*G);
406:   MatSetUp(*G);

408:   PetscObjectTypeCompare((PetscObject)*G,MATMPIAIJ,&flg1);
409:   PetscObjectTypeCompare((PetscObject)A,MATMPIAIJ,&flg2);
410:   if (flg1 && flg2) {
411:     SlepcMatTile_MPIAIJ(a,A,b,B,c,C,d,D,*G);
412:   } else {
413:     PetscObjectTypeCompare((PetscObject)*G,MATSEQAIJ,&flg1);
414:     PetscObjectTypeCompare((PetscObject)A,MATSEQAIJ,&flg2);
415:     if (flg1 && flg2) {
416:       SlepcMatTile_SeqAIJ(a,A,b,B,c,C,d,D,*G);
417:     } else SETERRQ(PetscObjectComm((PetscObject)A),PETSC_ERR_SUP,"Not implemented for this matrix type");
418:   }
419:   MatAssemblyBegin(*G,MAT_FINAL_ASSEMBLY);
420:   MatAssemblyEnd(*G,MAT_FINAL_ASSEMBLY);
421:   return(0);
422: }

426: /*@
427:    SlepcCheckOrthogonality - Checks (or prints) the level of orthogonality
428:    of a set of vectors.

430:    Collective on Vec

432:    Input parameters:
433: +  V  - a set of vectors
434: .  nv - number of V vectors
435: .  W  - an alternative set of vectors (optional)
436: .  nw - number of W vectors
437: .  B  - matrix defining the inner product (optional)
438: -  viewer - optional visualization context

440:    Output parameter:
441: .  lev - level of orthogonality (optional)

443:    Notes:
444:    This function computes W'*V and prints the result. It is intended to check
445:    the level of bi-orthogonality of the vectors in the two sets. If W is equal
446:    to NULL then V is used, thus checking the orthogonality of the V vectors.

448:    If matrix B is provided then the check uses the B-inner product, W'*B*V.

450:    If lev is not NULL, it will contain the maximum entry of matrix
451:    W'*V - I (in absolute value). Otherwise, the matrix W'*V is printed.

453:    Level: developer
454: @*/
455: PetscErrorCode SlepcCheckOrthogonality(Vec *V,PetscInt nv,Vec *W,PetscInt nw,Mat B,PetscViewer viewer,PetscReal *lev)
456: {
458:   PetscInt       i,j;
459:   PetscScalar    *vals;
460:   PetscBool      isascii;
461:   Vec            w;

464:   if (nv<=0 || nw<=0) return(0);
467:   if (!lev) {
468:     if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)*V));
471:     PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
472:     if (!isascii) return(0);
473:   }

475:   PetscMalloc(nv*sizeof(PetscScalar),&vals);
476:   if (B) {
477:     VecDuplicate(V[0],&w);
478:   }
479:   if (lev) *lev = 0.0;
480:   for (i=0;i<nw;i++) {
481:     if (B) {
482:       if (W) {
483:         MatMultTranspose(B,W[i],w);
484:       } else {
485:         MatMultTranspose(B,V[i],w);
486:       }
487:     } else {
488:       if (W) w = W[i];
489:       else w = V[i];
490:     }
491:     VecMDot(w,nv,V,vals);
492:     for (j=0;j<nv;j++) {
493:       if (lev) *lev = PetscMax(*lev,PetscAbsScalar((j==i)? (vals[j]-1.0): vals[j]));
494:       else {
495: #if !defined(PETSC_USE_COMPLEX)
496:         PetscViewerASCIIPrintf(viewer," %12G  ",vals[j]);
497: #else
498:         PetscViewerASCIIPrintf(viewer," %12G%+12Gi ",PetscRealPart(vals[j]),PetscImaginaryPart(vals[j]));
499: #endif
500:       }
501:     }
502:     if (!lev) { PetscViewerASCIIPrintf(viewer,"\n"); }
503:   }
504:   PetscFree(vals);
505:   if (B) {
506:     VecDestroy(&w);
507:   }
508:   return(0);
509: }

513: /*
514:   Clean up context used in monitors of type XXXMonitorConverged.
515:   This function is shared by EPS, SVD, QEP
516: */
517: PetscErrorCode SlepcConvMonitorDestroy(SlepcConvMonitor *ctx)
518: {

522:   if (!*ctx) return(0);
523:   PetscViewerDestroy(&(*ctx)->viewer);
524:   PetscFree(*ctx);
525:   return(0);
526: }

530: PetscErrorCode SlepcCompareLargestMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
531: {
532:   PetscReal a,b;

535:   a = SlepcAbsEigenvalue(ar,ai);
536:   b = SlepcAbsEigenvalue(br,bi);
537:   if (a<b) *result = 1;
538:   else if (a>b) *result = -1;
539:   else *result = 0;
540:   return(0);
541: }

545: PetscErrorCode SlepcCompareSmallestMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
546: {
547:   PetscReal a,b;

550:   a = SlepcAbsEigenvalue(ar,ai);
551:   b = SlepcAbsEigenvalue(br,bi);
552:   if (a>b) *result = 1;
553:   else if (a<b) *result = -1;
554:   else *result = 0;
555:   return(0);
556: }

560: PetscErrorCode SlepcCompareLargestReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
561: {
562:   PetscReal a,b;

565:   a = PetscRealPart(ar);
566:   b = PetscRealPart(br);
567:   if (a<b) *result = 1;
568:   else if (a>b) *result = -1;
569:   else *result = 0;
570:   return(0);
571: }

575: PetscErrorCode SlepcCompareSmallestReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
576: {
577:   PetscReal a,b;

580:   a = PetscRealPart(ar);
581:   b = PetscRealPart(br);
582:   if (a>b) *result = 1;
583:   else if (a<b) *result = -1;
584:   else *result = 0;
585:   return(0);
586: }

590: PetscErrorCode SlepcCompareLargestImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
591: {
592:   PetscReal a,b;

595: #if defined(PETSC_USE_COMPLEX)
596:   a = PetscImaginaryPart(ar);
597:   b = PetscImaginaryPart(br);
598: #else
599:   a = PetscAbsReal(ai);
600:   b = PetscAbsReal(bi);
601: #endif
602:   if (a<b) *result = 1;
603:   else if (a>b) *result = -1;
604:   else *result = 0;
605:   return(0);
606: }

610: PetscErrorCode SlepcCompareSmallestImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
611: {
612:   PetscReal a,b;

615: #if defined(PETSC_USE_COMPLEX)
616:   a = PetscImaginaryPart(ar);
617:   b = PetscImaginaryPart(br);
618: #else
619:   a = PetscAbsReal(ai);
620:   b = PetscAbsReal(bi);
621: #endif
622:   if (a>b) *result = 1;
623:   else if (a<b) *result = -1;
624:   else *result = 0;
625:   return(0);
626: }

630: PetscErrorCode SlepcCompareTargetMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
631: {
632:   PetscReal   a,b;
633:   PetscScalar *target = (PetscScalar*)ctx;

636:   /* complex target only allowed if scalartype=complex */
637:   a = SlepcAbsEigenvalue(ar-(*target),ai);
638:   b = SlepcAbsEigenvalue(br-(*target),bi);
639:   if (a>b) *result = 1;
640:   else if (a<b) *result = -1;
641:   else *result = 0;
642:   return(0);
643: }

647: PetscErrorCode SlepcCompareTargetReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
648: {
649:   PetscReal   a,b;
650:   PetscScalar *target = (PetscScalar*)ctx;

653:   a = PetscAbsReal(PetscRealPart(ar-(*target)));
654:   b = PetscAbsReal(PetscRealPart(br-(*target)));
655:   if (a>b) *result = 1;
656:   else if (a<b) *result = -1;
657:   else *result = 0;
658:   return(0);
659: }

663: PetscErrorCode SlepcCompareTargetImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
664: {
665:   PetscReal   a,b;
666: #if defined(PETSC_USE_COMPLEX)
667:   PetscScalar *target = (PetscScalar*)ctx;
668: #endif

671: #if !defined(PETSC_USE_COMPLEX)
672:   /* complex target only allowed if scalartype=complex */
673:   a = PetscAbsReal(ai);
674:   b = PetscAbsReal(bi);
675: #else
676:   a = PetscAbsReal(PetscImaginaryPart(ar-(*target)));
677:   b = PetscAbsReal(PetscImaginaryPart(br-(*target)));
678: #endif
679:   if (a>b) *result = 1;
680:   else if (a<b) *result = -1;
681:   else *result = 0;
682:   return(0);
683: }

687: /*
688:    Used in the SVD for computing smallest singular values
689:    from the cyclic matrix.
690: */
691: PetscErrorCode SlepcCompareSmallestPosReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)
692: {
693:   PetscReal a,b;
694:   PetscBool aisright,bisright;

697:   if (PetscRealPart(ar)>0.0) aisright = PETSC_TRUE;
698:   else aisright = PETSC_FALSE;
699:   if (PetscRealPart(br)>0.0) bisright = PETSC_TRUE;
700:   else bisright = PETSC_FALSE;
701:   if (aisright == bisright) { /* same sign */
702:     a = SlepcAbsEigenvalue(ar,ai);
703:     b = SlepcAbsEigenvalue(br,bi);
704:     if (a>b) *result = 1;
705:     else if (a<b) *result = -1;
706:     else *result = 0;
707:   } else if (aisright && !bisright) *result = -1; /* 'a' is on the right */
708:   else *result = 1;  /* 'b' is on the right */
709:   return(0);
710: }

714: /*
715:    Given n vectors in V, this function gets references of them into W.
716:    If m<0 then some previous non-processed vectors remain in W and must be freed.
717:  */
718: PetscErrorCode SlepcBasisReference_Private(PetscInt n,Vec *V,PetscInt *m,Vec **W)
719: {
721:   PetscInt       i;

724:   SlepcBasisDestroy_Private(m,W);
725:   if (n>0) {
726:     PetscMalloc(n*sizeof(Vec),W);
727:     for (i=0;i<n;i++) {
728:       PetscObjectReference((PetscObject)V[i]);
729:       (*W)[i] = V[i];
730:     }
731:     *m = -n;
732:   }
733:   return(0);
734: }

738: /*
739:    Destroys a set of vectors.
740:    A negative value of m indicates that W contains vectors to be destroyed.
741:  */
742: PetscErrorCode SlepcBasisDestroy_Private(PetscInt *m,Vec **W)
743: {
745:   PetscInt       i;

748:   if (*m<0) {
749:     for (i=0;i<-(*m);i++) {
750:       VecDestroy(&(*W)[i]);
751:     }
752:     PetscFree(*W);
753:   }
754:   *m = 0;
755:   return(0);
756: }

760: /*@C
761:    SlepcSNPrintfScalar - Prints a PetscScalar variable to a string of
762:    given length.

764:    Not Collective

766:    Input Parameters:
767: +  str - the string to print to
768: .  len - the length of str
769: .  val - scalar value to be printed
770: -  exp - to be used within an expression, print leading sign and parentheses
771:          in case of nonzero imaginary part

773:    Level: developer
774: @*/
775: PetscErrorCode SlepcSNPrintfScalar(char *str,size_t len,PetscScalar val,PetscBool exp)
776: {
778: #if defined(PETSC_USE_COMPLEX)
779:   PetscReal      re,im;
780: #endif

783: #if !defined(PETSC_USE_COMPLEX)
784:   if (exp) {
785:     PetscSNPrintf(str,len,"%+G",val);
786:   } else {
787:     PetscSNPrintf(str,len,"%G",val);
788:   }
789: #else
790:   re = PetscRealPart(val);
791:   im = PetscImaginaryPart(val);
792:   if (im!=0.0) {
793:     if (exp) {
794:       PetscSNPrintf(str,len,"+(%G%+G i)",re,im);
795:     } else {
796:       PetscSNPrintf(str,len,"%G%+G i",re,im);
797:     }
798:   } else {
799:     if (exp) {
800:       PetscSNPrintf(str,len,"%+G",re,im);
801:     } else {
802:       PetscSNPrintf(str,len,"%G",re,im);
803:     }
804:   }
805: #endif
806:   return(0);
807: }

slepc-3.4.2.dfsg.orig/src/sys/slepcinit.c0000644000175000017500000002422212211062077017200 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsys.h" I*/ #include #include #include #include #include #include #include #include #include #include #include #undef __FUNCT__ #define __FUNCT__ "SlepcGetVersion" /*@C SlepcGetVersion - Gets the SLEPc version information in a string. Input Parameter: . len - length of the string Output Parameter: . version - version string Fortran Note: This routine is not supported in Fortran. Level: developer @*/ PetscErrorCode SlepcGetVersion(char version[],size_t len) { PetscErrorCode ierr; PetscFunctionBegin; #if (SLEPC_VERSION_RELEASE == 1) ierr = PetscSNPrintf(version,len,"SLEPc Release Version %d.%d.%d, %s",SLEPC_VERSION_MAJOR,SLEPC_VERSION_MINOR,SLEPC_VERSION_SUBMINOR,SLEPC_VERSION_DATE);CHKERRQ(ierr); #else ierr = PetscSNPrintf(version,len,"SLEPc Development GIT revision: %d GIT Date: %s",SLEPC_VERSION_GIT,SLEPC_VERSION_DATE_GIT);CHKERRQ(ierr); #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcPrintVersion" /* SlepcPrintVersion - Prints SLEPc version info. Collective on MPI_Comm */ PetscErrorCode SlepcPrintVersion(MPI_Comm comm) { PetscErrorCode ierr; char version[256]; PetscFunctionBegin; ierr = SlepcGetVersion(version,256);CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,"--------------------------------------------------------------------------\n");CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,"%s\n",version);CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,SLEPC_AUTHOR_INFO);CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,"See docs/manual.html for help.\n");CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,"SLEPc libraries linked from %s\n",SLEPC_LIB_DIR);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcPrintHelpIntro" /* SlepcPrintHelpIntro - Prints introductory SLEPc help info. Collective on MPI_Comm */ PetscErrorCode SlepcPrintHelpIntro(MPI_Comm comm) { PetscErrorCode ierr; PetscFunctionBegin; ierr = (*PetscHelpPrintf)(comm,"SLEPc help information includes that for the PETSc libraries, which provide\n");CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,"low-level system infrastructure and linear algebra tools.\n");CHKERRQ(ierr); ierr = (*PetscHelpPrintf)(comm,"--------------------------------------------------------------------------\n");CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------Nasty global variables -------------------------------*/ /* Indicates whether SLEPc started PETSc, or whether it was already started before SLEPc was initialized. */ PetscBool SlepcBeganPetsc = PETSC_FALSE; PetscBool SlepcInitializeCalled = PETSC_FALSE; #if defined(PETSC_USE_DYNAMIC_LIBRARIES) #undef __FUNCT__ #define __FUNCT__ "SlepcInitialize_DynamicLibraries" /* SlepcInitialize_DynamicLibraries - Adds the default dynamic link libraries to the search path. */ PetscErrorCode SlepcInitialize_DynamicLibraries(void) { PetscErrorCode ierr; PetscBool found; char libs[PETSC_MAX_PATH_LEN],dlib[PETSC_MAX_PATH_LEN]; PetscFunctionBegin; ierr = PetscStrcpy(libs,SLEPC_LIB_DIR);CHKERRQ(ierr); ierr = PetscStrcat(libs,"/libslepc");CHKERRQ(ierr); ierr = PetscDLLibraryRetrieve(PETSC_COMM_WORLD,libs,dlib,1024,&found);CHKERRQ(ierr); if (found) { ierr = PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,libs);CHKERRQ(ierr); } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc dynamic library\nYou cannot move the dynamic libraries"); PetscFunctionReturn(0); } #endif #undef __FUNCT__ #define __FUNCT__ "SlepcInitialize_LogEvents" /* SlepcInitialize_LogEvents - Initialize log events not pertaining to any object class. */ PetscErrorCode SlepcInitialize_LogEvents(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscLogEventRegister("UpdateVectors",0,&SLEPC_UpdateVectors);CHKERRQ(ierr); ierr = PetscLogEventRegister("VecMAXPBY",0,&SLEPC_VecMAXPBY);CHKERRQ(ierr); ierr = PetscLogEventRegister("DenseMatProd",EPS_CLASSID,&SLEPC_SlepcDenseMatProd);CHKERRQ(ierr); ierr = PetscLogEventRegister("DenseMatNorm",EPS_CLASSID,&SLEPC_SlepcDenseNorm);CHKERRQ(ierr); ierr = PetscLogEventRegister("DenseCopy",EPS_CLASSID,&SLEPC_SlepcDenseCopy);CHKERRQ(ierr); ierr = PetscLogEventRegister("VecsMult",EPS_CLASSID,&SLEPC_VecsMult);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcInitialize" /*@C SlepcInitialize - Initializes the SLEPc library. SlepcInitialize() calls PetscInitialize() if that has not been called yet, so this routine should always be called near the beginning of your program. Collective on MPI_COMM_WORLD or PETSC_COMM_WORLD if it has been set Input Parameters: + argc - count of number of command line arguments . args - the command line arguments . file - [optional] PETSc database file, defaults to ~username/.petscrc (use NULL for default) - help - [optional] Help message to print, use NULL for no message Fortran Note: Fortran syntax is very similar to that of PetscInitialize() Level: beginner .seealso: SlepcFinalize(), PetscInitialize() @*/ PetscErrorCode SlepcInitialize(int *argc,char ***args,const char file[],const char help[]) { PetscErrorCode ierr; PetscBool flg; PetscFunctionBegin; if (SlepcInitializeCalled) PetscFunctionReturn(0); ierr = PetscSetHelpVersionFunctions(SlepcPrintHelpIntro,SlepcPrintVersion);CHKERRQ(ierr); ierr = PetscInitialized(&flg);CHKERRQ(ierr); if (!flg) { ierr = PetscInitialize(argc,args,file,help);CHKERRQ(ierr); SlepcBeganPetsc = PETSC_TRUE; } #if defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = SlepcInitialize_DynamicLibraries();CHKERRQ(ierr); #endif ierr = SlepcInitialize_LogEvents();CHKERRQ(ierr); #if defined(PETSC_HAVE_DRAND48) /* work-around for Cygwin drand48() initialization bug */ srand48(0); #endif SlepcInitializeCalled = PETSC_TRUE; ierr = PetscInfo(0,"SLEPc successfully started\n");CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcFinalize" /*@ SlepcFinalize - Checks for options to be called at the conclusion of the SLEPc program and calls PetscFinalize(). Collective on PETSC_COMM_WORLD Level: beginner .seealso: SlepcInitialize(), PetscFinalize() @*/ PetscErrorCode SlepcFinalize(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscInfo(0,"SlepcFinalize() called\n");CHKERRQ(ierr); if (SlepcBeganPetsc) { ierr = PetscFinalize();CHKERRQ(ierr); } SlepcInitializeCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcInitializeNoArguments" /*@C SlepcInitializeNoArguments - Calls SlepcInitialize() from C/C++ without the command line arguments. Collective Level: advanced .seealso: SlepcInitialize(), SlepcInitializeFortran() @*/ PetscErrorCode SlepcInitializeNoArguments(void) { PetscErrorCode ierr; int argc = 0; char **args = 0; PetscFunctionBegin; ierr = SlepcInitialize(&argc,&args,NULL,NULL); PetscFunctionReturn(ierr); } #undef __FUNCT__ #define __FUNCT__ "SlepcInitialized" /*@ SlepcInitialized - Determine whether SLEPc is initialized. Level: beginner .seealso: SlepcInitialize(), SlepcInitializeFortran() @*/ PetscErrorCode SlepcInitialized(PetscBool *isInitialized) { PetscFunctionBegin; PetscValidPointer(isInitialized,1); *isInitialized = SlepcInitializeCalled; PetscFunctionReturn(0); } PETSC_EXTERN PetscBool PetscBeganMPI; #undef __FUNCT__ #define __FUNCT__ "SlepcInitializeNoPointers" /* SlepcInitializeNoPointers - Calls SlepcInitialize() from C/C++ without the pointers to argc and args (analogue to PetscInitializeNoPointers). Collective Level: advanced .seealso: SlepcInitialize() */ PetscErrorCode SlepcInitializeNoPointers(int argc,char **args,const char *filename,const char *help) { PetscErrorCode ierr; int myargc = argc; char **myargs = args; PetscFunctionBegin; ierr = SlepcInitialize(&myargc,&myargs,filename,help);CHKERRQ(ierr); ierr = PetscPopSignalHandler();CHKERRQ(ierr); PetscBeganMPI = PETSC_FALSE; PetscFunctionReturn(ierr); } #if defined(PETSC_USE_DYNAMIC_LIBRARIES) #undef __FUNCT__ #define __FUNCT__ "PetscDLLibraryRegister_slepc" /* PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened. This one registers all the EPS and ST methods in the libslepc.a library. Input Parameter: path - library path */ PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepc(char *path) { PetscErrorCode ierr; PetscFunctionBegin; ierr = EPSInitializePackage();CHKERRQ(ierr); ierr = SVDInitializePackage();CHKERRQ(ierr); ierr = QEPInitializePackage();CHKERRQ(ierr); ierr = NEPInitializePackage();CHKERRQ(ierr); ierr = MFNInitializePackage();CHKERRQ(ierr); ierr = STInitializePackage();CHKERRQ(ierr); ierr = IPInitializePackage();CHKERRQ(ierr); ierr = DSInitializePackage();CHKERRQ(ierr); ierr = FNInitializePackage();CHKERRQ(ierr); PetscFunctionReturn(0); } #endif /* PETSC_USE_DYNAMIC_LIBRARIES */ slepc-3.4.2.dfsg.orig/src/sys/makefile0000644000175000017500000000215212211062077016540 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = slepcinit.c slepcutil.c SOURCEF = SOURCEH = LIBBASE = libslepc MANSEC = sys LOCDIR = src/sys/ DIRS = f90-mod include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/sys/slepcutil.c0000644000175000017500000006361712211062077017225 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsys.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "SlepcMatConvertSeqDense" /*@C SlepcMatConvertSeqDense - Converts a parallel matrix to another one in sequential dense format replicating the values in every processor. Collective on Mat Input parameters: + A - the source matrix - B - the target matrix Level: developer @*/ PetscErrorCode SlepcMatConvertSeqDense(Mat mat,Mat *newmat) { PetscErrorCode ierr; PetscInt m,n; PetscMPIInt size; Mat *M; IS isrow,iscol; PetscFunctionBegin; PetscValidHeaderSpecific(mat,MAT_CLASSID,1); PetscValidPointer(newmat,2); ierr = MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);CHKERRQ(ierr); if (size > 1) { if (!mat->ops->getsubmatrices) SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Mat type %s",((PetscObject)mat)->type_name); /* assemble full matrix on every processor */ ierr = MatGetSize(mat,&m,&n);CHKERRQ(ierr); ierr = ISCreateStride(PETSC_COMM_SELF,m,0,1,&isrow);CHKERRQ(ierr); ierr = ISCreateStride(PETSC_COMM_SELF,n,0,1,&iscol);CHKERRQ(ierr); ierr = MatGetSubMatrices(mat,1,&isrow,&iscol,MAT_INITIAL_MATRIX,&M);CHKERRQ(ierr); ierr = ISDestroy(&isrow);CHKERRQ(ierr); ierr = ISDestroy(&iscol);CHKERRQ(ierr); /* Fake support for "inplace" convert */ if (*newmat == mat) { ierr = MatDestroy(&mat);CHKERRQ(ierr); } /* convert matrix to MatSeqDense */ ierr = MatConvert(*M,MATSEQDENSE,MAT_INITIAL_MATRIX,newmat);CHKERRQ(ierr); ierr = MatDestroyMatrices(1,&M);CHKERRQ(ierr); } else { /* convert matrix to MatSeqDense */ ierr = MatConvert(mat,MATSEQDENSE,MAT_INITIAL_MATRIX,newmat);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcMatTile_SeqAIJ" static PetscErrorCode SlepcMatTile_SeqAIJ(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat G) { PetscErrorCode ierr; PetscInt i,j,M1,M2,N1,N2,*nnz,ncols,*scols; PetscScalar *svals,*buf; const PetscInt *cols; const PetscScalar *vals; PetscFunctionBegin; ierr = MatGetSize(A,&M1,&N1);CHKERRQ(ierr); ierr = MatGetSize(D,&M2,&N2);CHKERRQ(ierr); ierr = PetscMalloc((M1+M2)*sizeof(PetscInt),&nnz);CHKERRQ(ierr); ierr = PetscMemzero(nnz,(M1+M2)*sizeof(PetscInt));CHKERRQ(ierr); /* Preallocate for A */ if (a!=0.0) { for (i=0;iviewer);CHKERRQ(ierr); ierr = PetscFree(*ctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcCompareLargestMagnitude" PetscErrorCode SlepcCompareLargestMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx) { PetscReal a,b; PetscFunctionBegin; a = SlepcAbsEigenvalue(ar,ai); b = SlepcAbsEigenvalue(br,bi); if (ab) *result = -1; else *result = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcCompareSmallestMagnitude" PetscErrorCode SlepcCompareSmallestMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx) { PetscReal a,b; PetscFunctionBegin; a = SlepcAbsEigenvalue(ar,ai); b = SlepcAbsEigenvalue(br,bi); if (a>b) *result = 1; else if (ab) *result = -1; else *result = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcCompareSmallestReal" PetscErrorCode SlepcCompareSmallestReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx) { PetscReal a,b; PetscFunctionBegin; a = PetscRealPart(ar); b = PetscRealPart(br); if (a>b) *result = 1; else if (ab) *result = -1; else *result = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcCompareSmallestImaginary" PetscErrorCode SlepcCompareSmallestImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx) { PetscReal a,b; PetscFunctionBegin; #if defined(PETSC_USE_COMPLEX) a = PetscImaginaryPart(ar); b = PetscImaginaryPart(br); #else a = PetscAbsReal(ai); b = PetscAbsReal(bi); #endif if (a>b) *result = 1; else if (ab) *result = 1; else if (ab) *result = 1; else if (ab) *result = 1; else if (a0.0) aisright = PETSC_TRUE; else aisright = PETSC_FALSE; if (PetscRealPart(br)>0.0) bisright = PETSC_TRUE; else bisright = PETSC_FALSE; if (aisright == bisright) { /* same sign */ a = SlepcAbsEigenvalue(ar,ai); b = SlepcAbsEigenvalue(br,bi); if (a>b) *result = 1; else if (a0) { ierr = PetscMalloc(n*sizeof(Vec),W);CHKERRQ(ierr); for (i=0;i
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = slepcinit.c slepcutil.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
MANSEC   = sys
LOCDIR   = src/sys/
DIRS     = f90-mod

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/sys/index.html0000644000175000017500000000153012211062077017034 0ustar gladkgladk SLEPc System Routines

SLEPc System routines

SLEPc provides a variety of "system" level routines. These routines are generally tools used by other SLEPc routines and are not intended for application programmers (except the basic SlepcInitialize() / SlepcFinalize()).

Useful tools for application programmers can be found in PETSc's system routines, including parallel file access, synchronized printing to screen, and many other programming aids.

f90-mod/
slepcinit.c
slepcutil.c
makefile
slepc-3.4.2.dfsg.orig/src/sys/ftn-custom/0000755000175000017500000000000012214143515017137 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/sys/ftn-custom/zslepc_startf.c0000644000175000017500000000374012211062077022172 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define slepcinitializefortran_ SLEPCINITIALIZEFORTRAN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define slepcinitializefortran_ slepcinitializefortran #endif /*@C SlepcInitializeFortran - Routine that should be called from C after the call to SlepcInitialize() if one is using a C main program that calls Fortran routines that in turn call SLEPc routines. Collective on PETSC_COMM_WORLD Level: beginner Notes: SlepcInitializeFortran() initializes some of the default SLEPc variables for use in Fortran if a user's main program is written in C. SlepcInitializeFortran() is NOT needed if a user's main program is written in Fortran; in this case, just calling SlepcInitialize() in the main (Fortran) program is sufficient. .seealso: SlepcInitialize() @*/ PetscErrorCode SlepcInitializeFortran(void) { PetscInitializeFortran(); return 0; } PETSC_EXTERN void PETSC_STDCALL slepcinitializefortran_(PetscErrorCode *info) { *info = SlepcInitializeFortran(); } slepc-3.4.2.dfsg.orig/src/sys/ftn-custom/zslepc_start.c0000644000175000017500000000551212211062077022023 0ustar gladkgladk/* This file contains the Fortran version of SlepcInitialize(). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define petscinitialize_ PETSCINITIALIZE #define slepcinitialize_ SLEPCINITIALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define petscinitialize_ petscinitialize #define slepcinitialize_ slepcinitialize #endif PETSC_EXTERN void PETSC_STDCALL petscinitialize_(CHAR filename PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)); /* SlepcInitialize - Version called from Fortran. Notes: Since this routine is called from Fortran it does not return error codes. */ PETSC_EXTERN void PETSC_STDCALL slepcinitialize_(CHAR filename PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { PetscBool flg; *ierr = 1; if (SlepcInitializeCalled) { *ierr = 0; return; } *ierr = PetscInitialized(&flg); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:PetscInitialized failed");return; } if (!flg) { #if defined(PETSC_HAVE_FORTRAN_MIXED_STR_ARG) petscinitialize_(filename,len,ierr); #else petscinitialize_(filename,ierr,len); #endif if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:PetscInitialize failed");return; } SlepcBeganPetsc = PETSC_TRUE; } #if defined(PETSC_USE_DYNAMIC_LIBRARIES) *ierr = SlepcInitialize_DynamicLibraries(); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Initializing dynamic libraries\n");return; } #endif *ierr = SlepcInitialize_LogEvents(); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Initializing log events\n");return; } #if defined(PETSC_HAVE_DRAND48) /* work-around for Cygwin drand48() initialization bug */ srand48(0); #endif SlepcInitializeCalled = PETSC_TRUE; *ierr = PetscInfo(0,"SLEPc successfully started from Fortran\n"); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Calling PetscInfo()");return; } } slepc-3.4.2.dfsg.orig/src/sys/ftn-custom/makefile0000644000175000017500000000230112211062077020633 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = -DSLEPC_LIB_DIR='"${SLEPC_DESTDIR}/lib"' FFLAGS = SOURCEC = zslepc_start.c zslepc_startf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc MANSEC = sys LOCDIR = src/sys/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/sys/f90-mod/0000755000175000017500000000000012214143515016213 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/sys/f90-mod/makefile0000644000175000017500000000300012211062077017704 0ustar gladkgladk # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_USING_F90' # # Makes Fortran module functions from *.h90 files in include/finclude # ALL: buildmod_slepc speciallib: buildmod_slepc specialfastlib: buildmod_slepc SPECIALLIB = yes SPECIALFASTLIB = yes CFLAGS = FFLAGS = SOURCEC = SOURCEF = slepcmod.F SOURCEH = LIBBASE = libslepc MANSEC = sys LOCDIR = src/sys/f90-mod/ CLEANFILES = *.mod include ${SLEPC_DIR}/conf/slepc_common buildmod_slepc: -@${OMAKE} clean @${OMAKE} libfastcompile @${OMAKE} modcopy_slepc @${OMAKE} clean modcopy_slepc: @${CP} -f *.mod ${SLEPC_DIR}/${PETSC_ARCH}/include slepc-3.4.2.dfsg.orig/src/sys/f90-mod/slepcmod.F.html0000644000175000017500000002021412211062077021072 0ustar gladkgladk

Actual source code: slepcmod.F

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 20: #define PETSC_USE_FORTRAN_MODULES

 22: #include "finclude/petscdef.h"
 23: #include "finclude/slepcdef.h"

 25:         module slepcstdef
 26:         use petscksp
 27: #include "finclude/slepcst.h"
 28: #include "finclude/ftn-custom/slepcstdef.h90"
 29:         end module

 31:         module slepcst
 32:         use slepcstdef
 33: #include "finclude/slepcst.h90"
 34:         end module

 36:         module slepcipdef
 37:         use petscsys
 38: #include "finclude/slepcip.h"
 39: #include "finclude/ftn-custom/slepcipdef.h90"
 40:         end module

 42:         module slepcip
 43:         use slepcipdef
 44: #include "finclude/slepcip.h90"
 45:         end module

 47:         module slepcdsdef
 48:         use petscsys
 49: #include "finclude/slepcds.h"
 50: #include "finclude/ftn-custom/slepcdsdef.h90"
 51:         end module

 53:         module slepcds
 54:         use slepcdsdef
 55: #include "finclude/slepcds.h90"
 56:         end module

 58:         module slepcepsdef
 59:         use slepcst
 60:         use slepcip
 61:         use slepcds
 62: #include "finclude/slepceps.h"
 63: #include "finclude/ftn-custom/slepcepsdef.h90"
 64:         end module

 66:         module slepceps
 67:         use slepcepsdef
 68: #include "finclude/slepceps.h90"
 69:         end module

 71:         module slepcsvddef
 72:         use slepcip
 73:         use slepceps
 74: #include "finclude/slepcsvd.h"
 75: #include "finclude/ftn-custom/slepcsvddef.h90"
 76:         end module

 78:         module slepcsvd
 79:         use slepcsvddef
 80: #include "finclude/slepcsvd.h90"
 81:         end module

 83:         module slepcqepdef
 84:         use slepcip
 85:         use slepceps
 86: #include "finclude/slepcqep.h"
 87: #include "finclude/ftn-custom/slepcqepdef.h90"
 88:         end module

 90:         module slepcqep
 91:         use slepcqepdef
 92: #include "finclude/slepcqep.h90"
 93:         end module

 95:         module slepcnepdef
 96:         use slepcip
 97:         use slepceps
 98: #include "finclude/slepcnep.h"
 99: #include "finclude/ftn-custom/slepcnepdef.h90"
100:         end module

102:         module slepcnep
103:         use slepcnepdef
104: #include "finclude/slepcnep.h90"
105:         end module

107:         module slepcmfndef
108:         use slepcip
109:         use slepcds
110: #include "finclude/slepcmfn.h"
111: #include "finclude/ftn-custom/slepcmfndef.h90"
112:         end module

114:         module slepcmfn
115:         use slepcmfndef
116: #include "finclude/slepcmfn.h90"
117:         end module

slepc-3.4.2.dfsg.orig/src/sys/f90-mod/makefile.html0000644000175000017500000000512612211062077020662 0ustar gladkgladk
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#requiresdefine   'PETSC_USING_F90'
#
#   Makes Fortran module functions from *.h90 files in include/finclude
#
ALL: buildmod_slepc
speciallib: buildmod_slepc
specialfastlib: buildmod_slepc
SPECIALLIB     = yes
SPECIALFASTLIB = yes


CFLAGS     =
FFLAGS     =
SOURCEC    =
SOURCEF    = slepcmod.F
SOURCEH    =
LIBBASE    = libslepc
MANSEC     = sys
LOCDIR     = src/sys/f90-mod/
CLEANFILES = *.mod

include ${SLEPC_DIR}/conf/slepc_common

buildmod_slepc:
	-@${OMAKE}  clean
	@${OMAKE}  libfastcompile
	@${OMAKE}  modcopy_slepc
	@${OMAKE}  clean
modcopy_slepc:
	@${CP} -f *.mod ${SLEPC_DIR}/${PETSC_ARCH}/include
slepc-3.4.2.dfsg.orig/src/sys/f90-mod/index.html0000644000175000017500000000140312211062077020206 0ustar gladkgladk SLEPc System Routines

SLEPc System routines

SLEPc provides a variety of "system" level routines. These routines are generally tools used by other SLEPc routines and are not intended for application programmers (except the basic SlepcInitialize() / SlepcFinalize()).

Useful tools for application programmers can be found in PETSc's system routines, including parallel file access, synchronized printing to screen, and many other programming aids.

slepcmod.F
makefile
slepc-3.4.2.dfsg.orig/src/sys/f90-mod/slepcmod.F0000644000175000017500000000604012211062077020130 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #define PETSC_USE_FORTRAN_MODULES #include "finclude/petscdef.h" #include "finclude/slepcdef.h" module slepcstdef use petscksp #include "finclude/slepcst.h" #include "finclude/ftn-custom/slepcstdef.h90" end module module slepcst use slepcstdef #include "finclude/slepcst.h90" end module module slepcipdef use petscsys #include "finclude/slepcip.h" #include "finclude/ftn-custom/slepcipdef.h90" end module module slepcip use slepcipdef #include "finclude/slepcip.h90" end module module slepcdsdef use petscsys #include "finclude/slepcds.h" #include "finclude/ftn-custom/slepcdsdef.h90" end module module slepcds use slepcdsdef #include "finclude/slepcds.h90" end module module slepcepsdef use slepcst use slepcip use slepcds #include "finclude/slepceps.h" #include "finclude/ftn-custom/slepcepsdef.h90" end module module slepceps use slepcepsdef #include "finclude/slepceps.h90" end module module slepcsvddef use slepcip use slepceps #include "finclude/slepcsvd.h" #include "finclude/ftn-custom/slepcsvddef.h90" end module module slepcsvd use slepcsvddef #include "finclude/slepcsvd.h90" end module module slepcqepdef use slepcip use slepceps #include "finclude/slepcqep.h" #include "finclude/ftn-custom/slepcqepdef.h90" end module module slepcqep use slepcqepdef #include "finclude/slepcqep.h90" end module module slepcnepdef use slepcip use slepceps #include "finclude/slepcnep.h" #include "finclude/ftn-custom/slepcnepdef.h90" end module module slepcnep use slepcnepdef #include "finclude/slepcnep.h90" end module module slepcmfndef use slepcip use slepcds #include "finclude/slepcmfn.h" #include "finclude/ftn-custom/slepcmfndef.h90" end module module slepcmfn use slepcmfndef #include "finclude/slepcmfn.h90" end module slepc-3.4.2.dfsg.orig/src/sys/ftn-auto/0000755000175000017500000000000012214143515016575 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/sys/ftn-auto/slepcutilf.c0000644000175000017500000000324112211062077021113 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* slepcutil.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsys.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define slepcmattile_ SLEPCMATTILE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define slepcmattile_ slepcmattile #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define slepccheckorthogonality_ SLEPCCHECKORTHOGONALITY #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define slepccheckorthogonality_ slepccheckorthogonality #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL slepcmattile_(PetscScalar *a,Mat A,PetscScalar *b,Mat B,PetscScalar *c,Mat C,PetscScalar *d,Mat D,Mat *G, int *__ierr ){ *__ierr = SlepcMatTile(*a, (Mat)PetscToPointer((A) ),*b, (Mat)PetscToPointer((B) ),*c, (Mat)PetscToPointer((C) ),*d, (Mat)PetscToPointer((D) ),G); } void PETSC_STDCALL slepccheckorthogonality_(Vec *V,PetscInt *nv,Vec *W,PetscInt *nw,Mat B,PetscViewer viewer,PetscReal *lev, int *__ierr ){ *__ierr = SlepcCheckOrthogonality(V,*nv,W,*nw, (Mat)PetscToPointer((B) ), (PetscViewer)PetscToPointer((viewer) ),lev); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/sys/ftn-auto/makefile0000644000175000017500000000034712211062077020301 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = slepcinitf.c slepcutilf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/sys/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/sys/ftn-auto/slepcinitf.c0000644000175000017500000000244612211062077021107 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* slepcinit.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsys.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define slepcfinalize_ SLEPCFINALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define slepcfinalize_ slepcfinalize #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define slepcinitialized_ SLEPCINITIALIZED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define slepcinitialized_ slepcinitialized #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL slepcfinalize_(int *__ierr ){ *__ierr = SlepcFinalize(); } void PETSC_STDCALL slepcinitialized_(PetscBool *isInitialized, int *__ierr ){ *__ierr = SlepcInitialized(isInitialized); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/mfn/0000755000175000017500000000000012214143515015002 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/examples/0000755000175000017500000000000012214143515016620 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/0000755000175000017500000000000012211062077020646 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/output/0000755000175000017500000000000012211062077022206 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/output/ex23_1.out0000644000175000017500000000027612211062077023745 0ustar gladkgladk Markov y=exp(t*A)*e_1, N=120 (m=15) Number of iterations of the method: 1 Subspace dimension: 30 Stopping condition: tol=1e-07, maxit=100 Computed vector at time t=2 has norm 2.46752 slepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/ex23.c0000644000175000017500000001475112211062077021603 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Computes exp(A)*v for a matrix associated with a Markov model.\n\n" "The command line options are:\n" " -m , where = number of grid subdivisions in each dimension.\n\n"; #include /* User-defined routines */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A); #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* problem matrix */ MFN mfn; PetscReal tol,norm; PetscScalar t; Vec v,y; PetscInt N,m=15,ncv,maxit,its; PetscErrorCode ierr; PetscBool draw_sol; MFNConvergedReason reason; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); N = m*(m+1)/2; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nMarkov y=exp(t*A)*e_1, N=%D (m=%D)\n\n",N,m);CHKERRQ(ierr); ierr = PetscOptionsHasName(PETSC_NULL,"-draw_sol",&draw_sol);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the transition probability matrix, A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatMarkovModel(m,A);CHKERRQ(ierr); /* set v = e_1 */ ierr = MatGetVecs(A,PETSC_NULL,&y);CHKERRQ(ierr); ierr = MatGetVecs(A,PETSC_NULL,&v);CHKERRQ(ierr); ierr = VecSetValue(v,1,1.0,INSERT_VALUES);CHKERRQ(ierr); ierr = VecAssemblyBegin(v);CHKERRQ(ierr); ierr = VecAssemblyEnd(v);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the solver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create matrix function solver context */ ierr = MFNCreate(PETSC_COMM_WORLD,&mfn);CHKERRQ(ierr); /* Set operator matrix, the function to compute, and other options */ ierr = MFNSetOperator(mfn,A);CHKERRQ(ierr); ierr = MFNSetFunction(mfn,SLEPC_FUNCTION_EXP);CHKERRQ(ierr); ierr = MFNSetTolerances(mfn,1e-07,PETSC_DEFAULT);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = MFNSetFromOptions(mfn);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the problem, y=exp(A)*v - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MFNSolve(mfn,v,y);CHKERRQ(ierr); ierr = MFNGetConvergedReason(mfn,&reason);CHKERRQ(ierr); if (reason!=MFN_CONVERGED_TOL) SETERRQ(PETSC_COMM_WORLD,1,"Solver did not converge"); ierr = VecNorm(y,NORM_2,&norm);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = MFNGetIterationNumber(mfn,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);CHKERRQ(ierr); ierr = MFNGetDimensions(mfn,&ncv);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Subspace dimension: %D\n",ncv);CHKERRQ(ierr); ierr = MFNGetTolerances(mfn,&tol,&maxit);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MFNGetScaleFactor(mfn,&t);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Computed vector at time t=%.4G has norm %G\n\n",PetscRealPart(t),norm);CHKERRQ(ierr); if (draw_sol) { ierr = PetscViewerDrawSetPause(PETSC_VIEWER_DRAW_WORLD,-1);CHKERRQ(ierr); ierr = VecView(y,PETSC_VIEWER_DRAW_WORLD);CHKERRQ(ierr); } /* Free work space */ ierr = MFNDestroy(&mfn);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); ierr = SlepcFinalize();CHKERRQ(ierr); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMarkovModel" /* Matrix generator for a Markov model of a random walk on a triangular grid. See ex5.c for additional details. */ PetscErrorCode MatMarkovModel(PetscInt m,Mat A) { const PetscReal cst = 0.5/(PetscReal)(m-1); PetscReal pd,pu; PetscInt Istart,Iend,i,j,jmax,ix=0; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=1;i<=m;i++) { jmax = m-i+1; for (j=1;j<=jmax;j++) { ix = ix + 1; if (ix-1Iend) continue; /* compute only owned rows */ if (j!=jmax) { pd = cst*(PetscReal)(i+j-1); /* north */ if (i==1) { ierr = MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);CHKERRQ(ierr); } /* east */ if (j==1) { ierr = MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);CHKERRQ(ierr); } else { ierr = MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);CHKERRQ(ierr); } } /* south */ pu = 0.5 - cst*(PetscReal)(i+j-3); if (j>1) { ierr = MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);CHKERRQ(ierr); } /* west */ if (i>1) { ierr = MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);CHKERRQ(ierr); } } } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/makefile0000644000175000017500000000300612211062077022345 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/mfn/examples/tutorials/ EXAMPLESC = ex23.c EXAMPLESF = MANSEC = MFN TESTEXAMPLES_C = ex23.PETSc runex23_1 ex23.rm include ${SLEPC_DIR}/conf/slepc_common ex23: ex23.o chkopts -${CLINKER} -o ex23 ex23.o ${SLEPC_LIB} ${RM} ex23.o #------------------------------------------------------------------------------------ runex23_1: -@${MPIEXEC} -np 1 ./ex23 -mfn_scale 2 > ex23_1.tmp 2>&1; \ if (${DIFF} output/ex23_1.out ex23_1.tmp) then true; \ else echo "Possible problem with ex23_1, diffs above"; fi; \ ${RM} -f ex23_1.tmp slepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/makefile.html0000644000175000017500000000505612211062077023317 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/mfn/examples/tutorials/
EXAMPLESC  = ex23.c
EXAMPLESF  =
MANSEC     = MFN

TESTEXAMPLES_C = ex23.PETSc runex23_1 ex23.rm

include ${SLEPC_DIR}/conf/slepc_common

ex23: ex23.o chkopts
	-${CLINKER} -o ex23 ex23.o ${SLEPC_LIB}
	${RM} ex23.o

#------------------------------------------------------------------------------------

runex23_1:
	-@${MPIEXEC} -np 1 ./ex23 -mfn_scale 2 > ex23_1.tmp 2>&1; \
	   if (${DIFF} output/ex23_1.out ex23_1.tmp) then true; \
	   else echo "Possible problem with ex23_1, diffs above"; fi; \
	   ${RM} -f ex23_1.tmp

slepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/index.html0000644000175000017500000000127012211062077022643 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

ex23.c: Computes exp(A)*v for a matrix associated with a Markov model
makefile
slepc-3.4.2.dfsg.orig/src/mfn/examples/tutorials/ex23.c.html0000644000175000017500000003316712211062077022550 0ustar gladkgladk

Actual source code: ex23.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Computes exp(A)*v for a matrix associated with a Markov model.\n\n"
 23:   "The command line options are:\n"
 24:   "  -m <m>, where <m> = number of grid subdivisions in each dimension.\n\n";

 26: #include <slepcmfn.h>

 28: /*
 29:    User-defined routines
 30: */
 31: PetscErrorCode MatMarkovModel(PetscInt m,Mat A);

 35: int main(int argc,char **argv)
 36: {
 37:   Mat                A;           /* problem matrix */
 38:   MFN                mfn;
 39:   PetscReal          tol,norm;
 40:   PetscScalar        t;
 41:   Vec                v,y;
 42:   PetscInt           N,m=15,ncv,maxit,its;
 43:   PetscErrorCode     ierr;
 44:   PetscBool          draw_sol;
 45:   MFNConvergedReason reason;

 47:   SlepcInitialize(&argc,&argv,(char*)0,help);

 49:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 50:   N = m*(m+1)/2;
 51:   PetscPrintf(PETSC_COMM_WORLD,"\nMarkov y=exp(t*A)*e_1, N=%D (m=%D)\n\n",N,m);

 53:   PetscOptionsHasName(PETSC_NULL,"-draw_sol",&draw_sol);

 55:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 56:             Compute the transition probability matrix, A
 57:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 59:   MatCreate(PETSC_COMM_WORLD,&A);
 60:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 61:   MatSetFromOptions(A);
 62:   MatSetUp(A);
 63:   MatMarkovModel(m,A);

 65:   /* set v = e_1 */
 66:   MatGetVecs(A,PETSC_NULL,&y);
 67:   MatGetVecs(A,PETSC_NULL,&v);
 68:   VecSetValue(v,1,1.0,INSERT_VALUES);
 69:   VecAssemblyBegin(v);
 70:   VecAssemblyEnd(v);

 72:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 73:                 Create the solver and set various options
 74:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 75:   /* 
 76:      Create matrix function solver context
 77:   */
 78:   MFNCreate(PETSC_COMM_WORLD,&mfn);

 80:   /* 
 81:      Set operator matrix, the function to compute, and other options
 82:   */
 83:   MFNSetOperator(mfn,A);
 84:   MFNSetFunction(mfn,SLEPC_FUNCTION_EXP);
 85:   MFNSetTolerances(mfn,1e-07,PETSC_DEFAULT);

 87:   /*
 88:      Set solver parameters at runtime
 89:   */
 90:   MFNSetFromOptions(mfn);

 92:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 93:                       Solve the problem, y=exp(A)*v
 94:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 96:   MFNSolve(mfn,v,y);
 97:   MFNGetConvergedReason(mfn,&reason);
 98:   if (reason!=MFN_CONVERGED_TOL) SETERRQ(PETSC_COMM_WORLD,1,"Solver did not converge");
 99:   VecNorm(y,NORM_2,&norm);
100: 
101:   /*
102:      Optional: Get some information from the solver and display it
103:   */
104:   MFNGetIterationNumber(mfn,&its);
105:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);
106:   MFNGetDimensions(mfn,&ncv);
107:   PetscPrintf(PETSC_COMM_WORLD," Subspace dimension: %D\n",ncv);
108:   MFNGetTolerances(mfn,&tol,&maxit);
109:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

111:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
112:                     Display solution and clean up
113:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
114:   MFNGetScaleFactor(mfn,&t);
115:   PetscPrintf(PETSC_COMM_WORLD," Computed vector at time t=%.4G has norm %G\n\n",PetscRealPart(t),norm);
116:   if (draw_sol) {
117:     PetscViewerDrawSetPause(PETSC_VIEWER_DRAW_WORLD,-1);
118:     VecView(y,PETSC_VIEWER_DRAW_WORLD);
119:   }

121:   /* 
122:      Free work space
123:   */
124:   MFNDestroy(&mfn);
125:   MatDestroy(&A);
126:   VecDestroy(&v);
127:   VecDestroy(&y);
128:   SlepcFinalize();
129:   return 0;
130: }

134: /*
135:     Matrix generator for a Markov model of a random walk on a triangular grid.
136:     See ex5.c for additional details.
137: */
138: PetscErrorCode MatMarkovModel(PetscInt m,Mat A)
139: {
140:   const PetscReal cst = 0.5/(PetscReal)(m-1);
141:   PetscReal       pd,pu;
142:   PetscInt        Istart,Iend,i,j,jmax,ix=0;
143:   PetscErrorCode  ierr;

146:   MatGetOwnershipRange(A,&Istart,&Iend);
147:   for (i=1;i<=m;i++) {
148:     jmax = m-i+1;
149:     for (j=1;j<=jmax;j++) {
150:       ix = ix + 1;
151:       if (ix-1<Istart || ix>Iend) continue;  /* compute only owned rows */
152:       if (j!=jmax) {
153:         pd = cst*(PetscReal)(i+j-1);
154:         /* north */
155:         if (i==1) {
156:           MatSetValue(A,ix-1,ix,2*pd,INSERT_VALUES);
157:         } else {
158:           MatSetValue(A,ix-1,ix,pd,INSERT_VALUES);
159:         }
160:         /* east */
161:         if (j==1) {
162:           MatSetValue(A,ix-1,ix+jmax-1,2*pd,INSERT_VALUES);
163:         } else {
164:           MatSetValue(A,ix-1,ix+jmax-1,pd,INSERT_VALUES);
165:         }
166:       }
167:       /* south */
168:       pu = 0.5 - cst*(PetscReal)(i+j-3);
169:       if (j>1) {
170:         MatSetValue(A,ix-1,ix-2,pu,INSERT_VALUES);
171:       }
172:       /* west */
173:       if (i>1) {
174:         MatSetValue(A,ix-1,ix-jmax-2,pu,INSERT_VALUES);
175:       }
176:     }
177:   }
178:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
179:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
180:   return(0);
181: }

slepc-3.4.2.dfsg.orig/src/mfn/examples/makefile0000644000175000017500000000200512211062077020315 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/mfn/examples/ DIRS = tests tutorials include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/examples/makefile.html0000644000175000017500000000351412211062077021266 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/mfn/examples/
DIRS     = tests tutorials

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/mfn/examples/tests/0000755000175000017500000000000012214143515017762 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/examples/tests/makefile0000644000175000017500000000216412211062077021465 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/mfn/examples/tests/ EXAMPLESC = EXAMPLESF = MANSEC = MFN TESTS = TESTEXAMPLES_C = include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/examples/tests/makefile.html0000644000175000017500000000370212211062077022427 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/mfn/examples/tests/
EXAMPLESC  =
EXAMPLESF  =
MANSEC     = MFN
TESTS      =

TESTEXAMPLES_C           =

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/mfn/examples/tests/index.html0000644000175000017500000000112612211062077021757 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

makefile
slepc-3.4.2.dfsg.orig/src/mfn/examples/index.html0000644000175000017500000000040012211062077020607 0ustar gladkgladk Generic SLEPc Manual Pages

tests/
tutorials/
makefile
slepc-3.4.2.dfsg.orig/src/mfn/impls/0000755000175000017500000000000012214143515016126 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/impls/krylov/0000755000175000017500000000000012214143515017454 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/impls/krylov/makefile0000644000175000017500000000214412211062077021155 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = mfnkrylov.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = MFN LOCDIR = src/mfn/impls/krylov/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/impls/krylov/mfnkrylov.c.html0000644000175000017500000003717112211062077022623 0ustar gladkgladk

Actual source code: mfnkrylov.c

  1: /*

  3:    SLEPc matrix function solver: "krylov"

  5:    Method: Arnoldi

  7:    Algorithm:

  9:        Single-vector Arnoldi method to build a Krylov subspace, then
 10:        compute f(B) on the projected matrix B.

 12:    References:

 14:        [1] R. Sidje, "Expokit: a software package for computing matrix
 15:            exponentials", ACM Trans. Math. Softw. 24(1):130-156, 1998.

 17:    Last update: Feb 2013

 19:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 21:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 23:    This file is part of SLEPc.

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

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

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

 39: #include <slepc-private/mfnimpl.h>                /*I "slepcmfn.h" I*/

 43: PetscErrorCode MFNSetUp_Krylov(MFN mfn)
 44: {
 45:   PetscErrorCode  ierr;

 48:   if (!mfn->ncv) mfn->ncv = PetscMin(30,mfn->n);
 49:   if (!mfn->max_it) mfn->max_it = PetscMax(100,2*mfn->n/mfn->ncv);
 50:   VecDuplicateVecs(mfn->t,mfn->ncv+1,&mfn->V);
 51:   PetscLogObjectParents(mfn,mfn->ncv+1,mfn->V);
 52:   mfn->allocated_ncv = mfn->ncv+1;
 53:   DSAllocate(mfn->ds,mfn->ncv+2);
 54:   DSSetType(mfn->ds,DSNHEP);
 55:   return(0);
 56: }

 60: static PetscErrorCode MFNBasicArnoldi(MFN mfn,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)
 61: {
 63:   PetscInt       j,m = *M;
 64:   PetscReal      norm;

 67:   for (j=k;j<m-1;j++) {
 68:     MatMult(mfn->A,V[j],V[j+1]);
 69:     IPOrthogonalize(mfn->ip,0,NULL,j+1,NULL,V,V[j+1],H+ldh*j,&norm,breakdown);
 70:     H[j+1+ldh*j] = norm;
 71:     if (*breakdown) {
 72:       *M = j+1;
 73:       *beta = norm;
 74:       return(0);
 75:     } else {
 76:       VecScale(V[j+1],1/norm);
 77:     }
 78:   }
 79:   MatMult(mfn->A,V[m-1],f);
 80:   IPOrthogonalize(mfn->ip,0,NULL,m,NULL,V,f,H+ldh*(m-1),beta,NULL);
 81:   return(0);
 82: }

 86: PetscErrorCode MFNSolve_Krylov(MFN mfn,Vec b,Vec x)
 87: {
 89:   PetscInt       mxstep,mxrej,m,mb,ld,i,j,ireject,mx,k1;
 90:   Vec            r;
 91:   PetscScalar    *H,*B,*F,*betaF;
 92:   PetscReal      anorm,normb,avnorm,tol,err_loc,rndoff;
 93:   PetscReal      t,t_out,t_new,t_now,t_step;
 94:   PetscReal      xm,fact,s,sgn,p1,p2;
 95:   PetscReal      beta,beta2,gamma,delta;
 96:   PetscBool      breakdown;

 99:   m   = mfn->ncv;
100:   tol = mfn->tol;
101:   mxstep = mfn->max_it;
102:   mxrej = 10;
103:   gamma = 0.9;
104:   delta = 1.2;
105:   mb    = m;
106:   t     = PetscRealPart(mfn->sfactor);
107:   t_out = PetscAbsReal(t);
108:   t_new = 0.0;
109:   t_now = 0.0;
110:   MatNorm(mfn->A,NORM_INFINITY,&anorm);
111:   rndoff = anorm*PETSC_MACHINE_EPSILON;

113:   k1 = 2;
114:   xm = 1.0/(PetscReal)m;
115:   VecNorm(b,NORM_2,&normb);
116:   beta = normb;
117:   fact = PetscPowRealInt((m+1)/2.72,m+1)*PetscSqrtReal(2*PETSC_PI*(m+1));
118:   t_new = (1.0/anorm)*PetscPowReal((fact*tol)/(4.0*beta*anorm),xm);
119:   s = PetscPowReal(10,floor(log10(t_new))-1);
120:   t_new = ceil(t_new/s)*s;
121:   sgn = PetscSign(t);

123:   PetscMalloc((m+1)*sizeof(PetscScalar),&betaF);
124:   VecDuplicate(mfn->V[0],&r);
125:   VecCopy(b,x);
126:   DSGetLeadingDimension(mfn->ds,&ld);
127:   PetscMalloc(ld*ld*sizeof(PetscScalar),&B);

129:   while (mfn->reason == MFN_CONVERGED_ITERATING) {
130:     mfn->its++;
131:     if (PetscIsInfOrNanReal(t_new)) t_new = PETSC_MAX_REAL;
132:     t_step = PetscMin(t_out-t_now,t_new);

134:     VecCopy(x,mfn->V[0]);
135:     VecScale(mfn->V[0],1.0/beta);
136:     DSGetArray(mfn->ds,DS_MAT_A,&H);
137:     MFNBasicArnoldi(mfn,H,ld,mfn->V,0,&mb,r,&beta2,&breakdown);
138:     H[mb+(mb-1)*ld] = beta2;
139:     VecScale(r,1.0/beta2);
140:     VecCopy(r,mfn->V[m]);
141:     if (breakdown) {
142:       k1 = 0;
143:       t_step = t_out-t_now;
144:     }
145:     if (k1!=0) {
146:       H[m+1+ld*m] = 1.0;
147:       MatMult(mfn->A,mfn->V[m],r);
148:       VecNorm(r,NORM_2,&avnorm);
149:     }
150:     PetscMemcpy(B,H,ld*ld*sizeof(PetscScalar));
151:     DSRestoreArray(mfn->ds,DS_MAT_A,&H);

153:     ireject = 0;
154:     while (ireject <= mxrej) {
155:       mx = mb + k1;
156:       DSSetDimensions(mfn->ds,mx,0,0,0);
157:       DSGetArray(mfn->ds,DS_MAT_A,&H);
158:       for (i=0;i<mx;i++) {
159:         for (j=0;j<mx;j++) {
160:           H[i+j*ld] = sgn*B[i+j*ld]*t_step;
161:         }
162:       }
163:       DSRestoreArray(mfn->ds,DS_MAT_A,&H);
164:       DSComputeFunction(mfn->ds,mfn->function);

166:       if (k1==0) {
167:         err_loc = tol;
168:         break;
169:       } else {
170:         DSGetArray(mfn->ds,DS_MAT_F,&F);
171:         p1 = PetscAbsScalar(beta*F[m]);
172:         p2 = PetscAbsScalar(beta*F[m+1]*avnorm);
173:         DSRestoreArray(mfn->ds,DS_MAT_F,&F);
174:         if (p1 > 10*p2) {
175:           err_loc = p2;
176:           xm = 1.0/(PetscReal)m;
177:         } else if (p1 > p2) {
178:           err_loc = (p1*p2)/(p1-p2);
179:           xm = 1.0/(PetscReal)m;
180:         } else {
181:           err_loc = p1;
182:           xm = 1.0/(PetscReal)(m-1);
183:         }
184:       }
185:       if (err_loc <= delta*t_step*tol) break;
186:       else {
187:         t_step = gamma*t_step*PetscPowReal(t_step*tol/err_loc,xm);
188:         s = PetscPowReal(10,floor(log10(t_step))-1);
189:         t_step = ceil(t_step/s)*s;
190:         ireject = ireject+1;
191:       }
192:     }

194:     mx = mb + PetscMax(0,k1-1);
195:     DSGetArray(mfn->ds,DS_MAT_F,&F);
196:     for (j=0;j<mx;j++) betaF[j] = beta*F[j];
197:     DSRestoreArray(mfn->ds,DS_MAT_F,&F);
198:     VecSet(x,0.0);
199:     VecMAXPY(x,mx,betaF,mfn->V);
200:     VecNorm(x,NORM_2,&beta);

202:     t_now = t_now+t_step;
203:     if (t_now>=t_out) mfn->reason = MFN_CONVERGED_TOL;
204:     else {
205:       t_new = gamma*t_step*PetscPowReal((t_step*tol)/err_loc,xm);
206:       s = PetscPowReal(10,floor(log10(t_new))-1);
207:       t_new = ceil(t_new/s)*s;
208:     }
209:     err_loc = PetscMax(err_loc,rndoff);
210:     if (mfn->its==mxstep) mfn->reason = MFN_DIVERGED_ITS;
211:     MFNMonitor(mfn,mfn->its,t_now);
212:   }

214:   VecDestroy(&r);
215:   PetscFree(betaF);
216:   PetscFree(B);
217:   return(0);
218: }

222: PetscErrorCode MFNReset_Krylov(MFN mfn)
223: {
224:   PetscErrorCode  ierr;

227:   if (mfn->allocated_ncv > 0) {
228:     VecDestroyVecs(mfn->allocated_ncv,&mfn->V);
229:     mfn->allocated_ncv = 0;
230:   }
231:   return(0);
232: }

236: PETSC_EXTERN PetscErrorCode MFNCreate_Krylov(MFN mfn)
237: {
239:   mfn->ops->solve          = MFNSolve_Krylov;
240:   mfn->ops->setup          = MFNSetUp_Krylov;
241:   mfn->ops->reset          = MFNReset_Krylov;
242:   return(0);
243: }
slepc-3.4.2.dfsg.orig/src/mfn/impls/krylov/makefile.html0000644000175000017500000000374012211062077022123 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = mfnkrylov.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = MFN
LOCDIR   = src/mfn/impls/krylov/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/mfn/impls/krylov/index.html0000644000175000017500000000120512211062077021447 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

mfnkrylov.c
makefile
slepc-3.4.2.dfsg.orig/src/mfn/impls/krylov/mfnkrylov.c0000644000175000017500000001724412211062077021657 0ustar gladkgladk/* SLEPc matrix function solver: "krylov" Method: Arnoldi Algorithm: Single-vector Arnoldi method to build a Krylov subspace, then compute f(B) on the projected matrix B. References: [1] R. Sidje, "Expokit: a software package for computing matrix exponentials", ACM Trans. Math. Softw. 24(1):130-156, 1998. Last update: Feb 2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ #undef __FUNCT__ #define __FUNCT__ "MFNSetUp_Krylov" PetscErrorCode MFNSetUp_Krylov(MFN mfn) { PetscErrorCode ierr; PetscFunctionBegin; if (!mfn->ncv) mfn->ncv = PetscMin(30,mfn->n); if (!mfn->max_it) mfn->max_it = PetscMax(100,2*mfn->n/mfn->ncv); ierr = VecDuplicateVecs(mfn->t,mfn->ncv+1,&mfn->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(mfn,mfn->ncv+1,mfn->V);CHKERRQ(ierr); mfn->allocated_ncv = mfn->ncv+1; ierr = DSAllocate(mfn->ds,mfn->ncv+2);CHKERRQ(ierr); ierr = DSSetType(mfn->ds,DSNHEP);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNBasicArnoldi" static PetscErrorCode MFNBasicArnoldi(MFN mfn,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown) { PetscErrorCode ierr; PetscInt j,m = *M; PetscReal norm; PetscFunctionBegin; for (j=k;jA,V[j],V[j+1]);CHKERRQ(ierr); ierr = IPOrthogonalize(mfn->ip,0,NULL,j+1,NULL,V,V[j+1],H+ldh*j,&norm,breakdown);CHKERRQ(ierr); H[j+1+ldh*j] = norm; if (*breakdown) { *M = j+1; *beta = norm; PetscFunctionReturn(0); } else { ierr = VecScale(V[j+1],1/norm);CHKERRQ(ierr); } } ierr = MatMult(mfn->A,V[m-1],f);CHKERRQ(ierr); ierr = IPOrthogonalize(mfn->ip,0,NULL,m,NULL,V,f,H+ldh*(m-1),beta,NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSolve_Krylov" PetscErrorCode MFNSolve_Krylov(MFN mfn,Vec b,Vec x) { PetscErrorCode ierr; PetscInt mxstep,mxrej,m,mb,ld,i,j,ireject,mx,k1; Vec r; PetscScalar *H,*B,*F,*betaF; PetscReal anorm,normb,avnorm,tol,err_loc,rndoff; PetscReal t,t_out,t_new,t_now,t_step; PetscReal xm,fact,s,sgn,p1,p2; PetscReal beta,beta2,gamma,delta; PetscBool breakdown; PetscFunctionBegin; m = mfn->ncv; tol = mfn->tol; mxstep = mfn->max_it; mxrej = 10; gamma = 0.9; delta = 1.2; mb = m; t = PetscRealPart(mfn->sfactor); t_out = PetscAbsReal(t); t_new = 0.0; t_now = 0.0; ierr = MatNorm(mfn->A,NORM_INFINITY,&anorm);CHKERRQ(ierr); rndoff = anorm*PETSC_MACHINE_EPSILON; k1 = 2; xm = 1.0/(PetscReal)m; ierr = VecNorm(b,NORM_2,&normb);CHKERRQ(ierr); beta = normb; fact = PetscPowRealInt((m+1)/2.72,m+1)*PetscSqrtReal(2*PETSC_PI*(m+1)); t_new = (1.0/anorm)*PetscPowReal((fact*tol)/(4.0*beta*anorm),xm); s = PetscPowReal(10,floor(log10(t_new))-1); t_new = ceil(t_new/s)*s; sgn = PetscSign(t); ierr = PetscMalloc((m+1)*sizeof(PetscScalar),&betaF);CHKERRQ(ierr); ierr = VecDuplicate(mfn->V[0],&r);CHKERRQ(ierr); ierr = VecCopy(b,x);CHKERRQ(ierr); ierr = DSGetLeadingDimension(mfn->ds,&ld);CHKERRQ(ierr); ierr = PetscMalloc(ld*ld*sizeof(PetscScalar),&B);CHKERRQ(ierr); while (mfn->reason == MFN_CONVERGED_ITERATING) { mfn->its++; if (PetscIsInfOrNanReal(t_new)) t_new = PETSC_MAX_REAL; t_step = PetscMin(t_out-t_now,t_new); ierr = VecCopy(x,mfn->V[0]);CHKERRQ(ierr); ierr = VecScale(mfn->V[0],1.0/beta);CHKERRQ(ierr); ierr = DSGetArray(mfn->ds,DS_MAT_A,&H);CHKERRQ(ierr); ierr = MFNBasicArnoldi(mfn,H,ld,mfn->V,0,&mb,r,&beta2,&breakdown);CHKERRQ(ierr); H[mb+(mb-1)*ld] = beta2; ierr = VecScale(r,1.0/beta2);CHKERRQ(ierr); ierr = VecCopy(r,mfn->V[m]);CHKERRQ(ierr); if (breakdown) { k1 = 0; t_step = t_out-t_now; } if (k1!=0) { H[m+1+ld*m] = 1.0; ierr = MatMult(mfn->A,mfn->V[m],r);CHKERRQ(ierr); ierr = VecNorm(r,NORM_2,&avnorm);CHKERRQ(ierr); } ierr = PetscMemcpy(B,H,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); ierr = DSRestoreArray(mfn->ds,DS_MAT_A,&H);CHKERRQ(ierr); ireject = 0; while (ireject <= mxrej) { mx = mb + k1; ierr = DSSetDimensions(mfn->ds,mx,0,0,0);CHKERRQ(ierr); ierr = DSGetArray(mfn->ds,DS_MAT_A,&H);CHKERRQ(ierr); for (i=0;ids,DS_MAT_A,&H);CHKERRQ(ierr); ierr = DSComputeFunction(mfn->ds,mfn->function);CHKERRQ(ierr); if (k1==0) { err_loc = tol; break; } else { ierr = DSGetArray(mfn->ds,DS_MAT_F,&F);CHKERRQ(ierr); p1 = PetscAbsScalar(beta*F[m]); p2 = PetscAbsScalar(beta*F[m+1]*avnorm); ierr = DSRestoreArray(mfn->ds,DS_MAT_F,&F);CHKERRQ(ierr); if (p1 > 10*p2) { err_loc = p2; xm = 1.0/(PetscReal)m; } else if (p1 > p2) { err_loc = (p1*p2)/(p1-p2); xm = 1.0/(PetscReal)m; } else { err_loc = p1; xm = 1.0/(PetscReal)(m-1); } } if (err_loc <= delta*t_step*tol) break; else { t_step = gamma*t_step*PetscPowReal(t_step*tol/err_loc,xm); s = PetscPowReal(10,floor(log10(t_step))-1); t_step = ceil(t_step/s)*s; ireject = ireject+1; } } mx = mb + PetscMax(0,k1-1); ierr = DSGetArray(mfn->ds,DS_MAT_F,&F);CHKERRQ(ierr); for (j=0;jds,DS_MAT_F,&F);CHKERRQ(ierr); ierr = VecSet(x,0.0);CHKERRQ(ierr); ierr = VecMAXPY(x,mx,betaF,mfn->V);CHKERRQ(ierr); ierr = VecNorm(x,NORM_2,&beta);CHKERRQ(ierr); t_now = t_now+t_step; if (t_now>=t_out) mfn->reason = MFN_CONVERGED_TOL; else { t_new = gamma*t_step*PetscPowReal((t_step*tol)/err_loc,xm); s = PetscPowReal(10,floor(log10(t_new))-1); t_new = ceil(t_new/s)*s; } err_loc = PetscMax(err_loc,rndoff); if (mfn->its==mxstep) mfn->reason = MFN_DIVERGED_ITS; ierr = MFNMonitor(mfn,mfn->its,t_now);CHKERRQ(ierr); } ierr = VecDestroy(&r);CHKERRQ(ierr); ierr = PetscFree(betaF);CHKERRQ(ierr); ierr = PetscFree(B);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNReset_Krylov" PetscErrorCode MFNReset_Krylov(MFN mfn) { PetscErrorCode ierr; PetscFunctionBegin; if (mfn->allocated_ncv > 0) { ierr = VecDestroyVecs(mfn->allocated_ncv,&mfn->V);CHKERRQ(ierr); mfn->allocated_ncv = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNCreate_Krylov" PETSC_EXTERN PetscErrorCode MFNCreate_Krylov(MFN mfn) { PetscFunctionBegin; mfn->ops->solve = MFNSolve_Krylov; mfn->ops->setup = MFNSetUp_Krylov; mfn->ops->reset = MFNReset_Krylov; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/impls/makefile0000644000175000017500000000204112211062077017623 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = krylov LOCDIR = src/mfn/impls/ MANSEC = MFN include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/impls/makefile.html0000644000175000017500000000363512211062077020600 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = krylov
LOCDIR   = src/mfn/impls/
MANSEC   = MFN

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/mfn/impls/index.html0000644000175000017500000000117012211062077020122 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

krylov/
makefile
slepc-3.4.2.dfsg.orig/src/mfn/makefile0000644000175000017500000000214312211062077016502 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/mfnimpl.h ../../include/slepcmfn.h DIRS = interface impls examples LOCDIR = src/mfn/ MANSEC = MFN include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/makefile.html0000644000175000017500000000373712211062077017457 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/mfnimpl.h ../../include/slepcmfn.h
DIRS     = interface impls examples
LOCDIR   = src/mfn/
MANSEC   = MFN

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/mfn/interface/0000755000175000017500000000000012214143515016742 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/interface/mfnregis.c.html0000644000175000017500000000713412211062077021670 0ustar gladkgladk
Actual source code: mfnregis.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/mfnimpl.h>  /*I "slepcmfn.h" I*/

 24: PETSC_EXTERN PetscErrorCode MFNCreate_Krylov(MFN);

 28: /*@C
 29:   MFNRegisterAll - Registers all the matrix functions in the MFN package.

 31:   Not Collective

 33:   Level: advanced

 35: .seealso:  MFNRegister()
 36: @*/
 37: PetscErrorCode MFNRegisterAll(void)
 38: {

 42:   MFNRegisterAllCalled = PETSC_TRUE;
 43:   MFNRegister(MFNKRYLOV,MFNCreate_Krylov);
 44:   return(0);
 45: }
slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnopts.c.html0000644000175000017500000012355212211062077021547 0ustar gladkgladk
Actual source code: mfnopts.c

  1: /*
  2:       MFN routines related to options that can be set via the command-line
  3:       or procedurally.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/mfnimpl.h>   /*I "slepcmfn.h" I*/

 29: /*@
 30:    MFNSetFromOptions - Sets MFN options from the options database.
 31:    This routine must be called before MFNSetUp() if the user is to be
 32:    allowed to set the solver type.

 34:    Collective on MFN

 36:    Input Parameters:
 37: .  mfn - the matrix function context

 39:    Notes:
 40:    To see all options, run your program with the -help option.

 42:    Level: beginner
 43: @*/
 44: PetscErrorCode MFNSetFromOptions(MFN mfn)
 45: {
 46:   PetscErrorCode   ierr;
 47:   char             type[256],monfilename[PETSC_MAX_PATH_LEN];
 48:   PetscBool        flg;
 49:   PetscReal        r;
 50:   PetscInt         i;
 51:   PetscViewer      monviewer;

 55:   if (!MFNRegisterAllCalled) { MFNRegisterAll(); }
 56:   PetscObjectOptionsBegin((PetscObject)mfn);
 57:     PetscOptionsList("-mfn_type","Matrix Function method","MFNSetType",MFNList,(char*)(((PetscObject)mfn)->type_name?((PetscObject)mfn)->type_name:MFNKRYLOV),type,256,&flg);
 58:     if (flg) {
 59:       MFNSetType(mfn,type);
 60:     }
 61:     /*
 62:       Set the type if it was never set.
 63:     */
 64:     if (!((PetscObject)mfn)->type_name) {
 65:       MFNSetType(mfn,MFNKRYLOV);
 66:     }

 68:     PetscOptionsBoolGroupBegin("-mfn_exp","matrix exponential","MFNSetFunction",&flg);
 69:     if (flg) {
 70:       MFNSetFunction(mfn,SLEPC_FUNCTION_EXP);
 71:     }

 73:     PetscOptionsScalar("-mfn_scale","Scale factor","MFNSetScaleFactor",mfn->sfactor,&mfn->sfactor,NULL);

 75:     r = i = 0;
 76:     PetscOptionsInt("-mfn_max_it","Maximum number of iterations","MFNSetTolerances",mfn->max_it,&i,NULL);
 77:     PetscOptionsReal("-mfn_tol","Tolerance","MFNSetTolerances",mfn->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:mfn->tol,&r,NULL);
 78:     MFNSetTolerances(mfn,r,i);

 80:     i = 0;
 81:     PetscOptionsInt("-mfn_ncv","Number of basis vectors","MFNSetDimensions",mfn->ncv,&i,NULL);
 82:     MFNSetDimensions(mfn,i);

 84:     PetscOptionsBool("-mfn_error_if_not_converged","Generate error if solver does not converge","MFNSetErrorIfNotConverged",mfn->errorifnotconverged,&mfn->errorifnotconverged,NULL);

 86:     /* -----------------------------------------------------------------------*/
 87:     /*
 88:       Cancels all monitors hardwired into code before call to MFNSetFromOptions()
 89:     */
 90:     flg  = PETSC_FALSE;
 91:     PetscOptionsBool("-mfn_monitor_cancel","Remove any hardwired monitor routines","MFNMonitorCancel",flg,&flg,NULL);
 92:     if (flg) {
 93:       MFNMonitorCancel(mfn);
 94:     }
 95:     /*
 96:       Prints error estimate at each iteration
 97:     */
 98:     PetscOptionsString("-mfn_monitor","Monitor error estimate","MFNMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
 99:     if (flg) {
100:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)mfn),monfilename,&monviewer);
101:       MFNMonitorSet(mfn,MFNMonitorDefault,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
102:     }
103:     flg = PETSC_FALSE;
104:     PetscOptionsBool("-mfn_monitor_lg","Monitor error estimate graphically","MFNMonitorSet",flg,&flg,NULL);
105:     if (flg) {
106:       MFNMonitorSet(mfn,MFNMonitorLG,NULL,NULL);
107:     }
108:   /* -----------------------------------------------------------------------*/

110:     PetscOptionsName("-mfn_view","Print detailed information on solver used","MFNView",0);

112:     if (mfn->ops->setfromoptions) {
113:       (*mfn->ops->setfromoptions)(mfn);
114:     }
115:     PetscObjectProcessOptionsHandlers((PetscObject)mfn);
116:   PetscOptionsEnd();

118:   if (!mfn->ip) { MFNGetIP(mfn,&mfn->ip); }
119:   IPSetFromOptions(mfn->ip);
120:   if (!mfn->ds) { MFNGetDS(mfn,&mfn->ds); }
121:   DSSetFromOptions(mfn->ds);
122:   PetscRandomSetFromOptions(mfn->rand);
123:   return(0);
124: }

128: /*@
129:    MFNGetTolerances - Gets the tolerance and maximum iteration count used
130:    by the MFN convergence tests.

132:    Not Collective

134:    Input Parameter:
135: .  mfn - the matrix function context

137:    Output Parameters:
138: +  tol - the convergence tolerance
139: -  maxits - maximum number of iterations

141:    Notes:
142:    The user can specify NULL for any parameter that is not needed.

144:    Level: intermediate

146: .seealso: MFNSetTolerances()
147: @*/
148: PetscErrorCode MFNGetTolerances(MFN mfn,PetscReal *tol,PetscInt *maxits)
149: {
152:   if (tol)    *tol    = mfn->tol;
153:   if (maxits) *maxits = mfn->max_it;
154:   return(0);
155: }

159: /*@
160:    MFNSetTolerances - Sets the tolerance and maximum iteration count used
161:    by the MFN convergence tests.

163:    Logically Collective on MFN

165:    Input Parameters:
166: +  mfn - the matrix function context
167: .  tol - the convergence tolerance
168: -  maxits - maximum number of iterations to use

170:    Options Database Keys:
171: +  -mfn_tol <tol> - Sets the convergence tolerance
172: -  -mfn_max_it <maxits> - Sets the maximum number of iterations allowed

174:    Notes:
175:    Pass 0 for an argument that need not be changed.

177:    Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
178:    dependent on the solution method.

180:    Level: intermediate

182: .seealso: MFNGetTolerances()
183: @*/
184: PetscErrorCode MFNSetTolerances(MFN mfn,PetscReal tol,PetscInt maxits)
185: {
190:   if (tol) {
191:     if (tol == PETSC_DEFAULT) {
192:       mfn->tol = PETSC_DEFAULT;
193:     } else {
194:       if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
195:       mfn->tol = tol;
196:     }
197:   }
198:   if (maxits) {
199:     if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
200:       mfn->max_it = 0;
201:       mfn->setupcalled = 0;
202:     } else {
203:       if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
204:       mfn->max_it = maxits;
205:     }
206:   }
207:   return(0);
208: }

212: /*@
213:    MFNGetDimensions - Gets the dimension of the subspace used by the solver.

215:    Not Collective

217:    Input Parameter:
218: .  mfn - the matrix function context

220:    Output Parameter:
221: .  ncv - the maximum dimension of the subspace to be used by the solver

223:    Level: intermediate

225: .seealso: MFNSetDimensions()
226: @*/
227: PetscErrorCode MFNGetDimensions(MFN mfn,PetscInt *ncv)
228: {
232:   *ncv = mfn->ncv;
233:   return(0);
234: }

238: /*@
239:    MFNSetDimensions - Sets the dimension of the subspace to be used by the solver.

241:    Logically Collective on MFN

243:    Input Parameters:
244: +  mfn - the matrix function context
245: -  ncv - the maximum dimension of the subspace to be used by the solver

247:    Options Database Keys:
248: .  -mfn_ncv <ncv> - Sets the dimension of the subspace

250:    Notes:
251:    Use PETSC_DECIDE for ncv to assign a reasonably good value, which is
252:    dependent on the solution method.

254:    Level: intermediate

256: .seealso: MFNGetDimensions()
257: @*/
258: PetscErrorCode MFNSetDimensions(MFN mfn,PetscInt ncv)
259: {
263:   if (ncv) {
264:     if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
265:       mfn->ncv = 0;
266:     } else {
267:       if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
268:       mfn->ncv = ncv;
269:     }
270:     mfn->setupcalled = 0;
271:   }
272:   return(0);
273: }

277: /*@
278:    MFNSetFunction - Specifies the function to be computed.

280:    Logically Collective on MFN

282:    Input Parameters:
283: +  mfn      - the matrix function context
284: -  fun      - a known function

286:    Options Database Keys:
287: .  -mfn_exp - matrix exponential

289:    Level: beginner

291: .seealso: MFNSetOperator(), MFNSetType(), MFNGetFunction(), SlepcFunction
292: @*/
293: PetscErrorCode MFNSetFunction(MFN mfn,SlepcFunction fun)
294: {
298:   switch (fun) {
299:     case SLEPC_FUNCTION_EXP:
300:       break;
301:     default:
302:       SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_WRONG,"Unknown function");
303:   }
304:   mfn->function = fun;
305:   return(0);
306: }

310: /*@C
311:    MFNGetFunction - Gets the function from the MFN object.

313:    Not Collective

315:    Input Parameter:
316: .  mfn - the matrix function context

318:    Output Parameter:
319: .  fun - function

321:    Level: intermediate

323: .seealso: MFNSetFunction(), SlepcFunction
324: @*/
325: PetscErrorCode MFNGetFunction(MFN mfn,SlepcFunction *fun)
326: {
330:   *fun = mfn->function;
331:   return(0);
332: }

336: /*@
337:    MFNSetScaleFactor - Sets the scale factor to multiply the matrix (the
338:    argument of the function).

340:    Logically Collective on MFN

342:    Input Parameters:
343: +  mfn   - the matrix function context
344: -  alpha - the scaling factor

346:    Options Database Keys:
347: .  -mfn_scale <alpha> - Sets the scaling factor

349:    Notes:
350:    The computed result is f(alpha*A)*b. The default is alpha=1.0.

352:    Level: intermediate

354: .seealso: MFNGetScaleFactor(), MFNSolve()
355: @*/
356: PetscErrorCode MFNSetScaleFactor(MFN mfn,PetscScalar alpha)
357: {
361:   mfn->sfactor = alpha;
362:   return(0);
363: }

367: /*@
368:    MFNGetScaleFactor - Gets the factor used for scaling the matrix.

370:    Not Collective

372:    Input Parameter:
373: .  mfn - the matrix function context

375:    Output Parameters:
376: .  alpha - the scaling factor

378:    Level: intermediate

380: .seealso: MFNSetScaleFactor(), MFNSolve()
381: @*/
382: PetscErrorCode MFNGetScaleFactor(MFN mfn,PetscScalar *alpha)
383: {
387:   *alpha = mfn->sfactor;
388:   return(0);
389: }

393: /*@
394:    MFNSetErrorIfNotConverged - Causes MFNSolve() to generate an error if the
395:    solver has not converged.

397:    Logically Collective on MFN

399:    Input Parameters:
400: +  mfn - the matrix function context
401: -  flg - PETSC_TRUE indicates you want the error generated

403:    Options Database Keys:
404: .  -mfn_error_if_not_converged - this takes an optional truth value (0/1/no/yes/true/false)

406:    Level: intermediate

408:    Note:
409:    Normally SLEPc continues if the solver fails to converge, you can call
410:    MFNGetConvergedReason() after a MFNSolve() to determine if it has converged.

412: .seealso: MFNGetErrorIfNotConverged()
413: @*/
414: PetscErrorCode MFNSetErrorIfNotConverged(MFN mfn,PetscBool flg)
415: {
419:   mfn->errorifnotconverged = flg;
420:   return(0);
421: }

425: /*@
426:    MFNGetErrorIfNotConverged - Return a flag indicating whether MFNSolve() will
427:    generate an error if the solver does not converge.

429:    Not Collective

431:    Input Parameter:
432: .  mfn - the matrix function context

434:    Output Parameter:
435: .  flag - PETSC_TRUE if it will generate an error, else PETSC_FALSE

437:    Level: intermediate

439: .seealso:  MFNSetErrorIfNotConverged()
440: @*/
441: PetscErrorCode MFNGetErrorIfNotConverged(MFN mfn,PetscBool *flag)
442: {
446:   *flag = mfn->errorifnotconverged;
447:   return(0);
448: }

452: /*@C
453:    MFNSetOptionsPrefix - Sets the prefix used for searching for all
454:    MFN options in the database.

456:    Logically Collective on MFN

458:    Input Parameters:
459: +  mfn - the matrix function context
460: -  prefix - the prefix string to prepend to all MFN option requests

462:    Notes:
463:    A hyphen (-) must NOT be given at the beginning of the prefix name.
464:    The first character of all runtime options is AUTOMATICALLY the
465:    hyphen.

467:    For example, to distinguish between the runtime options for two
468:    different MFN contexts, one could call
469: .vb
470:       MFNSetOptionsPrefix(mfn1,"fun1_")
471:       MFNSetOptionsPrefix(mfn2,"fun2_")
472: .ve

474:    Level: advanced

476: .seealso: MFNAppendOptionsPrefix(), MFNGetOptionsPrefix()
477: @*/
478: PetscErrorCode MFNSetOptionsPrefix(MFN mfn,const char *prefix)
479: {

484:   if (!mfn->ip) { MFNGetIP(mfn,&mfn->ip); }
485:   IPSetOptionsPrefix(mfn->ip,prefix);
486:   if (!mfn->ds) { MFNGetDS(mfn,&mfn->ds); }
487:   DSSetOptionsPrefix(mfn->ds,prefix);
488:   PetscObjectSetOptionsPrefix((PetscObject)mfn,prefix);
489:   return(0);
490: }

494: /*@C
495:    MFNAppendOptionsPrefix - Appends to the prefix used for searching for all
496:    MFN options in the database.

498:    Logically Collective on MFN

500:    Input Parameters:
501: +  mfn - the matrix function context
502: -  prefix - the prefix string to prepend to all MFN option requests

504:    Notes:
505:    A hyphen (-) must NOT be given at the beginning of the prefix name.
506:    The first character of all runtime options is AUTOMATICALLY the hyphen.

508:    Level: advanced

510: .seealso: MFNSetOptionsPrefix(), MFNGetOptionsPrefix()
511: @*/
512: PetscErrorCode MFNAppendOptionsPrefix(MFN mfn,const char *prefix)
513: {

518:   if (!mfn->ip) { MFNGetIP(mfn,&mfn->ip); }
519:   IPSetOptionsPrefix(mfn->ip,prefix);
520:   if (!mfn->ds) { MFNGetDS(mfn,&mfn->ds); }
521:   DSSetOptionsPrefix(mfn->ds,prefix);
522:   PetscObjectAppendOptionsPrefix((PetscObject)mfn,prefix);
523:   return(0);
524: }

528: /*@C
529:    MFNGetOptionsPrefix - Gets the prefix used for searching for all
530:    MFN options in the database.

532:    Not Collective

534:    Input Parameters:
535: .  mfn - the matrix function context

537:    Output Parameters:
538: .  prefix - pointer to the prefix string used is returned

540:    Notes: On the fortran side, the user should pass in a string 'prefix' of
541:    sufficient length to hold the prefix.

543:    Level: advanced

545: .seealso: MFNSetOptionsPrefix(), MFNAppendOptionsPrefix()
546: @*/
547: PetscErrorCode MFNGetOptionsPrefix(MFN mfn,const char *prefix[])
548: {

554:   PetscObjectGetOptionsPrefix((PetscObject)mfn,prefix);
555:   return(0);
556: }
slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnopts.c0000644000175000017500000004013512211062077020577 0ustar gladkgladk/* MFN routines related to options that can be set via the command-line or procedurally. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ #undef __FUNCT__ #define __FUNCT__ "MFNSetFromOptions" /*@ MFNSetFromOptions - Sets MFN options from the options database. This routine must be called before MFNSetUp() if the user is to be allowed to set the solver type. Collective on MFN Input Parameters: . mfn - the matrix function context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode MFNSetFromOptions(MFN mfn) { PetscErrorCode ierr; char type[256],monfilename[PETSC_MAX_PATH_LEN]; PetscBool flg; PetscReal r; PetscInt i; PetscViewer monviewer; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (!MFNRegisterAllCalled) { ierr = MFNRegisterAll();CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)mfn);CHKERRQ(ierr); ierr = PetscOptionsList("-mfn_type","Matrix Function method","MFNSetType",MFNList,(char*)(((PetscObject)mfn)->type_name?((PetscObject)mfn)->type_name:MFNKRYLOV),type,256,&flg);CHKERRQ(ierr); if (flg) { ierr = MFNSetType(mfn,type);CHKERRQ(ierr); } /* Set the type if it was never set. */ if (!((PetscObject)mfn)->type_name) { ierr = MFNSetType(mfn,MFNKRYLOV);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupBegin("-mfn_exp","matrix exponential","MFNSetFunction",&flg);CHKERRQ(ierr); if (flg) { ierr = MFNSetFunction(mfn,SLEPC_FUNCTION_EXP);CHKERRQ(ierr); } ierr = PetscOptionsScalar("-mfn_scale","Scale factor","MFNSetScaleFactor",mfn->sfactor,&mfn->sfactor,NULL);CHKERRQ(ierr); r = i = 0; ierr = PetscOptionsInt("-mfn_max_it","Maximum number of iterations","MFNSetTolerances",mfn->max_it,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-mfn_tol","Tolerance","MFNSetTolerances",mfn->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:mfn->tol,&r,NULL);CHKERRQ(ierr); ierr = MFNSetTolerances(mfn,r,i);CHKERRQ(ierr); i = 0; ierr = PetscOptionsInt("-mfn_ncv","Number of basis vectors","MFNSetDimensions",mfn->ncv,&i,NULL);CHKERRQ(ierr); ierr = MFNSetDimensions(mfn,i);CHKERRQ(ierr); ierr = PetscOptionsBool("-mfn_error_if_not_converged","Generate error if solver does not converge","MFNSetErrorIfNotConverged",mfn->errorifnotconverged,&mfn->errorifnotconverged,NULL);CHKERRQ(ierr); /* -----------------------------------------------------------------------*/ /* Cancels all monitors hardwired into code before call to MFNSetFromOptions() */ flg = PETSC_FALSE; ierr = PetscOptionsBool("-mfn_monitor_cancel","Remove any hardwired monitor routines","MFNMonitorCancel",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = MFNMonitorCancel(mfn);CHKERRQ(ierr); } /* Prints error estimate at each iteration */ ierr = PetscOptionsString("-mfn_monitor","Monitor error estimate","MFNMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)mfn),monfilename,&monviewer);CHKERRQ(ierr); ierr = MFNMonitorSet(mfn,MFNMonitorDefault,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-mfn_monitor_lg","Monitor error estimate graphically","MFNMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = MFNMonitorSet(mfn,MFNMonitorLG,NULL,NULL);CHKERRQ(ierr); } /* -----------------------------------------------------------------------*/ ierr = PetscOptionsName("-mfn_view","Print detailed information on solver used","MFNView",0);CHKERRQ(ierr); if (mfn->ops->setfromoptions) { ierr = (*mfn->ops->setfromoptions)(mfn);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)mfn);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if (!mfn->ip) { ierr = MFNGetIP(mfn,&mfn->ip);CHKERRQ(ierr); } ierr = IPSetFromOptions(mfn->ip);CHKERRQ(ierr); if (!mfn->ds) { ierr = MFNGetDS(mfn,&mfn->ds);CHKERRQ(ierr); } ierr = DSSetFromOptions(mfn->ds);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(mfn->rand);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetTolerances" /*@ MFNGetTolerances - Gets the tolerance and maximum iteration count used by the MFN convergence tests. Not Collective Input Parameter: . mfn - the matrix function context Output Parameters: + tol - the convergence tolerance - maxits - maximum number of iterations Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: MFNSetTolerances() @*/ PetscErrorCode MFNGetTolerances(MFN mfn,PetscReal *tol,PetscInt *maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (tol) *tol = mfn->tol; if (maxits) *maxits = mfn->max_it; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetTolerances" /*@ MFNSetTolerances - Sets the tolerance and maximum iteration count used by the MFN convergence tests. Logically Collective on MFN Input Parameters: + mfn - the matrix function context . tol - the convergence tolerance - maxits - maximum number of iterations to use Options Database Keys: + -mfn_tol - Sets the convergence tolerance - -mfn_max_it - Sets the maximum number of iterations allowed Notes: Pass 0 for an argument that need not be changed. Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method. Level: intermediate .seealso: MFNGetTolerances() @*/ PetscErrorCode MFNSetTolerances(MFN mfn,PetscReal tol,PetscInt maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidLogicalCollectiveReal(mfn,tol,2); PetscValidLogicalCollectiveInt(mfn,maxits,3); if (tol) { if (tol == PETSC_DEFAULT) { mfn->tol = PETSC_DEFAULT; } else { if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0"); mfn->tol = tol; } } if (maxits) { if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) { mfn->max_it = 0; mfn->setupcalled = 0; } else { if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0"); mfn->max_it = maxits; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetDimensions" /*@ MFNGetDimensions - Gets the dimension of the subspace used by the solver. Not Collective Input Parameter: . mfn - the matrix function context Output Parameter: . ncv - the maximum dimension of the subspace to be used by the solver Level: intermediate .seealso: MFNSetDimensions() @*/ PetscErrorCode MFNGetDimensions(MFN mfn,PetscInt *ncv) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(ncv,2); *ncv = mfn->ncv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetDimensions" /*@ MFNSetDimensions - Sets the dimension of the subspace to be used by the solver. Logically Collective on MFN Input Parameters: + mfn - the matrix function context - ncv - the maximum dimension of the subspace to be used by the solver Options Database Keys: . -mfn_ncv - Sets the dimension of the subspace Notes: Use PETSC_DECIDE for ncv to assign a reasonably good value, which is dependent on the solution method. Level: intermediate .seealso: MFNGetDimensions() @*/ PetscErrorCode MFNSetDimensions(MFN mfn,PetscInt ncv) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidLogicalCollectiveInt(mfn,ncv,2); if (ncv) { if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) { mfn->ncv = 0; } else { if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0"); mfn->ncv = ncv; } mfn->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetFunction" /*@ MFNSetFunction - Specifies the function to be computed. Logically Collective on MFN Input Parameters: + mfn - the matrix function context - fun - a known function Options Database Keys: . -mfn_exp - matrix exponential Level: beginner .seealso: MFNSetOperator(), MFNSetType(), MFNGetFunction(), SlepcFunction @*/ PetscErrorCode MFNSetFunction(MFN mfn,SlepcFunction fun) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidLogicalCollectiveEnum(mfn,fun,2); switch (fun) { case SLEPC_FUNCTION_EXP: break; default: SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_WRONG,"Unknown function"); } mfn->function = fun; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetFunction" /*@C MFNGetFunction - Gets the function from the MFN object. Not Collective Input Parameter: . mfn - the matrix function context Output Parameter: . fun - function Level: intermediate .seealso: MFNSetFunction(), SlepcFunction @*/ PetscErrorCode MFNGetFunction(MFN mfn,SlepcFunction *fun) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(fun,2); *fun = mfn->function; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetScaleFactor" /*@ MFNSetScaleFactor - Sets the scale factor to multiply the matrix (the argument of the function). Logically Collective on MFN Input Parameters: + mfn - the matrix function context - alpha - the scaling factor Options Database Keys: . -mfn_scale - Sets the scaling factor Notes: The computed result is f(alpha*A)*b. The default is alpha=1.0. Level: intermediate .seealso: MFNGetScaleFactor(), MFNSolve() @*/ PetscErrorCode MFNSetScaleFactor(MFN mfn,PetscScalar alpha) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidLogicalCollectiveScalar(mfn,alpha,2); mfn->sfactor = alpha; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetScaleFactor" /*@ MFNGetScaleFactor - Gets the factor used for scaling the matrix. Not Collective Input Parameter: . mfn - the matrix function context Output Parameters: . alpha - the scaling factor Level: intermediate .seealso: MFNSetScaleFactor(), MFNSolve() @*/ PetscErrorCode MFNGetScaleFactor(MFN mfn,PetscScalar *alpha) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(alpha,2); *alpha = mfn->sfactor; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetErrorIfNotConverged" /*@ MFNSetErrorIfNotConverged - Causes MFNSolve() to generate an error if the solver has not converged. Logically Collective on MFN Input Parameters: + mfn - the matrix function context - flg - PETSC_TRUE indicates you want the error generated Options Database Keys: . -mfn_error_if_not_converged - this takes an optional truth value (0/1/no/yes/true/false) Level: intermediate Note: Normally SLEPc continues if the solver fails to converge, you can call MFNGetConvergedReason() after a MFNSolve() to determine if it has converged. .seealso: MFNGetErrorIfNotConverged() @*/ PetscErrorCode MFNSetErrorIfNotConverged(MFN mfn,PetscBool flg) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidLogicalCollectiveBool(mfn,flg,2); mfn->errorifnotconverged = flg; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetErrorIfNotConverged" /*@ MFNGetErrorIfNotConverged - Return a flag indicating whether MFNSolve() will generate an error if the solver does not converge. Not Collective Input Parameter: . mfn - the matrix function context Output Parameter: . flag - PETSC_TRUE if it will generate an error, else PETSC_FALSE Level: intermediate .seealso: MFNSetErrorIfNotConverged() @*/ PetscErrorCode MFNGetErrorIfNotConverged(MFN mfn,PetscBool *flag) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(flag,2); *flag = mfn->errorifnotconverged; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetOptionsPrefix" /*@C MFNSetOptionsPrefix - Sets the prefix used for searching for all MFN options in the database. Logically Collective on MFN Input Parameters: + mfn - the matrix function context - prefix - the prefix string to prepend to all MFN option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different MFN contexts, one could call .vb MFNSetOptionsPrefix(mfn1,"fun1_") MFNSetOptionsPrefix(mfn2,"fun2_") .ve Level: advanced .seealso: MFNAppendOptionsPrefix(), MFNGetOptionsPrefix() @*/ PetscErrorCode MFNSetOptionsPrefix(MFN mfn,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (!mfn->ip) { ierr = MFNGetIP(mfn,&mfn->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(mfn->ip,prefix);CHKERRQ(ierr); if (!mfn->ds) { ierr = MFNGetDS(mfn,&mfn->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(mfn->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectSetOptionsPrefix((PetscObject)mfn,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNAppendOptionsPrefix" /*@C MFNAppendOptionsPrefix - Appends to the prefix used for searching for all MFN options in the database. Logically Collective on MFN Input Parameters: + mfn - the matrix function context - prefix - the prefix string to prepend to all MFN option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: MFNSetOptionsPrefix(), MFNGetOptionsPrefix() @*/ PetscErrorCode MFNAppendOptionsPrefix(MFN mfn,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (!mfn->ip) { ierr = MFNGetIP(mfn,&mfn->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(mfn->ip,prefix);CHKERRQ(ierr); if (!mfn->ds) { ierr = MFNGetDS(mfn,&mfn->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(mfn->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectAppendOptionsPrefix((PetscObject)mfn,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetOptionsPrefix" /*@C MFNGetOptionsPrefix - Gets the prefix used for searching for all MFN options in the database. Not Collective Input Parameters: . mfn - the matrix function context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: MFNSetOptionsPrefix(), MFNAppendOptionsPrefix() @*/ PetscErrorCode MFNGetOptionsPrefix(MFN mfn,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)mfn,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnbasic.c0000644000175000017500000003703412211062077020677 0ustar gladkgladk/* The basic MFN routines, Create, View, etc. are here. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ PetscFunctionList MFNList = 0; PetscBool MFNRegisterAllCalled = PETSC_FALSE; PetscClassId MFN_CLASSID = 0; PetscLogEvent MFN_SetUp = 0,MFN_Solve = 0; static PetscBool MFNPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "MFNFinalizePackage" /*@C MFNFinalizePackage - This function destroys everything in the SLEPc interface to the MFN package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode MFNFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&MFNList);CHKERRQ(ierr); MFNPackageInitialized = PETSC_FALSE; MFNRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNInitializePackage" /*@C MFNInitializePackage - This function initializes everything in the MFN package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to MFNCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode MFNInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (MFNPackageInitialized) PetscFunctionReturn(0); MFNPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Matrix Function",&MFN_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = MFNRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);CHKERRQ(ierr); ierr = PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"mfn",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(MFN_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"mfn",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(MFN_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(MFNFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNView" /*@C MFNView - Prints the MFN data structure. Collective on MFN Input Parameters: + mfn - the matrix function solver context - viewer - optional visualization context Options Database Key: . -mfn_view - Calls MFNView() at end of MFNSolve() Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode MFNView(MFN mfn,PetscViewer viewer) { PetscErrorCode ierr; const char *fun; char str[50]; PetscBool isascii; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)mfn)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(mfn,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)mfn,viewer,"MFN Object");CHKERRQ(ierr); if (mfn->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*mfn->ops->view)(mfn,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } if (mfn->function) { switch (mfn->function) { case SLEPC_FUNCTION_EXP: fun = "exponential"; break; default: SETERRQ(PetscObjectComm((PetscObject)mfn),1,"Wrong value of mfn->function"); } } else fun = "not yet set"; ierr = PetscViewerASCIIPrintf(viewer," function: %s\n",fun);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %D\n",mfn->ncv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %D\n",mfn->max_it);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," tolerance: %G\n",mfn->tol);CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,mfn->sfactor,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," scaling factor: %s\n",str);CHKERRQ(ierr); } else { if (mfn->ops->view) { ierr = (*mfn->ops->view)(mfn,viewer);CHKERRQ(ierr); } } if (!mfn->ip) { ierr = MFNGetIP(mfn,&mfn->ip);CHKERRQ(ierr); } ierr = IPView(mfn->ip,viewer);CHKERRQ(ierr); if (!mfn->ds) { ierr = MFNGetDS(mfn,&mfn->ds);CHKERRQ(ierr); } ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr); ierr = DSView(mfn->ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNCreate" /*@C MFNCreate - Creates the default MFN context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . mfn - location to put the MFN context Note: The default MFN type is MFNKRYLOV Level: beginner .seealso: MFNSetUp(), MFNSolve(), MFNDestroy(), MFN @*/ PetscErrorCode MFNCreate(MPI_Comm comm,MFN *outmfn) { PetscErrorCode ierr; MFN mfn; PetscFunctionBegin; PetscValidPointer(outmfn,2); *outmfn = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = MFNInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(mfn,_p_MFN,struct _MFNOps,MFN_CLASSID,"MFN","Matrix Function","MFN",comm,MFNDestroy,MFNView);CHKERRQ(ierr); mfn->max_it = 0; mfn->ncv = 0; mfn->allocated_ncv = 0; mfn->tol = PETSC_DEFAULT; mfn->function = (SlepcFunction)0; mfn->sfactor = 1.0; mfn->A = 0; mfn->V = 0; mfn->t = 0; mfn->errest = 0; mfn->ip = 0; mfn->ds = 0; mfn->rand = 0; mfn->data = 0; mfn->its = 0; mfn->nwork = 0; mfn->work = 0; mfn->setupcalled = 0; mfn->reason = MFN_CONVERGED_ITERATING; mfn->numbermonitors = 0; ierr = PetscRandomCreate(comm,&mfn->rand);CHKERRQ(ierr); ierr = PetscRandomSetSeed(mfn->rand,0x12345678);CHKERRQ(ierr); ierr = PetscLogObjectParent(mfn,mfn->rand);CHKERRQ(ierr); *outmfn = mfn; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetType" /*@C MFNSetType - Selects the particular solver to be used in the MFN object. Logically Collective on MFN Input Parameters: + mfn - the matrix function context - type - a known method Options Database Key: . -mfn_type - Sets the method; use -help for a list of available methods Notes: See "slepc/include/slepcmfn.h" for available methods. The default is MFNKRYLOV Normally, it is best to use the MFNSetFromOptions() command and then set the MFN type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The MFNSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database. Level: intermediate .seealso: MFNType @*/ PetscErrorCode MFNSetType(MFN mfn,MFNType type) { PetscErrorCode ierr,(*r)(MFN); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)mfn,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(MFNList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown MFN type given: %s",type); if (mfn->ops->destroy) { ierr = (*mfn->ops->destroy)(mfn);CHKERRQ(ierr); } ierr = PetscMemzero(mfn->ops,sizeof(struct _MFNOps));CHKERRQ(ierr); mfn->setupcalled = 0; ierr = PetscObjectChangeTypeName((PetscObject)mfn,type);CHKERRQ(ierr); ierr = (*r)(mfn);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetType" /*@C MFNGetType - Gets the MFN type as a string from the MFN object. Not Collective Input Parameter: . mfn - the matrix function context Output Parameter: . name - name of MFN method Level: intermediate .seealso: MFNSetType() @*/ PetscErrorCode MFNGetType(MFN mfn,MFNType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)mfn)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNRegister" /*@C MFNRegister - Adds a method to the matrix function solver package. Not Collective Input Parameters: + name - name of a new user-defined solver - function - routine to create the solver context Notes: MFNRegister() may be called multiple times to add several user-defined solvers. Sample usage: .vb MFNRegister("my_solver",MySolverCreate); .ve Then, your solver can be chosen with the procedural interface via $ MFNSetType(mfn,"my_solver") or at runtime via the option $ -mfn_type my_solver Level: advanced .seealso: MFNRegisterAll() @*/ PetscErrorCode MFNRegister(const char *name,PetscErrorCode (*function)(MFN)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&MFNList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNReset" /*@ MFNReset - Resets the MFN context to the setupcalled=0 state and removes any allocated objects. Collective on MFN Input Parameter: . mfn - matrix function context obtained from MFNCreate() Level: advanced .seealso: MFNDestroy() @*/ PetscErrorCode MFNReset(MFN mfn) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (mfn->ops->reset) { ierr = (mfn->ops->reset)(mfn);CHKERRQ(ierr); } if (mfn->ip) { ierr = IPReset(mfn->ip);CHKERRQ(ierr); } if (mfn->ds) { ierr = DSReset(mfn->ds);CHKERRQ(ierr); } ierr = VecDestroy(&mfn->t);CHKERRQ(ierr); mfn->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNDestroy" /*@C MFNDestroy - Destroys the MFN context. Collective on MFN Input Parameter: . mfn - matrix function context obtained from MFNCreate() Level: beginner .seealso: MFNCreate(), MFNSetUp(), MFNSolve() @*/ PetscErrorCode MFNDestroy(MFN *mfn) { PetscErrorCode ierr; PetscFunctionBegin; if (!*mfn) PetscFunctionReturn(0); PetscValidHeaderSpecific(*mfn,MFN_CLASSID,1); if (--((PetscObject)(*mfn))->refct > 0) { *mfn = 0; PetscFunctionReturn(0); } ierr = MFNReset(*mfn);CHKERRQ(ierr); if ((*mfn)->ops->destroy) { ierr = (*(*mfn)->ops->destroy)(*mfn);CHKERRQ(ierr); } ierr = MatDestroy(&(*mfn)->A);CHKERRQ(ierr); ierr = IPDestroy(&(*mfn)->ip);CHKERRQ(ierr); ierr = DSDestroy(&(*mfn)->ds);CHKERRQ(ierr); ierr = PetscRandomDestroy(&(*mfn)->rand);CHKERRQ(ierr); ierr = MFNMonitorCancel(*mfn);CHKERRQ(ierr); ierr = PetscHeaderDestroy(mfn);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetIP" /*@ MFNSetIP - Associates an inner product object to the matrix function solver. Collective on MFN Input Parameters: + mfn - matrix function context obtained from MFNCreate() - ip - the inner product object Note: Use MFNGetIP() to retrieve the inner product context (for example, to free it at the end of the computations). Level: advanced .seealso: MFNGetIP() @*/ PetscErrorCode MFNSetIP(MFN mfn,IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidHeaderSpecific(ip,IP_CLASSID,2); PetscCheckSameComm(mfn,1,ip,2); ierr = PetscObjectReference((PetscObject)ip);CHKERRQ(ierr); ierr = IPDestroy(&mfn->ip);CHKERRQ(ierr); mfn->ip = ip; ierr = PetscLogObjectParent(mfn,mfn->ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetIP" /*@C MFNGetIP - Obtain the inner product object associated to the eigensolver object. Not Collective Input Parameters: . mfn - matrix function context obtained from MFNCreate() Output Parameter: . ip - inner product context Level: advanced .seealso: MFNSetIP() @*/ PetscErrorCode MFNGetIP(MFN mfn,IP *ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(ip,2); if (!mfn->ip) { ierr = IPCreate(PetscObjectComm((PetscObject)mfn),&mfn->ip);CHKERRQ(ierr); ierr = PetscLogObjectParent(mfn,mfn->ip);CHKERRQ(ierr); } *ip = mfn->ip; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetDS" /*@ MFNSetDS - Associates a direct solver object to the matrix function solver. Collective on MFN Input Parameters: + mfn - matrix function context obtained from MFNCreate() - ds - the direct solver object Note: Use MFNGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations). Level: advanced .seealso: MFNGetDS() @*/ PetscErrorCode MFNSetDS(MFN mfn,DS ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidHeaderSpecific(ds,DS_CLASSID,2); PetscCheckSameComm(mfn,1,ds,2); ierr = PetscObjectReference((PetscObject)ds);CHKERRQ(ierr); ierr = DSDestroy(&mfn->ds);CHKERRQ(ierr); mfn->ds = ds; ierr = PetscLogObjectParent(mfn,mfn->ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetDS" /*@C MFNGetDS - Obtain the direct solver object associated to the matrix function object. Not Collective Input Parameters: . mfn - matrix function context obtained from MFNCreate() Output Parameter: . ds - direct solver context Level: advanced .seealso: MFNSetDS() @*/ PetscErrorCode MFNGetDS(MFN mfn,DS *ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(ds,2); if (!mfn->ds) { ierr = DSCreate(PetscObjectComm((PetscObject)mfn),&mfn->ds);CHKERRQ(ierr); ierr = PetscLogObjectParent(mfn,mfn->ds);CHKERRQ(ierr); } *ds = mfn->ds; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnmon.c0000644000175000017500000001562112211062077020405 0ustar gladkgladk/* MFN routines related to monitors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "MFNMonitor" /* Runs the user provided monitor routines, if any. */ PetscErrorCode MFNMonitor(MFN mfn,PetscInt it,PetscReal errest) { PetscErrorCode ierr; PetscInt i,n = mfn->numbermonitors; PetscFunctionBegin; for (i=0;imonitor[i])(mfn,it,errest,mfn->monitorcontext[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNMonitorSet" /*@C MFNMonitorSet - Sets an ADDITIONAL function to be called at every iteration to monitor convergence. Logically Collective on MFN Input Parameters: + mfn - matrix function context obtained from MFNCreate() . monitor - pointer to function (if this is NULL, it turns off monitoring) . mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired) - monitordestroy - [optional] routine that frees monitor context (may be NULL) Calling Sequence of monitor: $ monitor (MFN mfn, int its, PetscReal errest, void *mctx) + mfn - matrix function context obtained from MFNCreate() . its - iteration number . errest - error estimate - mctx - optional monitoring context, as set by MFNMonitorSet() Options Database Keys: + -mfn_monitor - print the error estimate . -mfn_monitor_lg - sets line graph monitor for the error estimate - -mfn_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to MFNMonitorSet(), but does not cancel those set via the options database. Notes: Several different monitoring routines may be set by calling MFNMonitorSet() multiple times; all will be called in the order in which they were set. Level: intermediate .seealso: MFNMonitorFirst(), MFNMonitorAll(), MFNMonitorCancel() @*/ PetscErrorCode MFNMonitorSet(MFN mfn,PetscErrorCode (*monitor)(MFN,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**)) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (mfn->numbermonitors >= MAXMFNMONITORS) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Too many MFN monitors set"); mfn->monitor[mfn->numbermonitors] = monitor; mfn->monitorcontext[mfn->numbermonitors] = (void*)mctx; mfn->monitordestroy[mfn->numbermonitors++] = monitordestroy; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNMonitorCancel" /*@ MFNMonitorCancel - Clears all monitors for an MFN object. Logically Collective on MFN Input Parameters: . mfn - matrix function context obtained from MFNCreate() Options Database Key: . -mfn_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to MFNMonitorSet(), but does not cancel those set via the options database. Level: intermediate .seealso: MFNMonitorSet() @*/ PetscErrorCode MFNMonitorCancel(MFN mfn) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); for (i=0; inumbermonitors; i++) { if (mfn->monitordestroy[i]) { ierr = (*mfn->monitordestroy[i])(&mfn->monitorcontext[i]);CHKERRQ(ierr); } } mfn->numbermonitors = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetMonitorContext" /*@C MFNGetMonitorContext - Gets the monitor context, as set by MFNMonitorSet() for the FIRST monitor only. Not Collective Input Parameter: . mfn - matrix function context obtained from MFNCreate() Output Parameter: . ctx - monitor context Level: intermediate .seealso: MFNMonitorSet() @*/ PetscErrorCode MFNGetMonitorContext(MFN mfn,void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); *ctx = mfn->monitorcontext[0]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNMonitorDefault" /*@C MFNMonitorDefault - Print the error estimate of the current approximation at each iteration of the matrix function solver. Collective on MFN Input Parameters: + mfn - matrix function context . its - iteration number . errest - error estimate - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: MFNMonitorSet() @*/ PetscErrorCode MFNMonitorDefault(MFN mfn,PetscInt its,PetscReal errest,void *monctx) { PetscErrorCode ierr; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)mfn)); PetscFunctionBegin; ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)mfn)->tablevel);CHKERRQ(ierr); if (its == 0 && ((PetscObject)mfn)->prefix) { ierr = PetscViewerASCIIPrintf(viewer," Monitor for %s solve.\n",((PetscObject)mfn)->prefix);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"%3D MFN value %14.12e\n",its,(double)errest);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)mfn)->tablevel);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNMonitorLG" PetscErrorCode MFNMonitorLG(MFN mfn,PetscInt its,PetscReal errest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw; PetscDrawLG lg; PetscErrorCode ierr; PetscReal x,y; PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)mfn)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimate");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(mfn->tol)-2,0.0);CHKERRQ(ierr); } x = (PetscReal)its; if (errest>0.0) y = log10(errest); else y = 0.0; ierr = PetscDrawLGAddPoint(lg,&x,&y);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/interface/makefile0000644000175000017500000000222412211062077020442 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = mfnmon.c mfnbasic.c mfnregis.c mfnopts.c mfnsetup.c mfnsolve.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = MFN LOCDIR = src/mfn/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnsolve.c.html0000644000175000017500000003307012211062077021705 0ustar gladkgladk
Actual source code: mfnsolve.c

  1: /*
  2:       MFN routines related to the solution process.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/mfnimpl.h>   /*I "slepcmfn.h" I*/

 28: /*@
 29:    MFNSolve - Solves the matrix function problem. Given a vector b, the
 30:    vector x = f(alpha*A)*b is returned.

 32:    Collective on MFN

 34:    Input Parameters:
 35: +  mfn - matrix function context obtained from MFNCreate()
 36: -  b   - the right hand side vector

 38:    Output Parameter:
 39: .  x   - the solution

 41:    Options Database Keys:
 42: +  -mfn_view - print information about the solver used
 43: .  -mfn_view_mat binary - save the matrix to the default binary viewer
 44: .  -mfn_view_rhs binary - save right hand side vector to the default binary viewer
 45: -  -mfn_view_solution binary - save computed solution vector to the default binary viewer

 47:    Notes:
 48:    The matrix A is specified with MFNSetOperator().
 49:    The function f is specified with MFNSetFunction().
 50:    The scalar alpha is specified with MFNSetScaleFactor().

 52:    Level: beginner

 54: .seealso: MFNCreate(), MFNSetUp(), MFNDestroy(), MFNSetTolerances(),
 55:           MFNSetOperator(), MFNSetFunction(), MFNSetScaleFactor()
 56: @*/
 57: PetscErrorCode MFNSolve(MFN mfn,Vec b,Vec x)
 58: {
 59:   PetscErrorCode    ierr;
 60:   PetscBool         flg;
 61:   PetscViewer       viewer;
 62:   PetscViewerFormat format;


 71:   /* call setup */
 72:   MFNSetUp(mfn);
 73:   mfn->its = 0;

 75:   MFNMonitor(mfn,mfn->its,0);

 77:   /* call solver */
 78:   PetscLogEventBegin(MFN_Solve,mfn,b,x,0);
 79:   (*mfn->ops->solve)(mfn,b,x);
 80:   PetscLogEventEnd(MFN_Solve,mfn,b,x,0);

 82:   if (!mfn->reason) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason");

 84:   if (mfn->errorifnotconverged && mfn->reason < 0) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_NOT_CONVERGED,"MFNSolve has not converged");

 86:   /* various viewers */
 87:   MatViewFromOptions(mfn->A,((PetscObject)mfn)->prefix,"-mfn_view_mat");
 88:   VecViewFromOptions(b,((PetscObject)mfn)->prefix,"-mfn_view_rhs");
 89:   VecViewFromOptions(x,((PetscObject)mfn)->prefix,"-mfn_view_solution");

 91:   PetscOptionsGetViewer(PetscObjectComm((PetscObject)mfn),((PetscObject)mfn)->prefix,"-mfn_view",&viewer,&format,&flg);
 92:   if (flg && !PetscPreLoadingOn) {
 93:     PetscViewerPushFormat(viewer,format);
 94:     MFNView(mfn,viewer);
 95:     PetscViewerPopFormat(viewer);
 96:     PetscViewerDestroy(&viewer);
 97:   }
 98:   return(0);
 99: }

103: /*@
104:    MFNGetIterationNumber - Gets the current iteration number. If the
105:    call to MFNSolve() is complete, then it returns the number of iterations
106:    carried out by the solution method.

108:    Not Collective

110:    Input Parameter:
111: .  mfn - the matrix function context

113:    Output Parameter:
114: .  its - number of iterations

116:    Level: intermediate

118:    Note:
119:    During the i-th iteration this call returns i-1. If MFNSolve() is
120:    complete, then parameter "its" contains either the iteration number at
121:    which convergence was successfully reached, or failure was detected.
122:    Call MFNGetConvergedReason() to determine if the solver converged or
123:    failed and why.

125: .seealso: MFNGetConvergedReason(), MFNSetTolerances()
126: @*/
127: PetscErrorCode MFNGetIterationNumber(MFN mfn,PetscInt *its)
128: {
132:   *its = mfn->its;
133:   return(0);
134: }

138: /*@C
139:    MFNGetConvergedReason - Gets the reason why the MFNSolve() iteration was
140:    stopped.

142:    Not Collective

144:    Input Parameter:
145: .  mfn - the matrix function context

147:    Output Parameter:
148: .  reason - negative value indicates diverged, positive value converged

150:    Possible values for reason:
151: +  MFN_CONVERGED_TOL - converged up to tolerance
152: .  MFN_DIVERGED_ITS - required more than its to reach convergence
153: -  MFN_DIVERGED_BREAKDOWN - generic breakdown in method

155:    Note:
156:    Can only be called after the call to MFNSolve() is complete.

158:    Level: intermediate

160: .seealso: MFNSetTolerances(), MFNSolve(), MFNConvergedReason, MFNSetErrorIfNotConverged()
161: @*/
162: PetscErrorCode MFNGetConvergedReason(MFN mfn,MFNConvergedReason *reason)
163: {
167:   *reason = mfn->reason;
168:   return(0);
169: }

slepc-3.4.2.dfsg.orig/src/mfn/interface/makefile.html0000644000175000017500000000402012211062077021401 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = mfnmon.c mfnbasic.c mfnregis.c mfnopts.c mfnsetup.c mfnsolve.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = MFN
LOCDIR   = src/mfn/interface/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/mfn/interface/index.html0000644000175000017500000000153612211062077020744 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

mfnmon.c
mfnbasic.c
mfnregis.c
mfnopts.c
mfnsetup.c
mfnsolve.c
makefile
slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnsetup.c.html0000644000175000017500000003025312211062077021715 0ustar gladkgladk

Actual source code: mfnsetup.c

  1: /*
  2:       MFN routines related to problem setup.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/mfnimpl.h>       /*I "slepcmfn.h" I*/
 25: #include <slepc-private/ipimpl.h>

 29: /*@
 30:    MFNSetUp - Sets up all the internal data structures necessary for the
 31:    execution of the matrix function solver.

 33:    Collective on MFN

 35:    Input Parameter:
 36: .  mfn   - matrix function context

 38:    Notes:
 39:    This function need not be called explicitly in most cases, since MFNSolve()
 40:    calls it. It can be useful when one wants to measure the set-up time
 41:    separately from the solve time.

 43:    Level: advanced

 45: .seealso: MFNCreate(), MFNSolve(), MFNDestroy()
 46: @*/
 47: PetscErrorCode MFNSetUp(MFN mfn)
 48: {

 53:   if (mfn->setupcalled) return(0);
 54:   PetscLogEventBegin(MFN_SetUp,mfn,0,0,0);

 56:   /* reset the convergence flag from the previous solves */
 57:   mfn->reason = MFN_CONVERGED_ITERATING;

 59:   /* Set default solver type (MFNSetFromOptions was not called) */
 60:   if (!((PetscObject)mfn)->type_name) {
 61:     MFNSetType(mfn,MFNKRYLOV);
 62:   }
 63:   if (!mfn->ip) { MFNGetIP(mfn,&mfn->ip); }
 64:   if (!((PetscObject)mfn->ip)->type_name) {
 65:     IPSetType_Default(mfn->ip);
 66:   }
 67:   IPSetMatrix(mfn->ip,NULL);
 68:   if (!mfn->ds) { MFNGetDS(mfn,&mfn->ds); }
 69:   DSReset(mfn->ds);
 70:   if (!((PetscObject)mfn->rand)->type_name) {
 71:     PetscRandomSetFromOptions(mfn->rand);
 72:   }

 74:   /* Set problem dimensions */
 75:   if (!mfn->A) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_WRONGSTATE,"MFNSetOperator must be called first");
 76:   MatGetSize(mfn->A,&mfn->n,NULL);
 77:   MatGetLocalSize(mfn->A,&mfn->nloc,NULL);
 78:   VecDestroy(&mfn->t);
 79:   SlepcMatGetVecsTemplate(mfn->A,&mfn->t,NULL);
 80:   PetscLogObjectParent(mfn,mfn->t);

 82:   /* Set default function */
 83:   if (!mfn->function) {
 84:     MFNSetFunction(mfn,SLEPC_FUNCTION_EXP);
 85:   }

 87:   if (mfn->ncv > mfn->n) mfn->ncv = mfn->n;

 89:   /* call specific solver setup */
 90:   (*mfn->ops->setup)(mfn);

 92:   /* set tolerance if not yet set */
 93:   if (mfn->tol==PETSC_DEFAULT) mfn->tol = SLEPC_DEFAULT_TOL;

 95:   PetscLogEventEnd(MFN_SetUp,mfn,0,0,0);
 96:   mfn->setupcalled = 1;
 97:   return(0);
 98: }

102: /*@
103:    MFNSetOperator - Sets the matrix for which the matrix function is to be computed.

105:    Collective on MFN and Mat

107:    Input Parameters:
108: +  mfn - the matrix function context
109: -  A   - the problem matrix

111:    Notes:
112:    It must be called after MFNSetUp(). If it is called again after MFNSetUp() then
113:    the MFN object is reset.

115:    Level: beginner

117: .seealso: MFNSolve(), MFNSetUp(), MFNReset()
118: @*/
119: PetscErrorCode MFNSetOperator(MFN mfn,Mat A)
120: {
122:   PetscInt       m,n;


129:   MatGetSize(A,&m,&n);
130:   if (m!=n) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_WRONG,"A is a non-square matrix");
131:   if (mfn->setupcalled) { MFNReset(mfn); }
132:   PetscObjectReference((PetscObject)A);
133:   MatDestroy(&mfn->A);
134:   mfn->A = A;
135:   return(0);
136: }

140: /*@
141:    MFNGetOperator - Gets the matrix associated with the MFN object.

143:    Collective on MFN and Mat

145:    Input Parameter:
146: .  mfn - the MFN context

148:    Output Parameters:
149: .  A  - the matrix for which the matrix function is to be computed

151:    Level: intermediate

153: .seealso: MFNSolve(), MFNSetOperator()
154: @*/
155: PetscErrorCode MFNGetOperator(MFN mfn,Mat *A)
156: {
160:   *A = mfn->A;
161:   return(0);
162: }

slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnbasic.c.html0000644000175000017500000011522412211062077021640 0ustar gladkgladk
Actual source code: mfnbasic.c

  1: /*
  2:      The basic MFN routines, Create, View, etc. are here.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/mfnimpl.h>      /*I "slepcmfn.h" I*/

 26: PetscFunctionList MFNList = 0;
 27: PetscBool         MFNRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      MFN_CLASSID = 0;
 29: PetscLogEvent     MFN_SetUp = 0,MFN_Solve = 0;
 30: static PetscBool  MFNPackageInitialized = PETSC_FALSE;

 34: /*@C
 35:   MFNFinalizePackage - This function destroys everything in the SLEPc interface
 36:   to the MFN package. It is called from SlepcFinalize().

 38:   Level: developer

 40: .seealso: SlepcFinalize()
 41: @*/
 42: PetscErrorCode MFNFinalizePackage(void)
 43: {

 47:   PetscFunctionListDestroy(&MFNList);
 48:   MFNPackageInitialized = PETSC_FALSE;
 49:   MFNRegisterAllCalled  = PETSC_FALSE;
 50:   return(0);
 51: }

 55: /*@C
 56:   MFNInitializePackage - This function initializes everything in the MFN package.
 57:   It is called from PetscDLLibraryRegister() when using dynamic libraries, and
 58:   on the first call to MFNCreate() when using static libraries.

 60:   Level: developer

 62: .seealso: SlepcInitialize()
 63: @*/
 64: PetscErrorCode MFNInitializePackage(void)
 65: {
 66:   char           logList[256];
 67:   char           *className;
 68:   PetscBool      opt;

 72:   if (MFNPackageInitialized) return(0);
 73:   MFNPackageInitialized = PETSC_TRUE;
 74:   /* Register Classes */
 75:   PetscClassIdRegister("Matrix Function",&MFN_CLASSID);
 76:   /* Register Constructors */
 77:   MFNRegisterAll();
 78:   /* Register Events */
 79:   PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);
 80:   PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);
 81:   /* Process info exclusions */
 82:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 83:   if (opt) {
 84:     PetscStrstr(logList,"mfn",&className);
 85:     if (className) {
 86:       PetscInfoDeactivateClass(MFN_CLASSID);
 87:     }
 88:   }
 89:   /* Process summary exclusions */
 90:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 91:   if (opt) {
 92:     PetscStrstr(logList,"mfn",&className);
 93:     if (className) {
 94:       PetscLogEventDeactivateClass(MFN_CLASSID);
 95:     }
 96:   }
 97:   PetscRegisterFinalize(MFNFinalizePackage);
 98:   return(0);
 99: }

103: /*@C
104:    MFNView - Prints the MFN data structure.

106:    Collective on MFN

108:    Input Parameters:
109: +  mfn - the matrix function solver context
110: -  viewer - optional visualization context

112:    Options Database Key:
113: .  -mfn_view -  Calls MFNView() at end of MFNSolve()

115:    Note:
116:    The available visualization contexts include
117: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
118: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
119:          output where only the first processor opens
120:          the file.  All other processors send their
121:          data to the first processor to print.

123:    The user can open an alternative visualization context with
124:    PetscViewerASCIIOpen() - output to a specified file.

126:    Level: beginner

128: .seealso: PetscViewerASCIIOpen()
129: @*/
130: PetscErrorCode MFNView(MFN mfn,PetscViewer viewer)
131: {
133:   const char     *fun;
134:   char           str[50];
135:   PetscBool      isascii;

139:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)mfn));

143:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
144:   if (isascii) {
145:     PetscObjectPrintClassNamePrefixType((PetscObject)mfn,viewer,"MFN Object");
146:     if (mfn->ops->view) {
147:       PetscViewerASCIIPushTab(viewer);
148:       (*mfn->ops->view)(mfn,viewer);
149:       PetscViewerASCIIPopTab(viewer);
150:     }
151:     if (mfn->function) {
152:       switch (mfn->function) {
153:         case SLEPC_FUNCTION_EXP: fun = "exponential"; break;
154:         default: SETERRQ(PetscObjectComm((PetscObject)mfn),1,"Wrong value of mfn->function");
155:       }
156:     } else fun = "not yet set";
157:     PetscViewerASCIIPrintf(viewer,"  function: %s\n",fun);
158:     PetscViewerASCIIPrintf(viewer,"  number of column vectors (ncv): %D\n",mfn->ncv);
159:     PetscViewerASCIIPrintf(viewer,"  maximum number of iterations: %D\n",mfn->max_it);
160:     PetscViewerASCIIPrintf(viewer,"  tolerance: %G\n",mfn->tol);
161:     SlepcSNPrintfScalar(str,50,mfn->sfactor,PETSC_FALSE);
162:     PetscViewerASCIIPrintf(viewer,"  scaling factor: %s\n",str);
163:   } else {
164:     if (mfn->ops->view) {
165:       (*mfn->ops->view)(mfn,viewer);
166:     }
167:   }
168:   if (!mfn->ip) { MFNGetIP(mfn,&mfn->ip); }
169:   IPView(mfn->ip,viewer);
170:   if (!mfn->ds) { MFNGetDS(mfn,&mfn->ds); }
171:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);
172:   DSView(mfn->ds,viewer);
173:   PetscViewerPopFormat(viewer);
174:   return(0);
175: }

179: /*@C
180:    MFNCreate - Creates the default MFN context.

182:    Collective on MPI_Comm

184:    Input Parameter:
185: .  comm - MPI communicator

187:    Output Parameter:
188: .  mfn - location to put the MFN context

190:    Note:
191:    The default MFN type is MFNKRYLOV

193:    Level: beginner

195: .seealso: MFNSetUp(), MFNSolve(), MFNDestroy(), MFN
196: @*/
197: PetscErrorCode MFNCreate(MPI_Comm comm,MFN *outmfn)
198: {
200:   MFN            mfn;

204:   *outmfn = 0;
205: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
206:   MFNInitializePackage();
207: #endif

209:   SlepcHeaderCreate(mfn,_p_MFN,struct _MFNOps,MFN_CLASSID,"MFN","Matrix Function","MFN",comm,MFNDestroy,MFNView);

211:   mfn->max_it          = 0;
212:   mfn->ncv             = 0;
213:   mfn->allocated_ncv   = 0;
214:   mfn->tol             = PETSC_DEFAULT;
215:   mfn->function        = (SlepcFunction)0;
216:   mfn->sfactor         = 1.0;

218:   mfn->A               = 0;
219:   mfn->V               = 0;
220:   mfn->t               = 0;
221:   mfn->errest          = 0;
222:   mfn->ip              = 0;
223:   mfn->ds              = 0;
224:   mfn->rand            = 0;
225:   mfn->data            = 0;
226:   mfn->its             = 0;

228:   mfn->nwork           = 0;
229:   mfn->work            = 0;
230:   mfn->setupcalled     = 0;
231:   mfn->reason          = MFN_CONVERGED_ITERATING;
232:   mfn->numbermonitors  = 0;

234:   PetscRandomCreate(comm,&mfn->rand);
235:   PetscRandomSetSeed(mfn->rand,0x12345678);
236:   PetscLogObjectParent(mfn,mfn->rand);
237:   *outmfn = mfn;
238:   return(0);
239: }

243: /*@C
244:    MFNSetType - Selects the particular solver to be used in the MFN object.

246:    Logically Collective on MFN

248:    Input Parameters:
249: +  mfn  - the matrix function context
250: -  type - a known method

252:    Options Database Key:
253: .  -mfn_type <method> - Sets the method; use -help for a list
254:     of available methods

256:    Notes:
257:    See "slepc/include/slepcmfn.h" for available methods. The default
258:    is MFNKRYLOV

260:    Normally, it is best to use the MFNSetFromOptions() command and
261:    then set the MFN type from the options database rather than by using
262:    this routine.  Using the options database provides the user with
263:    maximum flexibility in evaluating the different available methods.
264:    The MFNSetType() routine is provided for those situations where it
265:    is necessary to set the iterative solver independently of the command
266:    line or options database.

268:    Level: intermediate

270: .seealso: MFNType
271: @*/
272: PetscErrorCode MFNSetType(MFN mfn,MFNType type)
273: {
274:   PetscErrorCode ierr,(*r)(MFN);
275:   PetscBool      match;


281:   PetscObjectTypeCompare((PetscObject)mfn,type,&match);
282:   if (match) return(0);

284:   PetscFunctionListFind(MFNList,type,&r);
285:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown MFN type given: %s",type);

287:   if (mfn->ops->destroy) { (*mfn->ops->destroy)(mfn); }
288:   PetscMemzero(mfn->ops,sizeof(struct _MFNOps));

290:   mfn->setupcalled = 0;
291:   PetscObjectChangeTypeName((PetscObject)mfn,type);
292:   (*r)(mfn);
293:   return(0);
294: }

298: /*@C
299:    MFNGetType - Gets the MFN type as a string from the MFN object.

301:    Not Collective

303:    Input Parameter:
304: .  mfn - the matrix function context

306:    Output Parameter:
307: .  name - name of MFN method

309:    Level: intermediate

311: .seealso: MFNSetType()
312: @*/
313: PetscErrorCode MFNGetType(MFN mfn,MFNType *type)
314: {
318:   *type = ((PetscObject)mfn)->type_name;
319:   return(0);
320: }

324: /*@C
325:    MFNRegister - Adds a method to the matrix function solver package.

327:    Not Collective

329:    Input Parameters:
330: +  name - name of a new user-defined solver
331: -  function - routine to create the solver context

333:    Notes:
334:    MFNRegister() may be called multiple times to add several user-defined solvers.

336:    Sample usage:
337: .vb
338:    MFNRegister("my_solver",MySolverCreate);
339: .ve

341:    Then, your solver can be chosen with the procedural interface via
342: $     MFNSetType(mfn,"my_solver")
343:    or at runtime via the option
344: $     -mfn_type my_solver

346:    Level: advanced

348: .seealso: MFNRegisterAll()
349: @*/
350: PetscErrorCode MFNRegister(const char *name,PetscErrorCode (*function)(MFN))
351: {

355:   PetscFunctionListAdd(&MFNList,name,function);
356:   return(0);
357: }

361: /*@
362:    MFNReset - Resets the MFN context to the setupcalled=0 state and removes any
363:    allocated objects.

365:    Collective on MFN

367:    Input Parameter:
368: .  mfn - matrix function context obtained from MFNCreate()

370:    Level: advanced

372: .seealso: MFNDestroy()
373: @*/
374: PetscErrorCode MFNReset(MFN mfn)
375: {

380:   if (mfn->ops->reset) { (mfn->ops->reset)(mfn); }
381:   if (mfn->ip) { IPReset(mfn->ip); }
382:   if (mfn->ds) { DSReset(mfn->ds); }
383:   VecDestroy(&mfn->t);
384:   mfn->setupcalled = 0;
385:   return(0);
386: }

390: /*@C
391:    MFNDestroy - Destroys the MFN context.

393:    Collective on MFN

395:    Input Parameter:
396: .  mfn - matrix function context obtained from MFNCreate()

398:    Level: beginner

400: .seealso: MFNCreate(), MFNSetUp(), MFNSolve()
401: @*/
402: PetscErrorCode MFNDestroy(MFN *mfn)
403: {

407:   if (!*mfn) return(0);
409:   if (--((PetscObject)(*mfn))->refct > 0) { *mfn = 0; return(0); }
410:   MFNReset(*mfn);
411:   if ((*mfn)->ops->destroy) { (*(*mfn)->ops->destroy)(*mfn); }
412:   MatDestroy(&(*mfn)->A);
413:   IPDestroy(&(*mfn)->ip);
414:   DSDestroy(&(*mfn)->ds);
415:   PetscRandomDestroy(&(*mfn)->rand);
416:   MFNMonitorCancel(*mfn);
417:   PetscHeaderDestroy(mfn);
418:   return(0);
419: }

423: /*@
424:    MFNSetIP - Associates an inner product object to the matrix function solver.

426:    Collective on MFN

428:    Input Parameters:
429: +  mfn - matrix function context obtained from MFNCreate()
430: -  ip  - the inner product object

432:    Note:
433:    Use MFNGetIP() to retrieve the inner product context (for example,
434:    to free it at the end of the computations).

436:    Level: advanced

438: .seealso: MFNGetIP()
439: @*/
440: PetscErrorCode MFNSetIP(MFN mfn,IP ip)
441: {

448:   PetscObjectReference((PetscObject)ip);
449:   IPDestroy(&mfn->ip);
450:   mfn->ip = ip;
451:   PetscLogObjectParent(mfn,mfn->ip);
452:   return(0);
453: }

457: /*@C
458:    MFNGetIP - Obtain the inner product object associated to the eigensolver object.

460:    Not Collective

462:    Input Parameters:
463: .  mfn - matrix function context obtained from MFNCreate()

465:    Output Parameter:
466: .  ip - inner product context

468:    Level: advanced

470: .seealso: MFNSetIP()
471: @*/
472: PetscErrorCode MFNGetIP(MFN mfn,IP *ip)
473: {

479:   if (!mfn->ip) {
480:     IPCreate(PetscObjectComm((PetscObject)mfn),&mfn->ip);
481:     PetscLogObjectParent(mfn,mfn->ip);
482:   }
483:   *ip = mfn->ip;
484:   return(0);
485: }

489: /*@
490:    MFNSetDS - Associates a direct solver object to the matrix function solver.

492:    Collective on MFN

494:    Input Parameters:
495: +  mfn - matrix function context obtained from MFNCreate()
496: -  ds  - the direct solver object

498:    Note:
499:    Use MFNGetDS() to retrieve the direct solver context (for example,
500:    to free it at the end of the computations).

502:    Level: advanced

504: .seealso: MFNGetDS()
505: @*/
506: PetscErrorCode MFNSetDS(MFN mfn,DS ds)
507: {

514:   PetscObjectReference((PetscObject)ds);
515:   DSDestroy(&mfn->ds);
516:   mfn->ds = ds;
517:   PetscLogObjectParent(mfn,mfn->ds);
518:   return(0);
519: }

523: /*@C
524:    MFNGetDS - Obtain the direct solver object associated to the matrix function object.

526:    Not Collective

528:    Input Parameters:
529: .  mfn - matrix function context obtained from MFNCreate()

531:    Output Parameter:
532: .  ds - direct solver context

534:    Level: advanced

536: .seealso: MFNSetDS()
537: @*/
538: PetscErrorCode MFNGetDS(MFN mfn,DS *ds)
539: {

545:   if (!mfn->ds) {
546:     DSCreate(PetscObjectComm((PetscObject)mfn),&mfn->ds);
547:     PetscLogObjectParent(mfn,mfn->ds);
548:   }
549:   *ds = mfn->ds;
550:   return(0);
551: }

slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnsetup.c0000644000175000017500000001164512211062077020756 0ustar gladkgladk/* MFN routines related to problem setup. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "MFNSetUp" /*@ MFNSetUp - Sets up all the internal data structures necessary for the execution of the matrix function solver. Collective on MFN Input Parameter: . mfn - matrix function context Notes: This function need not be called explicitly in most cases, since MFNSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time. Level: advanced .seealso: MFNCreate(), MFNSolve(), MFNDestroy() @*/ PetscErrorCode MFNSetUp(MFN mfn) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (mfn->setupcalled) PetscFunctionReturn(0); ierr = PetscLogEventBegin(MFN_SetUp,mfn,0,0,0);CHKERRQ(ierr); /* reset the convergence flag from the previous solves */ mfn->reason = MFN_CONVERGED_ITERATING; /* Set default solver type (MFNSetFromOptions was not called) */ if (!((PetscObject)mfn)->type_name) { ierr = MFNSetType(mfn,MFNKRYLOV);CHKERRQ(ierr); } if (!mfn->ip) { ierr = MFNGetIP(mfn,&mfn->ip);CHKERRQ(ierr); } if (!((PetscObject)mfn->ip)->type_name) { ierr = IPSetType_Default(mfn->ip);CHKERRQ(ierr); } ierr = IPSetMatrix(mfn->ip,NULL);CHKERRQ(ierr); if (!mfn->ds) { ierr = MFNGetDS(mfn,&mfn->ds);CHKERRQ(ierr); } ierr = DSReset(mfn->ds);CHKERRQ(ierr); if (!((PetscObject)mfn->rand)->type_name) { ierr = PetscRandomSetFromOptions(mfn->rand);CHKERRQ(ierr); } /* Set problem dimensions */ if (!mfn->A) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_WRONGSTATE,"MFNSetOperator must be called first"); ierr = MatGetSize(mfn->A,&mfn->n,NULL);CHKERRQ(ierr); ierr = MatGetLocalSize(mfn->A,&mfn->nloc,NULL);CHKERRQ(ierr); ierr = VecDestroy(&mfn->t);CHKERRQ(ierr); ierr = SlepcMatGetVecsTemplate(mfn->A,&mfn->t,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(mfn,mfn->t);CHKERRQ(ierr); /* Set default function */ if (!mfn->function) { ierr = MFNSetFunction(mfn,SLEPC_FUNCTION_EXP);CHKERRQ(ierr); } if (mfn->ncv > mfn->n) mfn->ncv = mfn->n; /* call specific solver setup */ ierr = (*mfn->ops->setup)(mfn);CHKERRQ(ierr); /* set tolerance if not yet set */ if (mfn->tol==PETSC_DEFAULT) mfn->tol = SLEPC_DEFAULT_TOL; ierr = PetscLogEventEnd(MFN_SetUp,mfn,0,0,0);CHKERRQ(ierr); mfn->setupcalled = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNSetOperator" /*@ MFNSetOperator - Sets the matrix for which the matrix function is to be computed. Collective on MFN and Mat Input Parameters: + mfn - the matrix function context - A - the problem matrix Notes: It must be called after MFNSetUp(). If it is called again after MFNSetUp() then the MFN object is reset. Level: beginner .seealso: MFNSolve(), MFNSetUp(), MFNReset() @*/ PetscErrorCode MFNSetOperator(MFN mfn,Mat A) { PetscErrorCode ierr; PetscInt m,n; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidHeaderSpecific(A,MAT_CLASSID,2); PetscCheckSameComm(mfn,1,A,2); ierr = MatGetSize(A,&m,&n);CHKERRQ(ierr); if (m!=n) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_WRONG,"A is a non-square matrix"); if (mfn->setupcalled) { ierr = MFNReset(mfn);CHKERRQ(ierr); } ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr); ierr = MatDestroy(&mfn->A);CHKERRQ(ierr); mfn->A = A; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetOperator" /*@ MFNGetOperator - Gets the matrix associated with the MFN object. Collective on MFN and Mat Input Parameter: . mfn - the MFN context Output Parameters: . A - the matrix for which the matrix function is to be computed Level: intermediate .seealso: MFNSolve(), MFNSetOperator() @*/ PetscErrorCode MFNGetOperator(MFN mfn,Mat *A) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidPointer(A,2); *A = mfn->A; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-custom/0000755000175000017500000000000012214143515021041 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-custom/zmfnf.c0000644000175000017500000001520212211062077022325 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define mfndestroy_ MFNDESTROY #define mfnview_ MFNVIEW #define mfnsetoptionsprefix_ MFNSETOPTIONSPREFIX #define mfnappendoptionsprefix_ MFNAPPENDOPTIONSPREFIX #define mfngetoptionsprefix_ MFNGETOPTIONSPREFIX #define mfncreate_ MFNCREATE #define mfnsettype_ MFNSETTYPE #define mfngettype_ MFNGETTYPE #define mfnmonitordefault_ MFNMONITORDEFAULT #define mfnmonitorlg_ MFNMONITORLG #define mfnmonitorset_ MFNMONITORSET #define mfngetip_ MFNGETIP #define mfngetds_ MFNGETDS #define mfngetconvergedreason_ MFNGETCONVERGEDREASON #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define mfndestroy_ mfndestroy #define mfnview_ mfnview #define mfnsetoptionsprefix_ mfnsetoptionsprefix #define mfnappendoptionsprefix_ mfnappendoptionsprefix #define mfngetoptionsprefix_ mfngetoptionsprefix #define mfncreate_ mfncreate #define mfnsettype_ mfnsettype #define mfngettype_ mfngettype #define mfnmonitordefault_ mfnmonitordefault #define mfnmonitorlg_ mfnmonitorlg #define mfnmonitorset_ mfnmonitorset #define mfngetip_ mfngetip #define mfngetds_ mfngetds #define mfngetconvergedreason_ mfngetconvergedreason #endif /* These are not usually called from Fortran but allow Fortran users to transparently set these monitors from .F code, hence no STDCALL */ PETSC_EXTERN void mfnmonitordefault_(MFN *mfn,PetscInt *it,PetscReal *errest,void *ctx,PetscErrorCode *ierr) { *ierr = MFNMonitorDefault(*mfn,*it,*errest,ctx); } PETSC_EXTERN void mfnmonitorlg_(MFN *mfn,PetscInt *it,PetscReal *errest,void *ctx,PetscErrorCode *ierr) { *ierr = MFNMonitorLG(*mfn,*it,*errest,ctx); } static struct { PetscFortranCallbackId monitor; PetscFortranCallbackId monitordestroy; } _cb; /* These are not extern C because they are passed into non-extern C user level functions */ #undef __FUNCT__ #define __FUNCT__ "ourmonitor" static PetscErrorCode ourmonitor(MFN mfn,PetscInt i,PetscReal d,void* ctx) { PetscObjectUseFortranCallback(mfn,_cb.monitor,(MFN*,PetscInt*,PetscReal*,void*,PetscErrorCode*),(&mfn,&i,&d,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourdestroy" static PetscErrorCode ourdestroy(void** ctx) { MFN mfn = (MFN)*ctx; PetscObjectUseFortranCallback(mfn,_cb.monitordestroy,(void*,PetscErrorCode*),(_ctx,&ierr)); return 0; } PETSC_EXTERN void PETSC_STDCALL mfndestroy_(MFN *mfn,PetscErrorCode *ierr) { *ierr = MFNDestroy(mfn); } PETSC_EXTERN void PETSC_STDCALL mfnview_(MFN *mfn,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = MFNView(*mfn,v); } PETSC_EXTERN void PETSC_STDCALL mfnsettype_(MFN *mfn,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(type,len,t); *ierr = MFNSetType(*mfn,t); FREECHAR(type,t); } PETSC_EXTERN void PETSC_STDCALL mfngettype_(MFN *mfn,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { MFNType tname; *ierr = MFNGetType(*mfn,&tname);if (*ierr) return; *ierr = PetscStrncpy(name,tname,len); FIXRETURNCHAR(PETSC_TRUE,name,len); } PETSC_EXTERN void PETSC_STDCALL mfnsetoptionsprefix_(MFN *mfn,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = MFNSetOptionsPrefix(*mfn,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL mfnappendoptionsprefix_(MFN *mfn,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = MFNAppendOptionsPrefix(*mfn,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL mfngetoptionsprefix_(MFN *mfn,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = MFNGetOptionsPrefix(*mfn,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL mfncreate_(MPI_Fint *comm,MFN *mfn,PetscErrorCode *ierr) { *ierr = MFNCreate(MPI_Comm_f2c(*(comm)),mfn); } PETSC_EXTERN void PETSC_STDCALL mfnmonitorset_(MFN *mfn,void (PETSC_STDCALL *monitor)(MFN*,PetscInt*,PetscReal*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr) { CHKFORTRANNULLOBJECT(mctx); CHKFORTRANNULLFUNCTION(monitordestroy); if ((PetscVoidFunction)monitor == (PetscVoidFunction)mfnmonitordefault_) { *ierr = MFNMonitorSet(*mfn,MFNMonitorDefault,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)mfnmonitorlg_) { *ierr = MFNMonitorSet(*mfn,MFNMonitorLG,0,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*mfn,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)monitor,mctx); if (*ierr) return; if (!monitordestroy) { *ierr = MFNMonitorSet(*mfn,ourmonitor,*mfn,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*mfn,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitordestroy,(PetscVoidFunction)monitordestroy,mctx); if (*ierr) return; *ierr = MFNMonitorSet(*mfn,ourmonitor,*mfn,ourdestroy); } } } PETSC_EXTERN void PETSC_STDCALL mfngetip_(MFN *mfn,IP *ip,PetscErrorCode *ierr) { *ierr = MFNGetIP(*mfn,ip); } PETSC_EXTERN void PETSC_STDCALL mfngetds_(MFN *mfn,DS *ds,PetscErrorCode *ierr) { *ierr = MFNGetDS(*mfn,ds); } PETSC_EXTERN void PETSC_STDCALL mfngetconvergedreason_(MFN *mfn,MFNConvergedReason *reason,PetscErrorCode *ierr) { *ierr = MFNGetConvergedReason(*mfn,reason); } slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-custom/makefile0000644000175000017500000000217412211062077022545 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zmfnf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/mfn/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnregis.c0000644000175000017500000000264512211062077020727 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ PETSC_EXTERN PetscErrorCode MFNCreate_Krylov(MFN); #undef __FUNCT__ #define __FUNCT__ "MFNRegisterAll" /*@C MFNRegisterAll - Registers all the matrix functions in the MFN package. Not Collective Level: advanced .seealso: MFNRegister() @*/ PetscErrorCode MFNRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; MFNRegisterAllCalled = PETSC_TRUE; ierr = MFNRegister(MFNKRYLOV,MFNCreate_Krylov);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnmon.c.html0000644000175000017500000004007412211062077021350 0ustar gladkgladk
Actual source code: mfnmon.c

  1: /*
  2:       MFN routines related to monitors.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/mfnimpl.h>   /*I "slepcmfn.h" I*/
 25: #include <petscdraw.h>

 29: /*
 30:    Runs the user provided monitor routines, if any.
 31: */
 32: PetscErrorCode MFNMonitor(MFN mfn,PetscInt it,PetscReal errest)
 33: {
 35:   PetscInt       i,n = mfn->numbermonitors;

 38:   for (i=0;i<n;i++) {
 39:     (*mfn->monitor[i])(mfn,it,errest,mfn->monitorcontext[i]);
 40:   }
 41:   return(0);
 42: }

 46: /*@C
 47:    MFNMonitorSet - Sets an ADDITIONAL function to be called at every
 48:    iteration to monitor convergence.

 50:    Logically Collective on MFN

 52:    Input Parameters:
 53: +  mfn     - matrix function context obtained from MFNCreate()
 54: .  monitor - pointer to function (if this is NULL, it turns off monitoring)
 55: .  mctx    - [optional] context for private data for the
 56:              monitor routine (use NULL if no context is desired)
 57: -  monitordestroy - [optional] routine that frees monitor context (may be NULL)

 59:    Calling Sequence of monitor:
 60: $     monitor (MFN mfn, int its, PetscReal errest, void *mctx)

 62: +  mfn    - matrix function context obtained from MFNCreate()
 63: .  its    - iteration number
 64: .  errest - error estimate
 65: -  mctx   - optional monitoring context, as set by MFNMonitorSet()

 67:    Options Database Keys:
 68: +    -mfn_monitor        - print the error estimate
 69: .    -mfn_monitor_lg     - sets line graph monitor for the error estimate
 70: -    -mfn_monitor_cancel - cancels all monitors that have been hardwired into
 71:       a code by calls to MFNMonitorSet(), but does not cancel those set via
 72:       the options database.

 74:    Notes:
 75:    Several different monitoring routines may be set by calling
 76:    MFNMonitorSet() multiple times; all will be called in the
 77:    order in which they were set.

 79:    Level: intermediate

 81: .seealso: MFNMonitorFirst(), MFNMonitorAll(), MFNMonitorCancel()
 82: @*/
 83: PetscErrorCode MFNMonitorSet(MFN mfn,PetscErrorCode (*monitor)(MFN,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
 84: {
 87:   if (mfn->numbermonitors >= MAXMFNMONITORS) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_ARG_OUTOFRANGE,"Too many MFN monitors set");
 88:   mfn->monitor[mfn->numbermonitors]           = monitor;
 89:   mfn->monitorcontext[mfn->numbermonitors]    = (void*)mctx;
 90:   mfn->monitordestroy[mfn->numbermonitors++]  = monitordestroy;
 91:   return(0);
 92: }

 96: /*@
 97:    MFNMonitorCancel - Clears all monitors for an MFN object.

 99:    Logically Collective on MFN

101:    Input Parameters:
102: .  mfn - matrix function context obtained from MFNCreate()

104:    Options Database Key:
105: .    -mfn_monitor_cancel - Cancels all monitors that have been hardwired
106:       into a code by calls to MFNMonitorSet(),
107:       but does not cancel those set via the options database.

109:    Level: intermediate

111: .seealso: MFNMonitorSet()
112: @*/
113: PetscErrorCode MFNMonitorCancel(MFN mfn)
114: {
116:   PetscInt       i;

120:   for (i=0; i<mfn->numbermonitors; i++) {
121:     if (mfn->monitordestroy[i]) {
122:       (*mfn->monitordestroy[i])(&mfn->monitorcontext[i]);
123:     }
124:   }
125:   mfn->numbermonitors = 0;
126:   return(0);
127: }

131: /*@C
132:    MFNGetMonitorContext - Gets the monitor context, as set by
133:    MFNMonitorSet() for the FIRST monitor only.

135:    Not Collective

137:    Input Parameter:
138: .  mfn - matrix function context obtained from MFNCreate()

140:    Output Parameter:
141: .  ctx - monitor context

143:    Level: intermediate

145: .seealso: MFNMonitorSet()
146: @*/
147: PetscErrorCode MFNGetMonitorContext(MFN mfn,void **ctx)
148: {
151:   *ctx = mfn->monitorcontext[0];
152:   return(0);
153: }

157: /*@C
158:    MFNMonitorDefault - Print the error estimate of the current approximation at each
159:    iteration of the matrix function solver.

161:    Collective on MFN

163:    Input Parameters:
164: +  mfn    - matrix function context
165: .  its    - iteration number
166: .  errest - error estimate
167: -  monctx - monitor context (contains viewer, can be NULL)

169:    Level: intermediate

171: .seealso: MFNMonitorSet()
172: @*/
173: PetscErrorCode MFNMonitorDefault(MFN mfn,PetscInt its,PetscReal errest,void *monctx)
174: {
176:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)mfn));

179:   PetscViewerASCIIAddTab(viewer,((PetscObject)mfn)->tablevel);
180:   if (its == 0 && ((PetscObject)mfn)->prefix) {
181:     PetscViewerASCIIPrintf(viewer,"  Monitor for %s solve.\n",((PetscObject)mfn)->prefix);
182:   }
183:   PetscViewerASCIIPrintf(viewer,"%3D MFN value %14.12e\n",its,(double)errest);
184:   PetscViewerASCIISubtractTab(viewer,((PetscObject)mfn)->tablevel);
185:   return(0);
186: }

190: PetscErrorCode MFNMonitorLG(MFN mfn,PetscInt its,PetscReal errest,void *monctx)
191: {
192:   PetscViewer    viewer = (PetscViewer)monctx;
193:   PetscDraw      draw;
194:   PetscDrawLG    lg;
196:   PetscReal      x,y;

199:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)mfn));
200:   PetscViewerDrawGetDraw(viewer,0,&draw);
201:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
202:   if (!its) {
203:     PetscDrawSetTitle(draw,"Error estimate");
204:     PetscDrawSetDoubleBuffer(draw);
205:     PetscDrawLGSetDimension(lg,1);
206:     PetscDrawLGReset(lg);
207:     PetscDrawLGSetLimits(lg,0,1.0,log10(mfn->tol)-2,0.0);
208:   }
209:   x = (PetscReal)its;
210:   if (errest>0.0) y = log10(errest); else y = 0.0;
211:   PetscDrawLGAddPoint(lg,&x,&y);
212:   PetscDrawLGDraw(lg);
213:   return(0);
214: }

slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/0000755000175000017500000000000012214143515020477 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/mfnsolvef.c0000644000175000017500000000256012211062077022645 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* mfnsolve.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcmfn.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsolve_ MFNSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsolve_ mfnsolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfngetiterationnumber_ MFNGETITERATIONNUMBER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfngetiterationnumber_ mfngetiterationnumber #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL mfnsolve_(MFN *mfn,Vec b,Vec x, int *__ierr ){ *__ierr = MFNSolve(*mfn, (Vec)PetscToPointer((b) ), (Vec)PetscToPointer((x) )); } void PETSC_STDCALL mfngetiterationnumber_(MFN *mfn,PetscInt *its, int *__ierr ){ *__ierr = MFNGetIterationNumber(*mfn,its); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/mfnsetupf.c0000644000175000017500000000310112211062077022645 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* mfnsetup.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcmfn.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetup_ MFNSETUP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetup_ mfnsetup #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetoperator_ MFNSETOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetoperator_ mfnsetoperator #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfngetoperator_ MFNGETOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfngetoperator_ mfngetoperator #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL mfnsetup_(MFN *mfn, int *__ierr ){ *__ierr = MFNSetUp(*mfn); } void PETSC_STDCALL mfnsetoperator_(MFN *mfn,Mat A, int *__ierr ){ *__ierr = MFNSetOperator(*mfn, (Mat)PetscToPointer((A) )); } void PETSC_STDCALL mfngetoperator_(MFN *mfn,Mat *A, int *__ierr ){ *__ierr = MFNGetOperator(*mfn,A); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/mfnoptsf.c0000644000175000017500000001003612211062077022477 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* mfnopts.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcmfn.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetfromoptions_ MFNSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetfromoptions_ mfnsetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfngettolerances_ MFNGETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfngettolerances_ mfngettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsettolerances_ MFNSETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsettolerances_ mfnsettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfngetdimensions_ MFNGETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfngetdimensions_ mfngetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetdimensions_ MFNSETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetdimensions_ mfnsetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetfunction_ MFNSETFUNCTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetfunction_ mfnsetfunction #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetscalefactor_ MFNSETSCALEFACTOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetscalefactor_ mfnsetscalefactor #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfngetscalefactor_ MFNGETSCALEFACTOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfngetscalefactor_ mfngetscalefactor #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnseterrorifnotconverged_ MFNSETERRORIFNOTCONVERGED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnseterrorifnotconverged_ mfnseterrorifnotconverged #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfngeterrorifnotconverged_ MFNGETERRORIFNOTCONVERGED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfngeterrorifnotconverged_ mfngeterrorifnotconverged #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL mfnsetfromoptions_(MFN *mfn, int *__ierr ){ *__ierr = MFNSetFromOptions(*mfn); } void PETSC_STDCALL mfngettolerances_(MFN *mfn,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = MFNGetTolerances(*mfn,tol,maxits); } void PETSC_STDCALL mfnsettolerances_(MFN *mfn,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = MFNSetTolerances(*mfn,*tol,*maxits); } void PETSC_STDCALL mfngetdimensions_(MFN *mfn,PetscInt *ncv, int *__ierr ){ *__ierr = MFNGetDimensions(*mfn,ncv); } void PETSC_STDCALL mfnsetdimensions_(MFN *mfn,PetscInt *ncv, int *__ierr ){ *__ierr = MFNSetDimensions(*mfn,*ncv); } void PETSC_STDCALL mfnsetfunction_(MFN *mfn,SlepcFunction *fun, int *__ierr ){ *__ierr = MFNSetFunction(*mfn,*fun); } void PETSC_STDCALL mfnsetscalefactor_(MFN *mfn,PetscScalar *alpha, int *__ierr ){ *__ierr = MFNSetScaleFactor(*mfn,*alpha); } void PETSC_STDCALL mfngetscalefactor_(MFN *mfn,PetscScalar *alpha, int *__ierr ){ *__ierr = MFNGetScaleFactor(*mfn,alpha); } void PETSC_STDCALL mfnseterrorifnotconverged_(MFN *mfn,PetscBool *flg, int *__ierr ){ *__ierr = MFNSetErrorIfNotConverged(*mfn,*flg); } void PETSC_STDCALL mfngeterrorifnotconverged_(MFN *mfn,PetscBool *flag, int *__ierr ){ *__ierr = MFNGetErrorIfNotConverged(*mfn,flag); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/mfnmonf.c0000644000175000017500000000177012211062077022310 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* mfnmon.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcmfn.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnmonitorcancel_ MFNMONITORCANCEL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnmonitorcancel_ mfnmonitorcancel #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL mfnmonitorcancel_(MFN *mfn, int *__ierr ){ *__ierr = MFNMonitorCancel(*mfn); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/mfnbasicf.c0000644000175000017500000000274412211062077022602 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* mfnbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcmfn.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnreset_ MFNRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnreset_ mfnreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetip_ MFNSETIP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetip_ mfnsetip #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define mfnsetds_ MFNSETDS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define mfnsetds_ mfnsetds #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL mfnreset_(MFN *mfn, int *__ierr ){ *__ierr = MFNReset(*mfn); } void PETSC_STDCALL mfnsetip_(MFN *mfn,IP *ip, int *__ierr ){ *__ierr = MFNSetIP(*mfn,*ip); } void PETSC_STDCALL mfnsetds_(MFN *mfn,DS *ds, int *__ierr ){ *__ierr = MFNSetDS(*mfn,*ds); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/mfn/interface/ftn-auto/makefile0000644000175000017500000000042012211062077022173 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = mfnbasicf.c mfnmonf.c mfnoptsf.c mfnsetupf.c mfnsolvef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/mfn/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/mfn/interface/mfnsolve.c0000644000175000017500000001315212211062077020741 0ustar gladkgladk/* MFN routines related to the solution process. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcmfn.h" I*/ #undef __FUNCT__ #define __FUNCT__ "MFNSolve" /*@ MFNSolve - Solves the matrix function problem. Given a vector b, the vector x = f(alpha*A)*b is returned. Collective on MFN Input Parameters: + mfn - matrix function context obtained from MFNCreate() - b - the right hand side vector Output Parameter: . x - the solution Options Database Keys: + -mfn_view - print information about the solver used . -mfn_view_mat binary - save the matrix to the default binary viewer . -mfn_view_rhs binary - save right hand side vector to the default binary viewer - -mfn_view_solution binary - save computed solution vector to the default binary viewer Notes: The matrix A is specified with MFNSetOperator(). The function f is specified with MFNSetFunction(). The scalar alpha is specified with MFNSetScaleFactor(). Level: beginner .seealso: MFNCreate(), MFNSetUp(), MFNDestroy(), MFNSetTolerances(), MFNSetOperator(), MFNSetFunction(), MFNSetScaleFactor() @*/ PetscErrorCode MFNSolve(MFN mfn,Vec b,Vec x) { PetscErrorCode ierr; PetscBool flg; PetscViewer viewer; PetscViewerFormat format; PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); if (b) PetscValidHeaderSpecific(b,VEC_CLASSID,2); if (b) PetscCheckSameComm(mfn,1,b,2); if (x) PetscValidHeaderSpecific(x,VEC_CLASSID,3); if (x) PetscCheckSameComm(mfn,1,x,3); /* call setup */ ierr = MFNSetUp(mfn);CHKERRQ(ierr); mfn->its = 0; ierr = MFNMonitor(mfn,mfn->its,0);CHKERRQ(ierr); /* call solver */ ierr = PetscLogEventBegin(MFN_Solve,mfn,b,x,0);CHKERRQ(ierr); ierr = (*mfn->ops->solve)(mfn,b,x);CHKERRQ(ierr); ierr = PetscLogEventEnd(MFN_Solve,mfn,b,x,0);CHKERRQ(ierr); if (!mfn->reason) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason"); if (mfn->errorifnotconverged && mfn->reason < 0) SETERRQ(PetscObjectComm((PetscObject)mfn),PETSC_ERR_NOT_CONVERGED,"MFNSolve has not converged"); /* various viewers */ ierr = MatViewFromOptions(mfn->A,((PetscObject)mfn)->prefix,"-mfn_view_mat");CHKERRQ(ierr); ierr = VecViewFromOptions(b,((PetscObject)mfn)->prefix,"-mfn_view_rhs");CHKERRQ(ierr); ierr = VecViewFromOptions(x,((PetscObject)mfn)->prefix,"-mfn_view_solution");CHKERRQ(ierr); ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)mfn),((PetscObject)mfn)->prefix,"-mfn_view",&viewer,&format,&flg);CHKERRQ(ierr); if (flg && !PetscPreLoadingOn) { ierr = PetscViewerPushFormat(viewer,format);CHKERRQ(ierr); ierr = MFNView(mfn,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetIterationNumber" /*@ MFNGetIterationNumber - Gets the current iteration number. If the call to MFNSolve() is complete, then it returns the number of iterations carried out by the solution method. Not Collective Input Parameter: . mfn - the matrix function context Output Parameter: . its - number of iterations Level: intermediate Note: During the i-th iteration this call returns i-1. If MFNSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call MFNGetConvergedReason() to determine if the solver converged or failed and why. .seealso: MFNGetConvergedReason(), MFNSetTolerances() @*/ PetscErrorCode MFNGetIterationNumber(MFN mfn,PetscInt *its) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidIntPointer(its,2); *its = mfn->its; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MFNGetConvergedReason" /*@C MFNGetConvergedReason - Gets the reason why the MFNSolve() iteration was stopped. Not Collective Input Parameter: . mfn - the matrix function context Output Parameter: . reason - negative value indicates diverged, positive value converged Possible values for reason: + MFN_CONVERGED_TOL - converged up to tolerance . MFN_DIVERGED_ITS - required more than its to reach convergence - MFN_DIVERGED_BREAKDOWN - generic breakdown in method Note: Can only be called after the call to MFNSolve() is complete. Level: intermediate .seealso: MFNSetTolerances(), MFNSolve(), MFNConvergedReason, MFNSetErrorIfNotConverged() @*/ PetscErrorCode MFNGetConvergedReason(MFN mfn,MFNConvergedReason *reason) { PetscFunctionBegin; PetscValidHeaderSpecific(mfn,MFN_CLASSID,1); PetscValidIntPointer(reason,2); *reason = mfn->reason; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/mfn/index.html0000644000175000017500000000156012211062077017001 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

interface/
impls/
examples/
../../include/slepc-private/mfnimpl.h
../../include/slepcmfn.h
makefile
slepc-3.4.2.dfsg.orig/src/makefile0000644000175000017500000000201212211062077015715 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # DIRS = eps st svd qep nep mfn ip ds fn sys vec LOCDIR = src/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/makefile.html0000644000175000017500000000344312211062077016671 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

DIRS     = eps st svd qep nep mfn ip ds fn sys vec

LOCDIR   = src/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/vec/0000755000175000017500000000000012211062077014777 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/vec/veccomp0.h.html0000644000175000017500000005304212211062077017633 0ustar gladkgladk
Actual source code: veccomp0.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <petsc-private/vecimpl.h>     /*I  "petsvec.h"  I*/

 24: #if defined(__WITH_MPI__)
 26: #else
 28: #endif


 36: PetscErrorCode __SUF__(VecDot_Comp)(Vec a,Vec b,PetscScalar *z)
 37: {
 38:   PetscScalar    sum = 0.0,work;
 39:   PetscInt       i;
 41:   Vec_Comp       *as = (Vec_Comp*)a->data,*bs = (Vec_Comp*)b->data;

 44:   SlepcValidVecComp(a);
 45:   SlepcValidVecComp(b);
 46:   if (as->x[0]->ops->dot_local) {
 47:     for (i=0,sum=0.0;i<as->n->n;i++) {
 48:       as->x[i]->ops->dot_local(as->x[i],bs->x[i],&work);
 49:       sum += work;
 50:     }
 51: #if defined(__WITH_MPI__)
 52:     work = sum;
 53:     MPI_Allreduce(&work,&sum,1,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));
 54: #endif
 55:   } else {
 56:     for (i=0,sum=0.0;i<as->n->n;i++) {
 57:       VecDot(as->x[i],bs->x[i],&work);
 58:       sum += work;
 59:     }
 60:   }
 61:   *z = sum;
 62:   return(0);
 63: }

 67: PetscErrorCode __SUF__(VecMDot_Comp)(Vec a,PetscInt n,const Vec b[],PetscScalar *z)
 68: {
 69:   PetscScalar    *work,*work0,*r;
 71:   Vec_Comp       *as = (Vec_Comp*)a->data;
 72:   Vec            *bx;
 73:   PetscInt       i,j;

 76:   SlepcValidVecComp(a);
 77:   for (i=0;i<n;i++) SlepcValidVecComp(b[i]);

 79:   if (as->n->n == 0) {
 80:     *z = 0;
 81:     return(0);
 82:   }

 84:   PetscMalloc(sizeof(PetscScalar)*n,&work0);
 85:   PetscMalloc(sizeof(Vec)*n,&bx);

 87: #if defined(__WITH_MPI__)
 88:   if (as->x[0]->ops->mdot_local) {
 89:     r = work0; work = z;
 90:   } else
 91: #endif
 92:   {
 93:     r = z; work = work0;
 94:   }

 96:   /* z[i] <- a.x' * b[i].x */
 97:   for (i=0;i<n;i++) bx[i] = ((Vec_Comp*)b[i]->data)->x[0];
 98:   if (as->x[0]->ops->mdot_local) {
 99:     as->x[0]->ops->mdot_local(as->x[0],n,bx,r);
100:   } else {
101:     VecMDot(as->x[0],n,bx,r);
102:   }
103:   for (j=0;j<as->n->n;j++) {
104:     for (i=0;i<n;i++) bx[i] = ((Vec_Comp*)b[i]->data)->x[j];
105:     if (as->x[0]->ops->mdot_local) {
106:       as->x[j]->ops->mdot_local(as->x[j],n,bx,work);
107:     } else {
108:       VecMDot(as->x[j],n,bx,work);
109:     }
110:     for (i=0;i<n;i++) r[i] += work[i];
111:   }

113:   /* If def(__WITH_MPI__) and exists mdot_local */
114: #if defined(__WITH_MPI__)
115:   if (as->x[0]->ops->mdot_local) {
116:     /* z[i] <- Allreduce(work[i]) */
117:     MPI_Allreduce(r,z,n,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));
118:   }
119: #endif

121:   PetscFree(work0);
122:   PetscFree(bx);
123:   return(0);
124: }

128: PetscErrorCode __SUF__(VecTDot_Comp)(Vec a,Vec b,PetscScalar *z)
129: {
130:   PetscScalar    sum = 0.0,work;
131:   PetscInt       i;
133:   Vec_Comp       *as = (Vec_Comp*)a->data,*bs = (Vec_Comp*)b->data;

136:   SlepcValidVecComp(a);
137:   SlepcValidVecComp(b);
138:   if (as->x[0]->ops->tdot_local) {
139:     for (i=0,sum=0.0;i<as->n->n;i++) {
140:       as->x[i]->ops->tdot_local(as->x[i],bs->x[i],&work);
141:       sum += work;
142:     }
143: #if defined(__WITH_MPI__)
144:     work = sum;
145:     MPI_Allreduce(&work,&sum,1,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));
146: #endif
147:   } else {
148:     for (i=0,sum=0.0;i<as->n->n;i++) {
149:       VecTDot(as->x[i],bs->x[i],&work);
150:       sum += work;
151:     }
152:   }
153:   *z = sum;
154:   return(0);
155: }

159: PetscErrorCode __SUF__(VecMTDot_Comp)(Vec a,PetscInt n,const Vec b[],PetscScalar *z)
160: {
161:   PetscScalar    *work,*work0,*r;
163:   Vec_Comp       *as = (Vec_Comp*)a->data;
164:   Vec            *bx;
165:   PetscInt       i,j;

168:   SlepcValidVecComp(a);
169:   for (i=0;i<n;i++) SlepcValidVecComp(b[i]);

171:   if (as->n->n == 0) {
172:     *z = 0;
173:     return(0);
174:   }

176:   PetscMalloc(sizeof(PetscScalar)*n,&work0);
177:   PetscMalloc(sizeof(Vec)*n,&bx);

179: #if defined(__WITH_MPI__)
180:   if (as->x[0]->ops->mtdot_local) {
181:     r = work0; work = z;
182:   } else
183: #endif
184:   {
185:     r = z; work = work0;
186:   }

188:   /* z[i] <- a.x' * b[i].x */
189:   for (i=0;i<n;i++) bx[i] = ((Vec_Comp*)b[i]->data)->x[0];
190:   if (as->x[0]->ops->mtdot_local) {
191:     as->x[0]->ops->mtdot_local(as->x[0],n,bx,r);
192:   } else {
193:     VecMTDot(as->x[0],n,bx,r);
194:   }
195:   for (j=0;j<as->n->n;j++) {
196:     for (i=0;i<n;i++) bx[i] = ((Vec_Comp*)b[i]->data)->x[j];
197:     if (as->x[0]->ops->mtdot_local) {
198:       as->x[j]->ops->mtdot_local(as->x[j],n,bx,work);
199:     } else {
200:       VecMTDot(as->x[j],n,bx,work);
201:     }
202:     for (i=0;i<n;i++) r[i] += work[i];
203:   }

205:   /* If def(__WITH_MPI__) and exists mtdot_local */
206: #if defined(__WITH_MPI__)
207:   if (as->x[0]->ops->mtdot_local) {
208:     /* z[i] <- Allreduce(work[i]) */
209:     MPI_Allreduce(r,z,n,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));
210:   }
211: #endif

213:   PetscFree(work0);
214:   PetscFree(bx);
215:   return(0);
216: }

220: PetscErrorCode __SUF__(VecNorm_Comp)(Vec a,NormType t,PetscReal *norm)
221: {
222:   PetscReal      work[3],s=0.0;
224:   Vec_Comp       *as = (Vec_Comp*)a->data;
225:   PetscInt       i;

228:   SlepcValidVecComp(a);
229:   /* Initialize norm */
230:   switch (t) {
231:     case NORM_1: case NORM_INFINITY: *norm = 0.0; break;
232:     case NORM_2: case NORM_FROBENIUS: *norm = 1.0; s = 0.0; break;
233:     case NORM_1_AND_2: norm[0] = 0.0; norm[1] = 1.0; s = 0.0; break;
234:   }
235:   for (i=0;i<as->n->n;i++) {
236:     if (as->x[0]->ops->norm_local) {
237:       as->x[0]->ops->norm_local(as->x[i],t,work);
238:     } else {
239:       VecNorm(as->x[i],t,work);
240:     }
241:     /* norm+= work */
242:     switch (t) {
243:       case NORM_1: *norm+= *work; break;
244:       case NORM_2: case NORM_FROBENIUS: AddNorm2(norm,&s,*work); break;
245:       case NORM_1_AND_2: norm[0]+= work[0]; AddNorm2(&norm[1],&s,work[1]); break;
246:       case NORM_INFINITY: *norm = PetscMax(*norm,*work); break;
247:     }
248:   }

250:   /* If def(__WITH_MPI__) and exists norm_local */
251: #if defined(__WITH_MPI__)
252:   if (as->x[0]->ops->norm_local) {
253:     PetscReal work0[3];
254:     /* norm <- Allreduce(work) */
255:     switch (t) {
256:     case NORM_1:
257:       work[0] = *norm;
258:       MPI_Allreduce(work,norm,1,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)a));
259:       break;
260:     case NORM_2: case NORM_FROBENIUS:
261:       work[0] = *norm; work[1] = s;
262:       MPI_Allreduce(work,work0,1,MPIU_NORM2,MPIU_NORM2_SUM,PetscObjectComm((PetscObject)a));
263:       *norm = GetNorm2(work0[0],work0[1]);
264:       break;
265:     case NORM_1_AND_2:
266:       work[0] = norm[0]; work[1] = norm[1]; work[2] = s;
267:       MPI_Allreduce(work,work0,1,MPIU_NORM1_AND_2,MPIU_NORM2_SUM,PetscObjectComm((PetscObject)a));
268:       norm[0] = work0[0];
269:       norm[1] = GetNorm2(work0[1],work0[2]);
270:       break;
271:     case NORM_INFINITY:
272:       work[0] = *norm;
273:       MPI_Allreduce(work,norm,1,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)a));
274:       break;
275:     }
276:   }
277: #else
278:   /* Norm correction */
279:   switch (t) {
280:     case NORM_2: case NORM_FROBENIUS: *norm = GetNorm2(*norm,s); break;
281:     case NORM_1_AND_2: norm[1] = GetNorm2(norm[1],s); break;
282:     default: ;
283:   }
284: #endif
285:   return(0);
286: }

290: PetscErrorCode __SUF__(VecDotNorm2_Comp)(Vec v,Vec w,PetscScalar *dp,PetscScalar *nm)
291: {
292:   PetscScalar    *vx,*wx,dp0,nm0,dp1,nm1;
294:   Vec_Comp       *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data;
295:   PetscInt       i,n;
296:   PetscBool      t0,t1;
297: #if defined(__WITH_MPI__)
298:   PetscScalar    work[4];
299: #endif

302:   /* Compute recursively the local part */
303:   dp0 = nm0 = 0.0;
304:   PetscObjectTypeCompare((PetscObject)v,VECCOMP,&t0);
305:   PetscObjectTypeCompare((PetscObject)w,VECCOMP,&t1);
306:   if (t0 && t1) {
307:     SlepcValidVecComp(v);
308:     SlepcValidVecComp(w);
309:     for (i=0;i<vs->n->n;i++) {
310:       VecDotNorm2_Comp_Seq(vs->x[i],ws->x[i],&dp1,&nm1);
311:       dp0 += dp1;
312:       nm0 += nm1;
313:     }
314:   } else if (!t0 && !t1) {
315:     VecGetLocalSize(v,&n);
316:     VecGetArray(v,&vx);
317:     VecGetArray(w,&wx);
318:     for (i=0;i<n;i++) {
319:       dp0 += vx[i]*PetscConj(wx[i]);
320:       nm0 += wx[i]*PetscConj(wx[i]);
321:     }
322:     VecRestoreArray(v,&vx);
323:     VecRestoreArray(w,&wx);
324:   } else SETERRQ(PetscObjectComm((PetscObject)v),PETSC_ERR_ARG_INCOMP,"Incompatible vector types");

326: #if defined(__WITH_MPI__)
327:     /* [dp, nm] <- Allreduce([dp0, nm0]) */
328:     work[0] = dp0; work[1] = nm0;
329:     MPI_Allreduce(work,&work[2],2,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)v));
330:     *dp = work[2]; *nm = work[3];
331: #else
332:     *dp = dp0; *nm = nm0;
333: #endif
334:   return(0);
335: }


slepc-3.4.2.dfsg.orig/src/vec/veccomp.c.html0000644000175000017500000013436112211062077017552 0ustar gladkgladk
Actual source code: veccomp.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/vecimplslepc.h>     /*I "slepcvec.h" I*/

 24: /* Private MPI datatypes and operators */
 25: static MPI_Datatype MPIU_NORM2=0, MPIU_NORM1_AND_2=0;
 26: static MPI_Op MPIU_NORM2_SUM=0;
 27: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
 28: static PetscBool VecCompInitialized = PETSC_FALSE;
 29: #endif

 31: /* Private inline functions */
 32: PETSC_STATIC_INLINE void SumNorm2(PetscReal *,PetscReal *,PetscReal *,PetscReal *);
 33: PETSC_STATIC_INLINE PetscReal GetNorm2(PetscReal,PetscReal);
 34: PETSC_STATIC_INLINE void AddNorm2(PetscReal *,PetscReal *,PetscReal);

 36: #include "veccomp0.h"

 39: #include "veccomp0.h"

 41: PETSC_STATIC_INLINE void SumNorm2(PetscReal *ssq0,PetscReal *scale0,PetscReal *ssq1,PetscReal *scale1)
 42: {
 43:   PetscReal q;
 44:   if (*scale0 > *scale1) {
 45:     q = *scale1/(*scale0);
 46:     *ssq1 = *ssq0 + q*q*(*ssq1);
 47:     *scale1 = *scale0;
 48:   } else {
 49:     q = *scale0/(*scale1);
 50:     *ssq1 += q*q*(*ssq0);
 51:   }
 52: }

 54: PETSC_STATIC_INLINE PetscReal GetNorm2(PetscReal ssq,PetscReal scale)
 55: {
 56:   return scale*PetscSqrtReal(ssq);
 57: }

 59: PETSC_STATIC_INLINE void AddNorm2(PetscReal *ssq,PetscReal *scale,PetscReal x)
 60: {
 61:   PetscReal absx,q;
 62:   if (x != 0.0) {
 63:     absx = PetscAbs(x);
 64:     if (*scale < absx) {
 65:       q = *scale/absx;
 66:       *ssq = 1.0 + *ssq*q*q;
 67:       *scale = absx;
 68:     } else {
 69:       q = absx/(*scale);
 70:       *ssq += q*q;
 71:     }
 72:   }
 73: }

 75: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)

 79: static void SlepcSumNorm2_Local(void *in,void *out,PetscMPIInt *cnt,MPI_Datatype *datatype)
 80: {
 81:   PetscInt       i,count = *cnt;

 84:   if (*datatype == MPIU_NORM2) {
 85:     PetscReal *xin = (PetscReal*)in,*xout = (PetscReal*)out;
 86:     for (i=0; i<count; i++) {
 87:       SumNorm2(&xin[i*2],&xin[i*2+1],&xout[i*2],&xout[i*2+1]);
 88:     }
 89:   } else if (*datatype == MPIU_NORM1_AND_2) {
 90:     PetscReal *xin = (PetscReal*)in,*xout = (PetscReal*)out;
 91:     for (i=0; i<count; i++) {
 92:       xout[i*3]+= xin[i*3];
 93:       SumNorm2(&xin[i*3+1],&xin[i*3+2],&xout[i*3+1],&xout[i*3+2]);
 94:     }
 95:   } else {
 96:     (*PetscErrorPrintf)("Can only handle MPIU_NORM* data types");
 97:     MPI_Abort(MPI_COMM_WORLD,1);
 98:   }
 99:   PetscFunctionReturnVoid();
100: }

104: static PetscErrorCode VecNormCompEnd(void)
105: {

109:   MPI_Type_free(&MPIU_NORM2);
110:   MPI_Type_free(&MPIU_NORM1_AND_2);
111:   MPI_Op_free(&MPIU_NORM2_SUM);
112:   VecCompInitialized = PETSC_FALSE;
113:   return(0);
114: }

118: static PetscErrorCode VecNormCompInit()
119: {

123:   MPI_Type_contiguous(sizeof(PetscReal)*2,MPI_BYTE,&MPIU_NORM2);
124:   MPI_Type_commit(&MPIU_NORM2);
125:   MPI_Type_contiguous(sizeof(PetscReal)*3,MPI_BYTE,&MPIU_NORM1_AND_2);
126:   MPI_Type_commit(&MPIU_NORM1_AND_2);
127:   MPI_Op_create(SlepcSumNorm2_Local,1,&MPIU_NORM2_SUM);
128:   PetscRegisterFinalize(VecNormCompEnd);
129:   return(0);
130: }
131: #endif

135: PetscErrorCode VecDestroy_Comp(Vec v)
136: {
137:   Vec_Comp       *vs = (Vec_Comp*)v->data;
138:   PetscInt       i;

142: #if defined(PETSC_USE_LOG)
143:   PetscLogObjectState((PetscObject)v,"Length=%D",v->map->n);
144: #endif
145:   for (i=0;i<vs->nx;i++) {
146:     VecDestroy(&vs->x[i]);
147:   }
148:   if (--vs->n->friends <= 0) {
149:     PetscFree(vs->n);
150:   }
151:   PetscFree(vs->x);
152:   PetscFree(vs);
153:   return(0);
154: }

156: static struct _VecOps DvOps = {VecDuplicate_Comp, /* 1 */
157:             VecDuplicateVecs_Comp,
158:             VecDestroyVecs_Comp,
159:             VecDot_Comp_MPI,
160:             VecMDot_Comp_MPI,
161:             VecNorm_Comp_MPI,
162:             VecTDot_Comp_MPI,
163:             VecMTDot_Comp_MPI,
164:             VecScale_Comp,
165:             VecCopy_Comp, /* 10 */
166:             VecSet_Comp,
167:             VecSwap_Comp,
168:             VecAXPY_Comp,
169:             VecAXPBY_Comp,
170:             VecMAXPY_Comp,
171:             VecAYPX_Comp,
172:             VecWAXPY_Comp,
173:             VecAXPBYPCZ_Comp,
174:             VecPointwiseMult_Comp,
175:             VecPointwiseDivide_Comp,
176:             0, /* 20 */
177:             0,0,
178:             0 /*VecGetArray_Seq*/,
179:             VecGetSize_Comp,
180:             VecGetLocalSize_Comp,
181:             0/*VecRestoreArray_Seq*/,
182:             VecMax_Comp,
183:             VecMin_Comp,
184:             VecSetRandom_Comp,
185:             0, /* 30 */
186:             0,
187:             VecDestroy_Comp,
188:             VecView_Comp,
189:             0/*VecPlaceArray_Seq*/,
190:             0/*VecReplaceArray_Seq*/,
191:             VecDot_Comp_Seq,
192:             0,
193:             VecNorm_Comp_Seq,
194:             VecMDot_Comp_Seq,
195:             0, /* 40 */
196:             0,
197:             VecReciprocal_Comp,
198:             VecConjugate_Comp,
199:             0,0,
200:             0/*VecResetArray_Seq*/,
201:             0,
202:             VecMaxPointwiseDivide_Comp,
203:             VecPointwiseMax_Comp,
204:             VecPointwiseMaxAbs_Comp,
205:             VecPointwiseMin_Comp,
206:             0,
207:             VecSqrtAbs_Comp,
208:             VecAbs_Comp,
209:             VecExp_Comp,
210:             VecLog_Comp,
211:             0/*VecShift_Comp*/,
212:             0,
213:             0,
214:             0,
215:             VecDotNorm2_Comp_MPI
216:           };

220: PetscErrorCode VecDuplicateVecs_Comp(Vec w,PetscInt m,Vec *V[])
221: {
223:   PetscInt       i;

228:   if (m<=0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"m must be > 0: m = %D",m);
229:   PetscMalloc(m*sizeof(Vec*),V);
230:   for (i=0;i<m;i++) { VecDuplicate(w,*V+i); }
231:   return(0);
232: }

236: PetscErrorCode VecDestroyVecs_Comp(PetscInt m,Vec v[])
237: {
239:   PetscInt       i;

243:   if (m<=0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"m must be > 0: m = %D",m);
244:   for (i=0;i<m;i++) { VecDestroy(&v[i]); }
245:   PetscFree(v);
246:   return(0);
247: }

251: static PetscErrorCode VecCreate_Comp_Private(Vec v,Vec *x,PetscInt nx,PetscBool x_to_me,Vec_Comp_N *n)
252: {
253:   Vec_Comp       *s;
255:   PetscInt       N=0,lN=0,i,k;

258: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
259:   if (!VecCompInitialized) {
260:     VecCompInitialized = PETSC_TRUE;
261:     VecRegister(VECCOMP,VecCreate_Comp);
262:     VecNormCompInit();
263:   }
264: #endif
265:   /* Allocate a new Vec_Comp */
266:   if (v->data) { PetscFree(v->data); }
267:   PetscNewLog(v,Vec_Comp,&s);
268:   PetscMemcpy(v->ops,&DvOps,sizeof(DvOps));
269:   v->data  = (void*)s;
270:   v->petscnative     = PETSC_FALSE;

272:   /* Allocate the array of Vec, if it is needed to be done */
273:   if (x_to_me != PETSC_TRUE) {
274:     PetscMalloc(sizeof(Vec)*nx,&s->x);
275:     PetscMemcpy(s->x,x,sizeof(Vec)*nx);
276:   } else s->x = x;

278:   s->nx = nx;
279:   for (i=0;i<nx;i++) {
280:     VecGetSize(x[i],&k);
281:     N+= k;
282:     VecGetLocalSize(x[i],&k);
283:     lN+= k;
284:   }

286:   /* Allocate the shared structure, if it is not given */
287:   if (!n) {
288:     PetscNewLog(v,Vec_Comp_N,&n);
289:     s->n = n;
290:     n->n = nx;
291:     n->N = N;
292:     n->lN = lN;
293:     n->friends = 1;
294:   } else { /* If not, check in the vector in the shared structure */
295:     s->n = n;
296:     s->n->friends++;
297:     s->n->n = nx;
298:   }

300:   /* Set the virtual sizes as the real sizes of the vector */
301:   VecSetSizes(v,s->n->lN,s->n->N);

303:   PetscObjectChangeTypeName((PetscObject)v,VECCOMP);
304:   return(0);
305: }

309: PETSC_EXTERN PetscErrorCode VecCreate_Comp(Vec V)
310: {

314:   VecCreate_Comp_Private(V,NULL,0,PETSC_FALSE,NULL);
315:   return(0);
316: }

320: /*@C
321:    VecCreateComp - Creates a new vector containing several subvectors, each stored separately

323:    Collective on Vec

325:    Input Parameter:
326: +  comm - communicator for the new Vec
327: .  Nx   - array of (initial) global sizes of child vectors
328: .  n    - number of child vectors
329: .  t    - type of the child vectors
330: -  Vparent - (optional) template vector

332:    Output Parameter:
333: .  V - new vector

335:    Notes:
336:    This is similar to PETSc's VecNest but customized for SLEPc's needs. In particular,
337:    the number of child vectors can be modified dynamically, with VecCompSetSubVecs().

339:    Level: developer

341: .seealso: VecCreateCompWithVecs(), VecCompSetSubVecs()
342: @*/
343: PetscErrorCode VecCreateComp(MPI_Comm comm,PetscInt *Nx,PetscInt n,VecType t,Vec Vparent,Vec *V)
344: {
346:   Vec            *x;
347:   PetscInt       i;

350:   VecCreate(comm,V);
351:   PetscMalloc(n*sizeof(Vec),&x);
352:   PetscLogObjectMemory(*V,n*sizeof(Vec));
353:   for (i=0;i<n;i++) {
354:     VecCreate(comm,&x[i]);
355:     VecSetSizes(x[i],PETSC_DECIDE,Nx[i]);
356:     VecSetType(x[i],t);
357:   }
358:   VecCreate_Comp_Private(*V,x,n,PETSC_TRUE,
359:                            Vparent?((Vec_Comp*)Vparent->data)->n:NULL);
360:   return(0);
361: }

365: /*@C
366:    VecCreateCompWithVecs - Creates a new vector containing several subvectors,
367:    each stored separately, from an array of Vecs

369:    Collective on Vec

371:    Input Parameter:
372: +  x - array of Vecs
373: .  n - number of child vectors
374: -  Vparent - (optional) template vector

376:    Output Parameter:
377: .  V - new vector

379:    Level: developer

381: .seealso: VecCreateComp()
382: @*/
383: PetscErrorCode VecCreateCompWithVecs(Vec *x,PetscInt n,Vec Vparent,Vec *V)
384: {
386:   PetscInt       i;

389:   VecCreate(PetscObjectComm((PetscObject)x[0]),V);
390:   for (i=0;i<n;i++) {
391:     PetscObjectReference((PetscObject)x[i]);
392:   }
393:   VecCreate_Comp_Private(*V,x,n,PETSC_FALSE,
394:                            Vparent?((Vec_Comp*)Vparent->data)->n:NULL);
395:   return(0);
396: }

400: PetscErrorCode VecDuplicate_Comp(Vec win,Vec *V)
401: {
403:   Vec            *x;
404:   PetscInt       i;
405:   Vec_Comp       *s = (Vec_Comp*)win->data;

408:   SlepcValidVecComp(win);
409:   VecCreate(PetscObjectComm((PetscObject)win),V);
410:   PetscMalloc(s->nx*sizeof(Vec),&x);
411:   PetscLogObjectMemory(*V,s->nx*sizeof(Vec));
412:   for (i=0;i<s->nx;i++) {
413:     VecDuplicate(s->x[i],&x[i]);
414:   }
415:   VecCreate_Comp_Private(*V,x,s->nx,PETSC_TRUE,s->n);
416:   return(0);
417: }

421: /*@C
422:    VecCompGetSubVecs - Returns the entire array of vectors defining a compound vector

424:    Collective on Vec

426:    Input Parameter:
427: .  win - compound vector

429:    Output Parameter:
430: +  n - number of child vectors
431: -  x - array of child vectors

433:    Level: developer

435: .seealso: VecCreateComp()
436: @*/
437: PetscErrorCode VecCompGetSubVecs(Vec win,PetscInt *n,const Vec **x)
438: {
439:   Vec_Comp *s = (Vec_Comp*)win->data;

442:   SlepcValidVecComp(win);
443:   if (x) *x = s->x;
444:   if (n) *n = s->nx;
445:   return(0);
446: }

450: /*@C
451:    VecCompSetSubVecs - Resets the number of subvectors defining a compound vector,
452:    of replaces the subvectors

454:    Collective on Vec

456:    Input Parameters:
457: +  win - compound vector
458: .  n - number of child vectors
459: -  x - array of child vectors

461:    Level: developer

463: .seealso: VecCreateComp()
464: @*/
465: PetscErrorCode VecCompSetSubVecs(Vec win,PetscInt n,Vec *x)
466: {
467:   Vec_Comp       *s = (Vec_Comp*)win->data;

471:   SlepcValidVecComp(win);
472:   if (x) {
473:     if (n > s->nx) {
474:       PetscFree(s->x);
475:       PetscMalloc(sizeof(Vec)*n,&s->x);
476:     }
477:     PetscMemcpy(s->x,x,sizeof(Vec)*n);
478:     s->nx = n;
479:   }
480:   s->n->n = n;
481:   return(0);
482: }

486: PetscErrorCode VecAXPY_Comp(Vec v,PetscScalar alpha,Vec w)
487: {
489:   Vec_Comp       *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data;
490:   PetscInt       i;

493:   SlepcValidVecComp(v);
494:   SlepcValidVecComp(w);
495:   for (i=0;i<vs->n->n;i++) {
496:     VecAXPY(vs->x[i],alpha,ws->x[i]);
497:   }
498:   return(0);
499: }

503: PetscErrorCode VecAYPX_Comp(Vec v,PetscScalar alpha,Vec w)
504: {
506:   Vec_Comp       *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data;
507:   PetscInt       i;

510:   SlepcValidVecComp(v);
511:   SlepcValidVecComp(w);
512:   for (i=0;i<vs->n->n;i++) {
513:     VecAYPX(vs->x[i],alpha,ws->x[i]);
514:   }
515:   return(0);
516: }

520: PetscErrorCode VecAXPBY_Comp(Vec v,PetscScalar alpha,PetscScalar beta,Vec w)
521: {
523:   Vec_Comp       *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data;
524:   PetscInt       i;

527:   SlepcValidVecComp(v);
528:   SlepcValidVecComp(w);
529:   for (i=0;i<vs->n->n;i++) {
530:     VecAXPBY(vs->x[i],alpha,beta,ws->x[i]);
531:   }
532:   return(0);
533: }

537: PetscErrorCode VecMAXPY_Comp(Vec v,PetscInt n,const PetscScalar *alpha,Vec *w)
538: {
540:   Vec_Comp       *vs = (Vec_Comp*)v->data;
541:   Vec            *wx;
542:   PetscInt       i,j;

545:   SlepcValidVecComp(v);
546:   for (i=0;i<n;i++) SlepcValidVecComp(w[i]);

548:   PetscMalloc(sizeof(Vec)*n,&wx);

550:   for (j=0;j<vs->n->n;j++) {
551:     for (i=0;i<n;i++) wx[i] = ((Vec_Comp*)w[i]->data)->x[j];
552:     VecMAXPY(vs->x[j],n,alpha,wx);
553:   }

555:   PetscFree(wx);
556:   return(0);
557: }

561: PetscErrorCode VecWAXPY_Comp(Vec v,PetscScalar alpha,Vec w,Vec z)
562: {
564:   Vec_Comp       *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data,*zs = (Vec_Comp*)z->data;
565:   PetscInt       i;

568:   SlepcValidVecComp(v);
569:   SlepcValidVecComp(w);
570:   SlepcValidVecComp(z);
571:   for (i=0;i<vs->n->n;i++) {
572:     VecWAXPY(vs->x[i],alpha,ws->x[i],zs->x[i]);
573:   }
574:   return(0);
575: }

579: PetscErrorCode VecAXPBYPCZ_Comp(Vec v,PetscScalar alpha,PetscScalar beta,PetscScalar gamma,Vec w,Vec z)
580: {
581:   PetscErrorCode  ierr;
582:   Vec_Comp        *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data,*zs = (Vec_Comp*)z->data;
583:   PetscInt        i;

586:   SlepcValidVecComp(v);
587:   SlepcValidVecComp(w);
588:   SlepcValidVecComp(z);
589:   for (i=0;i<vs->n->n;i++) {
590:     VecAXPBYPCZ(vs->x[i],alpha,beta,gamma,ws->x[i],zs->x[i]);
591:   }
592:   return(0);
593: }

597: PetscErrorCode VecGetSize_Comp(Vec v,PetscInt *size)
598: {
599:   Vec_Comp *vs = (Vec_Comp*)v->data;

602:   SlepcValidVecComp(v);
604:   *size = vs->n->N;
605:   return(0);
606: }

610: PetscErrorCode VecGetLocalSize_Comp(Vec v,PetscInt *size)
611: {
612:   Vec_Comp *vs = (Vec_Comp*)v->data;

615:   SlepcValidVecComp(v);
617:   *size = vs->n->lN;
618:   return(0);
619: }

623: PetscErrorCode VecMax_Comp(Vec v,PetscInt *idx,PetscReal *z)
624: {
626:   Vec_Comp       *vs = (Vec_Comp*)v->data;
627:   PetscInt       idxp,s=0,s0;
628:   PetscReal      zp,z0;
629:   PetscInt       i;

632:   SlepcValidVecComp(v);
633:   if (!idx && !z) return(0);

635:   if (vs->n->n > 0) {
636:     VecMax(vs->x[0],idx?&idxp:NULL,&zp);
637:   }
638:   for (i=1;i<vs->n->n;i++) {
639:     VecGetSize(vs->x[i-1],&s0);
640:     s+= s0;
641:     VecMax(vs->x[i],idx?&idxp:NULL,&z0);
642:     if (zp < z0) {
643:       if (idx) *idx = s+idxp;
644:       zp = z0;
645:     }
646:   }
647:   if (z) *z = zp;
648:   return(0);
649: }

653: PetscErrorCode VecMin_Comp(Vec v,PetscInt *idx,PetscReal *z)
654: {
656:   Vec_Comp       *vs = (Vec_Comp*)v->data;
657:   PetscInt       idxp,s=0,s0;
658:   PetscReal      zp,z0;
659:   PetscInt       i;

662:   SlepcValidVecComp(v);
663:   if (!idx && !z) return(0);

665:   if (vs->n->n > 0) {
666:     VecMin(vs->x[0],idx?&idxp:NULL,&zp);
667:   }
668:   for (i=1;i<vs->n->n;i++) {
669:     VecGetSize(vs->x[i-1],&s0);
670:     s+= s0;
671:     VecMin(vs->x[i],idx?&idxp:NULL,&z0);
672:     if (zp > z0) {
673:       if (idx) *idx = s+idxp;
674:       zp = z0;
675:     }
676:   }
677:   if (z) *z = zp;
678:   return(0);
679: }

683: PetscErrorCode VecMaxPointwiseDivide_Comp(Vec v,Vec w,PetscReal *m)
684: {
686:   Vec_Comp       *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data;
687:   PetscReal      work;
688:   PetscInt       i;

691:   SlepcValidVecComp(v);
692:   SlepcValidVecComp(w);
693:   if (!m || vs->n->n == 0) return(0);
694:   VecMaxPointwiseDivide(vs->x[0],ws->x[0],m);
695:   for (i=1;i<vs->n->n;i++) {
696:     VecMaxPointwiseDivide(vs->x[i],ws->x[i],&work);
697:     *m = PetscMax(*m,work);
698:   }
699:   return(0);
700: }



708: PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v) \
709: { \
710:   PetscErrorCode  ierr; \
711:   Vec_Comp        *vs = (Vec_Comp*)v->data; \
712:   PetscInt        i; \
713: \
715:   SlepcValidVecComp(v); \
716:   for (i=0;i<vs->n->n;i++) { \
717:     __COMPOSE2__(Vec,NAME)(vs->x[i]); \
718:   } \
719:   return(0);\
720: }

724: __FUNC_TEMPLATE1__(Conjugate)

728: __FUNC_TEMPLATE1__(Reciprocal)

732: __FUNC_TEMPLATE1__(SqrtAbs)

736: __FUNC_TEMPLATE1__(Abs)

740: __FUNC_TEMPLATE1__(Exp)

744: __FUNC_TEMPLATE1__(Log)


748: PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v,T0 __a) \
749: { \
750:   PetscErrorCode  ierr; \
751:   Vec_Comp        *vs = (Vec_Comp*)v->data; \
752:   PetscInt        i; \
753: \
755:   SlepcValidVecComp(v); \
756:   for (i=0;i<vs->n->n;i++) { \
757:     __COMPOSE2__(Vec,NAME)(vs->x[i],__a); \
758:   } \
759:   return(0);\
760: }

764: __FUNC_TEMPLATE2__(Set,PetscScalar)

768: __FUNC_TEMPLATE2__(View,PetscViewer)

772: __FUNC_TEMPLATE2__(Scale,PetscScalar)

776: __FUNC_TEMPLATE2__(SetRandom,PetscRandom)

780: __FUNC_TEMPLATE2__(Shift,PetscScalar)


784: PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v,Vec w) \
785: { \
786:   PetscErrorCode  ierr; \
787:   Vec_Comp        *vs = (Vec_Comp*)v->data,\
788:                   *ws = (Vec_Comp*)w->data; \
789:   PetscInt        i; \
790: \
792:   SlepcValidVecComp(v); \
793:   SlepcValidVecComp(w); \
794:   for (i=0;i<vs->n->n;i++) { \
795:     __COMPOSE2__(Vec,NAME)(vs->x[i],ws->x[i]); \
796:   } \
797:   return(0);\
798: }

802: __FUNC_TEMPLATE3__(Copy)

806: __FUNC_TEMPLATE3__(Swap)


810: PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v,Vec w,Vec z) \
811: { \
812:   PetscErrorCode  ierr; \
813:   Vec_Comp        *vs = (Vec_Comp*)v->data, \
814:                   *ws = (Vec_Comp*)w->data, \
815:                   *zs = (Vec_Comp*)z->data; \
816:   PetscInt        i; \
817: \
819:   SlepcValidVecComp(v); \
820:   SlepcValidVecComp(w); \
821:   SlepcValidVecComp(z); \
822:   for (i=0;i<vs->n->n;i++) { \
823:     __COMPOSE2__(Vec,NAME)(vs->x[i],ws->x[i],zs->x[i]); \
824:   } \
825:   return(0);\
826: }

830: __FUNC_TEMPLATE4__(PointwiseMax)

834: __FUNC_TEMPLATE4__(PointwiseMaxAbs)

838: __FUNC_TEMPLATE4__(PointwiseMin)

842: __FUNC_TEMPLATE4__(PointwiseMult)

846: __FUNC_TEMPLATE4__(PointwiseDivide)
slepc-3.4.2.dfsg.orig/src/vec/makefile0000644000175000017500000000216712211062077016505 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = vecutil.c veccomp.c contiguous.c SOURCEF = SOURCEH = veccomp0.h LIBBASE = libslepc DIRS = MANSEC = sys LOCDIR = src/vec/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/vec/makefile.html0000644000175000017500000000367612211062077017456 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = vecutil.c veccomp.c contiguous.c
SOURCEF  =
SOURCEH  = veccomp0.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = sys
LOCDIR   = src/vec/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/vec/index.html0000644000175000017500000000161212211062077016774 0ustar gladkgladk SLEPc System Routines

SLEPc System routines

SLEPc provides a variety of "system" level routines. These routines are generally tools used by other SLEPc routines and are not intended for application programmers (except the basic SlepcInitialize() / SlepcFinalize()).

Useful tools for application programmers can be found in PETSc's system routines, including parallel file access, synchronized printing to screen, and many other programming aids.

veccomp0.h
vecutil.c
veccomp.c
contiguous.c
makefile
slepc-3.4.2.dfsg.orig/src/vec/contiguous.c0000644000175000017500000004154612211062077017354 0ustar gladkgladk/* Subroutines related to special Vecs that share a common contiguous storage. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcvec.h" I*/ #include /*I "petscvec.h" I*/ #include PetscLogEvent SLEPC_UpdateVectors = 0,SLEPC_VecMAXPBY = 0; #undef __FUNCT__ #define __FUNCT__ "Vecs_ContiguousDestroy" /* Frees the array of the contiguous vectors when all vectors have been destroyed. */ static PetscErrorCode Vecs_ContiguousDestroy(void *ctx) { PetscErrorCode ierr; Vecs_Contiguous *vc = (Vecs_Contiguous*)ctx; PetscFunctionBegin; ierr = PetscFree(vc->array);CHKERRQ(ierr); ierr = PetscFree(vc);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecDuplicateVecs_Contiguous" /* Version of VecDuplicateVecs that sets contiguous storage. */ static PetscErrorCode VecDuplicateVecs_Contiguous(Vec v,PetscInt m,Vec *V[]) { PetscErrorCode ierr; PetscInt i,nloc; PetscScalar *pV; PetscContainer container; Vecs_Contiguous *vc; PetscFunctionBegin; /* Allocate array */ ierr = VecGetLocalSize(v,&nloc);CHKERRQ(ierr); ierr = PetscMalloc(m*nloc*sizeof(PetscScalar),&pV);CHKERRQ(ierr); /* Create container */ ierr = PetscNew(Vecs_Contiguous,&vc);CHKERRQ(ierr); vc->nvecs = m; vc->array = pV; ierr = PetscContainerCreate(PetscObjectComm((PetscObject)v),&container);CHKERRQ(ierr); ierr = PetscContainerSetPointer(container,vc);CHKERRQ(ierr); ierr = PetscContainerSetUserDestroy(container,Vecs_ContiguousDestroy);CHKERRQ(ierr); /* Create vectors */ ierr = PetscMalloc(m*sizeof(Vec),V);CHKERRQ(ierr); for (i=0;iops->duplicatevecs = VecDuplicateVecs_Contiguous; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcMatGetVecsTemplate" /*@ SlepcMatGetVecsTemplate - Get vectors compatible with a matrix, i.e. with the same parallel layout, and mark them as templates for contiguous storage. Collective on Mat Input Parameter: . mat - the matrix Output Parameters: + right - (optional) vector that the matrix can be multiplied against - left - (optional) vector that the matrix vector product can be stored in Options Database Keys: . -slepc_non_contiguous - Disable contiguous vector storage Notes: Use -slepc_non_contiguous to disable contiguous storage throughout SLEPc. Contiguous storage is currently also disabled in AIJCUSP matrices. Level: developer .seealso: SlepcVecSetTemplate() @*/ PetscErrorCode SlepcMatGetVecsTemplate(Mat mat,Vec *right,Vec *left) { PetscErrorCode ierr; PetscBool flg; Vec v; PetscFunctionBegin; PetscValidHeaderSpecific(mat,MAT_CLASSID,1); PetscValidType(mat,1); ierr = MatGetVecs(mat,right,left);CHKERRQ(ierr); v = right? *right: *left; ierr = PetscObjectTypeCompareAny((PetscObject)v,&flg,VECSEQ,VECMPI,"");CHKERRQ(ierr); if (!flg) PetscFunctionReturn(0); ierr = PetscOptionsHasName(NULL,"-slepc_non_contiguous",&flg);CHKERRQ(ierr); if (!flg) { if (right) { ierr = SlepcVecSetTemplate(*right);CHKERRQ(ierr); } if (left) { ierr = SlepcVecSetTemplate(*left);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcUpdateVectors_Noncontiguous_Inplace" /* SlepcUpdateVectors_Noncontiguous_Inplace - V = V*Q for regular vectors (non-contiguous). */ static PetscErrorCode SlepcUpdateVectors_Noncontiguous_Inplace(PetscInt m_,Vec *V,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans) { PetscInt l; PetscBLASInt j,ls,bs=64,m,k,ldq; PetscScalar *pv,*pq=(PetscScalar*)Q,*work,*out,one=1.0,zero=0.0; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscLogEventBegin(SLEPC_UpdateVectors,0,0,0,0);CHKERRQ(ierr); ierr = VecGetLocalSize(V[0],&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(l,&ls);CHKERRQ(ierr); ierr = PetscBLASIntCast(m_,&m);CHKERRQ(ierr); ierr = PetscBLASIntCast(ldq_,&ldq);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*2*bs*m,&work);CHKERRQ(ierr); out = work+m*bs; k = ls % bs; if (k) { for (j=0;j0) { for (i=s;ie) { for (i=s;i=e) PetscFunctionReturn(0); PetscValidPointer(V,2); PetscValidHeaderSpecific(*V,VEC_CLASSID,2); PetscValidType(*V,2); PetscValidScalarPointer(Q,5); ierr = PetscObjectQuery((PetscObject)(V[0]),"contiguous",(PetscObject*)&container);CHKERRQ(ierr); if (container) { /* contiguous Vecs, use BLAS calls */ ierr = SlepcUpdateStrideVectors(n,V,s,1,e,Q,ldq,qtrans);CHKERRQ(ierr); } else { /* use regular Vec operations */ ierr = SlepcUpdateVectors_Noncontiguous(n,V,s,e,Q,ldq,qtrans);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SlepcUpdateStrideVectors" /*@ SlepcUpdateStrideVectors - Update a set of vectors V as V(:,s:d:e-1) = V*Q(:,s:e-1). Not Collective Input parameters: + n - number of vectors in V . s - first column of V to be overwritten . d - stride . e - first column of V not to be overwritten . Q - matrix containing the coefficients of the update . ldq - leading dimension of Q - qtrans - flag indicating if Q is to be transposed Input/Output parameter: . V - set of vectors Notes: This function computes V(:,s:d:e-1) = V*Q(:,s:e-1), that is, given a set of vectors V, columns from s to e-1 are overwritten with columns from s to e-1 of the matrix-matrix product V*Q. Matrix V is represented as an array of Vec, whereas Q is represented as a column-major dense array of leading dimension ldq. Only columns s to e-1 of Q are referenced. If qtrans=PETSC_TRUE, the operation is V*Q'. This routine is implemented with a call to BLAS, therefore V is an array of Vec which have the data stored contiguously in memory as a Fortran matrix. PETSc does not create such arrays by default. Level: developer .seealso: SlepcUpdateVectors() @*/ PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans) { PetscErrorCode ierr; PetscInt l; PetscBLASInt i,j,k,bs=64,m,n,ldq,ls,ld; PetscScalar *pv,*pw,*pq,*work,*pwork,one=1.0,zero=0.0; const char *qt; PetscFunctionBegin; ierr = PetscBLASIntCast(n_/d,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ldq_,&ldq);CHKERRQ(ierr); m = (e-s)/d; if (!m) PetscFunctionReturn(0); PetscValidIntPointer(Q,5); if (m<0 || n<0 || s<0 || m>n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Index argument out of range"); ierr = PetscLogEventBegin(SLEPC_UpdateVectors,0,0,0,0);CHKERRQ(ierr); ierr = VecGetLocalSize(V[0],&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(l,&ls);CHKERRQ(ierr); ierr = PetscBLASIntCast(ls*d,&ld);CHKERRQ(ierr); ierr = VecGetArray(V[0],&pv);CHKERRQ(ierr); if (qtrans) { pq = (PetscScalar*)Q+s; qt = "C"; } else { pq = (PetscScalar*)Q+s*ldq; qt = "N"; } ierr = PetscMalloc(sizeof(PetscScalar)*bs*m,&work);CHKERRQ(ierr); k = ls % bs; if (k) { PetscStackCallBLAS("BLASgemm",BLASgemm_("N",qt,&k,&m,&n,&one,pv,&ld,pq,&ldq,&zero,work,&k)); for (j=0;jmap->N != (y)->map->N) SETERRQ(PetscObjectComm((PetscObject)y),PETSC_ERR_ARG_INCOMP,"Incompatible vector global lengths"); if ((*x)->map->n != (y)->map->n) SETERRQ(PetscObjectComm((PetscObject)y),PETSC_ERR_ARG_INCOMP,"Incompatible vector local lengths"); ierr = PetscObjectQuery((PetscObject)(x[0]),"contiguous",(PetscObject*)&container);CHKERRQ(ierr); if (container) { /* assume x Vecs are contiguous, use BLAS calls */ ierr = PetscLogEventBegin(SLEPC_VecMAXPBY,*x,y,0,0);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecGetArrayRead(*x,&px);CHKERRQ(ierr); ierr = PetscBLASIntCast(nv,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast((y)->map->n,&m);CHKERRQ(ierr); if (m>0) PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&m,&n,&alpha,px,&m,a,&one,&beta,py,&one)); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); ierr = VecRestoreArrayRead(*x,&px);CHKERRQ(ierr); ierr = PetscLogFlops(nv*2*(y)->map->n);CHKERRQ(ierr); ierr = PetscLogEventEnd(SLEPC_VecMAXPBY,*x,y,0,0);CHKERRQ(ierr); } else { /* use regular Vec operations */ if (alpha==-beta) { for (i=0;iActual source code: vecutil.c

  1: /*
  2:    Miscellaneous Vec-related functions.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/vecimplslepc.h>            /*I "slepcvec.h" I*/
 25: #include <slepcsys.h>

 29: /*@
 30:    SlepcVecSetRandom - Sets all components of a vector to random numbers.

 32:    Logically Collective on Vec

 34:    Input/Output Parameter:
 35: .  x  - the vector

 37:    Input Parameter:
 38: -  rctx - the random number context, formed by PetscRandomCreate(), or NULL and
 39:           it will create one internally.

 41:    Note:
 42:    This operation is equivalent to VecSetRandom - the difference is that the
 43:    vector generated by SlepcVecSetRandom is the same irrespective of the size
 44:    of the communicator (if all processes pass a PetscRandom context initialized
 45:    with the same seed).

 47:    Level: developer
 48: @*/
 49: PetscErrorCode SlepcVecSetRandom(Vec x,PetscRandom rctx)
 50: {
 52:   PetscRandom    randObj = NULL;
 53:   PetscInt       i,n,low,high;
 54:   PetscScalar    *px,t;

 59:   else {
 60:     PetscRandomCreate(PetscObjectComm((PetscObject)x),&randObj);
 61:     PetscRandomSetSeed(randObj,0x12345678);
 62:     PetscRandomSetFromOptions(randObj);
 63:     rctx = randObj;
 64:   }

 66:   VecGetSize(x,&n);
 67:   VecGetOwnershipRange(x,&low,&high);
 68:   VecGetArray(x,&px);
 69:   for (i=0;i<n;i++) {
 70:     PetscRandomGetValue(rctx,&t);
 71:     if (i>=low && i<high) px[i-low] = t;
 72:   }
 73:   VecRestoreArray(x,&px);
 74:   PetscRandomDestroy(&randObj);
 75:   PetscObjectStateIncrease((PetscObject)x);
 76:   return(0);
 77: }

 81: /*@C
 82:    SlepcVecNormalize - Normalizes a possibly complex vector by the 2-norm.

 84:    Collective on Vec

 86:    Input parameters:
 87: +  xr         - the real part of the vector (overwritten on output)
 88: .  xi         - the imaginary part of the vector (not referenced if iscomplex is false)
 89: -  iscomplex - a flag that indicating if the vector is complex

 91:    Output parameter:
 92: .  norm      - the vector norm before normalization (can be set to NULL)

 94:    Level: developer

 96: @*/
 97: PetscErrorCode SlepcVecNormalize(Vec xr,Vec xi,PetscBool iscomplex,PetscReal *norm)
 98: {
100: #if !defined(PETSC_USE_COMPLEX)
101:   PetscReal      normr,normi,alpha;
102: #endif

106: #if !defined(PETSC_USE_COMPLEX)
107:   if (iscomplex) {
109:     VecNormBegin(xr,NORM_2,&normr);
110:     VecNormBegin(xi,NORM_2,&normi);
111:     VecNormEnd(xr,NORM_2,&normr);
112:     VecNormEnd(xi,NORM_2,&normi);
113:     alpha = SlepcAbsEigenvalue(normr,normi);
114:     if (norm) *norm = alpha;
115:     alpha = 1.0 / alpha;
116:     VecScale(xr,alpha);
117:     VecScale(xi,alpha);
118:   } else
119: #endif
120:   {
121:     VecNormalize(xr,norm);
122:   }
123:   return(0);
124: }

slepc-3.4.2.dfsg.orig/src/vec/vecutil.c0000644000175000017500000001000712211062077016614 0ustar gladkgladk/* Miscellaneous Vec-related functions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcvec.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "SlepcVecSetRandom" /*@ SlepcVecSetRandom - Sets all components of a vector to random numbers. Logically Collective on Vec Input/Output Parameter: . x - the vector Input Parameter: - rctx - the random number context, formed by PetscRandomCreate(), or NULL and it will create one internally. Note: This operation is equivalent to VecSetRandom - the difference is that the vector generated by SlepcVecSetRandom is the same irrespective of the size of the communicator (if all processes pass a PetscRandom context initialized with the same seed). Level: developer @*/ PetscErrorCode SlepcVecSetRandom(Vec x,PetscRandom rctx) { PetscErrorCode ierr; PetscRandom randObj = NULL; PetscInt i,n,low,high; PetscScalar *px,t; PetscFunctionBegin; PetscValidHeaderSpecific(x,VEC_CLASSID,1); if (rctx) PetscValidHeaderSpecific(rctx,PETSC_RANDOM_CLASSID,2); else { ierr = PetscRandomCreate(PetscObjectComm((PetscObject)x),&randObj);CHKERRQ(ierr); ierr = PetscRandomSetSeed(randObj,0x12345678);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(randObj);CHKERRQ(ierr); rctx = randObj; } ierr = VecGetSize(x,&n);CHKERRQ(ierr); ierr = VecGetOwnershipRange(x,&low,&high);CHKERRQ(ierr); ierr = VecGetArray(x,&px);CHKERRQ(ierr); for (i=0;i=low && iActual source code: contiguous.c
  1: /*
  2:    Subroutines related to special Vecs that share a common contiguous storage.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/vecimplslepc.h>       /*I "slepcvec.h" I*/
 25: #include <petsc-private/vecimpl.h>            /*I "petscvec.h" I*/
 26: #include <petscblaslapack.h>

 28: PetscLogEvent SLEPC_UpdateVectors = 0,SLEPC_VecMAXPBY = 0;

 32: /*
 33:   Frees the array of the contiguous vectors when all vectors have been destroyed.
 34: */
 35: static PetscErrorCode Vecs_ContiguousDestroy(void *ctx)
 36: {
 37:   PetscErrorCode  ierr;
 38:   Vecs_Contiguous *vc = (Vecs_Contiguous*)ctx;

 41:   PetscFree(vc->array);
 42:   PetscFree(vc);
 43:   return(0);
 44: }

 48: /*
 49:   Version of VecDuplicateVecs that sets contiguous storage.
 50: */
 51: static PetscErrorCode VecDuplicateVecs_Contiguous(Vec v,PetscInt m,Vec *V[])
 52: {
 53:   PetscErrorCode  ierr;
 54:   PetscInt        i,nloc;
 55:   PetscScalar     *pV;
 56:   PetscContainer  container;
 57:   Vecs_Contiguous *vc;

 60:   /* Allocate array */
 61:   VecGetLocalSize(v,&nloc);
 62:   PetscMalloc(m*nloc*sizeof(PetscScalar),&pV);
 63:   /* Create container */
 64:   PetscNew(Vecs_Contiguous,&vc);
 65:   vc->nvecs = m;
 66:   vc->array = pV;
 67:   PetscContainerCreate(PetscObjectComm((PetscObject)v),&container);
 68:   PetscContainerSetPointer(container,vc);
 69:   PetscContainerSetUserDestroy(container,Vecs_ContiguousDestroy);
 70:   /* Create vectors */
 71:   PetscMalloc(m*sizeof(Vec),V);
 72:   for (i=0;i<m;i++) {
 73:     VecCreateMPIWithArray(PetscObjectComm((PetscObject)v),1,nloc,PETSC_DECIDE,pV+i*nloc,*V+i);
 74:     PetscObjectCompose((PetscObject)*(*V+i),"contiguous",(PetscObject)container);
 75:   }
 76:   PetscContainerDestroy(&container);
 77:   return(0);
 78: }

 82: /*@
 83:    SlepcVecSetTemplate - Sets a vector as a template for contiguous storage.

 85:    Collective on Vec

 87:    Input Parameters:
 88: .  v - the vector

 90:    Note:
 91:    Once this function is called, subsequent calls to VecDuplicateVecs()
 92:    with this vector will use a special version that generates vectors with
 93:    contiguous storage, that is, the array of values of V[1] immediately
 94:    follows the array of V[0], and so on.

 96:    Level: developer
 97: @*/
 98: PetscErrorCode SlepcVecSetTemplate(Vec v)
 99: {
101:   PetscBool      flg;

105:   PetscObjectTypeCompareAny((PetscObject)v,&flg,VECSEQ,VECMPI,"");
106:   if (!flg) SETERRQ(PetscObjectComm((PetscObject)v),PETSC_ERR_SUP,"Only available for standard vectors (VECSEQ or VECMPI)");
107:   v->ops->duplicatevecs = VecDuplicateVecs_Contiguous;
108:   return(0);
109: }

113: /*@
114:    SlepcMatGetVecsTemplate - Get vectors compatible with a matrix,
115:    i.e. with the same parallel layout, and mark them as templates
116:    for contiguous storage.

118:    Collective on Mat

120:    Input Parameter:
121: .  mat - the matrix

123:    Output Parameters:
124: +  right - (optional) vector that the matrix can be multiplied against
125: -  left  - (optional) vector that the matrix vector product can be stored in

127:    Options Database Keys:
128: .  -slepc_non_contiguous - Disable contiguous vector storage

130:    Notes:
131:    Use -slepc_non_contiguous to disable contiguous storage throughout SLEPc.
132:    Contiguous storage is currently also disabled in AIJCUSP matrices.

134:    Level: developer

136: .seealso: SlepcVecSetTemplate()
137: @*/
138: PetscErrorCode SlepcMatGetVecsTemplate(Mat mat,Vec *right,Vec *left)
139: {
141:   PetscBool      flg;
142:   Vec            v;

147:   MatGetVecs(mat,right,left);
148:   v = right? *right: *left;
149:   PetscObjectTypeCompareAny((PetscObject)v,&flg,VECSEQ,VECMPI,"");
150:   if (!flg) return(0);
151:   PetscOptionsHasName(NULL,"-slepc_non_contiguous",&flg);
152:   if (!flg) {
153:     if (right) { SlepcVecSetTemplate(*right); }
154:     if (left) { SlepcVecSetTemplate(*left); }
155:   }
156:   return(0);
157: }

161: /*
162:    SlepcUpdateVectors_Noncontiguous_Inplace - V = V*Q for regular vectors
163:    (non-contiguous).
164: */
165: static PetscErrorCode SlepcUpdateVectors_Noncontiguous_Inplace(PetscInt m_,Vec *V,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans)
166: {
167:   PetscInt       l;
168:   PetscBLASInt   j,ls,bs=64,m,k,ldq;
169:   PetscScalar    *pv,*pq=(PetscScalar*)Q,*work,*out,one=1.0,zero=0.0;

173:   PetscLogEventBegin(SLEPC_UpdateVectors,0,0,0,0);
174:   VecGetLocalSize(V[0],&l);
175:   PetscBLASIntCast(l,&ls);
176:   PetscBLASIntCast(m_,&m);
177:   PetscBLASIntCast(ldq_,&ldq);
178:   PetscMalloc(sizeof(PetscScalar)*2*bs*m,&work);
179:   out = work+m*bs;
180:   k = ls % bs;
181:   if (k) {
182:     for (j=0;j<m;j++) {
183:       VecGetArray(V[j],&pv);
184:       PetscMemcpy(work+j*bs,pv,k*sizeof(PetscScalar));
185:       VecRestoreArray(V[j],&pv);
186:     }
187:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N",qtrans?"C":"N",&k,&m,&m,&one,work,&bs,pq,&ldq,&zero,out,&bs));
188:     for (j=0;j<m;j++) {
189:       VecGetArray(V[j],&pv);
190:       PetscMemcpy(pv,out+j*bs,k*sizeof(PetscScalar));
191:       VecRestoreArray(V[j],&pv);
192:     }
193:   }
194:   for (;k<ls;k+=bs) {
195:     for (j=0;j<m;j++) {
196:       VecGetArray(V[j],&pv);
197:       PetscMemcpy(work+j*bs,pv+k,bs*sizeof(PetscScalar));
198:       VecRestoreArray(V[j],&pv);
199:     }
200:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N",qtrans?"C":"N",&bs,&m,&m,&one,work,&bs,pq,&ldq,&zero,out,&bs));
201:     for (j=0;j<m;j++) {
202:       VecGetArray(V[j],&pv);
203:       PetscMemcpy(pv+k,out+j*bs,bs*sizeof(PetscScalar));
204:       VecRestoreArray(V[j],&pv);
205:     }
206:   }
207:   PetscFree(work);
208:   PetscLogFlops(m*m*2.0*ls);
209:   PetscLogEventEnd(SLEPC_UpdateVectors,0,0,0,0);
210:   return(0);
211: }

215: /*
216:    SlepcUpdateVectors_Noncontiguous - V(:,s:e-1) = V*Q(:,s:e-1) for
217:    regular vectors (non-contiguous).

219:    Writing V = [ V1 V2 V3 ] and Q = [ Q1 Q2 Q3 ], where the V2 and Q2
220:    correspond to the columns s:e-1, the computation is done as
221:                   V2 := V2*Q2 + V1*Q1 + V3*Q3
222:    (the first term is computed with SlepcUpdateVectors_Noncontiguous_Inplace).
223: */
224: static PetscErrorCode SlepcUpdateVectors_Noncontiguous(PetscInt n,Vec *V,PetscInt s,PetscInt e,const PetscScalar *Q,PetscInt ldq,PetscBool qtrans)
225: {
226:   PetscInt       i,j,m,ln;
227:   PetscScalar    *pq,qt[100];
228:   PetscBool      allocated = PETSC_FALSE;

232:   m = e-s;
233:   if (qtrans) {
234:     ln = PetscMax(s,n-e);
235:     if (ln<=100) pq = qt;
236:     else {
237:       PetscMalloc(ln*sizeof(PetscScalar),&pq);
238:       allocated = PETSC_TRUE;
239:     }
240:   }
241:   /* V2 */
242:   SlepcUpdateVectors_Noncontiguous_Inplace(m,V+s,Q+s*ldq+s,ldq,qtrans);
243:   /* V1 */
244:   if (s>0) {
245:     for (i=s;i<e;i++) {
246:       if (qtrans) {
247:         for (j=0;j<s;j++) pq[j] = Q[i+j*ldq];
248:       } else pq = (PetscScalar*)Q+i*ldq;
249:       VecMAXPY(V[i],s,pq,V);
250:     }
251:   }
252:   /* V3 */
253:   if (n>e) {
254:     for (i=s;i<e;i++) {
255:       if (qtrans) {
256:         for (j=0;j<n-e;j++) pq[j] = Q[i+(j+e)*ldq];
257:       } else pq = (PetscScalar*)Q+i*ldq+e;
258:       VecMAXPY(V[i],n-e,pq,V+e);
259:     }
260:   }
261:   if (allocated) { PetscFree(pq); }
262:   return(0);
263: }

267: /*@
268:    SlepcUpdateVectors - Update a set of vectors V as V(:,s:e-1) = V*Q(:,s:e-1).

270:    Not Collective

272:    Input parameters:
273: +  n      - number of vectors in V
274: .  s      - first column of V to be overwritten
275: .  e      - first column of V not to be overwritten
276: .  Q      - matrix containing the coefficients of the update
277: .  ldq    - leading dimension of Q
278: -  qtrans - flag indicating if Q is to be transposed

280:    Input/Output parameter:
281: .  V      - set of vectors

283:    Notes:
284:    This function computes V(:,s:e-1) = V*Q(:,s:e-1), that is, given a set of
285:    vectors V, columns from s to e-1 are overwritten with columns from s to
286:    e-1 of the matrix-matrix product V*Q.

288:    Matrix V is represented as an array of Vec, whereas Q is represented as
289:    a column-major dense array of leading dimension ldq. Only columns s to e-1
290:    of Q are referenced.

292:    If qtrans=PETSC_TRUE, the operation is V*Q'.

294:    This routine is implemented with a call to BLAS, therefore V is an array
295:    of Vec which have the data stored contiguously in memory as a Fortran matrix.
296:    PETSc does not create such arrays by default.

298:    Level: developer

300: .seealso: SlepcUpdateStrideVectors()
301: @*/
302: PetscErrorCode SlepcUpdateVectors(PetscInt n,Vec *V,PetscInt s,PetscInt e,const PetscScalar *Q,PetscInt ldq,PetscBool qtrans)
303: {
304:   PetscContainer container;

308:   if (n<0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Number of vectors (given %D) cannot be negative",n);
309:   if (!n || s>=e) return(0);
314:   PetscObjectQuery((PetscObject)(V[0]),"contiguous",(PetscObject*)&container);
315:   if (container) {
316:     /* contiguous Vecs, use BLAS calls */
317:     SlepcUpdateStrideVectors(n,V,s,1,e,Q,ldq,qtrans);
318:   } else {
319:     /* use regular Vec operations */
320:     SlepcUpdateVectors_Noncontiguous(n,V,s,e,Q,ldq,qtrans);
321:   }
322:   return(0);
323: }

327: /*@
328:    SlepcUpdateStrideVectors - Update a set of vectors V as
329:    V(:,s:d:e-1) = V*Q(:,s:e-1).

331:    Not Collective

333:    Input parameters:
334: +  n      - number of vectors in V
335: .  s      - first column of V to be overwritten
336: .  d      - stride
337: .  e      - first column of V not to be overwritten
338: .  Q      - matrix containing the coefficients of the update
339: .  ldq    - leading dimension of Q
340: -  qtrans - flag indicating if Q is to be transposed

342:    Input/Output parameter:
343: .  V      - set of vectors

345:    Notes:
346:    This function computes V(:,s:d:e-1) = V*Q(:,s:e-1), that is, given a set
347:    of vectors V, columns from s to e-1 are overwritten with columns from s to
348:    e-1 of the matrix-matrix product V*Q.

350:    Matrix V is represented as an array of Vec, whereas Q is represented as
351:    a column-major dense array of leading dimension ldq. Only columns s to e-1
352:    of Q are referenced.

354:    If qtrans=PETSC_TRUE, the operation is V*Q'.

356:    This routine is implemented with a call to BLAS, therefore V is an array
357:    of Vec which have the data stored contiguously in memory as a Fortran matrix.
358:    PETSc does not create such arrays by default.

360:    Level: developer

362: .seealso: SlepcUpdateVectors()
363: @*/
364: PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans)
365: {
367:   PetscInt       l;
368:   PetscBLASInt   i,j,k,bs=64,m,n,ldq,ls,ld;
369:   PetscScalar    *pv,*pw,*pq,*work,*pwork,one=1.0,zero=0.0;
370:   const char     *qt;

373:   PetscBLASIntCast(n_/d,&n);
374:   PetscBLASIntCast(ldq_,&ldq);
375:   m = (e-s)/d;
376:   if (!m) return(0);
378:   if (m<0 || n<0 || s<0 || m>n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Index argument out of range");
379:   PetscLogEventBegin(SLEPC_UpdateVectors,0,0,0,0);
380:   VecGetLocalSize(V[0],&l);
381:   PetscBLASIntCast(l,&ls);
382:   PetscBLASIntCast(ls*d,&ld);
383:   VecGetArray(V[0],&pv);
384:   if (qtrans) {
385:     pq = (PetscScalar*)Q+s;
386:     qt = "C";
387:   } else {
388:     pq = (PetscScalar*)Q+s*ldq;
389:     qt = "N";
390:   }
391:   PetscMalloc(sizeof(PetscScalar)*bs*m,&work);
392:   k = ls % bs;
393:   if (k) {
394:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N",qt,&k,&m,&n,&one,pv,&ld,pq,&ldq,&zero,work,&k));
395:     for (j=0;j<m;j++) {
396:       pw = pv+(s+j)*ld;
397:       pwork = work+j*k;
398:       for (i=0;i<k;i++) {
399:         *pw++ = *pwork++;
400:       }
401:     }
402:   }
403:   for (;k<ls;k+=bs) {
404:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N",qt,&bs,&m,&n,&one,pv+k,&ld,pq,&ldq,&zero,work,&bs));
405:     for (j=0;j<m;j++) {
406:       pw = pv+(s+j)*ld+k;
407:       pwork = work+j*bs;
408:       for (i=0;i<bs;i++) {
409:         *pw++ = *pwork++;
410:       }
411:     }
412:   }
413:   VecRestoreArray(V[0],&pv);
414:   PetscFree(work);
415:   PetscLogFlops(m*n*2.0*ls);
416:   PetscLogEventEnd(SLEPC_UpdateVectors,0,0,0,0);
417:   return(0);
418: }

422: /*@
423:    SlepcVecMAXPBY - Computes y = beta*y + sum alpha*a[j]*x[j]

425:    Logically Collective on Vec

427:    Input parameters:
428: +  beta   - scalar beta
429: .  alpha  - scalar alpha
430: .  nv     - number of vectors in x and scalars in a
431: .  a      - array of scalars
432: -  x      - set of vectors

434:    Input/Output parameter:
435: .  y      - the vector to update

437:    Notes:
438:    If x are Vec's with contiguous storage, then the operation is done
439:    through a call to BLAS. Otherwise, VecMAXPY() is called.

441:    Level: developer

443: .seealso: SlepcVecSetTemplate()
444: @*/
445: PetscErrorCode SlepcVecMAXPBY(Vec y,PetscScalar beta,PetscScalar alpha,PetscInt nv,PetscScalar a[],Vec x[])
446: {
447:   PetscErrorCode    ierr;
448:   PetscBLASInt      i,n,m,one=1;
449:   PetscScalar       *py;
450:   const PetscScalar *px;
451:   PetscContainer    container;
452:   Vec               z;

456:   if (!nv) return(0);
457:   if (nv < 0) SETERRQ1(PetscObjectComm((PetscObject)y),PETSC_ERR_ARG_OUTOFRANGE,"Number of vectors (given %D) cannot be negative",nv);
467:   if ((*x)->map->N != (y)->map->N) SETERRQ(PetscObjectComm((PetscObject)y),PETSC_ERR_ARG_INCOMP,"Incompatible vector global lengths");
468:   if ((*x)->map->n != (y)->map->n) SETERRQ(PetscObjectComm((PetscObject)y),PETSC_ERR_ARG_INCOMP,"Incompatible vector local lengths");

470:   PetscObjectQuery((PetscObject)(x[0]),"contiguous",(PetscObject*)&container);
471:   if (container) {
472:     /* assume x Vecs are contiguous, use BLAS calls */
473:     PetscLogEventBegin(SLEPC_VecMAXPBY,*x,y,0,0);
474:     VecGetArray(y,&py);
475:     VecGetArrayRead(*x,&px);
476:     PetscBLASIntCast(nv,&n);
477:     PetscBLASIntCast((y)->map->n,&m);
478:     if (m>0) PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&m,&n,&alpha,px,&m,a,&one,&beta,py,&one));
479:     VecRestoreArray(y,&py);
480:     VecRestoreArrayRead(*x,&px);
481:     PetscLogFlops(nv*2*(y)->map->n);
482:     PetscLogEventEnd(SLEPC_VecMAXPBY,*x,y,0,0);
483:   } else {
484:     /* use regular Vec operations */
485:     if (alpha==-beta) {
486:       for (i=0;i<nv;i++) a[i] = -a[i];
487:       VecMAXPY(y,nv,a,x);
488:       for (i=0;i<nv;i++) a[i] = -a[i];
489:       VecScale(y,beta);
490:     } else {
491:       VecDuplicate(y,&z);
492:       VecCopy(y,z);
493:       VecMAXPY(y,nv,a,x);
494:       VecAXPBY(y,beta-alpha,alpha,z);
495:       VecDestroy(&z);
496:     }
497:   }
498:   return(0);
499: }

slepc-3.4.2.dfsg.orig/src/vec/veccomp.c0000644000175000017500000005361512211062077016611 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcvec.h" I*/ /* Private MPI datatypes and operators */ static MPI_Datatype MPIU_NORM2=0, MPIU_NORM1_AND_2=0; static MPI_Op MPIU_NORM2_SUM=0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) static PetscBool VecCompInitialized = PETSC_FALSE; #endif /* Private inline functions */ PETSC_STATIC_INLINE void SumNorm2(PetscReal *,PetscReal *,PetscReal *,PetscReal *); PETSC_STATIC_INLINE PetscReal GetNorm2(PetscReal,PetscReal); PETSC_STATIC_INLINE void AddNorm2(PetscReal *,PetscReal *,PetscReal); #include "veccomp0.h" #define __WITH_MPI__ #include "veccomp0.h" PETSC_STATIC_INLINE void SumNorm2(PetscReal *ssq0,PetscReal *scale0,PetscReal *ssq1,PetscReal *scale1) { PetscReal q; if (*scale0 > *scale1) { q = *scale1/(*scale0); *ssq1 = *ssq0 + q*q*(*ssq1); *scale1 = *scale0; } else { q = *scale0/(*scale1); *ssq1 += q*q*(*ssq0); } } PETSC_STATIC_INLINE PetscReal GetNorm2(PetscReal ssq,PetscReal scale) { return scale*PetscSqrtReal(ssq); } PETSC_STATIC_INLINE void AddNorm2(PetscReal *ssq,PetscReal *scale,PetscReal x) { PetscReal absx,q; if (x != 0.0) { absx = PetscAbs(x); if (*scale < absx) { q = *scale/absx; *ssq = 1.0 + *ssq*q*q; *scale = absx; } else { q = absx/(*scale); *ssq += q*q; } } } #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) #undef __FUNCT__ #define __FUNCT__ "SlepcSumNorm2_Local" static void SlepcSumNorm2_Local(void *in,void *out,PetscMPIInt *cnt,MPI_Datatype *datatype) { PetscInt i,count = *cnt; PetscFunctionBegin; if (*datatype == MPIU_NORM2) { PetscReal *xin = (PetscReal*)in,*xout = (PetscReal*)out; for (i=0; idata; PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; #if defined(PETSC_USE_LOG) PetscLogObjectState((PetscObject)v,"Length=%D",v->map->n); #endif for (i=0;inx;i++) { ierr = VecDestroy(&vs->x[i]);CHKERRQ(ierr); } if (--vs->n->friends <= 0) { ierr = PetscFree(vs->n);CHKERRQ(ierr); } ierr = PetscFree(vs->x);CHKERRQ(ierr); ierr = PetscFree(vs);CHKERRQ(ierr); PetscFunctionReturn(0); } static struct _VecOps DvOps = {VecDuplicate_Comp, /* 1 */ VecDuplicateVecs_Comp, VecDestroyVecs_Comp, VecDot_Comp_MPI, VecMDot_Comp_MPI, VecNorm_Comp_MPI, VecTDot_Comp_MPI, VecMTDot_Comp_MPI, VecScale_Comp, VecCopy_Comp, /* 10 */ VecSet_Comp, VecSwap_Comp, VecAXPY_Comp, VecAXPBY_Comp, VecMAXPY_Comp, VecAYPX_Comp, VecWAXPY_Comp, VecAXPBYPCZ_Comp, VecPointwiseMult_Comp, VecPointwiseDivide_Comp, 0, /* 20 */ 0,0, 0 /*VecGetArray_Seq*/, VecGetSize_Comp, VecGetLocalSize_Comp, 0/*VecRestoreArray_Seq*/, VecMax_Comp, VecMin_Comp, VecSetRandom_Comp, 0, /* 30 */ 0, VecDestroy_Comp, VecView_Comp, 0/*VecPlaceArray_Seq*/, 0/*VecReplaceArray_Seq*/, VecDot_Comp_Seq, 0, VecNorm_Comp_Seq, VecMDot_Comp_Seq, 0, /* 40 */ 0, VecReciprocal_Comp, VecConjugate_Comp, 0,0, 0/*VecResetArray_Seq*/, 0, VecMaxPointwiseDivide_Comp, VecPointwiseMax_Comp, VecPointwiseMaxAbs_Comp, VecPointwiseMin_Comp, 0, VecSqrtAbs_Comp, VecAbs_Comp, VecExp_Comp, VecLog_Comp, 0/*VecShift_Comp*/, 0, 0, 0, VecDotNorm2_Comp_MPI }; #undef __FUNCT__ #define __FUNCT__ "VecDuplicateVecs_Comp" PetscErrorCode VecDuplicateVecs_Comp(Vec w,PetscInt m,Vec *V[]) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(w,VEC_CLASSID,1); PetscValidPointer(V,3); if (m<=0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"m must be > 0: m = %D",m); ierr = PetscMalloc(m*sizeof(Vec*),V);CHKERRQ(ierr); for (i=0;i 0: m = %D",m); for (i=0;idata) { ierr = PetscFree(v->data);CHKERRQ(ierr); } ierr = PetscNewLog(v,Vec_Comp,&s);CHKERRQ(ierr); ierr = PetscMemcpy(v->ops,&DvOps,sizeof(DvOps));CHKERRQ(ierr); v->data = (void*)s; v->petscnative = PETSC_FALSE; /* Allocate the array of Vec, if it is needed to be done */ if (x_to_me != PETSC_TRUE) { ierr = PetscMalloc(sizeof(Vec)*nx,&s->x);CHKERRQ(ierr); ierr = PetscMemcpy(s->x,x,sizeof(Vec)*nx);CHKERRQ(ierr); } else s->x = x; s->nx = nx; for (i=0;in = n; n->n = nx; n->N = N; n->lN = lN; n->friends = 1; } else { /* If not, check in the vector in the shared structure */ s->n = n; s->n->friends++; s->n->n = nx; } /* Set the virtual sizes as the real sizes of the vector */ ierr = VecSetSizes(v,s->n->lN,s->n->N);CHKERRQ(ierr); ierr = PetscObjectChangeTypeName((PetscObject)v,VECCOMP);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecCreate_Comp" PETSC_EXTERN PetscErrorCode VecCreate_Comp(Vec V) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecCreate_Comp_Private(V,NULL,0,PETSC_FALSE,NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecCreateComp" /*@C VecCreateComp - Creates a new vector containing several subvectors, each stored separately Collective on Vec Input Parameter: + comm - communicator for the new Vec . Nx - array of (initial) global sizes of child vectors . n - number of child vectors . t - type of the child vectors - Vparent - (optional) template vector Output Parameter: . V - new vector Notes: This is similar to PETSc's VecNest but customized for SLEPc's needs. In particular, the number of child vectors can be modified dynamically, with VecCompSetSubVecs(). Level: developer .seealso: VecCreateCompWithVecs(), VecCompSetSubVecs() @*/ PetscErrorCode VecCreateComp(MPI_Comm comm,PetscInt *Nx,PetscInt n,VecType t,Vec Vparent,Vec *V) { PetscErrorCode ierr; Vec *x; PetscInt i; PetscFunctionBegin; ierr = VecCreate(comm,V);CHKERRQ(ierr); ierr = PetscMalloc(n*sizeof(Vec),&x);CHKERRQ(ierr); ierr = PetscLogObjectMemory(*V,n*sizeof(Vec));CHKERRQ(ierr); for (i=0;idata)->n:NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecCreateCompWithVecs" /*@C VecCreateCompWithVecs - Creates a new vector containing several subvectors, each stored separately, from an array of Vecs Collective on Vec Input Parameter: + x - array of Vecs . n - number of child vectors - Vparent - (optional) template vector Output Parameter: . V - new vector Level: developer .seealso: VecCreateComp() @*/ PetscErrorCode VecCreateCompWithVecs(Vec *x,PetscInt n,Vec Vparent,Vec *V) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; ierr = VecCreate(PetscObjectComm((PetscObject)x[0]),V);CHKERRQ(ierr); for (i=0;idata)->n:NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecDuplicate_Comp" PetscErrorCode VecDuplicate_Comp(Vec win,Vec *V) { PetscErrorCode ierr; Vec *x; PetscInt i; Vec_Comp *s = (Vec_Comp*)win->data; PetscFunctionBegin; SlepcValidVecComp(win); ierr = VecCreate(PetscObjectComm((PetscObject)win),V);CHKERRQ(ierr); ierr = PetscMalloc(s->nx*sizeof(Vec),&x);CHKERRQ(ierr); ierr = PetscLogObjectMemory(*V,s->nx*sizeof(Vec));CHKERRQ(ierr); for (i=0;inx;i++) { ierr = VecDuplicate(s->x[i],&x[i]);CHKERRQ(ierr); } ierr = VecCreate_Comp_Private(*V,x,s->nx,PETSC_TRUE,s->n);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecCompGetSubVecs" /*@C VecCompGetSubVecs - Returns the entire array of vectors defining a compound vector Collective on Vec Input Parameter: . win - compound vector Output Parameter: + n - number of child vectors - x - array of child vectors Level: developer .seealso: VecCreateComp() @*/ PetscErrorCode VecCompGetSubVecs(Vec win,PetscInt *n,const Vec **x) { Vec_Comp *s = (Vec_Comp*)win->data; PetscFunctionBegin; SlepcValidVecComp(win); if (x) *x = s->x; if (n) *n = s->nx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecCompSetSubVecs" /*@C VecCompSetSubVecs - Resets the number of subvectors defining a compound vector, of replaces the subvectors Collective on Vec Input Parameters: + win - compound vector . n - number of child vectors - x - array of child vectors Level: developer .seealso: VecCreateComp() @*/ PetscErrorCode VecCompSetSubVecs(Vec win,PetscInt n,Vec *x) { Vec_Comp *s = (Vec_Comp*)win->data; PetscErrorCode ierr; PetscFunctionBegin; SlepcValidVecComp(win); if (x) { if (n > s->nx) { ierr = PetscFree(s->x);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(Vec)*n,&s->x);CHKERRQ(ierr); } ierr = PetscMemcpy(s->x,x,sizeof(Vec)*n);CHKERRQ(ierr); s->nx = n; } s->n->n = n; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecAXPY_Comp" PetscErrorCode VecAXPY_Comp(Vec v,PetscScalar alpha,Vec w) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); SlepcValidVecComp(w); for (i=0;in->n;i++) { ierr = VecAXPY(vs->x[i],alpha,ws->x[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecAYPX_Comp" PetscErrorCode VecAYPX_Comp(Vec v,PetscScalar alpha,Vec w) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); SlepcValidVecComp(w); for (i=0;in->n;i++) { ierr = VecAYPX(vs->x[i],alpha,ws->x[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecAXPBY_Comp" PetscErrorCode VecAXPBY_Comp(Vec v,PetscScalar alpha,PetscScalar beta,Vec w) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); SlepcValidVecComp(w); for (i=0;in->n;i++) { ierr = VecAXPBY(vs->x[i],alpha,beta,ws->x[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecMAXPY_Comp" PetscErrorCode VecMAXPY_Comp(Vec v,PetscInt n,const PetscScalar *alpha,Vec *w) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data; Vec *wx; PetscInt i,j; PetscFunctionBegin; SlepcValidVecComp(v); for (i=0;in->n;j++) { for (i=0;idata)->x[j]; ierr = VecMAXPY(vs->x[j],n,alpha,wx);CHKERRQ(ierr); } ierr = PetscFree(wx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecWAXPY_Comp" PetscErrorCode VecWAXPY_Comp(Vec v,PetscScalar alpha,Vec w,Vec z) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data,*zs = (Vec_Comp*)z->data; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); SlepcValidVecComp(w); SlepcValidVecComp(z); for (i=0;in->n;i++) { ierr = VecWAXPY(vs->x[i],alpha,ws->x[i],zs->x[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecAXPBYPCZ_Comp" PetscErrorCode VecAXPBYPCZ_Comp(Vec v,PetscScalar alpha,PetscScalar beta,PetscScalar gamma,Vec w,Vec z) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data,*zs = (Vec_Comp*)z->data; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); SlepcValidVecComp(w); SlepcValidVecComp(z); for (i=0;in->n;i++) { ierr = VecAXPBYPCZ(vs->x[i],alpha,beta,gamma,ws->x[i],zs->x[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecGetSize_Comp" PetscErrorCode VecGetSize_Comp(Vec v,PetscInt *size) { Vec_Comp *vs = (Vec_Comp*)v->data; PetscFunctionBegin; SlepcValidVecComp(v); PetscValidIntPointer(size,2); *size = vs->n->N; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecGetLocalSize_Comp" PetscErrorCode VecGetLocalSize_Comp(Vec v,PetscInt *size) { Vec_Comp *vs = (Vec_Comp*)v->data; PetscFunctionBegin; SlepcValidVecComp(v); PetscValidIntPointer(size,2); *size = vs->n->lN; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecMax_Comp" PetscErrorCode VecMax_Comp(Vec v,PetscInt *idx,PetscReal *z) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data; PetscInt idxp,s=0,s0; PetscReal zp,z0; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); if (!idx && !z) PetscFunctionReturn(0); if (vs->n->n > 0) { ierr = VecMax(vs->x[0],idx?&idxp:NULL,&zp);CHKERRQ(ierr); } for (i=1;in->n;i++) { ierr = VecGetSize(vs->x[i-1],&s0);CHKERRQ(ierr); s+= s0; ierr = VecMax(vs->x[i],idx?&idxp:NULL,&z0);CHKERRQ(ierr); if (zp < z0) { if (idx) *idx = s+idxp; zp = z0; } } if (z) *z = zp; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecMin_Comp" PetscErrorCode VecMin_Comp(Vec v,PetscInt *idx,PetscReal *z) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data; PetscInt idxp,s=0,s0; PetscReal zp,z0; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); if (!idx && !z) PetscFunctionReturn(0); if (vs->n->n > 0) { ierr = VecMin(vs->x[0],idx?&idxp:NULL,&zp);CHKERRQ(ierr); } for (i=1;in->n;i++) { ierr = VecGetSize(vs->x[i-1],&s0);CHKERRQ(ierr); s+= s0; ierr = VecMin(vs->x[i],idx?&idxp:NULL,&z0);CHKERRQ(ierr); if (zp > z0) { if (idx) *idx = s+idxp; zp = z0; } } if (z) *z = zp; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "VecMaxPointwiseDivide_Comp" PetscErrorCode VecMaxPointwiseDivide_Comp(Vec v,Vec w,PetscReal *m) { PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data; PetscReal work; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(v); SlepcValidVecComp(w); if (!m || vs->n->n == 0) PetscFunctionReturn(0); ierr = VecMaxPointwiseDivide(vs->x[0],ws->x[0],m);CHKERRQ(ierr); for (i=1;in->n;i++) { ierr = VecMaxPointwiseDivide(vs->x[i],ws->x[i],&work);CHKERRQ(ierr); *m = PetscMax(*m,work); } PetscFunctionReturn(0); } #define __QUOTEME__(x) #x #define __COMPOSE2__(A,B) A##B #define __COMPOSE3__(A,B,C) A##B##C #define __FUNC_TEMPLATE1__(NAME) \ PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v) \ { \ PetscErrorCode ierr; \ Vec_Comp *vs = (Vec_Comp*)v->data; \ PetscInt i; \ \ PetscFunctionBegin; \ SlepcValidVecComp(v); \ for (i=0;in->n;i++) { \ ierr = __COMPOSE2__(Vec,NAME)(vs->x[i]);CHKERRQ(ierr); \ } \ PetscFunctionReturn(0);\ } #undef __FUNCT__ #define __FUNCT__ "VecConjugate_Comp" __FUNC_TEMPLATE1__(Conjugate) #undef __FUNCT__ #define __FUNCT__ "VecReciprocal_Comp" __FUNC_TEMPLATE1__(Reciprocal) #undef __FUNCT__ #define __FUNCT__ "VecSqrtAbs_Comp" __FUNC_TEMPLATE1__(SqrtAbs) #undef __FUNCT__ #define __FUNCT__ "VecAbs_Comp" __FUNC_TEMPLATE1__(Abs) #undef __FUNCT__ #define __FUNCT__ "VecExp_Comp" __FUNC_TEMPLATE1__(Exp) #undef __FUNCT__ #define __FUNCT__ "VecLog_Comp" __FUNC_TEMPLATE1__(Log) #define __FUNC_TEMPLATE2__(NAME,T0) \ PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v,T0 __a) \ { \ PetscErrorCode ierr; \ Vec_Comp *vs = (Vec_Comp*)v->data; \ PetscInt i; \ \ PetscFunctionBegin; \ SlepcValidVecComp(v); \ for (i=0;in->n;i++) { \ ierr = __COMPOSE2__(Vec,NAME)(vs->x[i],__a);CHKERRQ(ierr); \ } \ PetscFunctionReturn(0);\ } #undef __FUNCT__ #define __FUNCT__ "VecSet_Comp" __FUNC_TEMPLATE2__(Set,PetscScalar) #undef __FUNCT__ #define __FUNCT__ "VecView_Comp" __FUNC_TEMPLATE2__(View,PetscViewer) #undef __FUNCT__ #define __FUNCT__ "VecScale_Comp" __FUNC_TEMPLATE2__(Scale,PetscScalar) #undef __FUNCT__ #define __FUNCT__ "VecSetRandom_Comp" __FUNC_TEMPLATE2__(SetRandom,PetscRandom) #undef __FUNCT__ #define __FUNCT__ "VecShift_Comp" __FUNC_TEMPLATE2__(Shift,PetscScalar) #define __FUNC_TEMPLATE3__(NAME) \ PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v,Vec w) \ { \ PetscErrorCode ierr; \ Vec_Comp *vs = (Vec_Comp*)v->data,\ *ws = (Vec_Comp*)w->data; \ PetscInt i; \ \ PetscFunctionBegin; \ SlepcValidVecComp(v); \ SlepcValidVecComp(w); \ for (i=0;in->n;i++) { \ ierr = __COMPOSE2__(Vec,NAME)(vs->x[i],ws->x[i]);CHKERRQ(ierr); \ } \ PetscFunctionReturn(0);\ } #undef __FUNCT__ #define __FUNCT__ "VecCopy_Comp" __FUNC_TEMPLATE3__(Copy) #undef __FUNCT__ #define __FUNCT__ "VecSwap_Comp" __FUNC_TEMPLATE3__(Swap) #define __FUNC_TEMPLATE4__(NAME) \ PetscErrorCode __COMPOSE3__(Vec,NAME,_Comp)(Vec v,Vec w,Vec z) \ { \ PetscErrorCode ierr; \ Vec_Comp *vs = (Vec_Comp*)v->data, \ *ws = (Vec_Comp*)w->data, \ *zs = (Vec_Comp*)z->data; \ PetscInt i; \ \ PetscFunctionBegin; \ SlepcValidVecComp(v); \ SlepcValidVecComp(w); \ SlepcValidVecComp(z); \ for (i=0;in->n;i++) { \ ierr = __COMPOSE2__(Vec,NAME)(vs->x[i],ws->x[i],zs->x[i]);CHKERRQ(ierr); \ } \ PetscFunctionReturn(0);\ } #undef __FUNCT__ #define __FUNCT__ "VecPointwiseMax_Comp" __FUNC_TEMPLATE4__(PointwiseMax) #undef __FUNCT__ #define __FUNCT__ "VecPointwiseMaxAbs_Comp" __FUNC_TEMPLATE4__(PointwiseMaxAbs) #undef __FUNCT__ #define __FUNCT__ "VecPointwiseMin_Comp" __FUNC_TEMPLATE4__(PointwiseMin) #undef __FUNCT__ #define __FUNCT__ "VecPointwiseMult_Comp" __FUNC_TEMPLATE4__(PointwiseMult) #undef __FUNCT__ #define __FUNCT__ "VecPointwiseDivide_Comp" __FUNC_TEMPLATE4__(PointwiseDivide) slepc-3.4.2.dfsg.orig/src/vec/veccomp0.h0000644000175000017500000002376312211062077016677 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "petsvec.h" I*/ #if defined(__WITH_MPI__) #define __SUF__(A) A##_MPI #else #define __SUF__(A) A##_Seq #endif #define __QUOTEME_(x) #x #define __QUOTEME(x) __QUOTEME_(x) #define __SUF_C__(A) __QUOTEME(__SUF__(A)) #undef __FUNCT__ #define __FUNCT__ __SUF_C__(VecDot_Comp) PetscErrorCode __SUF__(VecDot_Comp)(Vec a,Vec b,PetscScalar *z) { PetscScalar sum = 0.0,work; PetscInt i; PetscErrorCode ierr; Vec_Comp *as = (Vec_Comp*)a->data,*bs = (Vec_Comp*)b->data; PetscFunctionBegin; SlepcValidVecComp(a); SlepcValidVecComp(b); if (as->x[0]->ops->dot_local) { for (i=0,sum=0.0;in->n;i++) { ierr = as->x[i]->ops->dot_local(as->x[i],bs->x[i],&work);CHKERRQ(ierr); sum += work; } #if defined(__WITH_MPI__) work = sum; ierr = MPI_Allreduce(&work,&sum,1,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); #endif } else { for (i=0,sum=0.0;in->n;i++) { ierr = VecDot(as->x[i],bs->x[i],&work);CHKERRQ(ierr); sum += work; } } *z = sum; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ __SUF_C__(VecMDot_Comp) PetscErrorCode __SUF__(VecMDot_Comp)(Vec a,PetscInt n,const Vec b[],PetscScalar *z) { PetscScalar *work,*work0,*r; PetscErrorCode ierr; Vec_Comp *as = (Vec_Comp*)a->data; Vec *bx; PetscInt i,j; PetscFunctionBegin; SlepcValidVecComp(a); for (i=0;in->n == 0) { *z = 0; PetscFunctionReturn(0); } ierr = PetscMalloc(sizeof(PetscScalar)*n,&work0);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(Vec)*n,&bx);CHKERRQ(ierr); #if defined(__WITH_MPI__) if (as->x[0]->ops->mdot_local) { r = work0; work = z; } else #endif { r = z; work = work0; } /* z[i] <- a.x' * b[i].x */ for (i=0;idata)->x[0]; if (as->x[0]->ops->mdot_local) { ierr = as->x[0]->ops->mdot_local(as->x[0],n,bx,r);CHKERRQ(ierr); } else { ierr = VecMDot(as->x[0],n,bx,r);CHKERRQ(ierr); } for (j=0;jn->n;j++) { for (i=0;idata)->x[j]; if (as->x[0]->ops->mdot_local) { ierr = as->x[j]->ops->mdot_local(as->x[j],n,bx,work);CHKERRQ(ierr); } else { ierr = VecMDot(as->x[j],n,bx,work);CHKERRQ(ierr); } for (i=0;ix[0]->ops->mdot_local) { /* z[i] <- Allreduce(work[i]) */ ierr = MPI_Allreduce(r,z,n,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); } #endif ierr = PetscFree(work0);CHKERRQ(ierr); ierr = PetscFree(bx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ __SUF_C__(VecTDot_Comp) PetscErrorCode __SUF__(VecTDot_Comp)(Vec a,Vec b,PetscScalar *z) { PetscScalar sum = 0.0,work; PetscInt i; PetscErrorCode ierr; Vec_Comp *as = (Vec_Comp*)a->data,*bs = (Vec_Comp*)b->data; PetscFunctionBegin; SlepcValidVecComp(a); SlepcValidVecComp(b); if (as->x[0]->ops->tdot_local) { for (i=0,sum=0.0;in->n;i++) { ierr = as->x[i]->ops->tdot_local(as->x[i],bs->x[i],&work);CHKERRQ(ierr); sum += work; } #if defined(__WITH_MPI__) work = sum; ierr = MPI_Allreduce(&work,&sum,1,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); #endif } else { for (i=0,sum=0.0;in->n;i++) { ierr = VecTDot(as->x[i],bs->x[i],&work);CHKERRQ(ierr); sum += work; } } *z = sum; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ __SUF_C__(VecMTDot_Comp) PetscErrorCode __SUF__(VecMTDot_Comp)(Vec a,PetscInt n,const Vec b[],PetscScalar *z) { PetscScalar *work,*work0,*r; PetscErrorCode ierr; Vec_Comp *as = (Vec_Comp*)a->data; Vec *bx; PetscInt i,j; PetscFunctionBegin; SlepcValidVecComp(a); for (i=0;in->n == 0) { *z = 0; PetscFunctionReturn(0); } ierr = PetscMalloc(sizeof(PetscScalar)*n,&work0);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(Vec)*n,&bx);CHKERRQ(ierr); #if defined(__WITH_MPI__) if (as->x[0]->ops->mtdot_local) { r = work0; work = z; } else #endif { r = z; work = work0; } /* z[i] <- a.x' * b[i].x */ for (i=0;idata)->x[0]; if (as->x[0]->ops->mtdot_local) { ierr = as->x[0]->ops->mtdot_local(as->x[0],n,bx,r);CHKERRQ(ierr); } else { ierr = VecMTDot(as->x[0],n,bx,r);CHKERRQ(ierr); } for (j=0;jn->n;j++) { for (i=0;idata)->x[j]; if (as->x[0]->ops->mtdot_local) { ierr = as->x[j]->ops->mtdot_local(as->x[j],n,bx,work);CHKERRQ(ierr); } else { ierr = VecMTDot(as->x[j],n,bx,work);CHKERRQ(ierr); } for (i=0;ix[0]->ops->mtdot_local) { /* z[i] <- Allreduce(work[i]) */ ierr = MPI_Allreduce(r,z,n,MPIU_SCALAR,MPIU_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); } #endif ierr = PetscFree(work0);CHKERRQ(ierr); ierr = PetscFree(bx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ __SUF_C__(VecNorm_Comp) PetscErrorCode __SUF__(VecNorm_Comp)(Vec a,NormType t,PetscReal *norm) { PetscReal work[3],s=0.0; PetscErrorCode ierr; Vec_Comp *as = (Vec_Comp*)a->data; PetscInt i; PetscFunctionBegin; SlepcValidVecComp(a); /* Initialize norm */ switch (t) { case NORM_1: case NORM_INFINITY: *norm = 0.0; break; case NORM_2: case NORM_FROBENIUS: *norm = 1.0; s = 0.0; break; case NORM_1_AND_2: norm[0] = 0.0; norm[1] = 1.0; s = 0.0; break; } for (i=0;in->n;i++) { if (as->x[0]->ops->norm_local) { ierr = as->x[0]->ops->norm_local(as->x[i],t,work);CHKERRQ(ierr); } else { ierr = VecNorm(as->x[i],t,work);CHKERRQ(ierr); } /* norm+= work */ switch (t) { case NORM_1: *norm+= *work; break; case NORM_2: case NORM_FROBENIUS: AddNorm2(norm,&s,*work); break; case NORM_1_AND_2: norm[0]+= work[0]; AddNorm2(&norm[1],&s,work[1]); break; case NORM_INFINITY: *norm = PetscMax(*norm,*work); break; } } /* If def(__WITH_MPI__) and exists norm_local */ #if defined(__WITH_MPI__) if (as->x[0]->ops->norm_local) { PetscReal work0[3]; /* norm <- Allreduce(work) */ switch (t) { case NORM_1: work[0] = *norm; ierr = MPI_Allreduce(work,norm,1,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); break; case NORM_2: case NORM_FROBENIUS: work[0] = *norm; work[1] = s; ierr = MPI_Allreduce(work,work0,1,MPIU_NORM2,MPIU_NORM2_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); *norm = GetNorm2(work0[0],work0[1]); break; case NORM_1_AND_2: work[0] = norm[0]; work[1] = norm[1]; work[2] = s; ierr = MPI_Allreduce(work,work0,1,MPIU_NORM1_AND_2,MPIU_NORM2_SUM,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); norm[0] = work0[0]; norm[1] = GetNorm2(work0[1],work0[2]); break; case NORM_INFINITY: work[0] = *norm; ierr = MPI_Allreduce(work,norm,1,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)a));CHKERRQ(ierr); break; } } #else /* Norm correction */ switch (t) { case NORM_2: case NORM_FROBENIUS: *norm = GetNorm2(*norm,s); break; case NORM_1_AND_2: norm[1] = GetNorm2(norm[1],s); break; default: ; } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ __SUF_C__(VecDotNorm2_Comp) PetscErrorCode __SUF__(VecDotNorm2_Comp)(Vec v,Vec w,PetscScalar *dp,PetscScalar *nm) { PetscScalar *vx,*wx,dp0,nm0,dp1,nm1; PetscErrorCode ierr; Vec_Comp *vs = (Vec_Comp*)v->data,*ws = (Vec_Comp*)w->data; PetscInt i,n; PetscBool t0,t1; #if defined(__WITH_MPI__) PetscScalar work[4]; #endif PetscFunctionBegin; /* Compute recursively the local part */ dp0 = nm0 = 0.0; ierr = PetscObjectTypeCompare((PetscObject)v,VECCOMP,&t0);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)w,VECCOMP,&t1);CHKERRQ(ierr); if (t0 && t1) { SlepcValidVecComp(v); SlepcValidVecComp(w); for (i=0;in->n;i++) { ierr = VecDotNorm2_Comp_Seq(vs->x[i],ws->x[i],&dp1,&nm1);CHKERRQ(ierr); dp0 += dp1; nm0 += nm1; } } else if (!t0 && !t1) { ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr); ierr = VecGetArray(v,&vx);CHKERRQ(ierr); ierr = VecGetArray(w,&wx);CHKERRQ(ierr); for (i=0;i Generic SLEPc Manual Pages

eps/
st/
svd/
qep/
nep/
mfn/
ip/
ds/
fn/
sys/
vec/
makefile
slepc-3.4.2.dfsg.orig/src/qep/0000755000175000017500000000000012214143515015007 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/examples/0000755000175000017500000000000012214143515016625 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/0000755000175000017500000000000012211062077020653 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/output/0000755000175000017500000000000012211062077022213 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/output/ex16f90_1.out0000644000175000017500000000057312211062077024273 0ustar gladkgladk Quadratic Eigenproblem, N= 100 ( 10x 10 grid) Solution method: linear Number of requested eigenvalues: 4 Stopping condition: tol=1.0000E-08, maxit= 100 All requested eigenvalues computed up to the required tolerance: 0.00000+2.79964i, 0.00000-2.79964i, 0.00000+2.75708i, 0.00000-2.75708i slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/output/ex17_1.out0000644000175000017500000000060412211062077023750 0ustar gladkgladk Quadratic eigenproblem stored in file. Reading REAL matrices from binary files... Number of iterations of the method: 10 Solution method: linear Number of requested eigenvalues: 4 Stopping condition: tol=1e-09, maxit=100 All requested eigenvalues computed up to the required tolerance: 0.00000+15457.40554i, 0.00000-15457.40554i, 0.00000+14602.93503i, 0.00000-14602.93503i slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/output/ex16_1.out0000644000175000017500000000037212211062077023751 0ustar gladkgladk Quadratic Eigenproblem, N=100 (10x10 grid) Solution method: linear Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.00000+2.79964i, 0.00000-2.79964i, 0.00000+2.75708i, 0.00000-2.75708i slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/ex17.c0000644000175000017500000001305412211062077021606 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves a quadratic eigenproblem (l^2*M + l*C + K)*x = 0 with matrices loaded from a file.\n\n" "The command line options are:\n" " -M , where = matrix (M) file in PETSc binary form.\n" " -C , where = matrix (C) file in PETSc binary form.\n" " -K , where = matrix (K) file in PETSc binary form.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat M,C,K; /* problem matrices */ QEP qep; /* quadratic eigenproblem solver context */ QEPType type; PetscReal tol; PetscInt nev,maxit,its; char filename[PETSC_MAX_PATH_LEN]; PetscViewer viewer; PetscBool flg; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Load the matrices that define the quadratic eigenproblem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscPrintf(PETSC_COMM_WORLD,"\nQuadratic eigenproblem stored in file.\n\n");CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrices from binary files...\n");CHKERRQ(ierr); #else ierr = PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrices from binary files...\n");CHKERRQ(ierr); #endif ierr = PetscOptionsGetString(NULL,"-M",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix M with the -M option"); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&M);CHKERRQ(ierr); ierr = MatSetFromOptions(M);CHKERRQ(ierr); ierr = MatLoad(M,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-C",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix C with the -C option"); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&C);CHKERRQ(ierr); ierr = MatSetFromOptions(C);CHKERRQ(ierr); ierr = MatLoad(C,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-K",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix K with the -K option"); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&K);CHKERRQ(ierr); ierr = MatSetFromOptions(K);CHKERRQ(ierr); ierr = MatLoad(K,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = QEPCreate(PETSC_COMM_WORLD,&qep);CHKERRQ(ierr); /* Set matrices */ ierr = QEPSetOperators(qep,M,C,K);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = QEPSetFromOptions(qep);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = QEPSolve(qep);CHKERRQ(ierr); ierr = QEPGetIterationNumber(qep,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = QEPGetType(qep,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = QEPGetDimensions(qep,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); ierr = QEPGetTolerances(qep,&tol,&maxit);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = QEPPrintSolution(qep,NULL);CHKERRQ(ierr); ierr = QEPDestroy(&qep);CHKERRQ(ierr); ierr = MatDestroy(&M);CHKERRQ(ierr); ierr = MatDestroy(&C);CHKERRQ(ierr); ierr = MatDestroy(&K);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/makefile0000644000175000017500000000502612211062077022356 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/qep/examples/tutorials/ EXAMPLESC = ex16.c ex17.c EXAMPLESF = ex16f90.F90 MANSEC = QEP TESTEXAMPLES_C = ex16.PETSc runex16_1 ex16.rm TESTEXAMPLES_C_NOCOMPLEX = ex17.PETSc runex17_1 ex17.rm TESTEXAMPLES_F90 = ex16f90.PETSc runex16f90_1 ex16f90.rm include ${SLEPC_DIR}/conf/slepc_common ex16: ex16.o chkopts -${CLINKER} -o ex16 ex16.o ${SLEPC_LIB} ${RM} ex16.o ex16f90: ex16f90.o chkopts -${FLINKER} -o ex16f90 ex16f90.o ${SLEPC_LIB} ${RM} ex16f90.o ex17: ex17.o chkopts -${CLINKER} -o ex17 ex17.o ${SLEPC_LIB} ${RM} ex17.o #------------------------------------------------------------------------------------ DATAPATH = ${SLEPC_DIR}/share/slepc/datafiles/matrices runex16_1: -@${MPIEXEC} -np 1 ./ex16 -qep_nev 4 -qep_ncv 20 -qep_terse > ex16_1.tmp 2>&1; \ if (${DIFF} output/ex16_1.out ex16_1.tmp) then true; \ else echo "Possible problem with ex16_1, diffs above"; fi; \ ${RM} -f ex16_1.tmp runex16f90_1: -@${MPIEXEC} -np 1 ./ex16f90 -qep_nev 4 -qep_ncv 20 -qep_terse > ex16f90_1.tmp 2>&1; \ if (${DIFF} output/ex16f90_1.out ex16f90_1.tmp) then true; \ else echo "Possible problem with ex16f90_1, diffs above"; fi; \ ${RM} -f ex16f90_1.tmp runex17_1: -@${MPIEXEC} -np 1 ./ex17 -M ${DATAPATH}/speaker107m.petsc -C ${DATAPATH}/speaker107c.petsc -K ${DATAPATH}/speaker107k.petsc -qep_linear_explicitmatrix -qep_nev 4 -qep_ncv 20 -qep_tol 1e-9 -qep_terse > ex17_1.tmp 2>&1; \ if (${DIFF} output/ex17_1.out ex17_1.tmp) then true; \ else echo "Possible problem with ex17_1, diffs above"; fi; \ ${RM} -f ex17_1.tmp slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/ex16f90.F900000644000175000017500000001500712211062077022240 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n ex16f90 [-help] [-n ] [-m ] [SLEPc opts] ! ! Description: Simple example that solves a quadratic eigensystem with the ! QEP object. This is the Fortran90 equivalent to ex16.c ! ! The command line options are: ! -n , where = number of grid subdivisions in x dimension ! -m , where = number of grid subdivisions in y dimension ! ! ---------------------------------------------------------------------- ! program main #include use slepcqep implicit none ! For usage without modules, uncomment the following lines and remove ! the previous lines between 'program main' and 'implicit none' ! !#include !#include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! M,C,K problem matrices ! solver quadratic eigenproblem solver context #if defined(PETSC_USE_FORTRAN_DATATYPES) type(Mat) M, C, K type(QEP) solver #else Mat M, C, K QEP solver #endif QEPType tname PetscReal tol PetscInt N, nx, ny, i, j, Istart, Iend, II PetscInt nev, maxit PetscMPIInt rank PetscErrorCode ierr PetscBool flg PetscScalar one, mone, four ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) nx = 10 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',nx,flg,ierr) call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-m',ny,flg,ierr) if (.not. flg) then ny = nx endif N = nx*ny if (rank .eq. 0) then write(*,100) N, nx, ny endif 100 format (/'Quadratic Eigenproblem, N=',I6,' (',I4,'x',I4,' grid)') ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** K is the 2-D Laplacian call MatCreate(PETSC_COMM_WORLD,K,ierr) call MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,N,N,ierr) call MatSetFromOptions(K,ierr) call MatSetUp(K,ierr) call MatGetOwnershipRange(K,Istart,Iend,ierr) mone = -1.0 four = 4.0 do II=Istart,Iend-1 i = II/nx j = II-i*nx if (i .gt. 0) then call MatSetValue(K,II,II-nx,mone,INSERT_VALUES,ierr) endif if (i .lt. ny-1) then call MatSetValue(K,II,II+nx,mone,INSERT_VALUES,ierr) endif if (j .gt. 0) then call MatSetValue(K,II,II-1,mone,INSERT_VALUES,ierr) endif if (j .lt. nx-1) then call MatSetValue(K,II,II+1,mone,INSERT_VALUES,ierr) endif call MatSetValue(K,II,II,four,INSERT_VALUES,ierr) end do call MatAssemblyBegin(K,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(K,MAT_FINAL_ASSEMBLY,ierr) ! ** C is the zero matrix call MatCreate(PETSC_COMM_WORLD,C,ierr) call MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,N,N,ierr) call MatSetFromOptions(C,ierr) call MatSetUp(C,ierr) call MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY,ierr) ! ** M is the identity matrix call MatCreate(PETSC_COMM_WORLD,M,ierr) call MatSetSizes(M,PETSC_DECIDE,PETSC_DECIDE,N,N,ierr) call MatSetFromOptions(M,ierr) call MatSetUp(M,ierr) call MatAssemblyBegin(M,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(M,MAT_FINAL_ASSEMBLY,ierr) one = 1.0 call MatShift(M,one,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the eigensolver and set various options ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create eigensolver context call QEPCreate(PETSC_COMM_WORLD,solver,ierr) ! ** Set matrices and problem type call QEPSetOperators(solver,M,C,K,ierr) call QEPSetProblemType(solver,QEP_GENERAL,ierr) ! ** Set solver parameters at runtime call QEPSetFromOptions(solver,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the eigensystem ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call QEPSolve(solver,ierr) ! ** Optional: Get some information from the solver and display it call QEPGetType(solver,tname,ierr) if (rank .eq. 0) then write(*,120) tname endif 120 format (' Solution method: ',A) call QEPGetDimensions(solver,nev,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,130) nev endif 130 format (' Number of requested eigenvalues:',I4) call QEPGetTolerances(solver,tol,maxit,ierr) if (rank .eq. 0) then write(*,140) tol, maxit endif 140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call QEPPrintSolution(solver,PETSC_NULL_OBJECT,ierr) call QEPDestroy(solver,ierr) call MatDestroy(K,ierr) call MatDestroy(C,ierr) call MatDestroy(M,ierr) call SlepcFinalize(ierr) end slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/makefile.html0000644000175000017500000000767012211062077023330 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/qep/examples/tutorials/
EXAMPLESC  = ex16.c ex17.c
EXAMPLESF  = ex16f90.F90
MANSEC     = QEP

TESTEXAMPLES_C           = ex16.PETSc runex16_1 ex16.rm
TESTEXAMPLES_C_NOCOMPLEX = ex17.PETSc runex17_1 ex17.rm
TESTEXAMPLES_F90         = ex16f90.PETSc runex16f90_1 ex16f90.rm

include ${SLEPC_DIR}/conf/slepc_common

ex16: ex16.o chkopts
	-${CLINKER} -o ex16 ex16.o ${SLEPC_LIB}
	${RM} ex16.o

ex16f90: ex16f90.o chkopts
	-${FLINKER} -o ex16f90 ex16f90.o ${SLEPC_LIB}
	${RM} ex16f90.o

ex17: ex17.o chkopts
	-${CLINKER} -o ex17 ex17.o ${SLEPC_LIB}
	${RM} ex17.o

#------------------------------------------------------------------------------------
DATAPATH = ${SLEPC_DIR}/share/slepc/datafiles/matrices

runex16_1:
	-@${MPIEXEC} -np 1 ./ex16 -qep_nev 4 -qep_ncv 20 -qep_terse > ex16_1.tmp 2>&1; \
	   if (${DIFF} output/ex16_1.out ex16_1.tmp) then true; \
	   else echo "Possible problem with ex16_1, diffs above"; fi; \
	   ${RM} -f ex16_1.tmp

runex16f90_1:
	-@${MPIEXEC} -np 1 ./ex16f90 -qep_nev 4 -qep_ncv 20 -qep_terse > ex16f90_1.tmp 2>&1; \
	   if (${DIFF} output/ex16f90_1.out ex16f90_1.tmp) then true; \
	   else echo "Possible problem with ex16f90_1, diffs above"; fi; \
	   ${RM} -f ex16f90_1.tmp

runex17_1:
	-@${MPIEXEC} -np 1 ./ex17 -M ${DATAPATH}/speaker107m.petsc -C ${DATAPATH}/speaker107c.petsc -K ${DATAPATH}/speaker107k.petsc -qep_linear_explicitmatrix -qep_nev 4 -qep_ncv 20 -qep_tol 1e-9 -qep_terse > ex17_1.tmp 2>&1; \
	   if (${DIFF} output/ex17_1.out ex17_1.tmp) then true; \
	   else echo "Possible problem with ex17_1, diffs above"; fi; \
	   ${RM} -f ex17_1.tmp

slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/index.html0000644000175000017500000000233612211062077022654 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

ex16.c: Quadratic eigenproblem for testing the QEP object
ex17.c: Solves a quadratic eigenproblem (l^2*M + l*C + K)*x = 0 with matrices loaded from a file
makefile
slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/ex16f90.F90.html0000644000175000017500000003160012211062077023200 0ustar gladkgladk

Actual source code: ex16f90.F90

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n ex16f90 [-help] [-n <n>] [-m <m>] [SLEPc opts]
 21: !
 22: !  Description: Simple example that solves a quadratic eigensystem with the
 23: !  QEP object. This is the Fortran90 equivalent to ex16.c
 24: !
 25: !  The command line options are:
 26: !    -n <n>, where <n> = number of grid subdivisions in x dimension
 27: !    -m <m>, where <m> = number of grid subdivisions in y dimension
 28: !
 29: ! ----------------------------------------------------------------------
 30: !
 31:       program main

 33: #include <finclude/slepcqepdef.h>
 34:       use slepcqep

 36:       implicit none

 38: ! For usage without modules, uncomment the following lines and remove
 39: ! the previous lines between 'program main' and 'implicit none'
 40: !
 41: !#include <finclude/petsc.h>
 42: !#include <finclude/slepc.h>

 44: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 45: !     Declarations
 46: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 47: !
 48: !  Variables:
 49: !     M,C,K  problem matrices
 50: !     solver quadratic eigenproblem solver context

 52: #if defined(PETSC_USE_FORTRAN_DATATYPES)
 53:       type(Mat)      M, C, K
 54:       type(QEP)      solver
 55: #else
 56:       Mat            M, C, K
 57:       QEP            solver
 58: #endif
 59:       QEPType        tname
 60:       PetscReal      tol
 61:       PetscInt       N, nx, ny, i, j, Istart, Iend, II
 62:       PetscInt       nev, maxit
 63:       PetscMPIInt    rank
 64:       PetscErrorCode ierr
 65:       PetscBool      flg
 66:       PetscScalar    one, mone, four

 68: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 69: !     Beginning of program
 70: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 72:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 73:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 74:       nx = 10
 75:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',nx,flg,ierr)
 76:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-m',ny,flg,ierr)
 77:       if (.not. flg) then
 78:         ny = nx
 79:       endif
 80:       N = nx*ny
 81:       if (rank .eq. 0) then
 82:         write(*,100) N, nx, ny
 83:       endif
 84:  100  format (/'Quadratic Eigenproblem, N=',I6,' (',I4,'x',I4,' grid)')

 86: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 87: !     Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0
 88: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 90: !     ** K is the 2-D Laplacian
 91:       call MatCreate(PETSC_COMM_WORLD,K,ierr)
 92:       call MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,N,N,ierr)
 93:       call MatSetFromOptions(K,ierr)
 94:       call MatSetUp(K,ierr)
 95:       call MatGetOwnershipRange(K,Istart,Iend,ierr)
 96:       mone = -1.0
 97:       four = 4.0
 98:       do II=Istart,Iend-1
 99:         i = II/nx
100:         j = II-i*nx
101:         if (i .gt. 0) then
102:           call MatSetValue(K,II,II-nx,mone,INSERT_VALUES,ierr)
103:         endif
104:         if (i .lt. ny-1) then
105:           call MatSetValue(K,II,II+nx,mone,INSERT_VALUES,ierr)
106:         endif
107:         if (j .gt. 0) then
108:           call MatSetValue(K,II,II-1,mone,INSERT_VALUES,ierr)
109:         endif
110:         if (j .lt. nx-1) then
111:           call MatSetValue(K,II,II+1,mone,INSERT_VALUES,ierr)
112:         endif
113:         call MatSetValue(K,II,II,four,INSERT_VALUES,ierr)
114:       end do
115:       call MatAssemblyBegin(K,MAT_FINAL_ASSEMBLY,ierr)
116:       call MatAssemblyEnd(K,MAT_FINAL_ASSEMBLY,ierr)

118: !     ** C is the zero matrix
119:       call MatCreate(PETSC_COMM_WORLD,C,ierr)
120:       call MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,N,N,ierr)
121:       call MatSetFromOptions(C,ierr)
122:       call MatSetUp(C,ierr)
123:       call MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY,ierr)
124:       call MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY,ierr)

126: !     ** M is the identity matrix
127:       call MatCreate(PETSC_COMM_WORLD,M,ierr)
128:       call MatSetSizes(M,PETSC_DECIDE,PETSC_DECIDE,N,N,ierr)
129:       call MatSetFromOptions(M,ierr)
130:       call MatSetUp(M,ierr)
131:       call MatAssemblyBegin(M,MAT_FINAL_ASSEMBLY,ierr)
132:       call MatAssemblyEnd(M,MAT_FINAL_ASSEMBLY,ierr)
133:       one = 1.0
134:       call MatShift(M,one,ierr)

136: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
137: !     Create the eigensolver and set various options
138: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

140: !     ** Create eigensolver context
141:       call QEPCreate(PETSC_COMM_WORLD,solver,ierr)

143: !     ** Set matrices and problem type
144:       call QEPSetOperators(solver,M,C,K,ierr)
145:       call QEPSetProblemType(solver,QEP_GENERAL,ierr)

147: !     ** Set solver parameters at runtime
148:       call QEPSetFromOptions(solver,ierr)

150: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
151: !     Solve the eigensystem
152: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

154:       call QEPSolve(solver,ierr)

156: !     ** Optional: Get some information from the solver and display it
157:       call QEPGetType(solver,tname,ierr)
158:       if (rank .eq. 0) then
159:         write(*,120) tname
160:       endif
161:  120  format (' Solution method: ',A)
162:       call QEPGetDimensions(solver,nev,PETSC_NULL_INTEGER,              &
163:      &                      PETSC_NULL_INTEGER,ierr)
164:       if (rank .eq. 0) then
165:         write(*,130) nev
166:       endif
167:  130  format (' Number of requested eigenvalues:',I4)
168:       call QEPGetTolerances(solver,tol,maxit,ierr)
169:       if (rank .eq. 0) then
170:         write(*,140) tol, maxit
171:       endif
172:  140  format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)

174: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
175: !     Display solution and clean up
176: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

178:       call QEPPrintSolution(solver,PETSC_NULL_OBJECT,ierr)
179:       call QEPDestroy(solver,ierr)
180:       call MatDestroy(K,ierr)
181:       call MatDestroy(C,ierr)
182:       call MatDestroy(M,ierr)
183:       call SlepcFinalize(ierr)
184:       end

slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/ex16.c0000644000175000017500000001233012211062077021601 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Quadratic eigenproblem for testing the QEP object.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions in x dimension.\n" " -m , where = number of grid subdivisions in y dimension.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat M,C,K; /* problem matrices */ QEP qep; /* quadratic eigenproblem solver context */ QEPType type; PetscInt N,n=10,m,Istart,Iend,II,nev,i,j; PetscBool flag; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscPrintf(PETSC_COMM_WORLD,"\nQuadratic Eigenproblem, N=%D (%Dx%D grid)\n\n",N,n,m);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* K is the 2-D Laplacian */ ierr = MatCreate(PETSC_COMM_WORLD,&K);CHKERRQ(ierr); ierr = MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(K);CHKERRQ(ierr); ierr = MatSetUp(K);CHKERRQ(ierr); ierr = MatGetOwnershipRange(K,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(K,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (i0) { ierr = MatSetValue(K,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (jActual source code: ex17.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves a quadratic eigenproblem (l^2*M + l*C + K)*x = 0 with matrices loaded from a file.\n\n"
 23:   "The command line options are:\n"
 24:   "  -M <filename>, where <filename> = matrix (M) file in PETSc binary form.\n"
 25:   "  -C <filename>, where <filename> = matrix (C) file in PETSc binary form.\n"
 26:   "  -K <filename>, where <filename> = matrix (K) file in PETSc binary form.\n\n";

 28: #include <slepcqep.h>

 32: int main(int argc,char **argv)
 33: {
 34:   Mat            M,C,K;           /* problem matrices */
 35:   QEP            qep;             /* quadratic eigenproblem solver context */
 36:   QEPType        type;
 37:   PetscReal      tol;
 38:   PetscInt       nev,maxit,its;
 39:   char           filename[PETSC_MAX_PATH_LEN];
 40:   PetscViewer    viewer;
 41:   PetscBool      flg;

 44:   SlepcInitialize(&argc,&argv,(char*)0,help);

 46:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 47:         Load the matrices that define the quadratic eigenproblem
 48:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 50:   PetscPrintf(PETSC_COMM_WORLD,"\nQuadratic eigenproblem stored in file.\n\n");
 51: #if defined(PETSC_USE_COMPLEX)
 52:   PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrices from binary files...\n");
 53: #else
 54:   PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrices from binary files...\n");
 55: #endif

 57:   PetscOptionsGetString(NULL,"-M",filename,PETSC_MAX_PATH_LEN,&flg);
 58:   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix M with the -M option");
 59:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 60:   MatCreate(PETSC_COMM_WORLD,&M);
 61:   MatSetFromOptions(M);
 62:   MatLoad(M,viewer);
 63:   PetscViewerDestroy(&viewer);

 65:   PetscOptionsGetString(NULL,"-C",filename,PETSC_MAX_PATH_LEN,&flg);
 66:   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix C with the -C option");
 67:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 68:   MatCreate(PETSC_COMM_WORLD,&C);
 69:   MatSetFromOptions(C);
 70:   MatLoad(C,viewer);
 71:   PetscViewerDestroy(&viewer);

 73:   PetscOptionsGetString(NULL,"-K",filename,PETSC_MAX_PATH_LEN,&flg);
 74:   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name for matrix K with the -K option");
 75:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 76:   MatCreate(PETSC_COMM_WORLD,&K);
 77:   MatSetFromOptions(K);
 78:   MatLoad(K,viewer);
 79:   PetscViewerDestroy(&viewer);

 81:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 82:                 Create the eigensolver and set various options
 83:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 85:   /*
 86:      Create eigensolver context
 87:   */
 88:   QEPCreate(PETSC_COMM_WORLD,&qep);

 90:   /*
 91:      Set matrices
 92:   */
 93:   QEPSetOperators(qep,M,C,K);

 95:   /*
 96:      Set solver parameters at runtime
 97:   */
 98:   QEPSetFromOptions(qep);

100:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101:                       Solve the eigensystem
102:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

104:   QEPSolve(qep);
105:   QEPGetIterationNumber(qep,&its);
106:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);

108:   /*
109:      Optional: Get some information from the solver and display it
110:   */
111:   QEPGetType(qep,&type);
112:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
113:   QEPGetDimensions(qep,&nev,NULL,NULL);
114:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
115:   QEPGetTolerances(qep,&tol,&maxit);
116:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

118:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
119:                     Display solution and clean up
120:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

122:   QEPPrintSolution(qep,NULL);
123:   QEPDestroy(&qep);
124:   MatDestroy(&M);
125:   MatDestroy(&C);
126:   MatDestroy(&K);
127:   SlepcFinalize();
128:   return 0;
129: }

slepc-3.4.2.dfsg.orig/src/qep/examples/tutorials/ex16.c.html0000644000175000017500000002437312211062077022556 0ustar gladkgladk
Actual source code: ex16.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Quadratic eigenproblem for testing the QEP object.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions in x dimension.\n"
 25:   "  -m <m>, where <m> = number of grid subdivisions in y dimension.\n\n";

 27: #include <slepcqep.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            M,C,K;           /* problem matrices */
 34:   QEP            qep;             /* quadratic eigenproblem solver context */
 35:   QEPType        type;
 36:   PetscInt       N,n=10,m,Istart,Iend,II,nev,i,j;
 37:   PetscBool      flag;

 40:   SlepcInitialize(&argc,&argv,(char*)0,help);

 42:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 43:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 44:   if (!flag) m=n;
 45:   N = n*m;
 46:   PetscPrintf(PETSC_COMM_WORLD,"\nQuadratic Eigenproblem, N=%D (%Dx%D grid)\n\n",N,n,m);

 48:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 49:      Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0
 50:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 52:   /* K is the 2-D Laplacian */
 53:   MatCreate(PETSC_COMM_WORLD,&K);
 54:   MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,N,N);
 55:   MatSetFromOptions(K);
 56:   MatSetUp(K);

 58:   MatGetOwnershipRange(K,&Istart,&Iend);
 59:   for (II=Istart;II<Iend;II++) {
 60:     i = II/n; j = II-i*n;
 61:     if (i>0) { MatSetValue(K,II,II-n,-1.0,INSERT_VALUES); }
 62:     if (i<m-1) { MatSetValue(K,II,II+n,-1.0,INSERT_VALUES); }
 63:     if (j>0) { MatSetValue(K,II,II-1,-1.0,INSERT_VALUES); }
 64:     if (j<n-1) { MatSetValue(K,II,II+1,-1.0,INSERT_VALUES); }
 65:     MatSetValue(K,II,II,4.0,INSERT_VALUES);
 66:   }

 68:   MatAssemblyBegin(K,MAT_FINAL_ASSEMBLY);
 69:   MatAssemblyEnd(K,MAT_FINAL_ASSEMBLY);

 71:   /* C is the zero matrix */
 72:   MatCreate(PETSC_COMM_WORLD,&C);
 73:   MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,N,N);
 74:   MatSetFromOptions(C);
 75:   MatSetUp(C);
 76:   MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);
 77:   MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);

 79:   /* M is the identity matrix */
 80:   MatCreate(PETSC_COMM_WORLD,&M);
 81:   MatSetSizes(M,PETSC_DECIDE,PETSC_DECIDE,N,N);
 82:   MatSetFromOptions(M);
 83:   MatSetUp(M);
 84:   MatAssemblyBegin(M,MAT_FINAL_ASSEMBLY);
 85:   MatAssemblyEnd(M,MAT_FINAL_ASSEMBLY);
 86:   MatShift(M,1.0);

 88:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 89:                 Create the eigensolver and set various options
 90:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 92:   /*
 93:      Create eigensolver context
 94:   */
 95:   QEPCreate(PETSC_COMM_WORLD,&qep);

 97:   /*
 98:      Set matrices and problem type
 99:   */
100:   QEPSetOperators(qep,M,C,K);
101:   QEPSetProblemType(qep,QEP_HERMITIAN);

103:   /*
104:      Set solver parameters at runtime
105:   */
106:   QEPSetFromOptions(qep);

108:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
109:                       Solve the eigensystem
110:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

112:   QEPSolve(qep);

114:   /*
115:      Optional: Get some information from the solver and display it
116:   */
117:   QEPGetType(qep,&type);
118:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
119:   QEPGetDimensions(qep,&nev,NULL,NULL);
120:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

122:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
123:                     Display solution and clean up
124:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

126:   QEPPrintSolution(qep,NULL);
127:   QEPDestroy(&qep);
128:   MatDestroy(&M);
129:   MatDestroy(&C);
130:   MatDestroy(&K);
131:   SlepcFinalize();
132:   return 0;
133: }

slepc-3.4.2.dfsg.orig/src/qep/examples/makefile0000644000175000017500000000200512211062077020322 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/qep/examples/ DIRS = tests tutorials include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/examples/makefile.html0000644000175000017500000000351412211062077021273 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/qep/examples/
DIRS     = tests tutorials

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/qep/examples/tests/0000755000175000017500000000000012214143515017767 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/examples/tests/output/0000755000175000017500000000000012214143515021327 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/examples/tests/output/test2_1.out0000644000175000017500000000262712211062077023350 0ustar gladkgladkqep type qarnoldi Solution method: qarnoldi Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: -49.39227, -49.08545, -48.57759, -47.87388 qep type linear, eps type krylovschur Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: -49.39227, -49.08545, -48.57759, -47.87388 qep type linear, eps type arnoldi Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: -49.39227, -49.08545, -48.57759, -47.87388 qep type linear, eps type gd Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=2000 All requested eigenvalues computed up to the required tolerance: -49.39227, -49.08545, -48.57759, -47.87388 qep type linear, eps type jd Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=2000 All requested eigenvalues computed up to the required tolerance: -49.39227, -49.08545, -48.57759, -47.87388 qep type linear, eps type gd2 Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=2000 All requested eigenvalues computed up to the required tolerance: -49.39227, -49.08545, -48.57759, -47.87388 slepc-3.4.2.dfsg.orig/src/qep/examples/tests/output/test1_1.out0000644000175000017500000000447712211062077023354 0ustar gladkgladkqep type linear Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: linear Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i qep type qarnoldi Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: qarnoldi Solution method: qarnoldi Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i qep type linear, eps type krylovschur Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: linear EPS type: krylovschur Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i qep type linear, eps type arnoldi Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: linear EPS type: arnoldi Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=100 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i qep type linear, eps type gd Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: linear EPS type: gd Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=2000 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i qep type linear, eps type jd Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: linear EPS type: jd Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=2000 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i qep type linear, eps type gd2 Quadratic Eigenproblem, N=110 (10x11 grid) QEP type: linear EPS type: gd2 Solution method: linear Number of requested eigenvalues: 4 Stopping condition: maxit=2000 All requested eigenvalues computed up to the required tolerance: 0.00000+2.80193i, 0.00000-2.80193i, 0.00000+2.76605i, 0.00000-2.76605i slepc-3.4.2.dfsg.orig/src/qep/examples/tests/test1.c.html0000644000175000017500000003425112211062077022143 0ustar gladkgladk
Actual source code: test1.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test the solution of a QEP without calling QEPSetFromOptions (based on ex16.c).\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = number of grid subdivisions in x dimension.\n"
 25:   "  -m <m>, where <m> = number of grid subdivisions in y dimension.\n"
 26:   "  -type <qep_type> = qep type to test.\n"
 27:   "  -epstype <eps_type> = eps type to test (for linear).\n\n";

 29: #include <slepcqep.h>

 33: int main(int argc,char **argv)
 34: {
 35:   Mat            M,C,K;           /* problem matrices */
 36:   QEP            qep;             /* quadratic eigenproblem solver context */
 37:   QEPType        type;
 38:   PetscInt       N,n=10,m,Istart,Iend,II,nev,maxit,i,j;
 39:   PetscBool      flag,isgd2;
 40:   char           qeptype[30] = "linear",epstype[30] = "";
 41:   EPS            eps;
 42:   ST             st;
 43:   KSP            ksp;
 44:   PC             pc;

 47:   SlepcInitialize(&argc,&argv,(char*)0,help);

 49:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 50:   PetscOptionsGetInt(NULL,"-m",&m,&flag);
 51:   if (!flag) m=n;
 52:   N = n*m;
 53:   PetscOptionsGetString(NULL,"-type",qeptype,30,NULL);
 54:   PetscOptionsGetString(NULL,"-epstype",epstype,30,&flag);
 55:   PetscPrintf(PETSC_COMM_WORLD,"\nQuadratic Eigenproblem, N=%D (%Dx%D grid)",N,n,m);
 56:   PetscPrintf(PETSC_COMM_WORLD,"\nQEP type: %s",qeptype);
 57:   if (flag) {
 58:     PetscPrintf(PETSC_COMM_WORLD,"\nEPS type: %s",epstype);
 59:   }
 60:   PetscPrintf(PETSC_COMM_WORLD,"\n\n");

 62:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 63:      Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0
 64:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 66:   /* K is the 2-D Laplacian */
 67:   MatCreate(PETSC_COMM_WORLD,&K);
 68:   MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,N,N);
 69:   MatSetFromOptions(K);
 70:   MatSetUp(K);

 72:   MatGetOwnershipRange(K,&Istart,&Iend);
 73:   for (II=Istart;II<Iend;II++) {
 74:     i = II/n; j = II-i*n;
 75:     if (i>0) { MatSetValue(K,II,II-n,-1.0,INSERT_VALUES); }
 76:     if (i<m-1) { MatSetValue(K,II,II+n,-1.0,INSERT_VALUES); }
 77:     if (j>0) { MatSetValue(K,II,II-1,-1.0,INSERT_VALUES); }
 78:     if (j<n-1) { MatSetValue(K,II,II+1,-1.0,INSERT_VALUES); }
 79:     MatSetValue(K,II,II,4.0,INSERT_VALUES);
 80:   }

 82:   MatAssemblyBegin(K,MAT_FINAL_ASSEMBLY);
 83:   MatAssemblyEnd(K,MAT_FINAL_ASSEMBLY);

 85:   /* C is the zero matrix */
 86:   MatCreate(PETSC_COMM_WORLD,&C);
 87:   MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,N,N);
 88:   MatSetFromOptions(C);
 89:   MatSetUp(C);
 90:   MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);
 91:   MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);

 93:   /* M is the identity matrix */
 94:   MatCreate(PETSC_COMM_WORLD,&M);
 95:   MatSetSizes(M,PETSC_DECIDE,PETSC_DECIDE,N,N);
 96:   MatSetFromOptions(M);
 97:   MatSetUp(M);
 98:   MatAssemblyBegin(M,MAT_FINAL_ASSEMBLY);
 99:   MatAssemblyEnd(M,MAT_FINAL_ASSEMBLY);
100:   MatShift(M,1.0);

102:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
103:                 Create the eigensolver and set various options
104:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

106:   /*
107:      Create eigensolver context
108:   */
109:   QEPCreate(PETSC_COMM_WORLD,&qep);

111:   /*
112:      Set matrices and problem type
113:   */
114:   QEPSetOperators(qep,M,C,K);
115:   QEPSetProblemType(qep,QEP_GENERAL);
116:   QEPSetDimensions(qep,4,20,PETSC_DEFAULT);
117:   QEPSetTolerances(qep,PETSC_SMALL,PETSC_DEFAULT);

119:   /*
120:      Set solver type at runtime
121:   */
122:   QEPSetType(qep,qeptype);
123:   if (flag) {
124:     PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&flag);
125:     if (flag) {
126:       QEPLinearGetEPS(qep,&eps);
127:       PetscStrcmp(epstype,"gd2",&isgd2);
128:       if (isgd2) {
129:         EPSSetType(eps,EPSGD);
130:         EPSGDSetDoubleExpansion(eps,PETSC_TRUE);
131:       } else {
132:         EPSSetType(eps,epstype);
133:       }
134:       EPSGetST(eps,&st);
135:       STGetKSP(st,&ksp);
136:       KSPGetPC(ksp,&pc);
137:       PCSetType(pc,PCJACOBI);
138:       PetscObjectTypeCompare((PetscObject)eps,EPSGD,&flag);
139:     }
140:   }

142:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
143:                       Solve the eigensystem
144:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

146:   QEPSolve(qep);

148:   /*
149:      Optional: Get some information from the solver and display it
150:   */
151:   QEPGetType(qep,&type);
152:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
153:   QEPGetDimensions(qep,&nev,NULL,NULL);
154:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
155:   QEPGetTolerances(qep,NULL,&maxit);
156:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: maxit=%D\n",maxit);

158:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
159:                     Display solution and clean up
160:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

162:   QEPPrintSolution(qep,NULL);

164:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
165:      Free work space
166:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

168:   QEPDestroy(&qep);
169:   MatDestroy(&M);
170:   MatDestroy(&C);
171:   MatDestroy(&K);
172:   SlepcFinalize();
173:   return 0;
174: }

slepc-3.4.2.dfsg.orig/src/qep/examples/tests/makefile0000644000175000017500000000555412211062077021500 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/qep/examples/tests/ EXAMPLESC = test1.c test2.c EXAMPLESF = MANSEC = QEP TESTS = test1 test2 TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \ test2.PETSc runtest2_1 test2.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o #------------------------------------------------------------------------------------ QEP = qarnoldi QEPEPS = linear EPS = krylovschur arnoldi gd jd gd2 TESTCODE = \ [ x${SAVE_OUTPUT} = xyes ] && cp $${test}.tmp output/$${test}.out; \ ${DIFF} output/$${test}.out $${test}.tmp || \ echo "Possible problem with $${test}, diffs above"; \ ${RM} -f $${test}.tmp runtest1_1: -@test=test1_1; \ for qep in ${QEPEPS} ${QEP}; do \ echo "qep type $$qep"; \ ${MPIEXEC} -np 1 ./test1 -type $$qep -m 11 -qep_terse 2>&1; \ done > $${test}.tmp; \ for qep in ${QEPEPS}; do \ for eps in ${EPS}; do \ echo "qep type $$qep, eps type $$eps"; \ ${MPIEXEC} -np 1 ./test1 -type $$qep -epstype $$eps -m 11 -qep_terse 2>&1; \ done; \ done >> $${test}.tmp; \ ${TESTCODE} runtest2_1: -@test=test2_1; \ for qep in ${QEP}; do \ echo "qep type $$qep"; \ if [ $$qep = qarnoldi ]; then EXTRA="-qep_ncv 30"; else EXTRA=""; fi; \ ${MPIEXEC} -np 1 ./test2 -qep_type $$qep -qep_nev 4 -qep_terse $$EXTRA 2>&1; \ done > $${test}.tmp; \ for qep in ${QEPEPS}; do \ for eps in ${EPS}; do \ echo "qep type $$qep, eps type $$eps"; \ if [ $$eps = arnoldi -o $$eps = krylovschur ]; then EXTRA="-qep_ncv 30"; else EXTRA=""; fi; \ if [ $$eps = gd2 ]; then eps="gd -qep_eps_gd_double_expansion"; fi; \ ${MPIEXEC} -np 1 ./test2 -qep_type $$qep -qep_eps_type $$eps -qep_nev 4 -qep_terse $$EXTRA 2>&1; \ done; \ done >> $${test}.tmp; \ ${TESTCODE} slepc-3.4.2.dfsg.orig/src/qep/examples/tests/makefile.html0000644000175000017500000001202212211062077022427 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/qep/examples/tests/
EXAMPLESC  = test1.c test2.c
EXAMPLESF  =
MANSEC     = QEP
TESTS      = test1 test2

TESTEXAMPLES_C       = test1.PETSc runtest1_1 test1.rm \
                       test2.PETSc runtest2_1 test2.rm

include ${SLEPC_DIR}/conf/slepc_common

test1: test1.o chkopts
	-${CLINKER} -o test1 test1.o ${SLEPC_LIB}
	${RM} test1.o

test2: test2.o chkopts
	-${CLINKER} -o test2 test2.o ${SLEPC_LIB}
	${RM} test2.o

#------------------------------------------------------------------------------------
QEP = qarnoldi
QEPEPS = linear
EPS = krylovschur arnoldi gd jd gd2

TESTCODE = \
	[ x${SAVE_OUTPUT} = xyes ] && cp $${test}.tmp output/$${test}.out; \
	${DIFF} output/$${test}.out $${test}.tmp || \
	echo "Possible problem with $${test}, diffs above"; \
	${RM} -f $${test}.tmp

runtest1_1:
	-@test=test1_1; \
	for qep in ${QEPEPS} ${QEP}; do \
	   echo "qep type $$qep"; \
	   ${MPIEXEC} -np 1 ./test1 -type $$qep -m 11 -qep_terse 2>&1; \
	done > $${test}.tmp; \
	for qep in ${QEPEPS}; do \
	   for eps in ${EPS}; do \
	      echo "qep type $$qep, eps type $$eps"; \
	      ${MPIEXEC} -np 1 ./test1 -type $$qep -epstype $$eps -m 11 -qep_terse 2>&1; \
           done; \
	done >> $${test}.tmp; \
	${TESTCODE}

runtest2_1:
	-@test=test2_1; \
	for qep in ${QEP}; do \
	   echo "qep type $$qep"; \
	   if [ $$qep = qarnoldi ]; then EXTRA="-qep_ncv 30"; else EXTRA=""; fi; \
	   ${MPIEXEC} -np 1 ./test2 -qep_type $$qep -qep_nev 4 -qep_terse $$EXTRA 2>&1; \
	done > $${test}.tmp; \
	for qep in ${QEPEPS}; do \
	   for eps in ${EPS}; do \
	      echo "qep type $$qep, eps type $$eps"; \
	      if [ $$eps = arnoldi -o $$eps = krylovschur ]; then EXTRA="-qep_ncv 30"; else EXTRA=""; fi; \
	      if [ $$eps = gd2 ]; then eps="gd -qep_eps_gd_double_expansion"; fi; \
	      ${MPIEXEC} -np 1 ./test2 -qep_type $$qep -qep_eps_type $$eps -qep_nev 4 -qep_terse $$EXTRA 2>&1; \
           done; \
	done >> $${test}.tmp; \
	${TESTCODE}
slepc-3.4.2.dfsg.orig/src/qep/examples/tests/test1.c0000644000175000017500000001603712211062077021202 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test the solution of a QEP without calling QEPSetFromOptions (based on ex16.c).\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions in x dimension.\n" " -m , where = number of grid subdivisions in y dimension.\n" " -type = qep type to test.\n" " -epstype = eps type to test (for linear).\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat M,C,K; /* problem matrices */ QEP qep; /* quadratic eigenproblem solver context */ QEPType type; PetscInt N,n=10,m,Istart,Iend,II,nev,maxit,i,j; PetscBool flag,isgd2; char qeptype[30] = "linear",epstype[30] = ""; EPS eps; ST st; KSP ksp; PC pc; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,&flag);CHKERRQ(ierr); if (!flag) m=n; N = n*m; ierr = PetscOptionsGetString(NULL,"-type",qeptype,30,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-epstype",epstype,30,&flag);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nQuadratic Eigenproblem, N=%D (%Dx%D grid)",N,n,m);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nQEP type: %s",qeptype);CHKERRQ(ierr); if (flag) { ierr = PetscPrintf(PETSC_COMM_WORLD,"\nEPS type: %s",epstype);CHKERRQ(ierr); } ierr = PetscPrintf(PETSC_COMM_WORLD,"\n\n");CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* K is the 2-D Laplacian */ ierr = MatCreate(PETSC_COMM_WORLD,&K);CHKERRQ(ierr); ierr = MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(K);CHKERRQ(ierr); ierr = MatSetUp(K);CHKERRQ(ierr); ierr = MatGetOwnershipRange(K,&Istart,&Iend);CHKERRQ(ierr); for (II=Istart;II0) { ierr = MatSetValue(K,II,II-n,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (i0) { ierr = MatSetValue(K,II,II-1,-1.0,INSERT_VALUES);CHKERRQ(ierr); } if (j Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

test1.c: Test the solution of a QEP without calling QEPSetFromOptions (based on ex16
test2.c: Test the solution of a QEP from a finite element model of
makefile
slepc-3.4.2.dfsg.orig/src/qep/examples/tests/test2.c0000644000175000017500000001465112211062077021203 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example based on spring problem in NLEVP collection [1]. See the parameters meaning at Example 2 in [2]. [1] T. Betcke, N. J. Higham, V. Mehrmann, C. Schroder, and F. Tisseur, NLEVP: A Collection of Nonlinear Eigenvalue Problems, MIMS EPrint 2010.98, November 2010. [2] F. Tisseur, Backward error and condition of polynomial eigenvalue problems, Linear Algebra and its Applications, 309 (2000), pp. 339--361, April 2000. */ static char help[] = "Test the solution of a QEP from a finite element model of " "damped mass-spring system (problem from NLEVP collection).\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions.\n" " -tau , where = tau parameter.\n" " -kappa , where = kappa paramter.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat M,C,K; /* problem matrices */ QEP qep; /* quadratic eigenproblem solver context */ QEPType type; PetscErrorCode ierr; PetscInt n=30,Istart,Iend,i,maxit,nev; PetscScalar mu=1.0,tau=10.0,kappa=5.0; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-mu",&mu,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-tau",&tau,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetScalar(NULL,"-kappa",&kappa,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* K is a tridiagonal */ ierr = MatCreate(PETSC_COMM_WORLD,&K);CHKERRQ(ierr); ierr = MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(K);CHKERRQ(ierr); ierr = MatSetUp(K);CHKERRQ(ierr); ierr = MatGetOwnershipRange(K,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart; i0) { ierr = MatSetValue(K,i,i-1,-kappa,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatSetValue(K,i,i,kappa*3.0,INSERT_VALUES);CHKERRQ(ierr); if (i0) { ierr = MatSetValue(C,i,i-1,-tau,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatSetValue(C,i,i,tau*3.0,INSERT_VALUES);CHKERRQ(ierr); if (iActual source code: test2.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

 17:    You  should have received a copy of the GNU Lesser General  Public  License
 18:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 21:    Example based on spring problem in NLEVP collection [1]. See the parameters
 22:    meaning at Example 2 in [2].

 24:    [1] T. Betcke, N. J. Higham, V. Mehrmann, C. Schroder, and F. Tisseur,
 25:        NLEVP: A Collection of Nonlinear Eigenvalue Problems, MIMS EPrint
 26:        2010.98, November 2010.
 27:    [2] F. Tisseur, Backward error and condition of polynomial eigenvalue
 28:        problems, Linear Algebra and its Applications, 309 (2000), pp. 339--361,
 29:        April 2000.
 30: */

 32: static char help[] = "Test the solution of a QEP from a finite element model of "
 33:   "damped mass-spring system (problem from NLEVP collection).\n\n"
 34:   "The command line options are:\n"
 35:   "  -n <n>, where <n> = number of grid subdivisions.\n"
 36:   "  -tau <tau>, where <tau> = tau parameter.\n"
 37:   "  -kappa <kappa>, where <kappa> = kappa paramter.\n\n";

 39: #include <slepcqep.h>

 43: int main(int argc,char **argv)
 44: {
 45:   Mat            M,C,K;           /* problem matrices */
 46:   QEP            qep;             /* quadratic eigenproblem solver context */
 47:   QEPType        type;
 49:   PetscInt       n=30,Istart,Iend,i,maxit,nev;
 50:   PetscScalar    mu=1.0,tau=10.0,kappa=5.0;

 52:   SlepcInitialize(&argc,&argv,(char*)0,help);

 54:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 55:   PetscOptionsGetScalar(NULL,"-mu",&mu,NULL);
 56:   PetscOptionsGetScalar(NULL,"-tau",&tau,NULL);
 57:   PetscOptionsGetScalar(NULL,"-kappa",&kappa,NULL);

 59:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 60:      Compute the matrices that define the eigensystem, (k^2*M+k*C+K)x=0
 61:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 63:   /* K is a tridiagonal */
 64:   MatCreate(PETSC_COMM_WORLD,&K);
 65:   MatSetSizes(K,PETSC_DECIDE,PETSC_DECIDE,n,n);
 66:   MatSetFromOptions(K);
 67:   MatSetUp(K);

 69:   MatGetOwnershipRange(K,&Istart,&Iend);
 70:   for (i=Istart; i<Iend; i++) {
 71:     if (i>0) {
 72:       MatSetValue(K,i,i-1,-kappa,INSERT_VALUES);
 73:     }
 74:     MatSetValue(K,i,i,kappa*3.0,INSERT_VALUES);
 75:     if (i<n-1) {
 76:       MatSetValue(K,i,i+1,-kappa,INSERT_VALUES);
 77:     }
 78:   }

 80:   MatAssemblyBegin(K,MAT_FINAL_ASSEMBLY);
 81:   MatAssemblyEnd(K,MAT_FINAL_ASSEMBLY);

 83:   /* C is a tridiagonal */
 84:   MatCreate(PETSC_COMM_WORLD,&C);
 85:   MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,n,n);
 86:   MatSetFromOptions(C);
 87:   MatSetUp(C);

 89:   MatGetOwnershipRange(C,&Istart,&Iend);
 90:   for (i=Istart; i<Iend; i++) {
 91:     if (i>0) {
 92:       MatSetValue(C,i,i-1,-tau,INSERT_VALUES);
 93:     }
 94:     MatSetValue(C,i,i,tau*3.0,INSERT_VALUES);
 95:     if (i<n-1) {
 96:       MatSetValue(C,i,i+1,-tau,INSERT_VALUES);
 97:     }
 98:   }

100:   MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);
101:   MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);

103:   /* M is a diagonal matrix */
104:   MatCreate(PETSC_COMM_WORLD,&M);
105:   MatSetSizes(M,PETSC_DECIDE,PETSC_DECIDE,n,n);
106:   MatSetFromOptions(M);
107:   MatSetUp(M);
108:   MatGetOwnershipRange(M,&Istart,&Iend);
109:   for (i=Istart; i<Iend; i++) {
110:     MatSetValue(M,i,i,mu,INSERT_VALUES);
111:   }
112:   MatAssemblyBegin(M,MAT_FINAL_ASSEMBLY);
113:   MatAssemblyEnd(M,MAT_FINAL_ASSEMBLY);

115:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116:                 Create the eigensolver and set various options
117:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

119:   /*
120:      Create eigensolver context
121:   */
122:   QEPCreate(PETSC_COMM_WORLD,&qep);

124:   /*
125:      Set matrices, the problem type and other settings
126:   */
127:   QEPSetOperators(qep,M,C,K);
128:   QEPSetProblemType(qep,QEP_GENERAL);
129:   QEPSetTolerances(qep,PETSC_SMALL,PETSC_DEFAULT);
130:   QEPSetFromOptions(qep);

132:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
133:                       Solve the eigensystem
134:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

136:   QEPSolve(qep);

138:   /*
139:      Optional: Get some information from the solver and display it
140:   */
141:   QEPGetType(qep,&type);
142:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
143:   QEPGetDimensions(qep,&nev,NULL,NULL);
144:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);
145:   QEPGetTolerances(qep,NULL,&maxit);
146:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: maxit=%D\n",maxit);

148:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
149:                     Display solution and clean up
150:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

152:   QEPPrintSolution(qep,NULL);

154:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
155:      Free work space
156:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

158:   QEPDestroy(&qep);
159:   MatDestroy(&M);
160:   MatDestroy(&C);
161:   MatDestroy(&K);
162:   SlepcFinalize();
163:   return 0;
164: }
slepc-3.4.2.dfsg.orig/src/qep/examples/index.html0000644000175000017500000000040012211062077020614 0ustar gladkgladk Generic SLEPc Manual Pages

tests/
tutorials/
makefile
slepc-3.4.2.dfsg.orig/src/qep/impls/0000755000175000017500000000000012214143515016133 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/impls/qarnoldi/0000755000175000017500000000000012214143515017744 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/impls/qarnoldi/qarnoldi.c0000644000175000017500000002625712211062077021735 0ustar gladkgladk/* SLEPc quadratic eigensolver: "qarnoldi" Method: Q-Arnoldi Algorithm: Quadratic Arnoldi with Krylov-Schur type restart. References: [1] K. Meerbergen, "The Quadratic Arnoldi method for the solution of the quadratic eigenvalue problem", SIAM J. Matrix Anal. Appl. 30(4):1462-1482, 2008. Last update: Nov 2012 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "QEPSetUp_QArnoldi" PetscErrorCode QEPSetUp_QArnoldi(QEP qep) { PetscErrorCode ierr; PetscBool sinv; PetscFunctionBegin; if (qep->ncv) { /* ncv set */ if (qep->ncvnev) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must be at least nev"); } else if (qep->mpd) { /* mpd set */ qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (qep->nev<500) qep->ncv = PetscMin(qep->n,PetscMax(2*qep->nev,qep->nev+15)); else { qep->mpd = 500; qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd); } } if (!qep->mpd) qep->mpd = qep->ncv; if (qep->ncv>qep->nev+qep->mpd) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must not be larger than nev+mpd"); if (!qep->max_it) qep->max_it = PetscMax(100,2*qep->n/qep->ncv); if (!qep->which) { ierr = PetscObjectTypeCompare((PetscObject)qep->st,STSINVERT,&sinv);CHKERRQ(ierr); if (sinv) qep->which = QEP_TARGET_MAGNITUDE; else qep->which = QEP_LARGEST_MAGNITUDE; } ierr = QEPAllocateSolution(qep);CHKERRQ(ierr); ierr = QEPSetWorkVecs(qep,4);CHKERRQ(ierr); ierr = DSSetType(qep->ds,DSNHEP);CHKERRQ(ierr); ierr = DSSetExtraRow(qep->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSAllocate(qep->ds,qep->ncv+1);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPQArnoldiCGS" /* Compute a step of Classical Gram-Schmidt orthogonalization */ static PetscErrorCode QEPQArnoldiCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work) { PetscErrorCode ierr; PetscBLASInt ione = 1,j_1 = j+1; PetscReal x,y; PetscScalar dot,one = 1.0,zero = 0.0; PetscFunctionBegin; /* compute norm of v and w */ if (onorm) { ierr = VecNorm(v,NORM_2,&x);CHKERRQ(ierr); ierr = VecNorm(w,NORM_2,&y);CHKERRQ(ierr); *onorm = PetscSqrtReal(x*x+y*y); } /* orthogonalize: compute h */ ierr = VecMDot(v,j_1,V,h);CHKERRQ(ierr); ierr = VecMDot(w,j_1,V,work);CHKERRQ(ierr); if (j>0) PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&j_1,&j,&one,H,&ldh,work,&ione,&one,h,&ione)); ierr = VecDot(w,t,&dot);CHKERRQ(ierr); h[j] += dot; /* orthogonalize: update v and w */ ierr = SlepcVecMAXPBY(v,1.0,-1.0,j_1,h,V);CHKERRQ(ierr); if (j>0) { PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&j_1,&j,&one,H,&ldh,h,&ione,&zero,work,&ione)); ierr = SlepcVecMAXPBY(w,1.0,-1.0,j_1,work,V);CHKERRQ(ierr); } ierr = VecAXPY(w,-h[j],t);CHKERRQ(ierr); /* compute norm of v and w */ if (norm) { ierr = VecNorm(v,NORM_2,&x);CHKERRQ(ierr); ierr = VecNorm(w,NORM_2,&y);CHKERRQ(ierr); *norm = PetscSqrtReal(x*x+y*y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPQArnoldi" /* Compute a run of Q-Arnoldi iterations */ static PetscErrorCode QEPQArnoldi(QEP qep,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscReal *beta,PetscBool *breakdown,PetscScalar *work) { PetscErrorCode ierr; PetscInt i,j,l,m = *M; Vec t = qep->work[2],u = qep->work[3]; IPOrthogRefineType refinement; PetscReal norm,onorm,eta; PetscScalar *c = work + m; PetscFunctionBegin; ierr = IPGetOrthogonalization(qep->ip,NULL,&refinement,&eta);CHKERRQ(ierr); ierr = VecCopy(v,qep->V[k]);CHKERRQ(ierr); for (j=k;jst,0,v,u);CHKERRQ(ierr); ierr = STMatMult(qep->st,1,t,w);CHKERRQ(ierr); ierr = VecAXPY(u,qep->sfactor,w);CHKERRQ(ierr); ierr = STMatSolve(qep->st,2,u,w);CHKERRQ(ierr); ierr = VecScale(w,-1.0/(qep->sfactor*qep->sfactor));CHKERRQ(ierr); ierr = VecCopy(t,v);CHKERRQ(ierr); /* orthogonalize */ switch (refinement) { case IP_ORTHOG_REFINE_NEVER: ierr = QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,NULL,&norm,work);CHKERRQ(ierr); *breakdown = PETSC_FALSE; break; case IP_ORTHOG_REFINE_ALWAYS: ierr = QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,NULL,NULL,work);CHKERRQ(ierr); ierr = QEPQArnoldiCGS(qep,H,ldh,c,j,V,t,v,w,&onorm,&norm,work);CHKERRQ(ierr); for (i=0;i<=j;i++) H[ldh*j+i] += c[i]; if (norm < eta * onorm) *breakdown = PETSC_TRUE; else *breakdown = PETSC_FALSE; break; case IP_ORTHOG_REFINE_IFNEEDED: ierr = QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,&onorm,&norm,work);CHKERRQ(ierr); /* ||q|| < eta ||h|| */ l = 1; while (l<3 && norm < eta * onorm) { l++; onorm = norm; ierr = QEPQArnoldiCGS(qep,H,ldh,c,j,V,t,v,w,NULL,&norm,work);CHKERRQ(ierr); for (i=0;i<=j;i++) H[ldh*j+i] += c[i]; } if (norm < eta * onorm) *breakdown = PETSC_TRUE; else *breakdown = PETSC_FALSE; break; default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of ip->orth_ref"); } ierr = VecScale(v,1.0/norm);CHKERRQ(ierr); ierr = VecScale(w,1.0/norm);CHKERRQ(ierr); H[j+1+ldh*j] = norm; if (jwork[0],w=qep->work[1],v_=qep->work[2],w_=qep->work[3]; PetscScalar *S,*Q,*work,r,s; PetscReal beta=0.0,norm,x,y,t; PetscBool breakdown=PETSC_FALSE,issinv; PetscFunctionBegin; ierr = DSGetLeadingDimension(qep->ds,&ld);CHKERRQ(ierr); lwork = 7*qep->ncv; ierr = PetscMalloc(lwork*sizeof(PetscScalar),&work);CHKERRQ(ierr); /* Get the starting Arnoldi vector */ if (qep->nini>0) { ierr = VecCopy(qep->V[0],v);CHKERRQ(ierr); } else { ierr = SlepcVecSetRandom(v,qep->rand);CHKERRQ(ierr); } /* w is always a random vector */ ierr = SlepcVecSetRandom(w,qep->rand);CHKERRQ(ierr); ierr = VecNorm(v,NORM_2,&x);CHKERRQ(ierr); ierr = VecNorm(w,NORM_2,&y);CHKERRQ(ierr); norm = PetscSqrtReal(x*x+y*y);CHKERRQ(ierr); ierr = VecScale(v,1.0/norm);CHKERRQ(ierr); ierr = VecScale(w,1.0/norm);CHKERRQ(ierr); /* Compute scaling factor if not set by user */ ierr = PetscObjectTypeCompare((PetscObject)qep->st,STSINVERT,&issinv);CHKERRQ(ierr); if (issinv && !qep->sfactor_set) { ierr = STMatMult(qep->st,1,w,w_);CHKERRQ(ierr); ierr = STMatMult(qep->st,0,v,v_);CHKERRQ(ierr); ierr = VecAXPY(v_,1.0,w_);CHKERRQ(ierr); ierr = STMatSolve(qep->st,2,v_,w_);CHKERRQ(ierr); ierr = VecScale(w_,-1.0);CHKERRQ(ierr); ierr = VecCopy(w,v_);CHKERRQ(ierr); ierr = VecDot(v_,v,&r);CHKERRQ(ierr); ierr = VecDot(w_,w,&s);CHKERRQ(ierr); t = PetscAbsScalar(r+s); qep->sfactor = 1.0; while (t > 1.0) { qep->sfactor *=10.0; t /= 10.0; } } /* Restart loop */ l = 0; while (qep->reason == QEP_CONVERGED_ITERATING) { qep->its++; /* Compute an nv-step Arnoldi factorization */ nv = PetscMin(qep->nconv+qep->mpd,qep->ncv); ierr = DSGetArray(qep->ds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = QEPQArnoldi(qep,S,ld,qep->V,qep->nconv+l,&nv,v,w,&beta,&breakdown,work);CHKERRQ(ierr); ierr = DSRestoreArray(qep->ds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = DSSetDimensions(qep->ds,nv,0,qep->nconv,qep->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(qep->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(qep->ds,DS_STATE_RAW);CHKERRQ(ierr); } /* Solve projected problem */ ierr = DSSolve(qep->ds,qep->eigr,qep->eigi);CHKERRQ(ierr); ierr = DSSort(qep->ds,qep->eigr,qep->eigi,NULL,NULL,NULL);CHKERRQ(ierr); ierr = DSUpdateExtraRow(qep->ds);CHKERRQ(ierr); /* Check convergence */ ierr = QEPKrylovConvergence(qep,PETSC_FALSE,qep->nconv,nv-qep->nconv,nv,beta,&k);CHKERRQ(ierr); if (qep->its >= qep->max_it) qep->reason = QEP_DIVERGED_ITS; if (k >= qep->nev) qep->reason = QEP_CONVERGED_TOL; /* Update l */ if (qep->reason != QEP_CONVERGED_ITERATING || breakdown) l = 0; else l = (nv-k)/2; if (qep->reason == QEP_CONVERGED_ITERATING) { if (breakdown) { /* Stop if breakdown */ ierr = PetscInfo2(qep,"Breakdown Quadratic Arnoldi method (it=%D norm=%G)\n",qep->its,beta);CHKERRQ(ierr); qep->reason = QEP_DIVERGED_BREAKDOWN; } else { /* Prepare the Rayleigh quotient for restart */ ierr = DSTruncate(qep->ds,k+l);CHKERRQ(ierr); ierr = DSGetDimensions(qep->ds,&newn,NULL,NULL,NULL,NULL);CHKERRQ(ierr); l = newn-k; } } /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */ ierr = DSGetArray(qep->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,qep->V,qep->nconv,k+l,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(qep->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); qep->nconv = k; ierr = QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,nv);CHKERRQ(ierr); } for (j=0;jnconv;j++) { qep->eigr[j] *= qep->sfactor; qep->eigi[j] *= qep->sfactor; } /* truncate Schur decomposition and change the state to raw so that DSVectors() computes eigenvectors from scratch */ ierr = DSSetDimensions(qep->ds,qep->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(qep->ds,DS_STATE_RAW);CHKERRQ(ierr); /* Compute eigenvectors */ if (qep->nconv > 0) { ierr = QEPComputeVectors_Schur(qep);CHKERRQ(ierr); } ierr = PetscFree(work);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPCreate_QArnoldi" PETSC_EXTERN PetscErrorCode QEPCreate_QArnoldi(QEP qep) { PetscFunctionBegin; qep->ops->solve = QEPSolve_QArnoldi; qep->ops->setup = QEPSetUp_QArnoldi; qep->ops->reset = QEPReset_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/qarnoldi/qarnoldi.c.html0000644000175000017500000005705012211062077022673 0ustar gladkgladk

Actual source code: qarnoldi.c

  1: /*

  3:    SLEPc quadratic eigensolver: "qarnoldi"

  5:    Method: Q-Arnoldi

  7:    Algorithm:

  9:        Quadratic Arnoldi with Krylov-Schur type restart.

 11:    References:

 13:        [1] K. Meerbergen, "The Quadratic Arnoldi method for the solution
 14:            of the quadratic eigenvalue problem", SIAM J. Matrix Anal.
 15:            Appl. 30(4):1462-1482, 2008.

 17:    Last update: Nov 2012

 19:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 21:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 23:    This file is part of SLEPc.

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

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

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

 39: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 40: #include <petscblaslapack.h>

 44: PetscErrorCode QEPSetUp_QArnoldi(QEP qep)
 45: {
 47:   PetscBool      sinv;

 50:   if (qep->ncv) { /* ncv set */
 51:     if (qep->ncv<qep->nev) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must be at least nev");
 52:   } else if (qep->mpd) { /* mpd set */
 53:     qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd);
 54:   } else { /* neither set: defaults depend on nev being small or large */
 55:     if (qep->nev<500) qep->ncv = PetscMin(qep->n,PetscMax(2*qep->nev,qep->nev+15));
 56:     else {
 57:       qep->mpd = 500;
 58:       qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd);
 59:     }
 60:   }
 61:   if (!qep->mpd) qep->mpd = qep->ncv;
 62:   if (qep->ncv>qep->nev+qep->mpd) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must not be larger than nev+mpd");
 63:   if (!qep->max_it) qep->max_it = PetscMax(100,2*qep->n/qep->ncv);
 64:   if (!qep->which) {
 65:     PetscObjectTypeCompare((PetscObject)qep->st,STSINVERT,&sinv);
 66:     if (sinv) qep->which = QEP_TARGET_MAGNITUDE;
 67:     else qep->which = QEP_LARGEST_MAGNITUDE;
 68:   }

 70:   QEPAllocateSolution(qep);
 71:   QEPSetWorkVecs(qep,4);

 73:   DSSetType(qep->ds,DSNHEP);
 74:   DSSetExtraRow(qep->ds,PETSC_TRUE);
 75:   DSAllocate(qep->ds,qep->ncv+1);
 76:   return(0);
 77: }

 81: /*
 82:   Compute a step of Classical Gram-Schmidt orthogonalization
 83: */
 84: static PetscErrorCode QEPQArnoldiCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work)
 85: {
 87:   PetscBLASInt   ione = 1,j_1 = j+1;
 88:   PetscReal      x,y;
 89:   PetscScalar    dot,one = 1.0,zero = 0.0;

 92:   /* compute norm of v and w */
 93:   if (onorm) {
 94:     VecNorm(v,NORM_2,&x);
 95:     VecNorm(w,NORM_2,&y);
 96:     *onorm = PetscSqrtReal(x*x+y*y);
 97:   }

 99:   /* orthogonalize: compute h */
100:   VecMDot(v,j_1,V,h);
101:   VecMDot(w,j_1,V,work);
102:   if (j>0)
103:     PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&j_1,&j,&one,H,&ldh,work,&ione,&one,h,&ione));
104:   VecDot(w,t,&dot);
105:   h[j] += dot;

107:   /* orthogonalize: update v and w */
108:   SlepcVecMAXPBY(v,1.0,-1.0,j_1,h,V);
109:   if (j>0) {
110:     PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&j_1,&j,&one,H,&ldh,h,&ione,&zero,work,&ione));
111:     SlepcVecMAXPBY(w,1.0,-1.0,j_1,work,V);
112:   }
113:   VecAXPY(w,-h[j],t);

115:   /* compute norm of v and w */
116:   if (norm) {
117:     VecNorm(v,NORM_2,&x);
118:     VecNorm(w,NORM_2,&y);
119:     *norm = PetscSqrtReal(x*x+y*y);
120:   }
121:   return(0);
122: }

126: /*
127:   Compute a run of Q-Arnoldi iterations
128: */
129: static PetscErrorCode QEPQArnoldi(QEP qep,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscReal *beta,PetscBool *breakdown,PetscScalar *work)
130: {
131:   PetscErrorCode     ierr;
132:   PetscInt           i,j,l,m = *M;
133:   Vec                t = qep->work[2],u = qep->work[3];
134:   IPOrthogRefineType refinement;
135:   PetscReal          norm,onorm,eta;
136:   PetscScalar        *c = work + m;

139:   IPGetOrthogonalization(qep->ip,NULL,&refinement,&eta);
140:   VecCopy(v,qep->V[k]);

142:   for (j=k;j<m;j++) {
143:     /* apply operator */
144:     VecCopy(w,t);
145:     STMatMult(qep->st,0,v,u);
146:     STMatMult(qep->st,1,t,w);
147:     VecAXPY(u,qep->sfactor,w);
148:     STMatSolve(qep->st,2,u,w);
149:     VecScale(w,-1.0/(qep->sfactor*qep->sfactor));
150:     VecCopy(t,v);

152:     /* orthogonalize */
153:     switch (refinement) {
154:       case IP_ORTHOG_REFINE_NEVER:
155:         QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,NULL,&norm,work);
156:         *breakdown = PETSC_FALSE;
157:         break;
158:       case IP_ORTHOG_REFINE_ALWAYS:
159:         QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,NULL,NULL,work);
160:         QEPQArnoldiCGS(qep,H,ldh,c,j,V,t,v,w,&onorm,&norm,work);
161:         for (i=0;i<=j;i++) H[ldh*j+i] += c[i];
162:         if (norm < eta * onorm) *breakdown = PETSC_TRUE;
163:         else *breakdown = PETSC_FALSE;
164:         break;
165:       case IP_ORTHOG_REFINE_IFNEEDED:
166:         QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,&onorm,&norm,work);
167:         /* ||q|| < eta ||h|| */
168:         l = 1;
169:         while (l<3 && norm < eta * onorm) {
170:           l++;
171:           onorm = norm;
172:           QEPQArnoldiCGS(qep,H,ldh,c,j,V,t,v,w,NULL,&norm,work);
173:           for (i=0;i<=j;i++) H[ldh*j+i] += c[i];
174:         }
175:         if (norm < eta * onorm) *breakdown = PETSC_TRUE;
176:         else *breakdown = PETSC_FALSE;
177:         break;
178:       default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of ip->orth_ref");
179:     }
180:     VecScale(v,1.0/norm);
181:     VecScale(w,1.0/norm);

183:     H[j+1+ldh*j] = norm;
184:     if (j<m-1) {
185:       VecCopy(v,V[j+1]);
186:     }
187:   }
188:   *beta = norm;
189:   return(0);
190: }

194: PetscErrorCode QEPSolve_QArnoldi(QEP qep)
195: {
197:   PetscInt       j,k,l,lwork,nv,ld,newn;
198:   Vec            v=qep->work[0],w=qep->work[1],v_=qep->work[2],w_=qep->work[3];
199:   PetscScalar    *S,*Q,*work,r,s;
200:   PetscReal      beta=0.0,norm,x,y,t;
201:   PetscBool      breakdown=PETSC_FALSE,issinv;

204:   DSGetLeadingDimension(qep->ds,&ld);
205:   lwork = 7*qep->ncv;
206:   PetscMalloc(lwork*sizeof(PetscScalar),&work);

208:   /* Get the starting Arnoldi vector */
209:   if (qep->nini>0) {
210:     VecCopy(qep->V[0],v);
211:   } else {
212:     SlepcVecSetRandom(v,qep->rand);
213:   }
214:   /* w is always a random vector */
215:   SlepcVecSetRandom(w,qep->rand);
216:   VecNorm(v,NORM_2,&x);
217:   VecNorm(w,NORM_2,&y);
218:   norm = PetscSqrtReal(x*x+y*y);
219:   VecScale(v,1.0/norm);
220:   VecScale(w,1.0/norm);

222:   /* Compute scaling factor if not set by user */
223:   PetscObjectTypeCompare((PetscObject)qep->st,STSINVERT,&issinv);
224:   if (issinv && !qep->sfactor_set) {
225:     STMatMult(qep->st,1,w,w_);
226:     STMatMult(qep->st,0,v,v_);
227:     VecAXPY(v_,1.0,w_);
228:     STMatSolve(qep->st,2,v_,w_);
229:     VecScale(w_,-1.0);
230:     VecCopy(w,v_);
231:     VecDot(v_,v,&r);
232:     VecDot(w_,w,&s);
233:     t = PetscAbsScalar(r+s);
234:     qep->sfactor = 1.0;
235:     while (t > 1.0) {
236:       qep->sfactor *=10.0;
237:       t /= 10.0;
238:     }
239:   }
240:   /* Restart loop */
241:   l = 0;
242:   while (qep->reason == QEP_CONVERGED_ITERATING) {
243:     qep->its++;

245:     /* Compute an nv-step Arnoldi factorization */
246:     nv = PetscMin(qep->nconv+qep->mpd,qep->ncv);
247:     DSGetArray(qep->ds,DS_MAT_A,&S);
248:     QEPQArnoldi(qep,S,ld,qep->V,qep->nconv+l,&nv,v,w,&beta,&breakdown,work);
249:     DSRestoreArray(qep->ds,DS_MAT_A,&S);
250:     DSSetDimensions(qep->ds,nv,0,qep->nconv,qep->nconv+l);
251:     if (l==0) {
252:       DSSetState(qep->ds,DS_STATE_INTERMEDIATE);
253:     } else {
254:       DSSetState(qep->ds,DS_STATE_RAW);
255:     }

257:     /* Solve projected problem */
258:     DSSolve(qep->ds,qep->eigr,qep->eigi);
259:     DSSort(qep->ds,qep->eigr,qep->eigi,NULL,NULL,NULL);
260:     DSUpdateExtraRow(qep->ds);

262:     /* Check convergence */
263:     QEPKrylovConvergence(qep,PETSC_FALSE,qep->nconv,nv-qep->nconv,nv,beta,&k);
264:     if (qep->its >= qep->max_it) qep->reason = QEP_DIVERGED_ITS;
265:     if (k >= qep->nev) qep->reason = QEP_CONVERGED_TOL;

267:     /* Update l */
268:     if (qep->reason != QEP_CONVERGED_ITERATING || breakdown) l = 0;
269:     else l = (nv-k)/2;

271:     if (qep->reason == QEP_CONVERGED_ITERATING) {
272:       if (breakdown) {
273:         /* Stop if breakdown */
274:         PetscInfo2(qep,"Breakdown Quadratic Arnoldi method (it=%D norm=%G)\n",qep->its,beta);
275:         qep->reason = QEP_DIVERGED_BREAKDOWN;
276:       } else {
277:         /* Prepare the Rayleigh quotient for restart */
278:         DSTruncate(qep->ds,k+l);
279:         DSGetDimensions(qep->ds,&newn,NULL,NULL,NULL,NULL);
280:         l = newn-k;
281:       }
282:     }
283:     /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
284:     DSGetArray(qep->ds,DS_MAT_Q,&Q);
285:     SlepcUpdateVectors(nv,qep->V,qep->nconv,k+l,Q,ld,PETSC_FALSE);
286:     DSRestoreArray(qep->ds,DS_MAT_Q,&Q);

288:     qep->nconv = k;
289:     QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,nv);
290:   }

292:   for (j=0;j<qep->nconv;j++) {
293:     qep->eigr[j] *= qep->sfactor;
294:     qep->eigi[j] *= qep->sfactor;
295:   }

297:   /* truncate Schur decomposition and change the state to raw so that
298:      DSVectors() computes eigenvectors from scratch */
299:   DSSetDimensions(qep->ds,qep->nconv,0,0,0);
300:   DSSetState(qep->ds,DS_STATE_RAW);

302:   /* Compute eigenvectors */
303:   if (qep->nconv > 0) {
304:     QEPComputeVectors_Schur(qep);
305:   }
306:   PetscFree(work);
307:   return(0);
308: }

312: PETSC_EXTERN PetscErrorCode QEPCreate_QArnoldi(QEP qep)
313: {
315:   qep->ops->solve                = QEPSolve_QArnoldi;
316:   qep->ops->setup                = QEPSetUp_QArnoldi;
317:   qep->ops->reset                = QEPReset_Default;
318:   return(0);
319: }

slepc-3.4.2.dfsg.orig/src/qep/impls/qarnoldi/makefile0000644000175000017500000000214512211062077021446 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = qarnoldi.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = QEP LOCDIR = src/qep/impls/qarnoldi/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/impls/qarnoldi/makefile.html0000644000175000017500000000374112211062077022414 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = qarnoldi.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = QEP
LOCDIR   = src/qep/impls/qarnoldi/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/qep/impls/qarnoldi/index.html0000644000175000017500000000206612211062077021745 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

qarnoldi.c
makefile
slepc-3.4.2.dfsg.orig/src/qep/impls/makefile0000644000175000017500000000206312211062077017634 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = linear qarnoldi qlanczos LOCDIR = src/qep/impls/ MANSEC = QEP include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/impls/makefile.html0000644000175000017500000000365712211062077020611 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = linear qarnoldi qlanczos
LOCDIR   = src/qep/impls/
MANSEC   = QEP

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/qep/impls/index.html0000644000175000017500000000216712211062077020136 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

linear/
qarnoldi/
qlanczos/
makefile
slepc-3.4.2.dfsg.orig/src/qep/impls/linear/0000755000175000017500000000000012214143515017405 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_s1.c.html0000644000175000017500000002371212211062077022414 0ustar gladkgladk

Actual source code: qeplin_s1.c

  1: /*

  3:    Linearization for Hermitian QEP, companion form 1.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26:  #include linearp.h

 28: /*
 29:     Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
 30:     linearization is employed:

 32:       A*z = l*B*z   where   A = [  0  -K ]     B = [-K  0 ]     z = [  x  ]
 33:                                 [ -K  -C ]         [ 0  M ]         [ l*x ]
 34:  */

 38: PetscErrorCode MatMult_Linear_S1A(Mat A,Vec x,Vec y)
 39: {
 40:   PetscErrorCode    ierr;
 41:   QEP_LINEAR        *ctx;
 42:   const PetscScalar *px;
 43:   PetscScalar       *py;
 44:   PetscInt          m;

 47:   MatShellGetContext(A,(void**)&ctx);
 48:   MatGetLocalSize(ctx->M,&m,NULL);
 49:   VecGetArrayRead(x,&px);
 50:   VecGetArray(y,&py);
 51:   VecPlaceArray(ctx->x1,px);
 52:   VecPlaceArray(ctx->x2,px+m);
 53:   VecPlaceArray(ctx->y1,py);
 54:   VecPlaceArray(ctx->y2,py+m);
 55:   /* y2 = -(K*x1 + C*x2) */
 56:   MatMult(ctx->K,ctx->x1,ctx->y2);
 57:   VecScale(ctx->y2,-1.0);
 58:   MatMult(ctx->C,ctx->x2,ctx->y1);
 59:   VecAXPY(ctx->y2,-ctx->sfactor,ctx->y1);
 60:   /* y1 = -K*x2 */
 61:   MatMult(ctx->K,ctx->x2,ctx->y1);
 62:   VecScale(ctx->y1,-1.0);
 63:   VecResetArray(ctx->x1);
 64:   VecResetArray(ctx->x2);
 65:   VecResetArray(ctx->y1);
 66:   VecResetArray(ctx->y2);
 67:   VecRestoreArrayRead(x,&px);
 68:   VecRestoreArray(y,&py);
 69:   return(0);
 70: }

 74: PetscErrorCode MatMult_Linear_S1B(Mat B,Vec x,Vec y)
 75: {
 76:   PetscErrorCode    ierr;
 77:   QEP_LINEAR        *ctx;
 78:   const PetscScalar *px;
 79:   PetscScalar       *py;
 80:   PetscInt          m;

 83:   MatShellGetContext(B,(void**)&ctx);
 84:   MatGetLocalSize(ctx->M,&m,NULL);
 85:   VecGetArrayRead(x,&px);
 86:   VecGetArray(y,&py);
 87:   VecPlaceArray(ctx->x1,px);
 88:   VecPlaceArray(ctx->x2,px+m);
 89:   VecPlaceArray(ctx->y1,py);
 90:   VecPlaceArray(ctx->y2,py+m);
 91:   /* y1 = -K*x1 */
 92:   MatMult(ctx->K,ctx->x1,ctx->y1);
 93:   VecScale(ctx->y1,-1.0);
 94:   /* y2 = M*x2 */
 95:   MatMult(ctx->M,ctx->x2,ctx->y2);
 96:   VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);
 97:   VecResetArray(ctx->x1);
 98:   VecResetArray(ctx->x2);
 99:   VecResetArray(ctx->y1);
100:   VecResetArray(ctx->y2);
101:   VecRestoreArrayRead(x,&px);
102:   VecRestoreArray(y,&py);
103:   return(0);
104: }

108: PetscErrorCode MatGetDiagonal_Linear_S1A(Mat A,Vec diag)
109: {
111:   QEP_LINEAR     *ctx;
112:   PetscScalar    *pd;
113:   PetscInt       m;

116:   MatShellGetContext(A,(void**)&ctx);
117:   MatGetLocalSize(ctx->M,&m,NULL);
118:   VecGetArray(diag,&pd);
119:   VecPlaceArray(ctx->x1,pd);
120:   VecPlaceArray(ctx->x2,pd+m);
121:   VecSet(ctx->x1,0.0);
122:   MatGetDiagonal(ctx->C,ctx->x2);
123:   VecScale(ctx->x2,-ctx->sfactor);
124:   VecResetArray(ctx->x1);
125:   VecResetArray(ctx->x2);
126:   VecRestoreArray(diag,&pd);
127:   return(0);
128: }

132: PetscErrorCode MatGetDiagonal_Linear_S1B(Mat B,Vec diag)
133: {
135:   QEP_LINEAR     *ctx;
136:   PetscScalar    *pd;
137:   PetscInt       m;

140:   MatShellGetContext(B,(void**)&ctx);
141:   MatGetLocalSize(ctx->M,&m,NULL);
142:   VecGetArray(diag,&pd);
143:   VecPlaceArray(ctx->x1,pd);
144:   VecPlaceArray(ctx->x2,pd+m);
145:   MatGetDiagonal(ctx->K,ctx->x1);
146:   VecScale(ctx->x1,-1.0);
147:   MatGetDiagonal(ctx->M,ctx->x2);
148:   VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);
149:   VecResetArray(ctx->x1);
150:   VecResetArray(ctx->x2);
151:   VecRestoreArray(diag,&pd);
152:   return(0);
153: }

157: PetscErrorCode MatCreateExplicit_Linear_S1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
158: {

162:   SlepcMatTile(0.0,ctx->K,-1.0,ctx->K,-1.0,ctx->K,-ctx->sfactor,ctx->C,A);
163:   return(0);
164: }

168: PetscErrorCode MatCreateExplicit_Linear_S1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
169: {

173:   SlepcMatTile(-1.0,ctx->K,0.0,ctx->M,0.0,ctx->M,ctx->sfactor*ctx->sfactor,ctx->M,B);
174:   return(0);
175: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_n2.c.html0000644000175000017500000002610112211062077022403 0ustar gladkgladk
Actual source code: qeplin_n2.c

  1: /*

  3:    Linearization for general QEP, companion form 2.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26:  #include linearp.h

 28: /*
 29:     Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
 30:     linearization is employed:

 32:       A*z = l*B*z   where   A = [ -K   0 ]     B = [ C  M ]     z = [  x  ]
 33:                                 [  0   I ]         [ I  0 ]         [ l*x ]
 34:  */

 38: PetscErrorCode MatMult_Linear_N2A(Mat A,Vec x,Vec y)
 39: {
 40:   PetscErrorCode    ierr;
 41:   QEP_LINEAR        *ctx;
 42:   const PetscScalar *px;
 43:   PetscScalar       *py;
 44:   PetscInt          m;

 47:   MatShellGetContext(A,(void**)&ctx);
 48:   MatGetLocalSize(ctx->M,&m,NULL);
 49:   VecGetArrayRead(x,&px);
 50:   VecGetArray(y,&py);
 51:   VecPlaceArray(ctx->x1,px);
 52:   VecPlaceArray(ctx->x2,px+m);
 53:   VecPlaceArray(ctx->y1,py);
 54:   VecPlaceArray(ctx->y2,py+m);
 55:   /* y1 = -K*x1 */
 56:   MatMult(ctx->K,ctx->x1,ctx->y1);
 57:   VecScale(ctx->y1,-1.0);
 58:   /* y2 = x2 */
 59:   VecCopy(ctx->x2,ctx->y2);
 60:   VecResetArray(ctx->x1);
 61:   VecResetArray(ctx->x2);
 62:   VecResetArray(ctx->y1);
 63:   VecResetArray(ctx->y2);
 64:   VecRestoreArrayRead(x,&px);
 65:   VecRestoreArray(y,&py);
 66:   return(0);
 67: }

 71: PetscErrorCode MatMult_Linear_N2B(Mat B,Vec x,Vec y)
 72: {
 73:   PetscErrorCode    ierr;
 74:   QEP_LINEAR        *ctx;
 75:   const PetscScalar *px;
 76:   PetscScalar       *py;
 77:   PetscInt          m;

 80:   MatShellGetContext(B,(void**)&ctx);
 81:   MatGetLocalSize(ctx->M,&m,NULL);
 82:   VecGetArrayRead(x,&px);
 83:   VecGetArray(y,&py);
 84:   VecPlaceArray(ctx->x1,px);
 85:   VecPlaceArray(ctx->x2,px+m);
 86:   VecPlaceArray(ctx->y1,py);
 87:   VecPlaceArray(ctx->y2,py+m);
 88:   /* y1 = C*x1 + M*x2 */
 89:   MatMult(ctx->C,ctx->x1,ctx->y1);
 90:   VecScale(ctx->y1,ctx->sfactor);
 91:   MatMult(ctx->M,ctx->x2,ctx->y2);
 92:   VecAXPY(ctx->y1,ctx->sfactor*ctx->sfactor,ctx->y2);
 93:   /* y2 = x1 */
 94:   VecCopy(ctx->x1,ctx->y2);
 95:   VecResetArray(ctx->x1);
 96:   VecResetArray(ctx->x2);
 97:   VecResetArray(ctx->y1);
 98:   VecResetArray(ctx->y2);
 99:   VecRestoreArrayRead(x,&px);
100:   VecRestoreArray(y,&py);
101:   return(0);
102: }

106: PetscErrorCode MatGetDiagonal_Linear_N2A(Mat A,Vec diag)
107: {
109:   QEP_LINEAR     *ctx;
110:   PetscScalar    *pd;
111:   PetscInt       m;

114:   MatShellGetContext(A,(void**)&ctx);
115:   MatGetLocalSize(ctx->M,&m,NULL);
116:   VecGetArray(diag,&pd);
117:   VecPlaceArray(ctx->x1,pd);
118:   VecPlaceArray(ctx->x2,pd+m);
119:   MatGetDiagonal(ctx->K,ctx->x1);
120:   VecScale(ctx->x1,-1.0);
121:   VecSet(ctx->x2,1.0);
122:   VecResetArray(ctx->x1);
123:   VecResetArray(ctx->x2);
124:   VecRestoreArray(diag,&pd);
125:   return(0);
126: }

130: PetscErrorCode MatGetDiagonal_Linear_N2B(Mat B,Vec diag)
131: {
133:   QEP_LINEAR     *ctx;
134:   PetscScalar    *pd;
135:   PetscInt       m;

138:   MatShellGetContext(B,(void**)&ctx);
139:   MatGetLocalSize(ctx->M,&m,NULL);
140:   VecGetArray(diag,&pd);
141:   VecPlaceArray(ctx->x1,pd);
142:   VecPlaceArray(ctx->x2,pd+m);
143:   MatGetDiagonal(ctx->C,ctx->x1);
144:   VecScale(ctx->x1,ctx->sfactor);
145:   VecSet(ctx->x2,0.0);
146:   VecResetArray(ctx->x1);
147:   VecResetArray(ctx->x2);
148:   VecRestoreArray(diag,&pd);
149:   return(0);
150: }

154: PetscErrorCode MatCreateExplicit_Linear_N2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
155: {
157:   PetscInt       M,N,m,n;
158:   Mat            Id;

161:   MatGetSize(ctx->M,&M,&N);
162:   MatGetLocalSize(ctx->M,&m,&n);
163:   MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);
164:   MatSetSizes(Id,m,n,M,N);
165:   MatSetFromOptions(Id);
166:   MatSetUp(Id);
167:   MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);
168:   MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);
169:   MatShift(Id,1.0);
170:   SlepcMatTile(-1.0,ctx->K,0.0,Id,0.0,Id,1.0,Id,A);
171:   MatDestroy(&Id);
172:   return(0);
173: }

177: PetscErrorCode MatCreateExplicit_Linear_N2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
178: {
180:   PetscInt       M,N,m,n;
181:   Mat            Id;

184:   MatGetSize(ctx->M,&M,&N);
185:   MatGetLocalSize(ctx->M,&m,&n);
186:   MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);
187:   MatSetSizes(Id,m,n,M,N);
188:   MatSetFromOptions(Id);
189:   MatSetUp(Id);
190:   MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);
191:   MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);
192:   MatShift(Id,1.0);
193:   SlepcMatTile(ctx->sfactor,ctx->C,ctx->sfactor*ctx->sfactor,ctx->M,1.0,Id,0.0,Id,B);
194:   MatDestroy(&Id);
195:   return(0);
196: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_s2.c.html0000644000175000017500000002405712211062077022420 0ustar gladkgladk
Actual source code: qeplin_s2.c

  1: /*

  3:    Linearization for Hermitian QEP, companion form 2.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26:  #include linearp.h

 28: /*
 29:     Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
 30:     linearization is employed:

 32:       A*z = l*B*z   where   A = [ -K   0 ]     B = [ C  M ]     z = [  x  ]
 33:                                 [  0   M ]         [ M  0 ]         [ l*x ]
 34:  */

 38: PetscErrorCode MatMult_Linear_S2A(Mat A,Vec x,Vec y)
 39: {
 40:   PetscErrorCode    ierr;
 41:   QEP_LINEAR        *ctx;
 42:   const PetscScalar *px;
 43:   PetscScalar       *py;
 44:   PetscInt          m;

 47:   MatShellGetContext(A,(void**)&ctx);
 48:   MatGetLocalSize(ctx->M,&m,NULL);
 49:   VecGetArrayRead(x,&px);
 50:   VecGetArray(y,&py);
 51:   VecPlaceArray(ctx->x1,px);
 52:   VecPlaceArray(ctx->x2,px+m);
 53:   VecPlaceArray(ctx->y1,py);
 54:   VecPlaceArray(ctx->y2,py+m);
 55:   /* y1 = -K*x1 */
 56:   MatMult(ctx->K,ctx->x1,ctx->y1);
 57:   VecScale(ctx->y1,-1.0);
 58:   /* y2 = M*x2 */
 59:   MatMult(ctx->M,ctx->x2,ctx->y2);
 60:   VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);
 61:   VecResetArray(ctx->x1);
 62:   VecResetArray(ctx->x2);
 63:   VecResetArray(ctx->y1);
 64:   VecResetArray(ctx->y2);
 65:   VecRestoreArrayRead(x,&px);
 66:   VecRestoreArray(y,&py);
 67:   return(0);
 68: }

 72: PetscErrorCode MatMult_Linear_S2B(Mat B,Vec x,Vec y)
 73: {
 74:   PetscErrorCode    ierr;
 75:   QEP_LINEAR        *ctx;
 76:   const PetscScalar *px;
 77:   PetscScalar       *py;
 78:   PetscInt          m;

 81:   MatShellGetContext(B,(void**)&ctx);
 82:   MatGetLocalSize(ctx->M,&m,NULL);
 83:   VecGetArrayRead(x,&px);
 84:   VecGetArray(y,&py);
 85:   VecPlaceArray(ctx->x1,px);
 86:   VecPlaceArray(ctx->x2,px+m);
 87:   VecPlaceArray(ctx->y1,py);
 88:   VecPlaceArray(ctx->y2,py+m);
 89:   /* y1 = C*x1 + M*x2 */
 90:   MatMult(ctx->C,ctx->x1,ctx->y1);
 91:   VecScale(ctx->y1,ctx->sfactor);
 92:   MatMult(ctx->M,ctx->x2,ctx->y2);
 93:   VecAXPY(ctx->y1,ctx->sfactor*ctx->sfactor,ctx->y2);
 94:   /* y2 = M*x1 */
 95:   MatMult(ctx->M,ctx->x1,ctx->y2);
 96:   VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);
 97:   VecResetArray(ctx->x1);
 98:   VecResetArray(ctx->x2);
 99:   VecResetArray(ctx->y1);
100:   VecResetArray(ctx->y2);
101:   VecRestoreArrayRead(x,&px);
102:   VecRestoreArray(y,&py);
103:   return(0);
104: }

108: PetscErrorCode MatGetDiagonal_Linear_S2A(Mat A,Vec diag)
109: {
111:   QEP_LINEAR     *ctx;
112:   PetscScalar    *pd;
113:   PetscInt       m;

116:   MatShellGetContext(A,(void**)&ctx);
117:   MatGetLocalSize(ctx->M,&m,NULL);
118:   VecGetArray(diag,&pd);
119:   VecPlaceArray(ctx->x1,pd);
120:   VecPlaceArray(ctx->x2,pd+m);
121:   MatGetDiagonal(ctx->K,ctx->x1);
122:   VecScale(ctx->x1,-1.0);
123:   MatGetDiagonal(ctx->M,ctx->x2);
124:   VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);
125:   VecResetArray(ctx->x1);
126:   VecResetArray(ctx->x2);
127:   VecRestoreArray(diag,&pd);
128:   return(0);
129: }

133: PetscErrorCode MatGetDiagonal_Linear_S2B(Mat B,Vec diag)
134: {
136:   QEP_LINEAR     *ctx;
137:   PetscScalar    *pd;
138:   PetscInt       m;

141:   MatShellGetContext(B,(void**)&ctx);
142:   MatGetLocalSize(ctx->M,&m,NULL);
143:   VecGetArray(diag,&pd);
144:   VecPlaceArray(ctx->x1,pd);
145:   VecPlaceArray(ctx->x2,pd+m);
146:   MatGetDiagonal(ctx->C,ctx->x1);
147:   VecScale(ctx->x1,ctx->sfactor);
148:   VecSet(ctx->x2,0.0);
149:   VecResetArray(ctx->x1);
150:   VecResetArray(ctx->x2);
151:   VecRestoreArray(diag,&pd);
152:   return(0);
153: }

157: PetscErrorCode MatCreateExplicit_Linear_S2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
158: {

162:   SlepcMatTile(-1.0,ctx->K,0.0,ctx->M,0.0,ctx->M,ctx->sfactor*ctx->sfactor,ctx->M,A);
163:   return(0);
164: }

168: PetscErrorCode MatCreateExplicit_Linear_S2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
169: {

173:   SlepcMatTile(ctx->sfactor,ctx->C,ctx->sfactor*ctx->sfactor,ctx->M,ctx->sfactor*ctx->sfactor,ctx->M,0.0,ctx->M,B);
174:   return(0);
175: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/linear.c0000644000175000017500000006542612211062077021040 0ustar gladkgladk/* Straightforward linearization for quadratic eigenproblems. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include /*I "slepceps.h" I*/ #include "linearp.h" #undef __FUNCT__ #define __FUNCT__ "QEPSetUp_Linear" PetscErrorCode QEPSetUp_Linear(QEP qep) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscInt i=0; EPSWhich which; PetscBool trackall; PetscScalar sigma; /* function tables */ PetscErrorCode (*fcreate[][2])(MPI_Comm,QEP_LINEAR*,Mat*) = { { MatCreateExplicit_Linear_N1A, MatCreateExplicit_Linear_N1B }, /* N1 */ { MatCreateExplicit_Linear_N2A, MatCreateExplicit_Linear_N2B }, /* N2 */ { MatCreateExplicit_Linear_S1A, MatCreateExplicit_Linear_S1B }, /* S1 */ { MatCreateExplicit_Linear_S2A, MatCreateExplicit_Linear_S2B }, /* S2 */ { MatCreateExplicit_Linear_H1A, MatCreateExplicit_Linear_H1B }, /* H1 */ { MatCreateExplicit_Linear_H2A, MatCreateExplicit_Linear_H2B } /* H2 */ }; PetscErrorCode (*fmult[][2])(Mat,Vec,Vec) = { { MatMult_Linear_N1A, MatMult_Linear_N1B }, { MatMult_Linear_N2A, MatMult_Linear_N2B }, { MatMult_Linear_S1A, MatMult_Linear_S1B }, { MatMult_Linear_S2A, MatMult_Linear_S2B }, { MatMult_Linear_H1A, MatMult_Linear_H1B }, { MatMult_Linear_H2A, MatMult_Linear_H2B } }; PetscErrorCode (*fgetdiagonal[][2])(Mat,Vec) = { { MatGetDiagonal_Linear_N1A, MatGetDiagonal_Linear_N1B }, { MatGetDiagonal_Linear_N2A, MatGetDiagonal_Linear_N2B }, { MatGetDiagonal_Linear_S1A, MatGetDiagonal_Linear_S1B }, { MatGetDiagonal_Linear_S2A, MatGetDiagonal_Linear_S2B }, { MatGetDiagonal_Linear_H1A, MatGetDiagonal_Linear_H1B }, { MatGetDiagonal_Linear_H2A, MatGetDiagonal_Linear_H2B } }; PetscFunctionBegin; if (!ctx->cform) ctx->cform = 1; if (!qep->which) qep->which = QEP_LARGEST_MAGNITUDE; ctx->M = qep->M; ctx->C = qep->C; ctx->K = qep->K; ctx->sfactor = qep->sfactor; ierr = MatDestroy(&ctx->A);CHKERRQ(ierr); ierr = MatDestroy(&ctx->B);CHKERRQ(ierr); ierr = VecDestroy(&ctx->x1);CHKERRQ(ierr); ierr = VecDestroy(&ctx->x2);CHKERRQ(ierr); ierr = VecDestroy(&ctx->y1);CHKERRQ(ierr); ierr = VecDestroy(&ctx->y2);CHKERRQ(ierr); switch (qep->problem_type) { case QEP_GENERAL: i = 0; break; case QEP_HERMITIAN: i = 2; break; case QEP_GYROSCOPIC: i = 4; break; default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of qep->problem_type"); } i += ctx->cform-1; if (ctx->explicitmatrix) { ctx->x1 = ctx->x2 = ctx->y1 = ctx->y2 = NULL; ierr = (*fcreate[i][0])(PetscObjectComm((PetscObject)qep),ctx,&ctx->A);CHKERRQ(ierr); ierr = (*fcreate[i][1])(PetscObjectComm((PetscObject)qep),ctx,&ctx->B);CHKERRQ(ierr); } else { ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->x1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->x2);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->y1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->y2);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,ctx->x1);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,ctx->x2);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,ctx->y1);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,ctx->y2);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)qep),2*qep->nloc,2*qep->nloc,2*qep->n,2*qep->n,ctx,&ctx->A);CHKERRQ(ierr); ierr = MatShellSetOperation(ctx->A,MATOP_MULT,(void(*)(void))fmult[i][0]);CHKERRQ(ierr); ierr = MatShellSetOperation(ctx->A,MATOP_GET_DIAGONAL,(void(*)(void))fgetdiagonal[i][0]);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)qep),2*qep->nloc,2*qep->nloc,2*qep->n,2*qep->n,ctx,&ctx->B);CHKERRQ(ierr); ierr = MatShellSetOperation(ctx->B,MATOP_MULT,(void(*)(void))fmult[i][1]);CHKERRQ(ierr); ierr = MatShellSetOperation(ctx->B,MATOP_GET_DIAGONAL,(void(*)(void))fgetdiagonal[i][1]);CHKERRQ(ierr); } ierr = PetscLogObjectParent(qep,ctx->A);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,ctx->B);CHKERRQ(ierr); if (!ctx->eps) { ierr = QEPLinearGetEPS(qep,&ctx->eps);CHKERRQ(ierr); } ierr = EPSSetOperators(ctx->eps,ctx->A,ctx->B);CHKERRQ(ierr); if (qep->problem_type==QEP_HERMITIAN) { ierr = EPSSetProblemType(ctx->eps,EPS_GHIEP);CHKERRQ(ierr); } else { ierr = EPSSetProblemType(ctx->eps,EPS_GNHEP);CHKERRQ(ierr); } switch (qep->which) { case QEP_LARGEST_MAGNITUDE: which = EPS_LARGEST_MAGNITUDE; break; case QEP_SMALLEST_MAGNITUDE: which = EPS_SMALLEST_MAGNITUDE; break; case QEP_LARGEST_REAL: which = EPS_LARGEST_REAL; break; case QEP_SMALLEST_REAL: which = EPS_SMALLEST_REAL; break; case QEP_LARGEST_IMAGINARY: which = EPS_LARGEST_IMAGINARY; break; case QEP_SMALLEST_IMAGINARY: which = EPS_SMALLEST_IMAGINARY; break; default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of which"); } ierr = EPSSetWhichEigenpairs(ctx->eps,which);CHKERRQ(ierr); ierr = EPSSetLeftVectorsWanted(ctx->eps,qep->leftvecs);CHKERRQ(ierr); ierr = EPSSetDimensions(ctx->eps,qep->nev,qep->ncv,qep->mpd);CHKERRQ(ierr); ierr = EPSSetTolerances(ctx->eps,qep->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL/10.0:qep->tol/10.0,qep->max_it);CHKERRQ(ierr); /* Transfer the trackall option from qep to eps */ ierr = QEPGetTrackAll(qep,&trackall);CHKERRQ(ierr); ierr = EPSSetTrackAll(ctx->eps,trackall);CHKERRQ(ierr); if (ctx->setfromoptionscalled) { ierr = EPSSetFromOptions(ctx->eps);CHKERRQ(ierr); ctx->setfromoptionscalled = PETSC_FALSE; } /* temporary change of target */ if (qep->sfactor!=1.0) { ierr = EPSGetTarget(ctx->eps,&sigma);CHKERRQ(ierr); ierr = EPSSetTarget(ctx->eps,sigma/qep->sfactor);CHKERRQ(ierr); } ierr = EPSSetUp(ctx->eps);CHKERRQ(ierr); ierr = EPSGetDimensions(ctx->eps,NULL,&qep->ncv,&qep->mpd);CHKERRQ(ierr); ierr = EPSGetTolerances(ctx->eps,NULL,&qep->max_it);CHKERRQ(ierr); if (qep->nini>0 || qep->ninil>0) { ierr = PetscInfo(qep,"Ignoring initial vectors\n");CHKERRQ(ierr); } ierr = QEPAllocateSolution(qep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSelect_Norm" /* QEPLinearSelect_Norm - Auxiliary routine that copies the solution of the linear eigenproblem to the QEP object. The eigenvector of the generalized problem is supposed to be z = [ x ] [ l*x ] The eigenvector is taken from z(1:n) or z(n+1:2*n) depending on the explicitly computed residual norm. Finally, x is normalized so that ||x||_2 = 1. */ static PetscErrorCode QEPLinearSelect_Norm(QEP qep,EPS eps) { PetscErrorCode ierr; PetscInt i; PetscScalar *px; PetscReal rn1,rn2; Vec xr,xi,wr,wi; Mat A; #if !defined(PETSC_USE_COMPLEX) PetscScalar *py; #endif PetscFunctionBegin; ierr = EPSGetOperators(eps,&A,NULL);CHKERRQ(ierr); ierr = MatGetVecs(A,&xr,NULL);CHKERRQ(ierr); ierr = VecDuplicate(xr,&xi);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&wr);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&wi);CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);CHKERRQ(ierr); qep->eigr[i] *= qep->sfactor; qep->eigi[i] *= qep->sfactor; #if !defined(PETSC_USE_COMPLEX) if (qep->eigi[i]>0.0) { /* first eigenvalue of a complex conjugate pair */ ierr = VecGetArray(xr,&px);CHKERRQ(ierr); ierr = VecGetArray(xi,&py);CHKERRQ(ierr); ierr = VecPlaceArray(wr,px);CHKERRQ(ierr); ierr = VecPlaceArray(wi,py);CHKERRQ(ierr); ierr = SlepcVecNormalize(wr,wi,PETSC_TRUE,NULL);CHKERRQ(ierr); ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn1);CHKERRQ(ierr); ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr); ierr = VecCopy(wi,qep->V[i+1]);CHKERRQ(ierr); ierr = VecResetArray(wr);CHKERRQ(ierr); ierr = VecResetArray(wi);CHKERRQ(ierr); ierr = VecPlaceArray(wr,px+qep->nloc);CHKERRQ(ierr); ierr = VecPlaceArray(wi,py+qep->nloc);CHKERRQ(ierr); ierr = SlepcVecNormalize(wr,wi,PETSC_TRUE,NULL);CHKERRQ(ierr); ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn2);CHKERRQ(ierr); if (rn1>rn2) { ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr); ierr = VecCopy(wi,qep->V[i+1]);CHKERRQ(ierr); } ierr = VecResetArray(wr);CHKERRQ(ierr); ierr = VecResetArray(wi);CHKERRQ(ierr); ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr); ierr = VecRestoreArray(xi,&py);CHKERRQ(ierr); } else if (qep->eigi[i]==0.0) /* real eigenvalue */ #endif { ierr = VecGetArray(xr,&px);CHKERRQ(ierr); ierr = VecPlaceArray(wr,px);CHKERRQ(ierr); ierr = SlepcVecNormalize(wr,NULL,PETSC_FALSE,NULL);CHKERRQ(ierr); ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,NULL,&rn1);CHKERRQ(ierr); ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr); ierr = VecResetArray(wr);CHKERRQ(ierr); ierr = VecPlaceArray(wr,px+qep->nloc);CHKERRQ(ierr); ierr = SlepcVecNormalize(wr,NULL,PETSC_FALSE,NULL);CHKERRQ(ierr); ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,NULL,&rn2);CHKERRQ(ierr); if (rn1>rn2) { ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr); } ierr = VecResetArray(wr);CHKERRQ(ierr); ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr); } } ierr = VecDestroy(&wr);CHKERRQ(ierr); ierr = VecDestroy(&wi);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSelect_Simple" /* QEPLinearSelect_Simple - Auxiliary routine that copies the solution of the linear eigenproblem to the QEP object. The eigenvector of the generalized problem is supposed to be z = [ x ] [ l*x ] If |l|<1.0, the eigenvector is taken from z(1:n), otherwise from z(n+1:2*n). Finally, x is normalized so that ||x||_2 = 1. */ static PetscErrorCode QEPLinearSelect_Simple(QEP qep,EPS eps) { PetscErrorCode ierr; PetscInt i,offset; PetscScalar *px; Vec xr,xi,w; Mat A; PetscFunctionBegin; ierr = EPSGetOperators(eps,&A,NULL);CHKERRQ(ierr); ierr = MatGetVecs(A,&xr,NULL);CHKERRQ(ierr); ierr = VecDuplicate(xr,&xi);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&w);CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);CHKERRQ(ierr); qep->eigr[i] *= qep->sfactor; qep->eigi[i] *= qep->sfactor; if (SlepcAbsEigenvalue(qep->eigr[i],qep->eigi[i])>1.0) offset = qep->nloc; else offset = 0; #if !defined(PETSC_USE_COMPLEX) if (qep->eigi[i]>0.0) { /* first eigenvalue of a complex conjugate pair */ ierr = VecGetArray(xr,&px);CHKERRQ(ierr); ierr = VecPlaceArray(w,px+offset);CHKERRQ(ierr); ierr = VecCopy(w,qep->V[i]);CHKERRQ(ierr); ierr = VecResetArray(w);CHKERRQ(ierr); ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr); ierr = VecGetArray(xi,&px);CHKERRQ(ierr); ierr = VecPlaceArray(w,px+offset);CHKERRQ(ierr); ierr = VecCopy(w,qep->V[i+1]);CHKERRQ(ierr); ierr = VecResetArray(w);CHKERRQ(ierr); ierr = VecRestoreArray(xi,&px);CHKERRQ(ierr); ierr = SlepcVecNormalize(qep->V[i],qep->V[i+1],PETSC_TRUE,NULL);CHKERRQ(ierr); } else if (qep->eigi[i]==0.0) /* real eigenvalue */ #endif { ierr = VecGetArray(xr,&px);CHKERRQ(ierr); ierr = VecPlaceArray(w,px+offset);CHKERRQ(ierr); ierr = VecCopy(w,qep->V[i]);CHKERRQ(ierr); ierr = VecResetArray(w);CHKERRQ(ierr); ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr); ierr = SlepcVecNormalize(qep->V[i],NULL,PETSC_FALSE,NULL);CHKERRQ(ierr); } } ierr = VecDestroy(&w);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSolve_Linear" PetscErrorCode QEPSolve_Linear(QEP qep) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscBool flg=PETSC_FALSE; PetscScalar sigma; PetscFunctionBegin; ierr = EPSSolve(ctx->eps);CHKERRQ(ierr); ierr = EPSGetConverged(ctx->eps,&qep->nconv);CHKERRQ(ierr); ierr = EPSGetIterationNumber(ctx->eps,&qep->its);CHKERRQ(ierr); ierr = EPSGetConvergedReason(ctx->eps,(EPSConvergedReason*)&qep->reason);CHKERRQ(ierr); ierr = EPSGetOperationCounters(ctx->eps,&qep->matvecs,NULL,&qep->linits);CHKERRQ(ierr); /* restore target */ ierr = EPSGetTarget(ctx->eps,&sigma);CHKERRQ(ierr); ierr = EPSSetTarget(ctx->eps,sigma*qep->sfactor);CHKERRQ(ierr); qep->matvecs *= 2; /* convention: count one matvec for each non-trivial block in A */ ierr = PetscOptionsGetBool(((PetscObject)qep)->prefix,"-qep_linear_select_simple",&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = QEPLinearSelect_Simple(qep,ctx->eps);CHKERRQ(ierr); } else { ierr = QEPLinearSelect_Norm(qep,ctx->eps);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "EPSMonitor_Linear" static PetscErrorCode EPSMonitor_Linear(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx) { PetscInt i; QEP qep = (QEP)ctx; PetscErrorCode ierr; PetscFunctionBegin; nconv = 0; for (i=0;incv);i++) { qep->eigr[i] = eigr[i]; qep->eigi[i] = eigi[i]; qep->errest[i] = errest[i]; if (0.0 < errest[i] && errest[i] < qep->tol) nconv++; } ierr = STBackTransform(eps->st,nest,qep->eigr,qep->eigi);CHKERRQ(ierr); ierr = QEPMonitor(qep,its,nconv,qep->eigr,qep->eigi,qep->errest,nest);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetFromOptions_Linear" PetscErrorCode QEPSetFromOptions_Linear(QEP qep) { PetscErrorCode ierr; PetscBool set,val; PetscInt i; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; ST st; PetscFunctionBegin; ctx->setfromoptionscalled = PETSC_TRUE; ierr = PetscOptionsHead("QEP Linear Options");CHKERRQ(ierr); ierr = PetscOptionsInt("-qep_linear_cform","Number of the companion form","QEPLinearSetCompanionForm",ctx->cform,&i,&set);CHKERRQ(ierr); if (set) { ierr = QEPLinearSetCompanionForm(qep,i);CHKERRQ(ierr); } ierr = PetscOptionsBool("-qep_linear_explicitmatrix","Use explicit matrix in linearization","QEPLinearSetExplicitMatrix",ctx->explicitmatrix,&val,&set);CHKERRQ(ierr); if (set) { ierr = QEPLinearSetExplicitMatrix(qep,val);CHKERRQ(ierr); } if (!ctx->explicitmatrix) { /* use as default an ST with shell matrix and Jacobi */ if (!ctx->eps) { ierr = QEPLinearGetEPS(qep,&ctx->eps);CHKERRQ(ierr); } ierr = EPSGetST(ctx->eps,&st);CHKERRQ(ierr); ierr = STSetMatMode(st,ST_MATMODE_SHELL);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSetCompanionForm_Linear" static PetscErrorCode QEPLinearSetCompanionForm_Linear(QEP qep,PetscInt cform) { QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; if (!cform) PetscFunctionReturn(0); if (cform==PETSC_DECIDE || cform==PETSC_DEFAULT) ctx->cform = 1; else { if (cform!=1 && cform!=2) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Invalid value of argument 'cform'"); ctx->cform = cform; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSetCompanionForm" /*@ QEPLinearSetCompanionForm - Choose between the two companion forms available for the linearization of the quadratic problem. Logically Collective on QEP Input Parameters: + qep - quadratic eigenvalue solver - cform - 1 or 2 (first or second companion form) Options Database Key: . -qep_linear_cform - Choose the companion form Level: advanced .seealso: QEPLinearGetCompanionForm() @*/ PetscErrorCode QEPLinearSetCompanionForm(QEP qep,PetscInt cform) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,cform,2); ierr = PetscTryMethod(qep,"QEPLinearSetCompanionForm_C",(QEP,PetscInt),(qep,cform));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearGetCompanionForm_Linear" static PetscErrorCode QEPLinearGetCompanionForm_Linear(QEP qep,PetscInt *cform) { QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; *cform = ctx->cform; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearGetCompanionForm" /*@ QEPLinearGetCompanionForm - Returns the number of the companion form that will be used for the linearization of the quadratic problem. Not Collective Input Parameter: . qep - quadratic eigenvalue solver Output Parameter: . cform - the companion form number (1 or 2) Level: advanced .seealso: QEPLinearSetCompanionForm() @*/ PetscErrorCode QEPLinearGetCompanionForm(QEP qep,PetscInt *cform) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidIntPointer(cform,2); ierr = PetscTryMethod(qep,"QEPLinearGetCompanionForm_C",(QEP,PetscInt*),(qep,cform));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSetExplicitMatrix_Linear" static PetscErrorCode QEPLinearSetExplicitMatrix_Linear(QEP qep,PetscBool explicitmatrix) { QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; ctx->explicitmatrix = explicitmatrix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSetExplicitMatrix" /*@ QEPLinearSetExplicitMatrix - Indicate if the matrices A and B for the linearization of the quadratic problem must be built explicitly. Logically Collective on QEP Input Parameters: + qep - quadratic eigenvalue solver - explicit - boolean flag indicating if the matrices are built explicitly Options Database Key: . -qep_linear_explicitmatrix - Indicates the boolean flag Level: advanced .seealso: QEPLinearGetExplicitMatrix() @*/ PetscErrorCode QEPLinearSetExplicitMatrix(QEP qep,PetscBool explicitmatrix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveBool(qep,explicitmatrix,2); ierr = PetscTryMethod(qep,"QEPLinearSetExplicitMatrix_C",(QEP,PetscBool),(qep,explicitmatrix));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearGetExplicitMatrix_Linear" static PetscErrorCode QEPLinearGetExplicitMatrix_Linear(QEP qep,PetscBool *explicitmatrix) { QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; *explicitmatrix = ctx->explicitmatrix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearGetExplicitMatrix" /*@ QEPLinearGetExplicitMatrix - Returns the flag indicating if the matrices A and B for the linearization of the quadratic problem are built explicitly. Not Collective Input Parameter: . qep - quadratic eigenvalue solver Output Parameter: . explicitmatrix - the mode flag Level: advanced .seealso: QEPLinearSetExplicitMatrix() @*/ PetscErrorCode QEPLinearGetExplicitMatrix(QEP qep,PetscBool *explicitmatrix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(explicitmatrix,2); ierr = PetscTryMethod(qep,"QEPLinearGetExplicitMatrix_C",(QEP,PetscBool*),(qep,explicitmatrix));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSetEPS_Linear" static PetscErrorCode QEPLinearSetEPS_Linear(QEP qep,EPS eps) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; ierr = PetscObjectReference((PetscObject)eps);CHKERRQ(ierr); ierr = EPSDestroy(&ctx->eps);CHKERRQ(ierr); ctx->eps = eps; ierr = PetscLogObjectParent(qep,ctx->eps);CHKERRQ(ierr); qep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearSetEPS" /*@ QEPLinearSetEPS - Associate an eigensolver object (EPS) to the quadratic eigenvalue solver. Collective on QEP Input Parameters: + qep - quadratic eigenvalue solver - eps - the eigensolver object Level: advanced .seealso: QEPLinearGetEPS() @*/ PetscErrorCode QEPLinearSetEPS(QEP qep,EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidHeaderSpecific(eps,EPS_CLASSID,2); PetscCheckSameComm(qep,1,eps,2); ierr = PetscTryMethod(qep,"QEPLinearSetEPS_C",(QEP,EPS),(qep,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearGetEPS_Linear" static PetscErrorCode QEPLinearGetEPS_Linear(QEP qep,EPS *eps) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; if (!ctx->eps) { ierr = EPSCreate(PetscObjectComm((PetscObject)qep),&ctx->eps);CHKERRQ(ierr); ierr = EPSSetOptionsPrefix(ctx->eps,((PetscObject)qep)->prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(ctx->eps,"qep_");CHKERRQ(ierr); ierr = STSetOptionsPrefix(ctx->eps->st,((PetscObject)ctx->eps)->prefix);CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)ctx->eps,(PetscObject)qep,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,ctx->eps);CHKERRQ(ierr); if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } ierr = EPSSetIP(ctx->eps,qep->ip);CHKERRQ(ierr); ierr = EPSMonitorSet(ctx->eps,EPSMonitor_Linear,qep,NULL);CHKERRQ(ierr); } *eps = ctx->eps; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPLinearGetEPS" /*@ QEPLinearGetEPS - Retrieve the eigensolver object (EPS) associated to the quadratic eigenvalue solver. Not Collective Input Parameter: . qep - quadratic eigenvalue solver Output Parameter: . eps - the eigensolver object Level: advanced .seealso: QEPLinearSetEPS() @*/ PetscErrorCode QEPLinearGetEPS(QEP qep,EPS *eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(eps,2); ierr = PetscTryMethod(qep,"QEPLinearGetEPS_C",(QEP,EPS*),(qep,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPView_Linear" PetscErrorCode QEPView_Linear(QEP qep,PetscViewer viewer) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; if (!ctx->eps) { ierr = QEPLinearGetEPS(qep,&ctx->eps);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," Linear: %s matrices\n",ctx->explicitmatrix? "explicit": "implicit");CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Linear: %s companion form\n",ctx->cform==1? "1st": "2nd");CHKERRQ(ierr); ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = EPSView(ctx->eps,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPReset_Linear" PetscErrorCode QEPReset_Linear(QEP qep) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; if (!ctx->eps) { ierr = EPSReset(ctx->eps);CHKERRQ(ierr); } ierr = MatDestroy(&ctx->A);CHKERRQ(ierr); ierr = MatDestroy(&ctx->B);CHKERRQ(ierr); ierr = VecDestroy(&ctx->x1);CHKERRQ(ierr); ierr = VecDestroy(&ctx->x2);CHKERRQ(ierr); ierr = VecDestroy(&ctx->y1);CHKERRQ(ierr); ierr = VecDestroy(&ctx->y2);CHKERRQ(ierr); ierr = QEPReset_Default(qep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPDestroy_Linear" PetscErrorCode QEPDestroy_Linear(QEP qep) { PetscErrorCode ierr; QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data; PetscFunctionBegin; ierr = EPSDestroy(&ctx->eps);CHKERRQ(ierr); ierr = PetscFree(qep->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetCompanionForm_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetCompanionForm_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetEPS_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetEPS_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetExplicitMatrix_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetExplicitMatrix_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPCreate_Linear" PETSC_EXTERN PetscErrorCode QEPCreate_Linear(QEP qep) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscFunctionBegin; ierr = PetscNewLog(qep,QEP_LINEAR,&ctx);CHKERRQ(ierr); qep->data = (void*)ctx; qep->ops->solve = QEPSolve_Linear; qep->ops->setup = QEPSetUp_Linear; qep->ops->setfromoptions = QEPSetFromOptions_Linear; qep->ops->destroy = QEPDestroy_Linear; qep->ops->reset = QEPReset_Linear; qep->ops->view = QEPView_Linear; ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetCompanionForm_C",QEPLinearSetCompanionForm_Linear);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetCompanionForm_C",QEPLinearGetCompanionForm_Linear);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetEPS_C",QEPLinearSetEPS_Linear);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetEPS_C",QEPLinearGetEPS_Linear);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetExplicitMatrix_C",QEPLinearSetExplicitMatrix_Linear);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetExplicitMatrix_C",QEPLinearGetExplicitMatrix_Linear);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_n2.c0000644000175000017500000001604712211062077021450 0ustar gladkgladk/* Linearization for general QEP, companion form 2. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include "linearp.h" /* Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following linearization is employed: A*z = l*B*z where A = [ -K 0 ] B = [ C M ] z = [ x ] [ 0 I ] [ I 0 ] [ l*x ] */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_N2A" PetscErrorCode MatMult_Linear_N2A(Mat A,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = -K*x1 */ ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr); /* y2 = x2 */ ierr = VecCopy(ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_N2B" PetscErrorCode MatMult_Linear_N2B(Mat B,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = C*x1 + M*x2 */ ierr = MatMult(ctx->C,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,ctx->sfactor);CHKERRQ(ierr); ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecAXPY(ctx->y1,ctx->sfactor*ctx->sfactor,ctx->y2);CHKERRQ(ierr); /* y2 = x1 */ ierr = VecCopy(ctx->x1,ctx->y2);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_N2A" PetscErrorCode MatGetDiagonal_Linear_N2A(Mat A,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr); ierr = VecScale(ctx->x1,-1.0);CHKERRQ(ierr); ierr = VecSet(ctx->x2,1.0);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_N2B" PetscErrorCode MatGetDiagonal_Linear_N2B(Mat B,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->C,ctx->x1);CHKERRQ(ierr); ierr = VecScale(ctx->x1,ctx->sfactor);CHKERRQ(ierr); ierr = VecSet(ctx->x2,0.0);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_N2A" PetscErrorCode MatCreateExplicit_Linear_N2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A) { PetscErrorCode ierr; PetscInt M,N,m,n; Mat Id; PetscFunctionBegin; ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr); ierr = MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);CHKERRQ(ierr); ierr = MatSetSizes(Id,m,n,M,N);CHKERRQ(ierr); ierr = MatSetFromOptions(Id);CHKERRQ(ierr); ierr = MatSetUp(Id);CHKERRQ(ierr); ierr = MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatShift(Id,1.0);CHKERRQ(ierr); ierr = SlepcMatTile(-1.0,ctx->K,0.0,Id,0.0,Id,1.0,Id,A);CHKERRQ(ierr); ierr = MatDestroy(&Id);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_N2B" PetscErrorCode MatCreateExplicit_Linear_N2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B) { PetscErrorCode ierr; PetscInt M,N,m,n; Mat Id; PetscFunctionBegin; ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr); ierr = MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);CHKERRQ(ierr); ierr = MatSetSizes(Id,m,n,M,N);CHKERRQ(ierr); ierr = MatSetFromOptions(Id);CHKERRQ(ierr); ierr = MatSetUp(Id);CHKERRQ(ierr); ierr = MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatShift(Id,1.0);CHKERRQ(ierr); ierr = SlepcMatTile(ctx->sfactor,ctx->C,ctx->sfactor*ctx->sfactor,ctx->M,1.0,Id,0.0,Id,B);CHKERRQ(ierr); ierr = MatDestroy(&Id);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_n1.c.html0000644000175000017500000002614012211062077022405 0ustar gladkgladk
Actual source code: qeplin_n1.c

  1: /*

  3:    Linearization for general QEP, companion form 1.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26:  #include linearp.h

 28: /*
 29:     Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
 30:     linearization is employed:

 32:       A*z = l*B*z   where   A = [  0   I ]     B = [ I  0 ]     z = [  x  ]
 33:                                 [ -K  -C ]         [ 0  M ]         [ l*x ]
 34:  */

 38: PetscErrorCode MatMult_Linear_N1A(Mat A,Vec x,Vec y)
 39: {
 40:   PetscErrorCode    ierr;
 41:   QEP_LINEAR        *ctx;
 42:   const PetscScalar *px;
 43:   PetscScalar       *py;
 44:   PetscInt          m;

 47:   MatShellGetContext(A,(void**)&ctx);
 48:   MatGetLocalSize(ctx->M,&m,NULL);
 49:   VecGetArrayRead(x,&px);
 50:   VecGetArray(y,&py);
 51:   VecPlaceArray(ctx->x1,px);
 52:   VecPlaceArray(ctx->x2,px+m);
 53:   VecPlaceArray(ctx->y1,py);
 54:   VecPlaceArray(ctx->y2,py+m);
 55:   /* y2 = -(K*x1 + C*x2) */
 56:   MatMult(ctx->K,ctx->x1,ctx->y2);
 57:   MatMult(ctx->C,ctx->x2,ctx->y1);
 58:   VecAXPY(ctx->y2,ctx->sfactor,ctx->y1);
 59:   VecScale(ctx->y2,-1.0);
 60:   /* y1 = x2 */
 61:   VecCopy(ctx->x2,ctx->y1);
 62:   VecResetArray(ctx->x1);
 63:   VecResetArray(ctx->x2);
 64:   VecResetArray(ctx->y1);
 65:   VecResetArray(ctx->y2);
 66:   VecRestoreArrayRead(x,&px);
 67:   VecRestoreArray(y,&py);
 68:   return(0);
 69: }

 73: PetscErrorCode MatMult_Linear_N1B(Mat B,Vec x,Vec y)
 74: {
 75:   PetscErrorCode    ierr;
 76:   QEP_LINEAR        *ctx;
 77:   const PetscScalar *px;
 78:   PetscScalar       *py;
 79:   PetscInt          m;

 82:   MatShellGetContext(B,(void**)&ctx);
 83:   MatGetLocalSize(ctx->M,&m,NULL);
 84:   VecGetArrayRead(x,&px);
 85:   VecGetArray(y,&py);
 86:   VecPlaceArray(ctx->x1,px);
 87:   VecPlaceArray(ctx->x2,px+m);
 88:   VecPlaceArray(ctx->y1,py);
 89:   VecPlaceArray(ctx->y2,py+m);
 90:   /* y1 = x1 */
 91:   VecCopy(ctx->x1,ctx->y1);
 92:   /* y2 = M*x2 */
 93:   MatMult(ctx->M,ctx->x2,ctx->y2);
 94:   VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);
 95:   VecResetArray(ctx->x1);
 96:   VecResetArray(ctx->x2);
 97:   VecResetArray(ctx->y1);
 98:   VecResetArray(ctx->y2);
 99:   VecRestoreArrayRead(x,&px);
100:   VecRestoreArray(y,&py);
101:   return(0);
102: }

106: PetscErrorCode MatGetDiagonal_Linear_N1A(Mat A,Vec diag)
107: {
109:   QEP_LINEAR     *ctx;
110:   PetscScalar    *pd;
111:   PetscInt       m;

114:   MatShellGetContext(A,(void**)&ctx);
115:   MatGetLocalSize(ctx->M,&m,NULL);
116:   VecGetArray(diag,&pd);
117:   VecPlaceArray(ctx->x1,pd);
118:   VecPlaceArray(ctx->x2,pd+m);
119:   VecSet(ctx->x1,0.0);
120:   MatGetDiagonal(ctx->C,ctx->x2);
121:   VecScale(ctx->x2,-ctx->sfactor);
122:   VecResetArray(ctx->x1);
123:   VecResetArray(ctx->x2);
124:   VecRestoreArray(diag,&pd);
125:   return(0);
126: }

130: PetscErrorCode MatGetDiagonal_Linear_N1B(Mat B,Vec diag)
131: {
133:   QEP_LINEAR     *ctx;
134:   PetscScalar    *pd;
135:   PetscInt       m;

138:   MatShellGetContext(B,(void**)&ctx);
139:   MatGetLocalSize(ctx->M,&m,NULL);
140:   VecGetArray(diag,&pd);
141:   VecPlaceArray(ctx->x1,pd);
142:   VecPlaceArray(ctx->x2,pd+m);
143:   VecSet(ctx->x1,1.0);
144:   MatGetDiagonal(ctx->M,ctx->x2);
145:   VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);
146:   VecResetArray(ctx->x1);
147:   VecResetArray(ctx->x2);
148:   VecRestoreArray(diag,&pd);
149:   return(0);
150: }

154: PetscErrorCode MatCreateExplicit_Linear_N1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
155: {
157:   PetscInt       M,N,m,n;
158:   Mat            Id;

161:   MatGetSize(ctx->M,&M,&N);
162:   MatGetLocalSize(ctx->M,&m,&n);
163:   MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);
164:   MatSetSizes(Id,m,n,M,N);
165:   MatSetFromOptions(Id);
166:   MatSetUp(Id);
167:   MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);
168:   MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);
169:   MatShift(Id,1.0);
170:   SlepcMatTile(0.0,Id,1.0,Id,-1.0,ctx->K,-ctx->sfactor,ctx->C,A);
171:   MatDestroy(&Id);
172:   return(0);
173: }

177: PetscErrorCode MatCreateExplicit_Linear_N1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
178: {
180:   PetscInt       M,N,m,n;
181:   Mat            Id;

184:   MatGetSize(ctx->M,&M,&N);
185:   MatGetLocalSize(ctx->M,&m,&n);
186:   MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);
187:   MatSetSizes(Id,m,n,M,N);
188:   MatSetFromOptions(Id);
189:   MatSetUp(Id);
190:   MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);
191:   MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);
192:   MatShift(Id,1.0);
193:   SlepcMatTile(1.0,Id,0.0,Id,0.0,Id,ctx->sfactor*ctx->sfactor,ctx->M,B);
194:   MatDestroy(&Id);
195:   return(0);
196: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/makefile0000644000175000017500000000226312211062077021110 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = linear.c qeplin_n1.c qeplin_n2.c qeplin_s1.c qeplin_s2.c qeplin_h1.c qeplin_h2.c SOURCEF = SOURCEH = linearp.h LIBBASE = libslepc DIRS = MANSEC = QEP LOCDIR = src/qep/impls/linear/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/impls/linear/linear.c.html0000644000175000017500000015312212211062077021772 0ustar gladkgladk
Actual source code: linear.c

  1: /*

  3:    Straightforward linearization for quadratic eigenproblems.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26: #include <slepc-private/epsimpl.h>         /*I "slepceps.h" I*/
 27:  #include linearp.h

 31: PetscErrorCode QEPSetUp_Linear(QEP qep)
 32: {
 34:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;
 35:   PetscInt       i=0;
 36:   EPSWhich       which;
 37:   PetscBool      trackall;
 38:   PetscScalar    sigma;
 39:   /* function tables */
 40:   PetscErrorCode (*fcreate[][2])(MPI_Comm,QEP_LINEAR*,Mat*) = {
 41:     { MatCreateExplicit_Linear_N1A, MatCreateExplicit_Linear_N1B },   /* N1 */
 42:     { MatCreateExplicit_Linear_N2A, MatCreateExplicit_Linear_N2B },   /* N2 */
 43:     { MatCreateExplicit_Linear_S1A, MatCreateExplicit_Linear_S1B },   /* S1 */
 44:     { MatCreateExplicit_Linear_S2A, MatCreateExplicit_Linear_S2B },   /* S2 */
 45:     { MatCreateExplicit_Linear_H1A, MatCreateExplicit_Linear_H1B },   /* H1 */
 46:     { MatCreateExplicit_Linear_H2A, MatCreateExplicit_Linear_H2B }    /* H2 */
 47:   };
 48:   PetscErrorCode (*fmult[][2])(Mat,Vec,Vec) = {
 49:     { MatMult_Linear_N1A, MatMult_Linear_N1B },
 50:     { MatMult_Linear_N2A, MatMult_Linear_N2B },
 51:     { MatMult_Linear_S1A, MatMult_Linear_S1B },
 52:     { MatMult_Linear_S2A, MatMult_Linear_S2B },
 53:     { MatMult_Linear_H1A, MatMult_Linear_H1B },
 54:     { MatMult_Linear_H2A, MatMult_Linear_H2B }
 55:   };
 56:   PetscErrorCode (*fgetdiagonal[][2])(Mat,Vec) = {
 57:     { MatGetDiagonal_Linear_N1A, MatGetDiagonal_Linear_N1B },
 58:     { MatGetDiagonal_Linear_N2A, MatGetDiagonal_Linear_N2B },
 59:     { MatGetDiagonal_Linear_S1A, MatGetDiagonal_Linear_S1B },
 60:     { MatGetDiagonal_Linear_S2A, MatGetDiagonal_Linear_S2B },
 61:     { MatGetDiagonal_Linear_H1A, MatGetDiagonal_Linear_H1B },
 62:     { MatGetDiagonal_Linear_H2A, MatGetDiagonal_Linear_H2B }
 63:   };

 66:   if (!ctx->cform) ctx->cform = 1;
 67:   if (!qep->which) qep->which = QEP_LARGEST_MAGNITUDE;
 68:   ctx->M = qep->M;
 69:   ctx->C = qep->C;
 70:   ctx->K = qep->K;
 71:   ctx->sfactor = qep->sfactor;

 73:   MatDestroy(&ctx->A);
 74:   MatDestroy(&ctx->B);
 75:   VecDestroy(&ctx->x1);
 76:   VecDestroy(&ctx->x2);
 77:   VecDestroy(&ctx->y1);
 78:   VecDestroy(&ctx->y2);

 80:   switch (qep->problem_type) {
 81:     case QEP_GENERAL:    i = 0; break;
 82:     case QEP_HERMITIAN:  i = 2; break;
 83:     case QEP_GYROSCOPIC: i = 4; break;
 84:     default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of qep->problem_type");
 85:   }
 86:   i += ctx->cform-1;

 88:   if (ctx->explicitmatrix) {
 89:     ctx->x1 = ctx->x2 = ctx->y1 = ctx->y2 = NULL;
 90:     (*fcreate[i][0])(PetscObjectComm((PetscObject)qep),ctx,&ctx->A);
 91:     (*fcreate[i][1])(PetscObjectComm((PetscObject)qep),ctx,&ctx->B);
 92:   } else {
 93:     VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->x1);
 94:     VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->x2);
 95:     VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->y1);
 96:     VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&ctx->y2);
 97:     PetscLogObjectParent(qep,ctx->x1);
 98:     PetscLogObjectParent(qep,ctx->x2);
 99:     PetscLogObjectParent(qep,ctx->y1);
100:     PetscLogObjectParent(qep,ctx->y2);
101:     MatCreateShell(PetscObjectComm((PetscObject)qep),2*qep->nloc,2*qep->nloc,2*qep->n,2*qep->n,ctx,&ctx->A);
102:     MatShellSetOperation(ctx->A,MATOP_MULT,(void(*)(void))fmult[i][0]);
103:     MatShellSetOperation(ctx->A,MATOP_GET_DIAGONAL,(void(*)(void))fgetdiagonal[i][0]);
104:     MatCreateShell(PetscObjectComm((PetscObject)qep),2*qep->nloc,2*qep->nloc,2*qep->n,2*qep->n,ctx,&ctx->B);
105:     MatShellSetOperation(ctx->B,MATOP_MULT,(void(*)(void))fmult[i][1]);
106:     MatShellSetOperation(ctx->B,MATOP_GET_DIAGONAL,(void(*)(void))fgetdiagonal[i][1]);
107:   }
108:   PetscLogObjectParent(qep,ctx->A);
109:   PetscLogObjectParent(qep,ctx->B);

111:   if (!ctx->eps) { QEPLinearGetEPS(qep,&ctx->eps); }
112:   EPSSetOperators(ctx->eps,ctx->A,ctx->B);
113:   if (qep->problem_type==QEP_HERMITIAN) {
114:     EPSSetProblemType(ctx->eps,EPS_GHIEP);
115:   } else {
116:     EPSSetProblemType(ctx->eps,EPS_GNHEP);
117:   }
118:   switch (qep->which) {
119:       case QEP_LARGEST_MAGNITUDE:  which = EPS_LARGEST_MAGNITUDE; break;
120:       case QEP_SMALLEST_MAGNITUDE: which = EPS_SMALLEST_MAGNITUDE; break;
121:       case QEP_LARGEST_REAL:       which = EPS_LARGEST_REAL; break;
122:       case QEP_SMALLEST_REAL:      which = EPS_SMALLEST_REAL; break;
123:       case QEP_LARGEST_IMAGINARY:  which = EPS_LARGEST_IMAGINARY; break;
124:       case QEP_SMALLEST_IMAGINARY: which = EPS_SMALLEST_IMAGINARY; break;
125:       default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of which");
126:   }
127:   EPSSetWhichEigenpairs(ctx->eps,which);
128:   EPSSetLeftVectorsWanted(ctx->eps,qep->leftvecs);
129:   EPSSetDimensions(ctx->eps,qep->nev,qep->ncv,qep->mpd);
130:   EPSSetTolerances(ctx->eps,qep->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL/10.0:qep->tol/10.0,qep->max_it);
131:   /* Transfer the trackall option from qep to eps */
132:   QEPGetTrackAll(qep,&trackall);
133:   EPSSetTrackAll(ctx->eps,trackall);
134:   if (ctx->setfromoptionscalled) {
135:     EPSSetFromOptions(ctx->eps);
136:     ctx->setfromoptionscalled = PETSC_FALSE;
137:   }
138:   /* temporary change of target */
139:   if (qep->sfactor!=1.0) {
140:     EPSGetTarget(ctx->eps,&sigma);
141:     EPSSetTarget(ctx->eps,sigma/qep->sfactor);
142:   }
143:   EPSSetUp(ctx->eps);
144:   EPSGetDimensions(ctx->eps,NULL,&qep->ncv,&qep->mpd);
145:   EPSGetTolerances(ctx->eps,NULL,&qep->max_it);
146:   if (qep->nini>0 || qep->ninil>0) { PetscInfo(qep,"Ignoring initial vectors\n"); }
147:   QEPAllocateSolution(qep);
148:   return(0);
149: }

153: /*
154:    QEPLinearSelect_Norm - Auxiliary routine that copies the solution of the
155:    linear eigenproblem to the QEP object. The eigenvector of the generalized
156:    problem is supposed to be
157:                                z = [  x  ]
158:                                    [ l*x ]
159:    The eigenvector is taken from z(1:n) or z(n+1:2*n) depending on the explicitly
160:    computed residual norm.
161:    Finally, x is normalized so that ||x||_2 = 1.
162: */
163: static PetscErrorCode QEPLinearSelect_Norm(QEP qep,EPS eps)
164: {
166:   PetscInt       i;
167:   PetscScalar    *px;
168:   PetscReal      rn1,rn2;
169:   Vec            xr,xi,wr,wi;
170:   Mat            A;
171: #if !defined(PETSC_USE_COMPLEX)
172:   PetscScalar    *py;
173: #endif

176:   EPSGetOperators(eps,&A,NULL);
177:   MatGetVecs(A,&xr,NULL);
178:   VecDuplicate(xr,&xi);
179:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&wr);
180:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&wi);
181:   for (i=0;i<qep->nconv;i++) {
182:     EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);
183:     qep->eigr[i] *= qep->sfactor;
184:     qep->eigi[i] *= qep->sfactor;
185: #if !defined(PETSC_USE_COMPLEX)
186:     if (qep->eigi[i]>0.0) {   /* first eigenvalue of a complex conjugate pair */
187:       VecGetArray(xr,&px);
188:       VecGetArray(xi,&py);
189:       VecPlaceArray(wr,px);
190:       VecPlaceArray(wi,py);
191:       SlepcVecNormalize(wr,wi,PETSC_TRUE,NULL);
192:       QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn1);
193:       VecCopy(wr,qep->V[i]);
194:       VecCopy(wi,qep->V[i+1]);
195:       VecResetArray(wr);
196:       VecResetArray(wi);
197:       VecPlaceArray(wr,px+qep->nloc);
198:       VecPlaceArray(wi,py+qep->nloc);
199:       SlepcVecNormalize(wr,wi,PETSC_TRUE,NULL);
200:       QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn2);
201:       if (rn1>rn2) {
202:         VecCopy(wr,qep->V[i]);
203:         VecCopy(wi,qep->V[i+1]);
204:       }
205:       VecResetArray(wr);
206:       VecResetArray(wi);
207:       VecRestoreArray(xr,&px);
208:       VecRestoreArray(xi,&py);
209:     } else if (qep->eigi[i]==0.0)   /* real eigenvalue */
210: #endif
211:     {
212:       VecGetArray(xr,&px);
213:       VecPlaceArray(wr,px);
214:       SlepcVecNormalize(wr,NULL,PETSC_FALSE,NULL);
215:       QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,NULL,&rn1);
216:       VecCopy(wr,qep->V[i]);
217:       VecResetArray(wr);
218:       VecPlaceArray(wr,px+qep->nloc);
219:       SlepcVecNormalize(wr,NULL,PETSC_FALSE,NULL);
220:       QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,NULL,&rn2);
221:       if (rn1>rn2) {
222:         VecCopy(wr,qep->V[i]);
223:       }
224:       VecResetArray(wr);
225:       VecRestoreArray(xr,&px);
226:     }
227:   }
228:   VecDestroy(&wr);
229:   VecDestroy(&wi);
230:   VecDestroy(&xr);
231:   VecDestroy(&xi);
232:   return(0);
233: }

237: /*
238:    QEPLinearSelect_Simple - Auxiliary routine that copies the solution of the
239:    linear eigenproblem to the QEP object. The eigenvector of the generalized
240:    problem is supposed to be
241:                                z = [  x  ]
242:                                    [ l*x ]
243:    If |l|<1.0, the eigenvector is taken from z(1:n), otherwise from z(n+1:2*n).
244:    Finally, x is normalized so that ||x||_2 = 1.
245: */
246: static PetscErrorCode QEPLinearSelect_Simple(QEP qep,EPS eps)
247: {
249:   PetscInt       i,offset;
250:   PetscScalar    *px;
251:   Vec            xr,xi,w;
252:   Mat            A;

255:   EPSGetOperators(eps,&A,NULL);
256:   MatGetVecs(A,&xr,NULL);
257:   VecDuplicate(xr,&xi);
258:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)qep),1,qep->nloc,qep->n,NULL,&w);
259:   for (i=0;i<qep->nconv;i++) {
260:     EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);
261:     qep->eigr[i] *= qep->sfactor;
262:     qep->eigi[i] *= qep->sfactor;
263:     if (SlepcAbsEigenvalue(qep->eigr[i],qep->eigi[i])>1.0) offset = qep->nloc;
264:     else offset = 0;
265: #if !defined(PETSC_USE_COMPLEX)
266:     if (qep->eigi[i]>0.0) {   /* first eigenvalue of a complex conjugate pair */
267:       VecGetArray(xr,&px);
268:       VecPlaceArray(w,px+offset);
269:       VecCopy(w,qep->V[i]);
270:       VecResetArray(w);
271:       VecRestoreArray(xr,&px);
272:       VecGetArray(xi,&px);
273:       VecPlaceArray(w,px+offset);
274:       VecCopy(w,qep->V[i+1]);
275:       VecResetArray(w);
276:       VecRestoreArray(xi,&px);
277:       SlepcVecNormalize(qep->V[i],qep->V[i+1],PETSC_TRUE,NULL);
278:     } else if (qep->eigi[i]==0.0)   /* real eigenvalue */
279: #endif
280:     {
281:       VecGetArray(xr,&px);
282:       VecPlaceArray(w,px+offset);
283:       VecCopy(w,qep->V[i]);
284:       VecResetArray(w);
285:       VecRestoreArray(xr,&px);
286:       SlepcVecNormalize(qep->V[i],NULL,PETSC_FALSE,NULL);
287:     }
288:   }
289:   VecDestroy(&w);
290:   VecDestroy(&xr);
291:   VecDestroy(&xi);
292:   return(0);
293: }

297: PetscErrorCode QEPSolve_Linear(QEP qep)
298: {
300:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;
301:   PetscBool      flg=PETSC_FALSE;
302:   PetscScalar    sigma;

305:   EPSSolve(ctx->eps);
306:   EPSGetConverged(ctx->eps,&qep->nconv);
307:   EPSGetIterationNumber(ctx->eps,&qep->its);
308:   EPSGetConvergedReason(ctx->eps,(EPSConvergedReason*)&qep->reason);
309:   EPSGetOperationCounters(ctx->eps,&qep->matvecs,NULL,&qep->linits);
310:   /* restore target */
311:   EPSGetTarget(ctx->eps,&sigma);
312:   EPSSetTarget(ctx->eps,sigma*qep->sfactor);

314:   qep->matvecs *= 2;  /* convention: count one matvec for each non-trivial block in A */
315:   PetscOptionsGetBool(((PetscObject)qep)->prefix,"-qep_linear_select_simple",&flg,NULL);
316:   if (flg) {
317:     QEPLinearSelect_Simple(qep,ctx->eps);
318:   } else {
319:     QEPLinearSelect_Norm(qep,ctx->eps);
320:   }
321:   return(0);
322: }

326: static PetscErrorCode EPSMonitor_Linear(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)
327: {
328:   PetscInt       i;
329:   QEP            qep = (QEP)ctx;

333:   nconv = 0;
334:   for (i=0;i<PetscMin(nest,qep->ncv);i++) {
335:     qep->eigr[i] = eigr[i];
336:     qep->eigi[i] = eigi[i];
337:     qep->errest[i] = errest[i];
338:     if (0.0 < errest[i] && errest[i] < qep->tol) nconv++;
339:   }
340:   STBackTransform(eps->st,nest,qep->eigr,qep->eigi);
341:   QEPMonitor(qep,its,nconv,qep->eigr,qep->eigi,qep->errest,nest);
342:   return(0);
343: }

347: PetscErrorCode QEPSetFromOptions_Linear(QEP qep)
348: {
350:   PetscBool      set,val;
351:   PetscInt       i;
352:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;
353:   ST             st;

356:   ctx->setfromoptionscalled = PETSC_TRUE;
357:   PetscOptionsHead("QEP Linear Options");
358:   PetscOptionsInt("-qep_linear_cform","Number of the companion form","QEPLinearSetCompanionForm",ctx->cform,&i,&set);
359:   if (set) {
360:     QEPLinearSetCompanionForm(qep,i);
361:   }
362:   PetscOptionsBool("-qep_linear_explicitmatrix","Use explicit matrix in linearization","QEPLinearSetExplicitMatrix",ctx->explicitmatrix,&val,&set);
363:   if (set) {
364:     QEPLinearSetExplicitMatrix(qep,val);
365:   }
366:   if (!ctx->explicitmatrix) {
367:     /* use as default an ST with shell matrix and Jacobi */
368:     if (!ctx->eps) { QEPLinearGetEPS(qep,&ctx->eps); }
369:     EPSGetST(ctx->eps,&st);
370:     STSetMatMode(st,ST_MATMODE_SHELL);
371:   }
372:   PetscOptionsTail();
373:   return(0);
374: }

378: static PetscErrorCode QEPLinearSetCompanionForm_Linear(QEP qep,PetscInt cform)
379: {
380:   QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data;

383:   if (!cform) return(0);
384:   if (cform==PETSC_DECIDE || cform==PETSC_DEFAULT) ctx->cform = 1;
385:   else {
386:     if (cform!=1 && cform!=2) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Invalid value of argument 'cform'");
387:     ctx->cform = cform;
388:   }
389:   return(0);
390: }

394: /*@
395:    QEPLinearSetCompanionForm - Choose between the two companion forms available
396:    for the linearization of the quadratic problem.

398:    Logically Collective on QEP

400:    Input Parameters:
401: +  qep   - quadratic eigenvalue solver
402: -  cform - 1 or 2 (first or second companion form)

404:    Options Database Key:
405: .  -qep_linear_cform <int> - Choose the companion form

407:    Level: advanced

409: .seealso: QEPLinearGetCompanionForm()
410: @*/
411: PetscErrorCode QEPLinearSetCompanionForm(QEP qep,PetscInt cform)
412: {

418:   PetscTryMethod(qep,"QEPLinearSetCompanionForm_C",(QEP,PetscInt),(qep,cform));
419:   return(0);
420: }

424: static PetscErrorCode QEPLinearGetCompanionForm_Linear(QEP qep,PetscInt *cform)
425: {
426:   QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data;

429:   *cform = ctx->cform;
430:   return(0);
431: }

435: /*@
436:    QEPLinearGetCompanionForm - Returns the number of the companion form that
437:    will be used for the linearization of the quadratic problem.

439:    Not Collective

441:    Input Parameter:
442: .  qep  - quadratic eigenvalue solver

444:    Output Parameter:
445: .  cform - the companion form number (1 or 2)

447:    Level: advanced

449: .seealso: QEPLinearSetCompanionForm()
450: @*/
451: PetscErrorCode QEPLinearGetCompanionForm(QEP qep,PetscInt *cform)
452: {

458:   PetscTryMethod(qep,"QEPLinearGetCompanionForm_C",(QEP,PetscInt*),(qep,cform));
459:   return(0);
460: }

464: static PetscErrorCode QEPLinearSetExplicitMatrix_Linear(QEP qep,PetscBool explicitmatrix)
465: {
466:   QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data;

469:   ctx->explicitmatrix = explicitmatrix;
470:   return(0);
471: }

475: /*@
476:    QEPLinearSetExplicitMatrix - Indicate if the matrices A and B for the linearization
477:    of the quadratic problem must be built explicitly.

479:    Logically Collective on QEP

481:    Input Parameters:
482: +  qep      - quadratic eigenvalue solver
483: -  explicit - boolean flag indicating if the matrices are built explicitly

485:    Options Database Key:
486: .  -qep_linear_explicitmatrix <boolean> - Indicates the boolean flag

488:    Level: advanced

490: .seealso: QEPLinearGetExplicitMatrix()
491: @*/
492: PetscErrorCode QEPLinearSetExplicitMatrix(QEP qep,PetscBool explicitmatrix)
493: {

499:   PetscTryMethod(qep,"QEPLinearSetExplicitMatrix_C",(QEP,PetscBool),(qep,explicitmatrix));
500:   return(0);
501: }

505: static PetscErrorCode QEPLinearGetExplicitMatrix_Linear(QEP qep,PetscBool *explicitmatrix)
506: {
507:   QEP_LINEAR *ctx = (QEP_LINEAR*)qep->data;

510:   *explicitmatrix = ctx->explicitmatrix;
511:   return(0);
512: }

516: /*@
517:    QEPLinearGetExplicitMatrix - Returns the flag indicating if the matrices A and B
518:    for the linearization of the quadratic problem are built explicitly.

520:    Not Collective

522:    Input Parameter:
523: .  qep  - quadratic eigenvalue solver

525:    Output Parameter:
526: .  explicitmatrix - the mode flag

528:    Level: advanced

530: .seealso: QEPLinearSetExplicitMatrix()
531: @*/
532: PetscErrorCode QEPLinearGetExplicitMatrix(QEP qep,PetscBool *explicitmatrix)
533: {

539:   PetscTryMethod(qep,"QEPLinearGetExplicitMatrix_C",(QEP,PetscBool*),(qep,explicitmatrix));
540:   return(0);
541: }

545: static PetscErrorCode QEPLinearSetEPS_Linear(QEP qep,EPS eps)
546: {
548:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;

551:   PetscObjectReference((PetscObject)eps);
552:   EPSDestroy(&ctx->eps);
553:   ctx->eps = eps;
554:   PetscLogObjectParent(qep,ctx->eps);
555:   qep->setupcalled = 0;
556:   return(0);
557: }

561: /*@
562:    QEPLinearSetEPS - Associate an eigensolver object (EPS) to the
563:    quadratic eigenvalue solver.

565:    Collective on QEP

567:    Input Parameters:
568: +  qep - quadratic eigenvalue solver
569: -  eps - the eigensolver object

571:    Level: advanced

573: .seealso: QEPLinearGetEPS()
574: @*/
575: PetscErrorCode QEPLinearSetEPS(QEP qep,EPS eps)
576: {

583:   PetscTryMethod(qep,"QEPLinearSetEPS_C",(QEP,EPS),(qep,eps));
584:   return(0);
585: }

589: static PetscErrorCode QEPLinearGetEPS_Linear(QEP qep,EPS *eps)
590: {
592:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;

595:   if (!ctx->eps) {
596:     EPSCreate(PetscObjectComm((PetscObject)qep),&ctx->eps);
597:     EPSSetOptionsPrefix(ctx->eps,((PetscObject)qep)->prefix);
598:     EPSAppendOptionsPrefix(ctx->eps,"qep_");
599:     STSetOptionsPrefix(ctx->eps->st,((PetscObject)ctx->eps)->prefix);
600:     PetscObjectIncrementTabLevel((PetscObject)ctx->eps,(PetscObject)qep,1);
601:     PetscLogObjectParent(qep,ctx->eps);
602:     if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
603:     EPSSetIP(ctx->eps,qep->ip);
604:     EPSMonitorSet(ctx->eps,EPSMonitor_Linear,qep,NULL);
605:   }
606:   *eps = ctx->eps;
607:   return(0);
608: }

612: /*@
613:    QEPLinearGetEPS - Retrieve the eigensolver object (EPS) associated
614:    to the quadratic eigenvalue solver.

616:    Not Collective

618:    Input Parameter:
619: .  qep - quadratic eigenvalue solver

621:    Output Parameter:
622: .  eps - the eigensolver object

624:    Level: advanced

626: .seealso: QEPLinearSetEPS()
627: @*/
628: PetscErrorCode QEPLinearGetEPS(QEP qep,EPS *eps)
629: {

635:   PetscTryMethod(qep,"QEPLinearGetEPS_C",(QEP,EPS*),(qep,eps));
636:   return(0);
637: }

641: PetscErrorCode QEPView_Linear(QEP qep,PetscViewer viewer)
642: {
644:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;

647:   if (!ctx->eps) { QEPLinearGetEPS(qep,&ctx->eps); }
648:   PetscViewerASCIIPrintf(viewer,"  Linear: %s matrices\n",ctx->explicitmatrix? "explicit": "implicit");
649:   PetscViewerASCIIPrintf(viewer,"  Linear: %s companion form\n",ctx->cform==1? "1st": "2nd");
650:   PetscViewerASCIIPushTab(viewer);
651:   EPSView(ctx->eps,viewer);
652:   PetscViewerASCIIPopTab(viewer);
653:   return(0);
654: }

658: PetscErrorCode QEPReset_Linear(QEP qep)
659: {
661:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;

664:   if (!ctx->eps) { EPSReset(ctx->eps); }
665:   MatDestroy(&ctx->A);
666:   MatDestroy(&ctx->B);
667:   VecDestroy(&ctx->x1);
668:   VecDestroy(&ctx->x2);
669:   VecDestroy(&ctx->y1);
670:   VecDestroy(&ctx->y2);
671:   QEPReset_Default(qep);
672:   return(0);
673: }

677: PetscErrorCode QEPDestroy_Linear(QEP qep)
678: {
680:   QEP_LINEAR     *ctx = (QEP_LINEAR*)qep->data;

683:   EPSDestroy(&ctx->eps);
684:   PetscFree(qep->data);
685:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetCompanionForm_C",NULL);
686:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetCompanionForm_C",NULL);
687:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetEPS_C",NULL);
688:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetEPS_C",NULL);
689:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetExplicitMatrix_C",NULL);
690:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetExplicitMatrix_C",NULL);
691:   return(0);
692: }

696: PETSC_EXTERN PetscErrorCode QEPCreate_Linear(QEP qep)
697: {
699:   QEP_LINEAR     *ctx;

702:   PetscNewLog(qep,QEP_LINEAR,&ctx);
703:   qep->data                      = (void*)ctx;
704:   qep->ops->solve                = QEPSolve_Linear;
705:   qep->ops->setup                = QEPSetUp_Linear;
706:   qep->ops->setfromoptions       = QEPSetFromOptions_Linear;
707:   qep->ops->destroy              = QEPDestroy_Linear;
708:   qep->ops->reset                = QEPReset_Linear;
709:   qep->ops->view                 = QEPView_Linear;
710:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetCompanionForm_C",QEPLinearSetCompanionForm_Linear);
711:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetCompanionForm_C",QEPLinearGetCompanionForm_Linear);
712:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetEPS_C",QEPLinearSetEPS_Linear);
713:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetEPS_C",QEPLinearGetEPS_Linear);
714:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearSetExplicitMatrix_C",QEPLinearSetExplicitMatrix_Linear);
715:   PetscObjectComposeFunction((PetscObject)qep,"QEPLinearGetExplicitMatrix_C",QEPLinearGetExplicitMatrix_Linear);
716:   return(0);
717: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/makefile.html0000644000175000017500000000405712211062077022056 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = linear.c qeplin_n1.c qeplin_n2.c qeplin_s1.c qeplin_s2.c qeplin_h1.c qeplin_h2.c
SOURCEF  =
SOURCEH  = linearp.h
LIBBASE  = libslepc
DIRS     =
MANSEC   = QEP
LOCDIR   = src/qep/impls/linear/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/qep/impls/linear/index.html0000644000175000017500000000256712211062077021414 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

linearp.h
linear.c
qeplin_n1.c
qeplin_n2.c
qeplin_s1.c
qeplin_s2.c
qeplin_h1.c
qeplin_h2.c
makefile
slepc-3.4.2.dfsg.orig/src/qep/impls/linear/linearp.h.html0000644000175000017500000002114712211062077022160 0ustar gladkgladk

Actual source code: linearp.h

  1: /*
  2:    Private header for QEPLINEAR.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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


 27: typedef struct {
 28:   PetscBool  explicitmatrix;
 29:   PetscInt   cform;           /* companion form */
 30:   PetscReal  sfactor;         /* scaling factor */
 31:   Mat        A,B;             /* matrices of generalized eigenproblem */
 32:   EPS        eps;             /* linear eigensolver for Az=lBz */
 33:   Mat        M,C,K;           /* copy of QEP coefficient matrices */
 34:   Vec        x1,x2,y1,y2;     /* work vectors */
 35:   PetscBool  setfromoptionscalled;
 36: } QEP_LINEAR;

 38: /* N1 */
 39: PETSC_INTERN PetscErrorCode MatMult_Linear_N1A(Mat,Vec,Vec);
 40: PETSC_INTERN PetscErrorCode MatMult_Linear_N1B(Mat,Vec,Vec);
 41: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N1A(Mat,Vec);
 42: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N1B(Mat,Vec);
 43: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N1A(MPI_Comm,QEP_LINEAR*,Mat*);
 44: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N1B(MPI_Comm,QEP_LINEAR*,Mat*);

 46: /* N2 */
 47: PETSC_INTERN PetscErrorCode MatMult_Linear_N2A(Mat,Vec,Vec);
 48: PETSC_INTERN PetscErrorCode MatMult_Linear_N2B(Mat,Vec,Vec);
 49: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N2A(Mat,Vec);
 50: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N2B(Mat,Vec);
 51: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N2A(MPI_Comm,QEP_LINEAR*,Mat*);
 52: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N2B(MPI_Comm,QEP_LINEAR*,Mat*);

 54: /* S1 */
 55: PETSC_INTERN PetscErrorCode MatMult_Linear_S1A(Mat,Vec,Vec);
 56: PETSC_INTERN PetscErrorCode MatMult_Linear_S1B(Mat,Vec,Vec);
 57: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S1A(Mat,Vec);
 58: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S1B(Mat,Vec);
 59: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S1A(MPI_Comm,QEP_LINEAR*,Mat*);
 60: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S1B(MPI_Comm,QEP_LINEAR*,Mat*);

 62: /* S2 */
 63: PETSC_INTERN PetscErrorCode MatMult_Linear_S2A(Mat,Vec,Vec);
 64: PETSC_INTERN PetscErrorCode MatMult_Linear_S2B(Mat,Vec,Vec);
 65: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S2A(Mat,Vec);
 66: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S2B(Mat,Vec);
 67: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S2A(MPI_Comm,QEP_LINEAR*,Mat*);
 68: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S2B(MPI_Comm,QEP_LINEAR*,Mat*);

 70: /* H1 */
 71: PETSC_INTERN PetscErrorCode MatMult_Linear_H1A(Mat,Vec,Vec);
 72: PETSC_INTERN PetscErrorCode MatMult_Linear_H1B(Mat,Vec,Vec);
 73: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H1A(Mat,Vec);
 74: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H1B(Mat,Vec);
 75: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H1A(MPI_Comm,QEP_LINEAR*,Mat*);
 76: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H1B(MPI_Comm,QEP_LINEAR*,Mat*);

 78: /* H2 */
 79: PETSC_INTERN PetscErrorCode MatMult_Linear_H2A(Mat,Vec,Vec);
 80: PETSC_INTERN PetscErrorCode MatMult_Linear_H2B(Mat,Vec,Vec);
 81: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H2A(Mat,Vec);
 82: PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H2B(Mat,Vec);
 83: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H2A(MPI_Comm,QEP_LINEAR*,Mat*);
 84: PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H2B(MPI_Comm,QEP_LINEAR*,Mat*);

 86: #endif
slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_n1.c0000644000175000017500000001610012211062077021435 0ustar gladkgladk/* Linearization for general QEP, companion form 1. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include "linearp.h" /* Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following linearization is employed: A*z = l*B*z where A = [ 0 I ] B = [ I 0 ] z = [ x ] [ -K -C ] [ 0 M ] [ l*x ] */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_N1A" PetscErrorCode MatMult_Linear_N1A(Mat A,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y2 = -(K*x1 + C*x2) */ ierr = MatMult(ctx->K,ctx->x1,ctx->y2);CHKERRQ(ierr); ierr = MatMult(ctx->C,ctx->x2,ctx->y1);CHKERRQ(ierr); ierr = VecAXPY(ctx->y2,ctx->sfactor,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y2,-1.0);CHKERRQ(ierr); /* y1 = x2 */ ierr = VecCopy(ctx->x2,ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_N1B" PetscErrorCode MatMult_Linear_N1B(Mat B,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = x1 */ ierr = VecCopy(ctx->x1,ctx->y1);CHKERRQ(ierr); /* y2 = M*x2 */ ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_N1A" PetscErrorCode MatGetDiagonal_Linear_N1A(Mat A,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = VecSet(ctx->x1,0.0);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->C,ctx->x2);CHKERRQ(ierr); ierr = VecScale(ctx->x2,-ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_N1B" PetscErrorCode MatGetDiagonal_Linear_N1B(Mat B,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = VecSet(ctx->x1,1.0);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->M,ctx->x2);CHKERRQ(ierr); ierr = VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_N1A" PetscErrorCode MatCreateExplicit_Linear_N1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A) { PetscErrorCode ierr; PetscInt M,N,m,n; Mat Id; PetscFunctionBegin; ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr); ierr = MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);CHKERRQ(ierr); ierr = MatSetSizes(Id,m,n,M,N);CHKERRQ(ierr); ierr = MatSetFromOptions(Id);CHKERRQ(ierr); ierr = MatSetUp(Id);CHKERRQ(ierr); ierr = MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatShift(Id,1.0);CHKERRQ(ierr); ierr = SlepcMatTile(0.0,Id,1.0,Id,-1.0,ctx->K,-ctx->sfactor,ctx->C,A);CHKERRQ(ierr); ierr = MatDestroy(&Id);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_N1B" PetscErrorCode MatCreateExplicit_Linear_N1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B) { PetscErrorCode ierr; PetscInt M,N,m,n; Mat Id; PetscFunctionBegin; ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr); ierr = MatCreate(PetscObjectComm((PetscObject)ctx->M),&Id);CHKERRQ(ierr); ierr = MatSetSizes(Id,m,n,M,N);CHKERRQ(ierr); ierr = MatSetFromOptions(Id);CHKERRQ(ierr); ierr = MatSetUp(Id);CHKERRQ(ierr); ierr = MatAssemblyBegin(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Id,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatShift(Id,1.0);CHKERRQ(ierr); ierr = SlepcMatTile(1.0,Id,0.0,Id,0.0,Id,ctx->sfactor*ctx->sfactor,ctx->M,B);CHKERRQ(ierr); ierr = MatDestroy(&Id);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_h2.c.html0000644000175000017500000002235612211062077022405 0ustar gladkgladk
Actual source code: qeplin_h2.c

  1: /*

  3:    Linearization for gyroscopic QEP, companion form 2.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26:  #include linearp.h

 28: /*
 29:     Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
 30:     linearization is employed:

 32:       A*z = l*B*z   where   A = [  0  -K ]     B = [ M  C ]     z = [  x  ]
 33:                                 [  M   0 ]         [ 0  M ]         [ l*x ]
 34:  */

 38: PetscErrorCode MatMult_Linear_H2A(Mat A,Vec x,Vec y)
 39: {
 40:   PetscErrorCode    ierr;
 41:   QEP_LINEAR        *ctx;
 42:   const PetscScalar *px;
 43:   PetscScalar       *py;
 44:   PetscInt          m;

 47:   MatShellGetContext(A,(void**)&ctx);
 48:   MatGetLocalSize(ctx->M,&m,NULL);
 49:   VecGetArrayRead(x,&px);
 50:   VecGetArray(y,&py);
 51:   VecPlaceArray(ctx->x1,px);
 52:   VecPlaceArray(ctx->x2,px+m);
 53:   VecPlaceArray(ctx->y1,py);
 54:   VecPlaceArray(ctx->y2,py+m);
 55:   /* y1 = -K*x2 */
 56:   MatMult(ctx->K,ctx->x2,ctx->y1);
 57:   VecScale(ctx->y1,-1.0);
 58:   /* y2 = M*x1 */
 59:   MatMult(ctx->M,ctx->x1,ctx->y2);
 60:   VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);
 61:   VecResetArray(ctx->x1);
 62:   VecResetArray(ctx->x2);
 63:   VecResetArray(ctx->y1);
 64:   VecResetArray(ctx->y2);
 65:   VecRestoreArrayRead(x,&px);
 66:   VecRestoreArray(y,&py);
 67:   return(0);
 68: }

 72: PetscErrorCode MatMult_Linear_H2B(Mat B,Vec x,Vec y)
 73: {
 74:   PetscErrorCode    ierr;
 75:   QEP_LINEAR        *ctx;
 76:   const PetscScalar *px;
 77:   PetscScalar       *py;
 78:   PetscInt          m;

 81:   MatShellGetContext(B,(void**)&ctx);
 82:   MatGetLocalSize(ctx->M,&m,NULL);
 83:   VecGetArrayRead(x,&px);
 84:   VecGetArray(y,&py);
 85:   VecPlaceArray(ctx->x1,px);
 86:   VecPlaceArray(ctx->x2,px+m);
 87:   VecPlaceArray(ctx->y1,py);
 88:   VecPlaceArray(ctx->y2,py+m);
 89:   /* y1 = M*x1 + C*x2 */
 90:   MatMult(ctx->M,ctx->x1,ctx->y1);
 91:   VecScale(ctx->y1,ctx->sfactor*ctx->sfactor);
 92:   MatMult(ctx->C,ctx->x2,ctx->y2);
 93:   VecAXPY(ctx->y1,ctx->sfactor,ctx->y2);
 94:   /* y2 = M*x2 */
 95:   MatMult(ctx->M,ctx->x2,ctx->y2);
 96:   VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);
 97:   VecResetArray(ctx->x1);
 98:   VecResetArray(ctx->x2);
 99:   VecResetArray(ctx->y1);
100:   VecResetArray(ctx->y2);
101:   VecRestoreArrayRead(x,&px);
102:   VecRestoreArray(y,&py);
103:   return(0);
104: }

108: PetscErrorCode MatGetDiagonal_Linear_H2A(Mat A,Vec diag)
109: {

113:   VecSet(diag,0.0);
114:   return(0);
115: }

119: PetscErrorCode MatGetDiagonal_Linear_H2B(Mat B,Vec diag)
120: {
122:   QEP_LINEAR     *ctx;
123:   PetscScalar    *pd;
124:   PetscInt       m;

127:   MatShellGetContext(B,(void**)&ctx);
128:   MatGetLocalSize(ctx->M,&m,NULL);
129:   VecGetArray(diag,&pd);
130:   VecPlaceArray(ctx->x1,pd);
131:   VecPlaceArray(ctx->x2,pd+m);
132:   MatGetDiagonal(ctx->M,ctx->x1);
133:   VecScale(ctx->x1,ctx->sfactor*ctx->sfactor);
134:   VecCopy(ctx->x1,ctx->x2);
135:   VecResetArray(ctx->x1);
136:   VecResetArray(ctx->x2);
137:   VecRestoreArray(diag,&pd);
138:   return(0);
139: }

143: PetscErrorCode MatCreateExplicit_Linear_H2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
144: {

148:   SlepcMatTile(0.0,ctx->K,-1.0,ctx->K,ctx->sfactor*ctx->sfactor,ctx->M,0.0,ctx->K,A);
149:   return(0);
150: }

154: PetscErrorCode MatCreateExplicit_Linear_H2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
155: {

159:   SlepcMatTile(ctx->sfactor*ctx->sfactor,ctx->M,ctx->sfactor,ctx->C,0.0,ctx->C,ctx->sfactor*ctx->sfactor,ctx->M,B);
160:   return(0);
161: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_h1.c0000644000175000017500000001250712211062077021436 0ustar gladkgladk/* Linearization for gyroscopic QEP, companion form 1. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include "linearp.h" /* Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following linearization is employed: A*z = l*B*z where A = [ K 0 ] B = [ 0 K ] z = [ x ] [ C K ] [-M 0 ] [ l*x ] */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_H1A" PetscErrorCode MatMult_Linear_H1A(Mat A,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y2 = C*x1 + K*x2 */ ierr = MatMult(ctx->C,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = MatMult(ctx->K,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecAXPY(ctx->y2,ctx->sfactor,ctx->y1);CHKERRQ(ierr); /* y1 = K*x1 */ ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_H1B" PetscErrorCode MatMult_Linear_H1B(Mat B,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = K*x2 */ ierr = MatMult(ctx->K,ctx->x2,ctx->y1);CHKERRQ(ierr); /* y2 = -M*x1 */ ierr = MatMult(ctx->M,ctx->x1,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,-ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_H1A" PetscErrorCode MatGetDiagonal_Linear_H1A(Mat A,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr); ierr = VecCopy(ctx->x1,ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_H1B" PetscErrorCode MatGetDiagonal_Linear_H1B(Mat B,Vec diag) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecSet(diag,0.0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_H1A" PetscErrorCode MatCreateExplicit_Linear_H1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(1.0,ctx->K,0.0,ctx->K,ctx->sfactor,ctx->C,1.0,ctx->K,A);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_H1B" PetscErrorCode MatCreateExplicit_Linear_H1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(0.0,ctx->K,1.0,ctx->K,-ctx->sfactor*ctx->sfactor,ctx->M,0.0,ctx->K,B);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/linear/linearp.h0000644000175000017500000000771712211062077021224 0ustar gladkgladk/* Private header for QEPLINEAR. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__LINEARP_H) #define __LINEARP_H typedef struct { PetscBool explicitmatrix; PetscInt cform; /* companion form */ PetscReal sfactor; /* scaling factor */ Mat A,B; /* matrices of generalized eigenproblem */ EPS eps; /* linear eigensolver for Az=lBz */ Mat M,C,K; /* copy of QEP coefficient matrices */ Vec x1,x2,y1,y2; /* work vectors */ PetscBool setfromoptionscalled; } QEP_LINEAR; /* N1 */ PETSC_INTERN PetscErrorCode MatMult_Linear_N1A(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatMult_Linear_N1B(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N1A(Mat,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N1B(Mat,Vec); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N1A(MPI_Comm,QEP_LINEAR*,Mat*); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N1B(MPI_Comm,QEP_LINEAR*,Mat*); /* N2 */ PETSC_INTERN PetscErrorCode MatMult_Linear_N2A(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatMult_Linear_N2B(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N2A(Mat,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_N2B(Mat,Vec); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N2A(MPI_Comm,QEP_LINEAR*,Mat*); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_N2B(MPI_Comm,QEP_LINEAR*,Mat*); /* S1 */ PETSC_INTERN PetscErrorCode MatMult_Linear_S1A(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatMult_Linear_S1B(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S1A(Mat,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S1B(Mat,Vec); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S1A(MPI_Comm,QEP_LINEAR*,Mat*); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S1B(MPI_Comm,QEP_LINEAR*,Mat*); /* S2 */ PETSC_INTERN PetscErrorCode MatMult_Linear_S2A(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatMult_Linear_S2B(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S2A(Mat,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_S2B(Mat,Vec); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S2A(MPI_Comm,QEP_LINEAR*,Mat*); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_S2B(MPI_Comm,QEP_LINEAR*,Mat*); /* H1 */ PETSC_INTERN PetscErrorCode MatMult_Linear_H1A(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatMult_Linear_H1B(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H1A(Mat,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H1B(Mat,Vec); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H1A(MPI_Comm,QEP_LINEAR*,Mat*); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H1B(MPI_Comm,QEP_LINEAR*,Mat*); /* H2 */ PETSC_INTERN PetscErrorCode MatMult_Linear_H2A(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatMult_Linear_H2B(Mat,Vec,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H2A(Mat,Vec); PETSC_INTERN PetscErrorCode MatGetDiagonal_Linear_H2B(Mat,Vec); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H2A(MPI_Comm,QEP_LINEAR*,Mat*); PETSC_INTERN PetscErrorCode MatCreateExplicit_Linear_H2B(MPI_Comm,QEP_LINEAR*,Mat*); #endif slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_h1.c.html0000644000175000017500000002160612211062077022401 0ustar gladkgladk
Actual source code: qeplin_h1.c

  1: /*

  3:    Linearization for gyroscopic QEP, companion form 1.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 26:  #include linearp.h

 28: /*
 29:     Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
 30:     linearization is employed:

 32:       A*z = l*B*z   where   A = [  K   0 ]     B = [ 0  K ]     z = [  x  ]
 33:                                 [  C   K ]         [-M  0 ]         [ l*x ]
 34:  */

 38: PetscErrorCode MatMult_Linear_H1A(Mat A,Vec x,Vec y)
 39: {
 40:   PetscErrorCode    ierr;
 41:   QEP_LINEAR        *ctx;
 42:   const PetscScalar *px;
 43:   PetscScalar       *py;
 44:   PetscInt          m;

 47:   MatShellGetContext(A,(void**)&ctx);
 48:   MatGetLocalSize(ctx->M,&m,NULL);
 49:   VecGetArrayRead(x,&px);
 50:   VecGetArray(y,&py);
 51:   VecPlaceArray(ctx->x1,px);
 52:   VecPlaceArray(ctx->x2,px+m);
 53:   VecPlaceArray(ctx->y1,py);
 54:   VecPlaceArray(ctx->y2,py+m);
 55:   /* y2 = C*x1 + K*x2 */
 56:   MatMult(ctx->C,ctx->x1,ctx->y1);
 57:   MatMult(ctx->K,ctx->x2,ctx->y2);
 58:   VecAXPY(ctx->y2,ctx->sfactor,ctx->y1);
 59:   /* y1 = K*x1 */
 60:   MatMult(ctx->K,ctx->x1,ctx->y1);
 61:   VecResetArray(ctx->x1);
 62:   VecResetArray(ctx->x2);
 63:   VecResetArray(ctx->y1);
 64:   VecResetArray(ctx->y2);
 65:   VecRestoreArrayRead(x,&px);
 66:   VecRestoreArray(y,&py);
 67:   return(0);
 68: }

 72: PetscErrorCode MatMult_Linear_H1B(Mat B,Vec x,Vec y)
 73: {
 74:   PetscErrorCode    ierr;
 75:   QEP_LINEAR        *ctx;
 76:   const PetscScalar *px;
 77:   PetscScalar       *py;
 78:   PetscInt          m;

 81:   MatShellGetContext(B,(void**)&ctx);
 82:   MatGetLocalSize(ctx->M,&m,NULL);
 83:   VecGetArrayRead(x,&px);
 84:   VecGetArray(y,&py);
 85:   VecPlaceArray(ctx->x1,px);
 86:   VecPlaceArray(ctx->x2,px+m);
 87:   VecPlaceArray(ctx->y1,py);
 88:   VecPlaceArray(ctx->y2,py+m);
 89:   /* y1 = K*x2 */
 90:   MatMult(ctx->K,ctx->x2,ctx->y1);
 91:   /* y2 = -M*x1 */
 92:   MatMult(ctx->M,ctx->x1,ctx->y2);
 93:   VecScale(ctx->y2,-ctx->sfactor*ctx->sfactor);
 94:   VecResetArray(ctx->x1);
 95:   VecResetArray(ctx->x2);
 96:   VecResetArray(ctx->y1);
 97:   VecResetArray(ctx->y2);
 98:   VecRestoreArrayRead(x,&px);
 99:   VecRestoreArray(y,&py);
100:   return(0);
101: }

105: PetscErrorCode MatGetDiagonal_Linear_H1A(Mat A,Vec diag)
106: {
108:   QEP_LINEAR     *ctx;
109:   PetscScalar    *pd;
110:   PetscInt       m;

113:   MatShellGetContext(A,(void**)&ctx);
114:   MatGetLocalSize(ctx->M,&m,NULL);
115:   VecGetArray(diag,&pd);
116:   VecPlaceArray(ctx->x1,pd);
117:   VecPlaceArray(ctx->x2,pd+m);
118:   MatGetDiagonal(ctx->K,ctx->x1);
119:   VecCopy(ctx->x1,ctx->x2);
120:   VecResetArray(ctx->x1);
121:   VecResetArray(ctx->x2);
122:   VecRestoreArray(diag,&pd);
123:   return(0);
124: }

128: PetscErrorCode MatGetDiagonal_Linear_H1B(Mat B,Vec diag)
129: {

133:   VecSet(diag,0.0);
134:   return(0);
135: }

139: PetscErrorCode MatCreateExplicit_Linear_H1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
140: {

144:   SlepcMatTile(1.0,ctx->K,0.0,ctx->K,ctx->sfactor,ctx->C,1.0,ctx->K,A);
145:   return(0);
146: }

150: PetscErrorCode MatCreateExplicit_Linear_H1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
151: {

155:   SlepcMatTile(0.0,ctx->K,1.0,ctx->K,-ctx->sfactor*ctx->sfactor,ctx->M,0.0,ctx->K,B);
156:   return(0);
157: }

slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_h2.c0000644000175000017500000001315512211062077021437 0ustar gladkgladk/* Linearization for gyroscopic QEP, companion form 2. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include "linearp.h" /* Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following linearization is employed: A*z = l*B*z where A = [ 0 -K ] B = [ M C ] z = [ x ] [ M 0 ] [ 0 M ] [ l*x ] */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_H2A" PetscErrorCode MatMult_Linear_H2A(Mat A,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = -K*x2 */ ierr = MatMult(ctx->K,ctx->x2,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr); /* y2 = M*x1 */ ierr = MatMult(ctx->M,ctx->x1,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_H2B" PetscErrorCode MatMult_Linear_H2B(Mat B,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = M*x1 + C*x2 */ ierr = MatMult(ctx->M,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = MatMult(ctx->C,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecAXPY(ctx->y1,ctx->sfactor,ctx->y2);CHKERRQ(ierr); /* y2 = M*x2 */ ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_H2A" PetscErrorCode MatGetDiagonal_Linear_H2A(Mat A,Vec diag) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecSet(diag,0.0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_H2B" PetscErrorCode MatGetDiagonal_Linear_H2B(Mat B,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->M,ctx->x1);CHKERRQ(ierr); ierr = VecScale(ctx->x1,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecCopy(ctx->x1,ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_H2A" PetscErrorCode MatCreateExplicit_Linear_H2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(0.0,ctx->K,-1.0,ctx->K,ctx->sfactor*ctx->sfactor,ctx->M,0.0,ctx->K,A);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_H2B" PetscErrorCode MatCreateExplicit_Linear_H2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(ctx->sfactor*ctx->sfactor,ctx->M,ctx->sfactor,ctx->C,0.0,ctx->C,ctx->sfactor*ctx->sfactor,ctx->M,B);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_s2.c0000644000175000017500000001435212211062077021452 0ustar gladkgladk/* Linearization for Hermitian QEP, companion form 2. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include "linearp.h" /* Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following linearization is employed: A*z = l*B*z where A = [ -K 0 ] B = [ C M ] z = [ x ] [ 0 M ] [ M 0 ] [ l*x ] */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_S2A" PetscErrorCode MatMult_Linear_S2A(Mat A,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = -K*x1 */ ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr); /* y2 = M*x2 */ ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_S2B" PetscErrorCode MatMult_Linear_S2B(Mat B,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = C*x1 + M*x2 */ ierr = MatMult(ctx->C,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,ctx->sfactor);CHKERRQ(ierr); ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecAXPY(ctx->y1,ctx->sfactor*ctx->sfactor,ctx->y2);CHKERRQ(ierr); /* y2 = M*x1 */ ierr = MatMult(ctx->M,ctx->x1,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_S2A" PetscErrorCode MatGetDiagonal_Linear_S2A(Mat A,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr); ierr = VecScale(ctx->x1,-1.0);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->M,ctx->x2);CHKERRQ(ierr); ierr = VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_S2B" PetscErrorCode MatGetDiagonal_Linear_S2B(Mat B,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->C,ctx->x1);CHKERRQ(ierr); ierr = VecScale(ctx->x1,ctx->sfactor);CHKERRQ(ierr); ierr = VecSet(ctx->x2,0.0);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_S2A" PetscErrorCode MatCreateExplicit_Linear_S2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(-1.0,ctx->K,0.0,ctx->M,0.0,ctx->M,ctx->sfactor*ctx->sfactor,ctx->M,A);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_S2B" PetscErrorCode MatCreateExplicit_Linear_S2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(ctx->sfactor,ctx->C,ctx->sfactor*ctx->sfactor,ctx->M,ctx->sfactor*ctx->sfactor,ctx->M,0.0,ctx->M,B);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/linear/ftn-auto/0000755000175000017500000000000012214143515021142 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/impls/linear/ftn-auto/linearf.c0000644000175000017500000000562712211062077022740 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* linear.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qeplinearsetcompanionform_ QEPLINEARSETCOMPANIONFORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qeplinearsetcompanionform_ qeplinearsetcompanionform #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qeplineargetcompanionform_ QEPLINEARGETCOMPANIONFORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qeplineargetcompanionform_ qeplineargetcompanionform #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qeplinearsetexplicitmatrix_ QEPLINEARSETEXPLICITMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qeplinearsetexplicitmatrix_ qeplinearsetexplicitmatrix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qeplineargetexplicitmatrix_ QEPLINEARGETEXPLICITMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qeplineargetexplicitmatrix_ qeplineargetexplicitmatrix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qeplinearseteps_ QEPLINEARSETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qeplinearseteps_ qeplinearseteps #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qeplineargeteps_ QEPLINEARGETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qeplineargeteps_ qeplineargeteps #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qeplinearsetcompanionform_(QEP *qep,PetscInt *cform, int *__ierr ){ *__ierr = QEPLinearSetCompanionForm(*qep,*cform); } void PETSC_STDCALL qeplineargetcompanionform_(QEP *qep,PetscInt *cform, int *__ierr ){ *__ierr = QEPLinearGetCompanionForm(*qep,cform); } void PETSC_STDCALL qeplinearsetexplicitmatrix_(QEP *qep,PetscBool *explicitmatrix, int *__ierr ){ *__ierr = QEPLinearSetExplicitMatrix(*qep,*explicitmatrix); } void PETSC_STDCALL qeplineargetexplicitmatrix_(QEP *qep,PetscBool *explicitmatrix, int *__ierr ){ *__ierr = QEPLinearGetExplicitMatrix(*qep,explicitmatrix); } void PETSC_STDCALL qeplinearseteps_(QEP *qep,EPS *eps, int *__ierr ){ *__ierr = QEPLinearSetEPS(*qep,*eps); } void PETSC_STDCALL qeplineargeteps_(QEP *qep,EPS *eps, int *__ierr ){ *__ierr = QEPLinearGetEPS(*qep, (EPS* )PetscToPointer((eps) )); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/impls/linear/ftn-auto/makefile0000644000175000017500000000034412211062077022643 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = linearf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/qep/impls/linear/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/impls/linear/qeplin_s1.c0000644000175000017500000001423512211062077021451 0ustar gladkgladk/* Linearization for Hermitian QEP, companion form 1. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include "linearp.h" /* Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following linearization is employed: A*z = l*B*z where A = [ 0 -K ] B = [-K 0 ] z = [ x ] [ -K -C ] [ 0 M ] [ l*x ] */ #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_S1A" PetscErrorCode MatMult_Linear_S1A(Mat A,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y2 = -(K*x1 + C*x2) */ ierr = MatMult(ctx->K,ctx->x1,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,-1.0);CHKERRQ(ierr); ierr = MatMult(ctx->C,ctx->x2,ctx->y1);CHKERRQ(ierr); ierr = VecAXPY(ctx->y2,-ctx->sfactor,ctx->y1);CHKERRQ(ierr); /* y1 = -K*x2 */ ierr = MatMult(ctx->K,ctx->x2,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Linear_S1B" PetscErrorCode MatMult_Linear_S1B(Mat B,Vec x,Vec y) { PetscErrorCode ierr; QEP_LINEAR *ctx; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr); /* y1 = -K*x1 */ ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr); ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr); /* y2 = M*x2 */ ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr); ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecResetArray(ctx->y1);CHKERRQ(ierr); ierr = VecResetArray(ctx->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_S1A" PetscErrorCode MatGetDiagonal_Linear_S1A(Mat A,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = VecSet(ctx->x1,0.0);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->C,ctx->x2);CHKERRQ(ierr); ierr = VecScale(ctx->x2,-ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Linear_S1B" PetscErrorCode MatGetDiagonal_Linear_S1B(Mat B,Vec diag) { PetscErrorCode ierr; QEP_LINEAR *ctx; PetscScalar *pd; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr); ierr = MatGetLocalSize(ctx->M,&m,NULL);CHKERRQ(ierr); ierr = VecGetArray(diag,&pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr); ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr); ierr = VecScale(ctx->x1,-1.0);CHKERRQ(ierr); ierr = MatGetDiagonal(ctx->M,ctx->x2);CHKERRQ(ierr); ierr = VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr); ierr = VecResetArray(ctx->x1);CHKERRQ(ierr); ierr = VecResetArray(ctx->x2);CHKERRQ(ierr); ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_S1A" PetscErrorCode MatCreateExplicit_Linear_S1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(0.0,ctx->K,-1.0,ctx->K,-1.0,ctx->K,-ctx->sfactor,ctx->C,A);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatCreateExplicit_Linear_S1B" PetscErrorCode MatCreateExplicit_Linear_S1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; ierr = SlepcMatTile(-1.0,ctx->K,0.0,ctx->M,0.0,ctx->M,ctx->sfactor*ctx->sfactor,ctx->M,B);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/qlanczos/0000755000175000017500000000000012211062077017765 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/impls/qlanczos/qlanczos.c0000644000175000017500000003260412211062077021770 0ustar gladkgladk/* SLEPc quadratic eigensolver: "qlanczos" Method: Q-Lanczos Algorithm: Quadratic Lanczos with indefinite B-orthogonalization and thick restart. References: [1] C. Campos and J.E. Roman, "A thick-restart Q-Lanczos method for quadratic eigenvalue problems", in preparation, 2013. Last update: Mar 2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "QEPSetUp_QLanczos" PetscErrorCode QEPSetUp_QLanczos(QEP qep) { PetscErrorCode ierr; PetscBool sinv; PetscFunctionBegin; if (qep->ncv) { /* ncv set */ if (qep->ncvnev) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must be at least nev"); } else if (qep->mpd) { /* mpd set */ qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd); } else { /* neither set: defaults depend on nev being small or large */ if (qep->nev<500) qep->ncv = PetscMin(qep->n,PetscMax(2*qep->nev,qep->nev+15)); else { qep->mpd = 500; qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd); } } if (!qep->mpd) qep->mpd = qep->ncv; if (qep->ncv>qep->nev+qep->mpd) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must not be larger than nev+mpd"); if (!qep->max_it) qep->max_it = PetscMax(100,2*qep->n/qep->ncv); /* -- */ if (!qep->which) { ierr = PetscObjectTypeCompare((PetscObject)qep->st,STSINVERT,&sinv);CHKERRQ(ierr); if (sinv) qep->which = QEP_TARGET_MAGNITUDE; else qep->which = QEP_LARGEST_MAGNITUDE; } if (qep->problem_type!=QEP_HERMITIAN) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems"); ierr = QEPAllocateSolution(qep);CHKERRQ(ierr); ierr = QEPSetWorkVecs(qep,4);CHKERRQ(ierr); ierr = DSSetType(qep->ds,DSGHIEP);CHKERRQ(ierr); ierr = DSSetCompact(qep->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSAllocate(qep->ds,qep->ncv+1);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPQLanczosNorm_private" /* Compute B-norm of v=[v1;v2] whith B=diag(-qep->T[0],qep->T[2]) */ PetscErrorCode QEPQLanczosNorm_private(QEP qep,Vec v1,Vec v2,PetscReal *norm,Vec vw) { PetscErrorCode ierr; PetscScalar p1,p2; PetscFunctionBegin; ierr = STMatMult(qep->st,0,v1,vw);CHKERRQ(ierr); ierr = VecDot(vw,v1,&p1);CHKERRQ(ierr); ierr = STMatMult(qep->st,2,v2,vw);CHKERRQ(ierr); ierr = VecDot(vw,v2,&p2);CHKERRQ(ierr); *norm = PetscRealPart(-p1+qep->sfactor*qep->sfactor*p2); *norm = (*norm>0.0)?PetscSqrtReal(*norm):-PetscSqrtReal(-*norm); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPQLanczosCGS" /* Compute a step of Classical Gram-Schmidt orthogonalization */ static PetscErrorCode QEPQLanczosCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscReal *omega,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work,Vec vw) { PetscErrorCode ierr; PetscBLASInt ione = 1,j_1 = j+1,i; PetscScalar dot,one = 1.0,zero = 0.0; PetscFunctionBegin; /* compute norm of [v;w] */ if (onorm) { ierr = QEPQLanczosNorm_private(qep,v,w,onorm,vw);CHKERRQ(ierr); } /* orthogonalize: compute h */ ierr = STMatMult(qep->st,0,v,vw);CHKERRQ(ierr); ierr = VecMDot(vw,j_1,V,h);CHKERRQ(ierr); for (i=0;i<=j;i++) h[i] = -h[i]; ierr = STMatMult(qep->st,2,w,vw);CHKERRQ(ierr); if (j>0) { ierr = VecMDot(vw,j_1,V,work);CHKERRQ(ierr); for (i=0;isfactor*qep->sfactor; PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&j_1,&j,&one,H,&ldh,work,&ione,&one,h,&ione)); } ierr = VecDot(vw,t,&dot);CHKERRQ(ierr); h[j] += dot*qep->sfactor*qep->sfactor; /* apply inverse of signature */ for (i=0;i<=j;i++) h[i] /= omega[i]; /* orthogonalize: update v and w */ ierr = SlepcVecMAXPBY(v,1.0,-1.0,j_1,h,V);CHKERRQ(ierr); if (j>0) { PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&j_1,&j,&one,H,&ldh,h,&ione,&zero,work,&ione)); ierr = SlepcVecMAXPBY(w,1.0,-1.0,j_1,work,V);CHKERRQ(ierr); } ierr = VecAXPY(w,-h[j],t);CHKERRQ(ierr); /* H pseudosymmetric, signature is not revert*/ /* compute norm of v and w */ if (norm) { ierr = QEPQLanczosNorm_private(qep,v,w,norm,vw);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPQLanczos" /* Compute a run of Q-Lanczos iterations */ static PetscErrorCode QEPQLanczos(QEP qep,PetscScalar *H,PetscInt ldh,PetscReal *omega,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscBool *breakdown,PetscScalar *work,Vec *t_) { PetscErrorCode ierr; PetscInt i,j,m = *M,nwu = 0,l; Vec t = t_[0],u = t_[1]; IPOrthogRefineType refinement; PetscReal onorm,norm,eta; PetscScalar *c; PetscFunctionBegin; ierr = IPGetOrthogonalization(qep->ip,NULL,&refinement,&eta);CHKERRQ(ierr); nwu += m+1; c = work+nwu; for (j=k;jst,0,v,u);CHKERRQ(ierr); ierr = STMatMult(qep->st,1,t,w);CHKERRQ(ierr); ierr = VecAXPY(u,qep->sfactor,w);CHKERRQ(ierr); ierr = STMatSolve(qep->st,2,u,w);CHKERRQ(ierr); ierr = VecScale(w,-1.0/(qep->sfactor*qep->sfactor));CHKERRQ(ierr); ierr = VecCopy(t,v);CHKERRQ(ierr); /* orthogonalize */ switch (refinement) { case IP_ORTHOG_REFINE_NEVER: ierr = QEPQLanczosCGS(qep,H,ldh,omega,H+ldh*j,j,V,t,v,w,NULL,&norm,work,u);CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_ALWAYS: ierr = QEPQLanczosCGS(qep,H,ldh,omega,H+ldh*j,j,V,t,v,w,NULL,NULL,work,u);CHKERRQ(ierr); ierr = QEPQLanczosCGS(qep,H,ldh,omega,c,j,V,t,v,w,&onorm,&norm,work,u);CHKERRQ(ierr); for (i=0;i<=j;i++) H[ldh*j+i] += c[i]; break; case IP_ORTHOG_REFINE_IFNEEDED: /* -- */ ierr = QEPQLanczosCGS(qep,H,ldh,omega,H+ldh*j,j,V,t,v,w,&onorm,&norm,work,u);CHKERRQ(ierr); /* ||q|| < eta ||h|| */ l = 1; while (l<3 && PetscAbsReal(norm) < eta * PetscAbsReal(onorm)) { l++; onorm = norm; ierr = QEPQLanczosCGS(qep,H,ldh,omega,c,j,V,t,v,w,NULL,&norm,work,u);CHKERRQ(ierr); for (i=0;i<=j;i++) H[ldh*j+i] += c[i]; } break; default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of ip->orth_ref"); } if (breakdown) *breakdown = PETSC_FALSE; /* -- */ ierr = VecScale(v,1.0/norm);CHKERRQ(ierr); ierr = VecScale(w,1.0/norm);CHKERRQ(ierr); H[j+1+ldh*j] = norm; omega[j+1] = (norm<0.0)?-1.0:1.0; if (jwork[0],w=qep->work[1],w_=qep->work[2]; /* v_=qep->work[3]; */ PetscScalar *S,*Q,*work; PetscReal beta,norm,*omega,*a,*b,*r; PetscBool breakdown; PetscFunctionBegin; ierr = DSGetLeadingDimension(qep->ds,&ld);CHKERRQ(ierr); lwork = 7*qep->ncv; /* -- */ ierr = PetscMalloc(lwork*sizeof(PetscScalar),&work);CHKERRQ(ierr); /* Get the starting Lanczos vector */ if (qep->nini==0) { ierr = SlepcVecSetRandom(qep->V[0],qep->rand);CHKERRQ(ierr); } /* w is always a random vector */ ierr = SlepcVecSetRandom(w,qep->rand);CHKERRQ(ierr); ierr = QEPQLanczosNorm_private(qep,qep->V[0],w,&norm,w_);CHKERRQ(ierr); if (norm==0.0) SETERRQ(((PetscObject)qep)->comm,1,"Initial vector is zero or belongs to the deflation space"); ierr = VecScale(qep->V[0],1.0/norm);CHKERRQ(ierr); ierr = VecScale(w,1.0/norm);CHKERRQ(ierr); ierr = VecCopy(qep->V[0],v);CHKERRQ(ierr); ierr = DSGetArrayReal(qep->ds,DS_MAT_D,&omega);CHKERRQ(ierr); omega[0] = (norm > 0)?1.0:-1.0; ierr = DSRestoreArrayReal(qep->ds,DS_MAT_D,&omega);CHKERRQ(ierr); /* Restart loop */ l = 0; while (qep->reason == QEP_CONVERGED_ITERATING) { qep->its++; /* Form projected problem matrix on S */ ierr = DSGetArray(qep->ds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = DSGetArrayReal(qep->ds,DS_MAT_T,&a);CHKERRQ(ierr); b = a+ld; r = b+ld; ierr = DSGetArrayReal(qep->ds,DS_MAT_D,&omega);CHKERRQ(ierr); ierr = PetscMemzero(S,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); ti = qep->nconv+l; for (j=0;jnconv;jnconv+qep->mpd,qep->ncv); ierr = QEPQLanczos(qep,S,ld,omega,qep->V,qep->nconv+l,&nv,v,w,&breakdown,work,&qep->work[2]);CHKERRQ(ierr); for (j=ti;jds,DS_MAT_A,&S);CHKERRQ(ierr); ierr = DSRestoreArrayReal(qep->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSRestoreArrayReal(qep->ds,DS_MAT_D,&omega);CHKERRQ(ierr); ierr = DSSetDimensions(qep->ds,nv,0,qep->nconv,qep->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(qep->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(qep->ds,DS_STATE_RAW);CHKERRQ(ierr); } /* Solve projected problem */ ierr = DSSolve(qep->ds,qep->eigr,qep->eigi);CHKERRQ(ierr); ierr = DSSort(qep->ds,qep->eigr,qep->eigi,NULL,NULL,NULL);CHKERRQ(ierr); /* Check convergence */ ierr = DSGetDimensions(qep->ds,NULL,NULL,NULL,NULL,&t);CHKERRQ(ierr); ierr = QEPKrylovConvergence(qep,PETSC_FALSE,qep->nconv,t-qep->nconv,nv,beta,&k);CHKERRQ(ierr); if (qep->its >= qep->max_it) qep->reason = QEP_DIVERGED_ITS; if (k >= qep->nev) qep->reason = QEP_CONVERGED_TOL; /* Update l */ if (qep->reason != QEP_CONVERGED_ITERATING || breakdown) l = 0; else { l = PetscMax(1,(PetscInt)((nv-k)/2)); l = PetscMin(l,t); ierr = DSGetArrayReal(qep->ds,DS_MAT_T,&a);CHKERRQ(ierr); if (*(a+ld+k+l-1)!=0) { if (k+lds,DS_MAT_T,&a);CHKERRQ(ierr); } if (qep->reason == QEP_CONVERGED_ITERATING) { if (breakdown) { /* Stop if breakdown */ ierr = PetscInfo2(qep,"Breakdown Quadratic Lanczos method (it=%D norm=%G)\n",qep->its,beta);CHKERRQ(ierr); qep->reason = QEP_DIVERGED_BREAKDOWN; } else { /* Prepare the Rayleigh quotient for restart */ ierr = DSGetArray(qep->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = DSGetArrayReal(qep->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSGetArrayReal(qep->ds,DS_MAT_D,&omega);CHKERRQ(ierr); r = a + 2*ld; for (j=k;jds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = DSRestoreArrayReal(qep->ds,DS_MAT_T,&a);CHKERRQ(ierr); ierr = DSRestoreArrayReal(qep->ds,DS_MAT_D,&omega);CHKERRQ(ierr); } } /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */ ierr = DSGetArray(qep->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv,qep->V,qep->nconv,k+l,Q,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(qep->ds,DS_MAT_Q,&Q);CHKERRQ(ierr); /* Append v to V*/ if (qep->reason == QEP_CONVERGED_ITERATING) { ierr = VecCopy(v,qep->V[k+l]);CHKERRQ(ierr); } qep->nconv = k; ierr = QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,nv);CHKERRQ(ierr); } for (j=0;jnconv;j++) { qep->eigr[j] *= qep->sfactor; qep->eigi[j] *= qep->sfactor; } /* truncate Schur decomposition and change the state to raw so that DSVectors() computes eigenvectors from scratch */ ierr = DSSetDimensions(qep->ds,qep->nconv,0,0,0);CHKERRQ(ierr); ierr = DSSetState(qep->ds,DS_STATE_RAW);CHKERRQ(ierr); /* Compute eigenvectors */ if (qep->nconv > 0) { ierr = QEPComputeVectors_Schur(qep);CHKERRQ(ierr); } ierr = PetscFree(work);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPCreate_QLanczos" PETSC_EXTERN PetscErrorCode QEPCreate_QLanczos(QEP qep) { PetscFunctionBegin; qep->ops->solve = QEPSolve_QLanczos; qep->ops->setup = QEPSetUp_QLanczos; qep->ops->reset = QEPReset_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/impls/qlanczos/qlanczos.c.html0000644000175000017500000007123212211062077022733 0ustar gladkgladk
Actual source code: qlanczos.c

  1: /*

  3:    SLEPc quadratic eigensolver: "qlanczos"

  5:    Method: Q-Lanczos

  7:    Algorithm:

  9:        Quadratic Lanczos with indefinite B-orthogonalization and
 10:        thick restart.

 12:    References:

 14:        [1] C. Campos and J.E. Roman, "A thick-restart Q-Lanczos method
 15:            for quadratic eigenvalue problems", in preparation, 2013.

 17:    Last update: Mar 2013

 19:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 21:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 23:    This file is part of SLEPc.

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

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

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

 39: #include <slepc-private/qepimpl.h>         /*I "slepcqep.h" I*/
 40: #include <petscblaslapack.h>

 44: PetscErrorCode QEPSetUp_QLanczos(QEP qep)
 45: {
 47:   PetscBool      sinv;

 50:   if (qep->ncv) { /* ncv set */
 51:     if (qep->ncv<qep->nev) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must be at least nev");
 52:   } else if (qep->mpd) { /* mpd set */
 53:     qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd);
 54:   } else { /* neither set: defaults depend on nev being small or large */
 55:     if (qep->nev<500) qep->ncv = PetscMin(qep->n,PetscMax(2*qep->nev,qep->nev+15));
 56:     else {
 57:       qep->mpd = 500;
 58:       qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd);
 59:     }
 60:   }
 61:   if (!qep->mpd) qep->mpd = qep->ncv;
 62:   if (qep->ncv>qep->nev+qep->mpd) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The value of ncv must not be larger than nev+mpd");
 63:   if (!qep->max_it) qep->max_it = PetscMax(100,2*qep->n/qep->ncv); /* -- */
 64:   if (!qep->which) {
 65:     PetscObjectTypeCompare((PetscObject)qep->st,STSINVERT,&sinv);
 66:     if (sinv) qep->which = QEP_TARGET_MAGNITUDE;
 67:     else qep->which = QEP_LARGEST_MAGNITUDE;
 68:   }
 69:   if (qep->problem_type!=QEP_HERMITIAN) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_SUP,"Requested method is only available for Hermitian problems");

 71:   QEPAllocateSolution(qep);
 72:   QEPSetWorkVecs(qep,4);

 74:   DSSetType(qep->ds,DSGHIEP);
 75:   DSSetCompact(qep->ds,PETSC_TRUE);
 76:   DSAllocate(qep->ds,qep->ncv+1);
 77:   return(0);
 78: }


 83: /*
 84:   Compute B-norm of v=[v1;v2] whith  B=diag(-qep->T[0],qep->T[2]) 
 85: */
 86: PetscErrorCode QEPQLanczosNorm_private(QEP qep,Vec v1,Vec v2,PetscReal *norm,Vec vw)
 87: {
 89:   PetscScalar    p1,p2;
 90: 
 92:   STMatMult(qep->st,0,v1,vw);
 93:   VecDot(vw,v1,&p1);
 94:   STMatMult(qep->st,2,v2,vw);
 95:   VecDot(vw,v2,&p2);
 96:   *norm = PetscRealPart(-p1+qep->sfactor*qep->sfactor*p2);
 97:   *norm = (*norm>0.0)?PetscSqrtReal(*norm):-PetscSqrtReal(-*norm);
 98:   return(0);
 99: }


104: /*
105:   Compute a step of Classical Gram-Schmidt orthogonalization
106: */
107: static PetscErrorCode QEPQLanczosCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscReal *omega,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work,Vec vw)
108: {
110:   PetscBLASInt   ione = 1,j_1 = j+1,i;
111:   PetscScalar    dot,one = 1.0,zero = 0.0;

114:   /* compute norm of [v;w] */
115:   if (onorm) {
116:     QEPQLanczosNorm_private(qep,v,w,onorm,vw);
117:   }

119:   /* orthogonalize: compute h */
120:   STMatMult(qep->st,0,v,vw);
121:   VecMDot(vw,j_1,V,h);
122:   for (i=0;i<=j;i++) h[i] = -h[i];
123:   STMatMult(qep->st,2,w,vw);
124:   if (j>0) {
125:     VecMDot(vw,j_1,V,work);
126:     for (i=0;i<j_1;i++) work[i] *= qep->sfactor*qep->sfactor;
127:     PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&j_1,&j,&one,H,&ldh,work,&ione,&one,h,&ione));
128:   }
129:   VecDot(vw,t,&dot);
130:   h[j] += dot*qep->sfactor*qep->sfactor;
131:   /* apply inverse of signature */
132:   for (i=0;i<=j;i++) h[i] /= omega[i];
133:   /* orthogonalize: update v and w */
134:   SlepcVecMAXPBY(v,1.0,-1.0,j_1,h,V);
135:   if (j>0) {
136:     PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&j_1,&j,&one,H,&ldh,h,&ione,&zero,work,&ione));
137:     SlepcVecMAXPBY(w,1.0,-1.0,j_1,work,V);
138:   }
139:   VecAXPY(w,-h[j],t);
140:   /* H pseudosymmetric, signature is not revert*/

142:   /* compute norm of v and w */
143:   if (norm) {
144:     QEPQLanczosNorm_private(qep,v,w,norm,vw);
145:   }
146:   return(0);
147: }

151: /*
152:   Compute a run of Q-Lanczos iterations
153: */
154: static PetscErrorCode QEPQLanczos(QEP qep,PetscScalar *H,PetscInt ldh,PetscReal *omega,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscBool *breakdown,PetscScalar *work,Vec *t_)
155: {
156:   PetscErrorCode     ierr;
157:   PetscInt           i,j,m = *M,nwu = 0,l;
158:   Vec                t = t_[0],u = t_[1];
159:   IPOrthogRefineType refinement;
160:   PetscReal          onorm,norm,eta;
161:   PetscScalar        *c;

164:   IPGetOrthogonalization(qep->ip,NULL,&refinement,&eta);
165:   nwu += m+1;
166:   c = work+nwu;

168:   for (j=k;j<m;j++) {
169:     /* apply operator */
170:     VecCopy(w,t);
171:     STMatMult(qep->st,0,v,u);
172:     STMatMult(qep->st,1,t,w);
173:     VecAXPY(u,qep->sfactor,w);
174:     STMatSolve(qep->st,2,u,w);
175:     VecScale(w,-1.0/(qep->sfactor*qep->sfactor));
176:     VecCopy(t,v);

178:     /* orthogonalize */
179:     switch (refinement) {
180:       case IP_ORTHOG_REFINE_NEVER:
181:         QEPQLanczosCGS(qep,H,ldh,omega,H+ldh*j,j,V,t,v,w,NULL,&norm,work,u);
182:         break;
183:       case IP_ORTHOG_REFINE_ALWAYS:
184:         QEPQLanczosCGS(qep,H,ldh,omega,H+ldh*j,j,V,t,v,w,NULL,NULL,work,u);
185:         QEPQLanczosCGS(qep,H,ldh,omega,c,j,V,t,v,w,&onorm,&norm,work,u);
186:         for (i=0;i<=j;i++) H[ldh*j+i] += c[i];
187:         break;
188:       case IP_ORTHOG_REFINE_IFNEEDED: /* -- */
189:         QEPQLanczosCGS(qep,H,ldh,omega,H+ldh*j,j,V,t,v,w,&onorm,&norm,work,u);
190:         /* ||q|| < eta ||h|| */
191:         l = 1;
192:         while (l<3 && PetscAbsReal(norm) < eta * PetscAbsReal(onorm)) {
193:           l++;
194:           onorm = norm;
195:           QEPQLanczosCGS(qep,H,ldh,omega,c,j,V,t,v,w,NULL,&norm,work,u);
196:           for (i=0;i<=j;i++) H[ldh*j+i] += c[i];
197:         }
198:         break;
199:       default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of ip->orth_ref");
200:     }
201:     if (breakdown) *breakdown = PETSC_FALSE; /* -- */
202:     VecScale(v,1.0/norm);
203:     VecScale(w,1.0/norm);

205:     H[j+1+ldh*j] = norm;
206:     omega[j+1] = (norm<0.0)?-1.0:1.0;
207:     if (j<m-1) {
208:       VecCopy(v,V[j+1]);
209:     }
210:   }
211:   return(0);
212: }

216: PetscErrorCode QEPSolve_QLanczos(QEP qep)
217: {
219:   PetscInt       j,k,l,lwork,nv,ld,ti,t;
220:   Vec            v=qep->work[0],w=qep->work[1],w_=qep->work[2]; /* v_=qep->work[3]; */
221:   PetscScalar    *S,*Q,*work;
222:   PetscReal      beta,norm,*omega,*a,*b,*r;
223:   PetscBool      breakdown;

226:   DSGetLeadingDimension(qep->ds,&ld);
227:   lwork = 7*qep->ncv;  /* -- */
228:   PetscMalloc(lwork*sizeof(PetscScalar),&work);

230:   /* Get the starting Lanczos vector */
231:   if (qep->nini==0) {
232:     SlepcVecSetRandom(qep->V[0],qep->rand);
233:   }
234:   /* w is always a random vector */
235:   SlepcVecSetRandom(w,qep->rand);
236:   QEPQLanczosNorm_private(qep,qep->V[0],w,&norm,w_);
237:   if (norm==0.0) SETERRQ(((PetscObject)qep)->comm,1,"Initial vector is zero or belongs to the deflation space");
238:   VecScale(qep->V[0],1.0/norm);
239:   VecScale(w,1.0/norm);
240:   VecCopy(qep->V[0],v);
241:   DSGetArrayReal(qep->ds,DS_MAT_D,&omega);
242:   omega[0] = (norm > 0)?1.0:-1.0;
243:   DSRestoreArrayReal(qep->ds,DS_MAT_D,&omega);

245:   /* Restart loop */
246:   l = 0;
247:   while (qep->reason == QEP_CONVERGED_ITERATING) {
248:     qep->its++;

250:     /* Form projected problem matrix on S */
251:     DSGetArray(qep->ds,DS_MAT_A,&S);
252:     DSGetArrayReal(qep->ds,DS_MAT_T,&a);
253:     b = a+ld;
254:     r = b+ld;
255:     DSGetArrayReal(qep->ds,DS_MAT_D,&omega);
256:     PetscMemzero(S,ld*ld*sizeof(PetscScalar));
257:     ti = qep->nconv+l;
258:     for (j=0;j<ti;j++) {
259:       S[j+j*ld] = a[j]*omega[j];
260:       S[j+1+j*ld] = b[j]*omega[j+1];
261:       S[j+(j+1)*ld] = b[j]*omega[j];
262:     }
263:     for (j=qep->nconv;j<ti;j++) {
264:       S[ti+j*ld] = r[j]*omega[ti];
265:     }

267:     /* Compute an nv-step Lanczos factorization */
268:     nv = PetscMin(qep->nconv+qep->mpd,qep->ncv);
269:     QEPQLanczos(qep,S,ld,omega,qep->V,qep->nconv+l,&nv,v,w,&breakdown,work,&qep->work[2]);
270:     for (j=ti;j<nv-1;j++) {
271:       a[j] = PetscRealPart(S[j+j*ld]*omega[j]);
272:       b[j] = PetscAbsReal(PetscRealPart(S[j+1+j*ld]));
273:     }
274:     a[nv-1] = PetscRealPart(S[nv-1+(nv-1)*ld]*omega[nv-1]);
275:     beta = PetscAbsReal(PetscRealPart(S[nv+(nv-1)*ld]));
276:     DSRestoreArray(qep->ds,DS_MAT_A,&S);
277:     DSRestoreArrayReal(qep->ds,DS_MAT_T,&a);
278:     DSRestoreArrayReal(qep->ds,DS_MAT_D,&omega);
279:     DSSetDimensions(qep->ds,nv,0,qep->nconv,qep->nconv+l);
280:     if (l==0) {
281:       DSSetState(qep->ds,DS_STATE_INTERMEDIATE);
282:     } else {
283:       DSSetState(qep->ds,DS_STATE_RAW);
284:     }

286:     /* Solve projected problem */
287:     DSSolve(qep->ds,qep->eigr,qep->eigi);
288:     DSSort(qep->ds,qep->eigr,qep->eigi,NULL,NULL,NULL);

290:     /* Check convergence */
291:     DSGetDimensions(qep->ds,NULL,NULL,NULL,NULL,&t);
292:     QEPKrylovConvergence(qep,PETSC_FALSE,qep->nconv,t-qep->nconv,nv,beta,&k);
293:     if (qep->its >= qep->max_it) qep->reason = QEP_DIVERGED_ITS;
294:     if (k >= qep->nev) qep->reason = QEP_CONVERGED_TOL;

296:     /* Update l */
297:     if (qep->reason != QEP_CONVERGED_ITERATING || breakdown) l = 0;
298:     else {
299:       l = PetscMax(1,(PetscInt)((nv-k)/2));
300:       l = PetscMin(l,t);
301:       DSGetArrayReal(qep->ds,DS_MAT_T,&a);
302:       if (*(a+ld+k+l-1)!=0) {
303:         if (k+l<nv-1) l = l+1;
304:         else l = l-1;
305:       }
306:       DSRestoreArrayReal(qep->ds,DS_MAT_T,&a);
307:     }

309:     if (qep->reason == QEP_CONVERGED_ITERATING) {
310:       if (breakdown) {
311:         /* Stop if breakdown */
312:         PetscInfo2(qep,"Breakdown Quadratic Lanczos method (it=%D norm=%G)\n",qep->its,beta);
313:         qep->reason = QEP_DIVERGED_BREAKDOWN;
314:       } else {
315:         /* Prepare the Rayleigh quotient for restart */
316:         DSGetArray(qep->ds,DS_MAT_Q,&Q);
317:         DSGetArrayReal(qep->ds,DS_MAT_T,&a);
318:         DSGetArrayReal(qep->ds,DS_MAT_D,&omega);
319:         r = a + 2*ld;
320:         for (j=k;j<k+l;j++) {
321:           r[j] = PetscRealPart(Q[nv-1+j*ld]*beta);
322:         }
323:         b = a+ld;
324:         b[k+l-1] = r[k+l-1];
325:         omega[k+l] = omega[nv];
326:         DSRestoreArray(qep->ds,DS_MAT_Q,&Q);
327:         DSRestoreArrayReal(qep->ds,DS_MAT_T,&a);
328:         DSRestoreArrayReal(qep->ds,DS_MAT_D,&omega);
329:       }
330:     }
331:     /* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
332:     DSGetArray(qep->ds,DS_MAT_Q,&Q);
333:     SlepcUpdateVectors(nv,qep->V,qep->nconv,k+l,Q,ld,PETSC_FALSE);
334:     DSRestoreArray(qep->ds,DS_MAT_Q,&Q);
335: 
336:     /* Append v to V*/
337:     if (qep->reason == QEP_CONVERGED_ITERATING) {
338:       VecCopy(v,qep->V[k+l]);
339:     }
340:     qep->nconv = k;
341:     QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,nv);
342:   }

344:   for (j=0;j<qep->nconv;j++) {
345:     qep->eigr[j] *= qep->sfactor;
346:     qep->eigi[j] *= qep->sfactor;
347:   }

349:   /* truncate Schur decomposition and change the state to raw so that
350:      DSVectors() computes eigenvectors from scratch */
351:   DSSetDimensions(qep->ds,qep->nconv,0,0,0);
352:   DSSetState(qep->ds,DS_STATE_RAW);

354:   /* Compute eigenvectors */
355:   if (qep->nconv > 0) {
356:     QEPComputeVectors_Schur(qep);
357:   }
358:   PetscFree(work);
359:   return(0);
360: }

364: PETSC_EXTERN PetscErrorCode QEPCreate_QLanczos(QEP qep)
365: {
367:   qep->ops->solve                = QEPSolve_QLanczos;
368:   qep->ops->setup                = QEPSetUp_QLanczos;
369:   qep->ops->reset                = QEPReset_Default;
370:   return(0);
371: }

slepc-3.4.2.dfsg.orig/src/qep/impls/qlanczos/makefile0000644000175000017500000000214512211062077021467 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = qlanczos.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = QEP LOCDIR = src/qep/impls/qlanczos/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/impls/qlanczos/makefile.html0000644000175000017500000000374112211062077022435 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = qlanczos.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = QEP
LOCDIR   = src/qep/impls/qlanczos/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/qep/impls/qlanczos/index.html0000644000175000017500000000206612211062077021766 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

qlanczos.c
makefile
slepc-3.4.2.dfsg.orig/src/qep/makefile0000644000175000017500000000214312211062077016507 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/qepimpl.h ../../include/slepcqep.h DIRS = interface impls examples LOCDIR = src/qep/ MANSEC = QEP include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/makefile.html0000644000175000017500000000373712211062077017464 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/qepimpl.h ../../include/slepcqep.h
DIRS     = interface impls examples
LOCDIR   = src/qep/
MANSEC   = QEP

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/qep/interface/0000755000175000017500000000000012214143515016747 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/interface/qepregis.c.html0000644000175000017500000001035212211062077021676 0ustar gladkgladk
Actual source code: qepregis.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/qepimpl.h>      /*I "slepcqep.h" I*/

 24: PETSC_EXTERN PetscErrorCode QEPCreate_Linear(QEP);
 25: PETSC_EXTERN PetscErrorCode QEPCreate_QArnoldi(QEP);
 26: PETSC_EXTERN PetscErrorCode QEPCreate_QLanczos(QEP);

 30: /*@C
 31:    QEPRegisterAll - Registers all the solvers in the QEP package.

 33:    Not Collective

 35:    Level: advanced

 37: .seealso:  QEPRegister()
 38: @*/
 39: PetscErrorCode QEPRegisterAll(void)
 40: {

 44:   QEPRegisterAllCalled = PETSC_TRUE;
 45:   QEPRegister(QEPLINEAR,QEPCreate_Linear);
 46:   QEPRegister(QEPQARNOLDI,QEPCreate_QArnoldi);
 47:   QEPRegister(QEPQLANCZOS,QEPCreate_QLanczos);
 48:   return(0);
 49: }
slepc-3.4.2.dfsg.orig/src/qep/interface/qepsolve.c.html0000644000175000017500000015345612211062077021732 0ustar gladkgladk
Actual source code: qepsolve.c

  1: /*
  2:       QEP routines related to the solution process.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/qepimpl.h>       /*I "slepcqep.h" I*/
 25: #include <petscdraw.h>

 27: typedef struct {
 28:   PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 29:   void *comparisonctx;
 30:   ST st;
 31: } QEPSortForSTData;

 35: static PetscErrorCode QEPSortForSTFunc(PetscScalar ar,PetscScalar ai,
 36:                                 PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)
 37: {
 38:   QEPSortForSTData *data = (QEPSortForSTData*)ctx;
 39:   PetscErrorCode   ierr;

 42:   STBackTransform(data->st,1,&ar,&ai);
 43:   STBackTransform(data->st,1,&br,&bi);
 44:   (*data->comparison)(ar,ai,br,bi,r,data->comparisonctx);
 45:   return(0);
 46: }

 50: /*@
 51:    QEPSolve - Solves the quadratic eigensystem.

 53:    Collective on QEP

 55:    Input Parameter:
 56: .  qep - eigensolver context obtained from QEPCreate()

 58:    Options Database Keys:
 59: +  -qep_view - print information about the solver used
 60: .  -qep_view_mat0 binary - save the first matrix (M) to the default binary viewer
 61: .  -qep_view_mat1 binary - save the second matrix (C) to the default binary viewer
 62: .  -qep_view_mat2 binary - save the third matrix (K) to the default binary viewer
 63: -  -qep_plot_eigs - plot computed eigenvalues

 65:    Level: beginner

 67: .seealso: QEPCreate(), QEPSetUp(), QEPDestroy(), QEPSetTolerances()
 68: @*/
 69: PetscErrorCode QEPSolve(QEP qep)
 70: {
 71:   PetscErrorCode    ierr;
 72:   PetscInt          i;
 73:   PetscReal         re,im;
 74:   PetscBool         flg,islinear;
 75:   PetscViewer       viewer;
 76:   PetscViewerFormat format;
 77:   PetscDraw         draw;
 78:   PetscDrawSP       drawsp;
 79:   QEPSortForSTData  data;

 83:   PetscLogEventBegin(QEP_Solve,qep,0,0,0);

 85:   /* call setup */
 86:   QEPSetUp(qep);
 87:   qep->nconv = 0;
 88:   qep->its   = 0;
 89:   for (i=0;i<qep->ncv;i++) {
 90:     qep->eigr[i]   = 0.0;
 91:     qep->eigi[i]   = 0.0;
 92:     qep->errest[i] = 0.0;
 93:   }
 94:   QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,qep->ncv);

 96:   PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&islinear);
 97:   if (!islinear) {
 98:     /* temporarily change eigenvalue comparison function */
 99:     data.comparison    = qep->comparison;
100:     data.comparisonctx = qep->comparisonctx;
101:     data.st            = qep->st;
102:     qep->comparison    = QEPSortForSTFunc;
103:     qep->comparisonctx = &data;
104:   }
105:   DSSetEigenvalueComparison(qep->ds,qep->comparison,qep->comparisonctx);

107:   (*qep->ops->solve)(qep);
108:   if (!islinear) {
109:     STPostSolve(qep->st);
110:   }

112:   if (!qep->reason) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason");

114:   if (!islinear) {
115:     /* restore comparison function */
116:     qep->comparison    = data.comparison;
117:     qep->comparisonctx = data.comparisonctx;
118:     /* Map eigenvalues back to the original problem */
119:     STBackTransform(qep->st,qep->nconv,qep->eigr,qep->eigi);
120:   }

122: #if !defined(PETSC_USE_COMPLEX)
123:   /* reorder conjugate eigenvalues (positive imaginary first) */
124:   for (i=0;i<qep->nconv-1;i++) {
125:     if (qep->eigi[i] != 0) {
126:       if (qep->eigi[i] < 0) {
127:         qep->eigi[i] = -qep->eigi[i];
128:         qep->eigi[i+1] = -qep->eigi[i+1];
129:         VecScale(qep->V[i+1],-1.0);
130:       }
131:       i++;
132:     }
133:   }
134: #endif

136:   /* sort eigenvalues according to qep->which parameter */
137:   QEPSortEigenvalues(qep,qep->nconv,qep->eigr,qep->eigi,qep->perm);

139:   PetscLogEventEnd(QEP_Solve,qep,0,0,0);

141:   /* various viewers */
142:   MatViewFromOptions(qep->M,((PetscObject)qep)->prefix,"-qep_view_mat0");
143:   MatViewFromOptions(qep->C,((PetscObject)qep)->prefix,"-qep_view_mat1");
144:   MatViewFromOptions(qep->K,((PetscObject)qep)->prefix,"-qep_view_mat2");

146:   PetscOptionsGetViewer(PetscObjectComm((PetscObject)qep),((PetscObject)qep)->prefix,"-qep_view",&viewer,&format,&flg);
147:   if (flg && !PetscPreLoadingOn) {
148:     PetscViewerPushFormat(viewer,format);
149:     QEPView(qep,viewer);
150:     PetscViewerPopFormat(viewer);
151:     PetscViewerDestroy(&viewer);
152:   }

154:   flg = PETSC_FALSE;
155:   PetscOptionsGetBool(((PetscObject)qep)->prefix,"-qep_plot_eigs",&flg,NULL);
156:   if (flg) {
157:     PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);
158:     PetscViewerDrawGetDraw(viewer,0,&draw);
159:     PetscDrawSPCreate(draw,1,&drawsp);
160:     for (i=0;i<qep->nconv;i++) {
161: #if defined(PETSC_USE_COMPLEX)
162:       re = PetscRealPart(qep->eigr[i]);
163:       im = PetscImaginaryPart(qep->eigi[i]);
164: #else
165:       re = qep->eigr[i];
166:       im = qep->eigi[i];
167: #endif
168:       PetscDrawSPAddPoint(drawsp,&re,&im);
169:     }
170:     PetscDrawSPDraw(drawsp,PETSC_TRUE);
171:     PetscDrawSPDestroy(&drawsp);
172:     PetscViewerDestroy(&viewer);
173:   }

175:   /* Remove the initial subspace */
176:   qep->nini = 0;
177:   return(0);
178: }

182: /*@
183:    QEPGetIterationNumber - Gets the current iteration number. If the
184:    call to QEPSolve() is complete, then it returns the number of iterations
185:    carried out by the solution method.

187:    Not Collective

189:    Input Parameter:
190: .  qep - the quadratic eigensolver context

192:    Output Parameter:
193: .  its - number of iterations

195:    Level: intermediate

197:    Note:
198:    During the i-th iteration this call returns i-1. If QEPSolve() is
199:    complete, then parameter "its" contains either the iteration number at
200:    which convergence was successfully reached, or failure was detected.
201:    Call QEPGetConvergedReason() to determine if the solver converged or
202:    failed and why.

204: .seealso: QEPGetConvergedReason(), QEPSetTolerances()
205: @*/
206: PetscErrorCode QEPGetIterationNumber(QEP qep,PetscInt *its)
207: {
211:   *its = qep->its;
212:   return(0);
213: }

217: /*@
218:    QEPGetConverged - Gets the number of converged eigenpairs.

220:    Not Collective

222:    Input Parameter:
223: .  qep - the quadratic eigensolver context

225:    Output Parameter:
226: .  nconv - number of converged eigenpairs

228:    Note:
229:    This function should be called after QEPSolve() has finished.

231:    Level: beginner

233: .seealso: QEPSetDimensions(), QEPSolve()
234: @*/
235: PetscErrorCode QEPGetConverged(QEP qep,PetscInt *nconv)
236: {
240:   *nconv = qep->nconv;
241:   return(0);
242: }

246: /*@C
247:    QEPGetConvergedReason - Gets the reason why the QEPSolve() iteration was
248:    stopped.

250:    Not Collective

252:    Input Parameter:
253: .  qep - the quadratic eigensolver context

255:    Output Parameter:
256: .  reason - negative value indicates diverged, positive value converged

258:    Possible values for reason:
259: +  QEP_CONVERGED_TOL - converged up to tolerance
260: .  QEP_DIVERGED_ITS - required more than its to reach convergence
261: -  QEP_DIVERGED_BREAKDOWN - generic breakdown in method

263:    Note:
264:    Can only be called after the call to QEPSolve() is complete.

266:    Level: intermediate

268: .seealso: QEPSetTolerances(), QEPSolve(), QEPConvergedReason
269: @*/
270: PetscErrorCode QEPGetConvergedReason(QEP qep,QEPConvergedReason *reason)
271: {
275:   *reason = qep->reason;
276:   return(0);
277: }

281: /*@
282:    QEPGetEigenpair - Gets the i-th solution of the eigenproblem as computed by
283:    QEPSolve(). The solution consists in both the eigenvalue and the eigenvector.

285:    Logically Collective on EPS

287:    Input Parameters:
288: +  qep - quadratic eigensolver context
289: -  i   - index of the solution

291:    Output Parameters:
292: +  eigr - real part of eigenvalue
293: .  eigi - imaginary part of eigenvalue
294: .  Vr   - real part of eigenvector
295: -  Vi   - imaginary part of eigenvector

297:    Notes:
298:    If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is
299:    configured with complex scalars the eigenvalue is stored
300:    directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is
301:    set to zero).

303:    The index i should be a value between 0 and nconv-1 (see QEPGetConverged()).
304:    Eigenpairs are indexed according to the ordering criterion established
305:    with QEPSetWhichEigenpairs().

307:    Level: beginner

309: .seealso: QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs()
310: @*/
311: PetscErrorCode QEPGetEigenpair(QEP qep,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi)
312: {
313:   PetscInt       k;

321:   if (!qep->eigr || !qep->eigi || !qep->V) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONGSTATE,"QEPSolve must be called first");
322:   if (i<0 || i>=qep->nconv) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");

324:   if (!qep->perm) k = i;
325:   else k = qep->perm[i];

327:   /* eigenvalue */
328: #if defined(PETSC_USE_COMPLEX)
329:   if (eigr) *eigr = qep->eigr[k];
330:   if (eigi) *eigi = 0;
331: #else
332:   if (eigr) *eigr = qep->eigr[k];
333:   if (eigi) *eigi = qep->eigi[k];
334: #endif

336:   /* eigenvector */
337: #if defined(PETSC_USE_COMPLEX)
338:   if (Vr) { VecCopy(qep->V[k],Vr); }
339:   if (Vi) { VecSet(Vi,0.0); }
340: #else
341:   if (qep->eigi[k]>0) { /* first value of conjugate pair */
342:     if (Vr) { VecCopy(qep->V[k],Vr); }
343:     if (Vi) { VecCopy(qep->V[k+1],Vi); }
344:   } else if (qep->eigi[k]<0) { /* second value of conjugate pair */
345:     if (Vr) { VecCopy(qep->V[k-1],Vr); }
346:     if (Vi) {
347:       VecCopy(qep->V[k],Vi);
348:       VecScale(Vi,-1.0);
349:     }
350:   } else { /* real eigenvalue */
351:     if (Vr) { VecCopy(qep->V[k],Vr); }
352:     if (Vi) { VecSet(Vi,0.0); }
353:   }
354: #endif
355:   return(0);
356: }

360: /*@
361:    QEPGetErrorEstimate - Returns the error estimate associated to the i-th
362:    computed eigenpair.

364:    Not Collective

366:    Input Parameter:
367: +  qep - quadratic eigensolver context
368: -  i   - index of eigenpair

370:    Output Parameter:
371: .  errest - the error estimate

373:    Notes:
374:    This is the error estimate used internally by the eigensolver. The actual
375:    error bound can be computed with QEPComputeRelativeError(). See also the users
376:    manual for details.

378:    Level: advanced

380: .seealso: QEPComputeRelativeError()
381: @*/
382: PetscErrorCode QEPGetErrorEstimate(QEP qep,PetscInt i,PetscReal *errest)
383: {
387:   if (!qep->eigr || !qep->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"QEPSolve must be called first");
388:   if (i<0 || i>=qep->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
389:   if (qep->perm) i = qep->perm[i];
390:   if (errest) *errest = qep->errest[i];
391:   return(0);
392: }

396: /*
397:    QEPComputeResidualNorm_Private - Computes the norm of the residual vector
398:    associated with an eigenpair.
399: */
400: PetscErrorCode QEPComputeResidualNorm_Private(QEP qep,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *norm)
401: {
403:   Vec            u,w;
404:   Mat            M=qep->M,C=qep->C,K=qep->K;
405: #if !defined(PETSC_USE_COMPLEX)
406:   Vec            v,y,z;
407:   PetscReal      ni,nr;
408:   PetscScalar    a1,a2;
409: #endif

412:   VecDuplicate(qep->V[0],&u);
413:   VecDuplicate(u,&w);

415: #if !defined(PETSC_USE_COMPLEX)
416:   if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
417: #endif
418:     MatMult(K,xr,u);                 /* u=K*x */
419:     if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) {
420:       MatMult(C,xr,w);               /* w=C*x */
421:       VecAXPY(u,kr,w);               /* u=l*C*x+K*x */
422:       MatMult(M,xr,w);               /* w=M*x */
423:       VecAXPY(u,kr*kr,w);            /* u=l^2*M*x+l*C*x+K*x */
424:     }
425:     VecNorm(u,NORM_2,norm);
426: #if !defined(PETSC_USE_COMPLEX)
427:   } else {
428:     VecDuplicate(u,&v);
429:     VecDuplicate(u,&y);
430:     VecDuplicate(u,&z);
431:     a1 = kr*kr-ki*ki;
432:     a2 = 2.0*kr*ki;
433:     MatMult(K,xr,u);           /* u=K*xr */
434:     if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) {
435:       MatMult(C,xr,v);         /* v=C*xr */
436:       MatMult(C,xi,w);         /* w=C*xi */
437:       MatMult(M,xr,y);         /* y=M*xr */
438:       MatMult(M,xi,z);         /* z=M*xi */
439:       VecAXPY(u,kr,v);         /* u=kr*C*xr+K*xr */
440:       VecAXPY(u,-ki,w);        /* u=kr*C*xr-ki*C*xi+K*xr */
441:       VecAXPY(u,a1,y);         /* u=a1*M*xr+kr*C*xr-ki*C*xi+K*xr */
442:       VecAXPY(u,-a2,z);        /* u=a1*M*xr-a2*M*xi+kr*C*xr-ki*C*xi+K*xr */
443:     }
444:     VecNorm(u,NORM_2,&nr);
445:     MatMult(K,xi,u);         /* u=K*xi */
446:     if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) {
447:       VecAXPY(u,kr,w);         /* u=kr*C*xi+K*xi */
448:       VecAXPY(u,ki,v);         /* u=kr*C*xi+ki*C*xi+K*xi */
449:       VecAXPY(u,a1,z);         /* u=a1*M*xi+kr*C*xi+ki*C*xi+K*xi */
450:       VecAXPY(u,a2,y);         /* u=a1*M*xi+a2*M*ki+kr*C*xi+ki*C*xi+K*xi */
451:     }
452:     VecNorm(u,NORM_2,&ni);
453:     *norm = SlepcAbsEigenvalue(nr,ni);
454:     VecDestroy(&v);
455:     VecDestroy(&y);
456:     VecDestroy(&z);
457:   }
458: #endif

460:   VecDestroy(&w);
461:   VecDestroy(&u);
462:   return(0);
463: }

467: /*@
468:    QEPComputeResidualNorm - Computes the norm of the residual vector associated with
469:    the i-th computed eigenpair.

471:    Collective on QEP

473:    Input Parameter:
474: +  qep - the quadratic eigensolver context
475: -  i   - the solution index

477:    Output Parameter:
478: .  norm - the residual norm, computed as ||(l^2*M+l*C+K)x||_2 where l is the
479:    eigenvalue and x is the eigenvector.
480:    If l=0 then the residual norm is computed as ||Kx||_2.

482:    Notes:
483:    The index i should be a value between 0 and nconv-1 (see QEPGetConverged()).
484:    Eigenpairs are indexed according to the ordering criterion established
485:    with QEPSetWhichEigenpairs().

487:    Level: beginner

489: .seealso: QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs()
490: @*/
491: PetscErrorCode QEPComputeResidualNorm(QEP qep,PetscInt i,PetscReal *norm)
492: {
494:   Vec            xr,xi;
495:   PetscScalar    kr,ki;

501:   VecDuplicate(qep->V[0],&xr);
502:   VecDuplicate(qep->V[0],&xi);
503:   QEPGetEigenpair(qep,i,&kr,&ki,xr,xi);
504:   QEPComputeResidualNorm_Private(qep,kr,ki,xr,xi,norm);
505:   VecDestroy(&xr);
506:   VecDestroy(&xi);
507:   return(0);
508: }

512: /*
513:    QEPComputeRelativeError_Private - Computes the relative error bound
514:    associated with an eigenpair.
515: */
516: PetscErrorCode QEPComputeRelativeError_Private(QEP qep,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *error)
517: {
519:   PetscReal      norm,er;
520: #if !defined(PETSC_USE_COMPLEX)
521:   PetscReal      ei;
522: #endif

525:   QEPComputeResidualNorm_Private(qep,kr,ki,xr,xi,&norm);
526: #if !defined(PETSC_USE_COMPLEX)
527:   if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
528: #endif
529:     VecNorm(xr,NORM_2,&er);
530:     if (PetscAbsScalar(kr) > norm) {
531:       *error = norm/(PetscAbsScalar(kr)*er);
532:     } else {
533:       *error = norm/er;
534:     }
535: #if !defined(PETSC_USE_COMPLEX)
536:   } else {
537:     VecNorm(xr,NORM_2,&er);
538:     VecNorm(xi,NORM_2,&ei);
539:     if (SlepcAbsEigenvalue(kr,ki) > norm) {
540:       *error = norm/(SlepcAbsEigenvalue(kr,ki)*SlepcAbsEigenvalue(er,ei));
541:     } else {
542:       *error = norm/SlepcAbsEigenvalue(er,ei);
543:     }
544:   }
545: #endif
546:   return(0);
547: }

551: /*@
552:    QEPComputeRelativeError - Computes the relative error bound associated
553:    with the i-th computed eigenpair.

555:    Collective on QEP

557:    Input Parameter:
558: +  qep - the quadratic eigensolver context
559: -  i   - the solution index

561:    Output Parameter:
562: .  error - the relative error bound, computed as ||(l^2*M+l*C+K)x||_2/||lx||_2 where
563:    l is the eigenvalue and x is the eigenvector.
564:    If l=0 the relative error is computed as ||Kx||_2/||x||_2.

566:    Level: beginner

568: .seealso: QEPSolve(), QEPComputeResidualNorm(), QEPGetErrorEstimate()
569: @*/
570: PetscErrorCode QEPComputeRelativeError(QEP qep,PetscInt i,PetscReal *error)
571: {
573:   Vec            xr,xi;
574:   PetscScalar    kr,ki;

580:   VecDuplicate(qep->V[0],&xr);
581:   VecDuplicate(qep->V[0],&xi);
582:   QEPGetEigenpair(qep,i,&kr,&ki,xr,xi);
583:   QEPComputeRelativeError_Private(qep,kr,ki,xr,xi,error);
584:   VecDestroy(&xr);
585:   VecDestroy(&xi);
586:   return(0);
587: }

591: /*@
592:    QEPSortEigenvalues - Sorts a list of eigenvalues according to the criterion
593:    specified via QEPSetWhichEigenpairs().

595:    Not Collective

597:    Input Parameters:
598: +  qep   - the quadratic eigensolver context
599: .  n     - number of eigenvalues in the list
600: .  eigr  - pointer to the array containing the eigenvalues
601: -  eigi  - imaginary part of the eigenvalues (only when using real numbers)

603:    Output Parameter:
604: .  perm  - resulting permutation

606:    Note:
607:    The result is a list of indices in the original eigenvalue array
608:    corresponding to the first nev eigenvalues sorted in the specified
609:    criterion.

611:    Level: developer

613: .seealso: QEPSetWhichEigenpairs()
614: @*/
615: PetscErrorCode QEPSortEigenvalues(QEP qep,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)
616: {
618:   PetscScalar    re,im;
619:   PetscInt       i,j,result,tmp;

626:   for (i=0;i<n;i++) perm[i] = i;
627:   /* insertion sort */
628:   for (i=n-1; i>=0; i--) {
629:     re = eigr[perm[i]];
630:     im = eigi[perm[i]];
631:     j = i + 1;
632: #if !defined(PETSC_USE_COMPLEX)
633:     if (im != 0) {
634:       /* complex eigenvalue */
635:       i--;
636:       im = eigi[perm[i]];
637:     }
638: #endif
639:     while (j<n) {
640:       QEPCompareEigenvalues(qep,re,im,eigr[perm[j]],eigi[perm[j]],&result);
641:       if (result < 0) break;
642: #if !defined(PETSC_USE_COMPLEX)
643:       /* keep together every complex conjugated eigenpair */
644:       if (im == 0) {
645:         if (eigi[perm[j]] == 0) {
646: #endif
647:           tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = tmp;
648:           j++;
649: #if !defined(PETSC_USE_COMPLEX)
650:         } else {
651:           tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp;
652:           j+=2;
653:         }
654:       } else {
655:         if (eigi[perm[j]] == 0) {
656:           tmp = perm[j-2]; perm[j-2] = perm[j]; perm[j] = perm[j-1]; perm[j-1] = tmp;
657:           j++;
658:         } else {
659:           tmp = perm[j-2]; perm[j-2] = perm[j]; perm[j] = tmp;
660:           tmp = perm[j-1]; perm[j-1] = perm[j+1]; perm[j+1] = tmp;
661:           j+=2;
662:         }
663:       }
664: #endif
665:     }
666:   }
667:   return(0);
668: }

672: /*@
673:    QEPCompareEigenvalues - Compares two (possibly complex) eigenvalues according
674:    to a certain criterion.

676:    Not Collective

678:    Input Parameters:
679: +  qep    - the quadratic eigensolver context
680: .  ar     - real part of the 1st eigenvalue
681: .  ai     - imaginary part of the 1st eigenvalue
682: .  br     - real part of the 2nd eigenvalue
683: -  bi     - imaginary part of the 2nd eigenvalue

685:    Output Parameter:
686: .  res    - result of comparison

688:    Notes:
689:    Returns an integer less than, equal to, or greater than zero if the first
690:    eigenvalue is considered to be respectively less than, equal to, or greater
691:    than the second one.

693:    The criterion of comparison is related to the 'which' parameter set with
694:    QEPSetWhichEigenpairs().

696:    Level: developer

698: .seealso: QEPSortEigenvalues(), QEPSetWhichEigenpairs()
699: @*/
700: PetscErrorCode QEPCompareEigenvalues(QEP qep,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)
701: {

707:   if (!qep->comparison) SETERRQ(PETSC_COMM_SELF,1,"Undefined eigenvalue comparison function");
708:   (*qep->comparison)(ar,ai,br,bi,result,qep->comparisonctx);
709:   return(0);
710: }

714: /*@
715:    QEPGetOperationCounters - Gets the total number of matrix-vector products, dot
716:    products, and linear solve iterations used by the QEP object during the last
717:    QEPSolve() call.

719:    Not Collective

721:    Input Parameter:
722: .  qep - quadratic eigensolver context

724:    Output Parameter:
725: +  matvecs - number of matrix-vector product operations
726: .  dots    - number of dot product operations
727: -  lits    - number of linear iterations

729:    Notes:
730:    These counters are reset to zero at each successive call to QEPSolve().

732:    Level: intermediate

734: @*/
735: PetscErrorCode QEPGetOperationCounters(QEP qep,PetscInt* matvecs,PetscInt* dots,PetscInt* lits)
736: {

741:   if (matvecs) *matvecs = qep->matvecs;
742:   if (dots) {
743:     if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
744:     IPGetOperationCounters(qep->ip,dots);
745:   }
746:   if (lits) *lits = qep->linits;
747:   return(0);
748: }
slepc-3.4.2.dfsg.orig/src/qep/interface/qepdefault.c.html0000644000175000017500000002551112211062077022214 0ustar gladkgladk
Actual source code: qepdefault.c

  1: /*
  2:      This file contains some simple default routines for common QEP operations.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/qepimpl.h>     /*I "slepcqep.h" I*/
 25: #include <slepcblaslapack.h>

 29: PetscErrorCode QEPReset_Default(QEP qep)
 30: {

 34:   VecDestroyVecs(qep->nwork,&qep->work);
 35:   qep->nwork = 0;
 36:   QEPFreeSolution(qep);
 37:   return(0);
 38: }

 42: /*@
 43:    QEPSetWorkVecs - Sets a number of work vectors into a QEP object

 45:    Collective on QEP

 47:    Input Parameters:
 48: +  qep - quadratic eigensolver context
 49: -  nw  - number of work vectors to allocate

 51:    Developers Note:
 52:    This is PETSC_EXTERN because it may be required by user plugin QEP
 53:    implementations.

 55:    Level: developer
 56: @*/
 57: PetscErrorCode QEPSetWorkVecs(QEP qep,PetscInt nw)
 58: {

 62:   if (qep->nwork != nw) {
 63:     VecDestroyVecs(qep->nwork,&qep->work);
 64:     qep->nwork = nw;
 65:     VecDuplicateVecs(qep->t,nw,&qep->work);
 66:     PetscLogObjectParents(qep,nw,qep->work);
 67:   }
 68:   return(0);
 69: }

 73: /*
 74:   QEPConvergedDefault - Checks convergence relative to the eigenvalue.
 75: */
 76: PetscErrorCode QEPConvergedDefault(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
 77: {
 78:   PetscReal w;

 81:   w = SlepcAbsEigenvalue(eigr,eigi);
 82:   *errest = res/w;
 83:   return(0);
 84: }

 88: /*
 89:   QEPConvergedAbsolute - Checks convergence absolutely.
 90: */
 91: PetscErrorCode QEPConvergedAbsolute(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
 92: {
 94:   *errest = res;
 95:   return(0);
 96: }

100: PetscErrorCode QEPComputeVectors_Schur(QEP qep)
101: {
103:   PetscInt       n,ld;
104:   PetscScalar    *Z;

107:   DSGetLeadingDimension(qep->ds,&ld);
108:   DSGetDimensions(qep->ds,&n,NULL,NULL,NULL,NULL);

110:   /* right eigenvectors */
111:   DSVectors(qep->ds,DS_MAT_X,NULL,NULL);

113:   /* AV = V * Z */
114:   DSGetArray(qep->ds,DS_MAT_X,&Z);
115:   SlepcUpdateVectors(n,qep->V,0,n,Z,ld,PETSC_FALSE);
116:   DSRestoreArray(qep->ds,DS_MAT_X,&Z);
117:   return(0);
118: }

122: /*
123:    QEPKrylovConvergence - This is the analogue to EPSKrylovConvergence, but
124:    for quadratic Krylov methods.

126:    Differences:
127:    - Always non-symmetric
128:    - Does not check for STSHIFT
129:    - No correction factor
130:    - No support for true residual
131: */
132: PetscErrorCode QEPKrylovConvergence(QEP qep,PetscBool getall,PetscInt kini,PetscInt nits,PetscInt nv,PetscReal beta,PetscInt *kout)
133: {
135:   PetscInt       k,newk,marker,ld;
136:   PetscScalar    re,im;
137:   PetscReal      resnorm;

140:   DSGetLeadingDimension(qep->ds,&ld);
141:   marker = -1;
142:   if (qep->trackall) getall = PETSC_TRUE;
143:   for (k=kini;k<kini+nits;k++) {
144:     /* eigenvalue */
145:     re = qep->eigr[k];
146:     im = qep->eigi[k];
147:     newk = k;
148:     DSVectors(qep->ds,DS_MAT_X,&newk,&resnorm);
149:     resnorm *= beta;
150:     /* error estimate */
151:     (*qep->converged)(qep,re,im,resnorm,&qep->errest[k],qep->convergedctx);
152:     if (marker==-1 && qep->errest[k] >= qep->tol) marker = k;
153:     if (newk==k+1) {
154:       qep->errest[k+1] = qep->errest[k];
155:       k++;
156:     }
157:     if (marker!=-1 && !getall) break;
158:   }
159:   if (marker!=-1) k = marker;
160:   *kout = k;
161:   return(0);
162: }

slepc-3.4.2.dfsg.orig/src/qep/interface/qepmon.c0000644000175000017500000003311112211062077020411 0ustar gladkgladk/* QEP routines related to monitors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "QEPMonitor" /* Runs the user provided monitor routines, if any. */ PetscErrorCode QEPMonitor(QEP qep,PetscInt it,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest) { PetscErrorCode ierr; PetscInt i,n = qep->numbermonitors; PetscFunctionBegin; for (i=0;imonitor[i])(qep,it,nconv,eigr,eigi,errest,nest,qep->monitorcontext[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorSet" /*@C QEPMonitorSet - Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair. Logically Collective on QEP Input Parameters: + qep - eigensolver context obtained from QEPCreate() . monitor - pointer to function (if this is NULL, it turns off monitoring) . mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired) - monitordestroy - [optional] routine that frees monitor context (may be NULL) Calling Sequence of monitor: $ monitor (QEP qep, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx) + qep - quadratic eigensolver context obtained from QEPCreate() . its - iteration number . nconv - number of converged eigenpairs . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - relative error estimates for each eigenpair . nest - number of error estimates - mctx - optional monitoring context, as set by QEPMonitorSet() Options Database Keys: + -qep_monitor - print only the first error estimate . -qep_monitor_all - print error estimates at each iteration . -qep_monitor_conv - print the eigenvalue approximations only when convergence has been reached . -qep_monitor_lg - sets line graph monitor for the first unconverged approximate eigenvalue . -qep_monitor_lg_all - sets line graph monitor for all unconverged approximate eigenvalues - -qep_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to QEPMonitorSet(), but does not cancel those set via the options database. Notes: Several different monitoring routines may be set by calling QEPMonitorSet() multiple times; all will be called in the order in which they were set. Level: intermediate .seealso: QEPMonitorFirst(), QEPMonitorAll(), QEPMonitorCancel() @*/ PetscErrorCode QEPMonitorSet(QEP qep,PetscErrorCode (*monitor)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**)) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (qep->numbermonitors >= MAXQEPMONITORS) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Too many QEP monitors set"); qep->monitor[qep->numbermonitors] = monitor; qep->monitorcontext[qep->numbermonitors] = (void*)mctx; qep->monitordestroy[qep->numbermonitors++] = monitordestroy; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorCancel" /*@ QEPMonitorCancel - Clears all monitors for a QEP object. Logically Collective on QEP Input Parameters: . qep - eigensolver context obtained from QEPCreate() Options Database Key: . -qep_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to QEPMonitorSet(), but does not cancel those set via the options database. Level: intermediate .seealso: QEPMonitorSet() @*/ PetscErrorCode QEPMonitorCancel(QEP qep) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); for (i=0; inumbermonitors; i++) { if (qep->monitordestroy[i]) { ierr = (*qep->monitordestroy[i])(&qep->monitorcontext[i]);CHKERRQ(ierr); } } qep->numbermonitors = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetMonitorContext" /*@C QEPGetMonitorContext - Gets the monitor context, as set by QEPMonitorSet() for the FIRST monitor only. Not Collective Input Parameter: . qep - eigensolver context obtained from QEPCreate() Output Parameter: . ctx - monitor context Level: intermediate .seealso: QEPMonitorSet(), QEPDefaultMonitor() @*/ PetscErrorCode QEPGetMonitorContext(QEP qep,void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); *ctx = qep->monitorcontext[0]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorAll" /*@C QEPMonitorAll - Print the current approximate values and error estimates at each iteration of the quadratic eigensolver. Collective on QEP Input Parameters: + qep - quadratic eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorConverged() @*/ PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep)); PetscFunctionBegin; if (its) { ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D QEP nconv=%D Values (Errors)",its,nconv);CHKERRQ(ierr); for (i=0;itablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorFirst" /*@C QEPMonitorFirst - Print the first unconverged approximate value and error estimate at each iteration of the quadratic eigensolver. Collective on QEP Input Parameters: + qep - quadratic eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: QEPMonitorSet(), QEPMonitorAll(), QEPMonitorConverged() @*/ PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep)); PetscFunctionBegin; if (its && nconvtablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D QEP nconv=%D first unconverged value (error)",its,nconv);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eigr[nconv]),PetscImaginaryPart(eigr[nconv]));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",eigr[nconv]);CHKERRQ(ierr); if (eigi[nconv]!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",eigi[nconv]);CHKERRQ(ierr); } #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[nconv]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorConverged" /*@C QEPMonitorConverged - Print the approximate values and error estimates as they converge. Collective on QEP Input Parameters: + qep - quadratic eigensolver context . its - iteration number . nconv - number of converged eigenpairs so far . eigr - real part of the eigenvalues . eigi - imaginary part of the eigenvalues . errest - error estimates . nest - number of error estimates to display - monctx - monitor context Level: intermediate Note: The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT. .seealso: QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorAll() @*/ PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscViewer viewer; SlepcConvMonitor ctx = (SlepcConvMonitor)monctx; PetscFunctionBegin; if (!monctx) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"Must provide a context for QEPMonitorConverged"); if (!its) { ctx->oldnconv = 0; } else { viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep)); for (i=ctx->oldnconv;itablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D QEP converged value (error) #%D",its,i);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));CHKERRQ(ierr); #else ierr = PetscViewerASCIIPrintf(viewer," %G",eigr[i]);CHKERRQ(ierr); if (eigi[i]!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",eigi[i]);CHKERRQ(ierr); } #endif ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr); } ctx->oldnconv = nconv; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorLG" PetscErrorCode QEPMonitorLG(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw; PetscDrawLG lg; PetscErrorCode ierr; PetscReal x,y; PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)qep)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(qep->tol)-2,0.0);CHKERRQ(ierr); } x = (PetscReal)its; if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0; ierr = PetscDrawLGAddPoint(lg,&x,&y);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPMonitorLGAll" PetscErrorCode QEPMonitorLGAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw; PetscDrawLG lg; PetscErrorCode ierr; PetscReal *x,*y; PetscInt i,n = PetscMin(qep->nev,255); PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)qep)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,n);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(qep->tol)-2,0.0);CHKERRQ(ierr); } ierr = PetscMalloc(sizeof(PetscReal)*n,&x);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscReal)*n,&y);CHKERRQ(ierr); for (i=0;i 0.0) y[i] = log10(errest[i]); else y[i] = 0.0; } ierr = PetscDrawLGAddPoint(lg,x,y);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); ierr = PetscFree(x);CHKERRQ(ierr); ierr = PetscFree(y);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepregis.c0000644000175000017500000000322512211062077020734 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ PETSC_EXTERN PetscErrorCode QEPCreate_Linear(QEP); PETSC_EXTERN PetscErrorCode QEPCreate_QArnoldi(QEP); PETSC_EXTERN PetscErrorCode QEPCreate_QLanczos(QEP); #undef __FUNCT__ #define __FUNCT__ "QEPRegisterAll" /*@C QEPRegisterAll - Registers all the solvers in the QEP package. Not Collective Level: advanced .seealso: QEPRegister() @*/ PetscErrorCode QEPRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; QEPRegisterAllCalled = PETSC_TRUE; ierr = QEPRegister(QEPLINEAR,QEPCreate_Linear);CHKERRQ(ierr); ierr = QEPRegister(QEPQARNOLDI,QEPCreate_QArnoldi);CHKERRQ(ierr); ierr = QEPRegister(QEPQLANCZOS,QEPCreate_QLanczos);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepsolve.c0000644000175000017500000005727312211062077020767 0ustar gladkgladk/* QEP routines related to the solution process. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include typedef struct { PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); void *comparisonctx; ST st; } QEPSortForSTData; #undef __FUNCT__ #define __FUNCT__ "QEPSortForSTFunc" static PetscErrorCode QEPSortForSTFunc(PetscScalar ar,PetscScalar ai, PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx) { QEPSortForSTData *data = (QEPSortForSTData*)ctx; PetscErrorCode ierr; PetscFunctionBegin; ierr = STBackTransform(data->st,1,&ar,&ai);CHKERRQ(ierr); ierr = STBackTransform(data->st,1,&br,&bi);CHKERRQ(ierr); ierr = (*data->comparison)(ar,ai,br,bi,r,data->comparisonctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSolve" /*@ QEPSolve - Solves the quadratic eigensystem. Collective on QEP Input Parameter: . qep - eigensolver context obtained from QEPCreate() Options Database Keys: + -qep_view - print information about the solver used . -qep_view_mat0 binary - save the first matrix (M) to the default binary viewer . -qep_view_mat1 binary - save the second matrix (C) to the default binary viewer . -qep_view_mat2 binary - save the third matrix (K) to the default binary viewer - -qep_plot_eigs - plot computed eigenvalues Level: beginner .seealso: QEPCreate(), QEPSetUp(), QEPDestroy(), QEPSetTolerances() @*/ PetscErrorCode QEPSolve(QEP qep) { PetscErrorCode ierr; PetscInt i; PetscReal re,im; PetscBool flg,islinear; PetscViewer viewer; PetscViewerFormat format; PetscDraw draw; PetscDrawSP drawsp; QEPSortForSTData data; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); ierr = PetscLogEventBegin(QEP_Solve,qep,0,0,0);CHKERRQ(ierr); /* call setup */ ierr = QEPSetUp(qep);CHKERRQ(ierr); qep->nconv = 0; qep->its = 0; for (i=0;incv;i++) { qep->eigr[i] = 0.0; qep->eigi[i] = 0.0; qep->errest[i] = 0.0; } ierr = QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,qep->ncv);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&islinear);CHKERRQ(ierr); if (!islinear) { /* temporarily change eigenvalue comparison function */ data.comparison = qep->comparison; data.comparisonctx = qep->comparisonctx; data.st = qep->st; qep->comparison = QEPSortForSTFunc; qep->comparisonctx = &data; } ierr = DSSetEigenvalueComparison(qep->ds,qep->comparison,qep->comparisonctx);CHKERRQ(ierr); ierr = (*qep->ops->solve)(qep);CHKERRQ(ierr); if (!islinear) { ierr = STPostSolve(qep->st);CHKERRQ(ierr); } if (!qep->reason) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_PLIB,"Internal error, solver returned without setting converged reason"); if (!islinear) { /* restore comparison function */ qep->comparison = data.comparison; qep->comparisonctx = data.comparisonctx; /* Map eigenvalues back to the original problem */ ierr = STBackTransform(qep->st,qep->nconv,qep->eigr,qep->eigi);CHKERRQ(ierr); } #if !defined(PETSC_USE_COMPLEX) /* reorder conjugate eigenvalues (positive imaginary first) */ for (i=0;inconv-1;i++) { if (qep->eigi[i] != 0) { if (qep->eigi[i] < 0) { qep->eigi[i] = -qep->eigi[i]; qep->eigi[i+1] = -qep->eigi[i+1]; ierr = VecScale(qep->V[i+1],-1.0);CHKERRQ(ierr); } i++; } } #endif /* sort eigenvalues according to qep->which parameter */ ierr = QEPSortEigenvalues(qep,qep->nconv,qep->eigr,qep->eigi,qep->perm);CHKERRQ(ierr); ierr = PetscLogEventEnd(QEP_Solve,qep,0,0,0);CHKERRQ(ierr); /* various viewers */ ierr = MatViewFromOptions(qep->M,((PetscObject)qep)->prefix,"-qep_view_mat0");CHKERRQ(ierr); ierr = MatViewFromOptions(qep->C,((PetscObject)qep)->prefix,"-qep_view_mat1");CHKERRQ(ierr); ierr = MatViewFromOptions(qep->K,((PetscObject)qep)->prefix,"-qep_view_mat2");CHKERRQ(ierr); ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)qep),((PetscObject)qep)->prefix,"-qep_view",&viewer,&format,&flg);CHKERRQ(ierr); if (flg && !PetscPreLoadingOn) { ierr = PetscViewerPushFormat(viewer,format);CHKERRQ(ierr); ierr = QEPView(qep,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsGetBool(((PetscObject)qep)->prefix,"-qep_plot_eigs",&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);CHKERRQ(ierr); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscDrawSPCreate(draw,1,&drawsp);CHKERRQ(ierr); for (i=0;inconv;i++) { #if defined(PETSC_USE_COMPLEX) re = PetscRealPart(qep->eigr[i]); im = PetscImaginaryPart(qep->eigi[i]); #else re = qep->eigr[i]; im = qep->eigi[i]; #endif ierr = PetscDrawSPAddPoint(drawsp,&re,&im);CHKERRQ(ierr); } ierr = PetscDrawSPDraw(drawsp,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscDrawSPDestroy(&drawsp);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } /* Remove the initial subspace */ qep->nini = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetIterationNumber" /*@ QEPGetIterationNumber - Gets the current iteration number. If the call to QEPSolve() is complete, then it returns the number of iterations carried out by the solution method. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameter: . its - number of iterations Level: intermediate Note: During the i-th iteration this call returns i-1. If QEPSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call QEPGetConvergedReason() to determine if the solver converged or failed and why. .seealso: QEPGetConvergedReason(), QEPSetTolerances() @*/ PetscErrorCode QEPGetIterationNumber(QEP qep,PetscInt *its) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidIntPointer(its,2); *its = qep->its; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetConverged" /*@ QEPGetConverged - Gets the number of converged eigenpairs. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameter: . nconv - number of converged eigenpairs Note: This function should be called after QEPSolve() has finished. Level: beginner .seealso: QEPSetDimensions(), QEPSolve() @*/ PetscErrorCode QEPGetConverged(QEP qep,PetscInt *nconv) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidIntPointer(nconv,2); *nconv = qep->nconv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetConvergedReason" /*@C QEPGetConvergedReason - Gets the reason why the QEPSolve() iteration was stopped. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameter: . reason - negative value indicates diverged, positive value converged Possible values for reason: + QEP_CONVERGED_TOL - converged up to tolerance . QEP_DIVERGED_ITS - required more than its to reach convergence - QEP_DIVERGED_BREAKDOWN - generic breakdown in method Note: Can only be called after the call to QEPSolve() is complete. Level: intermediate .seealso: QEPSetTolerances(), QEPSolve(), QEPConvergedReason @*/ PetscErrorCode QEPGetConvergedReason(QEP qep,QEPConvergedReason *reason) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(reason,2); *reason = qep->reason; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetEigenpair" /*@ QEPGetEigenpair - Gets the i-th solution of the eigenproblem as computed by QEPSolve(). The solution consists in both the eigenvalue and the eigenvector. Logically Collective on EPS Input Parameters: + qep - quadratic eigensolver context - i - index of the solution Output Parameters: + eigr - real part of eigenvalue . eigi - imaginary part of eigenvalue . Vr - real part of eigenvector - Vi - imaginary part of eigenvector Notes: If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is configured with complex scalars the eigenvalue is stored directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is set to zero). The index i should be a value between 0 and nconv-1 (see QEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with QEPSetWhichEigenpairs(). Level: beginner .seealso: QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs() @*/ PetscErrorCode QEPGetEigenpair(QEP qep,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi) { PetscInt k; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,i,2); if (Vr) { PetscValidHeaderSpecific(Vr,VEC_CLASSID,6); PetscCheckSameComm(qep,1,Vr,6); } if (Vi) { PetscValidHeaderSpecific(Vi,VEC_CLASSID,7); PetscCheckSameComm(qep,1,Vi,7); } if (!qep->eigr || !qep->eigi || !qep->V) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONGSTATE,"QEPSolve must be called first"); if (i<0 || i>=qep->nconv) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (!qep->perm) k = i; else k = qep->perm[i]; /* eigenvalue */ #if defined(PETSC_USE_COMPLEX) if (eigr) *eigr = qep->eigr[k]; if (eigi) *eigi = 0; #else if (eigr) *eigr = qep->eigr[k]; if (eigi) *eigi = qep->eigi[k]; #endif /* eigenvector */ #if defined(PETSC_USE_COMPLEX) if (Vr) { ierr = VecCopy(qep->V[k],Vr);CHKERRQ(ierr); } if (Vi) { ierr = VecSet(Vi,0.0);CHKERRQ(ierr); } #else if (qep->eigi[k]>0) { /* first value of conjugate pair */ if (Vr) { ierr = VecCopy(qep->V[k],Vr);CHKERRQ(ierr); } if (Vi) { ierr = VecCopy(qep->V[k+1],Vi);CHKERRQ(ierr); } } else if (qep->eigi[k]<0) { /* second value of conjugate pair */ if (Vr) { ierr = VecCopy(qep->V[k-1],Vr);CHKERRQ(ierr); } if (Vi) { ierr = VecCopy(qep->V[k],Vi);CHKERRQ(ierr); ierr = VecScale(Vi,-1.0);CHKERRQ(ierr); } } else { /* real eigenvalue */ if (Vr) { ierr = VecCopy(qep->V[k],Vr);CHKERRQ(ierr); } if (Vi) { ierr = VecSet(Vi,0.0);CHKERRQ(ierr); } } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetErrorEstimate" /*@ QEPGetErrorEstimate - Returns the error estimate associated to the i-th computed eigenpair. Not Collective Input Parameter: + qep - quadratic eigensolver context - i - index of eigenpair Output Parameter: . errest - the error estimate Notes: This is the error estimate used internally by the eigensolver. The actual error bound can be computed with QEPComputeRelativeError(). See also the users manual for details. Level: advanced .seealso: QEPComputeRelativeError() @*/ PetscErrorCode QEPGetErrorEstimate(QEP qep,PetscInt i,PetscReal *errest) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(errest,3); if (!qep->eigr || !qep->eigi) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"QEPSolve must be called first"); if (i<0 || i>=qep->nconv) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); if (qep->perm) i = qep->perm[i]; if (errest) *errest = qep->errest[i]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPComputeResidualNorm_Private" /* QEPComputeResidualNorm_Private - Computes the norm of the residual vector associated with an eigenpair. */ PetscErrorCode QEPComputeResidualNorm_Private(QEP qep,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *norm) { PetscErrorCode ierr; Vec u,w; Mat M=qep->M,C=qep->C,K=qep->K; #if !defined(PETSC_USE_COMPLEX) Vec v,y,z; PetscReal ni,nr; PetscScalar a1,a2; #endif PetscFunctionBegin; ierr = VecDuplicate(qep->V[0],&u);CHKERRQ(ierr); ierr = VecDuplicate(u,&w);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) { #endif ierr = MatMult(K,xr,u);CHKERRQ(ierr); /* u=K*x */ if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) { ierr = MatMult(C,xr,w);CHKERRQ(ierr); /* w=C*x */ ierr = VecAXPY(u,kr,w);CHKERRQ(ierr); /* u=l*C*x+K*x */ ierr = MatMult(M,xr,w);CHKERRQ(ierr); /* w=M*x */ ierr = VecAXPY(u,kr*kr,w);CHKERRQ(ierr); /* u=l^2*M*x+l*C*x+K*x */ } ierr = VecNorm(u,NORM_2,norm);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) } else { ierr = VecDuplicate(u,&v);CHKERRQ(ierr); ierr = VecDuplicate(u,&y);CHKERRQ(ierr); ierr = VecDuplicate(u,&z);CHKERRQ(ierr); a1 = kr*kr-ki*ki; a2 = 2.0*kr*ki; ierr = MatMult(K,xr,u);CHKERRQ(ierr); /* u=K*xr */ if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) { ierr = MatMult(C,xr,v);CHKERRQ(ierr); /* v=C*xr */ ierr = MatMult(C,xi,w);CHKERRQ(ierr); /* w=C*xi */ ierr = MatMult(M,xr,y);CHKERRQ(ierr); /* y=M*xr */ ierr = MatMult(M,xi,z);CHKERRQ(ierr); /* z=M*xi */ ierr = VecAXPY(u,kr,v);CHKERRQ(ierr); /* u=kr*C*xr+K*xr */ ierr = VecAXPY(u,-ki,w);CHKERRQ(ierr); /* u=kr*C*xr-ki*C*xi+K*xr */ ierr = VecAXPY(u,a1,y);CHKERRQ(ierr); /* u=a1*M*xr+kr*C*xr-ki*C*xi+K*xr */ ierr = VecAXPY(u,-a2,z);CHKERRQ(ierr); /* u=a1*M*xr-a2*M*xi+kr*C*xr-ki*C*xi+K*xr */ } ierr = VecNorm(u,NORM_2,&nr);CHKERRQ(ierr); ierr = MatMult(K,xi,u);CHKERRQ(ierr); /* u=K*xi */ if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) { ierr = VecAXPY(u,kr,w);CHKERRQ(ierr); /* u=kr*C*xi+K*xi */ ierr = VecAXPY(u,ki,v);CHKERRQ(ierr); /* u=kr*C*xi+ki*C*xi+K*xi */ ierr = VecAXPY(u,a1,z);CHKERRQ(ierr); /* u=a1*M*xi+kr*C*xi+ki*C*xi+K*xi */ ierr = VecAXPY(u,a2,y);CHKERRQ(ierr); /* u=a1*M*xi+a2*M*ki+kr*C*xi+ki*C*xi+K*xi */ } ierr = VecNorm(u,NORM_2,&ni);CHKERRQ(ierr); *norm = SlepcAbsEigenvalue(nr,ni); ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); ierr = VecDestroy(&z);CHKERRQ(ierr); } #endif ierr = VecDestroy(&w);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPComputeResidualNorm" /*@ QEPComputeResidualNorm - Computes the norm of the residual vector associated with the i-th computed eigenpair. Collective on QEP Input Parameter: + qep - the quadratic eigensolver context - i - the solution index Output Parameter: . norm - the residual norm, computed as ||(l^2*M+l*C+K)x||_2 where l is the eigenvalue and x is the eigenvector. If l=0 then the residual norm is computed as ||Kx||_2. Notes: The index i should be a value between 0 and nconv-1 (see QEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with QEPSetWhichEigenpairs(). Level: beginner .seealso: QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs() @*/ PetscErrorCode QEPComputeResidualNorm(QEP qep,PetscInt i,PetscReal *norm) { PetscErrorCode ierr; Vec xr,xi; PetscScalar kr,ki; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,i,2); PetscValidPointer(norm,3); ierr = VecDuplicate(qep->V[0],&xr);CHKERRQ(ierr); ierr = VecDuplicate(qep->V[0],&xi);CHKERRQ(ierr); ierr = QEPGetEigenpair(qep,i,&kr,&ki,xr,xi);CHKERRQ(ierr); ierr = QEPComputeResidualNorm_Private(qep,kr,ki,xr,xi,norm);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPComputeRelativeError_Private" /* QEPComputeRelativeError_Private - Computes the relative error bound associated with an eigenpair. */ PetscErrorCode QEPComputeRelativeError_Private(QEP qep,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *error) { PetscErrorCode ierr; PetscReal norm,er; #if !defined(PETSC_USE_COMPLEX) PetscReal ei; #endif PetscFunctionBegin; ierr = QEPComputeResidualNorm_Private(qep,kr,ki,xr,xi,&norm);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) if (ki == 0 || PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) { #endif ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr); if (PetscAbsScalar(kr) > norm) { *error = norm/(PetscAbsScalar(kr)*er); } else { *error = norm/er; } #if !defined(PETSC_USE_COMPLEX) } else { ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr); ierr = VecNorm(xi,NORM_2,&ei);CHKERRQ(ierr); if (SlepcAbsEigenvalue(kr,ki) > norm) { *error = norm/(SlepcAbsEigenvalue(kr,ki)*SlepcAbsEigenvalue(er,ei)); } else { *error = norm/SlepcAbsEigenvalue(er,ei); } } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPComputeRelativeError" /*@ QEPComputeRelativeError - Computes the relative error bound associated with the i-th computed eigenpair. Collective on QEP Input Parameter: + qep - the quadratic eigensolver context - i - the solution index Output Parameter: . error - the relative error bound, computed as ||(l^2*M+l*C+K)x||_2/||lx||_2 where l is the eigenvalue and x is the eigenvector. If l=0 the relative error is computed as ||Kx||_2/||x||_2. Level: beginner .seealso: QEPSolve(), QEPComputeResidualNorm(), QEPGetErrorEstimate() @*/ PetscErrorCode QEPComputeRelativeError(QEP qep,PetscInt i,PetscReal *error) { PetscErrorCode ierr; Vec xr,xi; PetscScalar kr,ki; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,i,2); PetscValidPointer(error,3); ierr = VecDuplicate(qep->V[0],&xr);CHKERRQ(ierr); ierr = VecDuplicate(qep->V[0],&xi);CHKERRQ(ierr); ierr = QEPGetEigenpair(qep,i,&kr,&ki,xr,xi);CHKERRQ(ierr); ierr = QEPComputeRelativeError_Private(qep,kr,ki,xr,xi,error);CHKERRQ(ierr); ierr = VecDestroy(&xr);CHKERRQ(ierr); ierr = VecDestroy(&xi);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSortEigenvalues" /*@ QEPSortEigenvalues - Sorts a list of eigenvalues according to the criterion specified via QEPSetWhichEigenpairs(). Not Collective Input Parameters: + qep - the quadratic eigensolver context . n - number of eigenvalues in the list . eigr - pointer to the array containing the eigenvalues - eigi - imaginary part of the eigenvalues (only when using real numbers) Output Parameter: . perm - resulting permutation Note: The result is a list of indices in the original eigenvalue array corresponding to the first nev eigenvalues sorted in the specified criterion. Level: developer .seealso: QEPSetWhichEigenpairs() @*/ PetscErrorCode QEPSortEigenvalues(QEP qep,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm) { PetscErrorCode ierr; PetscScalar re,im; PetscInt i,j,result,tmp; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidScalarPointer(eigr,3); PetscValidScalarPointer(eigi,4); PetscValidIntPointer(perm,5); for (i=0;i=0; i--) { re = eigr[perm[i]]; im = eigi[perm[i]]; j = i + 1; #if !defined(PETSC_USE_COMPLEX) if (im != 0) { /* complex eigenvalue */ i--; im = eigi[perm[i]]; } #endif while (jcomparison) SETERRQ(PETSC_COMM_SELF,1,"Undefined eigenvalue comparison function"); ierr = (*qep->comparison)(ar,ai,br,bi,result,qep->comparisonctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetOperationCounters" /*@ QEPGetOperationCounters - Gets the total number of matrix-vector products, dot products, and linear solve iterations used by the QEP object during the last QEPSolve() call. Not Collective Input Parameter: . qep - quadratic eigensolver context Output Parameter: + matvecs - number of matrix-vector product operations . dots - number of dot product operations - lits - number of linear iterations Notes: These counters are reset to zero at each successive call to QEPSolve(). Level: intermediate @*/ PetscErrorCode QEPGetOperationCounters(QEP qep,PetscInt* matvecs,PetscInt* dots,PetscInt* lits) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (matvecs) *matvecs = qep->matvecs; if (dots) { if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } ierr = IPGetOperationCounters(qep->ip,dots);CHKERRQ(ierr); } if (lits) *lits = qep->linits; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepopts.c.html0000644000175000017500000023055312211062077021561 0ustar gladkgladk
Actual source code: qepopts.c

  1: /*
  2:       QEP routines related to options that can be set via the command-line
  3:       or procedurally.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/qepimpl.h>       /*I "slepcqep.h" I*/

 29: /*@
 30:    QEPSetFromOptions - Sets QEP options from the options database.
 31:    This routine must be called before QEPSetUp() if the user is to be
 32:    allowed to set the solver type.

 34:    Collective on QEP

 36:    Input Parameters:
 37: .  qep - the quadratic eigensolver context

 39:    Notes:
 40:    To see all options, run your program with the -help option.

 42:    Level: beginner
 43: @*/
 44: PetscErrorCode QEPSetFromOptions(QEP qep)
 45: {
 46:   PetscErrorCode   ierr;
 47:   char             type[256],monfilename[PETSC_MAX_PATH_LEN];
 48:   PetscBool        flg,val;
 49:   PetscReal        r;
 50:   PetscScalar      s;
 51:   PetscInt         i,j,k;
 52:   PetscViewer      monviewer;
 53:   SlepcConvMonitor ctx;

 57:   if (!QEPRegisterAllCalled) { QEPRegisterAll(); }
 58:   PetscObjectOptionsBegin((PetscObject)qep);
 59:     PetscOptionsList("-qep_type","Quadratic Eigenvalue Problem method","QEPSetType",QEPList,(char*)(((PetscObject)qep)->type_name?((PetscObject)qep)->type_name:QEPLINEAR),type,256,&flg);
 60:     if (flg) {
 61:       QEPSetType(qep,type);
 62:     } else if (!((PetscObject)qep)->type_name) {
 63:       QEPSetType(qep,QEPLINEAR);
 64:     }

 66:     PetscOptionsBoolGroupBegin("-qep_general","general quadratic eigenvalue problem","QEPSetProblemType",&flg);
 67:     if (flg) { QEPSetProblemType(qep,QEP_GENERAL); }
 68:     PetscOptionsBoolGroup("-qep_hermitian","hermitian quadratic eigenvalue problem","QEPSetProblemType",&flg);
 69:     if (flg) { QEPSetProblemType(qep,QEP_HERMITIAN); }
 70:     PetscOptionsBoolGroupEnd("-qep_gyroscopic","gyroscopic quadratic eigenvalue problem","QEPSetProblemType",&flg);
 71:     if (flg) { QEPSetProblemType(qep,QEP_GYROSCOPIC); }

 73:     r = 0;
 74:     PetscOptionsReal("-qep_scale","Scale factor","QEPSetScaleFactor",qep->sfactor,&r,NULL);
 75:     QEPSetScaleFactor(qep,r);

 77:     r = i = 0;
 78:     PetscOptionsInt("-qep_max_it","Maximum number of iterations","QEPSetTolerances",qep->max_it,&i,NULL);
 79:     PetscOptionsReal("-qep_tol","Tolerance","QEPSetTolerances",qep->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:qep->tol,&r,NULL);
 80:     QEPSetTolerances(qep,r,i);
 81:     PetscOptionsBoolGroupBegin("-qep_convergence_default","Default (relative error) convergence test","QEPSetConvergenceTest",&flg);
 82:     if (flg) { QEPSetConvergenceTest(qep,QEPConvergedDefault,NULL); }
 83:     PetscOptionsBoolGroupEnd("-qep_convergence_absolute","Absolute error convergence test","QEPSetConvergenceTest",&flg);
 84:     if (flg) { QEPSetConvergenceTest(qep,QEPConvergedAbsolute,NULL); }

 86:     i = j = k = 0;
 87:     PetscOptionsInt("-qep_nev","Number of eigenvalues to compute","QEPSetDimensions",qep->nev,&i,NULL);
 88:     PetscOptionsInt("-qep_ncv","Number of basis vectors","QEPSetDimensions",qep->ncv,&j,NULL);
 89:     PetscOptionsInt("-qep_mpd","Maximum dimension of projected problem","QEPSetDimensions",qep->mpd,&k,NULL);
 90:     QEPSetDimensions(qep,i,j,k);

 92:     PetscOptionsScalar("-qep_target","Value of the target","QEPSetTarget",qep->target,&s,&flg);
 93:     if (flg) {
 94:       QEPSetWhichEigenpairs(qep,QEP_TARGET_MAGNITUDE);
 95:       QEPSetTarget(qep,s);
 96:     }

 98:     /* -----------------------------------------------------------------------*/
 99:     /*
100:       Cancels all monitors hardwired into code before call to QEPSetFromOptions()
101:     */
102:     flg  = PETSC_FALSE;
103:     PetscOptionsBool("-qep_monitor_cancel","Remove any hardwired monitor routines","QEPMonitorCancel",flg,&flg,NULL);
104:     if (flg) {
105:       QEPMonitorCancel(qep);
106:     }
107:     /*
108:       Prints approximate eigenvalues and error estimates at each iteration
109:     */
110:     PetscOptionsString("-qep_monitor","Monitor first unconverged approximate eigenvalue and error estimate","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
111:     if (flg) {
112:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)qep),monfilename,&monviewer);
113:       QEPMonitorSet(qep,QEPMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
114:     }
115:     PetscOptionsString("-qep_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
116:     if (flg) {
117:       PetscNew(struct _n_SlepcConvMonitor,&ctx);
118:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)qep),monfilename,&ctx->viewer);
119:       QEPMonitorSet(qep,QEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
120:     }
121:     PetscOptionsString("-qep_monitor_all","Monitor approximate eigenvalues and error estimates","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
122:     if (flg) {
123:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)qep),monfilename,&monviewer);
124:       QEPMonitorSet(qep,QEPMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
125:       QEPSetTrackAll(qep,PETSC_TRUE);
126:     }
127:     flg = PETSC_FALSE;
128:     PetscOptionsBool("-qep_monitor_lg","Monitor first unconverged approximate error estimate graphically","QEPMonitorSet",flg,&flg,NULL);
129:     if (flg) {
130:       QEPMonitorSet(qep,QEPMonitorLG,NULL,NULL);
131:     }
132:     flg = PETSC_FALSE;
133:     PetscOptionsBool("-qep_monitor_lg_all","Monitor error estimates graphically","QEPMonitorSet",flg,&flg,NULL);
134:     if (flg) {
135:       QEPMonitorSet(qep,QEPMonitorLGAll,NULL,NULL);
136:       QEPSetTrackAll(qep,PETSC_TRUE);
137:     }
138:   /* -----------------------------------------------------------------------*/

140:     PetscOptionsBoolGroupBegin("-qep_largest_magnitude","compute largest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);
141:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_LARGEST_MAGNITUDE); }
142:     PetscOptionsBoolGroup("-qep_smallest_magnitude","compute smallest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);
143:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_SMALLEST_MAGNITUDE); }
144:     PetscOptionsBoolGroup("-qep_largest_real","compute largest real parts","QEPSetWhichEigenpairs",&flg);
145:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_LARGEST_REAL); }
146:     PetscOptionsBoolGroup("-qep_smallest_real","compute smallest real parts","QEPSetWhichEigenpairs",&flg);
147:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_SMALLEST_REAL); }
148:     PetscOptionsBoolGroup("-qep_largest_imaginary","compute largest imaginary parts","QEPSetWhichEigenpairs",&flg);
149:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_LARGEST_IMAGINARY); }
150:     PetscOptionsBoolGroup("-qep_smallest_imaginary","compute smallest imaginary parts","QEPSetWhichEigenpairs",&flg);
151:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_SMALLEST_IMAGINARY); }
152:     PetscOptionsBoolGroup("-qep_target_magnitude","compute nearest eigenvalues to target","QEPSetWhichEigenpairs",&flg);
153:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_TARGET_MAGNITUDE); }
154:     PetscOptionsBoolGroup("-qep_target_real","compute eigenvalues with real parts close to target","QEPSetWhichEigenpairs",&flg);
155:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_TARGET_REAL); }
156:     PetscOptionsBoolGroupEnd("-qep_target_imaginary","compute eigenvalues with imaginary parts close to target","QEPSetWhichEigenpairs",&flg);
157:     if (flg) { QEPSetWhichEigenpairs(qep,QEP_TARGET_IMAGINARY); }

159:     PetscOptionsBool("-qep_left_vectors","Compute left eigenvectors also","QEPSetLeftVectorsWanted",qep->leftvecs,&val,&flg);
160:     if (flg) {
161:       QEPSetLeftVectorsWanted(qep,val);
162:     }

164:     PetscOptionsName("-qep_view","Print detailed information on solver used","QEPView",0);
165:     PetscOptionsName("-qep_plot_eigs","Make a plot of the computed eigenvalues","QEPSolve",0);

167:     if (qep->ops->setfromoptions) {
168:       (*qep->ops->setfromoptions)(qep);
169:     }
170:     PetscObjectProcessOptionsHandlers((PetscObject)qep);
171:   PetscOptionsEnd();

173:   if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
174:   IPSetFromOptions(qep->ip);
175:   if (!qep->ds) { QEPGetDS(qep,&qep->ds); }
176:   DSSetFromOptions(qep->ds);
177:   if (!qep->st) { QEPGetST(qep,&qep->st); }
178:   STSetFromOptions(qep->st);
179:   PetscRandomSetFromOptions(qep->rand);
180:   return(0);
181: }

185: /*@
186:    QEPGetTolerances - Gets the tolerance and maximum iteration count used
187:    by the QEP convergence tests.

189:    Not Collective

191:    Input Parameter:
192: .  qep - the quadratic eigensolver context

194:    Output Parameters:
195: +  tol - the convergence tolerance
196: -  maxits - maximum number of iterations

198:    Notes:
199:    The user can specify NULL for any parameter that is not needed.

201:    Level: intermediate

203: .seealso: QEPSetTolerances()
204: @*/
205: PetscErrorCode QEPGetTolerances(QEP qep,PetscReal *tol,PetscInt *maxits)
206: {
209:   if (tol)    *tol    = qep->tol;
210:   if (maxits) *maxits = qep->max_it;
211:   return(0);
212: }

216: /*@
217:    QEPSetTolerances - Sets the tolerance and maximum iteration count used
218:    by the QEP convergence tests.

220:    Logically Collective on QEP

222:    Input Parameters:
223: +  qep - the quadratic eigensolver context
224: .  tol - the convergence tolerance
225: -  maxits - maximum number of iterations to use

227:    Options Database Keys:
228: +  -qep_tol <tol> - Sets the convergence tolerance
229: -  -qep_max_it <maxits> - Sets the maximum number of iterations allowed

231:    Notes:
232:    Pass 0 for an argument that need not be changed.

234:    Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
235:    dependent on the solution method.

237:    Level: intermediate

239: .seealso: QEPGetTolerances()
240: @*/
241: PetscErrorCode QEPSetTolerances(QEP qep,PetscReal tol,PetscInt maxits)
242: {
247:   if (tol) {
248:     if (tol == PETSC_DEFAULT) {
249:       qep->tol = PETSC_DEFAULT;
250:     } else {
251:       if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
252:       qep->tol = tol;
253:     }
254:   }
255:   if (maxits) {
256:     if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
257:       qep->max_it = 0;
258:       qep->setupcalled = 0;
259:     } else {
260:       if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
261:       qep->max_it = maxits;
262:     }
263:   }
264:   return(0);
265: }

269: /*@
270:    QEPGetDimensions - Gets the number of eigenvalues to compute
271:    and the dimension of the subspace.

273:    Not Collective

275:    Input Parameter:
276: .  qep - the quadratic eigensolver context

278:    Output Parameters:
279: +  nev - number of eigenvalues to compute
280: .  ncv - the maximum dimension of the subspace to be used by the solver
281: -  mpd - the maximum dimension allowed for the projected problem

283:    Notes:
284:    The user can specify NULL for any parameter that is not needed.

286:    Level: intermediate

288: .seealso: QEPSetDimensions()
289: @*/
290: PetscErrorCode QEPGetDimensions(QEP qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
291: {
294:   if (nev) *nev = qep->nev;
295:   if (ncv) *ncv = qep->ncv;
296:   if (mpd) *mpd = qep->mpd;
297:   return(0);
298: }

302: /*@
303:    QEPSetDimensions - Sets the number of eigenvalues to compute
304:    and the dimension of the subspace.

306:    Logically Collective on QEP

308:    Input Parameters:
309: +  qep - the quadratic eigensolver context
310: .  nev - number of eigenvalues to compute
311: .  ncv - the maximum dimension of the subspace to be used by the solver
312: -  mpd - the maximum dimension allowed for the projected problem

314:    Options Database Keys:
315: +  -qep_nev <nev> - Sets the number of eigenvalues
316: .  -qep_ncv <ncv> - Sets the dimension of the subspace
317: -  -qep_mpd <mpd> - Sets the maximum projected dimension

319:    Notes:
320:    Pass 0 to retain the previous value of any parameter.

322:    Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
323:    dependent on the solution method.

325:    The parameters ncv and mpd are intimately related, so that the user is advised
326:    to set one of them at most. Normal usage is that
327:    (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and
328:    (b) in cases where nev is large, the user sets mpd.

330:    The value of ncv should always be between nev and (nev+mpd), typically
331:    ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise
332:    a smaller value should be used.

334:    Level: intermediate

336: .seealso: QEPGetDimensions()
337: @*/
338: PetscErrorCode QEPSetDimensions(QEP qep,PetscInt nev,PetscInt ncv,PetscInt mpd)
339: {
345:   if (nev) {
346:     if (nev<1) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0");
347:     qep->nev = nev;
348:     qep->setupcalled = 0;
349:   }
350:   if (ncv) {
351:     if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
352:       qep->ncv = 0;
353:     } else {
354:       if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
355:       qep->ncv = ncv;
356:     }
357:     qep->setupcalled = 0;
358:   }
359:   if (mpd) {
360:     if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
361:       qep->mpd = 0;
362:     } else {
363:       if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
364:       qep->mpd = mpd;
365:     }
366:   }
367:   return(0);
368: }

372: /*@
373:     QEPSetWhichEigenpairs - Specifies which portion of the spectrum is
374:     to be sought.

376:     Logically Collective on QEP

378:     Input Parameters:
379: +   qep   - eigensolver context obtained from QEPCreate()
380: -   which - the portion of the spectrum to be sought

382:     Possible values:
383:     The parameter 'which' can have one of these values

385: +     QEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
386: .     QEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
387: .     QEP_LARGEST_REAL - largest real parts
388: .     QEP_SMALLEST_REAL - smallest real parts
389: .     QEP_LARGEST_IMAGINARY - largest imaginary parts
390: .     QEP_SMALLEST_IMAGINARY - smallest imaginary parts
391: .     QEP_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
392: .     QEP_TARGET_REAL - eigenvalues with real part closest to target
393: -     QEP_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target

395:     Options Database Keys:
396: +   -qep_largest_magnitude - Sets largest eigenvalues in magnitude
397: .   -qep_smallest_magnitude - Sets smallest eigenvalues in magnitude
398: .   -qep_largest_real - Sets largest real parts
399: .   -qep_smallest_real - Sets smallest real parts
400: .   -qep_largest_imaginary - Sets largest imaginary parts
401: .   -qep_smallest_imaginary - Sets smallest imaginary parts
402: .   -qep_target_magnitude - Sets eigenvalues closest to target
403: .   -qep_target_real - Sets real parts closest to target
404: -   -qep_target_imaginary - Sets imaginary parts closest to target

406:     Notes:
407:     Not all eigensolvers implemented in QEP account for all the possible values
408:     stated above. If SLEPc is compiled for real numbers QEP_LARGEST_IMAGINARY
409:     and QEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part
410:     for eigenvalue selection.

412:     Level: intermediate

414: .seealso: QEPGetWhichEigenpairs(), QEPWhich
415: @*/
416: PetscErrorCode QEPSetWhichEigenpairs(QEP qep,QEPWhich which)
417: {
421:   if (which) {
422:     if (which==PETSC_DECIDE || which==PETSC_DEFAULT) qep->which = (QEPWhich)0;
423:     else switch (which) {
424:       case QEP_LARGEST_MAGNITUDE:
425:       case QEP_SMALLEST_MAGNITUDE:
426:       case QEP_LARGEST_REAL:
427:       case QEP_SMALLEST_REAL:
428:       case QEP_LARGEST_IMAGINARY:
429:       case QEP_SMALLEST_IMAGINARY:
430:       case QEP_TARGET_MAGNITUDE:
431:       case QEP_TARGET_REAL:
432: #if defined(PETSC_USE_COMPLEX)
433:       case QEP_TARGET_IMAGINARY:
434: #endif
435:         if (qep->which != which) {
436:           qep->setupcalled = 0;
437:           qep->which = which;
438:         }
439:         break;
440:       default:
441:         SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value");
442:     }
443:   }
444:   return(0);
445: }

449: /*@C
450:     QEPGetWhichEigenpairs - Returns which portion of the spectrum is to be
451:     sought.

453:     Not Collective

455:     Input Parameter:
456: .   qep - eigensolver context obtained from QEPCreate()

458:     Output Parameter:
459: .   which - the portion of the spectrum to be sought

461:     Notes:
462:     See QEPSetWhichEigenpairs() for possible values of 'which'.

464:     Level: intermediate

466: .seealso: QEPSetWhichEigenpairs(), QEPWhich
467: @*/
468: PetscErrorCode QEPGetWhichEigenpairs(QEP qep,QEPWhich *which)
469: {
473:   *which = qep->which;
474:   return(0);
475: }

479: /*@
480:     QEPSetLeftVectorsWanted - Specifies which eigenvectors are required.

482:     Logically Collective on QEP

484:     Input Parameters:
485: +   qep      - the quadratic eigensolver context
486: -   leftvecs - whether left eigenvectors are required or not

488:     Options Database Keys:
489: .   -qep_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'

491:     Notes:
492:     If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of
493:     the algorithm that computes both right and left eigenvectors. This is
494:     usually much more costly. This option is not available in all solvers.

496:     Level: intermediate

498: .seealso: QEPGetLeftVectorsWanted()
499: @*/
500: PetscErrorCode QEPSetLeftVectorsWanted(QEP qep,PetscBool leftvecs)
501: {
505:   if (qep->leftvecs != leftvecs) {
506:     qep->leftvecs = leftvecs;
507:     qep->setupcalled = 0;
508:   }
509:   return(0);
510: }

514: /*@C
515:     QEPGetLeftVectorsWanted - Returns the flag indicating whether left
516:     eigenvectors are required or not.

518:     Not Collective

520:     Input Parameter:
521: .   qep - the eigensolver context

523:     Output Parameter:
524: .   leftvecs - the returned flag

526:     Level: intermediate

528: .seealso: QEPSetLeftVectorsWanted()
529: @*/
530: PetscErrorCode QEPGetLeftVectorsWanted(QEP qep,PetscBool *leftvecs)
531: {
535:   *leftvecs = qep->leftvecs;
536:   return(0);
537: }

541: /*@
542:    QEPGetScaleFactor - Gets the factor used for scaling the quadratic eigenproblem.

544:    Not Collective

546:    Input Parameter:
547: .  qep - the quadratic eigensolver context

549:    Output Parameters:
550: .  alpha - the scaling factor

552:    Notes:
553:    If the user did not specify a scaling factor, then after QEPSolve() the
554:    default value is returned.

556:    Level: intermediate

558: .seealso: QEPSetScaleFactor(), QEPSolve()
559: @*/
560: PetscErrorCode QEPGetScaleFactor(QEP qep,PetscReal *alpha)
561: {
565:   *alpha = qep->sfactor;
566:   return(0);
567: }

571: /*@
572:    QEPSetScaleFactor - Sets the scaling factor to be used for scaling the
573:    quadratic problem before attempting to solve.

575:    Logically Collective on QEP

577:    Input Parameters:
578: +  qep   - the quadratic eigensolver context
579: -  alpha - the scaling factor

581:    Options Database Keys:
582: .  -qep_scale <alpha> - Sets the scaling factor

584:    Notes:
585:    For the problem (l^2*M + l*C + K)*x = 0, the effect of scaling is to work
586:    with matrices (alpha^2*M, alpha*C, K), then scale the computed eigenvalue.

588:    The default is to scale with alpha = norm(K)/norm(M).

590:    Level: intermediate

592: .seealso: QEPGetScaleFactor()
593: @*/
594: PetscErrorCode QEPSetScaleFactor(QEP qep,PetscReal alpha)
595: {
599:   if (alpha) {
600:     if (alpha == PETSC_DEFAULT || alpha == PETSC_DECIDE) {
601:       qep->sfactor = 0.0;
602:       qep->sfactor_set = PETSC_FALSE;
603:     } else {
604:       if (alpha < 0.0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of alpha. Must be > 0");
605:       qep->sfactor = alpha;
606:       qep->sfactor_set = PETSC_TRUE;
607:     }
608:   }
609:   return(0);
610: }

614: /*@
615:    QEPSetProblemType - Specifies the type of the quadratic eigenvalue problem.

617:    Logically Collective on QEP

619:    Input Parameters:
620: +  qep      - the quadratic eigensolver context
621: -  type     - a known type of quadratic eigenvalue problem

623:    Options Database Keys:
624: +  -qep_general - general problem with no particular structure
625: .  -qep_hermitian - problem whose coefficient matrices are Hermitian
626: -  -qep_gyroscopic - problem with Hamiltonian structure

628:    Notes:
629:    Allowed values for the problem type are: general (QEP_GENERAL), Hermitian
630:    (QEP_HERMITIAN), and gyroscopic (QEP_GYROSCOPIC).

632:    This function is used to instruct SLEPc to exploit certain structure in
633:    the quadratic eigenproblem. By default, no particular structure is assumed.

635:    If the problem matrices are Hermitian (symmetric in the real case) or
636:    Hermitian/skew-Hermitian then the solver can exploit this fact to perform
637:    less operations or provide better stability.

639:    Level: intermediate

641: .seealso: QEPSetOperators(), QEPSetType(), QEPGetProblemType(), QEPProblemType
642: @*/
643: PetscErrorCode QEPSetProblemType(QEP qep,QEPProblemType type)
644: {
648:   if (type!=QEP_GENERAL && type!=QEP_HERMITIAN && type!=QEP_GYROSCOPIC)
649:     SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type");
650:   qep->problem_type = type;
651:   return(0);
652: }

656: /*@C
657:    QEPGetProblemType - Gets the problem type from the QEP object.

659:    Not Collective

661:    Input Parameter:
662: .  qep - the quadratic eigensolver context

664:    Output Parameter:
665: .  type - name of QEP problem type

667:    Level: intermediate

669: .seealso: QEPSetProblemType(), QEPProblemType
670: @*/
671: PetscErrorCode QEPGetProblemType(QEP qep,QEPProblemType *type)
672: {
676:   *type = qep->problem_type;
677:   return(0);
678: }

682: /*@C
683:     QEPSetConvergenceTest - Sets a function to compute the error estimate used in
684:     the convergence test.

686:     Logically Collective on QEP

688:     Input Parameters:
689: +   qep  - eigensolver context obtained from QEPCreate()
690: .   func - a pointer to the convergence test function
691: -   ctx  - a context pointer (the last parameter to the convergence test function)

693:     Calling Sequence of func:
694: $   func(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal* errest,void *ctx)

696: +   qep    - eigensolver context obtained from QEPCreate()
697: .   eigr   - real part of the eigenvalue
698: .   eigi   - imaginary part of the eigenvalue
699: .   res    - residual norm associated to the eigenpair
700: .   errest - (output) computed error estimate
701: -   ctx    - optional context, as set by QEPSetConvergenceTest()

703:     Note:
704:     If the error estimate returned by the convergence test function is less than
705:     the tolerance, then the eigenvalue is accepted as converged.

707:     Level: advanced

709: .seealso: QEPSetTolerances()
710: @*/
711: PetscErrorCode QEPSetConvergenceTest(QEP qep,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)
712: {
715:   qep->converged    = func;
716:   qep->convergedctx = ctx;
717:   return(0);
718: }

722: /*@
723:    QEPSetTrackAll - Specifies if the solver must compute the residual of all
724:    approximate eigenpairs or not.

726:    Logically Collective on QEP

728:    Input Parameters:
729: +  qep      - the eigensolver context
730: -  trackall - whether compute all residuals or not

732:    Notes:
733:    If the user sets trackall=PETSC_TRUE then the solver explicitly computes
734:    the residual for each eigenpair approximation. Computing the residual is
735:    usually an expensive operation and solvers commonly compute the associated
736:    residual to the first unconverged eigenpair.
737:    The options '-qep_monitor_all' and '-qep_monitor_lg_all' automatically
738:    activate this option.

740:    Level: intermediate

742: .seealso: QEPGetTrackAll()
743: @*/
744: PetscErrorCode QEPSetTrackAll(QEP qep,PetscBool trackall)
745: {
749:   qep->trackall = trackall;
750:   return(0);
751: }

755: /*@
756:    QEPGetTrackAll - Returns the flag indicating whether all residual norms must
757:    be computed or not.

759:    Not Collective

761:    Input Parameter:
762: .  qep - the eigensolver context

764:    Output Parameter:
765: .  trackall - the returned flag

767:    Level: intermediate

769: .seealso: QEPSetTrackAll()
770: @*/
771: PetscErrorCode QEPGetTrackAll(QEP qep,PetscBool *trackall)
772: {
776:   *trackall = qep->trackall;
777:   return(0);
778: }

782: /*@C
783:    QEPSetOptionsPrefix - Sets the prefix used for searching for all
784:    QEP options in the database.

786:    Logically Collective on QEP

788:    Input Parameters:
789: +  qep - the quadratic eigensolver context
790: -  prefix - the prefix string to prepend to all QEP option requests

792:    Notes:
793:    A hyphen (-) must NOT be given at the beginning of the prefix name.
794:    The first character of all runtime options is AUTOMATICALLY the
795:    hyphen.

797:    For example, to distinguish between the runtime options for two
798:    different QEP contexts, one could call
799: .vb
800:       QEPSetOptionsPrefix(qep1,"qeig1_")
801:       QEPSetOptionsPrefix(qep2,"qeig2_")
802: .ve

804:    Level: advanced

806: .seealso: QEPAppendOptionsPrefix(), QEPGetOptionsPrefix()
807: @*/
808: PetscErrorCode QEPSetOptionsPrefix(QEP qep,const char *prefix)
809: {

814:   if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
815:   IPSetOptionsPrefix(qep->ip,prefix);
816:   if (!qep->ds) { QEPGetDS(qep,&qep->ds); }
817:   DSSetOptionsPrefix(qep->ds,prefix);
818:   PetscObjectSetOptionsPrefix((PetscObject)qep,prefix);
819:   return(0);
820: }

824: /*@C
825:    QEPAppendOptionsPrefix - Appends to the prefix used for searching for all
826:    QEP options in the database.

828:    Logically Collective on QEP

830:    Input Parameters:
831: +  qep - the quadratic eigensolver context
832: -  prefix - the prefix string to prepend to all QEP option requests

834:    Notes:
835:    A hyphen (-) must NOT be given at the beginning of the prefix name.
836:    The first character of all runtime options is AUTOMATICALLY the hyphen.

838:    Level: advanced

840: .seealso: QEPSetOptionsPrefix(), QEPGetOptionsPrefix()
841: @*/
842: PetscErrorCode QEPAppendOptionsPrefix(QEP qep,const char *prefix)
843: {
845:   PetscBool      flg;
846:   EPS            eps;

850:   if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
851:   IPSetOptionsPrefix(qep->ip,prefix);
852:   if (!qep->ds) { QEPGetDS(qep,&qep->ds); }
853:   DSSetOptionsPrefix(qep->ds,prefix);
854:   PetscObjectAppendOptionsPrefix((PetscObject)qep,prefix);
855:   PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&flg);
856:   if (flg) {
857:     QEPLinearGetEPS(qep,&eps);
858:     EPSSetOptionsPrefix(eps,((PetscObject)qep)->prefix);
859:     EPSAppendOptionsPrefix(eps,"qep_");
860:   }
861:   return(0);
862: }

866: /*@C
867:    QEPGetOptionsPrefix - Gets the prefix used for searching for all
868:    QEP options in the database.

870:    Not Collective

872:    Input Parameters:
873: .  qep - the quadratic eigensolver context

875:    Output Parameters:
876: .  prefix - pointer to the prefix string used is returned

878:    Notes: On the fortran side, the user should pass in a string 'prefix' of
879:    sufficient length to hold the prefix.

881:    Level: advanced

883: .seealso: QEPSetOptionsPrefix(), QEPAppendOptionsPrefix()
884: @*/
885: PetscErrorCode QEPGetOptionsPrefix(QEP qep,const char *prefix[])
886: {

892:   PetscObjectGetOptionsPrefix((PetscObject)qep,prefix);
893:   return(0);
894: }
slepc-3.4.2.dfsg.orig/src/qep/interface/qepdefault.c0000644000175000017500000001124612211062077021251 0ustar gladkgladk/* This file contains some simple default routines for common QEP operations. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "QEPReset_Default" PetscErrorCode QEPReset_Default(QEP qep) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDestroyVecs(qep->nwork,&qep->work);CHKERRQ(ierr); qep->nwork = 0; ierr = QEPFreeSolution(qep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetWorkVecs" /*@ QEPSetWorkVecs - Sets a number of work vectors into a QEP object Collective on QEP Input Parameters: + qep - quadratic eigensolver context - nw - number of work vectors to allocate Developers Note: This is PETSC_EXTERN because it may be required by user plugin QEP implementations. Level: developer @*/ PetscErrorCode QEPSetWorkVecs(QEP qep,PetscInt nw) { PetscErrorCode ierr; PetscFunctionBegin; if (qep->nwork != nw) { ierr = VecDestroyVecs(qep->nwork,&qep->work);CHKERRQ(ierr); qep->nwork = nw; ierr = VecDuplicateVecs(qep->t,nw,&qep->work);CHKERRQ(ierr); ierr = PetscLogObjectParents(qep,nw,qep->work);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPConvergedDefault" /* QEPConvergedDefault - Checks convergence relative to the eigenvalue. */ PetscErrorCode QEPConvergedDefault(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) { PetscReal w; PetscFunctionBegin; w = SlepcAbsEigenvalue(eigr,eigi); *errest = res/w; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPConvergedAbsolute" /* QEPConvergedAbsolute - Checks convergence absolutely. */ PetscErrorCode QEPConvergedAbsolute(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx) { PetscFunctionBegin; *errest = res; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPComputeVectors_Schur" PetscErrorCode QEPComputeVectors_Schur(QEP qep) { PetscErrorCode ierr; PetscInt n,ld; PetscScalar *Z; PetscFunctionBegin; ierr = DSGetLeadingDimension(qep->ds,&ld);CHKERRQ(ierr); ierr = DSGetDimensions(qep->ds,&n,NULL,NULL,NULL,NULL);CHKERRQ(ierr); /* right eigenvectors */ ierr = DSVectors(qep->ds,DS_MAT_X,NULL,NULL);CHKERRQ(ierr); /* AV = V * Z */ ierr = DSGetArray(qep->ds,DS_MAT_X,&Z);CHKERRQ(ierr); ierr = SlepcUpdateVectors(n,qep->V,0,n,Z,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(qep->ds,DS_MAT_X,&Z);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPKrylovConvergence" /* QEPKrylovConvergence - This is the analogue to EPSKrylovConvergence, but for quadratic Krylov methods. Differences: - Always non-symmetric - Does not check for STSHIFT - No correction factor - No support for true residual */ PetscErrorCode QEPKrylovConvergence(QEP qep,PetscBool getall,PetscInt kini,PetscInt nits,PetscInt nv,PetscReal beta,PetscInt *kout) { PetscErrorCode ierr; PetscInt k,newk,marker,ld; PetscScalar re,im; PetscReal resnorm; PetscFunctionBegin; ierr = DSGetLeadingDimension(qep->ds,&ld);CHKERRQ(ierr); marker = -1; if (qep->trackall) getall = PETSC_TRUE; for (k=kini;keigr[k]; im = qep->eigi[k]; newk = k; ierr = DSVectors(qep->ds,DS_MAT_X,&newk,&resnorm);CHKERRQ(ierr); resnorm *= beta; /* error estimate */ ierr = (*qep->converged)(qep,re,im,resnorm,&qep->errest[k],qep->convergedctx);CHKERRQ(ierr); if (marker==-1 && qep->errest[k] >= qep->tol) marker = k; if (newk==k+1) { qep->errest[k+1] = qep->errest[k]; k++; } if (marker!=-1 && !getall) break; } if (marker!=-1) k = marker; *kout = k; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepbasic.c0000644000175000017500000006475712211062077020725 0ustar gladkgladk/* The basic QEP routines, Create, View, etc. are here. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ PetscFunctionList QEPList = 0; PetscBool QEPRegisterAllCalled = PETSC_FALSE; PetscClassId QEP_CLASSID = 0; PetscLogEvent QEP_SetUp = 0,QEP_Solve = 0,QEP_Dense = 0; static PetscBool QEPPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "QEPFinalizePackage" /*@C QEPFinalizePackage - This function destroys everything in the Slepc interface to the QEP package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode QEPFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&QEPList);CHKERRQ(ierr); QEPPackageInitialized = PETSC_FALSE; QEPRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPInitializePackage" /*@C QEPInitializePackage - This function initializes everything in the QEP package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to QEPCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode QEPInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (QEPPackageInitialized) PetscFunctionReturn(0); QEPPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Quadratic Eigenvalue Problem solver",&QEP_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = QEPRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("QEPSetUp",QEP_CLASSID,&QEP_SetUp);CHKERRQ(ierr); ierr = PetscLogEventRegister("QEPSolve",QEP_CLASSID,&QEP_Solve);CHKERRQ(ierr); ierr = PetscLogEventRegister("QEPDense",QEP_CLASSID,&QEP_Dense);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"qep",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(QEP_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"qep",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(QEP_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(QEPFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPView" /*@C QEPView - Prints the QEP data structure. Collective on QEP Input Parameters: + qep - the quadratic eigenproblem solver context - viewer - optional visualization context Options Database Key: . -qep_view - Calls QEPView() at end of QEPSolve() Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode QEPView(QEP qep,PetscViewer viewer) { PetscErrorCode ierr; const char *type; char str[50]; PetscBool isascii,islinear; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(qep,1,viewer,2); #if defined(PETSC_USE_COMPLEX) #define HERM "hermitian" #else #define HERM "symmetric" #endif ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)qep,viewer,"QEP Object");CHKERRQ(ierr); if (qep->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*qep->ops->view)(qep,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } if (qep->problem_type) { switch (qep->problem_type) { case QEP_GENERAL: type = "general quadratic eigenvalue problem"; break; case QEP_HERMITIAN: type = HERM " quadratic eigenvalue problem"; break; case QEP_GYROSCOPIC: type = "gyroscopic quadratic eigenvalue problem"; break; default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of qep->problem_type"); } } else type = "not yet set"; ierr = PetscViewerASCIIPrintf(viewer," problem type: %s\n",type);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: ");CHKERRQ(ierr); ierr = SlepcSNPrintfScalar(str,50,qep->target,PETSC_FALSE);CHKERRQ(ierr); if (!qep->which) { ierr = PetscViewerASCIIPrintf(viewer,"not yet set\n");CHKERRQ(ierr); } else switch (qep->which) { case QEP_TARGET_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (in magnitude)\n",str);CHKERRQ(ierr); break; case QEP_TARGET_REAL: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the real axis)\n",str);CHKERRQ(ierr); break; case QEP_TARGET_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the imaginary axis)\n",str);CHKERRQ(ierr); break; case QEP_LARGEST_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");CHKERRQ(ierr); break; case QEP_SMALLEST_MAGNITUDE: ierr = PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");CHKERRQ(ierr); break; case QEP_LARGEST_REAL: ierr = PetscViewerASCIIPrintf(viewer,"largest real parts\n");CHKERRQ(ierr); break; case QEP_SMALLEST_REAL: ierr = PetscViewerASCIIPrintf(viewer,"smallest real parts\n");CHKERRQ(ierr); break; case QEP_LARGEST_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");CHKERRQ(ierr); break; case QEP_SMALLEST_IMAGINARY: ierr = PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");CHKERRQ(ierr); break; default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of qep->which"); } if (qep->leftvecs) { ierr = PetscViewerASCIIPrintf(viewer," computing left eigenvectors also\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," number of eigenvalues (nev): %D\n",qep->nev);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %D\n",qep->ncv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum dimension of projected problem (mpd): %D\n",qep->mpd);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %D\n",qep->max_it);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," tolerance: %G\n",qep->tol);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," scaling factor: %G\n",qep->sfactor);CHKERRQ(ierr); if (qep->nini) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial space: %D\n",PetscAbs(qep->nini));CHKERRQ(ierr); } if (qep->ninil) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial left space: %D\n",PetscAbs(qep->ninil));CHKERRQ(ierr); } } else { if (qep->ops->view) { ierr = (*qep->ops->view)(qep,viewer);CHKERRQ(ierr); } } ierr = PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&islinear);CHKERRQ(ierr); if (!islinear) { if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } ierr = IPView(qep->ip,viewer);CHKERRQ(ierr); if (!qep->ds) { ierr = QEPGetDS(qep,&qep->ds);CHKERRQ(ierr); } ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr); ierr = DSView(qep->ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (!qep->st) { ierr = QEPGetST(qep,&qep->st);CHKERRQ(ierr); } ierr = STView(qep->st,viewer);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPPrintSolution" /*@ QEPPrintSolution - Prints the computed eigenvalues. Collective on QEP Input Parameters: + qep - the eigensolver context - viewer - optional visualization context Options Database Key: . -qep_terse - print only minimal information Note: By default, this function prints a table with eigenvalues and associated relative errors. With -qep_terse only the eigenvalues are printed. Level: intermediate .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode QEPPrintSolution(QEP qep,PetscViewer viewer) { PetscBool terse,errok,isascii; PetscReal error,re,im; PetscScalar kr,ki; PetscInt i,j; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(qep,1,viewer,2); if (!qep->eigr || !qep->eigi || !qep->V) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONGSTATE,"QEPSolve must be called first"); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (!isascii) PetscFunctionReturn(0); ierr = PetscOptionsHasName(NULL,"-qep_terse",&terse);CHKERRQ(ierr); if (terse) { if (qep->nconvnev) { ierr = PetscViewerASCIIPrintf(viewer," Problem: less than %D eigenvalues converged\n\n",qep->nev);CHKERRQ(ierr); } else { errok = PETSC_TRUE; for (i=0;inev;i++) { ierr = QEPComputeRelativeError(qep,i,&error);CHKERRQ(ierr); errok = (errok && errortol)? PETSC_TRUE: PETSC_FALSE; } if (errok) { ierr = PetscViewerASCIIPrintf(viewer," All requested eigenvalues computed up to the required tolerance:");CHKERRQ(ierr); for (i=0;i<=(qep->nev-1)/8;i++) { ierr = PetscViewerASCIIPrintf(viewer,"\n ");CHKERRQ(ierr); for (j=0;jnev-8*i);j++) { ierr = QEPGetEigenpair(qep,8*i+j,&kr,&ki,NULL,NULL);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) re = PetscRealPart(kr); im = PetscImaginaryPart(kr); #else re = kr; im = ki; #endif if (PetscAbs(re)/PetscAbs(im)nev) { ierr = PetscViewerASCIIPrintf(viewer,", ");CHKERRQ(ierr); } } } ierr = PetscViewerASCIIPrintf(viewer,"\n\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Problem: some of the first %D relative errors are higher than the tolerance\n\n",qep->nev);CHKERRQ(ierr); } } } else { ierr = PetscViewerASCIIPrintf(viewer," Number of converged approximate eigenpairs: %D\n\n",qep->nconv);CHKERRQ(ierr); if (qep->nconv>0) { ierr = PetscViewerASCIIPrintf(viewer, " k ||(k^2M+Ck+K)x||/||kx||\n" " ----------------- -------------------------\n");CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = QEPGetEigenpair(qep,i,&kr,&ki,NULL,NULL);CHKERRQ(ierr); ierr = QEPComputeRelativeError(qep,i,&error);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) re = PetscRealPart(kr); im = PetscImaginaryPart(kr); #else re = kr; im = ki; #endif if (im!=0.0) { ierr = PetscViewerASCIIPrintf(viewer," % 9F%+9F i %12G\n",re,im,error);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," % 12F %12G\n",re,error);CHKERRQ(ierr); } } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPCreate" /*@C QEPCreate - Creates the default QEP context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . qep - location to put the QEP context Note: The default QEP type is QEPLINEAR Level: beginner .seealso: QEPSetUp(), QEPSolve(), QEPDestroy(), QEP @*/ PetscErrorCode QEPCreate(MPI_Comm comm,QEP *outqep) { PetscErrorCode ierr; QEP qep; PetscFunctionBegin; PetscValidPointer(outqep,2); *outqep = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = QEPInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(qep,_p_QEP,struct _QEPOps,QEP_CLASSID,"QEP","Quadratic Eigenvalue Problem","QEP",comm,QEPDestroy,QEPView);CHKERRQ(ierr); qep->M = 0; qep->C = 0; qep->K = 0; qep->max_it = 0; qep->nev = 1; qep->ncv = 0; qep->mpd = 0; qep->nini = 0; qep->ninil = 0; qep->allocated_ncv = 0; qep->ip = 0; qep->ds = 0; qep->tol = PETSC_DEFAULT; qep->sfactor = 0.0; qep->sfactor_set = PETSC_FALSE; qep->converged = QEPConvergedDefault; qep->convergedctx = NULL; qep->which = (QEPWhich)0; qep->comparison = NULL; qep->comparisonctx = NULL; qep->leftvecs = PETSC_FALSE; qep->problem_type = (QEPProblemType)0; qep->V = NULL; qep->W = NULL; qep->IS = NULL; qep->ISL = NULL; qep->eigr = NULL; qep->eigi = NULL; qep->errest = NULL; qep->data = NULL; qep->t = NULL; qep->nconv = 0; qep->its = 0; qep->perm = NULL; qep->matvecs = 0; qep->linits = 0; qep->nwork = 0; qep->work = NULL; qep->setupcalled = 0; qep->reason = QEP_CONVERGED_ITERATING; qep->numbermonitors = 0; qep->trackall = PETSC_FALSE; qep->rand = 0; ierr = PetscRandomCreate(comm,&qep->rand);CHKERRQ(ierr); ierr = PetscRandomSetSeed(qep->rand,0x12345678);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,qep->rand);CHKERRQ(ierr); *outqep = qep; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetType" /*@C QEPSetType - Selects the particular solver to be used in the QEP object. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context - type - a known method Options Database Key: . -qep_type - Sets the method; use -help for a list of available methods Notes: See "slepc/include/slepcqep.h" for available methods. The default is QEPLINEAR. Normally, it is best to use the QEPSetFromOptions() command and then set the QEP type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The QEPSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database. Level: intermediate .seealso: QEPType @*/ PetscErrorCode QEPSetType(QEP qep,QEPType type) { PetscErrorCode ierr,(*r)(QEP); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)qep,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(QEPList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown QEP type given: %s",type); if (qep->ops->destroy) { ierr = (*qep->ops->destroy)(qep);CHKERRQ(ierr); } ierr = PetscMemzero(qep->ops,sizeof(struct _QEPOps));CHKERRQ(ierr); qep->setupcalled = 0; ierr = PetscObjectChangeTypeName((PetscObject)qep,type);CHKERRQ(ierr); ierr = (*r)(qep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetType" /*@C QEPGetType - Gets the QEP type as a string from the QEP object. Not Collective Input Parameter: . qep - the eigensolver context Output Parameter: . name - name of QEP method Level: intermediate .seealso: QEPSetType() @*/ PetscErrorCode QEPGetType(QEP qep,QEPType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)qep)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPRegister" /*@C QEPRegister - Adds a method to the quadratic eigenproblem solver package. Not Collective Input Parameters: + name - name of a new user-defined solver - function - routine to create the solver context Notes: QEPRegister() may be called multiple times to add several user-defined solvers. Sample usage: .vb QEPRegister("my_solver",MySolverCreate); .ve Then, your solver can be chosen with the procedural interface via $ QEPSetType(qep,"my_solver") or at runtime via the option $ -qep_type my_solver Level: advanced .seealso: QEPRegisterAll() @*/ PetscErrorCode QEPRegister(const char *name,PetscErrorCode (*function)(QEP)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&QEPList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPReset" /*@ QEPReset - Resets the QEP context to the setupcalled=0 state and removes any allocated objects. Collective on QEP Input Parameter: . qep - eigensolver context obtained from QEPCreate() Level: advanced .seealso: QEPDestroy() @*/ PetscErrorCode QEPReset(QEP qep) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (qep->ops->reset) { ierr = (qep->ops->reset)(qep);CHKERRQ(ierr); } if (qep->ip) { ierr = IPReset(qep->ip);CHKERRQ(ierr); } if (qep->ds) { ierr = DSReset(qep->ds);CHKERRQ(ierr); } ierr = MatDestroy(&qep->M);CHKERRQ(ierr); ierr = MatDestroy(&qep->C);CHKERRQ(ierr); ierr = MatDestroy(&qep->K);CHKERRQ(ierr); ierr = VecDestroy(&qep->t);CHKERRQ(ierr); ierr = QEPFreeSolution(qep);CHKERRQ(ierr); qep->matvecs = 0; qep->linits = 0; qep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPDestroy" /*@C QEPDestroy - Destroys the QEP context. Collective on QEP Input Parameter: . qep - eigensolver context obtained from QEPCreate() Level: beginner .seealso: QEPCreate(), QEPSetUp(), QEPSolve() @*/ PetscErrorCode QEPDestroy(QEP *qep) { PetscErrorCode ierr; PetscFunctionBegin; if (!*qep) PetscFunctionReturn(0); PetscValidHeaderSpecific(*qep,QEP_CLASSID,1); if (--((PetscObject)(*qep))->refct > 0) { *qep = 0; PetscFunctionReturn(0); } ierr = QEPReset(*qep);CHKERRQ(ierr); if ((*qep)->ops->destroy) { ierr = (*(*qep)->ops->destroy)(*qep);CHKERRQ(ierr); } ierr = STDestroy(&(*qep)->st);CHKERRQ(ierr); ierr = IPDestroy(&(*qep)->ip);CHKERRQ(ierr); ierr = DSDestroy(&(*qep)->ds);CHKERRQ(ierr); ierr = PetscRandomDestroy(&(*qep)->rand);CHKERRQ(ierr); /* just in case the initial vectors have not been used */ ierr = SlepcBasisDestroy_Private(&(*qep)->nini,&(*qep)->IS);CHKERRQ(ierr); ierr = SlepcBasisDestroy_Private(&(*qep)->ninil,&(*qep)->ISL);CHKERRQ(ierr); ierr = QEPMonitorCancel(*qep);CHKERRQ(ierr); ierr = PetscHeaderDestroy(qep);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetIP" /*@ QEPSetIP - Associates an inner product object to the quadratic eigensolver. Collective on QEP Input Parameters: + qep - eigensolver context obtained from QEPCreate() - ip - the inner product object Note: Use QEPGetIP() to retrieve the inner product context (for example, to free it at the end of the computations). Level: advanced .seealso: QEPGetIP() @*/ PetscErrorCode QEPSetIP(QEP qep,IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidHeaderSpecific(ip,IP_CLASSID,2); PetscCheckSameComm(qep,1,ip,2); ierr = PetscObjectReference((PetscObject)ip);CHKERRQ(ierr); ierr = IPDestroy(&qep->ip);CHKERRQ(ierr); qep->ip = ip; ierr = PetscLogObjectParent(qep,qep->ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetIP" /*@C QEPGetIP - Obtain the inner product object associated to the quadratic eigensolver object. Not Collective Input Parameters: . qep - eigensolver context obtained from QEPCreate() Output Parameter: . ip - inner product context Level: advanced .seealso: QEPSetIP() @*/ PetscErrorCode QEPGetIP(QEP qep,IP *ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(ip,2); if (!qep->ip) { ierr = IPCreate(PetscObjectComm((PetscObject)qep),&qep->ip);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,qep->ip);CHKERRQ(ierr); } *ip = qep->ip; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetDS" /*@ QEPSetDS - Associates a direct solver object to the quadratic eigensolver. Collective on QEP Input Parameters: + qep - eigensolver context obtained from QEPCreate() - ds - the direct solver object Note: Use QEPGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations). Level: advanced .seealso: QEPGetDS() @*/ PetscErrorCode QEPSetDS(QEP qep,DS ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidHeaderSpecific(ds,DS_CLASSID,2); PetscCheckSameComm(qep,1,ds,2); ierr = PetscObjectReference((PetscObject)ds);CHKERRQ(ierr); ierr = DSDestroy(&qep->ds);CHKERRQ(ierr); qep->ds = ds; ierr = PetscLogObjectParent(qep,qep->ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetDS" /*@C QEPGetDS - Obtain the direct solver object associated to the quadratic eigensolver object. Not Collective Input Parameters: . qep - eigensolver context obtained from QEPCreate() Output Parameter: . ds - direct solver context Level: advanced .seealso: QEPSetDS() @*/ PetscErrorCode QEPGetDS(QEP qep,DS *ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(ds,2); if (!qep->ds) { ierr = DSCreate(PetscObjectComm((PetscObject)qep),&qep->ds);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,qep->ds);CHKERRQ(ierr); } *ds = qep->ds; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetST" /*@ QEPSetST - Associates a spectral transformation object to the eigensolver. Collective on QEP Input Parameters: + qep - eigensolver context obtained from QEPCreate() - st - the spectral transformation object Note: Use QEPGetST() to retrieve the spectral transformation context (for example, to free it at the end of the computations). Level: developer .seealso: QEPGetST() @*/ PetscErrorCode QEPSetST(QEP qep,ST st) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidHeaderSpecific(st,ST_CLASSID,2); PetscCheckSameComm(qep,1,st,2); ierr = PetscObjectReference((PetscObject)st);CHKERRQ(ierr); ierr = STDestroy(&qep->st);CHKERRQ(ierr); qep->st = st; ierr = PetscLogObjectParent(qep,qep->st);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetST" /*@C QEPGetST - Obtain the spectral transformation (ST) object associated to the eigensolver object. Not Collective Input Parameters: . qep - eigensolver context obtained from QEPCreate() Output Parameter: . st - spectral transformation context Level: beginner .seealso: QEPSetST() @*/ PetscErrorCode QEPGetST(QEP qep,ST *st) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(st,2); if (!qep->st) { ierr = STCreate(PetscObjectComm((PetscObject)qep),&qep->st);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,qep->st);CHKERRQ(ierr); } *st = qep->st; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetTarget" /*@ QEPSetTarget - Sets the value of the target. Logically Collective on QEP Input Parameters: + qep - eigensolver context - target - the value of the target Notes: The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with QEPSetWhichEigenpairs(). Level: beginner .seealso: QEPGetTarget(), QEPSetWhichEigenpairs() @*/ PetscErrorCode QEPSetTarget(QEP qep,PetscScalar target) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveScalar(qep,target,2); qep->target = target; if (!qep->st) { ierr = QEPGetST(qep,&qep->st);CHKERRQ(ierr); } ierr = STSetDefaultShift(qep->st,target);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetTarget" /*@ QEPGetTarget - Gets the value of the target. Not Collective Input Parameter: . qep - eigensolver context Output Parameter: . target - the value of the target Level: beginner Note: If the target was not set by the user, then zero is returned. .seealso: QEPSetTarget() @*/ PetscErrorCode QEPGetTarget(QEP qep,PetscScalar* target) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidScalarPointer(target,2); *target = qep->target; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepopts.c0000644000175000017500000007550212211062077020617 0ustar gladkgladk/* QEP routines related to options that can be set via the command-line or procedurally. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #undef __FUNCT__ #define __FUNCT__ "QEPSetFromOptions" /*@ QEPSetFromOptions - Sets QEP options from the options database. This routine must be called before QEPSetUp() if the user is to be allowed to set the solver type. Collective on QEP Input Parameters: . qep - the quadratic eigensolver context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode QEPSetFromOptions(QEP qep) { PetscErrorCode ierr; char type[256],monfilename[PETSC_MAX_PATH_LEN]; PetscBool flg,val; PetscReal r; PetscScalar s; PetscInt i,j,k; PetscViewer monviewer; SlepcConvMonitor ctx; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (!QEPRegisterAllCalled) { ierr = QEPRegisterAll();CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)qep);CHKERRQ(ierr); ierr = PetscOptionsList("-qep_type","Quadratic Eigenvalue Problem method","QEPSetType",QEPList,(char*)(((PetscObject)qep)->type_name?((PetscObject)qep)->type_name:QEPLINEAR),type,256,&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetType(qep,type);CHKERRQ(ierr); } else if (!((PetscObject)qep)->type_name) { ierr = QEPSetType(qep,QEPLINEAR);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupBegin("-qep_general","general quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetProblemType(qep,QEP_GENERAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_hermitian","hermitian quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetProblemType(qep,QEP_HERMITIAN);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-qep_gyroscopic","gyroscopic quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetProblemType(qep,QEP_GYROSCOPIC);CHKERRQ(ierr); } r = 0; ierr = PetscOptionsReal("-qep_scale","Scale factor","QEPSetScaleFactor",qep->sfactor,&r,NULL);CHKERRQ(ierr); ierr = QEPSetScaleFactor(qep,r);CHKERRQ(ierr); r = i = 0; ierr = PetscOptionsInt("-qep_max_it","Maximum number of iterations","QEPSetTolerances",qep->max_it,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-qep_tol","Tolerance","QEPSetTolerances",qep->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:qep->tol,&r,NULL);CHKERRQ(ierr); ierr = QEPSetTolerances(qep,r,i);CHKERRQ(ierr); ierr = PetscOptionsBoolGroupBegin("-qep_convergence_default","Default (relative error) convergence test","QEPSetConvergenceTest",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetConvergenceTest(qep,QEPConvergedDefault,NULL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-qep_convergence_absolute","Absolute error convergence test","QEPSetConvergenceTest",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetConvergenceTest(qep,QEPConvergedAbsolute,NULL);CHKERRQ(ierr); } i = j = k = 0; ierr = PetscOptionsInt("-qep_nev","Number of eigenvalues to compute","QEPSetDimensions",qep->nev,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-qep_ncv","Number of basis vectors","QEPSetDimensions",qep->ncv,&j,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-qep_mpd","Maximum dimension of projected problem","QEPSetDimensions",qep->mpd,&k,NULL);CHKERRQ(ierr); ierr = QEPSetDimensions(qep,i,j,k);CHKERRQ(ierr); ierr = PetscOptionsScalar("-qep_target","Value of the target","QEPSetTarget",qep->target,&s,&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_TARGET_MAGNITUDE);CHKERRQ(ierr); ierr = QEPSetTarget(qep,s);CHKERRQ(ierr); } /* -----------------------------------------------------------------------*/ /* Cancels all monitors hardwired into code before call to QEPSetFromOptions() */ flg = PETSC_FALSE; ierr = PetscOptionsBool("-qep_monitor_cancel","Remove any hardwired monitor routines","QEPMonitorCancel",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = QEPMonitorCancel(qep);CHKERRQ(ierr); } /* Prints approximate eigenvalues and error estimates at each iteration */ ierr = PetscOptionsString("-qep_monitor","Monitor first unconverged approximate eigenvalue and error estimate","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)qep),monfilename,&monviewer);CHKERRQ(ierr); ierr = QEPMonitorSet(qep,QEPMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-qep_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);CHKERRQ(ierr); ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)qep),monfilename,&ctx->viewer);CHKERRQ(ierr); ierr = QEPMonitorSet(qep,QEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-qep_monitor_all","Monitor approximate eigenvalues and error estimates","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)qep),monfilename,&monviewer);CHKERRQ(ierr); ierr = QEPMonitorSet(qep,QEPMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); ierr = QEPSetTrackAll(qep,PETSC_TRUE);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-qep_monitor_lg","Monitor first unconverged approximate error estimate graphically","QEPMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = QEPMonitorSet(qep,QEPMonitorLG,NULL,NULL);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-qep_monitor_lg_all","Monitor error estimates graphically","QEPMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = QEPMonitorSet(qep,QEPMonitorLGAll,NULL,NULL);CHKERRQ(ierr); ierr = QEPSetTrackAll(qep,PETSC_TRUE);CHKERRQ(ierr); } /* -----------------------------------------------------------------------*/ ierr = PetscOptionsBoolGroupBegin("-qep_largest_magnitude","compute largest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_smallest_magnitude","compute smallest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_largest_real","compute largest real parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_smallest_real","compute smallest real parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_largest_imaginary","compute largest imaginary parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_smallest_imaginary","compute smallest imaginary parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_target_magnitude","compute nearest eigenvalues to target","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_TARGET_MAGNITUDE);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroup("-qep_target_real","compute eigenvalues with real parts close to target","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_TARGET_REAL);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-qep_target_imaginary","compute eigenvalues with imaginary parts close to target","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetWhichEigenpairs(qep,QEP_TARGET_IMAGINARY);CHKERRQ(ierr); } ierr = PetscOptionsBool("-qep_left_vectors","Compute left eigenvectors also","QEPSetLeftVectorsWanted",qep->leftvecs,&val,&flg);CHKERRQ(ierr); if (flg) { ierr = QEPSetLeftVectorsWanted(qep,val);CHKERRQ(ierr); } ierr = PetscOptionsName("-qep_view","Print detailed information on solver used","QEPView",0);CHKERRQ(ierr); ierr = PetscOptionsName("-qep_plot_eigs","Make a plot of the computed eigenvalues","QEPSolve",0);CHKERRQ(ierr); if (qep->ops->setfromoptions) { ierr = (*qep->ops->setfromoptions)(qep);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)qep);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } ierr = IPSetFromOptions(qep->ip);CHKERRQ(ierr); if (!qep->ds) { ierr = QEPGetDS(qep,&qep->ds);CHKERRQ(ierr); } ierr = DSSetFromOptions(qep->ds);CHKERRQ(ierr); if (!qep->st) { ierr = QEPGetST(qep,&qep->st);CHKERRQ(ierr); } ierr = STSetFromOptions(qep->st);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(qep->rand);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetTolerances" /*@ QEPGetTolerances - Gets the tolerance and maximum iteration count used by the QEP convergence tests. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameters: + tol - the convergence tolerance - maxits - maximum number of iterations Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: QEPSetTolerances() @*/ PetscErrorCode QEPGetTolerances(QEP qep,PetscReal *tol,PetscInt *maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (tol) *tol = qep->tol; if (maxits) *maxits = qep->max_it; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetTolerances" /*@ QEPSetTolerances - Sets the tolerance and maximum iteration count used by the QEP convergence tests. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context . tol - the convergence tolerance - maxits - maximum number of iterations to use Options Database Keys: + -qep_tol - Sets the convergence tolerance - -qep_max_it - Sets the maximum number of iterations allowed Notes: Pass 0 for an argument that need not be changed. Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method. Level: intermediate .seealso: QEPGetTolerances() @*/ PetscErrorCode QEPSetTolerances(QEP qep,PetscReal tol,PetscInt maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveReal(qep,tol,2); PetscValidLogicalCollectiveInt(qep,maxits,3); if (tol) { if (tol == PETSC_DEFAULT) { qep->tol = PETSC_DEFAULT; } else { if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0"); qep->tol = tol; } } if (maxits) { if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) { qep->max_it = 0; qep->setupcalled = 0; } else { if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0"); qep->max_it = maxits; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetDimensions" /*@ QEPGetDimensions - Gets the number of eigenvalues to compute and the dimension of the subspace. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameters: + nev - number of eigenvalues to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: QEPSetDimensions() @*/ PetscErrorCode QEPGetDimensions(QEP qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (nev) *nev = qep->nev; if (ncv) *ncv = qep->ncv; if (mpd) *mpd = qep->mpd; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetDimensions" /*@ QEPSetDimensions - Sets the number of eigenvalues to compute and the dimension of the subspace. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context . nev - number of eigenvalues to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Options Database Keys: + -qep_nev - Sets the number of eigenvalues . -qep_ncv - Sets the dimension of the subspace - -qep_mpd - Sets the maximum projected dimension Notes: Pass 0 to retain the previous value of any parameter. Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method. The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and (b) in cases where nev is large, the user sets mpd. The value of ncv should always be between nev and (nev+mpd), typically ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise a smaller value should be used. Level: intermediate .seealso: QEPGetDimensions() @*/ PetscErrorCode QEPSetDimensions(QEP qep,PetscInt nev,PetscInt ncv,PetscInt mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,nev,2); PetscValidLogicalCollectiveInt(qep,ncv,3); PetscValidLogicalCollectiveInt(qep,mpd,4); if (nev) { if (nev<1) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0"); qep->nev = nev; qep->setupcalled = 0; } if (ncv) { if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) { qep->ncv = 0; } else { if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0"); qep->ncv = ncv; } qep->setupcalled = 0; } if (mpd) { if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) { qep->mpd = 0; } else { if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0"); qep->mpd = mpd; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetWhichEigenpairs" /*@ QEPSetWhichEigenpairs - Specifies which portion of the spectrum is to be sought. Logically Collective on QEP Input Parameters: + qep - eigensolver context obtained from QEPCreate() - which - the portion of the spectrum to be sought Possible values: The parameter 'which' can have one of these values + QEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default) . QEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude . QEP_LARGEST_REAL - largest real parts . QEP_SMALLEST_REAL - smallest real parts . QEP_LARGEST_IMAGINARY - largest imaginary parts . QEP_SMALLEST_IMAGINARY - smallest imaginary parts . QEP_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude) . QEP_TARGET_REAL - eigenvalues with real part closest to target - QEP_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target Options Database Keys: + -qep_largest_magnitude - Sets largest eigenvalues in magnitude . -qep_smallest_magnitude - Sets smallest eigenvalues in magnitude . -qep_largest_real - Sets largest real parts . -qep_smallest_real - Sets smallest real parts . -qep_largest_imaginary - Sets largest imaginary parts . -qep_smallest_imaginary - Sets smallest imaginary parts . -qep_target_magnitude - Sets eigenvalues closest to target . -qep_target_real - Sets real parts closest to target - -qep_target_imaginary - Sets imaginary parts closest to target Notes: Not all eigensolvers implemented in QEP account for all the possible values stated above. If SLEPc is compiled for real numbers QEP_LARGEST_IMAGINARY and QEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection. Level: intermediate .seealso: QEPGetWhichEigenpairs(), QEPWhich @*/ PetscErrorCode QEPSetWhichEigenpairs(QEP qep,QEPWhich which) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveEnum(qep,which,2); if (which) { if (which==PETSC_DECIDE || which==PETSC_DEFAULT) qep->which = (QEPWhich)0; else switch (which) { case QEP_LARGEST_MAGNITUDE: case QEP_SMALLEST_MAGNITUDE: case QEP_LARGEST_REAL: case QEP_SMALLEST_REAL: case QEP_LARGEST_IMAGINARY: case QEP_SMALLEST_IMAGINARY: case QEP_TARGET_MAGNITUDE: case QEP_TARGET_REAL: #if defined(PETSC_USE_COMPLEX) case QEP_TARGET_IMAGINARY: #endif if (qep->which != which) { qep->setupcalled = 0; qep->which = which; } break; default: SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value"); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetWhichEigenpairs" /*@C QEPGetWhichEigenpairs - Returns which portion of the spectrum is to be sought. Not Collective Input Parameter: . qep - eigensolver context obtained from QEPCreate() Output Parameter: . which - the portion of the spectrum to be sought Notes: See QEPSetWhichEigenpairs() for possible values of 'which'. Level: intermediate .seealso: QEPSetWhichEigenpairs(), QEPWhich @*/ PetscErrorCode QEPGetWhichEigenpairs(QEP qep,QEPWhich *which) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(which,2); *which = qep->which; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetLeftVectorsWanted" /*@ QEPSetLeftVectorsWanted - Specifies which eigenvectors are required. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context - leftvecs - whether left eigenvectors are required or not Options Database Keys: . -qep_left_vectors - Sets/resets the boolean flag 'leftvecs' Notes: If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of the algorithm that computes both right and left eigenvectors. This is usually much more costly. This option is not available in all solvers. Level: intermediate .seealso: QEPGetLeftVectorsWanted() @*/ PetscErrorCode QEPSetLeftVectorsWanted(QEP qep,PetscBool leftvecs) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveBool(qep,leftvecs,2); if (qep->leftvecs != leftvecs) { qep->leftvecs = leftvecs; qep->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetLeftVectorsWanted" /*@C QEPGetLeftVectorsWanted - Returns the flag indicating whether left eigenvectors are required or not. Not Collective Input Parameter: . qep - the eigensolver context Output Parameter: . leftvecs - the returned flag Level: intermediate .seealso: QEPSetLeftVectorsWanted() @*/ PetscErrorCode QEPGetLeftVectorsWanted(QEP qep,PetscBool *leftvecs) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(leftvecs,2); *leftvecs = qep->leftvecs; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetScaleFactor" /*@ QEPGetScaleFactor - Gets the factor used for scaling the quadratic eigenproblem. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameters: . alpha - the scaling factor Notes: If the user did not specify a scaling factor, then after QEPSolve() the default value is returned. Level: intermediate .seealso: QEPSetScaleFactor(), QEPSolve() @*/ PetscErrorCode QEPGetScaleFactor(QEP qep,PetscReal *alpha) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(alpha,2); *alpha = qep->sfactor; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetScaleFactor" /*@ QEPSetScaleFactor - Sets the scaling factor to be used for scaling the quadratic problem before attempting to solve. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context - alpha - the scaling factor Options Database Keys: . -qep_scale - Sets the scaling factor Notes: For the problem (l^2*M + l*C + K)*x = 0, the effect of scaling is to work with matrices (alpha^2*M, alpha*C, K), then scale the computed eigenvalue. The default is to scale with alpha = norm(K)/norm(M). Level: intermediate .seealso: QEPGetScaleFactor() @*/ PetscErrorCode QEPSetScaleFactor(QEP qep,PetscReal alpha) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveReal(qep,alpha,2); if (alpha) { if (alpha == PETSC_DEFAULT || alpha == PETSC_DECIDE) { qep->sfactor = 0.0; qep->sfactor_set = PETSC_FALSE; } else { if (alpha < 0.0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of alpha. Must be > 0"); qep->sfactor = alpha; qep->sfactor_set = PETSC_TRUE; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetProblemType" /*@ QEPSetProblemType - Specifies the type of the quadratic eigenvalue problem. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context - type - a known type of quadratic eigenvalue problem Options Database Keys: + -qep_general - general problem with no particular structure . -qep_hermitian - problem whose coefficient matrices are Hermitian - -qep_gyroscopic - problem with Hamiltonian structure Notes: Allowed values for the problem type are: general (QEP_GENERAL), Hermitian (QEP_HERMITIAN), and gyroscopic (QEP_GYROSCOPIC). This function is used to instruct SLEPc to exploit certain structure in the quadratic eigenproblem. By default, no particular structure is assumed. If the problem matrices are Hermitian (symmetric in the real case) or Hermitian/skew-Hermitian then the solver can exploit this fact to perform less operations or provide better stability. Level: intermediate .seealso: QEPSetOperators(), QEPSetType(), QEPGetProblemType(), QEPProblemType @*/ PetscErrorCode QEPSetProblemType(QEP qep,QEPProblemType type) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveEnum(qep,type,2); if (type!=QEP_GENERAL && type!=QEP_HERMITIAN && type!=QEP_GYROSCOPIC) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type"); qep->problem_type = type; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetProblemType" /*@C QEPGetProblemType - Gets the problem type from the QEP object. Not Collective Input Parameter: . qep - the quadratic eigensolver context Output Parameter: . type - name of QEP problem type Level: intermediate .seealso: QEPSetProblemType(), QEPProblemType @*/ PetscErrorCode QEPGetProblemType(QEP qep,QEPProblemType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(type,2); *type = qep->problem_type; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetConvergenceTest" /*@C QEPSetConvergenceTest - Sets a function to compute the error estimate used in the convergence test. Logically Collective on QEP Input Parameters: + qep - eigensolver context obtained from QEPCreate() . func - a pointer to the convergence test function - ctx - a context pointer (the last parameter to the convergence test function) Calling Sequence of func: $ func(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal* errest,void *ctx) + qep - eigensolver context obtained from QEPCreate() . eigr - real part of the eigenvalue . eigi - imaginary part of the eigenvalue . res - residual norm associated to the eigenpair . errest - (output) computed error estimate - ctx - optional context, as set by QEPSetConvergenceTest() Note: If the error estimate returned by the convergence test function is less than the tolerance, then the eigenvalue is accepted as converged. Level: advanced .seealso: QEPSetTolerances() @*/ PetscErrorCode QEPSetConvergenceTest(QEP qep,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); qep->converged = func; qep->convergedctx = ctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetTrackAll" /*@ QEPSetTrackAll - Specifies if the solver must compute the residual of all approximate eigenpairs or not. Logically Collective on QEP Input Parameters: + qep - the eigensolver context - trackall - whether compute all residuals or not Notes: If the user sets trackall=PETSC_TRUE then the solver explicitly computes the residual for each eigenpair approximation. Computing the residual is usually an expensive operation and solvers commonly compute the associated residual to the first unconverged eigenpair. The options '-qep_monitor_all' and '-qep_monitor_lg_all' automatically activate this option. Level: intermediate .seealso: QEPGetTrackAll() @*/ PetscErrorCode QEPSetTrackAll(QEP qep,PetscBool trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveBool(qep,trackall,2); qep->trackall = trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetTrackAll" /*@ QEPGetTrackAll - Returns the flag indicating whether all residual norms must be computed or not. Not Collective Input Parameter: . qep - the eigensolver context Output Parameter: . trackall - the returned flag Level: intermediate .seealso: QEPSetTrackAll() @*/ PetscErrorCode QEPGetTrackAll(QEP qep,PetscBool *trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(trackall,2); *trackall = qep->trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetOptionsPrefix" /*@C QEPSetOptionsPrefix - Sets the prefix used for searching for all QEP options in the database. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context - prefix - the prefix string to prepend to all QEP option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different QEP contexts, one could call .vb QEPSetOptionsPrefix(qep1,"qeig1_") QEPSetOptionsPrefix(qep2,"qeig2_") .ve Level: advanced .seealso: QEPAppendOptionsPrefix(), QEPGetOptionsPrefix() @*/ PetscErrorCode QEPSetOptionsPrefix(QEP qep,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(qep->ip,prefix);CHKERRQ(ierr); if (!qep->ds) { ierr = QEPGetDS(qep,&qep->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(qep->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectSetOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPAppendOptionsPrefix" /*@C QEPAppendOptionsPrefix - Appends to the prefix used for searching for all QEP options in the database. Logically Collective on QEP Input Parameters: + qep - the quadratic eigensolver context - prefix - the prefix string to prepend to all QEP option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: QEPSetOptionsPrefix(), QEPGetOptionsPrefix() @*/ PetscErrorCode QEPAppendOptionsPrefix(QEP qep,const char *prefix) { PetscErrorCode ierr; PetscBool flg; EPS eps; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(qep->ip,prefix);CHKERRQ(ierr); if (!qep->ds) { ierr = QEPGetDS(qep,&qep->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(qep->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectAppendOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&flg);CHKERRQ(ierr); if (flg) { ierr = QEPLinearGetEPS(qep,&eps);CHKERRQ(ierr); ierr = EPSSetOptionsPrefix(eps,((PetscObject)qep)->prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(eps,"qep_");CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetOptionsPrefix" /*@C QEPGetOptionsPrefix - Gets the prefix used for searching for all QEP options in the database. Not Collective Input Parameters: . qep - the quadratic eigensolver context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: QEPSetOptionsPrefix(), QEPAppendOptionsPrefix() @*/ PetscErrorCode QEPGetOptionsPrefix(QEP qep,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepsetup.c0000644000175000017500000003427012211062077020767 0ustar gladkgladk/* QEP routines related to problem setup. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcqep.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "QEPSetUp" /*@ QEPSetUp - Sets up all the internal data structures necessary for the execution of the QEP solver. Collective on QEP Input Parameter: . qep - solver context Notes: This function need not be called explicitly in most cases, since QEPSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time. Level: advanced .seealso: QEPCreate(), QEPSolve(), QEPDestroy() @*/ PetscErrorCode QEPSetUp(QEP qep) { PetscErrorCode ierr; PetscBool khas,mhas,islinear,flg; PetscReal knorm,mnorm; Mat mat[3]; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (qep->setupcalled) PetscFunctionReturn(0); ierr = PetscLogEventBegin(QEP_SetUp,qep,0,0,0);CHKERRQ(ierr); /* reset the convergence flag from the previous solves */ qep->reason = QEP_CONVERGED_ITERATING; /* Set default solver type (QEPSetFromOptions was not called) */ if (!((PetscObject)qep)->type_name) { ierr = QEPSetType(qep,QEPLINEAR);CHKERRQ(ierr); } ierr = PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&islinear);CHKERRQ(ierr); if (!islinear) { if (!qep->st) { ierr = QEPGetST(qep,&qep->st);CHKERRQ(ierr); } if (!((PetscObject)qep->st)->type_name) { ierr = STSetType(qep->st,STSHIFT);CHKERRQ(ierr); } } if (!qep->ip) { ierr = QEPGetIP(qep,&qep->ip);CHKERRQ(ierr); } if (!((PetscObject)qep->ip)->type_name) { ierr = IPSetType_Default(qep->ip);CHKERRQ(ierr); } if (!qep->ds) { ierr = QEPGetDS(qep,&qep->ds);CHKERRQ(ierr); } ierr = DSReset(qep->ds);CHKERRQ(ierr); if (!((PetscObject)qep->rand)->type_name) { ierr = PetscRandomSetFromOptions(qep->rand);CHKERRQ(ierr); } /* Check matrices, transfer them to ST */ if (!qep->M || !qep->C || !qep->K) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONGSTATE,"QEPSetOperators must be called first"); if (!islinear) { mat[0] = qep->K; mat[1] = qep->C; mat[2] = qep->M; ierr = STSetOperators(qep->st,3,mat);CHKERRQ(ierr); } /* Set problem dimensions */ ierr = MatGetSize(qep->M,&qep->n,NULL);CHKERRQ(ierr); ierr = MatGetLocalSize(qep->M,&qep->nloc,NULL);CHKERRQ(ierr); ierr = VecDestroy(&qep->t);CHKERRQ(ierr); ierr = SlepcMatGetVecsTemplate(qep->M,&qep->t,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(qep,qep->t);CHKERRQ(ierr); /* Set default problem type */ if (!qep->problem_type) { ierr = QEPSetProblemType(qep,QEP_GENERAL);CHKERRQ(ierr); } /* Compute scaling factor if not set by user */ if (qep->sfactor==0.0) { ierr = MatHasOperation(qep->K,MATOP_NORM,&khas);CHKERRQ(ierr); ierr = MatHasOperation(qep->M,MATOP_NORM,&mhas);CHKERRQ(ierr); if (khas && mhas) { ierr = MatNorm(qep->K,NORM_INFINITY,&knorm);CHKERRQ(ierr); ierr = MatNorm(qep->M,NORM_INFINITY,&mnorm);CHKERRQ(ierr); qep->sfactor = PetscSqrtReal(knorm/mnorm); } else qep->sfactor = 1.0; } /* Call specific solver setup */ ierr = (*qep->ops->setup)(qep);CHKERRQ(ierr); /* set tolerance if not yet set */ if (qep->tol==PETSC_DEFAULT) qep->tol = SLEPC_DEFAULT_TOL; /* set eigenvalue comparison */ switch (qep->which) { case QEP_LARGEST_MAGNITUDE: qep->comparison = SlepcCompareLargestMagnitude; qep->comparisonctx = NULL; break; case QEP_SMALLEST_MAGNITUDE: qep->comparison = SlepcCompareSmallestMagnitude; qep->comparisonctx = NULL; break; case QEP_LARGEST_REAL: qep->comparison = SlepcCompareLargestReal; qep->comparisonctx = NULL; break; case QEP_SMALLEST_REAL: qep->comparison = SlepcCompareSmallestReal; qep->comparisonctx = NULL; break; case QEP_LARGEST_IMAGINARY: qep->comparison = SlepcCompareLargestImaginary; qep->comparisonctx = NULL; break; case QEP_SMALLEST_IMAGINARY: qep->comparison = SlepcCompareSmallestImaginary; qep->comparisonctx = NULL; break; case QEP_TARGET_MAGNITUDE: qep->comparison = SlepcCompareTargetMagnitude; qep->comparisonctx = &qep->target; break; case QEP_TARGET_REAL: qep->comparison = SlepcCompareTargetReal; qep->comparisonctx = &qep->target; break; case QEP_TARGET_IMAGINARY: qep->comparison = SlepcCompareTargetImaginary; qep->comparisonctx = &qep->target; break; } if (qep->ncv > 2*qep->n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"ncv must be twice the problem size at most"); if (qep->nev > qep->ncv) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"nev bigger than ncv"); /* Setup ST */ if (!islinear) { ierr = PetscObjectTypeCompareAny((PetscObject)qep->st,&flg,STSHIFT,STSINVERT,"");CHKERRQ(ierr); if (!flg) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_SUP,"Only STSHIFT and STSINVERT spectral transformations can be used in QEP"); ierr = STSetUp(qep->st);CHKERRQ(ierr); } /* process initial vectors */ if (qep->nini<0) { qep->nini = -qep->nini; if (qep->nini>qep->ncv) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The number of initial vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(qep->ip,&qep->nini,&qep->IS,qep->V);CHKERRQ(ierr); } if (qep->ninil<0) { if (!qep->leftvecs) { ierr = PetscInfo(qep,"Ignoring initial left vectors\n");CHKERRQ(ierr); } else { qep->ninil = -qep->ninil; if (qep->ninil>qep->ncv) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The number of initial left vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(qep->ip,&qep->ninil,&qep->ISL,qep->W);CHKERRQ(ierr); } } ierr = PetscLogEventEnd(QEP_SetUp,qep,0,0,0);CHKERRQ(ierr); qep->setupcalled = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetOperators" /*@ QEPSetOperators - Sets the matrices associated with the quadratic eigenvalue problem. Collective on QEP and Mat Input Parameters: + qep - the eigenproblem solver context . M - the first coefficient matrix . C - the second coefficient matrix - K - the third coefficient matrix Notes: The quadratic eigenproblem is defined as (l^2*M + l*C + K)*x = 0, where l is the eigenvalue and x is the eigenvector. Level: beginner .seealso: QEPSolve(), QEPGetOperators() @*/ PetscErrorCode QEPSetOperators(QEP qep,Mat M,Mat C,Mat K) { PetscErrorCode ierr; PetscInt m,n,m0; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidHeaderSpecific(M,MAT_CLASSID,2); PetscValidHeaderSpecific(C,MAT_CLASSID,3); PetscValidHeaderSpecific(K,MAT_CLASSID,4); PetscCheckSameComm(qep,1,M,2); PetscCheckSameComm(qep,1,C,3); PetscCheckSameComm(qep,1,K,4); /* Check for square matrices */ ierr = MatGetSize(M,&m,&n);CHKERRQ(ierr); if (m!=n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"M is a non-square matrix"); m0=m; ierr = MatGetSize(C,&m,&n);CHKERRQ(ierr); if (m!=n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"C is a non-square matrix"); if (m!=m0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_INCOMP,"Dimensions of M and C do not match"); ierr = MatGetSize(K,&m,&n);CHKERRQ(ierr); if (m!=n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"K is a non-square matrix"); if (m!=m0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_INCOMP,"Dimensions of M and K do not match"); /* Store a copy of the matrices */ if (qep->setupcalled) { ierr = QEPReset(qep);CHKERRQ(ierr); } ierr = PetscObjectReference((PetscObject)M);CHKERRQ(ierr); ierr = MatDestroy(&qep->M);CHKERRQ(ierr); qep->M = M; ierr = PetscObjectReference((PetscObject)C);CHKERRQ(ierr); ierr = MatDestroy(&qep->C);CHKERRQ(ierr); qep->C = C; ierr = PetscObjectReference((PetscObject)K);CHKERRQ(ierr); ierr = MatDestroy(&qep->K);CHKERRQ(ierr); qep->K = K; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPGetOperators" /*@ QEPGetOperators - Gets the matrices associated with the quadratic eigensystem. Collective on QEP and Mat Input Parameter: . qep - the QEP context Output Parameters: + M - the first coefficient matrix . C - the second coefficient matrix - K - the third coefficient matrix Level: intermediate .seealso: QEPSolve(), QEPSetOperators() @*/ PetscErrorCode QEPGetOperators(QEP qep,Mat *M,Mat *C,Mat *K) { PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); if (M) { PetscValidPointer(M,2); *M = qep->M; } if (C) { PetscValidPointer(C,3); *C = qep->C; } if (K) { PetscValidPointer(K,4); *K = qep->K; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetInitialSpace" /*@ QEPSetInitialSpace - Specify a basis of vectors that constitute the initial space, that is, the subspace from which the solver starts to iterate. Collective on QEP and Vec Input Parameter: + qep - the quadratic eigensolver context . n - number of vectors - is - set of basis vectors of the initial space Notes: Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored. These vectors do not persist from one QEPSolve() call to the other, so the initial space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster. Level: intermediate .seealso: QEPSetInitialSpaceLeft() @*/ PetscErrorCode QEPSetInitialSpace(QEP qep,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&qep->nini,&qep->IS);CHKERRQ(ierr); if (n>0) qep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPSetInitialSpaceLeft" /*@ QEPSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial left space, that is, the subspace from which the solver starts to iterate for building the left subspace (in methods that work with two subspaces). Collective on QEP and Vec Input Parameter: + qep - the quadratic eigensolver context . n - number of vectors - is - set of basis vectors of the initial left space Notes: Some solvers start to iterate on a single vector (initial left vector). In that case, the other vectors are ignored. These vectors do not persist from one QEPSolve() call to the other, so the initial left space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted left eigenspace. Then, convergence may be faster. Level: intermediate .seealso: QEPSetInitialSpace() @*/ PetscErrorCode QEPSetInitialSpaceLeft(QEP qep,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(qep,QEP_CLASSID,1); PetscValidLogicalCollectiveInt(qep,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&qep->ninil,&qep->ISL);CHKERRQ(ierr); if (n>0) qep->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPAllocateSolution" /* QEPAllocateSolution - Allocate memory storage for common variables such as eigenvalues and eigenvectors. All vectors in V (and W) share a contiguous chunk of memory. */ PetscErrorCode QEPAllocateSolution(QEP qep) { PetscErrorCode ierr; PetscInt newc,cnt; PetscFunctionBegin; if (qep->allocated_ncv != qep->ncv) { newc = PetscMax(0,qep->ncv-qep->allocated_ncv); ierr = QEPFreeSolution(qep);CHKERRQ(ierr); cnt = 0; ierr = PetscMalloc(qep->ncv*sizeof(PetscScalar),&qep->eigr);CHKERRQ(ierr); ierr = PetscMalloc(qep->ncv*sizeof(PetscScalar),&qep->eigi);CHKERRQ(ierr); cnt += 2*newc*sizeof(PetscScalar); ierr = PetscMalloc(qep->ncv*sizeof(PetscReal),&qep->errest);CHKERRQ(ierr); ierr = PetscMalloc(qep->ncv*sizeof(PetscInt),&qep->perm);CHKERRQ(ierr); cnt += 2*newc*sizeof(PetscReal); ierr = PetscLogObjectMemory(qep,cnt);CHKERRQ(ierr); ierr = VecDuplicateVecs(qep->t,qep->ncv,&qep->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(qep,qep->ncv,qep->V);CHKERRQ(ierr); qep->allocated_ncv = qep->ncv; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "QEPFreeSolution" /* QEPFreeSolution - Free memory storage. This routine is related to QEPAllocateSolution(). */ PetscErrorCode QEPFreeSolution(QEP qep) { PetscErrorCode ierr; PetscFunctionBegin; if (qep->allocated_ncv > 0) { ierr = PetscFree(qep->eigr);CHKERRQ(ierr); ierr = PetscFree(qep->eigi);CHKERRQ(ierr); ierr = PetscFree(qep->errest);CHKERRQ(ierr); ierr = PetscFree(qep->perm);CHKERRQ(ierr); ierr = VecDestroyVecs(qep->allocated_ncv,&qep->V);CHKERRQ(ierr); qep->allocated_ncv = 0; } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/qep/interface/makefile0000644000175000017500000000224112211062077020446 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = qepmon.c qepbasic.c qepdefault.c qepregis.c qepopts.c qepsetup.c qepsolve.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = QEP LOCDIR = src/qep/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/interface/makefile.html0000644000175000017500000000403512211062077021414 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = qepmon.c qepbasic.c qepdefault.c qepregis.c qepopts.c qepsetup.c qepsolve.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = QEP
LOCDIR   = src/qep/interface/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/qep/interface/index.html0000644000175000017500000000250212211062077020743 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

qepmon.c
qepbasic.c
qepdefault.c
qepregis.c
qepopts.c
qepsetup.c
qepsolve.c
makefile
slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-custom/0000755000175000017500000000000012214143515021046 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/interface/ftn-custom/makefile0000644000175000017500000000217412211062077022552 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zqepf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/qep/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-custom/zqepf.c0000644000175000017500000002263612211062077022350 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define qepdestroy_ QEPDESTROY #define qepview_ QEPVIEW #define qepsetoptionsprefix_ QEPSETOPTIONSPREFIX #define qepappendoptionsprefix_ QEPAPPENDOPTIONSPREFIX #define qepgetoptionsprefix_ QEPGETOPTIONSPREFIX #define qepcreate_ QEPCREATE #define qepsettype_ QEPSETTYPE #define qepgettype_ QEPGETTYPE #define qepmonitorall_ QEPMONITORALL #define qepmonitorlg_ QEPMONITORLG #define qepmonitorlgall_ QEPMONITORLGALL #define qepmonitorset_ QEPMONITORSET #define qepmonitorconverged_ QEPMONITORCONVERGED #define qepmonitorfirst_ QEPMONITORFIRST #define qepgetip_ QEPGETIP #define qepgetds_ QEPGETDS #define qepgetwhicheigenpairs_ QEPGETWHICHEIGENPAIRS #define qepgetproblemtype_ QEPGETPROBLEMTYPE #define qepgetconvergedreason_ QEPGETCONVERGEDREASON #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define qepdestroy_ qepdestroy #define qepview_ qepview #define qepsetoptionsprefix_ qepsetoptionsprefix #define qepappendoptionsprefix_ qepappendoptionsprefix #define qepgetoptionsprefix_ qepgetoptionsprefix #define qepcreate_ qepcreate #define qepsettype_ qepsettype #define qepgettype_ qepgettype #define qepmonitorall_ qepmonitorall #define qepmonitorlg_ qepmonitorlg #define qepmonitorlgall_ qepmonitorlgall #define qepmonitorset_ qepmonitorset #define qepmonitorconverged_ qepmonitorconverged #define qepmonitorfirst_ qepmonitorfirst #define qepgetip_ qepgetip #define qepgetds_ qepgetds #define qepgetwhicheigenpairs_ qepgetwhicheigenpairs #define qepgetproblemtype_ qepgetproblemtype #define qepgetconvergedreason_ qepgetconvergedreason #endif /* These are not usually called from Fortran but allow Fortran users to transparently set these monitors from .F code, hence no STDCALL */ PETSC_EXTERN void qepmonitorall_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = QEPMonitorAll(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void qepmonitorlg_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = QEPMonitorLG(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void qepmonitorlgall_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = QEPMonitorLGAll(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void qepmonitorconverged_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = QEPMonitorConverged(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx); } PETSC_EXTERN void qepmonitorfirst_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = QEPMonitorFirst(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx); } static struct { PetscFortranCallbackId monitor; PetscFortranCallbackId monitordestroy; } _cb; /* These are not extern C because they are passed into non-extern C user level functions */ #undef __FUNCT__ #define __FUNCT__ "ourmonitor" static PetscErrorCode ourmonitor(QEP qep,PetscInt i,PetscInt nc,PetscScalar *er,PetscScalar *ei,PetscReal *d,PetscInt l,void* ctx) { PetscObjectUseFortranCallback(qep,_cb.monitor,(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),(&qep,&i,&nc,er,ei,d,&l,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourdestroy" static PetscErrorCode ourdestroy(void** ctx) { QEP qep = (QEP)*ctx; PetscObjectUseFortranCallback(qep,_cb.monitordestroy,(void*,PetscErrorCode*),(_ctx,&ierr)); return 0; } PETSC_EXTERN void PETSC_STDCALL qepdestroy_(QEP *qep,PetscErrorCode *ierr) { *ierr = QEPDestroy(qep); } PETSC_EXTERN void PETSC_STDCALL qepview_(QEP *qep,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = QEPView(*qep,v); } PETSC_EXTERN void PETSC_STDCALL qepsettype_(QEP *qep,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(type,len,t); *ierr = QEPSetType(*qep,t); FREECHAR(type,t); } PETSC_EXTERN void PETSC_STDCALL qepgettype_(QEP *qep,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { QEPType tname; *ierr = QEPGetType(*qep,&tname);if (*ierr) return; *ierr = PetscStrncpy(name,tname,len); FIXRETURNCHAR(PETSC_TRUE,name,len); } PETSC_EXTERN void PETSC_STDCALL qepsetoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = QEPSetOptionsPrefix(*qep,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL qepappendoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = QEPAppendOptionsPrefix(*qep,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL qepcreate_(MPI_Fint *comm,QEP *qep,PetscErrorCode *ierr) { *ierr = QEPCreate(MPI_Comm_f2c(*(comm)),qep); } PETSC_EXTERN void PETSC_STDCALL qepgetoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = QEPGetOptionsPrefix(*qep,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL qepmonitorset_(QEP *qep,void (PETSC_STDCALL *monitor)(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr) { SlepcConvMonitor ctx; CHKFORTRANNULLOBJECT(mctx); CHKFORTRANNULLFUNCTION(monitordestroy); if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorall_) { *ierr = QEPMonitorSet(*qep,QEPMonitorAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorlg_) { *ierr = QEPMonitorSet(*qep,QEPMonitorLG,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorlgall_) { *ierr = QEPMonitorSet(*qep,QEPMonitorLGAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorconverged_) { if (!FORTRANNULLOBJECT(mctx)) { PetscError(PetscObjectComm((PetscObject)*qep),__LINE__,"qepmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to QEPMonitorSet"); *ierr = 1; return; } *ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx); if (*ierr) return; ctx->viewer = NULL; *ierr = QEPMonitorSet(*qep,QEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorfirst_) { *ierr = QEPMonitorSet(*qep,QEPMonitorFirst,0,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*qep,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)monitor,mctx); if (*ierr) return; if (!monitordestroy) { *ierr = QEPMonitorSet(*qep,ourmonitor,*qep,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*qep,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitordestroy,(PetscVoidFunction)monitordestroy,mctx); if (*ierr) return; *ierr = QEPMonitorSet(*qep,ourmonitor,*qep,ourdestroy); } } } PETSC_EXTERN void PETSC_STDCALL qepgetip_(QEP *qep,IP *ip,PetscErrorCode *ierr) { *ierr = QEPGetIP(*qep,ip); } PETSC_EXTERN void PETSC_STDCALL qepgetds_(QEP *qep,DS *ds,PetscErrorCode *ierr) { *ierr = QEPGetDS(*qep,ds); } PETSC_EXTERN void PETSC_STDCALL qepgetwhicheigenpairs_(QEP *qep,QEPWhich *which,PetscErrorCode *ierr) { *ierr = QEPGetWhichEigenpairs(*qep,which); } PETSC_EXTERN void PETSC_STDCALL qepgetproblemtype_(QEP *qep,QEPProblemType *type,PetscErrorCode *ierr) { *ierr = QEPGetProblemType(*qep,type); } PETSC_EXTERN void PETSC_STDCALL qepgetconvergedreason_(QEP *qep,QEPConvergedReason *reason,PetscErrorCode *ierr) { *ierr = QEPGetConvergedReason(*qep,reason); } slepc-3.4.2.dfsg.orig/src/qep/interface/qepsetup.c.html0000644000175000017500000007525612211062077021743 0ustar gladkgladk

Actual source code: qepsetup.c

  1: /*
  2:       QEP routines related to problem setup.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/qepimpl.h>       /*I "slepcqep.h" I*/
 25: #include <slepc-private/ipimpl.h>

 29: /*@
 30:    QEPSetUp - Sets up all the internal data structures necessary for the
 31:    execution of the QEP solver.

 33:    Collective on QEP

 35:    Input Parameter:
 36: .  qep   - solver context

 38:    Notes:
 39:    This function need not be called explicitly in most cases, since QEPSolve()
 40:    calls it. It can be useful when one wants to measure the set-up time
 41:    separately from the solve time.

 43:    Level: advanced

 45: .seealso: QEPCreate(), QEPSolve(), QEPDestroy()
 46: @*/
 47: PetscErrorCode QEPSetUp(QEP qep)
 48: {
 50:   PetscBool      khas,mhas,islinear,flg;
 51:   PetscReal      knorm,mnorm;
 52:   Mat            mat[3];

 56:   if (qep->setupcalled) return(0);
 57:   PetscLogEventBegin(QEP_SetUp,qep,0,0,0);

 59:   /* reset the convergence flag from the previous solves */
 60:   qep->reason = QEP_CONVERGED_ITERATING;

 62:   /* Set default solver type (QEPSetFromOptions was not called) */
 63:   if (!((PetscObject)qep)->type_name) {
 64:     QEPSetType(qep,QEPLINEAR);
 65:   }
 66:   PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&islinear);
 67:   if (!islinear) {
 68:     if (!qep->st) { QEPGetST(qep,&qep->st); }
 69:     if (!((PetscObject)qep->st)->type_name) {
 70:       STSetType(qep->st,STSHIFT);
 71:     }
 72:   }
 73:   if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
 74:   if (!((PetscObject)qep->ip)->type_name) {
 75:     IPSetType_Default(qep->ip);
 76:   }
 77:   if (!qep->ds) { QEPGetDS(qep,&qep->ds); }
 78:   DSReset(qep->ds);
 79:   if (!((PetscObject)qep->rand)->type_name) {
 80:     PetscRandomSetFromOptions(qep->rand);
 81:   }

 83:   /* Check matrices, transfer them to ST */
 84:   if (!qep->M || !qep->C || !qep->K) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONGSTATE,"QEPSetOperators must be called first");
 85:   if (!islinear) {
 86:     mat[0] = qep->K;
 87:     mat[1] = qep->C;
 88:     mat[2] = qep->M;
 89:     STSetOperators(qep->st,3,mat);
 90:   }

 92:   /* Set problem dimensions */
 93:   MatGetSize(qep->M,&qep->n,NULL);
 94:   MatGetLocalSize(qep->M,&qep->nloc,NULL);
 95:   VecDestroy(&qep->t);
 96:   SlepcMatGetVecsTemplate(qep->M,&qep->t,NULL);
 97:   PetscLogObjectParent(qep,qep->t);

 99:   /* Set default problem type */
100:   if (!qep->problem_type) {
101:     QEPSetProblemType(qep,QEP_GENERAL);
102:   }

104:   /* Compute scaling factor if not set by user */
105:   if (qep->sfactor==0.0) {
106:     MatHasOperation(qep->K,MATOP_NORM,&khas);
107:     MatHasOperation(qep->M,MATOP_NORM,&mhas);
108:     if (khas && mhas) {
109:       MatNorm(qep->K,NORM_INFINITY,&knorm);
110:       MatNorm(qep->M,NORM_INFINITY,&mnorm);
111:       qep->sfactor = PetscSqrtReal(knorm/mnorm);
112:     } else qep->sfactor = 1.0;
113:   }

115:   /* Call specific solver setup */
116:   (*qep->ops->setup)(qep);

118:   /* set tolerance if not yet set */
119:   if (qep->tol==PETSC_DEFAULT) qep->tol = SLEPC_DEFAULT_TOL;

121:   /* set eigenvalue comparison */
122:   switch (qep->which) {
123:     case QEP_LARGEST_MAGNITUDE:
124:       qep->comparison    = SlepcCompareLargestMagnitude;
125:       qep->comparisonctx = NULL;
126:       break;
127:     case QEP_SMALLEST_MAGNITUDE:
128:       qep->comparison    = SlepcCompareSmallestMagnitude;
129:       qep->comparisonctx = NULL;
130:       break;
131:     case QEP_LARGEST_REAL:
132:       qep->comparison    = SlepcCompareLargestReal;
133:       qep->comparisonctx = NULL;
134:       break;
135:     case QEP_SMALLEST_REAL:
136:       qep->comparison    = SlepcCompareSmallestReal;
137:       qep->comparisonctx = NULL;
138:       break;
139:     case QEP_LARGEST_IMAGINARY:
140:       qep->comparison    = SlepcCompareLargestImaginary;
141:       qep->comparisonctx = NULL;
142:       break;
143:     case QEP_SMALLEST_IMAGINARY:
144:       qep->comparison    = SlepcCompareSmallestImaginary;
145:       qep->comparisonctx = NULL;
146:       break;
147:     case QEP_TARGET_MAGNITUDE:
148:       qep->comparison    = SlepcCompareTargetMagnitude;
149:       qep->comparisonctx = &qep->target;
150:       break;
151:     case QEP_TARGET_REAL:
152:       qep->comparison    = SlepcCompareTargetReal;
153:       qep->comparisonctx = &qep->target;
154:       break;
155:     case QEP_TARGET_IMAGINARY:
156:       qep->comparison    = SlepcCompareTargetImaginary;
157:       qep->comparisonctx = &qep->target;
158:       break;
159:   }

161:   if (qep->ncv > 2*qep->n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"ncv must be twice the problem size at most");
162:   if (qep->nev > qep->ncv) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"nev bigger than ncv");

164:   /* Setup ST */
165:   if (!islinear) {
166:     PetscObjectTypeCompareAny((PetscObject)qep->st,&flg,STSHIFT,STSINVERT,"");
167:     if (!flg) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_SUP,"Only STSHIFT and STSINVERT spectral transformations can be used in QEP");
168:     STSetUp(qep->st);
169:   }

171:   /* process initial vectors */
172:   if (qep->nini<0) {
173:     qep->nini = -qep->nini;
174:     if (qep->nini>qep->ncv) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The number of initial vectors is larger than ncv");
175:     IPOrthonormalizeBasis_Private(qep->ip,&qep->nini,&qep->IS,qep->V);
176:   }
177:   if (qep->ninil<0) {
178:     if (!qep->leftvecs) { PetscInfo(qep,"Ignoring initial left vectors\n"); }
179:     else {
180:       qep->ninil = -qep->ninil;
181:       if (qep->ninil>qep->ncv) SETERRQ(PetscObjectComm((PetscObject)qep),1,"The number of initial left vectors is larger than ncv");
182:       IPOrthonormalizeBasis_Private(qep->ip,&qep->ninil,&qep->ISL,qep->W);
183:     }
184:   }
185:   PetscLogEventEnd(QEP_SetUp,qep,0,0,0);
186:   qep->setupcalled = 1;
187:   return(0);
188: }

192: /*@
193:    QEPSetOperators - Sets the matrices associated with the quadratic eigenvalue problem.

195:    Collective on QEP and Mat

197:    Input Parameters:
198: +  qep - the eigenproblem solver context
199: .  M   - the first coefficient matrix
200: .  C   - the second coefficient matrix
201: -  K   - the third coefficient matrix

203:    Notes:
204:    The quadratic eigenproblem is defined as (l^2*M + l*C + K)*x = 0, where l is
205:    the eigenvalue and x is the eigenvector.

207:    Level: beginner

209: .seealso: QEPSolve(), QEPGetOperators()
210: @*/
211: PetscErrorCode QEPSetOperators(QEP qep,Mat M,Mat C,Mat K)
212: {
214:   PetscInt       m,n,m0;


225:   /* Check for square matrices */
226:   MatGetSize(M,&m,&n);
227:   if (m!=n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"M is a non-square matrix");
228:   m0=m;
229:   MatGetSize(C,&m,&n);
230:   if (m!=n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"C is a non-square matrix");
231:   if (m!=m0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_INCOMP,"Dimensions of M and C do not match");
232:   MatGetSize(K,&m,&n);
233:   if (m!=n) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"K is a non-square matrix");
234:   if (m!=m0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_INCOMP,"Dimensions of M and K do not match");

236:   /* Store a copy of the matrices */
237:   if (qep->setupcalled) { QEPReset(qep); }
238:   PetscObjectReference((PetscObject)M);
239:   MatDestroy(&qep->M);
240:   qep->M = M;
241:   PetscObjectReference((PetscObject)C);
242:   MatDestroy(&qep->C);
243:   qep->C = C;
244:   PetscObjectReference((PetscObject)K);
245:   MatDestroy(&qep->K);
246:   qep->K = K;
247:   return(0);
248: }

252: /*@
253:    QEPGetOperators - Gets the matrices associated with the quadratic eigensystem.

255:    Collective on QEP and Mat

257:    Input Parameter:
258: .  qep - the QEP context

260:    Output Parameters:
261: +  M   - the first coefficient matrix
262: .  C   - the second coefficient matrix
263: -  K   - the third coefficient matrix

265:    Level: intermediate

267: .seealso: QEPSolve(), QEPSetOperators()
268: @*/
269: PetscErrorCode QEPGetOperators(QEP qep,Mat *M,Mat *C,Mat *K)
270: {
276:   return(0);
277: }

281: /*@
282:    QEPSetInitialSpace - Specify a basis of vectors that constitute the initial
283:    space, that is, the subspace from which the solver starts to iterate.

285:    Collective on QEP and Vec

287:    Input Parameter:
288: +  qep   - the quadratic eigensolver context
289: .  n     - number of vectors
290: -  is    - set of basis vectors of the initial space

292:    Notes:
293:    Some solvers start to iterate on a single vector (initial vector). In that case,
294:    the other vectors are ignored.

296:    These vectors do not persist from one QEPSolve() call to the other, so the
297:    initial space should be set every time.

299:    The vectors do not need to be mutually orthonormal, since they are explicitly
300:    orthonormalized internally.

302:    Common usage of this function is when the user can provide a rough approximation
303:    of the wanted eigenspace. Then, convergence may be faster.

305:    Level: intermediate

307: .seealso: QEPSetInitialSpaceLeft()
308: @*/
309: PetscErrorCode QEPSetInitialSpace(QEP qep,PetscInt n,Vec *is)
310: {

316:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
317:   SlepcBasisReference_Private(n,is,&qep->nini,&qep->IS);
318:   if (n>0) qep->setupcalled = 0;
319:   return(0);
320: }

324: /*@
325:    QEPSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial
326:    left space, that is, the subspace from which the solver starts to iterate for
327:    building the left subspace (in methods that work with two subspaces).

329:    Collective on QEP and Vec

331:    Input Parameter:
332: +  qep   - the quadratic eigensolver context
333: .  n     - number of vectors
334: -  is    - set of basis vectors of the initial left space

336:    Notes:
337:    Some solvers start to iterate on a single vector (initial left vector). In that case,
338:    the other vectors are ignored.

340:    These vectors do not persist from one QEPSolve() call to the other, so the
341:    initial left space should be set every time.

343:    The vectors do not need to be mutually orthonormal, since they are explicitly
344:    orthonormalized internally.

346:    Common usage of this function is when the user can provide a rough approximation
347:    of the wanted left eigenspace. Then, convergence may be faster.

349:    Level: intermediate

351: .seealso: QEPSetInitialSpace()
352: @*/
353: PetscErrorCode QEPSetInitialSpaceLeft(QEP qep,PetscInt n,Vec *is)
354: {

360:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
361:   SlepcBasisReference_Private(n,is,&qep->ninil,&qep->ISL);
362:   if (n>0) qep->setupcalled = 0;
363:   return(0);
364: }

368: /*
369:   QEPAllocateSolution - Allocate memory storage for common variables such
370:   as eigenvalues and eigenvectors. All vectors in V (and W) share a
371:   contiguous chunk of memory.
372: */
373: PetscErrorCode QEPAllocateSolution(QEP qep)
374: {
376:   PetscInt       newc,cnt;

379:   if (qep->allocated_ncv != qep->ncv) {
380:     newc = PetscMax(0,qep->ncv-qep->allocated_ncv);
381:     QEPFreeSolution(qep);
382:     cnt = 0;
383:     PetscMalloc(qep->ncv*sizeof(PetscScalar),&qep->eigr);
384:     PetscMalloc(qep->ncv*sizeof(PetscScalar),&qep->eigi);
385:     cnt += 2*newc*sizeof(PetscScalar);
386:     PetscMalloc(qep->ncv*sizeof(PetscReal),&qep->errest);
387:     PetscMalloc(qep->ncv*sizeof(PetscInt),&qep->perm);
388:     cnt += 2*newc*sizeof(PetscReal);
389:     PetscLogObjectMemory(qep,cnt);
390:     VecDuplicateVecs(qep->t,qep->ncv,&qep->V);
391:     PetscLogObjectParents(qep,qep->ncv,qep->V);
392:     qep->allocated_ncv = qep->ncv;
393:   }
394:   return(0);
395: }

399: /*
400:   QEPFreeSolution - Free memory storage. This routine is related to
401:   QEPAllocateSolution().
402: */
403: PetscErrorCode QEPFreeSolution(QEP qep)
404: {

408:   if (qep->allocated_ncv > 0) {
409:     PetscFree(qep->eigr);
410:     PetscFree(qep->eigi);
411:     PetscFree(qep->errest);
412:     PetscFree(qep->perm);
413:     VecDestroyVecs(qep->allocated_ncv,&qep->V);
414:     qep->allocated_ncv = 0;
415:   }
416:   return(0);
417: }

slepc-3.4.2.dfsg.orig/src/qep/interface/qepmon.c.html0000644000175000017500000007347212211062077021372 0ustar gladkgladk
Actual source code: qepmon.c

  1: /*
  2:       QEP routines related to monitors.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/qepimpl.h>      /*I "slepcqep.h" I*/
 25: #include <petscdraw.h>

 29: /*
 30:    Runs the user provided monitor routines, if any.
 31: */
 32: PetscErrorCode QEPMonitor(QEP qep,PetscInt it,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest)
 33: {
 35:   PetscInt       i,n = qep->numbermonitors;

 38:   for (i=0;i<n;i++) {
 39:     (*qep->monitor[i])(qep,it,nconv,eigr,eigi,errest,nest,qep->monitorcontext[i]);
 40:   }
 41:   return(0);
 42: }

 46: /*@C
 47:    QEPMonitorSet - Sets an ADDITIONAL function to be called at every
 48:    iteration to monitor the error estimates for each requested eigenpair.

 50:    Logically Collective on QEP

 52:    Input Parameters:
 53: +  qep     - eigensolver context obtained from QEPCreate()
 54: .  monitor - pointer to function (if this is NULL, it turns off monitoring)
 55: .  mctx    - [optional] context for private data for the
 56:              monitor routine (use NULL if no context is desired)
 57: -  monitordestroy - [optional] routine that frees monitor context (may be NULL)

 59:    Calling Sequence of monitor:
 60: $     monitor (QEP qep, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx)

 62: +  qep    - quadratic eigensolver context obtained from QEPCreate()
 63: .  its    - iteration number
 64: .  nconv  - number of converged eigenpairs
 65: .  eigr   - real part of the eigenvalues
 66: .  eigi   - imaginary part of the eigenvalues
 67: .  errest - relative error estimates for each eigenpair
 68: .  nest   - number of error estimates
 69: -  mctx   - optional monitoring context, as set by QEPMonitorSet()

 71:    Options Database Keys:
 72: +    -qep_monitor        - print only the first error estimate
 73: .    -qep_monitor_all    - print error estimates at each iteration
 74: .    -qep_monitor_conv   - print the eigenvalue approximations only when
 75:       convergence has been reached
 76: .    -qep_monitor_lg     - sets line graph monitor for the first unconverged
 77:       approximate eigenvalue
 78: .    -qep_monitor_lg_all - sets line graph monitor for all unconverged
 79:       approximate eigenvalues
 80: -    -qep_monitor_cancel - cancels all monitors that have been hardwired into
 81:       a code by calls to QEPMonitorSet(), but does not cancel those set via
 82:       the options database.

 84:    Notes:
 85:    Several different monitoring routines may be set by calling
 86:    QEPMonitorSet() multiple times; all will be called in the
 87:    order in which they were set.

 89:    Level: intermediate

 91: .seealso: QEPMonitorFirst(), QEPMonitorAll(), QEPMonitorCancel()
 92: @*/
 93: PetscErrorCode QEPMonitorSet(QEP qep,PetscErrorCode (*monitor)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
 94: {
 97:   if (qep->numbermonitors >= MAXQEPMONITORS) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_OUTOFRANGE,"Too many QEP monitors set");
 98:   qep->monitor[qep->numbermonitors]           = monitor;
 99:   qep->monitorcontext[qep->numbermonitors]    = (void*)mctx;
100:   qep->monitordestroy[qep->numbermonitors++]  = monitordestroy;
101:   return(0);
102: }

106: /*@
107:    QEPMonitorCancel - Clears all monitors for a QEP object.

109:    Logically Collective on QEP

111:    Input Parameters:
112: .  qep - eigensolver context obtained from QEPCreate()

114:    Options Database Key:
115: .    -qep_monitor_cancel - Cancels all monitors that have been hardwired
116:       into a code by calls to QEPMonitorSet(),
117:       but does not cancel those set via the options database.

119:    Level: intermediate

121: .seealso: QEPMonitorSet()
122: @*/
123: PetscErrorCode QEPMonitorCancel(QEP qep)
124: {
126:   PetscInt       i;

130:   for (i=0; i<qep->numbermonitors; i++) {
131:     if (qep->monitordestroy[i]) {
132:       (*qep->monitordestroy[i])(&qep->monitorcontext[i]);
133:     }
134:   }
135:   qep->numbermonitors = 0;
136:   return(0);
137: }

141: /*@C
142:    QEPGetMonitorContext - Gets the monitor context, as set by
143:    QEPMonitorSet() for the FIRST monitor only.

145:    Not Collective

147:    Input Parameter:
148: .  qep - eigensolver context obtained from QEPCreate()

150:    Output Parameter:
151: .  ctx - monitor context

153:    Level: intermediate

155: .seealso: QEPMonitorSet(), QEPDefaultMonitor()
156: @*/
157: PetscErrorCode QEPGetMonitorContext(QEP qep,void **ctx)
158: {
161:   *ctx = qep->monitorcontext[0];
162:   return(0);
163: }

167: /*@C
168:    QEPMonitorAll - Print the current approximate values and
169:    error estimates at each iteration of the quadratic eigensolver.

171:    Collective on QEP

173:    Input Parameters:
174: +  qep    - quadratic eigensolver context
175: .  its    - iteration number
176: .  nconv  - number of converged eigenpairs so far
177: .  eigr   - real part of the eigenvalues
178: .  eigi   - imaginary part of the eigenvalues
179: .  errest - error estimates
180: .  nest   - number of error estimates to display
181: -  monctx - monitor context (contains viewer, can be NULL)

183:    Level: intermediate

185: .seealso: QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorConverged()
186: @*/
187: PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
188: {
190:   PetscInt       i;
191:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep));

194:   if (its) {
195:     PetscViewerASCIIAddTab(viewer,((PetscObject)qep)->tablevel);
196:     PetscViewerASCIIPrintf(viewer,"%3D QEP nconv=%D Values (Errors)",its,nconv);
197:     for (i=0;i<nest;i++) {
198: #if defined(PETSC_USE_COMPLEX)
199:       PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));
200: #else
201:       PetscViewerASCIIPrintf(viewer," %G",eigr[i]);
202:       if (eigi[i]!=0.0) { PetscViewerASCIIPrintf(viewer,"%+Gi",eigi[i]); }
203: #endif
204:       PetscViewerASCIIPrintf(viewer," (%10.8e)",(double)errest[i]);
205:     }
206:     PetscViewerASCIIPrintf(viewer,"\n");
207:     PetscViewerASCIISubtractTab(viewer,((PetscObject)qep)->tablevel);
208:   }
209:   return(0);
210: }

214: /*@C
215:    QEPMonitorFirst - Print the first unconverged approximate value and
216:    error estimate at each iteration of the quadratic eigensolver.

218:    Collective on QEP

220:    Input Parameters:
221: +  qep    - quadratic eigensolver context
222: .  its    - iteration number
223: .  nconv  - number of converged eigenpairs so far
224: .  eigr   - real part of the eigenvalues
225: .  eigi   - imaginary part of the eigenvalues
226: .  errest - error estimates
227: .  nest   - number of error estimates to display
228: -  monctx - monitor context (contains viewer, can be NULL)

230:    Level: intermediate

232: .seealso: QEPMonitorSet(), QEPMonitorAll(), QEPMonitorConverged()
233: @*/
234: PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
235: {
237:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep));

240:   if (its && nconv<nest) {
241:     PetscViewerASCIIAddTab(viewer,((PetscObject)qep)->tablevel);
242:     PetscViewerASCIIPrintf(viewer,"%3D QEP nconv=%D first unconverged value (error)",its,nconv);
243: #if defined(PETSC_USE_COMPLEX)
244:     PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eigr[nconv]),PetscImaginaryPart(eigr[nconv]));
245: #else
246:     PetscViewerASCIIPrintf(viewer," %G",eigr[nconv]);
247:     if (eigi[nconv]!=0.0) { PetscViewerASCIIPrintf(viewer,"%+Gi",eigi[nconv]); }
248: #endif
249:     PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[nconv]);
250:     PetscViewerASCIISubtractTab(viewer,((PetscObject)qep)->tablevel);
251:   }
252:   return(0);
253: }

257: /*@C
258:    QEPMonitorConverged - Print the approximate values and
259:    error estimates as they converge.

261:    Collective on QEP

263:    Input Parameters:
264: +  qep    - quadratic eigensolver context
265: .  its    - iteration number
266: .  nconv  - number of converged eigenpairs so far
267: .  eigr   - real part of the eigenvalues
268: .  eigi   - imaginary part of the eigenvalues
269: .  errest - error estimates
270: .  nest   - number of error estimates to display
271: -  monctx - monitor context

273:    Level: intermediate

275:    Note:
276:    The monitor context must contain a struct with a PetscViewer and a
277:    PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

279: .seealso: QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorAll()
280: @*/
281: PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
282: {
283:   PetscErrorCode   ierr;
284:   PetscInt         i;
285:   PetscViewer      viewer;
286:   SlepcConvMonitor ctx = (SlepcConvMonitor)monctx;

289:   if (!monctx) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONG,"Must provide a context for QEPMonitorConverged");
290:   if (!its) {
291:     ctx->oldnconv = 0;
292:   } else {
293:     viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep));
294:     for (i=ctx->oldnconv;i<nconv;i++) {
295:       PetscViewerASCIIAddTab(viewer,((PetscObject)qep)->tablevel);
296:       PetscViewerASCIIPrintf(viewer,"%3D QEP converged value (error) #%D",its,i);
297: #if defined(PETSC_USE_COMPLEX)
298:       PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));
299: #else
300:       PetscViewerASCIIPrintf(viewer," %G",eigr[i]);
301:       if (eigi[i]!=0.0) { PetscViewerASCIIPrintf(viewer,"%+Gi",eigi[i]); }
302: #endif
303:       PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);
304:       PetscViewerASCIISubtractTab(viewer,((PetscObject)qep)->tablevel);
305:     }
306:     ctx->oldnconv = nconv;
307:   }
308:   return(0);
309: }

313: PetscErrorCode QEPMonitorLG(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
314: {
315:   PetscViewer    viewer = (PetscViewer)monctx;
316:   PetscDraw      draw;
317:   PetscDrawLG    lg;
319:   PetscReal      x,y;

322:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)qep));
323:   PetscViewerDrawGetDraw(viewer,0,&draw);
324:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
325:   if (!its) {
326:     PetscDrawSetTitle(draw,"Error estimates");
327:     PetscDrawSetDoubleBuffer(draw);
328:     PetscDrawLGSetDimension(lg,1);
329:     PetscDrawLGReset(lg);
330:     PetscDrawLGSetLimits(lg,0,1.0,log10(qep->tol)-2,0.0);
331:   }

333:   x = (PetscReal)its;
334:   if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0;
335:   PetscDrawLGAddPoint(lg,&x,&y);

337:   PetscDrawLGDraw(lg);
338:   return(0);
339: }

343: PetscErrorCode QEPMonitorLGAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
344: {
345:   PetscViewer    viewer = (PetscViewer)monctx;
346:   PetscDraw      draw;
347:   PetscDrawLG    lg;
349:   PetscReal      *x,*y;
350:   PetscInt       i,n = PetscMin(qep->nev,255);

353:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)qep));
354:   PetscViewerDrawGetDraw(viewer,0,&draw);
355:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
356:   if (!its) {
357:     PetscDrawSetTitle(draw,"Error estimates");
358:     PetscDrawSetDoubleBuffer(draw);
359:     PetscDrawLGSetDimension(lg,n);
360:     PetscDrawLGReset(lg);
361:     PetscDrawLGSetLimits(lg,0,1.0,log10(qep->tol)-2,0.0);
362:   }

364:   PetscMalloc(sizeof(PetscReal)*n,&x);
365:   PetscMalloc(sizeof(PetscReal)*n,&y);
366:   for (i=0;i<n;i++) {
367:     x[i] = (PetscReal)its;
368:     if (i < nest && errest[i] > 0.0) y[i] = log10(errest[i]);
369:     else y[i] = 0.0;
370:   }
371:   PetscDrawLGAddPoint(lg,x,y);

373:   PetscDrawLGDraw(lg);
374:   PetscFree(x);
375:   PetscFree(y);
376:   return(0);
377: }

slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/0000755000175000017500000000000012214143515020504 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/qepmonf.c0000644000175000017500000000177012211062077022322 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* qepmon.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepmonitorcancel_ QEPMONITORCANCEL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepmonitorcancel_ qepmonitorcancel #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qepmonitorcancel_(QEP *qep, int *__ierr ){ *__ierr = QEPMonitorCancel(*qep); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/qepsolvef.c0000644000175000017500000001055412211062077022661 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* qepsolve.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsolve_ QEPSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsolve_ qepsolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgetiterationnumber_ QEPGETITERATIONNUMBER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgetiterationnumber_ qepgetiterationnumber #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgetconverged_ QEPGETCONVERGED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgetconverged_ qepgetconverged #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgeteigenpair_ QEPGETEIGENPAIR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgeteigenpair_ qepgeteigenpair #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgeterrorestimate_ QEPGETERRORESTIMATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgeterrorestimate_ qepgeterrorestimate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepcomputeresidualnorm_ QEPCOMPUTERESIDUALNORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepcomputeresidualnorm_ qepcomputeresidualnorm #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepcomputerelativeerror_ QEPCOMPUTERELATIVEERROR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepcomputerelativeerror_ qepcomputerelativeerror #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsorteigenvalues_ QEPSORTEIGENVALUES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsorteigenvalues_ qepsorteigenvalues #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepcompareeigenvalues_ QEPCOMPAREEIGENVALUES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepcompareeigenvalues_ qepcompareeigenvalues #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgetoperationcounters_ QEPGETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgetoperationcounters_ qepgetoperationcounters #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qepsolve_(QEP *qep, int *__ierr ){ *__ierr = QEPSolve(*qep); } void PETSC_STDCALL qepgetiterationnumber_(QEP *qep,PetscInt *its, int *__ierr ){ *__ierr = QEPGetIterationNumber(*qep,its); } void PETSC_STDCALL qepgetconverged_(QEP *qep,PetscInt *nconv, int *__ierr ){ *__ierr = QEPGetConverged(*qep,nconv); } void PETSC_STDCALL qepgeteigenpair_(QEP *qep,PetscInt *i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi, int *__ierr ){ *__ierr = QEPGetEigenpair(*qep,*i,eigr,eigi, (Vec)PetscToPointer((Vr) ), (Vec)PetscToPointer((Vi) )); } void PETSC_STDCALL qepgeterrorestimate_(QEP *qep,PetscInt *i,PetscReal *errest, int *__ierr ){ *__ierr = QEPGetErrorEstimate(*qep,*i,errest); } void PETSC_STDCALL qepcomputeresidualnorm_(QEP *qep,PetscInt *i,PetscReal *norm, int *__ierr ){ *__ierr = QEPComputeResidualNorm(*qep,*i,norm); } void PETSC_STDCALL qepcomputerelativeerror_(QEP *qep,PetscInt *i,PetscReal *error, int *__ierr ){ *__ierr = QEPComputeRelativeError(*qep,*i,error); } void PETSC_STDCALL qepsorteigenvalues_(QEP *qep,PetscInt *n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm, int *__ierr ){ *__ierr = QEPSortEigenvalues(*qep,*n,eigr,eigi,perm); } void PETSC_STDCALL qepcompareeigenvalues_(QEP *qep,PetscScalar *ar,PetscScalar *ai,PetscScalar *br,PetscScalar *bi,PetscInt *result, int *__ierr ){ *__ierr = QEPCompareEigenvalues(*qep,*ar,*ai,*br,*bi,result); } void PETSC_STDCALL qepgetoperationcounters_(QEP *qep,PetscInt* matvecs,PetscInt* dots,PetscInt* lits, int *__ierr ){ *__ierr = QEPGetOperationCounters(*qep,matvecs,dots,lits); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/qepoptsf.c0000644000175000017500000001135012211062077022511 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* qepopts.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetfromoptions_ QEPSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetfromoptions_ qepsetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgettolerances_ QEPGETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgettolerances_ qepgettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsettolerances_ QEPSETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsettolerances_ qepsettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgetdimensions_ QEPGETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgetdimensions_ qepgetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetdimensions_ QEPSETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetdimensions_ qepsetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetwhicheigenpairs_ QEPSETWHICHEIGENPAIRS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetwhicheigenpairs_ qepsetwhicheigenpairs #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetleftvectorswanted_ QEPSETLEFTVECTORSWANTED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetleftvectorswanted_ qepsetleftvectorswanted #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgetscalefactor_ QEPGETSCALEFACTOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgetscalefactor_ qepgetscalefactor #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetscalefactor_ QEPSETSCALEFACTOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetscalefactor_ qepsetscalefactor #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetproblemtype_ QEPSETPROBLEMTYPE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetproblemtype_ qepsetproblemtype #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsettrackall_ QEPSETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsettrackall_ qepsettrackall #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgettrackall_ QEPGETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgettrackall_ qepgettrackall #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qepsetfromoptions_(QEP *qep, int *__ierr ){ *__ierr = QEPSetFromOptions(*qep); } void PETSC_STDCALL qepgettolerances_(QEP *qep,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = QEPGetTolerances(*qep,tol,maxits); } void PETSC_STDCALL qepsettolerances_(QEP *qep,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = QEPSetTolerances(*qep,*tol,*maxits); } void PETSC_STDCALL qepgetdimensions_(QEP *qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = QEPGetDimensions(*qep,nev,ncv,mpd); } void PETSC_STDCALL qepsetdimensions_(QEP *qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = QEPSetDimensions(*qep,*nev,*ncv,*mpd); } void PETSC_STDCALL qepsetwhicheigenpairs_(QEP *qep,QEPWhich *which, int *__ierr ){ *__ierr = QEPSetWhichEigenpairs(*qep,*which); } void PETSC_STDCALL qepsetleftvectorswanted_(QEP *qep,PetscBool *leftvecs, int *__ierr ){ *__ierr = QEPSetLeftVectorsWanted(*qep,*leftvecs); } void PETSC_STDCALL qepgetscalefactor_(QEP *qep,PetscReal *alpha, int *__ierr ){ *__ierr = QEPGetScaleFactor(*qep,alpha); } void PETSC_STDCALL qepsetscalefactor_(QEP *qep,PetscReal *alpha, int *__ierr ){ *__ierr = QEPSetScaleFactor(*qep,*alpha); } void PETSC_STDCALL qepsetproblemtype_(QEP *qep,QEPProblemType *type, int *__ierr ){ *__ierr = QEPSetProblemType(*qep,*type); } void PETSC_STDCALL qepsettrackall_(QEP *qep,PetscBool *trackall, int *__ierr ){ *__ierr = QEPSetTrackAll(*qep,*trackall); } void PETSC_STDCALL qepgettrackall_(QEP *qep,PetscBool *trackall, int *__ierr ){ *__ierr = QEPGetTrackAll(*qep,trackall); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/qepbasicf.c0000644000175000017500000000531212211062077022606 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* qepbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepprintsolution_ QEPPRINTSOLUTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepprintsolution_ qepprintsolution #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepreset_ QEPRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepreset_ qepreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetip_ QEPSETIP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetip_ qepsetip #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetds_ QEPSETDS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetds_ qepsetds #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetst_ QEPSETST #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetst_ qepsetst #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsettarget_ QEPSETTARGET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsettarget_ qepsettarget #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgettarget_ QEPGETTARGET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgettarget_ qepgettarget #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qepprintsolution_(QEP *qep,PetscViewer viewer, int *__ierr ){ *__ierr = QEPPrintSolution(*qep, (PetscViewer)PetscToPointer((viewer) )); } void PETSC_STDCALL qepreset_(QEP *qep, int *__ierr ){ *__ierr = QEPReset(*qep); } void PETSC_STDCALL qepsetip_(QEP *qep,IP *ip, int *__ierr ){ *__ierr = QEPSetIP(*qep,*ip); } void PETSC_STDCALL qepsetds_(QEP *qep,DS *ds, int *__ierr ){ *__ierr = QEPSetDS(*qep,*ds); } void PETSC_STDCALL qepsetst_(QEP *qep,ST *st, int *__ierr ){ *__ierr = QEPSetST(*qep,*st); } void PETSC_STDCALL qepsettarget_(QEP *qep,PetscScalar *target, int *__ierr ){ *__ierr = QEPSetTarget(*qep,*target); } void PETSC_STDCALL qepgettarget_(QEP *qep,PetscScalar* target, int *__ierr ){ *__ierr = QEPGetTarget(*qep,target); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/makefile0000644000175000017500000000043612211062077022207 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = qepbasicf.c qepdefaultf.c qepmonf.c qepoptsf.c qepsetupf.c qepsolvef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/qep/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/qepsetupf.c0000644000175000017500000000455312211062077022673 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* qepsetup.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetup_ QEPSETUP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetup_ qepsetup #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetoperators_ QEPSETOPERATORS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetoperators_ qepsetoperators #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepgetoperators_ QEPGETOPERATORS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepgetoperators_ qepgetoperators #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetinitialspace_ QEPSETINITIALSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetinitialspace_ qepsetinitialspace #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetinitialspaceleft_ QEPSETINITIALSPACELEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetinitialspaceleft_ qepsetinitialspaceleft #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qepsetup_(QEP *qep, int *__ierr ){ *__ierr = QEPSetUp(*qep); } void PETSC_STDCALL qepsetoperators_(QEP *qep,Mat M,Mat C,Mat K, int *__ierr ){ *__ierr = QEPSetOperators(*qep, (Mat)PetscToPointer((M) ), (Mat)PetscToPointer((C) ), (Mat)PetscToPointer((K) )); } void PETSC_STDCALL qepgetoperators_(QEP *qep,Mat *M,Mat *C,Mat *K, int *__ierr ){ *__ierr = QEPGetOperators(*qep,M,C,K); } void PETSC_STDCALL qepsetinitialspace_(QEP *qep,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = QEPSetInitialSpace(*qep,*n,is); } void PETSC_STDCALL qepsetinitialspaceleft_(QEP *qep,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = QEPSetInitialSpaceLeft(*qep,*n,is); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/interface/ftn-auto/qepdefaultf.c0000644000175000017500000000200112211062077023141 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* qepdefault.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcqep.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define qepsetworkvecs_ QEPSETWORKVECS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define qepsetworkvecs_ qepsetworkvecs #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL qepsetworkvecs_(QEP *qep,PetscInt *nw, int *__ierr ){ *__ierr = QEPSetWorkVecs(*qep,*nw); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/qep/interface/qepbasic.c.html0000644000175000017500000017572112211062077021662 0ustar gladkgladk
Actual source code: qepbasic.c

  1: /*
  2:      The basic QEP routines, Create, View, etc. are here.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/qepimpl.h>      /*I "slepcqep.h" I*/

 26: PetscFunctionList QEPList = 0;
 27: PetscBool         QEPRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      QEP_CLASSID = 0;
 29: PetscLogEvent     QEP_SetUp = 0,QEP_Solve = 0,QEP_Dense = 0;
 30: static PetscBool  QEPPackageInitialized = PETSC_FALSE;

 34: /*@C
 35:    QEPFinalizePackage - This function destroys everything in the Slepc interface
 36:    to the QEP package. It is called from SlepcFinalize().

 38:    Level: developer

 40: .seealso: SlepcFinalize()
 41: @*/
 42: PetscErrorCode QEPFinalizePackage(void)
 43: {

 47:   PetscFunctionListDestroy(&QEPList);
 48:   QEPPackageInitialized = PETSC_FALSE;
 49:   QEPRegisterAllCalled  = PETSC_FALSE;
 50:   return(0);
 51: }

 55: /*@C
 56:    QEPInitializePackage - This function initializes everything in the QEP package. It is called
 57:    from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to QEPCreate()
 58:    when using static libraries.

 60:    Level: developer

 62: .seealso: SlepcInitialize()
 63: @*/
 64: PetscErrorCode QEPInitializePackage(void)
 65: {
 66:   char           logList[256];
 67:   char           *className;
 68:   PetscBool      opt;

 72:   if (QEPPackageInitialized) return(0);
 73:   QEPPackageInitialized = PETSC_TRUE;
 74:   /* Register Classes */
 75:   PetscClassIdRegister("Quadratic Eigenvalue Problem solver",&QEP_CLASSID);
 76:   /* Register Constructors */
 77:   QEPRegisterAll();
 78:   /* Register Events */
 79:   PetscLogEventRegister("QEPSetUp",QEP_CLASSID,&QEP_SetUp);
 80:   PetscLogEventRegister("QEPSolve",QEP_CLASSID,&QEP_Solve);
 81:   PetscLogEventRegister("QEPDense",QEP_CLASSID,&QEP_Dense);
 82:   /* Process info exclusions */
 83:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 84:   if (opt) {
 85:     PetscStrstr(logList,"qep",&className);
 86:     if (className) {
 87:       PetscInfoDeactivateClass(QEP_CLASSID);
 88:     }
 89:   }
 90:   /* Process summary exclusions */
 91:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 92:   if (opt) {
 93:     PetscStrstr(logList,"qep",&className);
 94:     if (className) {
 95:       PetscLogEventDeactivateClass(QEP_CLASSID);
 96:     }
 97:   }
 98:   PetscRegisterFinalize(QEPFinalizePackage);
 99:   return(0);
100: }

104: /*@C
105:    QEPView - Prints the QEP data structure.

107:    Collective on QEP

109:    Input Parameters:
110: +  qep - the quadratic eigenproblem solver context
111: -  viewer - optional visualization context

113:    Options Database Key:
114: .  -qep_view -  Calls QEPView() at end of QEPSolve()

116:    Note:
117:    The available visualization contexts include
118: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
119: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
120:          output where only the first processor opens
121:          the file.  All other processors send their
122:          data to the first processor to print.

124:    The user can open an alternative visualization context with
125:    PetscViewerASCIIOpen() - output to a specified file.

127:    Level: beginner

129: .seealso: PetscViewerASCIIOpen()
130: @*/
131: PetscErrorCode QEPView(QEP qep,PetscViewer viewer)
132: {
134:   const char     *type;
135:   char           str[50];
136:   PetscBool      isascii,islinear;

140:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep));

144: #if defined(PETSC_USE_COMPLEX)
145: #define HERM "hermitian"
146: #else
147: #define HERM "symmetric"
148: #endif
149:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
150:   if (isascii) {
151:     PetscObjectPrintClassNamePrefixType((PetscObject)qep,viewer,"QEP Object");
152:     if (qep->ops->view) {
153:       PetscViewerASCIIPushTab(viewer);
154:       (*qep->ops->view)(qep,viewer);
155:       PetscViewerASCIIPopTab(viewer);
156:     }
157:     if (qep->problem_type) {
158:       switch (qep->problem_type) {
159:         case QEP_GENERAL:    type = "general quadratic eigenvalue problem"; break;
160:         case QEP_HERMITIAN:  type = HERM " quadratic eigenvalue problem"; break;
161:         case QEP_GYROSCOPIC: type = "gyroscopic quadratic eigenvalue problem"; break;
162:         default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of qep->problem_type");
163:       }
164:     } else type = "not yet set";
165:     PetscViewerASCIIPrintf(viewer,"  problem type: %s\n",type);
166:     PetscViewerASCIIPrintf(viewer,"  selected portion of the spectrum: ");
167:     SlepcSNPrintfScalar(str,50,qep->target,PETSC_FALSE);
168:     if (!qep->which) {
169:       PetscViewerASCIIPrintf(viewer,"not yet set\n");
170:     } else switch (qep->which) {
171:       case QEP_TARGET_MAGNITUDE:
172:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (in magnitude)\n",str);
173:         break;
174:       case QEP_TARGET_REAL:
175:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the real axis)\n",str);
176:         break;
177:       case QEP_TARGET_IMAGINARY:
178:         PetscViewerASCIIPrintf(viewer,"closest to target: %s (along the imaginary axis)\n",str);
179:         break;
180:       case QEP_LARGEST_MAGNITUDE:
181:         PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");
182:         break;
183:       case QEP_SMALLEST_MAGNITUDE:
184:         PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");
185:         break;
186:       case QEP_LARGEST_REAL:
187:         PetscViewerASCIIPrintf(viewer,"largest real parts\n");
188:         break;
189:       case QEP_SMALLEST_REAL:
190:         PetscViewerASCIIPrintf(viewer,"smallest real parts\n");
191:         break;
192:       case QEP_LARGEST_IMAGINARY:
193:         PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");
194:         break;
195:       case QEP_SMALLEST_IMAGINARY:
196:         PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");
197:         break;
198:       default: SETERRQ(PetscObjectComm((PetscObject)qep),1,"Wrong value of qep->which");
199:     }
200:     if (qep->leftvecs) {
201:       PetscViewerASCIIPrintf(viewer,"  computing left eigenvectors also\n");
202:     }
203:     PetscViewerASCIIPrintf(viewer,"  number of eigenvalues (nev): %D\n",qep->nev);
204:     PetscViewerASCIIPrintf(viewer,"  number of column vectors (ncv): %D\n",qep->ncv);
205:     PetscViewerASCIIPrintf(viewer,"  maximum dimension of projected problem (mpd): %D\n",qep->mpd);
206:     PetscViewerASCIIPrintf(viewer,"  maximum number of iterations: %D\n",qep->max_it);
207:     PetscViewerASCIIPrintf(viewer,"  tolerance: %G\n",qep->tol);
208:     PetscViewerASCIIPrintf(viewer,"  scaling factor: %G\n",qep->sfactor);
209:     if (qep->nini) {
210:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial space: %D\n",PetscAbs(qep->nini));
211:     }
212:     if (qep->ninil) {
213:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial left space: %D\n",PetscAbs(qep->ninil));
214:     }
215:   } else {
216:     if (qep->ops->view) {
217:       (*qep->ops->view)(qep,viewer);
218:     }
219:   }
220:   PetscObjectTypeCompare((PetscObject)qep,QEPLINEAR,&islinear);
221:   if (!islinear) {
222:     if (!qep->ip) { QEPGetIP(qep,&qep->ip); }
223:     IPView(qep->ip,viewer);
224:     if (!qep->ds) { QEPGetDS(qep,&qep->ds); }
225:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);
226:     DSView(qep->ds,viewer);
227:     PetscViewerPopFormat(viewer);
228:     if (!qep->st) { QEPGetST(qep,&qep->st); }
229:     STView(qep->st,viewer);
230:   }
231:   return(0);
232: }

236: /*@
237:    QEPPrintSolution - Prints the computed eigenvalues.

239:    Collective on QEP

241:    Input Parameters:
242: +  qep - the eigensolver context
243: -  viewer - optional visualization context

245:    Options Database Key:
246: .  -qep_terse - print only minimal information

248:    Note:
249:    By default, this function prints a table with eigenvalues and associated
250:    relative errors. With -qep_terse only the eigenvalues are printed.

252:    Level: intermediate

254: .seealso: PetscViewerASCIIOpen()
255: @*/
256: PetscErrorCode QEPPrintSolution(QEP qep,PetscViewer viewer)
257: {
258:   PetscBool      terse,errok,isascii;
259:   PetscReal      error,re,im;
260:   PetscScalar    kr,ki;
261:   PetscInt       i,j;

266:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)qep));
269:   if (!qep->eigr || !qep->eigi || !qep->V) SETERRQ(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_WRONGSTATE,"QEPSolve must be called first");
270:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
271:   if (!isascii) return(0);

273:   PetscOptionsHasName(NULL,"-qep_terse",&terse);
274:   if (terse) {
275:     if (qep->nconv<qep->nev) {
276:       PetscViewerASCIIPrintf(viewer," Problem: less than %D eigenvalues converged\n\n",qep->nev);
277:     } else {
278:       errok = PETSC_TRUE;
279:       for (i=0;i<qep->nev;i++) {
280:         QEPComputeRelativeError(qep,i,&error);
281:         errok = (errok && error<qep->tol)? PETSC_TRUE: PETSC_FALSE;
282:       }
283:       if (errok) {
284:         PetscViewerASCIIPrintf(viewer," All requested eigenvalues computed up to the required tolerance:");
285:         for (i=0;i<=(qep->nev-1)/8;i++) {
286:           PetscViewerASCIIPrintf(viewer,"\n     ");
287:           for (j=0;j<PetscMin(8,qep->nev-8*i);j++) {
288:             QEPGetEigenpair(qep,8*i+j,&kr,&ki,NULL,NULL);
289: #if defined(PETSC_USE_COMPLEX)
290:             re = PetscRealPart(kr);
291:             im = PetscImaginaryPart(kr);
292: #else
293:             re = kr;
294:             im = ki;
295: #endif
296:             if (PetscAbs(re)/PetscAbs(im)<PETSC_SMALL) re = 0.0;
297:             if (PetscAbs(im)/PetscAbs(re)<PETSC_SMALL) im = 0.0;
298:             if (im!=0.0) {
299:               PetscViewerASCIIPrintf(viewer,"%.5F%+.5Fi",re,im);
300:             } else {
301:               PetscViewerASCIIPrintf(viewer,"%.5F",re);
302:             }
303:             if (8*i+j+1<qep->nev) { PetscViewerASCIIPrintf(viewer,", "); }
304:           }
305:         }
306:         PetscViewerASCIIPrintf(viewer,"\n\n");
307:       } else {
308:         PetscViewerASCIIPrintf(viewer," Problem: some of the first %D relative errors are higher than the tolerance\n\n",qep->nev);
309:       }
310:     }
311:   } else {
312:     PetscViewerASCIIPrintf(viewer," Number of converged approximate eigenpairs: %D\n\n",qep->nconv);
313:     if (qep->nconv>0) {
314:       PetscViewerASCIIPrintf(viewer,
315:            "           k          ||(k^2M+Ck+K)x||/||kx||\n"
316:            "   ----------------- -------------------------\n");
317:       for (i=0;i<qep->nconv;i++) {
318:         QEPGetEigenpair(qep,i,&kr,&ki,NULL,NULL);
319:         QEPComputeRelativeError(qep,i,&error);
320: #if defined(PETSC_USE_COMPLEX)
321:         re = PetscRealPart(kr);
322:         im = PetscImaginaryPart(kr);
323: #else
324:         re = kr;
325:         im = ki;
326: #endif
327:         if (im!=0.0) {
328:           PetscViewerASCIIPrintf(viewer," % 9F%+9F i     %12G\n",re,im,error);
329:         } else {
330:           PetscViewerASCIIPrintf(viewer,"   % 12F           %12G\n",re,error);
331:         }
332:       }
333:       PetscViewerASCIIPrintf(viewer,"\n");
334:     }
335:   }
336:   return(0);
337: }

341: /*@C
342:    QEPCreate - Creates the default QEP context.

344:    Collective on MPI_Comm

346:    Input Parameter:
347: .  comm - MPI communicator

349:    Output Parameter:
350: .  qep - location to put the QEP context

352:    Note:
353:    The default QEP type is QEPLINEAR

355:    Level: beginner

357: .seealso: QEPSetUp(), QEPSolve(), QEPDestroy(), QEP
358: @*/
359: PetscErrorCode QEPCreate(MPI_Comm comm,QEP *outqep)
360: {
362:   QEP            qep;

366:   *outqep = 0;
367: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
368:   QEPInitializePackage();
369: #endif

371:   SlepcHeaderCreate(qep,_p_QEP,struct _QEPOps,QEP_CLASSID,"QEP","Quadratic Eigenvalue Problem","QEP",comm,QEPDestroy,QEPView);

373:   qep->M               = 0;
374:   qep->C               = 0;
375:   qep->K               = 0;
376:   qep->max_it          = 0;
377:   qep->nev             = 1;
378:   qep->ncv             = 0;
379:   qep->mpd             = 0;
380:   qep->nini            = 0;
381:   qep->ninil           = 0;
382:   qep->allocated_ncv   = 0;
383:   qep->ip              = 0;
384:   qep->ds              = 0;
385:   qep->tol             = PETSC_DEFAULT;
386:   qep->sfactor         = 0.0;
387:   qep->sfactor_set     = PETSC_FALSE;
388:   qep->converged       = QEPConvergedDefault;
389:   qep->convergedctx    = NULL;
390:   qep->which           = (QEPWhich)0;
391:   qep->comparison      = NULL;
392:   qep->comparisonctx   = NULL;
393:   qep->leftvecs        = PETSC_FALSE;
394:   qep->problem_type    = (QEPProblemType)0;
395:   qep->V               = NULL;
396:   qep->W               = NULL;
397:   qep->IS              = NULL;
398:   qep->ISL             = NULL;
399:   qep->eigr            = NULL;
400:   qep->eigi            = NULL;
401:   qep->errest          = NULL;
402:   qep->data            = NULL;
403:   qep->t               = NULL;
404:   qep->nconv           = 0;
405:   qep->its             = 0;
406:   qep->perm            = NULL;
407:   qep->matvecs         = 0;
408:   qep->linits          = 0;
409:   qep->nwork           = 0;
410:   qep->work            = NULL;
411:   qep->setupcalled     = 0;
412:   qep->reason          = QEP_CONVERGED_ITERATING;
413:   qep->numbermonitors  = 0;
414:   qep->trackall        = PETSC_FALSE;
415:   qep->rand            = 0;

417:   PetscRandomCreate(comm,&qep->rand);
418:   PetscRandomSetSeed(qep->rand,0x12345678);
419:   PetscLogObjectParent(qep,qep->rand);
420:   *outqep = qep;
421:   return(0);
422: }

426: /*@C
427:    QEPSetType - Selects the particular solver to be used in the QEP object.

429:    Logically Collective on QEP

431:    Input Parameters:
432: +  qep      - the quadratic eigensolver context
433: -  type     - a known method

435:    Options Database Key:
436: .  -qep_type <method> - Sets the method; use -help for a list
437:     of available methods

439:    Notes:
440:    See "slepc/include/slepcqep.h" for available methods. The default
441:    is QEPLINEAR.

443:    Normally, it is best to use the QEPSetFromOptions() command and
444:    then set the QEP type from the options database rather than by using
445:    this routine.  Using the options database provides the user with
446:    maximum flexibility in evaluating the different available methods.
447:    The QEPSetType() routine is provided for those situations where it
448:    is necessary to set the iterative solver independently of the command
449:    line or options database.

451:    Level: intermediate

453: .seealso: QEPType
454: @*/
455: PetscErrorCode QEPSetType(QEP qep,QEPType type)
456: {
457:   PetscErrorCode ierr,(*r)(QEP);
458:   PetscBool      match;


464:   PetscObjectTypeCompare((PetscObject)qep,type,&match);
465:   if (match) return(0);

467:   PetscFunctionListFind(QEPList,type,&r);
468:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)qep),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown QEP type given: %s",type);

470:   if (qep->ops->destroy) { (*qep->ops->destroy)(qep); }
471:   PetscMemzero(qep->ops,sizeof(struct _QEPOps));

473:   qep->setupcalled = 0;
474:   PetscObjectChangeTypeName((PetscObject)qep,type);
475:   (*r)(qep);
476:   return(0);
477: }

481: /*@C
482:    QEPGetType - Gets the QEP type as a string from the QEP object.

484:    Not Collective

486:    Input Parameter:
487: .  qep - the eigensolver context

489:    Output Parameter:
490: .  name - name of QEP method

492:    Level: intermediate

494: .seealso: QEPSetType()
495: @*/
496: PetscErrorCode QEPGetType(QEP qep,QEPType *type)
497: {
501:   *type = ((PetscObject)qep)->type_name;
502:   return(0);
503: }

507: /*@C
508:    QEPRegister - Adds a method to the quadratic eigenproblem solver package.

510:    Not Collective

512:    Input Parameters:
513: +  name - name of a new user-defined solver
514: -  function - routine to create the solver context

516:    Notes:
517:    QEPRegister() may be called multiple times to add several user-defined solvers.

519:    Sample usage:
520: .vb
521:    QEPRegister("my_solver",MySolverCreate);
522: .ve

524:    Then, your solver can be chosen with the procedural interface via
525: $     QEPSetType(qep,"my_solver")
526:    or at runtime via the option
527: $     -qep_type my_solver

529:    Level: advanced

531: .seealso: QEPRegisterAll()
532: @*/
533: PetscErrorCode QEPRegister(const char *name,PetscErrorCode (*function)(QEP))
534: {

538:   PetscFunctionListAdd(&QEPList,name,function);
539:   return(0);
540: }

544: /*@
545:    QEPReset - Resets the QEP context to the setupcalled=0 state and removes any
546:    allocated objects.

548:    Collective on QEP

550:    Input Parameter:
551: .  qep - eigensolver context obtained from QEPCreate()

553:    Level: advanced

555: .seealso: QEPDestroy()
556: @*/
557: PetscErrorCode QEPReset(QEP qep)
558: {

563:   if (qep->ops->reset) { (qep->ops->reset)(qep); }
564:   if (qep->ip) { IPReset(qep->ip); }
565:   if (qep->ds) { DSReset(qep->ds); }
566:   MatDestroy(&qep->M);
567:   MatDestroy(&qep->C);
568:   MatDestroy(&qep->K);
569:   VecDestroy(&qep->t);
570:   QEPFreeSolution(qep);
571:   qep->matvecs     = 0;
572:   qep->linits      = 0;
573:   qep->setupcalled = 0;
574:   return(0);
575: }

579: /*@C
580:    QEPDestroy - Destroys the QEP context.

582:    Collective on QEP

584:    Input Parameter:
585: .  qep - eigensolver context obtained from QEPCreate()

587:    Level: beginner

589: .seealso: QEPCreate(), QEPSetUp(), QEPSolve()
590: @*/
591: PetscErrorCode QEPDestroy(QEP *qep)
592: {

596:   if (!*qep) return(0);
598:   if (--((PetscObject)(*qep))->refct > 0) { *qep = 0; return(0); }
599:   QEPReset(*qep);
600:   if ((*qep)->ops->destroy) { (*(*qep)->ops->destroy)(*qep); }
601:   STDestroy(&(*qep)->st);
602:   IPDestroy(&(*qep)->ip);
603:   DSDestroy(&(*qep)->ds);
604:   PetscRandomDestroy(&(*qep)->rand);
605:   /* just in case the initial vectors have not been used */
606:   SlepcBasisDestroy_Private(&(*qep)->nini,&(*qep)->IS);
607:   SlepcBasisDestroy_Private(&(*qep)->ninil,&(*qep)->ISL);
608:   QEPMonitorCancel(*qep);
609:   PetscHeaderDestroy(qep);
610:   return(0);
611: }

615: /*@
616:    QEPSetIP - Associates an inner product object to the quadratic eigensolver.

618:    Collective on QEP

620:    Input Parameters:
621: +  qep - eigensolver context obtained from QEPCreate()
622: -  ip  - the inner product object

624:    Note:
625:    Use QEPGetIP() to retrieve the inner product context (for example,
626:    to free it at the end of the computations).

628:    Level: advanced

630: .seealso: QEPGetIP()
631: @*/
632: PetscErrorCode QEPSetIP(QEP qep,IP ip)
633: {

640:   PetscObjectReference((PetscObject)ip);
641:   IPDestroy(&qep->ip);
642:   qep->ip = ip;
643:   PetscLogObjectParent(qep,qep->ip);
644:   return(0);
645: }

649: /*@C
650:    QEPGetIP - Obtain the inner product object associated
651:    to the quadratic eigensolver object.

653:    Not Collective

655:    Input Parameters:
656: .  qep - eigensolver context obtained from QEPCreate()

658:    Output Parameter:
659: .  ip - inner product context

661:    Level: advanced

663: .seealso: QEPSetIP()
664: @*/
665: PetscErrorCode QEPGetIP(QEP qep,IP *ip)
666: {

672:   if (!qep->ip) {
673:     IPCreate(PetscObjectComm((PetscObject)qep),&qep->ip);
674:     PetscLogObjectParent(qep,qep->ip);
675:   }
676:   *ip = qep->ip;
677:   return(0);
678: }

682: /*@
683:    QEPSetDS - Associates a direct solver object to the quadratic eigensolver.

685:    Collective on QEP

687:    Input Parameters:
688: +  qep - eigensolver context obtained from QEPCreate()
689: -  ds  - the direct solver object

691:    Note:
692:    Use QEPGetDS() to retrieve the direct solver context (for example,
693:    to free it at the end of the computations).

695:    Level: advanced

697: .seealso: QEPGetDS()
698: @*/
699: PetscErrorCode QEPSetDS(QEP qep,DS ds)
700: {

707:   PetscObjectReference((PetscObject)ds);
708:   DSDestroy(&qep->ds);
709:   qep->ds = ds;
710:   PetscLogObjectParent(qep,qep->ds);
711:   return(0);
712: }

716: /*@C
717:    QEPGetDS - Obtain the direct solver object associated to the
718:    quadratic eigensolver object.

720:    Not Collective

722:    Input Parameters:
723: .  qep - eigensolver context obtained from QEPCreate()

725:    Output Parameter:
726: .  ds - direct solver context

728:    Level: advanced

730: .seealso: QEPSetDS()
731: @*/
732: PetscErrorCode QEPGetDS(QEP qep,DS *ds)
733: {

739:   if (!qep->ds) {
740:     DSCreate(PetscObjectComm((PetscObject)qep),&qep->ds);
741:     PetscLogObjectParent(qep,qep->ds);
742:   }
743:   *ds = qep->ds;
744:   return(0);
745: }

749: /*@
750:    QEPSetST - Associates a spectral transformation object to the eigensolver.

752:    Collective on QEP

754:    Input Parameters:
755: +  qep - eigensolver context obtained from QEPCreate()
756: -  st   - the spectral transformation object

758:    Note:
759:    Use QEPGetST() to retrieve the spectral transformation context (for example,
760:    to free it at the end of the computations).

762:    Level: developer

764: .seealso: QEPGetST()
765: @*/
766: PetscErrorCode QEPSetST(QEP qep,ST st)
767: {

774:   PetscObjectReference((PetscObject)st);
775:   STDestroy(&qep->st);
776:   qep->st = st;
777:   PetscLogObjectParent(qep,qep->st);
778:   return(0);
779: }

783: /*@C
784:    QEPGetST - Obtain the spectral transformation (ST) object associated
785:    to the eigensolver object.

787:    Not Collective

789:    Input Parameters:
790: .  qep - eigensolver context obtained from QEPCreate()

792:    Output Parameter:
793: .  st - spectral transformation context

795:    Level: beginner

797: .seealso: QEPSetST()
798: @*/
799: PetscErrorCode QEPGetST(QEP qep,ST *st)
800: {

806:   if (!qep->st) {
807:     STCreate(PetscObjectComm((PetscObject)qep),&qep->st);
808:     PetscLogObjectParent(qep,qep->st);
809:   }
810:   *st = qep->st;
811:   return(0);
812: }

816: /*@
817:    QEPSetTarget - Sets the value of the target.

819:    Logically Collective on QEP

821:    Input Parameters:
822: +  qep    - eigensolver context
823: -  target - the value of the target

825:    Notes:
826:    The target is a scalar value used to determine the portion of the spectrum
827:    of interest. It is used in combination with QEPSetWhichEigenpairs().

829:    Level: beginner

831: .seealso: QEPGetTarget(), QEPSetWhichEigenpairs()
832: @*/
833: PetscErrorCode QEPSetTarget(QEP qep,PetscScalar target)
834: {

840:   qep->target = target;
841:   if (!qep->st) { QEPGetST(qep,&qep->st); }
842:   STSetDefaultShift(qep->st,target);
843:   return(0);
844: }

848: /*@
849:    QEPGetTarget - Gets the value of the target.

851:    Not Collective

853:    Input Parameter:
854: .  qep - eigensolver context

856:    Output Parameter:
857: .  target - the value of the target

859:    Level: beginner

861:    Note:
862:    If the target was not set by the user, then zero is returned.

864: .seealso: QEPSetTarget()
865: @*/
866: PetscErrorCode QEPGetTarget(QEP qep,PetscScalar* target)
867: {
871:   *target = qep->target;
872:   return(0);
873: }

slepc-3.4.2.dfsg.orig/src/qep/index.html0000644000175000017500000000244312211062077017007 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

interface/
impls/
examples/
../../include/slepc-private/qepimpl.h
../../include/slepcqep.h
makefile
slepc-3.4.2.dfsg.orig/src/svd/0000755000175000017500000000000012214143515015016 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/examples/0000755000175000017500000000000012214143515016634 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/0000755000175000017500000000000012211062077020662 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex15.c.html0000644000175000017500000003051512211062077022557 0ustar gladkgladk

Actual source code: ex15.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Singular value decomposition of the Lauchli matrix.\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = matrix dimension.\n"
 25:   "  -mu <mu>, where <mu> = subdiagonal value.\n\n";

 27: #include <slepcsvd.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;               /* operator matrix */
 34:   Vec            u,v;             /* left and right singular vectors */
 35:   SVD            svd;             /* singular value problem solver context */
 36:   SVDType        type;
 37:   PetscReal      error,tol,sigma,mu=PETSC_SQRT_MACHINE_EPSILON;
 38:   PetscInt       n=100,i,j,Istart,Iend,nsv,maxit,its,nconv;

 41:   SlepcInitialize(&argc,&argv,(char*)0,help);

 43:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 44:   PetscOptionsGetReal(NULL,"-mu",&mu,NULL);
 45:   PetscPrintf(PETSC_COMM_WORLD,"\nLauchli singular value decomposition, (%D x %D) mu=%G\n\n",n+1,n,mu);

 47:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 48:                           Build the Lauchli matrix
 49:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 51:   MatCreate(PETSC_COMM_WORLD,&A);
 52:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n+1,n);
 53:   MatSetFromOptions(A);
 54:   MatSetUp(A);

 56:   MatGetOwnershipRange(A,&Istart,&Iend);
 57:   for (i=Istart;i<Iend;i++) {
 58:     if (i == 0) {
 59:       for (j=0;j<n;j++) {
 60:         MatSetValue(A,0,j,1.0,INSERT_VALUES);
 61:       }
 62:     } else {
 63:       MatSetValue(A,i,i-1,mu,INSERT_VALUES);
 64:     }
 65:   }

 67:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 68:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
 69:   MatGetVecs(A,&v,&u);

 71:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 72:           Create the singular value solver and set various options
 73:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 75:   /*
 76:      Create singular value solver context
 77:   */
 78:   SVDCreate(PETSC_COMM_WORLD,&svd);

 80:   /*
 81:      Set operator
 82:   */
 83:   SVDSetOperator(svd,A);

 85:   /*
 86:      Use thick-restart Lanczos as default solver
 87:   */
 88:   SVDSetType(svd,SVDTRLANCZOS);

 90:   /*
 91:      Set solver parameters at runtime
 92:   */
 93:   SVDSetFromOptions(svd);

 95:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 96:                       Solve the singular value system
 97:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 99:   SVDSolve(svd);
100:   SVDGetIterationNumber(svd,&its);
101:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);

103:   /*
104:      Optional: Get some information from the solver and display it
105:   */
106:   SVDGetType(svd,&type);
107:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
108:   SVDGetDimensions(svd,&nsv,NULL,NULL);
109:   PetscPrintf(PETSC_COMM_WORLD," Number of requested singular values: %D\n",nsv);
110:   SVDGetTolerances(svd,&tol,&maxit);
111:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

113:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
114:                     Display solution and clean up
115:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

117:   /*
118:      Get number of converged singular triplets
119:   */
120:   SVDGetConverged(svd,&nconv);
121:   PetscPrintf(PETSC_COMM_WORLD," Number of converged approximate singular triplets: %D\n\n",nconv);

123:   if (nconv>0) {
124:     /*
125:        Display singular values and relative errors
126:     */
127:     PetscPrintf(PETSC_COMM_WORLD,
128:          "          sigma           relative error\n"
129:          "  --------------------- ------------------\n");
130:     for (i=0;i<nconv;i++) {
131:       /*
132:          Get converged singular triplets: i-th singular value is stored in sigma
133:       */
134:       SVDGetSingularTriplet(svd,i,&sigma,u,v);

136:       /*
137:          Compute the error associated to each singular triplet
138:       */
139:       SVDComputeRelativeError(svd,i,&error);

141:       PetscPrintf(PETSC_COMM_WORLD,"       % 6F      ",sigma);
142:       PetscPrintf(PETSC_COMM_WORLD," % 12G\n",error);
143:     }
144:     PetscPrintf(PETSC_COMM_WORLD,"\n");
145:   }

147:   /*
148:      Free work space
149:   */
150:   SVDDestroy(&svd);
151:   MatDestroy(&A);
152:   VecDestroy(&u);
153:   VecDestroy(&v);
154:   SlepcFinalize();
155:   return 0;
156: }
slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex15.c0000644000175000017500000001330312211062077021610 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Singular value decomposition of the Lauchli matrix.\n" "The command line options are:\n" " -n , where = matrix dimension.\n" " -mu , where = subdiagonal value.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ Vec u,v; /* left and right singular vectors */ SVD svd; /* singular value problem solver context */ SVDType type; PetscReal error,tol,sigma,mu=PETSC_SQRT_MACHINE_EPSILON; PetscInt n=100,i,j,Istart,Iend,nsv,maxit,its,nconv; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,"-mu",&mu,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nLauchli singular value decomposition, (%D x %D) mu=%G\n\n",n+1,n,mu);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Build the Lauchli matrix - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n+1,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i0) { /* Display singular values and relative errors */ ierr = PetscPrintf(PETSC_COMM_WORLD, " sigma relative error\n" " --------------------- ------------------\n");CHKERRQ(ierr); for (i=0;iActual source code: ex8.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Estimates the 2-norm condition number of a matrix A, that is, the ratio of the largest to the smallest singular values of A. "
 23:   "The matrix is a Grcar matrix.\n\n"
 24:   "The command line options are:\n"
 25:   "  -n <n>, where <n> = matrix dimension.\n\n";

 27: #include <slepcsvd.h>

 29: /*
 30:    This example computes the singular values of an nxn Grcar matrix,
 31:    which is a nonsymmetric Toeplitz matrix:

 33:               |  1  1  1  1               |
 34:               | -1  1  1  1  1            |
 35:               |    -1  1  1  1  1         |
 36:               |       .  .  .  .  .       |
 37:           A = |          .  .  .  .  .    |
 38:               |            -1  1  1  1  1 |
 39:               |               -1  1  1  1 |
 40:               |                  -1  1  1 |
 41:               |                     -1  1 |

 43:  */

 47: int main(int argc,char **argv)
 48: {
 49:   Mat            A;               /* Grcar matrix */
 50:   SVD            svd;             /* singular value solver context */
 51:   PetscInt       N=30,Istart,Iend,i,col[5],nconv1,nconv2;
 52:   PetscScalar    value[] = { -1, 1, 1, 1, 1 };
 53:   PetscReal      sigma_1,sigma_n;

 56:   SlepcInitialize(&argc,&argv,(char*)0,help);

 58:   PetscOptionsGetInt(NULL,"-n",&N,NULL);
 59:   PetscPrintf(PETSC_COMM_WORLD,"\nEstimate the condition number of a Grcar matrix, n=%D\n\n",N);

 61:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 62:         Generate the matrix
 63:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 65:   MatCreate(PETSC_COMM_WORLD,&A);
 66:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 67:   MatSetFromOptions(A);
 68:   MatSetUp(A);

 70:   MatGetOwnershipRange(A,&Istart,&Iend);
 71:   for (i=Istart;i<Iend;i++) {
 72:     col[0]=i-1; col[1]=i; col[2]=i+1; col[3]=i+2; col[4]=i+3;
 73:     if (i==0) {
 74:       MatSetValues(A,1,&i,PetscMin(4,N-i),col+1,value+1,INSERT_VALUES);
 75:     } else {
 76:       MatSetValues(A,1,&i,PetscMin(5,N-i+1),col,value,INSERT_VALUES);
 77:     }
 78:   }

 80:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 81:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 83:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 84:              Create the singular value solver and set the solution method
 85:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 87:   /*
 88:      Create singular value context
 89:   */
 90:   SVDCreate(PETSC_COMM_WORLD,&svd);

 92:   /*
 93:      Set operator
 94:   */
 95:   SVDSetOperator(svd,A);

 97:   /*
 98:      Set solver parameters at runtime
 99:   */
100:   SVDSetFromOptions(svd);
101:   SVDSetDimensions(svd,1,0,0);

103:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
104:                       Solve the singular value problem
105:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

107:   /*
108:      First request a singular value from one end of the spectrum
109:   */
110:   SVDSetWhichSingularTriplets(svd,SVD_LARGEST);
111:   SVDSolve(svd);
112:   /*
113:      Get number of converged singular values
114:   */
115:   SVDGetConverged(svd,&nconv1);
116:   /*
117:      Get converged singular values: largest singular value is stored in sigma_1.
118:      In this example, we are not interested in the singular vectors
119:   */
120:   if (nconv1 > 0) {
121:     SVDGetSingularTriplet(svd,0,&sigma_1,NULL,NULL);
122:   } else {
123:     PetscPrintf(PETSC_COMM_WORLD," Unable to compute large singular value!\n\n");
124:   }

126:   /*
127:      Request a singular value from the other end of the spectrum
128:   */
129:   SVDSetWhichSingularTriplets(svd,SVD_SMALLEST);
130:   SVDSolve(svd);
131:   /*
132:      Get number of converged eigenpairs
133:   */
134:   SVDGetConverged(svd,&nconv2);
135:   /*
136:      Get converged singular values: smallest singular value is stored in sigma_n.
137:      As before, we are not interested in the singular vectors
138:   */
139:   if (nconv2 > 0) {
140:     SVDGetSingularTriplet(svd,0,&sigma_n,NULL,NULL);
141:   } else {
142:     PetscPrintf(PETSC_COMM_WORLD," Unable to compute small singular value!\n\n");
143:   }

145:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
146:                     Display solution and clean up
147:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
148:   if (nconv1 > 0 && nconv2 > 0) {
149:     PetscPrintf(PETSC_COMM_WORLD," Computed singular values: sigma_1=%6F, sigma_n=%6F\n",sigma_1,sigma_n);
150:     PetscPrintf(PETSC_COMM_WORLD," Estimated condition number: sigma_1/sigma_n=%6F\n\n",sigma_1/sigma_n);
151:   }

153:   /*
154:      Free work space
155:   */
156:   SVDDestroy(&svd);
157:   MatDestroy(&A);
158:   SlepcFinalize();
159:   return 0;
160: }

slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/makefile0000644000175000017500000000505512211062077022367 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/svd/examples/tutorials/ EXAMPLESC = ex8.c ex14.c ex15.c EXAMPLESF = ex15f.F MANSEC = SVD TESTEXAMPLES_C = ex8.PETSc runex8_1 ex8.rm TESTEXAMPLES_C_NOCOMPLEX = ex14.PETSc runex14_1 ex14.rm TESTEXAMPLES_FORTRAN = include ${SLEPC_DIR}/conf/slepc_common ex8: ex8.o chkopts -${CLINKER} -o ex8 ex8.o ${SLEPC_LIB} ${RM} ex8.o ex14: ex14.o chkopts -${CLINKER} -o ex14 ex14.o ${SLEPC_LIB} ${RM} ex14.o ex15: ex15.o chkopts -${CLINKER} -o ex15 ex15.o ${SLEPC_LIB} ${RM} ex15.o ex15f: ex15f.o chkopts -${FLINKER} -o ex15f ex15f.o ${SLEPC_LIB} ${RM} ex15f.o #------------------------------------------------------------------------------------ DATAPATH = ${SLEPC_DIR}/share/slepc/datafiles/matrices runex8_1: -@${MPIEXEC} -np 1 ./ex8 > ex8_1.tmp 2>&1; \ if (${DIFF} output/ex8_1.out ex8_1.tmp) then true; \ else echo "Possible problem with ex8_1, diffs above"; fi; \ ${RM} -f ex8_1.tmp runex14_1: -@${MPIEXEC} -np 1 ./ex14 -file ${DATAPATH}/rdb200.petsc -svd_nsv 4 -svd_terse > ex14_1.tmp 2>&1; \ if (${DIFF} output/ex14_1.out ex14_1.tmp) then true; \ else echo "Possible problem with ex14_1, diffs above"; fi; \ ${RM} -f ex14_1.tmp runex15_1: -@${MPIEXEC} -np 1 ./ex15 > ex15_1.tmp 2>&1; \ if (${DIFF} output/ex15_1.out ex15_1.tmp) then true; \ else echo "Possible problem with ex15_1, diffs above"; fi; \ ${RM} -f ex15_1.tmp runex15f_1: -@${MPIEXEC} -np 1 ./ex15f > ex15f_1.tmp 2>&1; \ if (${DIFF} output/ex15f_1.out ex15f_1.tmp) then true; \ else echo "Possible problem with ex15f_1, diffs above"; fi; \ ${RM} -f ex15f_1.tmp slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/makefile.html0000644000175000017500000001021412211062077023323 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/svd/examples/tutorials/
EXAMPLESC  = ex8.c ex14.c ex15.c
EXAMPLESF  = ex15f.F
MANSEC     = SVD

TESTEXAMPLES_C           = ex8.PETSc runex8_1 ex8.rm
TESTEXAMPLES_C_NOCOMPLEX = ex14.PETSc runex14_1 ex14.rm
TESTEXAMPLES_FORTRAN     =

include ${SLEPC_DIR}/conf/slepc_common

ex8: ex8.o chkopts
	-${CLINKER} -o ex8 ex8.o ${SLEPC_LIB}
	${RM} ex8.o

ex14: ex14.o chkopts
	-${CLINKER} -o ex14 ex14.o ${SLEPC_LIB}
	${RM} ex14.o

ex15: ex15.o chkopts
	-${CLINKER} -o ex15 ex15.o ${SLEPC_LIB}
	${RM} ex15.o

ex15f: ex15f.o chkopts
	-${FLINKER} -o ex15f ex15f.o ${SLEPC_LIB}
	${RM} ex15f.o

#------------------------------------------------------------------------------------
DATAPATH = ${SLEPC_DIR}/share/slepc/datafiles/matrices

runex8_1:
	-@${MPIEXEC} -np 1 ./ex8 > ex8_1.tmp 2>&1; \
	   if (${DIFF} output/ex8_1.out ex8_1.tmp) then true; \
	   else echo "Possible problem with ex8_1, diffs above"; fi; \
	   ${RM} -f ex8_1.tmp

runex14_1:
	-@${MPIEXEC} -np 1 ./ex14 -file ${DATAPATH}/rdb200.petsc -svd_nsv 4 -svd_terse > ex14_1.tmp 2>&1;	  \
	   if (${DIFF} output/ex14_1.out ex14_1.tmp) then true; \
	   else echo "Possible problem with ex14_1, diffs above"; fi; \
	   ${RM} -f ex14_1.tmp

runex15_1:
	-@${MPIEXEC} -np 1 ./ex15 > ex15_1.tmp 2>&1; \
	   if (${DIFF} output/ex15_1.out ex15_1.tmp) then true; \
	   else echo "Possible problem with ex15_1, diffs above"; fi; \
	   ${RM} -f ex15_1.tmp

runex15f_1:
	-@${MPIEXEC} -np 1 ./ex15f > ex15f_1.tmp 2>&1; \
	   if (${DIFF} output/ex15f_1.out ex15f_1.tmp) then true; \
	   else echo "Possible problem with ex15f_1, diffs above"; fi; \
	   ${RM} -f ex15f_1.tmp

slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex15f.F0000644000175000017500000001436112211062077021726 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Program usage: mpirun -np n ex15f [-help] [-n ] [-mu ] [all SLEPc options] ! ! Description: Singular value decomposition of the Lauchli matrix. ! ! The command line options are: ! -n , where = matrix dimension. ! -mu , where = subdiagonal value. ! ! ---------------------------------------------------------------------- ! program main implicit none #include #include #include #include #include ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Declarations ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Variables: ! A operator matrix ! svd singular value solver context Mat A SVD svd SVDType tname PetscReal tol, error, sigma, mu PetscInt n, i, j, Istart, Iend PetscInt nsv, maxit, its, nconv PetscMPIInt rank PetscErrorCode ierr PetscBool flg PetscScalar one ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Beginning of program ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SlepcInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) n = 100 call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr) mu = PETSC_SQRT_MACHINE_EPSILON call PetscOptionsGetReal(PETSC_NULL_CHARACTER,'-mu',mu,flg,ierr) if (rank .eq. 0) then write(*,100) n, mu endif 100 format (/'Lauchli SVD, n =',I3,', mu=',E12.4,' (Fortran)') ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Build the Lauchli matrix ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call MatCreate(PETSC_COMM_WORLD,A,ierr) call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n+1,n,ierr) call MatSetFromOptions(A,ierr) call MatSetUp(A,ierr) call MatGetOwnershipRange(A,Istart,Iend,ierr) one = 1.0 do i=Istart,Iend-1 if (i .eq. 0) then do j=0,n-1 call MatSetValue(A,i,j,one,INSERT_VALUES,ierr) end do else call MatSetValue(A,i,i-1,mu,INSERT_VALUES,ierr) end if enddo call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr) call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Create the singular value solver and display info ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Create singular value solver context call SVDCreate(PETSC_COMM_WORLD,svd,ierr) ! ** Set operator call SVDSetOperator(svd,A,ierr) ! ** Use thick-restart Lanczos as default solver call SVDSetType(svd,SVDTRLANCZOS,ierr) ! ** Set solver parameters at runtime call SVDSetFromOptions(svd,ierr) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Solve the singular value system ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - call SVDSolve(svd,ierr) call SVDGetIterationNumber(svd,its,ierr) if (rank .eq. 0) then write(*,110) its endif 110 format (/' Number of iterations of the method:',I4) ! ** Optional: Get some information from the solver and display it call SVDGetType(svd,tname,ierr) if (rank .eq. 0) then write(*,120) tname endif 120 format (' Solution method: ',A) call SVDGetDimensions(svd,nsv,PETSC_NULL_INTEGER, & & PETSC_NULL_INTEGER,ierr) if (rank .eq. 0) then write(*,130) nsv endif 130 format (' Number of requested singular values:',I2) call SVDGetTolerances(svd,tol,maxit,ierr) if (rank .eq. 0) then write(*,140) tol, maxit endif 140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! Display solution and clean up ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ** Get number of converged singular triplets call SVDGetConverged(svd,nconv,ierr) if (rank .eq. 0) then write(*,150) nconv endif 150 format (' Number of converged approximate singular triplets:',I2/) ! ** Display singular values and relative errors if (nconv.gt.0) then if (rank .eq. 0) then write(*,*) ' sigma relative error' write(*,*) ' ----------------- ------------------' endif do i=0,nconv-1 ! ** Get converged singular triplet: i-th singular value is stored in sigma call SVDGetSingularTriplet(svd,i,sigma,PETSC_NULL_OBJECT, & & PETSC_NULL_OBJECT,ierr) ! ** Compute the relative error associated to each eigenpair call SVDComputeRelativeError(svd,i,error,ierr) if (rank .eq. 0) then write(*,160) sigma, error endif 160 format (1P,' ',E12.4,' ',E12.4) enddo if (rank .eq. 0) then write(*,*) endif endif ! ** Free work space call SVDDestroy(svd,ierr) call MatDestroy(A,ierr) call SlepcFinalize(ierr) end slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/index.html0000644000175000017500000000254012211062077022660 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

ex8.c: Estimates the 2-norm condition number of a matrix A, that is, the ratio of the largest to the smallest singular values of A
ex14.c: Solves a singular value problem with the matrix loaded from a file
ex15.c: Singular value decomposition of the Lauchli matrix
makefile
slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex15f.F.html0000644000175000017500000003163012211062077022667 0ustar gladkgladk

Actual source code: ex15f.F

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Program usage: mpirun -np n ex15f [-help] [-n <n>] [-mu <mu>] [all SLEPc options]
 21: !
 22: !  Description: Singular value decomposition of the Lauchli matrix.
 23: !
 24: !  The command line options are:
 25: !    -n <n>, where <n> = matrix dimension.
 26: !    -mu <mu>, where <mu> = subdiagonal value.
 27: !
 28: ! ----------------------------------------------------------------------
 29: !
 30:       program main
 31:       implicit none

 33: #include <finclude/petscsys.h>
 34: #include <finclude/petscvec.h>
 35: #include <finclude/petscmat.h>
 36: #include <finclude/slepcsys.h>
 37: #include <finclude/slepcsvd.h>

 39: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 40: !     Declarations
 41: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 42: !
 43: !  Variables:
 44: !     A     operator matrix
 45: !     svd   singular value solver context

 47:       Mat            A
 48:       SVD            svd
 49:       SVDType        tname
 50:       PetscReal      tol, error, sigma, mu
 51:       PetscInt       n, i, j, Istart, Iend
 52:       PetscInt       nsv, maxit, its, nconv
 53:       PetscMPIInt    rank
 54:       PetscErrorCode ierr
 55:       PetscBool      flg
 56:       PetscScalar    one

 58: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 59: !     Beginning of program
 60: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 62:       call SlepcInitialize(PETSC_NULL_CHARACTER,ierr)
 63:       call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
 64:       n = 100
 65:       call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)
 66:       mu = PETSC_SQRT_MACHINE_EPSILON
 67:       call PetscOptionsGetReal(PETSC_NULL_CHARACTER,'-mu',mu,flg,ierr)

 69:       if (rank .eq. 0) then
 70:         write(*,100) n, mu
 71:       endif
 72:  100  format (/'Lauchli SVD, n =',I3,', mu=',E12.4,' (Fortran)')

 74: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 75: !     Build the Lauchli matrix
 76: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 78:       call MatCreate(PETSC_COMM_WORLD,A,ierr)
 79:       call MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n+1,n,ierr)
 80:       call MatSetFromOptions(A,ierr)
 81:       call MatSetUp(A,ierr)

 83:       call MatGetOwnershipRange(A,Istart,Iend,ierr)
 84:       one = 1.0
 85:       do i=Istart,Iend-1
 86:         if (i .eq. 0) then
 87:           do j=0,n-1
 88:             call MatSetValue(A,i,j,one,INSERT_VALUES,ierr)
 89:           end do
 90:         else
 91:           call MatSetValue(A,i,i-1,mu,INSERT_VALUES,ierr)
 92:         end if
 93:       enddo

 95:       call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)
 96:       call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)

 98: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 99: !     Create the singular value solver and display info
100: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

102: !     ** Create singular value solver context
103:       call SVDCreate(PETSC_COMM_WORLD,svd,ierr)

105: !     ** Set operator
106:       call SVDSetOperator(svd,A,ierr)

108: !     ** Use thick-restart Lanczos as default solver
109:       call SVDSetType(svd,SVDTRLANCZOS,ierr)

111: !     ** Set solver parameters at runtime
112:       call SVDSetFromOptions(svd,ierr)

114: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115: !     Solve the singular value system
116: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

118:       call SVDSolve(svd,ierr)
119:       call SVDGetIterationNumber(svd,its,ierr)
120:       if (rank .eq. 0) then
121:         write(*,110) its
122:       endif
123:  110  format (/' Number of iterations of the method:',I4)

125: !     ** Optional: Get some information from the solver and display it
126:       call SVDGetType(svd,tname,ierr)
127:       if (rank .eq. 0) then
128:         write(*,120) tname
129:       endif
130:  120  format (' Solution method: ',A)
131:       call SVDGetDimensions(svd,nsv,PETSC_NULL_INTEGER,                 &
132:      &                      PETSC_NULL_INTEGER,ierr)
133:       if (rank .eq. 0) then
134:         write(*,130) nsv
135:       endif
136:  130  format (' Number of requested singular values:',I2)
137:       call SVDGetTolerances(svd,tol,maxit,ierr)
138:       if (rank .eq. 0) then
139:         write(*,140) tol, maxit
140:       endif
141:  140  format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)

143: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
144: !     Display solution and clean up
145: ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

147: !     ** Get number of converged singular triplets
148:       call SVDGetConverged(svd,nconv,ierr)
149:       if (rank .eq. 0) then
150:         write(*,150) nconv
151:       endif
152:  150  format (' Number of converged approximate singular triplets:',I2/)

154: !     ** Display singular values and relative errors
155:       if (nconv.gt.0) then
156:         if (rank .eq. 0) then
157:           write(*,*) '       sigma          relative error'
158:           write(*,*) ' ----------------- ------------------'
159:         endif
160:         do i=0,nconv-1
161: !         ** Get converged singular triplet: i-th singular value is stored in sigma
162:           call SVDGetSingularTriplet(svd,i,sigma,PETSC_NULL_OBJECT,     &
163:      &         PETSC_NULL_OBJECT,ierr)

165: !         ** Compute the relative error associated to each eigenpair
166:           call SVDComputeRelativeError(svd,i,error,ierr)
167:           if (rank .eq. 0) then
168:             write(*,160) sigma, error
169:           endif
170:  160      format (1P,'   ',E12.4,'       ',E12.4)

172:         enddo
173:         if (rank .eq. 0) then
174:           write(*,*)
175:         endif
176:       endif

178: !     ** Free work space
179:       call SVDDestroy(svd,ierr)
180:       call MatDestroy(A,ierr)

182:       call SlepcFinalize(ierr)
183:       end

slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex8.c0000644000175000017500000001345212211062077021537 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Estimates the 2-norm condition number of a matrix A, that is, the ratio of the largest to the smallest singular values of A. " "The matrix is a Grcar matrix.\n\n" "The command line options are:\n" " -n , where = matrix dimension.\n\n"; #include /* This example computes the singular values of an nxn Grcar matrix, which is a nonsymmetric Toeplitz matrix: | 1 1 1 1 | | -1 1 1 1 1 | | -1 1 1 1 1 | | . . . . . | A = | . . . . . | | -1 1 1 1 1 | | -1 1 1 1 | | -1 1 1 | | -1 1 | */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* Grcar matrix */ SVD svd; /* singular value solver context */ PetscInt N=30,Istart,Iend,i,col[5],nconv1,nconv2; PetscScalar value[] = { -1, 1, 1, 1, 1 }; PetscReal sigma_1,sigma_n; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&N,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nEstimate the condition number of a Grcar matrix, n=%D\n\n",N);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Generate the matrix - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i 0) { ierr = SVDGetSingularTriplet(svd,0,&sigma_1,NULL,NULL);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD," Unable to compute large singular value!\n\n");CHKERRQ(ierr); } /* Request a singular value from the other end of the spectrum */ ierr = SVDSetWhichSingularTriplets(svd,SVD_SMALLEST);CHKERRQ(ierr); ierr = SVDSolve(svd);CHKERRQ(ierr); /* Get number of converged eigenpairs */ ierr = SVDGetConverged(svd,&nconv2);CHKERRQ(ierr); /* Get converged singular values: smallest singular value is stored in sigma_n. As before, we are not interested in the singular vectors */ if (nconv2 > 0) { ierr = SVDGetSingularTriplet(svd,0,&sigma_n,NULL,NULL);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD," Unable to compute small singular value!\n\n");CHKERRQ(ierr); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ if (nconv1 > 0 && nconv2 > 0) { ierr = PetscPrintf(PETSC_COMM_WORLD," Computed singular values: sigma_1=%6F, sigma_n=%6F\n",sigma_1,sigma_n);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Estimated condition number: sigma_1/sigma_n=%6F\n\n",sigma_1/sigma_n);CHKERRQ(ierr); } /* Free work space */ ierr = SVDDestroy(&svd);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex14.c0000644000175000017500000001067112211062077021614 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Solves a singular value problem with the matrix loaded from a file.\n" "This example works for both real and complex numbers.\n\n" "The command line options are:\n" " -file , where = matrix file in PETSc binary form.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ SVD svd; /* singular value problem solver context */ SVDType type; PetscReal tol; PetscInt nsv,maxit,its; char filename[PETSC_MAX_PATH_LEN]; PetscViewer viewer; PetscBool flg; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Load the operator matrix that defines the singular value problem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = PetscPrintf(PETSC_COMM_WORLD,"\nSingular value problem stored in file.\n\n");CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-file",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name with the -file option"); #if defined(PETSC_USE_COMPLEX) ierr = PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrix from a binary file...\n");CHKERRQ(ierr); #else ierr = PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrix from a binary file...\n");CHKERRQ(ierr); #endif ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatLoad(A,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the singular value solver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create singular value solver context */ ierr = SVDCreate(PETSC_COMM_WORLD,&svd);CHKERRQ(ierr); /* Set operator */ ierr = SVDSetOperator(svd,A);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = SVDSetFromOptions(svd);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the singular value system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = SVDSolve(svd);CHKERRQ(ierr); ierr = SVDGetIterationNumber(svd,&its);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = SVDGetType(svd,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = SVDGetDimensions(svd,&nsv,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested singular values: %D\n",nsv);CHKERRQ(ierr); ierr = SVDGetTolerances(svd,&tol,&maxit);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = SVDPrintSolution(svd,NULL);CHKERRQ(ierr); ierr = SVDDestroy(&svd);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/svd/examples/tutorials/ex14.c.html0000644000175000017500000002246112211062077022557 0ustar gladkgladk
Actual source code: ex14.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Solves a singular value problem with the matrix loaded from a file.\n"
 23:   "This example works for both real and complex numbers.\n\n"
 24:   "The command line options are:\n"
 25:   "  -file <filename>, where <filename> = matrix file in PETSc binary form.\n\n";

 27: #include <slepcsvd.h>

 31: int main(int argc,char **argv)
 32: {
 33:   Mat            A;               /* operator matrix */
 34:   SVD            svd;             /* singular value problem solver context */
 35:   SVDType        type;
 36:   PetscReal      tol;
 37:   PetscInt       nsv,maxit,its;
 38:   char           filename[PETSC_MAX_PATH_LEN];
 39:   PetscViewer    viewer;
 40:   PetscBool      flg;

 43:   SlepcInitialize(&argc,&argv,(char*)0,help);

 45:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 46:         Load the operator matrix that defines the singular value problem
 47:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 49:   PetscPrintf(PETSC_COMM_WORLD,"\nSingular value problem stored in file.\n\n");
 50:   PetscOptionsGetString(NULL,"-file",filename,PETSC_MAX_PATH_LEN,&flg);
 51:   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate a file name with the -file option");

 53: #if defined(PETSC_USE_COMPLEX)
 54:   PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrix from a binary file...\n");
 55: #else
 56:   PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrix from a binary file...\n");
 57: #endif
 58:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 59:   MatCreate(PETSC_COMM_WORLD,&A);
 60:   MatSetFromOptions(A);
 61:   MatLoad(A,viewer);
 62:   PetscViewerDestroy(&viewer);

 64:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 65:                 Create the singular value solver and set various options
 66:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 68:   /*
 69:      Create singular value solver context
 70:   */
 71:   SVDCreate(PETSC_COMM_WORLD,&svd);

 73:   /*
 74:      Set operator
 75:   */
 76:   SVDSetOperator(svd,A);

 78:   /*
 79:      Set solver parameters at runtime
 80:   */
 81:   SVDSetFromOptions(svd);

 83:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 84:                       Solve the singular value system
 85:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 87:   SVDSolve(svd);
 88:   SVDGetIterationNumber(svd,&its);
 89:   PetscPrintf(PETSC_COMM_WORLD," Number of iterations of the method: %D\n",its);

 91:   /*
 92:      Optional: Get some information from the solver and display it
 93:   */
 94:   SVDGetType(svd,&type);
 95:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
 96:   SVDGetDimensions(svd,&nsv,NULL,NULL);
 97:   PetscPrintf(PETSC_COMM_WORLD," Number of requested singular values: %D\n",nsv);
 98:   SVDGetTolerances(svd,&tol,&maxit);
 99:   PetscPrintf(PETSC_COMM_WORLD," Stopping condition: tol=%.4G, maxit=%D\n",tol,maxit);

101:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102:                     Display solution and clean up
103:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

105:   SVDPrintSolution(svd,NULL);
106:   SVDDestroy(&svd);
107:   MatDestroy(&A);
108:   SlepcFinalize();
109:   return 0;
110: }
slepc-3.4.2.dfsg.orig/src/svd/examples/makefile0000644000175000017500000000200512211062077020331 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/svd/examples/ DIRS = tests tutorials include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/examples/makefile.html0000644000175000017500000000351412211062077021302 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/svd/examples/
DIRS     = tests tutorials

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/svd/examples/tests/0000755000175000017500000000000012214143515017776 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/examples/tests/output/0000755000175000017500000000000012214143515021336 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/examples/tests/output/test2_1.out0000644000175000017500000000167612211062077023362 0ustar gladkgladksvd type cross Reading matrix from binary file... All requested singular values computed up to the required tolerance: 7.04105, 6.37355, 5.47846, 5.30799, 4.47061, 4.06786, 3.92213 svd type cyclic Reading matrix from binary file... All requested singular values computed up to the required tolerance: 7.04105, 6.37355, 5.47846, 5.30799, 4.47061, 4.06786, 3.92213 svd type lanczos Reading matrix from binary file... All requested singular values computed up to the required tolerance: 7.04105, 6.37355, 5.47846, 5.30799, 4.47061, 4.06786, 3.92213 svd type lapack Reading matrix from binary file... All requested singular values computed up to the required tolerance: 7.04105, 6.37355, 5.47846, 5.30799, 4.47061, 4.06786, 3.92213 svd type trlanczos Reading matrix from binary file... All requested singular values computed up to the required tolerance: 7.04105, 6.37355, 5.47846, 5.30799, 4.47061, 4.06786, 3.92213 slepc-3.4.2.dfsg.orig/src/svd/examples/tests/output/test3_1.out0000644000175000017500000000152512211062077023354 0ustar gladkgladksvd type cross SVD of a rectangular Grcar matrix, 35x30 All requested singular values computed up to the required tolerance: 3.22175, 3.21797, 3.16825, 3.15128 svd type cyclic SVD of a rectangular Grcar matrix, 35x30 All requested singular values computed up to the required tolerance: 3.22175, 3.21797, 3.16825, 3.15128 svd type lanczos SVD of a rectangular Grcar matrix, 35x30 All requested singular values computed up to the required tolerance: 3.22175, 3.21797, 3.16825, 3.15128 svd type lapack SVD of a rectangular Grcar matrix, 35x30 All requested singular values computed up to the required tolerance: 3.22175, 3.21797, 3.16825, 3.15128 svd type trlanczos SVD of a rectangular Grcar matrix, 35x30 All requested singular values computed up to the required tolerance: 3.22175, 3.21797, 3.16825, 3.15128 slepc-3.4.2.dfsg.orig/src/svd/examples/tests/output/test1_1.out0000644000175000017500000000571012211062077023352 0ustar gladkgladk Estimate the condition number of a Grcar matrix, n=30 SVD type: cross Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cyclic Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: lanczos Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: lapack Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: trlanczos Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cross EPS type: krylovschur Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cross EPS type: arnoldi Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cross EPS type: lanczos Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cross EPS type: gd Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cross EPS type: jd Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cyclic EPS type: krylovschur Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cyclic EPS type: arnoldi Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cyclic EPS type: lanczos Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cyclic EPS type: gd Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 Estimate the condition number of a Grcar matrix, n=30 SVD type: cyclic EPS type: jd Computed singular values: sigma_1=3.221487, sigma_n=0.955065 Estimated condition number: sigma_1/sigma_n=3.373056 slepc-3.4.2.dfsg.orig/src/svd/examples/tests/test1.c.html0000644000175000017500000003621012211062077022147 0ustar gladkgladk
Actual source code: test1.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test the solution of a SVD without calling SVDSetFromOptions (based on ex8.c).\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = matrix dimension.\n"
 25:   "  -type <svd_type> = svd type to test.\n\n";

 27: #include <slepcsvd.h>

 29: /*
 30:    This example computes the singular values of an nxn Grcar matrix,
 31:    which is a nonsymmetric Toeplitz matrix:

 33:               |  1  1  1  1               |
 34:               | -1  1  1  1  1            |
 35:               |    -1  1  1  1  1         |
 36:               |       .  .  .  .  .       |
 37:           A = |          .  .  .  .  .    |
 38:               |            -1  1  1  1  1 |
 39:               |               -1  1  1  1 |
 40:               |                  -1  1  1 |
 41:               |                     -1  1 |

 43:  */

 47: int main(int argc,char **argv)
 48: {
 49:   Mat            A;               /* Grcar matrix */
 50:   SVD            svd;             /* singular value solver context */
 51:   PetscInt       N=30,Istart,Iend,i,col[5],nconv1,nconv2;
 52:   PetscScalar    value[] = { -1, 1, 1, 1, 1 };
 53:   PetscReal      sigma_1,sigma_n;
 54:   char           svdtype[30] = "cross",epstype[30] = "";
 55:   PetscBool      flg;
 56:   EPS            eps;

 59:   SlepcInitialize(&argc,&argv,(char*)0,help);

 61:   PetscOptionsGetInt(NULL,"-n",&N,NULL);
 62:   PetscOptionsGetString(NULL,"-type",svdtype,30,NULL);
 63:   PetscOptionsGetString(NULL,"-epstype",epstype,30,&flg);
 64:   PetscPrintf(PETSC_COMM_WORLD,"\nEstimate the condition number of a Grcar matrix, n=%D",N);
 65:   PetscPrintf(PETSC_COMM_WORLD,"\nSVD type: %s",svdtype);
 66:   if (flg) {
 67:     PetscPrintf(PETSC_COMM_WORLD,"\nEPS type: %s",epstype);
 68:   }
 69:   PetscPrintf(PETSC_COMM_WORLD,"\n\n");

 71:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 72:         Generate the matrix
 73:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 75:   MatCreate(PETSC_COMM_WORLD,&A);
 76:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);
 77:   MatSetFromOptions(A);
 78:   MatSetUp(A);

 80:   MatGetOwnershipRange(A,&Istart,&Iend);
 81:   for (i=Istart;i<Iend;i++) {
 82:     col[0]=i-1; col[1]=i; col[2]=i+1; col[3]=i+2; col[4]=i+3;
 83:     if (i==0) {
 84:       MatSetValues(A,1,&i,4,col+1,value+1,INSERT_VALUES);
 85:     } else {
 86:       MatSetValues(A,1,&i,PetscMin(5,N-i+1),col,value,INSERT_VALUES);
 87:     }
 88:   }

 90:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 91:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 93:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 94:              Create the singular value solver and set the solution method
 95:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 97:   /*
 98:      Create singular value context
 99:   */
100:   SVDCreate(PETSC_COMM_WORLD,&svd);

102:   /*
103:      Set operator
104:   */
105:   SVDSetOperator(svd,A);

107:   /*
108:      Set solver parameters at runtime
109:   */
110:   SVDSetType(svd,svdtype);
111:   if (flg) {
112:     PetscObjectTypeCompare((PetscObject)svd,SVDCROSS,&flg);
113:     if (flg) {
114:       SVDCrossGetEPS(svd,&eps);
115:       EPSSetType(eps,epstype);
116:     }
117:     PetscObjectTypeCompare((PetscObject)svd,SVDCYCLIC,&flg);
118:     if (flg) {
119:       SVDCyclicGetEPS(svd,&eps);
120:       EPSSetType(eps,epstype);
121:     }
122:   }
123:   SVDSetDimensions(svd,1,0,0);
124:   SVDSetTolerances(svd,1e-6,1000);

126:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
127:                       Solve the eigensystem
128:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

130:   /*
131:      First request an eigenvalue from one end of the spectrum
132:   */
133:   SVDSetWhichSingularTriplets(svd,SVD_LARGEST);
134:   SVDSolve(svd);
135:   /*
136:      Get number of converged singular values
137:   */
138:   SVDGetConverged(svd,&nconv1);
139:   /*
140:      Get converged singular values: largest singular value is stored in sigma_1.
141:      In this example, we are not interested in the singular vectors
142:   */
143:   if (nconv1 > 0) {
144:     SVDGetSingularTriplet(svd,0,&sigma_1,NULL,NULL);
145:   } else {
146:     PetscPrintf(PETSC_COMM_WORLD," Unable to compute large singular value!\n\n");
147:   }

149:   /*
150:      Request an eigenvalue from the other end of the spectrum
151:   */
152:   SVDSetWhichSingularTriplets(svd,SVD_SMALLEST);
153:   SVDSolve(svd);
154:   /*
155:      Get number of converged eigenpairs
156:   */
157:   SVDGetConverged(svd,&nconv2);
158:   /*
159:      Get converged singular values: smallest singular value is stored in sigma_n.
160:      As before, we are not interested in the singular vectors
161:   */
162:   if (nconv2 > 0) {
163:     SVDGetSingularTriplet(svd,0,&sigma_n,NULL,NULL);
164:   } else {
165:     PetscPrintf(PETSC_COMM_WORLD," Unable to compute small singular value!\n\n");
166:   }

168:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
169:                     Display solution and clean up
170:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
171:   if (nconv1 > 0 && nconv2 > 0) {
172:     PetscPrintf(PETSC_COMM_WORLD," Computed singular values: sigma_1=%6F, sigma_n=%6F\n",sigma_1,sigma_n);
173:     PetscPrintf(PETSC_COMM_WORLD," Estimated condition number: sigma_1/sigma_n=%6F\n\n",sigma_1/sigma_n);
174:   }

176:   /*
177:      Free work space
178:   */
179:   SVDDestroy(&svd);
180:   MatDestroy(&A);
181:   SlepcFinalize();
182:   return 0;
183: }

slepc-3.4.2.dfsg.orig/src/svd/examples/tests/makefile0000644000175000017500000000576212211062077021510 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/svd/examples/tests/ EXAMPLESC = test1.c test2.c test3.c EXAMPLESF = MANSEC = SVD TESTS = test1 test2 test3 TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \ test3.PETSc runtest3_1 test3.rm TESTEXAMPLES_C_NOF128= test2.PETSc runtest2_1 test2.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o test3: test3.o chkopts -${CLINKER} -o test3 test3.o ${SLEPC_LIB} ${RM} test3.o #------------------------------------------------------------------------------------ SVD = lanczos lapack trlanczos SVDEPS = cross cyclic EPS = krylovschur arnoldi lanczos gd jd runtest1_1: -@touch test1_1.tmp; \ for svd in ${SVDEPS} ${SVD}; do \ ${MPIEXEC} -np 1 ./test1 -type $$svd >> test1_1.tmp 2>&1; \ done; \ for svd in ${SVDEPS}; do \ for eps in ${EPS}; do \ ${MPIEXEC} -np 1 ./test1 -type $$svd -epstype $$eps >> test1_1.tmp 2>&1; \ done; \ done; \ if (${DIFF} output/test1_1.out test1_1.tmp) then true; \ else echo "Possible problem with test1_1, diffs above"; fi; \ ${RM} -f test1_1.tmp runtest2_1: -@touch test2_1.tmp; \ for svd in ${SVDEPS} ${SVD}; do \ echo "svd type $$svd" >> test2_1.tmp; \ ${MPIEXEC} -np 1 ./test2 -svd_type $$svd -svd_nsv 7 -svd_terse >> test2_1.tmp 2>&1; \ done; \ [ x${SAVE_OUTPUT} = xyes ] && cp test2_1.tmp output/test2_1.out; \ if (${DIFF} output/test2_1.out test2_1.tmp) then true; \ else echo "Possible problem with test2_1, diffs above"; fi; \ ${RM} -f test2_1.tmp; runtest3_1: -@touch test3_1.tmp; \ for svd in ${SVDEPS} ${SVD}; do \ echo "svd type $$svd" >> test3_1.tmp; \ ${MPIEXEC} -np 1 ./test3 -svd_type $$svd -svd_nsv 4 -svd_terse >> test3_1.tmp 2>&1; \ done; \ [ x${SAVE_OUTPUT} = xyes ] && cp test3_1.tmp output/test3_1.out; \ if (${DIFF} output/test3_1.out test3_1.tmp) then true; \ else echo "Possible problem with test3_1, diffs above"; fi; \ ${RM} -f test3_1.tmp slepc-3.4.2.dfsg.orig/src/svd/examples/tests/makefile.html0000644000175000017500000001214012211062077022437 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/svd/examples/tests/
EXAMPLESC  = test1.c test2.c test3.c
EXAMPLESF  =
MANSEC     = SVD
TESTS      = test1 test2 test3

TESTEXAMPLES_C       = test1.PETSc runtest1_1 test1.rm \
                       test3.PETSc runtest3_1 test3.rm
TESTEXAMPLES_C_NOF128= test2.PETSc runtest2_1 test2.rm

include ${SLEPC_DIR}/conf/slepc_common

test1: test1.o chkopts
	-${CLINKER} -o test1 test1.o ${SLEPC_LIB}
	${RM} test1.o

test2: test2.o chkopts
	-${CLINKER} -o test2 test2.o ${SLEPC_LIB}
	${RM} test2.o

test3: test3.o chkopts
	-${CLINKER} -o test3 test3.o ${SLEPC_LIB}
	${RM} test3.o

#------------------------------------------------------------------------------------
SVD = lanczos lapack trlanczos
SVDEPS = cross cyclic
EPS = krylovschur arnoldi lanczos gd jd

runtest1_1:
	-@touch test1_1.tmp; \
	for svd in ${SVDEPS} ${SVD}; do \
	   ${MPIEXEC} -np 1 ./test1 -type $$svd >> test1_1.tmp 2>&1; \
	done; \
	for svd in ${SVDEPS}; do \
	   for eps in ${EPS}; do \
	      ${MPIEXEC} -np 1 ./test1 -type $$svd -epstype $$eps >> test1_1.tmp 2>&1; \
           done; \
	done; \
	if (${DIFF} output/test1_1.out test1_1.tmp) then true; \
	else echo "Possible problem with test1_1, diffs above"; fi; \
	${RM} -f test1_1.tmp

runtest2_1:
	-@touch test2_1.tmp; \
	for svd in ${SVDEPS} ${SVD}; do \
	   echo "svd type $$svd" >> test2_1.tmp; \
	   ${MPIEXEC} -np 1 ./test2 -svd_type $$svd -svd_nsv 7 -svd_terse >> test2_1.tmp 2>&1;    \
	done; \
	[ x${SAVE_OUTPUT} = xyes ] && cp test2_1.tmp output/test2_1.out; \
	if (${DIFF} output/test2_1.out test2_1.tmp) then true; \
	else echo "Possible problem with test2_1, diffs above"; fi; \
	${RM} -f test2_1.tmp;

runtest3_1:
	-@touch test3_1.tmp; \
	for svd in ${SVDEPS} ${SVD}; do \
	   echo "svd type $$svd" >> test3_1.tmp; \
	   ${MPIEXEC} -np 1 ./test3 -svd_type $$svd -svd_nsv 4 -svd_terse >> test3_1.tmp 2>&1; \
	done; \
	[ x${SAVE_OUTPUT} = xyes ] && cp test3_1.tmp output/test3_1.out; \
	if (${DIFF} output/test3_1.out test3_1.tmp) then true; \
	else echo "Possible problem with test3_1, diffs above"; fi; \
	${RM} -f test3_1.tmp

slepc-3.4.2.dfsg.orig/src/svd/examples/tests/test1.c0000644000175000017500000001527312211062077021212 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test the solution of a SVD without calling SVDSetFromOptions (based on ex8.c).\n\n" "The command line options are:\n" " -n , where = matrix dimension.\n" " -type = svd type to test.\n\n"; #include /* This example computes the singular values of an nxn Grcar matrix, which is a nonsymmetric Toeplitz matrix: | 1 1 1 1 | | -1 1 1 1 1 | | -1 1 1 1 1 | | . . . . . | A = | . . . . . | | -1 1 1 1 1 | | -1 1 1 1 | | -1 1 1 | | -1 1 | */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* Grcar matrix */ SVD svd; /* singular value solver context */ PetscInt N=30,Istart,Iend,i,col[5],nconv1,nconv2; PetscScalar value[] = { -1, 1, 1, 1, 1 }; PetscReal sigma_1,sigma_n; char svdtype[30] = "cross",epstype[30] = ""; PetscBool flg; EPS eps; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&N,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-type",svdtype,30,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetString(NULL,"-epstype",epstype,30,&flg);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nEstimate the condition number of a Grcar matrix, n=%D",N);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nSVD type: %s",svdtype);CHKERRQ(ierr); if (flg) { ierr = PetscPrintf(PETSC_COMM_WORLD,"\nEPS type: %s",epstype);CHKERRQ(ierr); } ierr = PetscPrintf(PETSC_COMM_WORLD,"\n\n");CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Generate the matrix - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i 0) { ierr = SVDGetSingularTriplet(svd,0,&sigma_1,NULL,NULL);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD," Unable to compute large singular value!\n\n");CHKERRQ(ierr); } /* Request an eigenvalue from the other end of the spectrum */ ierr = SVDSetWhichSingularTriplets(svd,SVD_SMALLEST);CHKERRQ(ierr); ierr = SVDSolve(svd);CHKERRQ(ierr); /* Get number of converged eigenpairs */ ierr = SVDGetConverged(svd,&nconv2);CHKERRQ(ierr); /* Get converged singular values: smallest singular value is stored in sigma_n. As before, we are not interested in the singular vectors */ if (nconv2 > 0) { ierr = SVDGetSingularTriplet(svd,0,&sigma_n,NULL,NULL);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD," Unable to compute small singular value!\n\n");CHKERRQ(ierr); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ if (nconv1 > 0 && nconv2 > 0) { ierr = PetscPrintf(PETSC_COMM_WORLD," Computed singular values: sigma_1=%6F, sigma_n=%6F\n",sigma_1,sigma_n);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Estimated condition number: sigma_1/sigma_n=%6F\n\n",sigma_1/sigma_n);CHKERRQ(ierr); } /* Free work space */ ierr = SVDDestroy(&svd);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/svd/examples/tests/index.html0000644000175000017500000000245512211062077022001 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

test1.c: Test the solution of a SVD without calling SVDSetFromOptions (based on ex8
test2.c: Test SVD with different builds with a matrix loaded from a file
test3.c: Test SVD with user-provided initial vectors
makefile
slepc-3.4.2.dfsg.orig/src/svd/examples/tests/test3.c0000644000175000017500000001007412211062077021206 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test SVD with user-provided initial vectors.\n\n" "The command line options are:\n" " -n , where = row dimension.\n" " -m , where = column dimension.\n\n"; #include /* This example computes the singular values of a rectangular nxm Grcar matrix: | 1 1 1 1 | | -1 1 1 1 1 | | -1 1 1 1 1 | A = | . . . . . | | . . . . . | | -1 1 1 1 1 | | -1 1 1 1 | */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* Grcar matrix */ SVD svd; /* singular value solver context */ Vec v0,w0; /* initial vectors */ PetscInt N=35,M=30,Istart,Iend,i,col[5]; PetscScalar value[] = { -1, 1, 1, 1, 1 }; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&N,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&M,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nSVD of a rectangular Grcar matrix, %Dx%D\n\n",N,M);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Generate the matrix - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,M);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); for (i=Istart;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test SVD with different builds with a matrix loaded from a file" " (matrices available in PETSc's distribution).\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A; /* operator matrix */ SVD svd; /* singular value problem solver context */ char filename[PETSC_MAX_PATH_LEN]; const char *prefix,*scalar,*ints,*floats; PetscReal tol=1000*PETSC_MACHINE_EPSILON; PetscViewer viewer; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Load the matrix for which the SVD must be computed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if defined(PETSC_USE_COMPLEX) prefix = "nh"; scalar = "complex"; #else prefix = "ns"; scalar = "real"; #endif #if defined(PETSC_USE_64BIT_INDICES) ints = "int64"; #else ints = "int32"; #endif #if defined(PETSC_USE_REAL_DOUBLE) floats = "float64"; #elif defined(PETSC_USE_REAL_SINGLE) floats = "float32"; #endif ierr = PetscSNPrintf(filename,PETSC_MAX_PATH_LEN,"%s/share/petsc/datafiles/matrices/%s-%s-%s-%s",PETSC_DIR,prefix,scalar,ints,floats);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\nReading matrix from binary file...\n\n");CHKERRQ(ierr); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatLoad(A,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the SVD solver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = SVDCreate(PETSC_COMM_WORLD,&svd);CHKERRQ(ierr); ierr = SVDSetOperator(svd,A);CHKERRQ(ierr); ierr = SVDSetTolerances(svd,tol,PETSC_DEFAULT);CHKERRQ(ierr); ierr = SVDSetFromOptions(svd);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem and display solution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = SVDSolve(svd);CHKERRQ(ierr); ierr = SVDPrintSolution(svd,NULL);CHKERRQ(ierr); ierr = SVDDestroy(&svd);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/svd/examples/tests/test2.c.html0000644000175000017500000001705212211062077022153 0ustar gladkgladk

Actual source code: test2.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test SVD with different builds with a matrix loaded from a file"
 23:   " (matrices available in PETSc's distribution).\n\n";

 25: #include <slepcsvd.h>

 29: int main(int argc,char **argv)
 30: {
 31:   Mat            A;               /* operator matrix */
 32:   SVD            svd;             /* singular value problem solver context */
 33:   char           filename[PETSC_MAX_PATH_LEN];
 34:   const char     *prefix,*scalar,*ints,*floats;
 35:   PetscReal      tol=1000*PETSC_MACHINE_EPSILON;
 36:   PetscViewer    viewer;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);

 41:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 42:         Load the matrix for which the SVD must be computed
 43:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 44: #if defined(PETSC_USE_COMPLEX)
 45:   prefix = "nh";
 46:   scalar = "complex";
 47: #else
 48:   prefix = "ns";
 49:   scalar = "real";
 50: #endif
 51: #if defined(PETSC_USE_64BIT_INDICES)
 52:   ints   = "int64";
 53: #else
 54:   ints   = "int32";
 55: #endif
 56: #if defined(PETSC_USE_REAL_DOUBLE)
 57:   floats = "float64";
 58: #elif defined(PETSC_USE_REAL_SINGLE)
 59:   floats = "float32";
 60: #endif

 62:   PetscSNPrintf(filename,PETSC_MAX_PATH_LEN,"%s/share/petsc/datafiles/matrices/%s-%s-%s-%s",PETSC_DIR,prefix,scalar,ints,floats);
 63:   PetscPrintf(PETSC_COMM_WORLD,"\nReading matrix from binary file...\n\n");
 64:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,filename,FILE_MODE_READ,&viewer);
 65:   MatCreate(PETSC_COMM_WORLD,&A);
 66:   MatSetFromOptions(A);
 67:   MatLoad(A,viewer);
 68:   PetscViewerDestroy(&viewer);

 70:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 71:                      Create the SVD solver
 72:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 73:   SVDCreate(PETSC_COMM_WORLD,&svd);
 74:   SVDSetOperator(svd,A);
 75:   SVDSetTolerances(svd,tol,PETSC_DEFAULT);
 76:   SVDSetFromOptions(svd);

 78:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 79:                 Solve the eigensystem and display solution
 80:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 81:   SVDSolve(svd);
 82:   SVDPrintSolution(svd,NULL);
 83:   SVDDestroy(&svd);
 84:   MatDestroy(&A);
 85:   SlepcFinalize();
 86:   return 0;
 87: }

slepc-3.4.2.dfsg.orig/src/svd/examples/tests/test3.c.html0000644000175000017500000002144212211062077022152 0ustar gladkgladk
Actual source code: test3.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test SVD with user-provided initial vectors.\n\n"
 23:   "The command line options are:\n"
 24:   "  -n <n>, where <n> = row dimension.\n"
 25:   "  -m <m>, where <m> = column dimension.\n\n";

 27: #include <slepcsvd.h>

 29: /*
 30:    This example computes the singular values of a rectangular nxm Grcar matrix:

 32:               |  1  1  1  1               |
 33:               | -1  1  1  1  1            |
 34:               |    -1  1  1  1  1         |
 35:           A = |       .  .  .  .  .       |
 36:               |          .  .  .  .  .    |
 37:               |            -1  1  1  1  1 |
 38:               |               -1  1  1  1 |

 40:  */

 44: int main(int argc,char **argv)
 45: {
 46:   Mat            A;               /* Grcar matrix */
 47:   SVD            svd;             /* singular value solver context */
 48:   Vec            v0,w0;           /* initial vectors */
 49:   PetscInt       N=35,M=30,Istart,Iend,i,col[5];
 50:   PetscScalar    value[] = { -1, 1, 1, 1, 1 };

 53:   SlepcInitialize(&argc,&argv,(char*)0,help);
 54:   PetscOptionsGetInt(NULL,"-n",&N,NULL);
 55:   PetscOptionsGetInt(NULL,"-m",&M,NULL);
 56:   PetscPrintf(PETSC_COMM_WORLD,"\nSVD of a rectangular Grcar matrix, %Dx%D\n\n",N,M);

 58:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 59:         Generate the matrix
 60:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 62:   MatCreate(PETSC_COMM_WORLD,&A);
 63:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,M);
 64:   MatSetFromOptions(A);
 65:   MatSetUp(A);

 67:   MatGetOwnershipRange(A,&Istart,&Iend);
 68:   for (i=Istart;i<Iend;i++) {
 69:     col[0]=i-1; col[1]=i; col[2]=i+1; col[3]=i+2; col[4]=i+3;
 70:     if (i==0) {
 71:       MatSetValues(A,1,&i,PetscMin(4,M-i+1),col+1,value+1,INSERT_VALUES);
 72:     } else {
 73:       MatSetValues(A,1,&i,PetscMin(5,M-i+1),col,value,INSERT_VALUES);
 74:     }
 75:   }
 76:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 77:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 79:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 80:              Create the SVD context and solve the problem
 81:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 83:   SVDCreate(PETSC_COMM_WORLD,&svd);
 84:   SVDSetOperator(svd,A);
 85:   SVDSetFromOptions(svd);

 87:   /*
 88:      Set the initial vectors. This is optional, if not done the initial
 89:      vectors are set to random values
 90:   */
 91:   MatGetVecs(A,&v0,&w0);
 92:   VecSet(v0,1.0);
 93:   VecSet(w0,1.0);
 94:   SVDSetInitialSpace(svd,1,&v0);
 95:   SVDSetInitialSpaceLeft(svd,1,&w0);

 97:   /*
 98:      Compute solution
 99:   */
100:   SVDSolve(svd);
101:   SVDPrintSolution(svd,NULL);

103:   /*
104:      Free work space
105:   */
106:   VecDestroy(&v0);
107:   VecDestroy(&w0);
108:   SVDDestroy(&svd);
109:   MatDestroy(&A);
110:   SlepcFinalize();
111:   return 0;
112: }

slepc-3.4.2.dfsg.orig/src/svd/examples/index.html0000644000175000017500000000040012211062077020623 0ustar gladkgladk Generic SLEPc Manual Pages

tests/
tutorials/
makefile
slepc-3.4.2.dfsg.orig/src/svd/impls/0000755000175000017500000000000012214143515016142 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/0000755000175000017500000000000012211062077020161 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/trlanczos.c0000644000175000017500000004147212211062077022354 0ustar gladkgladk/* SLEPc singular value solver: "trlanczos" Method: Thick-restart Lanczos Algorithm: Golub-Kahan-Lanczos bidiagonalization with thick-restart. References: [1] G.H. Golub and W. Kahan, "Calculating the singular values and pseudo-inverse of a matrix", SIAM J. Numer. Anal. Ser. B 2:205-224, 1965. [2] V. Hernandez, J.E. Roman, and A. Tomas, "A robust and efficient parallel SVD solver based on restarted Lanczos bidiagonalization", Elec. Trans. Numer. Anal. 31:68-85, 2008. Last update: Jun 2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include #include typedef struct { PetscBool oneside; } SVD_TRLANCZOS; #undef __FUNCT__ #define __FUNCT__ "SVDSetUp_TRLanczos" PetscErrorCode SVDSetUp_TRLanczos(SVD svd) { PetscErrorCode ierr; PetscInt N; PetscFunctionBegin; ierr = SVDMatGetSize(svd,NULL,&N);CHKERRQ(ierr); if (svd->ncv) { /* ncv set */ if (svd->ncvnsv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must be at least nsv"); } else if (svd->mpd) { /* mpd set */ svd->ncv = PetscMin(N,svd->nsv+svd->mpd); } else { /* neither set: defaults depend on nsv being small or large */ if (svd->nsv<500) svd->ncv = PetscMin(N,PetscMax(2*svd->nsv,10)); else { svd->mpd = 500; svd->ncv = PetscMin(N,svd->nsv+svd->mpd); } } if (!svd->mpd) svd->mpd = svd->ncv; if (svd->ncv>svd->nsv+svd->mpd) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must not be larger than nev+mpd"); if (!svd->max_it) svd->max_it = PetscMax(N/svd->ncv,100); if (svd->ncv!=svd->n) { ierr = VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);CHKERRQ(ierr); ierr = PetscLogObjectParents(svd,svd->ncv,svd->U);CHKERRQ(ierr); } ierr = DSSetType(svd->ds,DSSVD);CHKERRQ(ierr); ierr = DSSetCompact(svd->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSAllocate(svd->ds,svd->ncv);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDOneSideTRLanczosMGS" static PetscErrorCode SVDOneSideTRLanczosMGS(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec* U,PetscInt nconv,PetscInt l,PetscInt n,PetscScalar* work) { PetscErrorCode ierr; PetscReal a,b; PetscInt i,k=nconv+l; PetscFunctionBegin; ierr = SVDMatMult(svd,PETSC_FALSE,V[k],U[k]);CHKERRQ(ierr); if (l>0) { for (i=0;iip,U[k],&a);CHKERRQ(ierr); ierr = VecScale(U[k],1.0/a);CHKERRQ(ierr); alpha[k] = a; for (i=k+1;iip,0,NULL,i,NULL,V,V[i],work,&b,NULL);CHKERRQ(ierr); ierr = VecScale(V[i],1.0/b);CHKERRQ(ierr); beta[i-1] = b; ierr = SVDMatMult(svd,PETSC_FALSE,V[i],U[i]);CHKERRQ(ierr); ierr = VecAXPY(U[i],-b,U[i-1]);CHKERRQ(ierr); ierr = IPNorm(svd->ip,U[i],&a);CHKERRQ(ierr); ierr = VecScale(U[i],1.0/a);CHKERRQ(ierr); alpha[i] = a; } ierr = SVDMatMult(svd,PETSC_TRUE,U[n-1],v);CHKERRQ(ierr); ierr = IPOrthogonalize(svd->ip,0,NULL,n,NULL,V,v,work,&b,NULL);CHKERRQ(ierr); beta[n-1] = b; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDOneSideTRLanczosCGS" static PetscErrorCode SVDOneSideTRLanczosCGS(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec* U,PetscInt nconv,PetscInt l,PetscInt n,PetscScalar* work) { PetscErrorCode ierr; PetscReal a,b,sum,onorm,eta; PetscScalar dot; PetscInt i,j,k=nconv+l; IPOrthogRefineType refine; PetscFunctionBegin; ierr = SVDMatMult(svd,PETSC_FALSE,V[k],U[k]);CHKERRQ(ierr); if (l>0) { for (i=0;iip,NULL,&refine,&eta);CHKERRQ(ierr); for (i=k+1;iip,U[i-1],&a);CHKERRQ(ierr); if (refine == IP_ORTHOG_REFINE_IFNEEDED) { ierr = IPInnerProductBegin(svd->ip,V[i],V[i],&dot);CHKERRQ(ierr); } ierr = IPMInnerProductBegin(svd->ip,V[i],i,V,work);CHKERRQ(ierr); ierr = IPNormEnd(svd->ip,U[i-1],&a);CHKERRQ(ierr); if (refine == IP_ORTHOG_REFINE_IFNEEDED) { ierr = IPInnerProductEnd(svd->ip,V[i],V[i],&dot);CHKERRQ(ierr); } ierr = IPMInnerProductEnd(svd->ip,V[i],i,V,work);CHKERRQ(ierr); ierr = VecScale(U[i-1],1.0/a);CHKERRQ(ierr); for (j=0;jip,V[i],&b);CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_ALWAYS: ierr = IPOrthogonalizeCGS1(svd->ip,0,NULL,i,NULL,V,V[i],work,NULL,&b);CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_IFNEEDED: onorm = PetscSqrtReal(PetscRealPart(dot)) / a; sum = 0.0; for (j=0;j0.0) b = PetscSqrtReal(b); else { ierr = IPNorm(svd->ip,V[i],&b);CHKERRQ(ierr); } if (b < eta*onorm) { ierr = IPOrthogonalizeCGS1(svd->ip,0,NULL,i,NULL,V,V[i],work,NULL,&b);CHKERRQ(ierr); } break; } ierr = VecScale(V[i],1.0/b);CHKERRQ(ierr); ierr = SVDMatMult(svd,PETSC_FALSE,V[i],U[i]);CHKERRQ(ierr); ierr = VecAXPY(U[i],-b,U[i-1]);CHKERRQ(ierr); alpha[i-1] = a; beta[i-1] = b; } ierr = SVDMatMult(svd,PETSC_TRUE,U[n-1],v);CHKERRQ(ierr); ierr = IPNormBegin(svd->ip,U[n-1],&a);CHKERRQ(ierr); if (refine == IP_ORTHOG_REFINE_IFNEEDED) { ierr = IPInnerProductBegin(svd->ip,v,v,&dot);CHKERRQ(ierr); } ierr = IPMInnerProductBegin(svd->ip,v,n,V,work);CHKERRQ(ierr); ierr = IPNormEnd(svd->ip,U[n-1],&a);CHKERRQ(ierr); if (refine == IP_ORTHOG_REFINE_IFNEEDED) { ierr = IPInnerProductEnd(svd->ip,v,v,&dot);CHKERRQ(ierr); } ierr = IPMInnerProductEnd(svd->ip,v,n,V,work);CHKERRQ(ierr); ierr = VecScale(U[n-1],1.0/a);CHKERRQ(ierr); for (j=0;jip,v,&b);CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_ALWAYS: ierr = IPOrthogonalizeCGS1(svd->ip,0,NULL,n,NULL,V,v,work,NULL,&b);CHKERRQ(ierr); break; case IP_ORTHOG_REFINE_IFNEEDED: onorm = PetscSqrtReal(PetscRealPart(dot)) / a; sum = 0.0; for (j=0;j0.0) b = PetscSqrtReal(b); else { ierr = IPNorm(svd->ip,v,&b);CHKERRQ(ierr); } if (b < eta*onorm) { ierr = IPOrthogonalizeCGS1(svd->ip,0,NULL,n,NULL,V,v,work,NULL,&b);CHKERRQ(ierr); } break; } alpha[n-1] = a; beta[n-1] = b; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSolve_TRLanczos" PetscErrorCode SVDSolve_TRLanczos(SVD svd) { PetscErrorCode ierr; SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data; PetscReal *alpha,*beta,lastbeta,norm; PetscScalar *Q,*PT,*swork,*w; PetscInt i,k,l,nv,ld,off; Vec v; PetscBool conv; IPOrthogType orthog; PetscFunctionBegin; /* allocate working space */ ierr = DSGetLeadingDimension(svd->ds,&ld);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*ld,&w);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*svd->n,&swork);CHKERRQ(ierr); ierr = VecDuplicate(svd->V[0],&v);CHKERRQ(ierr); ierr = IPGetOrthogonalization(svd->ip,&orthog,NULL,NULL);CHKERRQ(ierr); /* normalize start vector */ if (!svd->nini) { ierr = SlepcVecSetRandom(svd->V[0],svd->rand);CHKERRQ(ierr); } ierr = VecNormalize(svd->V[0],&norm);CHKERRQ(ierr); l = 0; while (svd->reason == SVD_CONVERGED_ITERATING) { svd->its++; /* inner loop */ nv = PetscMin(svd->nconv+svd->mpd,svd->n); ierr = DSGetArrayReal(svd->ds,DS_MAT_T,&alpha);CHKERRQ(ierr); beta = alpha + ld; if (lanczos->oneside) { if (orthog == IP_ORTHOG_MGS) { ierr = SVDOneSideTRLanczosMGS(svd,alpha,beta,svd->V,v,svd->U,svd->nconv,l,nv,swork);CHKERRQ(ierr); } else { ierr = SVDOneSideTRLanczosCGS(svd,alpha,beta,svd->V,v,svd->U,svd->nconv,l,nv,swork);CHKERRQ(ierr); } } else { ierr = SVDTwoSideLanczos(svd,alpha,beta,svd->V,v,svd->U,svd->nconv+l,nv,swork);CHKERRQ(ierr); } lastbeta = beta[nv-1]; ierr = DSRestoreArrayReal(svd->ds,DS_MAT_T,&alpha);CHKERRQ(ierr); ierr = VecScale(v,1.0/lastbeta);CHKERRQ(ierr); /* compute SVD of general matrix */ ierr = DSSetDimensions(svd->ds,nv,nv,svd->nconv,svd->nconv+l);CHKERRQ(ierr); if (l==0) { ierr = DSSetState(svd->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); } else { ierr = DSSetState(svd->ds,DS_STATE_RAW);CHKERRQ(ierr); } ierr = DSSolve(svd->ds,w,NULL);CHKERRQ(ierr); ierr = DSSort(svd->ds,w,NULL,NULL,NULL,NULL);CHKERRQ(ierr); /* compute error estimates */ k = 0; conv = PETSC_TRUE; ierr = DSGetArray(svd->ds,DS_MAT_U,&Q);CHKERRQ(ierr); ierr = DSGetArrayReal(svd->ds,DS_MAT_T,&alpha);CHKERRQ(ierr); beta = alpha + ld; for (i=svd->nconv;isigma[i] = PetscRealPart(w[i]); beta[i] = PetscRealPart(Q[nv-1+i*ld])*lastbeta; svd->errest[i] = PetscAbsScalar(beta[i]); if (svd->sigma[i] > svd->tol) svd->errest[i] /= svd->sigma[i]; if (conv) { if (svd->errest[i] < svd->tol) k++; else conv = PETSC_FALSE; } } ierr = DSRestoreArrayReal(svd->ds,DS_MAT_T,&alpha);CHKERRQ(ierr); /* check convergence and update l */ if (svd->its >= svd->max_it) svd->reason = SVD_DIVERGED_ITS; if (svd->nconv+k >= svd->nsv) svd->reason = SVD_CONVERGED_TOL; if (svd->reason != SVD_CONVERGED_ITERATING) l = 0; else l = PetscMax((nv-svd->nconv-k)/2,0); /* compute converged singular vectors and restart vectors */ off = svd->nconv+svd->nconv*ld; ierr = DSGetArray(svd->ds,DS_MAT_VT,&PT);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv-svd->nconv,svd->V+svd->nconv,0,k+l,PT+off,ld,PETSC_TRUE);CHKERRQ(ierr); ierr = SlepcUpdateVectors(nv-svd->nconv,svd->U+svd->nconv,0,k+l,Q+off,ld,PETSC_FALSE);CHKERRQ(ierr); ierr = DSRestoreArray(svd->ds,DS_MAT_VT,&PT);CHKERRQ(ierr); ierr = DSRestoreArray(svd->ds,DS_MAT_U,&Q);CHKERRQ(ierr); /* copy the last vector to be the next initial vector */ if (svd->reason == SVD_CONVERGED_ITERATING) { ierr = VecCopy(v,svd->V[svd->nconv+k+l]);CHKERRQ(ierr); } svd->nconv += k; ierr = SVDMonitor(svd,svd->its,svd->nconv,svd->sigma,svd->errest,nv);CHKERRQ(ierr); } /* orthonormalize U columns in one side method */ if (lanczos->oneside) { for (i=0;inconv;i++) { ierr = IPOrthogonalize(svd->ip,0,NULL,i,NULL,svd->U,svd->U[i],NULL,&norm,NULL);CHKERRQ(ierr); ierr = VecScale(svd->U[i],1.0/norm);CHKERRQ(ierr); } } /* free working space */ ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = PetscFree(w);CHKERRQ(ierr); ierr = PetscFree(swork);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetFromOptions_TRLanczos" PetscErrorCode SVDSetFromOptions_TRLanczos(SVD svd) { PetscErrorCode ierr; PetscBool set,val; SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data; PetscFunctionBegin; ierr = PetscOptionsHead("SVD TRLanczos Options");CHKERRQ(ierr); ierr = PetscOptionsBool("-svd_trlanczos_oneside","Lanczos one-side reorthogonalization","SVDTRLanczosSetOneSide",lanczos->oneside,&val,&set);CHKERRQ(ierr); if (set) { ierr = SVDTRLanczosSetOneSide(svd,val);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDTRLanczosSetOneSide_TRLanczos" static PetscErrorCode SVDTRLanczosSetOneSide_TRLanczos(SVD svd,PetscBool oneside) { SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data; PetscFunctionBegin; lanczos->oneside = oneside; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDTRLanczosSetOneSide" /*@ SVDTRLanczosSetOneSide - Indicate if the variant of the Lanczos method to be used is one-sided or two-sided. Logically Collective on SVD Input Parameters: + svd - singular value solver - oneside - boolean flag indicating if the method is one-sided or not Options Database Key: . -svd_trlanczos_oneside - Indicates the boolean flag Note: By default, a two-sided variant is selected, which is sometimes slightly more robust. However, the one-sided variant is faster because it avoids the orthogonalization associated to left singular vectors. Level: advanced .seealso: SVDLanczosSetOneSide() @*/ PetscErrorCode SVDTRLanczosSetOneSide(SVD svd,PetscBool oneside) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveBool(svd,oneside,2); ierr = PetscTryMethod(svd,"SVDTRLanczosSetOneSide_C",(SVD,PetscBool),(svd,oneside));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDTRLanczosGetOneSide" /*@ SVDTRLanczosGetOneSide - Gets if the variant of the Lanczos method to be used is one-sided or two-sided. Not Collective Input Parameters: . svd - singular value solver Output Parameters: . oneside - boolean flag indicating if the method is one-sided or not Level: advanced .seealso: SVDTRLanczosSetOneSide() @*/ PetscErrorCode SVDTRLanczosGetOneSide(SVD svd,PetscBool *oneside) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(oneside,2); ierr = PetscTryMethod(svd,"SVDTRLanczosGetOneSide_C",(SVD,PetscBool*),(svd,oneside));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDTRLanczosGetOneSide_TRLanczos" static PetscErrorCode SVDTRLanczosGetOneSide_TRLanczos(SVD svd,PetscBool *oneside) { SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data; PetscFunctionBegin; *oneside = lanczos->oneside; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDReset_TRLanczos" PetscErrorCode SVDReset_TRLanczos(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDestroyVecs(svd->n,&svd->U);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDDestroy_TRLanczos" PetscErrorCode SVDDestroy_TRLanczos(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(svd->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosSetOneSide_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosGetOneSide_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDView_TRLanczos" PetscErrorCode SVDView_TRLanczos(SVD svd,PetscViewer viewer) { PetscErrorCode ierr; SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data; PetscFunctionBegin; ierr = PetscViewerASCIIPrintf(viewer," TRLanczos: %s-sided reorthogonalization\n",lanczos->oneside? "one": "two");CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCreate_TRLanczos" PETSC_EXTERN PetscErrorCode SVDCreate_TRLanczos(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(svd,SVD_TRLANCZOS,&svd->data);CHKERRQ(ierr); svd->ops->setup = SVDSetUp_TRLanczos; svd->ops->solve = SVDSolve_TRLanczos; svd->ops->destroy = SVDDestroy_TRLanczos; svd->ops->reset = SVDReset_TRLanczos; svd->ops->setfromoptions = SVDSetFromOptions_TRLanczos; svd->ops->view = SVDView_TRLanczos; ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosSetOneSide_C",SVDTRLanczosSetOneSide_TRLanczos);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosGetOneSide_C",SVDTRLanczosGetOneSide_TRLanczos);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/makefile0000644000175000017500000000214712211062077021665 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = trlanczos.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = SVD LOCDIR = src/svd/impls/trlanczos/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/makefile.html0000644000175000017500000000374312211062077022633 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = trlanczos.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = SVD
LOCDIR   = src/svd/impls/trlanczos/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/index.html0000644000175000017500000000205712211062077022162 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

trlanczos.c
makefile
slepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/trlanczos.c.html0000644000175000017500000010734012211062077023314 0ustar gladkgladk

Actual source code: trlanczos.c

  1: /*

  3:    SLEPc singular value solver: "trlanczos"

  5:    Method: Thick-restart Lanczos

  7:    Algorithm:

  9:        Golub-Kahan-Lanczos bidiagonalization with thick-restart.

 11:    References:

 13:        [1] G.H. Golub and W. Kahan, "Calculating the singular values
 14:            and pseudo-inverse of a matrix", SIAM J. Numer. Anal. Ser.
 15:            B 2:205-224, 1965.

 17:        [2] V. Hernandez, J.E. Roman, and A. Tomas, "A robust and
 18:            efficient parallel SVD solver based on restarted Lanczos
 19:            bidiagonalization", Elec. Trans. Numer. Anal. 31:68-85,
 20:            2008.

 22:    Last update: Jun 2007

 24:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 25:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 26:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 28:    This file is part of SLEPc.

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

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

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

 44: #include <slepc-private/svdimpl.h>                /*I "slepcsvd.h" I*/
 45: #include <slepc-private/ipimpl.h>
 46: #include <slepcblaslapack.h>

 48: typedef struct {
 49:   PetscBool oneside;
 50: } SVD_TRLANCZOS;

 54: PetscErrorCode SVDSetUp_TRLanczos(SVD svd)
 55: {
 57:   PetscInt       N;

 60:   SVDMatGetSize(svd,NULL,&N);
 61:   if (svd->ncv) { /* ncv set */
 62:     if (svd->ncv<svd->nsv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must be at least nsv");
 63:   } else if (svd->mpd) { /* mpd set */
 64:     svd->ncv = PetscMin(N,svd->nsv+svd->mpd);
 65:   } else { /* neither set: defaults depend on nsv being small or large */
 66:     if (svd->nsv<500) svd->ncv = PetscMin(N,PetscMax(2*svd->nsv,10));
 67:     else {
 68:       svd->mpd = 500;
 69:       svd->ncv = PetscMin(N,svd->nsv+svd->mpd);
 70:     }
 71:   }
 72:   if (!svd->mpd) svd->mpd = svd->ncv;
 73:   if (svd->ncv>svd->nsv+svd->mpd) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must not be larger than nev+mpd");
 74:   if (!svd->max_it) svd->max_it = PetscMax(N/svd->ncv,100);
 75:   if (svd->ncv!=svd->n) {
 76:     VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);
 77:     PetscLogObjectParents(svd,svd->ncv,svd->U);
 78:   }
 79:   DSSetType(svd->ds,DSSVD);
 80:   DSSetCompact(svd->ds,PETSC_TRUE);
 81:   DSAllocate(svd->ds,svd->ncv);
 82:   return(0);
 83: }

 87: static PetscErrorCode SVDOneSideTRLanczosMGS(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec* U,PetscInt nconv,PetscInt l,PetscInt n,PetscScalar* work)
 88: {
 90:   PetscReal      a,b;
 91:   PetscInt       i,k=nconv+l;

 94:   SVDMatMult(svd,PETSC_FALSE,V[k],U[k]);
 95:   if (l>0) {
 96:     for (i=0;i<l;i++) work[i]=beta[i+nconv];
 97:     SlepcVecMAXPBY(U[k],1.0,-1.0,l,work,U+nconv);
 98:   }
 99:   IPNorm(svd->ip,U[k],&a);
100:   VecScale(U[k],1.0/a);
101:   alpha[k] = a;
102:   for (i=k+1;i<n;i++) {
103:     SVDMatMult(svd,PETSC_TRUE,U[i-1],V[i]);
104:     IPOrthogonalize(svd->ip,0,NULL,i,NULL,V,V[i],work,&b,NULL);
105:     VecScale(V[i],1.0/b);
106:     beta[i-1] = b;

108:     SVDMatMult(svd,PETSC_FALSE,V[i],U[i]);
109:     VecAXPY(U[i],-b,U[i-1]);
110:     IPNorm(svd->ip,U[i],&a);
111:     VecScale(U[i],1.0/a);
112:     alpha[i] = a;
113:   }
114:   SVDMatMult(svd,PETSC_TRUE,U[n-1],v);
115:   IPOrthogonalize(svd->ip,0,NULL,n,NULL,V,v,work,&b,NULL);
116:   beta[n-1] = b;
117:   return(0);
118: }

122: static PetscErrorCode SVDOneSideTRLanczosCGS(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec* U,PetscInt nconv,PetscInt l,PetscInt n,PetscScalar* work)
123: {
124:   PetscErrorCode     ierr;
125:   PetscReal          a,b,sum,onorm,eta;
126:   PetscScalar        dot;
127:   PetscInt           i,j,k=nconv+l;
128:   IPOrthogRefineType refine;

131:   SVDMatMult(svd,PETSC_FALSE,V[k],U[k]);
132:   if (l>0) {
133:     for (i=0;i<l;i++) work[i]=beta[i+nconv];
134:     SlepcVecMAXPBY(U[k],1.0,-1.0,l,work,U+nconv);
135:   }
136:   IPGetOrthogonalization(svd->ip,NULL,&refine,&eta);
137:   for (i=k+1;i<n;i++) {
138:     SVDMatMult(svd,PETSC_TRUE,U[i-1],V[i]);
139:     IPNormBegin(svd->ip,U[i-1],&a);
140:     if (refine == IP_ORTHOG_REFINE_IFNEEDED) {
141:       IPInnerProductBegin(svd->ip,V[i],V[i],&dot);
142:     }
143:     IPMInnerProductBegin(svd->ip,V[i],i,V,work);
144:     IPNormEnd(svd->ip,U[i-1],&a);
145:     if (refine == IP_ORTHOG_REFINE_IFNEEDED) {
146:       IPInnerProductEnd(svd->ip,V[i],V[i],&dot);
147:     }
148:     IPMInnerProductEnd(svd->ip,V[i],i,V,work);

150:     VecScale(U[i-1],1.0/a);
151:     for (j=0;j<i;j++) work[j] = work[j] / a;
152:     SlepcVecMAXPBY(V[i],1.0/a,-1.0,i,work,V);

154:     switch (refine) {
155:     case IP_ORTHOG_REFINE_NEVER:
156:       IPNorm(svd->ip,V[i],&b);
157:       break;
158:     case IP_ORTHOG_REFINE_ALWAYS:
159:       IPOrthogonalizeCGS1(svd->ip,0,NULL,i,NULL,V,V[i],work,NULL,&b);
160:       break;
161:     case IP_ORTHOG_REFINE_IFNEEDED:
162:       onorm = PetscSqrtReal(PetscRealPart(dot)) / a;
163:       sum = 0.0;
164:       for (j=0;j<i;j++) {
165:         sum += PetscRealPart(work[j] * PetscConj(work[j]));
166:       }
167:       b = PetscRealPart(dot)/(a*a) - sum;
168:       if (b>0.0) b = PetscSqrtReal(b);
169:       else {
170:         IPNorm(svd->ip,V[i],&b);
171:       }
172:       if (b < eta*onorm) {
173:         IPOrthogonalizeCGS1(svd->ip,0,NULL,i,NULL,V,V[i],work,NULL,&b);
174:       }
175:       break;
176:     }

178:     VecScale(V[i],1.0/b);

180:     SVDMatMult(svd,PETSC_FALSE,V[i],U[i]);
181:     VecAXPY(U[i],-b,U[i-1]);

183:     alpha[i-1] = a;
184:     beta[i-1] = b;
185:   }
186:   SVDMatMult(svd,PETSC_TRUE,U[n-1],v);
187:   IPNormBegin(svd->ip,U[n-1],&a);
188:   if (refine == IP_ORTHOG_REFINE_IFNEEDED) {
189:     IPInnerProductBegin(svd->ip,v,v,&dot);
190:   }
191:   IPMInnerProductBegin(svd->ip,v,n,V,work);
192:   IPNormEnd(svd->ip,U[n-1],&a);
193:   if (refine == IP_ORTHOG_REFINE_IFNEEDED) {
194:     IPInnerProductEnd(svd->ip,v,v,&dot);
195:   }
196:   IPMInnerProductEnd(svd->ip,v,n,V,work);

198:   VecScale(U[n-1],1.0/a);
199:   for (j=0;j<n;j++) work[j] = work[j] / a;
200:   SlepcVecMAXPBY(v,1.0/a,-1.0,n,work,V);

202:   switch (refine) {
203:   case IP_ORTHOG_REFINE_NEVER:
204:     IPNorm(svd->ip,v,&b);
205:     break;
206:   case IP_ORTHOG_REFINE_ALWAYS:
207:     IPOrthogonalizeCGS1(svd->ip,0,NULL,n,NULL,V,v,work,NULL,&b);
208:     break;
209:   case IP_ORTHOG_REFINE_IFNEEDED:
210:     onorm = PetscSqrtReal(PetscRealPart(dot)) / a;
211:     sum = 0.0;
212:     for (j=0;j<i;j++) {
213:       sum += PetscRealPart(work[j] * PetscConj(work[j]));
214:     }
215:     b = PetscRealPart(dot)/(a*a) - sum;
216:     if (b>0.0) b = PetscSqrtReal(b);
217:     else {
218:       IPNorm(svd->ip,v,&b);
219:     }
220:     if (b < eta*onorm) {
221:       IPOrthogonalizeCGS1(svd->ip,0,NULL,n,NULL,V,v,work,NULL,&b);
222:     }
223:     break;
224:   }

226:   alpha[n-1] = a;
227:   beta[n-1] = b;
228:   return(0);
229: }

233: PetscErrorCode SVDSolve_TRLanczos(SVD svd)
234: {
236:   SVD_TRLANCZOS  *lanczos = (SVD_TRLANCZOS*)svd->data;
237:   PetscReal      *alpha,*beta,lastbeta,norm;
238:   PetscScalar    *Q,*PT,*swork,*w;
239:   PetscInt       i,k,l,nv,ld,off;
240:   Vec            v;
241:   PetscBool      conv;
242:   IPOrthogType   orthog;

245:   /* allocate working space */
246:   DSGetLeadingDimension(svd->ds,&ld);
247:   PetscMalloc(sizeof(PetscScalar)*ld,&w);
248:   PetscMalloc(sizeof(PetscScalar)*svd->n,&swork);
249:   VecDuplicate(svd->V[0],&v);
250:   IPGetOrthogonalization(svd->ip,&orthog,NULL,NULL);

252:   /* normalize start vector */
253:   if (!svd->nini) {
254:     SlepcVecSetRandom(svd->V[0],svd->rand);
255:   }
256:   VecNormalize(svd->V[0],&norm);

258:   l = 0;
259:   while (svd->reason == SVD_CONVERGED_ITERATING) {
260:     svd->its++;

262:     /* inner loop */
263:     nv = PetscMin(svd->nconv+svd->mpd,svd->n);
264:     DSGetArrayReal(svd->ds,DS_MAT_T,&alpha);
265:     beta = alpha + ld;
266:     if (lanczos->oneside) {
267:       if (orthog == IP_ORTHOG_MGS) {
268:         SVDOneSideTRLanczosMGS(svd,alpha,beta,svd->V,v,svd->U,svd->nconv,l,nv,swork);
269:       } else {
270:         SVDOneSideTRLanczosCGS(svd,alpha,beta,svd->V,v,svd->U,svd->nconv,l,nv,swork);
271:       }
272:     } else {
273:       SVDTwoSideLanczos(svd,alpha,beta,svd->V,v,svd->U,svd->nconv+l,nv,swork);
274:     }
275:     lastbeta = beta[nv-1];
276:     DSRestoreArrayReal(svd->ds,DS_MAT_T,&alpha);
277:     VecScale(v,1.0/lastbeta);

279:     /* compute SVD of general matrix */
280:     DSSetDimensions(svd->ds,nv,nv,svd->nconv,svd->nconv+l);
281:     if (l==0) {
282:       DSSetState(svd->ds,DS_STATE_INTERMEDIATE);
283:     } else {
284:       DSSetState(svd->ds,DS_STATE_RAW);
285:     }
286:     DSSolve(svd->ds,w,NULL);
287:     DSSort(svd->ds,w,NULL,NULL,NULL,NULL);

289:     /* compute error estimates */
290:     k = 0;
291:     conv = PETSC_TRUE;
292:     DSGetArray(svd->ds,DS_MAT_U,&Q);
293:     DSGetArrayReal(svd->ds,DS_MAT_T,&alpha);
294:     beta = alpha + ld;
295:     for (i=svd->nconv;i<nv;i++) {
296:       svd->sigma[i] = PetscRealPart(w[i]);
297:       beta[i] = PetscRealPart(Q[nv-1+i*ld])*lastbeta;
298:       svd->errest[i] = PetscAbsScalar(beta[i]);
299:       if (svd->sigma[i] > svd->tol) svd->errest[i] /= svd->sigma[i];
300:       if (conv) {
301:         if (svd->errest[i] < svd->tol) k++;
302:         else conv = PETSC_FALSE;
303:       }
304:     }
305:     DSRestoreArrayReal(svd->ds,DS_MAT_T,&alpha);

307:     /* check convergence and update l */
308:     if (svd->its >= svd->max_it) svd->reason = SVD_DIVERGED_ITS;
309:     if (svd->nconv+k >= svd->nsv) svd->reason = SVD_CONVERGED_TOL;
310:     if (svd->reason != SVD_CONVERGED_ITERATING) l = 0;
311:     else l = PetscMax((nv-svd->nconv-k)/2,0);

313:     /* compute converged singular vectors and restart vectors */
314:     off = svd->nconv+svd->nconv*ld;
315:     DSGetArray(svd->ds,DS_MAT_VT,&PT);
316:     SlepcUpdateVectors(nv-svd->nconv,svd->V+svd->nconv,0,k+l,PT+off,ld,PETSC_TRUE);
317:     SlepcUpdateVectors(nv-svd->nconv,svd->U+svd->nconv,0,k+l,Q+off,ld,PETSC_FALSE);
318:     DSRestoreArray(svd->ds,DS_MAT_VT,&PT);
319:     DSRestoreArray(svd->ds,DS_MAT_U,&Q);

321:     /* copy the last vector to be the next initial vector */
322:     if (svd->reason == SVD_CONVERGED_ITERATING) {
323:       VecCopy(v,svd->V[svd->nconv+k+l]);
324:     }

326:     svd->nconv += k;
327:     SVDMonitor(svd,svd->its,svd->nconv,svd->sigma,svd->errest,nv);
328:   }

330:   /* orthonormalize U columns in one side method */
331:   if (lanczos->oneside) {
332:     for (i=0;i<svd->nconv;i++) {
333:       IPOrthogonalize(svd->ip,0,NULL,i,NULL,svd->U,svd->U[i],NULL,&norm,NULL);
334:       VecScale(svd->U[i],1.0/norm);
335:     }
336:   }

338:   /* free working space */
339:   VecDestroy(&v);
340:   PetscFree(w);
341:   PetscFree(swork);
342:   return(0);
343: }

347: PetscErrorCode SVDSetFromOptions_TRLanczos(SVD svd)
348: {
350:   PetscBool      set,val;
351:   SVD_TRLANCZOS  *lanczos = (SVD_TRLANCZOS*)svd->data;

354:   PetscOptionsHead("SVD TRLanczos Options");
355:   PetscOptionsBool("-svd_trlanczos_oneside","Lanczos one-side reorthogonalization","SVDTRLanczosSetOneSide",lanczos->oneside,&val,&set);
356:   if (set) {
357:     SVDTRLanczosSetOneSide(svd,val);
358:   }
359:   PetscOptionsTail();
360:   return(0);
361: }

365: static PetscErrorCode SVDTRLanczosSetOneSide_TRLanczos(SVD svd,PetscBool oneside)
366: {
367:   SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data;

370:   lanczos->oneside = oneside;
371:   return(0);
372: }

376: /*@
377:    SVDTRLanczosSetOneSide - Indicate if the variant of the Lanczos method
378:    to be used is one-sided or two-sided.

380:    Logically Collective on SVD

382:    Input Parameters:
383: +  svd     - singular value solver
384: -  oneside - boolean flag indicating if the method is one-sided or not

386:    Options Database Key:
387: .  -svd_trlanczos_oneside <boolean> - Indicates the boolean flag

389:    Note:
390:    By default, a two-sided variant is selected, which is sometimes slightly
391:    more robust. However, the one-sided variant is faster because it avoids
392:    the orthogonalization associated to left singular vectors.

394:    Level: advanced

396: .seealso: SVDLanczosSetOneSide()
397: @*/
398: PetscErrorCode SVDTRLanczosSetOneSide(SVD svd,PetscBool oneside)
399: {

405:   PetscTryMethod(svd,"SVDTRLanczosSetOneSide_C",(SVD,PetscBool),(svd,oneside));
406:   return(0);
407: }

411: /*@
412:    SVDTRLanczosGetOneSide - Gets if the variant of the Lanczos method
413:    to be used is one-sided or two-sided.

415:    Not Collective

417:    Input Parameters:
418: .  svd     - singular value solver

420:    Output Parameters:
421: .  oneside - boolean flag indicating if the method is one-sided or not

423:    Level: advanced

425: .seealso: SVDTRLanczosSetOneSide()
426: @*/
427: PetscErrorCode SVDTRLanczosGetOneSide(SVD svd,PetscBool *oneside)
428: {

434:   PetscTryMethod(svd,"SVDTRLanczosGetOneSide_C",(SVD,PetscBool*),(svd,oneside));
435:   return(0);
436: }

440: static PetscErrorCode SVDTRLanczosGetOneSide_TRLanczos(SVD svd,PetscBool *oneside)
441: {
442:   SVD_TRLANCZOS    *lanczos = (SVD_TRLANCZOS*)svd->data;

445:   *oneside = lanczos->oneside;
446:   return(0);
447: }

451: PetscErrorCode SVDReset_TRLanczos(SVD svd)
452: {

456:   VecDestroyVecs(svd->n,&svd->U);
457:   return(0);
458: }

462: PetscErrorCode SVDDestroy_TRLanczos(SVD svd)
463: {

467:   PetscFree(svd->data);
468:   PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosSetOneSide_C",NULL);
469:   PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosGetOneSide_C",NULL);
470:   return(0);
471: }

475: PetscErrorCode SVDView_TRLanczos(SVD svd,PetscViewer viewer)
476: {
478:   SVD_TRLANCZOS  *lanczos = (SVD_TRLANCZOS*)svd->data;

481:   PetscViewerASCIIPrintf(viewer,"  TRLanczos: %s-sided reorthogonalization\n",lanczos->oneside? "one": "two");
482:   return(0);
483: }

487: PETSC_EXTERN PetscErrorCode SVDCreate_TRLanczos(SVD svd)
488: {

492:   PetscNewLog(svd,SVD_TRLANCZOS,&svd->data);
493:   svd->ops->setup          = SVDSetUp_TRLanczos;
494:   svd->ops->solve          = SVDSolve_TRLanczos;
495:   svd->ops->destroy        = SVDDestroy_TRLanczos;
496:   svd->ops->reset          = SVDReset_TRLanczos;
497:   svd->ops->setfromoptions = SVDSetFromOptions_TRLanczos;
498:   svd->ops->view           = SVDView_TRLanczos;
499:   PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosSetOneSide_C",SVDTRLanczosSetOneSide_TRLanczos);
500:   PetscObjectComposeFunction((PetscObject)svd,"SVDTRLanczosGetOneSide_C",SVDTRLanczosGetOneSide_TRLanczos);
501:   return(0);
502: }

slepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/ftn-auto/0000755000175000017500000000000012214143515021716 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/ftn-auto/trlanczosf.c0000644000175000017500000000265412211062077024256 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* trlanczos.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdtrlanczossetoneside_ SVDTRLANCZOSSETONESIDE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdtrlanczossetoneside_ svdtrlanczossetoneside #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdtrlanczosgetoneside_ SVDTRLANCZOSGETONESIDE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdtrlanczosgetoneside_ svdtrlanczosgetoneside #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdtrlanczossetoneside_(SVD *svd,PetscBool *oneside, int *__ierr ){ *__ierr = SVDTRLanczosSetOneSide(*svd,*oneside); } void PETSC_STDCALL svdtrlanczosgetoneside_(SVD *svd,PetscBool *oneside, int *__ierr ){ *__ierr = SVDTRLanczosGetOneSide(*svd,oneside); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/impls/trlanczos/ftn-auto/makefile0000644000175000017500000000035212211062077023416 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = trlanczosf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/svd/impls/trlanczos/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/cross/0000755000175000017500000000000012214143515017273 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/cross/cross.c.html0000644000175000017500000006337112211062077021545 0ustar gladkgladk
Actual source code: cross.c

  1: /*

  3:    SLEPc singular value solver: "cross"

  5:    Method: Uses a Hermitian eigensolver for A^T*A

  7:    Last update: Jun 2007

  9:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 10:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 11:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 13:    This file is part of SLEPc.

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

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

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

 29: #include <slepc-private/svdimpl.h>                /*I "slepcsvd.h" I*/
 30: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/

 32: typedef struct {
 33:   EPS       eps;
 34:   PetscBool setfromoptionscalled;
 35:   Mat       mat;
 36:   Vec       w,diag;
 37: } SVD_CROSS;

 41: static PetscErrorCode MatMult_Cross(Mat B,Vec x,Vec y)
 42: {
 44:   SVD            svd;
 45:   SVD_CROSS      *cross;

 48:   MatShellGetContext(B,(void**)&svd);
 49:   cross = (SVD_CROSS*)svd->data;
 50:   SVDMatMult(svd,PETSC_FALSE,x,cross->w);
 51:   SVDMatMult(svd,PETSC_TRUE,cross->w,y);
 52:   return(0);
 53: }

 57: static PetscErrorCode MatGetDiagonal_Cross(Mat B,Vec d)
 58: {
 59:   PetscErrorCode    ierr;
 60:   SVD               svd;
 61:   SVD_CROSS         *cross;
 62:   PetscInt          N,n,i,j,start,end,ncols;
 63:   PetscScalar       *work1,*work2,*diag;
 64:   const PetscInt    *cols;
 65:   const PetscScalar *vals;

 68:   MatShellGetContext(B,(void**)&svd);
 69:   cross = (SVD_CROSS*)svd->data;
 70:   if (!cross->diag) {
 71:     /* compute diagonal from rows and store in cross->diag */
 72:     VecDuplicate(d,&cross->diag);
 73:     SVDMatGetSize(svd,NULL,&N);
 74:     SVDMatGetLocalSize(svd,NULL,&n);
 75:     PetscMalloc(sizeof(PetscScalar)*N,&work1);
 76:     PetscMalloc(sizeof(PetscScalar)*N,&work2);
 77:     for (i=0;i<n;i++) work1[i] = work2[i] = 0.0;
 78:     if (svd->AT) {
 79:       MatGetOwnershipRange(svd->AT,&start,&end);
 80:       for (i=start;i<end;i++) {
 81:         MatGetRow(svd->AT,i,&ncols,NULL,&vals);
 82:         for (j=0;j<ncols;j++)
 83:           work1[i] += vals[j]*vals[j];
 84:         MatRestoreRow(svd->AT,i,&ncols,NULL,&vals);
 85:       }
 86:     } else {
 87:       MatGetOwnershipRange(svd->A,&start,&end);
 88:       for (i=start;i<end;i++) {
 89:         MatGetRow(svd->A,i,&ncols,&cols,&vals);
 90:         for (j=0;j<ncols;j++)
 91:           work1[cols[j]] += vals[j]*vals[j];
 92:         MatRestoreRow(svd->A,i,&ncols,&cols,&vals);
 93:       }
 94:     }
 95:     MPI_Allreduce(work1,work2,N,MPIU_SCALAR,MPI_SUM,PetscObjectComm((PetscObject)svd));
 96:     VecGetOwnershipRange(cross->diag,&start,&end);
 97:     VecGetArray(cross->diag,&diag);
 98:     for (i=start;i<end;i++)
 99:       diag[i-start] = work2[i];
100:     VecRestoreArray(cross->diag,&diag);
101:     PetscFree(work1);
102:     PetscFree(work2);
103:   }
104:   VecCopy(cross->diag,d);
105:   return(0);
106: }

110: PetscErrorCode SVDSetUp_Cross(SVD svd)
111: {
113:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;
114:   PetscInt       n,i;
115:   PetscBool      trackall;

118:   if (!cross->mat) {
119:     SVDMatGetLocalSize(svd,NULL,&n);
120:     MatCreateShell(PetscObjectComm((PetscObject)svd),n,n,PETSC_DETERMINE,PETSC_DETERMINE,svd,&cross->mat);
121:     MatShellSetOperation(cross->mat,MATOP_MULT,(void(*)(void))MatMult_Cross);
122:     MatShellSetOperation(cross->mat,MATOP_GET_DIAGONAL,(void(*)(void))MatGetDiagonal_Cross);
123:     SVDMatGetVecs(svd,NULL,&cross->w);
124:     PetscLogObjectParent(svd,cross->mat);
125:     PetscLogObjectParent(svd,cross->w);
126:   }

128:   if (!cross->eps) { SVDCrossGetEPS(svd,&cross->eps); }
129:   EPSSetOperators(cross->eps,cross->mat,NULL);
130:   EPSSetProblemType(cross->eps,EPS_HEP);
131:   EPSSetWhichEigenpairs(cross->eps,svd->which == SVD_LARGEST ? EPS_LARGEST_REAL : EPS_SMALLEST_REAL);
132:   EPSSetDimensions(cross->eps,svd->nsv,svd->ncv,svd->mpd);
133:   EPSSetTolerances(cross->eps,svd->tol,svd->max_it);
134:   /* Transfer the trackall option from svd to eps */
135:   SVDGetTrackAll(svd,&trackall);
136:   EPSSetTrackAll(cross->eps,trackall);
137:   if (cross->setfromoptionscalled) {
138:     EPSSetFromOptions(cross->eps);
139:     cross->setfromoptionscalled = PETSC_FALSE;
140:   }
141:   EPSSetUp(cross->eps);
142:   EPSGetDimensions(cross->eps,NULL,&svd->ncv,&svd->mpd);
143:   EPSGetTolerances(cross->eps,&svd->tol,&svd->max_it);
144:   /* Transfer the initial space from svd to eps */
145:   if (svd->nini < 0) {
146:     EPSSetInitialSpace(cross->eps,-svd->nini,svd->IS);
147:     for (i=0;i<-svd->nini;i++) {
148:       VecDestroy(&svd->IS[i]);
149:     }
150:     PetscFree(svd->IS);
151:     svd->nini = 0;
152:   }
153:   return(0);
154: }

158: PetscErrorCode SVDSolve_Cross(SVD svd)
159: {
161:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;
162:   PetscInt       i;
163:   PetscScalar    sigma;

166:   EPSSolve(cross->eps);
167:   EPSGetConverged(cross->eps,&svd->nconv);
168:   EPSGetIterationNumber(cross->eps,&svd->its);
169:   EPSGetConvergedReason(cross->eps,(EPSConvergedReason*)&svd->reason);
170:   for (i=0;i<svd->nconv;i++) {
171:     EPSGetEigenpair(cross->eps,i,&sigma,NULL,svd->V[i],NULL);
172:     if (PetscRealPart(sigma)<0.0) SETERRQ(PetscObjectComm((PetscObject)svd),1,"Negative eigenvalue computed by EPS");
173:     svd->sigma[i] = PetscSqrtReal(PetscRealPart(sigma));
174:   }
175:   return(0);
176: }

180: static PetscErrorCode SVDMonitor_Cross(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)
181: {
182:   PetscInt       i;
183:   SVD            svd = (SVD)ctx;
184:   PetscScalar    er,ei;

188:   for (i=0;i<PetscMin(nest,svd->ncv);i++) {
189:     er = eigr[i]; ei = eigi[i];
190:     STBackTransform(eps->st,1,&er,&ei);
191:     svd->sigma[i] = PetscSqrtReal(PetscRealPart(er));
192:     svd->errest[i] = errest[i];
193:   }
194:   SVDMonitor(svd,its,nconv,svd->sigma,svd->errest,nest);
195:   return(0);
196: }

200: PetscErrorCode SVDSetFromOptions_Cross(SVD svd)
201: {
202:   SVD_CROSS *cross = (SVD_CROSS*)svd->data;

205:   cross->setfromoptionscalled = PETSC_TRUE;
206:   return(0);
207: }

211: static PetscErrorCode SVDCrossSetEPS_Cross(SVD svd,EPS eps)
212: {
214:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;

217:   PetscObjectReference((PetscObject)eps);
218:   EPSDestroy(&cross->eps);
219:   cross->eps = eps;
220:   PetscLogObjectParent(svd,cross->eps);
221:   svd->setupcalled = 0;
222:   return(0);
223: }

227: /*@
228:    SVDCrossSetEPS - Associate an eigensolver object (EPS) to the
229:    singular value solver.

231:    Collective on SVD

233:    Input Parameters:
234: +  svd - singular value solver
235: -  eps - the eigensolver object

237:    Level: advanced

239: .seealso: SVDCrossGetEPS()
240: @*/
241: PetscErrorCode SVDCrossSetEPS(SVD svd,EPS eps)
242: {

249:   PetscTryMethod(svd,"SVDCrossSetEPS_C",(SVD,EPS),(svd,eps));
250:   return(0);
251: }

255: static PetscErrorCode SVDCrossGetEPS_Cross(SVD svd,EPS *eps)
256: {
257:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;
258:   ST             st;

262:   if (!cross->eps) {
263:     EPSCreate(PetscObjectComm((PetscObject)svd),&cross->eps);
264:     EPSSetOptionsPrefix(cross->eps,((PetscObject)svd)->prefix);
265:     EPSAppendOptionsPrefix(cross->eps,"svd_");
266:     PetscObjectIncrementTabLevel((PetscObject)cross->eps,(PetscObject)svd,1);
267:     PetscLogObjectParent(svd,cross->eps);
268:     if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
269:     EPSSetIP(cross->eps,svd->ip);
270:     EPSSetWhichEigenpairs(cross->eps,EPS_LARGEST_REAL);
271:     EPSMonitorSet(cross->eps,SVDMonitor_Cross,svd,NULL);
272:     EPSGetST(cross->eps,&st);
273:     STSetMatMode(st,ST_MATMODE_SHELL);
274:   }
275:   *eps = cross->eps;
276:   return(0);
277: }

281: /*@
282:    SVDCrossGetEPS - Retrieve the eigensolver object (EPS) associated
283:    to the singular value solver.

285:    Not Collective

287:    Input Parameter:
288: .  svd - singular value solver

290:    Output Parameter:
291: .  eps - the eigensolver object

293:    Level: advanced

295: .seealso: SVDCrossSetEPS()
296: @*/
297: PetscErrorCode SVDCrossGetEPS(SVD svd,EPS *eps)
298: {

304:   PetscTryMethod(svd,"SVDCrossGetEPS_C",(SVD,EPS*),(svd,eps));
305:   return(0);
306: }

310: PetscErrorCode SVDView_Cross(SVD svd,PetscViewer viewer)
311: {
313:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;

316:   if (!cross->eps) { SVDCrossGetEPS(svd,&cross->eps); }
317:   PetscViewerASCIIPushTab(viewer);
318:   EPSView(cross->eps,viewer);
319:   PetscViewerASCIIPopTab(viewer);
320:   return(0);
321: }

325: PetscErrorCode SVDReset_Cross(SVD svd)
326: {
328:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;

331:   if (cross->eps) { EPSReset(cross->eps); }
332:   MatDestroy(&cross->mat);
333:   VecDestroy(&cross->w);
334:   VecDestroy(&cross->diag);
335:   return(0);
336: }

340: PetscErrorCode SVDDestroy_Cross(SVD svd)
341: {
343:   SVD_CROSS      *cross = (SVD_CROSS*)svd->data;

346:   EPSDestroy(&cross->eps);
347:   PetscFree(svd->data);
348:   PetscObjectComposeFunction((PetscObject)svd,"SVDCrossSetEPS_C",NULL);
349:   PetscObjectComposeFunction((PetscObject)svd,"SVDCrossGetEPS_C",NULL);
350:   return(0);
351: }

355: PETSC_EXTERN PetscErrorCode SVDCreate_Cross(SVD svd)
356: {
358:   SVD_CROSS      *cross;

361:   PetscNewLog(svd,SVD_CROSS,&cross);
362:   svd->data                = (void*)cross;
363:   svd->ops->solve          = SVDSolve_Cross;
364:   svd->ops->setup          = SVDSetUp_Cross;
365:   svd->ops->setfromoptions = SVDSetFromOptions_Cross;
366:   svd->ops->destroy        = SVDDestroy_Cross;
367:   svd->ops->reset          = SVDReset_Cross;
368:   svd->ops->view           = SVDView_Cross;
369:   PetscObjectComposeFunction((PetscObject)svd,"SVDCrossSetEPS_C",SVDCrossSetEPS_Cross);
370:   PetscObjectComposeFunction((PetscObject)svd,"SVDCrossGetEPS_C",SVDCrossGetEPS_Cross);
371:   return(0);
372: }

slepc-3.4.2.dfsg.orig/src/svd/impls/cross/makefile0000644000175000017500000000213512211062077020774 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = cross.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = SVD LOCDIR = src/svd/impls/cross/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/cross/makefile.html0000644000175000017500000000373112211062077021742 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = cross.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = SVD
LOCDIR   = src/svd/impls/cross/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/svd/impls/cross/index.html0000644000175000017500000000204712211062077021273 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

cross.c
makefile
slepc-3.4.2.dfsg.orig/src/svd/impls/cross/ftn-auto/0000755000175000017500000000000012214143515021030 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/cross/ftn-auto/crossf.c0000644000175000017500000000253612211062077022501 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* cross.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcrossseteps_ SVDCROSSSETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcrossseteps_ svdcrossseteps #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcrossgeteps_ SVDCROSSGETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcrossgeteps_ svdcrossgeteps #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdcrossseteps_(SVD *svd,EPS *eps, int *__ierr ){ *__ierr = SVDCrossSetEPS(*svd,*eps); } void PETSC_STDCALL svdcrossgeteps_(SVD *svd,EPS *eps, int *__ierr ){ *__ierr = SVDCrossGetEPS(*svd, (EPS* )PetscToPointer((eps) )); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/impls/cross/ftn-auto/makefile0000644000175000017500000000034212211062077022527 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = crossf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/svd/impls/cross/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/cross/cross.c0000644000175000017500000003076612211062077020604 0ustar gladkgladk/* SLEPc singular value solver: "cross" Method: Uses a Hermitian eigensolver for A^T*A Last update: Jun 2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include /*I "slepceps.h" I*/ typedef struct { EPS eps; PetscBool setfromoptionscalled; Mat mat; Vec w,diag; } SVD_CROSS; #undef __FUNCT__ #define __FUNCT__ "MatMult_Cross" static PetscErrorCode MatMult_Cross(Mat B,Vec x,Vec y) { PetscErrorCode ierr; SVD svd; SVD_CROSS *cross; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&svd);CHKERRQ(ierr); cross = (SVD_CROSS*)svd->data; ierr = SVDMatMult(svd,PETSC_FALSE,x,cross->w);CHKERRQ(ierr); ierr = SVDMatMult(svd,PETSC_TRUE,cross->w,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Cross" static PetscErrorCode MatGetDiagonal_Cross(Mat B,Vec d) { PetscErrorCode ierr; SVD svd; SVD_CROSS *cross; PetscInt N,n,i,j,start,end,ncols; PetscScalar *work1,*work2,*diag; const PetscInt *cols; const PetscScalar *vals; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&svd);CHKERRQ(ierr); cross = (SVD_CROSS*)svd->data; if (!cross->diag) { /* compute diagonal from rows and store in cross->diag */ ierr = VecDuplicate(d,&cross->diag);CHKERRQ(ierr); ierr = SVDMatGetSize(svd,NULL,&N);CHKERRQ(ierr); ierr = SVDMatGetLocalSize(svd,NULL,&n);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*N,&work1);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*N,&work2);CHKERRQ(ierr); for (i=0;iAT) { ierr = MatGetOwnershipRange(svd->AT,&start,&end);CHKERRQ(ierr); for (i=start;iAT,i,&ncols,NULL,&vals);CHKERRQ(ierr); for (j=0;jAT,i,&ncols,NULL,&vals);CHKERRQ(ierr); } } else { ierr = MatGetOwnershipRange(svd->A,&start,&end);CHKERRQ(ierr); for (i=start;iA,i,&ncols,&cols,&vals);CHKERRQ(ierr); for (j=0;jA,i,&ncols,&cols,&vals);CHKERRQ(ierr); } } ierr = MPI_Allreduce(work1,work2,N,MPIU_SCALAR,MPI_SUM,PetscObjectComm((PetscObject)svd));CHKERRQ(ierr); ierr = VecGetOwnershipRange(cross->diag,&start,&end);CHKERRQ(ierr); ierr = VecGetArray(cross->diag,&diag);CHKERRQ(ierr); for (i=start;idiag,&diag);CHKERRQ(ierr); ierr = PetscFree(work1);CHKERRQ(ierr); ierr = PetscFree(work2);CHKERRQ(ierr); } ierr = VecCopy(cross->diag,d);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetUp_Cross" PetscErrorCode SVDSetUp_Cross(SVD svd) { PetscErrorCode ierr; SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscInt n,i; PetscBool trackall; PetscFunctionBegin; if (!cross->mat) { ierr = SVDMatGetLocalSize(svd,NULL,&n);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)svd),n,n,PETSC_DETERMINE,PETSC_DETERMINE,svd,&cross->mat);CHKERRQ(ierr); ierr = MatShellSetOperation(cross->mat,MATOP_MULT,(void(*)(void))MatMult_Cross);CHKERRQ(ierr); ierr = MatShellSetOperation(cross->mat,MATOP_GET_DIAGONAL,(void(*)(void))MatGetDiagonal_Cross);CHKERRQ(ierr); ierr = SVDMatGetVecs(svd,NULL,&cross->w);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cross->mat);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cross->w);CHKERRQ(ierr); } if (!cross->eps) { ierr = SVDCrossGetEPS(svd,&cross->eps);CHKERRQ(ierr); } ierr = EPSSetOperators(cross->eps,cross->mat,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(cross->eps,EPS_HEP);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(cross->eps,svd->which == SVD_LARGEST ? EPS_LARGEST_REAL : EPS_SMALLEST_REAL);CHKERRQ(ierr); ierr = EPSSetDimensions(cross->eps,svd->nsv,svd->ncv,svd->mpd);CHKERRQ(ierr); ierr = EPSSetTolerances(cross->eps,svd->tol,svd->max_it);CHKERRQ(ierr); /* Transfer the trackall option from svd to eps */ ierr = SVDGetTrackAll(svd,&trackall);CHKERRQ(ierr); ierr = EPSSetTrackAll(cross->eps,trackall);CHKERRQ(ierr); if (cross->setfromoptionscalled) { ierr = EPSSetFromOptions(cross->eps);CHKERRQ(ierr); cross->setfromoptionscalled = PETSC_FALSE; } ierr = EPSSetUp(cross->eps);CHKERRQ(ierr); ierr = EPSGetDimensions(cross->eps,NULL,&svd->ncv,&svd->mpd);CHKERRQ(ierr); ierr = EPSGetTolerances(cross->eps,&svd->tol,&svd->max_it);CHKERRQ(ierr); /* Transfer the initial space from svd to eps */ if (svd->nini < 0) { ierr = EPSSetInitialSpace(cross->eps,-svd->nini,svd->IS);CHKERRQ(ierr); for (i=0;i<-svd->nini;i++) { ierr = VecDestroy(&svd->IS[i]);CHKERRQ(ierr); } ierr = PetscFree(svd->IS);CHKERRQ(ierr); svd->nini = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSolve_Cross" PetscErrorCode SVDSolve_Cross(SVD svd) { PetscErrorCode ierr; SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscInt i; PetscScalar sigma; PetscFunctionBegin; ierr = EPSSolve(cross->eps);CHKERRQ(ierr); ierr = EPSGetConverged(cross->eps,&svd->nconv);CHKERRQ(ierr); ierr = EPSGetIterationNumber(cross->eps,&svd->its);CHKERRQ(ierr); ierr = EPSGetConvergedReason(cross->eps,(EPSConvergedReason*)&svd->reason);CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = EPSGetEigenpair(cross->eps,i,&sigma,NULL,svd->V[i],NULL);CHKERRQ(ierr); if (PetscRealPart(sigma)<0.0) SETERRQ(PetscObjectComm((PetscObject)svd),1,"Negative eigenvalue computed by EPS"); svd->sigma[i] = PetscSqrtReal(PetscRealPart(sigma)); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitor_Cross" static PetscErrorCode SVDMonitor_Cross(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx) { PetscInt i; SVD svd = (SVD)ctx; PetscScalar er,ei; PetscErrorCode ierr; PetscFunctionBegin; for (i=0;incv);i++) { er = eigr[i]; ei = eigi[i]; ierr = STBackTransform(eps->st,1,&er,&ei);CHKERRQ(ierr); svd->sigma[i] = PetscSqrtReal(PetscRealPart(er)); svd->errest[i] = errest[i]; } ierr = SVDMonitor(svd,its,nconv,svd->sigma,svd->errest,nest);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetFromOptions_Cross" PetscErrorCode SVDSetFromOptions_Cross(SVD svd) { SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscFunctionBegin; cross->setfromoptionscalled = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCrossSetEPS_Cross" static PetscErrorCode SVDCrossSetEPS_Cross(SVD svd,EPS eps) { PetscErrorCode ierr; SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscFunctionBegin; ierr = PetscObjectReference((PetscObject)eps);CHKERRQ(ierr); ierr = EPSDestroy(&cross->eps);CHKERRQ(ierr); cross->eps = eps; ierr = PetscLogObjectParent(svd,cross->eps);CHKERRQ(ierr); svd->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCrossSetEPS" /*@ SVDCrossSetEPS - Associate an eigensolver object (EPS) to the singular value solver. Collective on SVD Input Parameters: + svd - singular value solver - eps - the eigensolver object Level: advanced .seealso: SVDCrossGetEPS() @*/ PetscErrorCode SVDCrossSetEPS(SVD svd,EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidHeaderSpecific(eps,EPS_CLASSID,2); PetscCheckSameComm(svd,1,eps,2); ierr = PetscTryMethod(svd,"SVDCrossSetEPS_C",(SVD,EPS),(svd,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCrossGetEPS_Cross" static PetscErrorCode SVDCrossGetEPS_Cross(SVD svd,EPS *eps) { SVD_CROSS *cross = (SVD_CROSS*)svd->data; ST st; PetscErrorCode ierr; PetscFunctionBegin; if (!cross->eps) { ierr = EPSCreate(PetscObjectComm((PetscObject)svd),&cross->eps);CHKERRQ(ierr); ierr = EPSSetOptionsPrefix(cross->eps,((PetscObject)svd)->prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(cross->eps,"svd_");CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)cross->eps,(PetscObject)svd,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cross->eps);CHKERRQ(ierr); if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = EPSSetIP(cross->eps,svd->ip);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(cross->eps,EPS_LARGEST_REAL);CHKERRQ(ierr); ierr = EPSMonitorSet(cross->eps,SVDMonitor_Cross,svd,NULL);CHKERRQ(ierr); ierr = EPSGetST(cross->eps,&st);CHKERRQ(ierr); ierr = STSetMatMode(st,ST_MATMODE_SHELL);CHKERRQ(ierr); } *eps = cross->eps; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCrossGetEPS" /*@ SVDCrossGetEPS - Retrieve the eigensolver object (EPS) associated to the singular value solver. Not Collective Input Parameter: . svd - singular value solver Output Parameter: . eps - the eigensolver object Level: advanced .seealso: SVDCrossSetEPS() @*/ PetscErrorCode SVDCrossGetEPS(SVD svd,EPS *eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(eps,2); ierr = PetscTryMethod(svd,"SVDCrossGetEPS_C",(SVD,EPS*),(svd,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDView_Cross" PetscErrorCode SVDView_Cross(SVD svd,PetscViewer viewer) { PetscErrorCode ierr; SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscFunctionBegin; if (!cross->eps) { ierr = SVDCrossGetEPS(svd,&cross->eps);CHKERRQ(ierr); } ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = EPSView(cross->eps,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDReset_Cross" PetscErrorCode SVDReset_Cross(SVD svd) { PetscErrorCode ierr; SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscFunctionBegin; if (cross->eps) { ierr = EPSReset(cross->eps);CHKERRQ(ierr); } ierr = MatDestroy(&cross->mat);CHKERRQ(ierr); ierr = VecDestroy(&cross->w);CHKERRQ(ierr); ierr = VecDestroy(&cross->diag);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDDestroy_Cross" PetscErrorCode SVDDestroy_Cross(SVD svd) { PetscErrorCode ierr; SVD_CROSS *cross = (SVD_CROSS*)svd->data; PetscFunctionBegin; ierr = EPSDestroy(&cross->eps);CHKERRQ(ierr); ierr = PetscFree(svd->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCrossSetEPS_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCrossGetEPS_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCreate_Cross" PETSC_EXTERN PetscErrorCode SVDCreate_Cross(SVD svd) { PetscErrorCode ierr; SVD_CROSS *cross; PetscFunctionBegin; ierr = PetscNewLog(svd,SVD_CROSS,&cross);CHKERRQ(ierr); svd->data = (void*)cross; svd->ops->solve = SVDSolve_Cross; svd->ops->setup = SVDSetUp_Cross; svd->ops->setfromoptions = SVDSetFromOptions_Cross; svd->ops->destroy = SVDDestroy_Cross; svd->ops->reset = SVDReset_Cross; svd->ops->view = SVDView_Cross; ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCrossSetEPS_C",SVDCrossSetEPS_Cross);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCrossGetEPS_C",SVDCrossGetEPS_Cross);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/0000755000175000017500000000000012214143515017410 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/cyclic.c0000644000175000017500000004732112211062077021031 0ustar gladkgladk/* SLEPc singular value solver: "cyclic" Method: Uses a Hermitian eigensolver for H(A) = [ 0 A ; A^T 0 ] Last update: Jun 2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include /*I "slepceps.h" I*/ typedef struct { PetscBool explicitmatrix; EPS eps; PetscBool setfromoptionscalled; Mat mat; Vec x1,x2,y1,y2; } SVD_CYCLIC; #undef __FUNCT__ #define __FUNCT__ "MatMult_Cyclic" static PetscErrorCode MatMult_Cyclic(Mat B,Vec x,Vec y) { PetscErrorCode ierr; SVD svd; SVD_CYCLIC *cyclic; const PetscScalar *px; PetscScalar *py; PetscInt m; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&svd);CHKERRQ(ierr); cyclic = (SVD_CYCLIC*)svd->data; ierr = SVDMatGetLocalSize(svd,&m,NULL);CHKERRQ(ierr); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecGetArray(y,&py);CHKERRQ(ierr); ierr = VecPlaceArray(cyclic->x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(cyclic->x2,px+m);CHKERRQ(ierr); ierr = VecPlaceArray(cyclic->y1,py);CHKERRQ(ierr); ierr = VecPlaceArray(cyclic->y2,py+m);CHKERRQ(ierr); ierr = SVDMatMult(svd,PETSC_FALSE,cyclic->x2,cyclic->y1);CHKERRQ(ierr); ierr = SVDMatMult(svd,PETSC_TRUE,cyclic->x1,cyclic->y2);CHKERRQ(ierr); ierr = VecResetArray(cyclic->x1);CHKERRQ(ierr); ierr = VecResetArray(cyclic->x2);CHKERRQ(ierr); ierr = VecResetArray(cyclic->y1);CHKERRQ(ierr); ierr = VecResetArray(cyclic->y2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); ierr = VecRestoreArray(y,&py);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Cyclic" static PetscErrorCode MatGetDiagonal_Cyclic(Mat B,Vec diag) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecSet(diag,0.0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetUp_Cyclic" PetscErrorCode SVDSetUp_Cyclic(SVD svd) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscInt M,N,m,n,i,isl; const PetscScalar *isa; PetscScalar *va; PetscBool trackall; Vec v; Mat Zm,Zn; PetscFunctionBegin; ierr = SVDMatGetSize(svd,&M,&N);CHKERRQ(ierr); ierr = SVDMatGetLocalSize(svd,&m,&n);CHKERRQ(ierr); if (!cyclic->mat) { if (cyclic->explicitmatrix) { if (!svd->AT) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_SUP,"Cannot use explicit cyclic matrix with implicit transpose"); ierr = MatCreate(PetscObjectComm((PetscObject)svd),&Zm);CHKERRQ(ierr); ierr = MatSetSizes(Zm,m,m,M,M);CHKERRQ(ierr); ierr = MatSetFromOptions(Zm);CHKERRQ(ierr); ierr = MatSetUp(Zm);CHKERRQ(ierr); ierr = MatAssemblyBegin(Zm,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Zm,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatCreate(PetscObjectComm((PetscObject)svd),&Zn);CHKERRQ(ierr); ierr = MatSetSizes(Zn,n,n,N,N);CHKERRQ(ierr); ierr = MatSetFromOptions(Zn);CHKERRQ(ierr); ierr = MatSetUp(Zn);CHKERRQ(ierr); ierr = MatAssemblyBegin(Zn,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(Zn,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = SlepcMatTile(0.0,Zm,1.0,svd->A,1.0,svd->AT,0.0,Zn,&cyclic->mat);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cyclic->mat);CHKERRQ(ierr); ierr = MatDestroy(&Zm);CHKERRQ(ierr); ierr = MatDestroy(&Zn);CHKERRQ(ierr); } else { ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,m,M,NULL,&cyclic->x1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,n,N,NULL,&cyclic->x2);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,m,M,NULL,&cyclic->y1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,n,N,NULL,&cyclic->y2);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cyclic->x1);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cyclic->x2);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cyclic->y1);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cyclic->y2);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)svd),m+n,m+n,M+N,M+N,svd,&cyclic->mat);CHKERRQ(ierr); ierr = MatShellSetOperation(cyclic->mat,MATOP_MULT,(void(*)(void))MatMult_Cyclic);CHKERRQ(ierr); ierr = MatShellSetOperation(cyclic->mat,MATOP_GET_DIAGONAL,(void(*)(void))MatGetDiagonal_Cyclic);CHKERRQ(ierr); } ierr = PetscLogObjectParent(svd,cyclic->mat);CHKERRQ(ierr); } if (!cyclic->eps) { ierr = SVDCyclicGetEPS(svd,&cyclic->eps);CHKERRQ(ierr); } ierr = EPSSetOperators(cyclic->eps,cyclic->mat,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(cyclic->eps,EPS_HEP);CHKERRQ(ierr); if (svd->which == SVD_LARGEST) { ierr = EPSSetWhichEigenpairs(cyclic->eps,EPS_LARGEST_REAL);CHKERRQ(ierr); } else { ierr = EPSSetEigenvalueComparison(cyclic->eps,SlepcCompareSmallestPosReal,NULL);CHKERRQ(ierr); ierr = EPSSetTarget(cyclic->eps,0.0);CHKERRQ(ierr); } ierr = EPSSetDimensions(cyclic->eps,svd->nsv,svd->ncv,svd->mpd);CHKERRQ(ierr); ierr = EPSSetTolerances(cyclic->eps,svd->tol,svd->max_it);CHKERRQ(ierr); /* Transfer the trackall option from svd to eps */ ierr = SVDGetTrackAll(svd,&trackall);CHKERRQ(ierr); ierr = EPSSetTrackAll(cyclic->eps,trackall);CHKERRQ(ierr); /* Transfer the initial subspace from svd to eps */ if (svd->nini<0 || svd->ninil<0) { for (i=0;i<-PetscMin(svd->nini,svd->ninil);i++) { ierr = MatGetVecs(cyclic->mat,&v,NULL);CHKERRQ(ierr); ierr = VecGetArray(v,&va);CHKERRQ(ierr); if (i<-svd->ninil) { ierr = VecGetSize(svd->ISL[i],&isl);CHKERRQ(ierr); if (isl!=m) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_SUP,"Size mismatch for left initial vector"); ierr = VecGetArrayRead(svd->ISL[i],&isa);CHKERRQ(ierr); ierr = PetscMemcpy(va,isa,sizeof(PetscScalar)*m);CHKERRQ(ierr); ierr = VecRestoreArrayRead(svd->IS[i],&isa);CHKERRQ(ierr); } else { ierr = PetscMemzero(&va,sizeof(PetscScalar)*m);CHKERRQ(ierr); } if (i<-svd->nini) { ierr = VecGetSize(svd->IS[i],&isl);CHKERRQ(ierr); if (isl!=n) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_SUP,"Size mismatch for right initial vector"); ierr = VecGetArrayRead(svd->IS[i],&isa);CHKERRQ(ierr); ierr = PetscMemcpy(va+m,isa,sizeof(PetscScalar)*n);CHKERRQ(ierr); ierr = VecRestoreArrayRead(svd->IS[i],&isa);CHKERRQ(ierr); } else { ierr = PetscMemzero(va+m,sizeof(PetscScalar)*n);CHKERRQ(ierr); } ierr = VecRestoreArray(v,&va);CHKERRQ(ierr); ierr = VecDestroy(&svd->IS[i]);CHKERRQ(ierr); svd->IS[i] = v; } svd->nini = PetscMin(svd->nini,svd->ninil); ierr = EPSSetInitialSpace(cyclic->eps,-svd->nini,svd->IS);CHKERRQ(ierr); ierr = SlepcBasisDestroy_Private(&svd->nini,&svd->IS);CHKERRQ(ierr); ierr = SlepcBasisDestroy_Private(&svd->ninil,&svd->ISL);CHKERRQ(ierr); } if (cyclic->setfromoptionscalled) { ierr = EPSSetFromOptions(cyclic->eps);CHKERRQ(ierr); cyclic->setfromoptionscalled = PETSC_FALSE; } ierr = EPSSetUp(cyclic->eps);CHKERRQ(ierr); ierr = EPSGetDimensions(cyclic->eps,NULL,&svd->ncv,&svd->mpd);CHKERRQ(ierr); svd->ncv = PetscMin(svd->ncv,PetscMin(M,N)); ierr = EPSGetTolerances(cyclic->eps,&svd->tol,&svd->max_it);CHKERRQ(ierr); if (svd->ncv != svd->n) { ierr = VecDestroyVecs(svd->n,&svd->U);CHKERRQ(ierr); ierr = VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);CHKERRQ(ierr); ierr = PetscLogObjectParents(svd,svd->ncv,svd->U);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSolve_Cyclic" PetscErrorCode SVDSolve_Cyclic(SVD svd) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscInt i,j,M,N,m,n; PetscScalar sigma; const PetscScalar *px; Vec x,x1,x2; PetscFunctionBegin; ierr = EPSSolve(cyclic->eps);CHKERRQ(ierr); ierr = EPSGetConverged(cyclic->eps,&svd->nconv);CHKERRQ(ierr); ierr = EPSGetIterationNumber(cyclic->eps,&svd->its);CHKERRQ(ierr); ierr = EPSGetConvergedReason(cyclic->eps,(EPSConvergedReason*)&svd->reason);CHKERRQ(ierr); ierr = MatGetVecs(cyclic->mat,&x,NULL);CHKERRQ(ierr); ierr = SVDMatGetSize(svd,&M,&N);CHKERRQ(ierr); ierr = SVDMatGetLocalSize(svd,&m,&n);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,m,M,NULL,&x1);CHKERRQ(ierr); ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,n,N,NULL,&x2);CHKERRQ(ierr); for (i=0,j=0;inconv;i++) { ierr = EPSGetEigenpair(cyclic->eps,i,&sigma,NULL,x,NULL);CHKERRQ(ierr); if (PetscRealPart(sigma) > 0.0) { svd->sigma[j] = PetscRealPart(sigma); ierr = VecGetArrayRead(x,&px);CHKERRQ(ierr); ierr = VecPlaceArray(x1,px);CHKERRQ(ierr); ierr = VecPlaceArray(x2,px+m);CHKERRQ(ierr); ierr = VecCopy(x1,svd->U[j]);CHKERRQ(ierr); ierr = VecScale(svd->U[j],1.0/PetscSqrtReal(2.0));CHKERRQ(ierr); ierr = VecCopy(x2,svd->V[j]);CHKERRQ(ierr); ierr = VecScale(svd->V[j],1.0/PetscSqrtReal(2.0));CHKERRQ(ierr); ierr = VecResetArray(x1);CHKERRQ(ierr); ierr = VecResetArray(x2);CHKERRQ(ierr); ierr = VecRestoreArrayRead(x,&px);CHKERRQ(ierr); j++; } } svd->nconv = j; ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&x1);CHKERRQ(ierr); ierr = VecDestroy(&x2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitor_Cyclic" static PetscErrorCode SVDMonitor_Cyclic(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx) { PetscInt i,j; SVD svd = (SVD)ctx; PetscScalar er,ei; PetscErrorCode ierr; PetscFunctionBegin; nconv = 0; for (i=0,j=0;incv);i++) { er = eigr[i]; ei = eigi[i]; ierr = STBackTransform(eps->st,1,&er,&ei);CHKERRQ(ierr); if (PetscRealPart(er) > 0.0) { svd->sigma[j] = PetscRealPart(er); svd->errest[j] = errest[i]; if (errest[i] < svd->tol) nconv++; j++; } } nest = j; ierr = SVDMonitor(svd,its,nconv,svd->sigma,svd->errest,nest);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetFromOptions_Cyclic" PetscErrorCode SVDSetFromOptions_Cyclic(SVD svd) { PetscErrorCode ierr; PetscBool set,val; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; ST st; PetscFunctionBegin; cyclic->setfromoptionscalled = PETSC_TRUE; ierr = PetscOptionsHead("SVD Cyclic Options");CHKERRQ(ierr); ierr = PetscOptionsBool("-svd_cyclic_explicitmatrix","Use cyclic explicit matrix","SVDCyclicSetExplicitMatrix",cyclic->explicitmatrix,&val,&set);CHKERRQ(ierr); if (set) { ierr = SVDCyclicSetExplicitMatrix(svd,val);CHKERRQ(ierr); } if (!cyclic->explicitmatrix) { /* use as default an ST with shell matrix and Jacobi */ if (!cyclic->eps) { ierr = SVDCyclicGetEPS(svd,&cyclic->eps);CHKERRQ(ierr); } ierr = EPSGetST(cyclic->eps,&st);CHKERRQ(ierr); ierr = STSetMatMode(st,ST_MATMODE_SHELL);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicSetExplicitMatrix_Cyclic" static PetscErrorCode SVDCyclicSetExplicitMatrix_Cyclic(SVD svd,PetscBool explicitmatrix) { SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; cyclic->explicitmatrix = explicitmatrix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicSetExplicitMatrix" /*@ SVDCyclicSetExplicitMatrix - Indicate if the eigensolver operator H(A) = [ 0 A ; A^T 0 ] must be computed explicitly. Logically Collective on SVD Input Parameters: + svd - singular value solver - explicit - boolean flag indicating if H(A) is built explicitly Options Database Key: . -svd_cyclic_explicitmatrix - Indicates the boolean flag Level: advanced .seealso: SVDCyclicGetExplicitMatrix() @*/ PetscErrorCode SVDCyclicSetExplicitMatrix(SVD svd,PetscBool explicitmatrix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveBool(svd,explicitmatrix,2); ierr = PetscTryMethod(svd,"SVDCyclicSetExplicitMatrix_C",(SVD,PetscBool),(svd,explicitmatrix));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicGetExplicitMatrix_Cyclic" static PetscErrorCode SVDCyclicGetExplicitMatrix_Cyclic(SVD svd,PetscBool *explicitmatrix) { SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; *explicitmatrix = cyclic->explicitmatrix; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicGetExplicitMatrix" /*@ SVDCyclicGetExplicitMatrix - Returns the flag indicating if H(A) is built explicitly Not Collective Input Parameter: . svd - singular value solver Output Parameter: . explicit - the mode flag Level: advanced .seealso: SVDCyclicSetExplicitMatrix() @*/ PetscErrorCode SVDCyclicGetExplicitMatrix(SVD svd,PetscBool *explicitmatrix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(explicitmatrix,2); ierr = PetscTryMethod(svd,"SVDCyclicGetExplicitMatrix_C",(SVD,PetscBool*),(svd,explicitmatrix));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicSetEPS_Cyclic" static PetscErrorCode SVDCyclicSetEPS_Cyclic(SVD svd,EPS eps) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; ierr = PetscObjectReference((PetscObject)eps);CHKERRQ(ierr); ierr = EPSDestroy(&cyclic->eps);CHKERRQ(ierr); cyclic->eps = eps; ierr = PetscLogObjectParent(svd,cyclic->eps);CHKERRQ(ierr); svd->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicSetEPS" /*@ SVDCyclicSetEPS - Associate an eigensolver object (EPS) to the singular value solver. Collective on SVD Input Parameters: + svd - singular value solver - eps - the eigensolver object Level: advanced .seealso: SVDCyclicGetEPS() @*/ PetscErrorCode SVDCyclicSetEPS(SVD svd,EPS eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidHeaderSpecific(eps,EPS_CLASSID,2); PetscCheckSameComm(svd,1,eps,2); ierr = PetscTryMethod(svd,"SVDCyclicSetEPS_C",(SVD,EPS),(svd,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicGetEPS_Cyclic" static PetscErrorCode SVDCyclicGetEPS_Cyclic(SVD svd,EPS *eps) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; if (!cyclic->eps) { ierr = EPSCreate(PetscObjectComm((PetscObject)svd),&cyclic->eps);CHKERRQ(ierr); ierr = EPSSetOptionsPrefix(cyclic->eps,((PetscObject)svd)->prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(cyclic->eps,"svd_");CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)cyclic->eps,(PetscObject)svd,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,cyclic->eps);CHKERRQ(ierr); if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = EPSSetIP(cyclic->eps,svd->ip);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(cyclic->eps,EPS_LARGEST_REAL);CHKERRQ(ierr); ierr = EPSMonitorSet(cyclic->eps,SVDMonitor_Cyclic,svd,NULL);CHKERRQ(ierr); } *eps = cyclic->eps; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCyclicGetEPS" /*@ SVDCyclicGetEPS - Retrieve the eigensolver object (EPS) associated to the singular value solver. Not Collective Input Parameter: . svd - singular value solver Output Parameter: . eps - the eigensolver object Level: advanced .seealso: SVDCyclicSetEPS() @*/ PetscErrorCode SVDCyclicGetEPS(SVD svd,EPS *eps) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(eps,2); ierr = PetscTryMethod(svd,"SVDCyclicGetEPS_C",(SVD,EPS*),(svd,eps));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDView_Cyclic" PetscErrorCode SVDView_Cyclic(SVD svd,PetscViewer viewer) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; if (!cyclic->eps) { ierr = SVDCyclicGetEPS(svd,&cyclic->eps);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," Cyclic: %s matrix\n",cyclic->explicitmatrix?"explicit":"implicit");CHKERRQ(ierr); ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = EPSView(cyclic->eps,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDReset_Cyclic" PetscErrorCode SVDReset_Cyclic(SVD svd) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; if (!cyclic->eps) { ierr = EPSReset(cyclic->eps);CHKERRQ(ierr); } ierr = MatDestroy(&cyclic->mat);CHKERRQ(ierr); ierr = VecDestroy(&cyclic->x1);CHKERRQ(ierr); ierr = VecDestroy(&cyclic->x2);CHKERRQ(ierr); ierr = VecDestroy(&cyclic->y1);CHKERRQ(ierr); ierr = VecDestroy(&cyclic->y2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDDestroy_Cyclic" PetscErrorCode SVDDestroy_Cyclic(SVD svd) { PetscErrorCode ierr; SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data; PetscFunctionBegin; ierr = EPSDestroy(&cyclic->eps);CHKERRQ(ierr); ierr = PetscFree(svd->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetEPS_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetEPS_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetExplicitMatrix_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetExplicitMatrix_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCreate_Cyclic" PETSC_EXTERN PetscErrorCode SVDCreate_Cyclic(SVD svd) { PetscErrorCode ierr; SVD_CYCLIC *cyclic; PetscFunctionBegin; ierr = PetscNewLog(svd,SVD_CYCLIC,&cyclic);CHKERRQ(ierr); svd->data = (void*)cyclic; svd->ops->solve = SVDSolve_Cyclic; svd->ops->setup = SVDSetUp_Cyclic; svd->ops->setfromoptions = SVDSetFromOptions_Cyclic; svd->ops->destroy = SVDDestroy_Cyclic; svd->ops->reset = SVDReset_Cyclic; svd->ops->view = SVDView_Cyclic; ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetEPS_C",SVDCyclicSetEPS_Cyclic);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetEPS_C",SVDCyclicGetEPS_Cyclic);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetExplicitMatrix_C",SVDCyclicSetExplicitMatrix_Cyclic);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetExplicitMatrix_C",SVDCyclicGetExplicitMatrix_Cyclic);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/makefile0000644000175000017500000000213712211062077021113 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = cyclic.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = SVD LOCDIR = src/svd/impls/cyclic/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/makefile.html0000644000175000017500000000373312211062077022061 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = cyclic.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = SVD
LOCDIR   = src/svd/impls/cyclic/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/cyclic.c.html0000644000175000017500000011407612211062077021776 0ustar gladkgladk
Actual source code: cyclic.c

  1: /*

  3:    SLEPc singular value solver: "cyclic"

  5:    Method: Uses a Hermitian eigensolver for H(A) = [ 0  A ; A^T 0 ]

  7:    Last update: Jun 2007

  9:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 10:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 11:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 13:    This file is part of SLEPc.

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

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

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

 29: #include <slepc-private/svdimpl.h>                /*I "slepcsvd.h" I*/
 30: #include <slepc-private/epsimpl.h>                /*I "slepceps.h" I*/

 32: typedef struct {
 33:   PetscBool explicitmatrix;
 34:   EPS       eps;
 35:   PetscBool setfromoptionscalled;
 36:   Mat       mat;
 37:   Vec       x1,x2,y1,y2;
 38: } SVD_CYCLIC;

 42: static PetscErrorCode MatMult_Cyclic(Mat B,Vec x,Vec y)
 43: {
 44:   PetscErrorCode    ierr;
 45:   SVD               svd;
 46:   SVD_CYCLIC        *cyclic;
 47:   const PetscScalar *px;
 48:   PetscScalar       *py;
 49:   PetscInt          m;

 52:   MatShellGetContext(B,(void**)&svd);
 53:   cyclic = (SVD_CYCLIC*)svd->data;
 54:   SVDMatGetLocalSize(svd,&m,NULL);
 55:   VecGetArrayRead(x,&px);
 56:   VecGetArray(y,&py);
 57:   VecPlaceArray(cyclic->x1,px);
 58:   VecPlaceArray(cyclic->x2,px+m);
 59:   VecPlaceArray(cyclic->y1,py);
 60:   VecPlaceArray(cyclic->y2,py+m);
 61:   SVDMatMult(svd,PETSC_FALSE,cyclic->x2,cyclic->y1);
 62:   SVDMatMult(svd,PETSC_TRUE,cyclic->x1,cyclic->y2);
 63:   VecResetArray(cyclic->x1);
 64:   VecResetArray(cyclic->x2);
 65:   VecResetArray(cyclic->y1);
 66:   VecResetArray(cyclic->y2);
 67:   VecRestoreArrayRead(x,&px);
 68:   VecRestoreArray(y,&py);
 69:   return(0);
 70: }

 74: static PetscErrorCode MatGetDiagonal_Cyclic(Mat B,Vec diag)
 75: {

 79:   VecSet(diag,0.0);
 80:   return(0);
 81: }

 85: PetscErrorCode SVDSetUp_Cyclic(SVD svd)
 86: {
 87:   PetscErrorCode    ierr;
 88:   SVD_CYCLIC        *cyclic = (SVD_CYCLIC*)svd->data;
 89:   PetscInt          M,N,m,n,i,isl;
 90:   const PetscScalar *isa;
 91:   PetscScalar       *va;
 92:   PetscBool         trackall;
 93:   Vec               v;
 94:   Mat               Zm,Zn;

 97:   SVDMatGetSize(svd,&M,&N);
 98:   SVDMatGetLocalSize(svd,&m,&n);
 99:   if (!cyclic->mat) {
100:     if (cyclic->explicitmatrix) {
101:       if (!svd->AT) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_SUP,"Cannot use explicit cyclic matrix with implicit transpose");
102:       MatCreate(PetscObjectComm((PetscObject)svd),&Zm);
103:       MatSetSizes(Zm,m,m,M,M);
104:       MatSetFromOptions(Zm);
105:       MatSetUp(Zm);
106:       MatAssemblyBegin(Zm,MAT_FINAL_ASSEMBLY);
107:       MatAssemblyEnd(Zm,MAT_FINAL_ASSEMBLY);
108:       MatCreate(PetscObjectComm((PetscObject)svd),&Zn);
109:       MatSetSizes(Zn,n,n,N,N);
110:       MatSetFromOptions(Zn);
111:       MatSetUp(Zn);
112:       MatAssemblyBegin(Zn,MAT_FINAL_ASSEMBLY);
113:       MatAssemblyEnd(Zn,MAT_FINAL_ASSEMBLY);
114:       SlepcMatTile(0.0,Zm,1.0,svd->A,1.0,svd->AT,0.0,Zn,&cyclic->mat);
115:       PetscLogObjectParent(svd,cyclic->mat);
116:       MatDestroy(&Zm);
117:       MatDestroy(&Zn);
118:     } else {
119:       VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,m,M,NULL,&cyclic->x1);
120:       VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,n,N,NULL,&cyclic->x2);
121:       VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,m,M,NULL,&cyclic->y1);
122:       VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,n,N,NULL,&cyclic->y2);
123:       PetscLogObjectParent(svd,cyclic->x1);
124:       PetscLogObjectParent(svd,cyclic->x2);
125:       PetscLogObjectParent(svd,cyclic->y1);
126:       PetscLogObjectParent(svd,cyclic->y2);
127:       MatCreateShell(PetscObjectComm((PetscObject)svd),m+n,m+n,M+N,M+N,svd,&cyclic->mat);
128:       MatShellSetOperation(cyclic->mat,MATOP_MULT,(void(*)(void))MatMult_Cyclic);
129:       MatShellSetOperation(cyclic->mat,MATOP_GET_DIAGONAL,(void(*)(void))MatGetDiagonal_Cyclic);
130:     }
131:     PetscLogObjectParent(svd,cyclic->mat);
132:   }

134:   if (!cyclic->eps) { SVDCyclicGetEPS(svd,&cyclic->eps); }
135:   EPSSetOperators(cyclic->eps,cyclic->mat,NULL);
136:   EPSSetProblemType(cyclic->eps,EPS_HEP);
137:   if (svd->which == SVD_LARGEST) {
138:     EPSSetWhichEigenpairs(cyclic->eps,EPS_LARGEST_REAL);
139:   } else {
140:     EPSSetEigenvalueComparison(cyclic->eps,SlepcCompareSmallestPosReal,NULL);
141:     EPSSetTarget(cyclic->eps,0.0);
142:   }
143:   EPSSetDimensions(cyclic->eps,svd->nsv,svd->ncv,svd->mpd);
144:   EPSSetTolerances(cyclic->eps,svd->tol,svd->max_it);
145:   /* Transfer the trackall option from svd to eps */
146:   SVDGetTrackAll(svd,&trackall);
147:   EPSSetTrackAll(cyclic->eps,trackall);
148:   /* Transfer the initial subspace from svd to eps */
149:   if (svd->nini<0 || svd->ninil<0) {
150:     for (i=0;i<-PetscMin(svd->nini,svd->ninil);i++) {
151:       MatGetVecs(cyclic->mat,&v,NULL);
152:       VecGetArray(v,&va);
153:       if (i<-svd->ninil) {
154:         VecGetSize(svd->ISL[i],&isl);
155:         if (isl!=m) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_SUP,"Size mismatch for left initial vector");
156:         VecGetArrayRead(svd->ISL[i],&isa);
157:         PetscMemcpy(va,isa,sizeof(PetscScalar)*m);
158:         VecRestoreArrayRead(svd->IS[i],&isa);
159:       } else {
160:         PetscMemzero(&va,sizeof(PetscScalar)*m);
161:       }
162:       if (i<-svd->nini) {
163:         VecGetSize(svd->IS[i],&isl);
164:         if (isl!=n) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_SUP,"Size mismatch for right initial vector");
165:         VecGetArrayRead(svd->IS[i],&isa);
166:         PetscMemcpy(va+m,isa,sizeof(PetscScalar)*n);
167:         VecRestoreArrayRead(svd->IS[i],&isa);
168:       } else {
169:         PetscMemzero(va+m,sizeof(PetscScalar)*n);
170:       }
171:       VecRestoreArray(v,&va);
172:       VecDestroy(&svd->IS[i]);
173:       svd->IS[i] = v;
174:     }
175:     svd->nini = PetscMin(svd->nini,svd->ninil);
176:     EPSSetInitialSpace(cyclic->eps,-svd->nini,svd->IS);
177:     SlepcBasisDestroy_Private(&svd->nini,&svd->IS);
178:     SlepcBasisDestroy_Private(&svd->ninil,&svd->ISL);
179:   }
180:   if (cyclic->setfromoptionscalled) {
181:     EPSSetFromOptions(cyclic->eps);
182:     cyclic->setfromoptionscalled = PETSC_FALSE;
183:   }
184:   EPSSetUp(cyclic->eps);
185:   EPSGetDimensions(cyclic->eps,NULL,&svd->ncv,&svd->mpd);
186:   svd->ncv = PetscMin(svd->ncv,PetscMin(M,N));
187:   EPSGetTolerances(cyclic->eps,&svd->tol,&svd->max_it);

189:   if (svd->ncv != svd->n) {
190:     VecDestroyVecs(svd->n,&svd->U);
191:     VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);
192:     PetscLogObjectParents(svd,svd->ncv,svd->U);
193:   }
194:   return(0);
195: }

199: PetscErrorCode SVDSolve_Cyclic(SVD svd)
200: {
201:   PetscErrorCode    ierr;
202:   SVD_CYCLIC        *cyclic = (SVD_CYCLIC*)svd->data;
203:   PetscInt          i,j,M,N,m,n;
204:   PetscScalar       sigma;
205:   const PetscScalar *px;
206:   Vec               x,x1,x2;

209:   EPSSolve(cyclic->eps);
210:   EPSGetConverged(cyclic->eps,&svd->nconv);
211:   EPSGetIterationNumber(cyclic->eps,&svd->its);
212:   EPSGetConvergedReason(cyclic->eps,(EPSConvergedReason*)&svd->reason);

214:   MatGetVecs(cyclic->mat,&x,NULL);
215:   SVDMatGetSize(svd,&M,&N);
216:   SVDMatGetLocalSize(svd,&m,&n);
217:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,m,M,NULL,&x1);
218:   VecCreateMPIWithArray(PetscObjectComm((PetscObject)svd),1,n,N,NULL,&x2);
219:   for (i=0,j=0;i<svd->nconv;i++) {
220:     EPSGetEigenpair(cyclic->eps,i,&sigma,NULL,x,NULL);
221:     if (PetscRealPart(sigma) > 0.0) {
222:       svd->sigma[j] = PetscRealPart(sigma);
223:       VecGetArrayRead(x,&px);
224:       VecPlaceArray(x1,px);
225:       VecPlaceArray(x2,px+m);
226:       VecCopy(x1,svd->U[j]);
227:       VecScale(svd->U[j],1.0/PetscSqrtReal(2.0));
228:       VecCopy(x2,svd->V[j]);
229:       VecScale(svd->V[j],1.0/PetscSqrtReal(2.0));
230:       VecResetArray(x1);
231:       VecResetArray(x2);
232:       VecRestoreArrayRead(x,&px);
233:       j++;
234:     }
235:   }
236:   svd->nconv = j;

238:   VecDestroy(&x);
239:   VecDestroy(&x1);
240:   VecDestroy(&x2);
241:   return(0);
242: }

246: static PetscErrorCode SVDMonitor_Cyclic(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)
247: {
248:   PetscInt       i,j;
249:   SVD            svd = (SVD)ctx;
250:   PetscScalar    er,ei;

254:   nconv = 0;
255:   for (i=0,j=0;i<PetscMin(nest,svd->ncv);i++) {
256:     er = eigr[i]; ei = eigi[i];
257:     STBackTransform(eps->st,1,&er,&ei);
258:     if (PetscRealPart(er) > 0.0) {
259:       svd->sigma[j] = PetscRealPart(er);
260:       svd->errest[j] = errest[i];
261:       if (errest[i] < svd->tol) nconv++;
262:       j++;
263:     }
264:   }
265:   nest = j;
266:   SVDMonitor(svd,its,nconv,svd->sigma,svd->errest,nest);
267:   return(0);
268: }

272: PetscErrorCode SVDSetFromOptions_Cyclic(SVD svd)
273: {
275:   PetscBool      set,val;
276:   SVD_CYCLIC     *cyclic = (SVD_CYCLIC*)svd->data;
277:   ST             st;

280:   cyclic->setfromoptionscalled = PETSC_TRUE;
281:   PetscOptionsHead("SVD Cyclic Options");
282:   PetscOptionsBool("-svd_cyclic_explicitmatrix","Use cyclic explicit matrix","SVDCyclicSetExplicitMatrix",cyclic->explicitmatrix,&val,&set);
283:   if (set) {
284:     SVDCyclicSetExplicitMatrix(svd,val);
285:   }
286:   if (!cyclic->explicitmatrix) {
287:     /* use as default an ST with shell matrix and Jacobi */
288:     if (!cyclic->eps) { SVDCyclicGetEPS(svd,&cyclic->eps); }
289:     EPSGetST(cyclic->eps,&st);
290:     STSetMatMode(st,ST_MATMODE_SHELL);
291:   }
292:   PetscOptionsTail();
293:   return(0);
294: }

298: static PetscErrorCode SVDCyclicSetExplicitMatrix_Cyclic(SVD svd,PetscBool explicitmatrix)
299: {
300:   SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data;

303:   cyclic->explicitmatrix = explicitmatrix;
304:   return(0);
305: }

309: /*@
310:    SVDCyclicSetExplicitMatrix - Indicate if the eigensolver operator
311:    H(A) = [ 0  A ; A^T 0 ] must be computed explicitly.

313:    Logically Collective on SVD

315:    Input Parameters:
316: +  svd      - singular value solver
317: -  explicit - boolean flag indicating if H(A) is built explicitly

319:    Options Database Key:
320: .  -svd_cyclic_explicitmatrix <boolean> - Indicates the boolean flag

322:    Level: advanced

324: .seealso: SVDCyclicGetExplicitMatrix()
325: @*/
326: PetscErrorCode SVDCyclicSetExplicitMatrix(SVD svd,PetscBool explicitmatrix)
327: {

333:   PetscTryMethod(svd,"SVDCyclicSetExplicitMatrix_C",(SVD,PetscBool),(svd,explicitmatrix));
334:   return(0);
335: }

339: static PetscErrorCode SVDCyclicGetExplicitMatrix_Cyclic(SVD svd,PetscBool *explicitmatrix)
340: {
341:   SVD_CYCLIC *cyclic = (SVD_CYCLIC*)svd->data;

344:   *explicitmatrix = cyclic->explicitmatrix;
345:   return(0);
346: }

350: /*@
351:    SVDCyclicGetExplicitMatrix - Returns the flag indicating if H(A) is built explicitly

353:    Not Collective

355:    Input Parameter:
356: .  svd  - singular value solver

358:    Output Parameter:
359: .  explicit - the mode flag

361:    Level: advanced

363: .seealso: SVDCyclicSetExplicitMatrix()
364: @*/
365: PetscErrorCode SVDCyclicGetExplicitMatrix(SVD svd,PetscBool *explicitmatrix)
366: {

372:   PetscTryMethod(svd,"SVDCyclicGetExplicitMatrix_C",(SVD,PetscBool*),(svd,explicitmatrix));
373:   return(0);
374: }

378: static PetscErrorCode SVDCyclicSetEPS_Cyclic(SVD svd,EPS eps)
379: {
380:   PetscErrorCode  ierr;
381:   SVD_CYCLIC      *cyclic = (SVD_CYCLIC*)svd->data;

384:   PetscObjectReference((PetscObject)eps);
385:   EPSDestroy(&cyclic->eps);
386:   cyclic->eps = eps;
387:   PetscLogObjectParent(svd,cyclic->eps);
388:   svd->setupcalled = 0;
389:   return(0);
390: }

394: /*@
395:    SVDCyclicSetEPS - Associate an eigensolver object (EPS) to the
396:    singular value solver.

398:    Collective on SVD

400:    Input Parameters:
401: +  svd - singular value solver
402: -  eps - the eigensolver object

404:    Level: advanced

406: .seealso: SVDCyclicGetEPS()
407: @*/
408: PetscErrorCode SVDCyclicSetEPS(SVD svd,EPS eps)
409: {

416:   PetscTryMethod(svd,"SVDCyclicSetEPS_C",(SVD,EPS),(svd,eps));
417:   return(0);
418: }

422: static PetscErrorCode SVDCyclicGetEPS_Cyclic(SVD svd,EPS *eps)
423: {
425:   SVD_CYCLIC     *cyclic = (SVD_CYCLIC*)svd->data;

428:   if (!cyclic->eps) {
429:     EPSCreate(PetscObjectComm((PetscObject)svd),&cyclic->eps);
430:     EPSSetOptionsPrefix(cyclic->eps,((PetscObject)svd)->prefix);
431:     EPSAppendOptionsPrefix(cyclic->eps,"svd_");
432:     PetscObjectIncrementTabLevel((PetscObject)cyclic->eps,(PetscObject)svd,1);
433:     PetscLogObjectParent(svd,cyclic->eps);
434:     if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
435:     EPSSetIP(cyclic->eps,svd->ip);
436:     EPSSetWhichEigenpairs(cyclic->eps,EPS_LARGEST_REAL);
437:     EPSMonitorSet(cyclic->eps,SVDMonitor_Cyclic,svd,NULL);
438:   }
439:   *eps = cyclic->eps;
440:   return(0);
441: }

445: /*@
446:    SVDCyclicGetEPS - Retrieve the eigensolver object (EPS) associated
447:    to the singular value solver.

449:    Not Collective

451:    Input Parameter:
452: .  svd - singular value solver

454:    Output Parameter:
455: .  eps - the eigensolver object

457:    Level: advanced

459: .seealso: SVDCyclicSetEPS()
460: @*/
461: PetscErrorCode SVDCyclicGetEPS(SVD svd,EPS *eps)
462: {

468:   PetscTryMethod(svd,"SVDCyclicGetEPS_C",(SVD,EPS*),(svd,eps));
469:   return(0);
470: }

474: PetscErrorCode SVDView_Cyclic(SVD svd,PetscViewer viewer)
475: {
477:   SVD_CYCLIC     *cyclic = (SVD_CYCLIC*)svd->data;

480:   if (!cyclic->eps) { SVDCyclicGetEPS(svd,&cyclic->eps); }
481:   PetscViewerASCIIPrintf(viewer,"  Cyclic: %s matrix\n",cyclic->explicitmatrix?"explicit":"implicit");
482:   PetscViewerASCIIPushTab(viewer);
483:   EPSView(cyclic->eps,viewer);
484:   PetscViewerASCIIPopTab(viewer);
485:   return(0);
486: }

490: PetscErrorCode SVDReset_Cyclic(SVD svd)
491: {
493:   SVD_CYCLIC     *cyclic = (SVD_CYCLIC*)svd->data;

496:   if (!cyclic->eps) { EPSReset(cyclic->eps); }
497:   MatDestroy(&cyclic->mat);
498:   VecDestroy(&cyclic->x1);
499:   VecDestroy(&cyclic->x2);
500:   VecDestroy(&cyclic->y1);
501:   VecDestroy(&cyclic->y2);
502:   return(0);
503: }

507: PetscErrorCode SVDDestroy_Cyclic(SVD svd)
508: {
510:   SVD_CYCLIC     *cyclic = (SVD_CYCLIC*)svd->data;

513:   EPSDestroy(&cyclic->eps);
514:   PetscFree(svd->data);
515:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetEPS_C",NULL);
516:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetEPS_C",NULL);
517:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetExplicitMatrix_C",NULL);
518:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetExplicitMatrix_C",NULL);
519:   return(0);
520: }

524: PETSC_EXTERN PetscErrorCode SVDCreate_Cyclic(SVD svd)
525: {
527:   SVD_CYCLIC     *cyclic;

530:   PetscNewLog(svd,SVD_CYCLIC,&cyclic);
531:   svd->data                      = (void*)cyclic;
532:   svd->ops->solve                = SVDSolve_Cyclic;
533:   svd->ops->setup                = SVDSetUp_Cyclic;
534:   svd->ops->setfromoptions       = SVDSetFromOptions_Cyclic;
535:   svd->ops->destroy              = SVDDestroy_Cyclic;
536:   svd->ops->reset                = SVDReset_Cyclic;
537:   svd->ops->view                 = SVDView_Cyclic;
538:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetEPS_C",SVDCyclicSetEPS_Cyclic);
539:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetEPS_C",SVDCyclicGetEPS_Cyclic);
540:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicSetExplicitMatrix_C",SVDCyclicSetExplicitMatrix_Cyclic);
541:   PetscObjectComposeFunction((PetscObject)svd,"SVDCyclicGetExplicitMatrix_C",SVDCyclicGetExplicitMatrix_Cyclic);
542:   return(0);
543: }

slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/index.html0000644000175000017500000000205112211062077021403 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

cyclic.c
makefile
slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/ftn-auto/0000755000175000017500000000000012214143515021145 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/ftn-auto/makefile0000644000175000017500000000034412211062077022646 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = cyclicf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/svd/impls/cyclic/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/cyclic/ftn-auto/cyclicf.c0000644000175000017500000000423212211062077022726 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* cyclic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #include "slepceps.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcyclicsetexplicitmatrix_ SVDCYCLICSETEXPLICITMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcyclicsetexplicitmatrix_ svdcyclicsetexplicitmatrix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcyclicgetexplicitmatrix_ SVDCYCLICGETEXPLICITMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcyclicgetexplicitmatrix_ svdcyclicgetexplicitmatrix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcyclicseteps_ SVDCYCLICSETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcyclicseteps_ svdcyclicseteps #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcyclicgeteps_ SVDCYCLICGETEPS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcyclicgeteps_ svdcyclicgeteps #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdcyclicsetexplicitmatrix_(SVD *svd,PetscBool *explicitmatrix, int *__ierr ){ *__ierr = SVDCyclicSetExplicitMatrix(*svd,*explicitmatrix); } void PETSC_STDCALL svdcyclicgetexplicitmatrix_(SVD *svd,PetscBool *explicitmatrix, int *__ierr ){ *__ierr = SVDCyclicGetExplicitMatrix(*svd,explicitmatrix); } void PETSC_STDCALL svdcyclicseteps_(SVD *svd,EPS *eps, int *__ierr ){ *__ierr = SVDCyclicSetEPS(*svd,*eps); } void PETSC_STDCALL svdcyclicgeteps_(SVD *svd,EPS *eps, int *__ierr ){ *__ierr = SVDCyclicGetEPS(*svd, (EPS* )PetscToPointer((eps) )); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/impls/makefile0000644000175000017500000000210012211062077017633 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = cross cyclic lapack lanczos trlanczos LOCDIR = src/svd/impls/ MANSEC = SVD include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/makefile.html0000644000175000017500000000367412211062077020617 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = cross cyclic lapack lanczos trlanczos
LOCDIR   = src/svd/impls/
MANSEC   = SVD

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/0000755000175000017500000000000012214143515017613 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/gklanczos.c0000644000175000017500000003417212211062077021761 0ustar gladkgladk/* SLEPc singular value solver: "lanczos" Method: Explicitly restarted Lanczos Algorithm: Golub-Kahan-Lanczos bidiagonalization with explicit restart. References: [1] G.H. Golub and W. Kahan, "Calculating the singular values and pseudo-inverse of a matrix", SIAM J. Numer. Anal. Ser. B 2:205-224, 1965. [2] V. Hernandez, J.E. Roman, and A. Tomas, "A robust and efficient parallel SVD solver based on restarted Lanczos bidiagonalization", Elec. Trans. Numer. Anal. 31:68-85, 2008. Last update: Jun 2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include #include typedef struct { PetscBool oneside; } SVD_LANCZOS; #undef __FUNCT__ #define __FUNCT__ "SVDSetUp_Lanczos" PetscErrorCode SVDSetUp_Lanczos(SVD svd) { PetscErrorCode ierr; SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data; PetscInt N; PetscFunctionBegin; ierr = SVDMatGetSize(svd,NULL,&N);CHKERRQ(ierr); if (svd->ncv) { /* ncv set */ if (svd->ncvnsv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must be at least nsv"); } else if (svd->mpd) { /* mpd set */ svd->ncv = PetscMin(N,svd->nsv+svd->mpd); } else { /* neither set: defaults depend on nsv being small or large */ if (svd->nsv<500) svd->ncv = PetscMin(N,PetscMax(2*svd->nsv,10)); else { svd->mpd = 500; svd->ncv = PetscMin(N,svd->nsv+svd->mpd); } } if (!svd->mpd) svd->mpd = svd->ncv; if (svd->ncv>svd->nsv+svd->mpd) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must not be larger than nev+mpd"); if (!svd->max_it) svd->max_it = PetscMax(N/svd->ncv,100); if (!lanczos->oneside && svd->ncv != svd->n) { ierr = VecDestroyVecs(svd->n,&svd->U);CHKERRQ(ierr); ierr = VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);CHKERRQ(ierr); ierr = PetscLogObjectParents(svd,svd->ncv,svd->U);CHKERRQ(ierr); } ierr = DSSetType(svd->ds,DSSVD);CHKERRQ(ierr); ierr = DSSetCompact(svd->ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSAllocate(svd->ds,svd->ncv);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDTwoSideLanczos" PetscErrorCode SVDTwoSideLanczos(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec *U,PetscInt k,PetscInt n,PetscScalar* work) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; ierr = SVDMatMult(svd,PETSC_FALSE,V[k],U[k]);CHKERRQ(ierr); ierr = IPOrthogonalize(svd->ip,0,NULL,k,NULL,U,U[k],work,alpha+k,NULL);CHKERRQ(ierr); ierr = VecScale(U[k],1.0/alpha[k]);CHKERRQ(ierr); for (i=k+1;iip,0,NULL,i,NULL,V,V[i],work,beta+i-1,NULL);CHKERRQ(ierr); ierr = VecScale(V[i],1.0/beta[i-1]);CHKERRQ(ierr); ierr = SVDMatMult(svd,PETSC_FALSE,V[i],U[i]);CHKERRQ(ierr); ierr = IPOrthogonalize(svd->ip,0,NULL,i,NULL,U,U[i],work,alpha+i,NULL);CHKERRQ(ierr); ierr = VecScale(U[i],1.0/alpha[i]);CHKERRQ(ierr); } ierr = SVDMatMult(svd,PETSC_TRUE,U[n-1],v);CHKERRQ(ierr); ierr = IPOrthogonalize(svd->ip,0,NULL,n,NULL,V,v,work,beta+n-1,NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDOneSideLanczos" static PetscErrorCode SVDOneSideLanczos(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec u,Vec u_1,PetscInt k,PetscInt n,PetscScalar* work) { PetscErrorCode ierr; PetscInt i; PetscReal a,b; Vec temp; PetscFunctionBegin; ierr = SVDMatMult(svd,PETSC_FALSE,V[k],u);CHKERRQ(ierr); for (i=k+1;iip,u,&a);CHKERRQ(ierr); ierr = IPMInnerProductBegin(svd->ip,V[i],i,V,work);CHKERRQ(ierr); ierr = IPNormEnd(svd->ip,u,&a);CHKERRQ(ierr); ierr = IPMInnerProductEnd(svd->ip,V[i],i,V,work);CHKERRQ(ierr); ierr = VecScale(u,1.0/a);CHKERRQ(ierr); ierr = SlepcVecMAXPBY(V[i],1.0/a,-1.0/a,i,work,V);CHKERRQ(ierr); ierr = IPOrthogonalizeCGS1(svd->ip,0,NULL,i,NULL,V,V[i],work,NULL,&b);CHKERRQ(ierr); ierr = VecScale(V[i],1.0/b);CHKERRQ(ierr); ierr = SVDMatMult(svd,PETSC_FALSE,V[i],u_1);CHKERRQ(ierr); ierr = VecAXPY(u_1,-b,u);CHKERRQ(ierr); alpha[i-1] = a; beta[i-1] = b; temp = u; u = u_1; u_1 = temp; } ierr = SVDMatMult(svd,PETSC_TRUE,u,v);CHKERRQ(ierr); ierr = IPNormBegin(svd->ip,u,&a);CHKERRQ(ierr); ierr = IPMInnerProductBegin(svd->ip,v,n,V,work);CHKERRQ(ierr); ierr = IPNormEnd(svd->ip,u,&a);CHKERRQ(ierr); ierr = IPMInnerProductEnd(svd->ip,v,n,V,work);CHKERRQ(ierr); ierr = VecScale(u,1.0/a);CHKERRQ(ierr); ierr = SlepcVecMAXPBY(v,1.0/a,-1.0/a,n,work,V);CHKERRQ(ierr); ierr = IPOrthogonalizeCGS1(svd->ip,0,NULL,n,NULL,V,v,work,NULL,&b);CHKERRQ(ierr); alpha[n-1] = a; beta[n-1] = b; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSolve_Lanczos" PetscErrorCode SVDSolve_Lanczos(SVD svd) { PetscErrorCode ierr; SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data; PetscReal *alpha,*beta,lastbeta; PetscScalar *swork,*w,*Q,*PT; PetscInt i,k,j,nv,ld,off; Vec v,u=0,u_1=0; PetscBool conv; PetscFunctionBegin; /* allocate working space */ ierr = DSGetLeadingDimension(svd->ds,&ld);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*ld,&w);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscScalar)*svd->n,&swork);CHKERRQ(ierr); ierr = VecDuplicate(svd->V[0],&v);CHKERRQ(ierr); if (lanczos->oneside) { ierr = SVDMatGetVecs(svd,NULL,&u);CHKERRQ(ierr); ierr = SVDMatGetVecs(svd,NULL,&u_1);CHKERRQ(ierr); } /* normalize start vector */ if (!svd->nini) { ierr = SlepcVecSetRandom(svd->V[0],svd->rand);CHKERRQ(ierr); } ierr = VecNormalize(svd->V[0],NULL);CHKERRQ(ierr); while (svd->reason == SVD_CONVERGED_ITERATING) { svd->its++; /* inner loop */ nv = PetscMin(svd->nconv+svd->mpd,svd->n); ierr = DSGetArrayReal(svd->ds,DS_MAT_T,&alpha);CHKERRQ(ierr); beta = alpha + ld; if (lanczos->oneside) { ierr = SVDOneSideLanczos(svd,alpha,beta,svd->V,v,u,u_1,svd->nconv,nv,swork);CHKERRQ(ierr); } else { ierr = SVDTwoSideLanczos(svd,alpha,beta,svd->V,v,svd->U,svd->nconv,nv,swork);CHKERRQ(ierr); } lastbeta = beta[nv-1]; ierr = DSRestoreArrayReal(svd->ds,DS_MAT_T,&alpha);CHKERRQ(ierr); /* compute SVD of bidiagonal matrix */ ierr = DSSetDimensions(svd->ds,nv,nv,svd->nconv,0);CHKERRQ(ierr); ierr = DSSetState(svd->ds,DS_STATE_INTERMEDIATE);CHKERRQ(ierr); ierr = DSSolve(svd->ds,w,NULL);CHKERRQ(ierr); ierr = DSSort(svd->ds,w,NULL,NULL,NULL,NULL);CHKERRQ(ierr); /* compute error estimates */ k = 0; conv = PETSC_TRUE; ierr = DSGetArray(svd->ds,DS_MAT_U,&Q);CHKERRQ(ierr); for (i=svd->nconv;isigma[i] = PetscRealPart(w[i]); svd->errest[i] = PetscAbsScalar(Q[nv-1+i*ld])*lastbeta; if (svd->sigma[i] > svd->tol) svd->errest[i] /= svd->sigma[i]; if (conv) { if (svd->errest[i] < svd->tol) k++; else conv = PETSC_FALSE; } } /* check convergence */ if (svd->its >= svd->max_it) svd->reason = SVD_DIVERGED_ITS; if (svd->nconv+k >= svd->nsv) svd->reason = SVD_CONVERGED_TOL; /* compute restart vector */ ierr = DSGetArray(svd->ds,DS_MAT_VT,&PT);CHKERRQ(ierr); if (svd->reason == SVD_CONVERGED_ITERATING) { for (j=svd->nconv;jnconv] = PT[k+svd->nconv+j*ld]; ierr = SlepcVecMAXPBY(v,0.0,1.0,nv-svd->nconv,swork,svd->V+svd->nconv);CHKERRQ(ierr); } /* compute converged singular vectors */ off = svd->nconv+svd->nconv*ld; ierr = SlepcUpdateVectors(nv-svd->nconv,svd->V+svd->nconv,0,k,PT+off,ld,PETSC_TRUE);CHKERRQ(ierr); if (!lanczos->oneside) { ierr = SlepcUpdateVectors(nv-svd->nconv,svd->U+svd->nconv,0,k,Q+off,ld,PETSC_FALSE);CHKERRQ(ierr); } ierr = DSRestoreArray(svd->ds,DS_MAT_VT,&PT);CHKERRQ(ierr); ierr = DSRestoreArray(svd->ds,DS_MAT_U,&Q);CHKERRQ(ierr); /* copy restart vector from temporary space */ if (svd->reason == SVD_CONVERGED_ITERATING) { ierr = VecCopy(v,svd->V[svd->nconv+k]);CHKERRQ(ierr); } svd->nconv += k; ierr = SVDMonitor(svd,svd->its,svd->nconv,svd->sigma,svd->errest,nv);CHKERRQ(ierr); } /* free working space */ ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); ierr = VecDestroy(&u_1);CHKERRQ(ierr); ierr = PetscFree(w);CHKERRQ(ierr); ierr = PetscFree(swork);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetFromOptions_Lanczos" PetscErrorCode SVDSetFromOptions_Lanczos(SVD svd) { PetscErrorCode ierr; PetscBool set,val; SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data; PetscFunctionBegin; ierr = PetscOptionsHead("SVD Lanczos Options");CHKERRQ(ierr); ierr = PetscOptionsBool("-svd_lanczos_oneside","Lanczos one-side reorthogonalization","SVDLanczosSetOneSide",lanczos->oneside,&val,&set);CHKERRQ(ierr); if (set) { ierr = SVDLanczosSetOneSide(svd,val);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDLanczosSetOneSide_Lanczos" static PetscErrorCode SVDLanczosSetOneSide_Lanczos(SVD svd,PetscBool oneside) { SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data; PetscFunctionBegin; if (lanczos->oneside != oneside) { lanczos->oneside = oneside; svd->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDLanczosSetOneSide" /*@ SVDLanczosSetOneSide - Indicate if the variant of the Lanczos method to be used is one-sided or two-sided. Logically Collective on SVD Input Parameters: + svd - singular value solver - oneside - boolean flag indicating if the method is one-sided or not Options Database Key: . -svd_lanczos_oneside - Indicates the boolean flag Note: By default, a two-sided variant is selected, which is sometimes slightly more robust. However, the one-sided variant is faster because it avoids the orthogonalization associated to left singular vectors. It also saves the memory required for storing such vectors. Level: advanced .seealso: SVDTRLanczosSetOneSide() @*/ PetscErrorCode SVDLanczosSetOneSide(SVD svd,PetscBool oneside) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveBool(svd,oneside,2); ierr = PetscTryMethod(svd,"SVDLanczosSetOneSide_C",(SVD,PetscBool),(svd,oneside));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDLanczosGetOneSide" /*@ SVDLanczosGetOneSide - Gets if the variant of the Lanczos method to be used is one-sided or two-sided. Not Collective Input Parameters: . svd - singular value solver Output Parameters: . oneside - boolean flag indicating if the method is one-sided or not Level: advanced .seealso: SVDLanczosSetOneSide() @*/ PetscErrorCode SVDLanczosGetOneSide(SVD svd,PetscBool *oneside) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(oneside,2); ierr = PetscTryMethod(svd,"SVDLanczosGetOneSide_C",(SVD,PetscBool*),(svd,oneside));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDLanczosGetOneSide_Lanczos" static PetscErrorCode SVDLanczosGetOneSide_Lanczos(SVD svd,PetscBool *oneside) { SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data; PetscFunctionBegin; *oneside = lanczos->oneside; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDReset_Lanczos" PetscErrorCode SVDReset_Lanczos(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDestroyVecs(svd->n,&svd->U);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDDestroy_Lanczos" PetscErrorCode SVDDestroy_Lanczos(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(svd->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosSetOneSide_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosGetOneSide_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDView_Lanczos" PetscErrorCode SVDView_Lanczos(SVD svd,PetscViewer viewer) { PetscErrorCode ierr; SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data; PetscFunctionBegin; ierr = PetscViewerASCIIPrintf(viewer," Lanczos: %s-sided reorthogonalization\n",lanczos->oneside? "one": "two");CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCreate_Lanczos" PETSC_EXTERN PetscErrorCode SVDCreate_Lanczos(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(svd,SVD_LANCZOS,&svd->data);CHKERRQ(ierr); svd->ops->setup = SVDSetUp_Lanczos; svd->ops->solve = SVDSolve_Lanczos; svd->ops->destroy = SVDDestroy_Lanczos; svd->ops->reset = SVDReset_Lanczos; svd->ops->setfromoptions = SVDSetFromOptions_Lanczos; svd->ops->view = SVDView_Lanczos; ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosSetOneSide_C",SVDLanczosSetOneSide_Lanczos);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosGetOneSide_C",SVDLanczosGetOneSide_Lanczos);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/gklanczos.c.html0000644000175000017500000007154612211062077022732 0ustar gladkgladk
Actual source code: gklanczos.c

  1: /*

  3:    SLEPc singular value solver: "lanczos"

  5:    Method: Explicitly restarted Lanczos

  7:    Algorithm:

  9:        Golub-Kahan-Lanczos bidiagonalization with explicit restart.

 11:    References:

 13:        [1] G.H. Golub and W. Kahan, "Calculating the singular values
 14:            and pseudo-inverse of a matrix", SIAM J. Numer. Anal. Ser.
 15:            B 2:205-224, 1965.

 17:        [2] V. Hernandez, J.E. Roman, and A. Tomas, "A robust and
 18:            efficient parallel SVD solver based on restarted Lanczos
 19:            bidiagonalization", Elec. Trans. Numer. Anal. 31:68-85,
 20:            2008.

 22:    Last update: Jun 2007

 24:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 25:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 26:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 28:    This file is part of SLEPc.

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

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

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

 44: #include <slepc-private/svdimpl.h>                /*I "slepcsvd.h" I*/
 45: #include <slepc-private/ipimpl.h>
 46: #include <slepcblaslapack.h>

 48: typedef struct {
 49:   PetscBool oneside;
 50: } SVD_LANCZOS;

 54: PetscErrorCode SVDSetUp_Lanczos(SVD svd)
 55: {
 57:   SVD_LANCZOS    *lanczos = (SVD_LANCZOS*)svd->data;
 58:   PetscInt       N;

 61:   SVDMatGetSize(svd,NULL,&N);
 62:   if (svd->ncv) { /* ncv set */
 63:     if (svd->ncv<svd->nsv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must be at least nsv");
 64:   } else if (svd->mpd) { /* mpd set */
 65:     svd->ncv = PetscMin(N,svd->nsv+svd->mpd);
 66:   } else { /* neither set: defaults depend on nsv being small or large */
 67:     if (svd->nsv<500) svd->ncv = PetscMin(N,PetscMax(2*svd->nsv,10));
 68:     else {
 69:       svd->mpd = 500;
 70:       svd->ncv = PetscMin(N,svd->nsv+svd->mpd);
 71:     }
 72:   }
 73:   if (!svd->mpd) svd->mpd = svd->ncv;
 74:   if (svd->ncv>svd->nsv+svd->mpd) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The value of ncv must not be larger than nev+mpd");
 75:   if (!svd->max_it) svd->max_it = PetscMax(N/svd->ncv,100);
 76:   if (!lanczos->oneside && svd->ncv != svd->n) {
 77:     VecDestroyVecs(svd->n,&svd->U);
 78:     VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);
 79:     PetscLogObjectParents(svd,svd->ncv,svd->U);
 80:   }
 81:   DSSetType(svd->ds,DSSVD);
 82:   DSSetCompact(svd->ds,PETSC_TRUE);
 83:   DSAllocate(svd->ds,svd->ncv);
 84:   return(0);
 85: }

 89: PetscErrorCode SVDTwoSideLanczos(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec *U,PetscInt k,PetscInt n,PetscScalar* work)
 90: {
 92:   PetscInt       i;

 95:   SVDMatMult(svd,PETSC_FALSE,V[k],U[k]);
 96:   IPOrthogonalize(svd->ip,0,NULL,k,NULL,U,U[k],work,alpha+k,NULL);
 97:   VecScale(U[k],1.0/alpha[k]);
 98:   for (i=k+1;i<n;i++) {
 99:     SVDMatMult(svd,PETSC_TRUE,U[i-1],V[i]);
100:     IPOrthogonalize(svd->ip,0,NULL,i,NULL,V,V[i],work,beta+i-1,NULL);
101:     VecScale(V[i],1.0/beta[i-1]);

103:     SVDMatMult(svd,PETSC_FALSE,V[i],U[i]);
104:     IPOrthogonalize(svd->ip,0,NULL,i,NULL,U,U[i],work,alpha+i,NULL);
105:     VecScale(U[i],1.0/alpha[i]);
106:   }
107:   SVDMatMult(svd,PETSC_TRUE,U[n-1],v);
108:   IPOrthogonalize(svd->ip,0,NULL,n,NULL,V,v,work,beta+n-1,NULL);
109:   return(0);
110: }

114: static PetscErrorCode SVDOneSideLanczos(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec u,Vec u_1,PetscInt k,PetscInt n,PetscScalar* work)
115: {
117:   PetscInt       i;
118:   PetscReal      a,b;
119:   Vec            temp;

122:   SVDMatMult(svd,PETSC_FALSE,V[k],u);
123:   for (i=k+1;i<n;i++) {
124:     SVDMatMult(svd,PETSC_TRUE,u,V[i]);
125:     IPNormBegin(svd->ip,u,&a);
126:     IPMInnerProductBegin(svd->ip,V[i],i,V,work);
127:     IPNormEnd(svd->ip,u,&a);
128:     IPMInnerProductEnd(svd->ip,V[i],i,V,work);

130:     VecScale(u,1.0/a);
131:     SlepcVecMAXPBY(V[i],1.0/a,-1.0/a,i,work,V);

133:     IPOrthogonalizeCGS1(svd->ip,0,NULL,i,NULL,V,V[i],work,NULL,&b);
134:     VecScale(V[i],1.0/b);

136:     SVDMatMult(svd,PETSC_FALSE,V[i],u_1);
137:     VecAXPY(u_1,-b,u);

139:     alpha[i-1] = a;
140:     beta[i-1] = b;
141:     temp = u;
142:     u = u_1;
143:     u_1 = temp;
144:   }
145:   SVDMatMult(svd,PETSC_TRUE,u,v);
146:   IPNormBegin(svd->ip,u,&a);
147:   IPMInnerProductBegin(svd->ip,v,n,V,work);
148:   IPNormEnd(svd->ip,u,&a);
149:   IPMInnerProductEnd(svd->ip,v,n,V,work);

151:   VecScale(u,1.0/a);
152:   SlepcVecMAXPBY(v,1.0/a,-1.0/a,n,work,V);

154:   IPOrthogonalizeCGS1(svd->ip,0,NULL,n,NULL,V,v,work,NULL,&b);

156:   alpha[n-1] = a;
157:   beta[n-1] = b;
158:   return(0);
159: }

163: PetscErrorCode SVDSolve_Lanczos(SVD svd)
164: {
166:   SVD_LANCZOS    *lanczos = (SVD_LANCZOS*)svd->data;
167:   PetscReal      *alpha,*beta,lastbeta;
168:   PetscScalar    *swork,*w,*Q,*PT;
169:   PetscInt       i,k,j,nv,ld,off;
170:   Vec            v,u=0,u_1=0;
171:   PetscBool      conv;

174:   /* allocate working space */
175:   DSGetLeadingDimension(svd->ds,&ld);
176:   PetscMalloc(sizeof(PetscScalar)*ld,&w);
177:   PetscMalloc(sizeof(PetscScalar)*svd->n,&swork);

179:   VecDuplicate(svd->V[0],&v);
180:   if (lanczos->oneside) {
181:     SVDMatGetVecs(svd,NULL,&u);
182:     SVDMatGetVecs(svd,NULL,&u_1);
183:   }

185:   /* normalize start vector */
186:   if (!svd->nini) {
187:     SlepcVecSetRandom(svd->V[0],svd->rand);
188:   }
189:   VecNormalize(svd->V[0],NULL);

191:   while (svd->reason == SVD_CONVERGED_ITERATING) {
192:     svd->its++;

194:     /* inner loop */
195:     nv = PetscMin(svd->nconv+svd->mpd,svd->n);
196:     DSGetArrayReal(svd->ds,DS_MAT_T,&alpha);
197:     beta = alpha + ld;
198:     if (lanczos->oneside) {
199:       SVDOneSideLanczos(svd,alpha,beta,svd->V,v,u,u_1,svd->nconv,nv,swork);
200:     } else {
201:       SVDTwoSideLanczos(svd,alpha,beta,svd->V,v,svd->U,svd->nconv,nv,swork);
202:     }
203:     lastbeta = beta[nv-1];
204:     DSRestoreArrayReal(svd->ds,DS_MAT_T,&alpha);

206:     /* compute SVD of bidiagonal matrix */
207:     DSSetDimensions(svd->ds,nv,nv,svd->nconv,0);
208:     DSSetState(svd->ds,DS_STATE_INTERMEDIATE);
209:     DSSolve(svd->ds,w,NULL);
210:     DSSort(svd->ds,w,NULL,NULL,NULL,NULL);

212:     /* compute error estimates */
213:     k = 0;
214:     conv = PETSC_TRUE;
215:     DSGetArray(svd->ds,DS_MAT_U,&Q);
216:     for (i=svd->nconv;i<nv;i++) {
217:       svd->sigma[i] = PetscRealPart(w[i]);
218:       svd->errest[i] = PetscAbsScalar(Q[nv-1+i*ld])*lastbeta;
219:       if (svd->sigma[i] > svd->tol) svd->errest[i] /= svd->sigma[i];
220:       if (conv) {
221:         if (svd->errest[i] < svd->tol) k++;
222:         else conv = PETSC_FALSE;
223:       }
224:     }

226:     /* check convergence */
227:     if (svd->its >= svd->max_it) svd->reason = SVD_DIVERGED_ITS;
228:     if (svd->nconv+k >= svd->nsv) svd->reason = SVD_CONVERGED_TOL;

230:     /* compute restart vector */
231:     DSGetArray(svd->ds,DS_MAT_VT,&PT);
232:     if (svd->reason == SVD_CONVERGED_ITERATING) {
233:       for (j=svd->nconv;j<nv;j++) swork[j-svd->nconv] = PT[k+svd->nconv+j*ld];
234:       SlepcVecMAXPBY(v,0.0,1.0,nv-svd->nconv,swork,svd->V+svd->nconv);
235:     }

237:     /* compute converged singular vectors */
238:     off = svd->nconv+svd->nconv*ld;
239:     SlepcUpdateVectors(nv-svd->nconv,svd->V+svd->nconv,0,k,PT+off,ld,PETSC_TRUE);
240:     if (!lanczos->oneside) {
241:       SlepcUpdateVectors(nv-svd->nconv,svd->U+svd->nconv,0,k,Q+off,ld,PETSC_FALSE);
242:     }
243:     DSRestoreArray(svd->ds,DS_MAT_VT,&PT);
244:     DSRestoreArray(svd->ds,DS_MAT_U,&Q);

246:     /* copy restart vector from temporary space */
247:     if (svd->reason == SVD_CONVERGED_ITERATING) {
248:       VecCopy(v,svd->V[svd->nconv+k]);
249:     }

251:     svd->nconv += k;
252:     SVDMonitor(svd,svd->its,svd->nconv,svd->sigma,svd->errest,nv);
253:   }

255:   /* free working space */
256:   VecDestroy(&v);
257:   VecDestroy(&u);
258:   VecDestroy(&u_1);
259:   PetscFree(w);
260:   PetscFree(swork);
261:   return(0);
262: }

266: PetscErrorCode SVDSetFromOptions_Lanczos(SVD svd)
267: {
269:   PetscBool      set,val;
270:   SVD_LANCZOS    *lanczos = (SVD_LANCZOS*)svd->data;

273:   PetscOptionsHead("SVD Lanczos Options");
274:   PetscOptionsBool("-svd_lanczos_oneside","Lanczos one-side reorthogonalization","SVDLanczosSetOneSide",lanczos->oneside,&val,&set);
275:   if (set) {
276:     SVDLanczosSetOneSide(svd,val);
277:   }
278:   PetscOptionsTail();
279:   return(0);
280: }

284: static PetscErrorCode SVDLanczosSetOneSide_Lanczos(SVD svd,PetscBool oneside)
285: {
286:   SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data;

289:   if (lanczos->oneside != oneside) {
290:     lanczos->oneside = oneside;
291:     svd->setupcalled = 0;
292:   }
293:   return(0);
294: }

298: /*@
299:    SVDLanczosSetOneSide - Indicate if the variant of the Lanczos method
300:    to be used is one-sided or two-sided.

302:    Logically Collective on SVD

304:    Input Parameters:
305: +  svd     - singular value solver
306: -  oneside - boolean flag indicating if the method is one-sided or not

308:    Options Database Key:
309: .  -svd_lanczos_oneside <boolean> - Indicates the boolean flag

311:    Note:
312:    By default, a two-sided variant is selected, which is sometimes slightly
313:    more robust. However, the one-sided variant is faster because it avoids
314:    the orthogonalization associated to left singular vectors. It also saves
315:    the memory required for storing such vectors.

317:    Level: advanced

319: .seealso: SVDTRLanczosSetOneSide()
320: @*/
321: PetscErrorCode SVDLanczosSetOneSide(SVD svd,PetscBool oneside)
322: {

328:   PetscTryMethod(svd,"SVDLanczosSetOneSide_C",(SVD,PetscBool),(svd,oneside));
329:   return(0);
330: }

334: /*@
335:    SVDLanczosGetOneSide - Gets if the variant of the Lanczos method
336:    to be used is one-sided or two-sided.

338:    Not Collective

340:    Input Parameters:
341: .  svd     - singular value solver

343:    Output Parameters:
344: .  oneside - boolean flag indicating if the method is one-sided or not

346:    Level: advanced

348: .seealso: SVDLanczosSetOneSide()
349: @*/
350: PetscErrorCode SVDLanczosGetOneSide(SVD svd,PetscBool *oneside)
351: {

357:   PetscTryMethod(svd,"SVDLanczosGetOneSide_C",(SVD,PetscBool*),(svd,oneside));
358:   return(0);
359: }

363: static PetscErrorCode SVDLanczosGetOneSide_Lanczos(SVD svd,PetscBool *oneside)
364: {
365:   SVD_LANCZOS *lanczos = (SVD_LANCZOS*)svd->data;

368:   *oneside = lanczos->oneside;
369:   return(0);
370: }

374: PetscErrorCode SVDReset_Lanczos(SVD svd)
375: {

379:   VecDestroyVecs(svd->n,&svd->U);
380:   return(0);
381: }

385: PetscErrorCode SVDDestroy_Lanczos(SVD svd)
386: {

390:   PetscFree(svd->data);
391:   PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosSetOneSide_C",NULL);
392:   PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosGetOneSide_C",NULL);
393:   return(0);
394: }

398: PetscErrorCode SVDView_Lanczos(SVD svd,PetscViewer viewer)
399: {
401:   SVD_LANCZOS    *lanczos = (SVD_LANCZOS*)svd->data;

404:   PetscViewerASCIIPrintf(viewer,"  Lanczos: %s-sided reorthogonalization\n",lanczos->oneside? "one": "two");
405:   return(0);
406: }

410: PETSC_EXTERN PetscErrorCode SVDCreate_Lanczos(SVD svd)
411: {

415:   PetscNewLog(svd,SVD_LANCZOS,&svd->data);
416:   svd->ops->setup          = SVDSetUp_Lanczos;
417:   svd->ops->solve          = SVDSolve_Lanczos;
418:   svd->ops->destroy        = SVDDestroy_Lanczos;
419:   svd->ops->reset          = SVDReset_Lanczos;
420:   svd->ops->setfromoptions = SVDSetFromOptions_Lanczos;
421:   svd->ops->view           = SVDView_Lanczos;
422:   PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosSetOneSide_C",SVDLanczosSetOneSide_Lanczos);
423:   PetscObjectComposeFunction((PetscObject)svd,"SVDLanczosGetOneSide_C",SVDLanczosGetOneSide_Lanczos);
424:   return(0);
425: }

slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/makefile0000644000175000017500000000214512211062077021315 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = gklanczos.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = SVD LOCDIR = src/svd/impls/lanczos/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/makefile.html0000644000175000017500000000374112211062077022263 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = gklanczos.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = SVD
LOCDIR   = src/svd/impls/lanczos/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/index.html0000644000175000017500000000205712211062077021614 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

gklanczos.c
makefile
slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/ftn-auto/0000755000175000017500000000000012214143515021350 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/ftn-auto/gklanczosf.c0000644000175000017500000000262412211062077023661 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* gklanczos.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdlanczossetoneside_ SVDLANCZOSSETONESIDE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdlanczossetoneside_ svdlanczossetoneside #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdlanczosgetoneside_ SVDLANCZOSGETONESIDE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdlanczosgetoneside_ svdlanczosgetoneside #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdlanczossetoneside_(SVD *svd,PetscBool *oneside, int *__ierr ){ *__ierr = SVDLanczosSetOneSide(*svd,*oneside); } void PETSC_STDCALL svdlanczosgetoneside_(SVD *svd,PetscBool *oneside, int *__ierr ){ *__ierr = SVDLanczosGetOneSide(*svd,oneside); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/impls/lanczos/ftn-auto/makefile0000644000175000017500000000035012211062077023046 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = gklanczosf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/svd/impls/lanczos/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/index.html0000644000175000017500000000226012211062077020137 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

cross/
cyclic/
lapack/
lanczos/
trlanczos/
makefile
slepc-3.4.2.dfsg.orig/src/svd/impls/lapack/0000755000175000017500000000000012214143515017375 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/impls/lapack/svdlapack.c.html0000644000175000017500000002277112211062077022465 0ustar gladkgladk

Actual source code: svdlapack.c

  1: /*
  2:    This file implements a wrapper to the LAPACK SVD subroutines.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>      /*I "slepcsvd.h" I*/
 25: #include <slepcblaslapack.h>

 29: PetscErrorCode SVDSetUp_LAPACK(SVD svd)
 30: {
 32:   PetscInt       M,N;

 35:   SVDMatGetSize(svd,&M,&N);
 36:   svd->ncv = N;
 37:   if (svd->mpd) { PetscInfo(svd,"Warning: parameter mpd ignored\n"); }
 38:   svd->max_it = 1;
 39:   if (svd->ncv!=svd->n) {
 40:     VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);
 41:     PetscLogObjectParents(svd,svd->ncv,svd->U);
 42:   }
 43:   DSSetType(svd->ds,DSSVD);
 44:   DSAllocate(svd->ds,PetscMax(M,N));
 45:   return(0);
 46: }

 50: PetscErrorCode SVDSolve_LAPACK(SVD svd)
 51: {
 53:   PetscInt       M,N,n,i,j,k,ld;
 54:   Mat            mat;
 55:   PetscScalar    *pU,*pVT,*pmat,*pu,*pv,*A,*w;

 58:   DSGetLeadingDimension(svd->ds,&ld);
 59:   MatConvert(svd->OP,MATSEQDENSE,MAT_INITIAL_MATRIX,&mat);
 60:   MatGetSize(mat,&M,&N);
 61:   DSSetDimensions(svd->ds,M,N,0,0);
 62:   MatDenseGetArray(mat,&pmat);
 63:   DSGetArray(svd->ds,DS_MAT_A,&A);
 64:   for (i=0;i<M;i++)
 65:     for (j=0;j<N;j++)
 66:       A[i+j*ld] = pmat[i+j*M];
 67:   DSRestoreArray(svd->ds,DS_MAT_A,&A);
 68:   MatDenseRestoreArray(mat,&pmat);
 69:   DSSetState(svd->ds,DS_STATE_RAW);

 71:   n = PetscMin(M,N);
 72:   PetscMalloc(sizeof(PetscScalar)*n,&w);
 73:   DSSolve(svd->ds,w,NULL);
 74:   DSSort(svd->ds,w,NULL,NULL,NULL,NULL);

 76:   /* copy singular vectors */
 77:   DSGetArray(svd->ds,DS_MAT_U,&pU);
 78:   DSGetArray(svd->ds,DS_MAT_VT,&pVT);
 79:   for (i=0;i<n;i++) {
 80:     if (svd->which == SVD_SMALLEST) k = n - i - 1;
 81:     else k = i;
 82:     svd->sigma[k] = PetscRealPart(w[i]);
 83:     VecGetArray(svd->U[k],&pu);
 84:     VecGetArray(svd->V[k],&pv);
 85:     if (M>=N) {
 86:       for (j=0;j<M;j++) pu[j] = pU[i*ld+j];
 87:       for (j=0;j<N;j++) pv[j] = PetscConj(pVT[j*ld+i]);
 88:     } else {
 89:       for (j=0;j<N;j++) pu[j] = PetscConj(pVT[j*ld+i]);
 90:       for (j=0;j<M;j++) pv[j] = pU[i*ld+j];
 91:     }
 92:     VecRestoreArray(svd->U[k],&pu);
 93:     VecRestoreArray(svd->V[k],&pv);
 94:   }
 95:   DSRestoreArray(svd->ds,DS_MAT_U,&pU);
 96:   DSRestoreArray(svd->ds,DS_MAT_VT,&pVT);

 98:   svd->nconv = n;
 99:   svd->reason = SVD_CONVERGED_TOL;

101:   MatDestroy(&mat);
102:   PetscFree(w);
103:   return(0);
104: }

108: PetscErrorCode SVDReset_LAPACK(SVD svd)
109: {

113:   VecDestroyVecs(svd->n,&svd->U);
114:   return(0);
115: }

119: PetscErrorCode SVDDestroy_LAPACK(SVD svd)
120: {

124:   PetscFree(svd->data);
125:   return(0);
126: }

130: PETSC_EXTERN PetscErrorCode SVDCreate_LAPACK(SVD svd)
131: {
133:   svd->ops->setup   = SVDSetUp_LAPACK;
134:   svd->ops->solve   = SVDSolve_LAPACK;
135:   svd->ops->destroy = SVDDestroy_LAPACK;
136:   svd->ops->reset   = SVDReset_LAPACK;
137:   if (svd->transmode == PETSC_DECIDE)
138:     svd->transmode = SVD_TRANSPOSE_IMPLICIT; /* don't build the transpose */
139:   return(0);
140: }

slepc-3.4.2.dfsg.orig/src/svd/impls/lapack/svdlapack.c0000644000175000017500000001106112211062077021510 0ustar gladkgladk/* This file implements a wrapper to the LAPACK SVD subroutines. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "SVDSetUp_LAPACK" PetscErrorCode SVDSetUp_LAPACK(SVD svd) { PetscErrorCode ierr; PetscInt M,N; PetscFunctionBegin; ierr = SVDMatGetSize(svd,&M,&N);CHKERRQ(ierr); svd->ncv = N; if (svd->mpd) { ierr = PetscInfo(svd,"Warning: parameter mpd ignored\n");CHKERRQ(ierr); } svd->max_it = 1; if (svd->ncv!=svd->n) { ierr = VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);CHKERRQ(ierr); ierr = PetscLogObjectParents(svd,svd->ncv,svd->U);CHKERRQ(ierr); } ierr = DSSetType(svd->ds,DSSVD);CHKERRQ(ierr); ierr = DSAllocate(svd->ds,PetscMax(M,N));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSolve_LAPACK" PetscErrorCode SVDSolve_LAPACK(SVD svd) { PetscErrorCode ierr; PetscInt M,N,n,i,j,k,ld; Mat mat; PetscScalar *pU,*pVT,*pmat,*pu,*pv,*A,*w; PetscFunctionBegin; ierr = DSGetLeadingDimension(svd->ds,&ld);CHKERRQ(ierr); ierr = MatConvert(svd->OP,MATSEQDENSE,MAT_INITIAL_MATRIX,&mat);CHKERRQ(ierr); ierr = MatGetSize(mat,&M,&N);CHKERRQ(ierr); ierr = DSSetDimensions(svd->ds,M,N,0,0);CHKERRQ(ierr); ierr = MatDenseGetArray(mat,&pmat);CHKERRQ(ierr); ierr = DSGetArray(svd->ds,DS_MAT_A,&A);CHKERRQ(ierr); for (i=0;ids,DS_MAT_A,&A);CHKERRQ(ierr); ierr = MatDenseRestoreArray(mat,&pmat);CHKERRQ(ierr); ierr = DSSetState(svd->ds,DS_STATE_RAW);CHKERRQ(ierr); n = PetscMin(M,N); ierr = PetscMalloc(sizeof(PetscScalar)*n,&w);CHKERRQ(ierr); ierr = DSSolve(svd->ds,w,NULL);CHKERRQ(ierr); ierr = DSSort(svd->ds,w,NULL,NULL,NULL,NULL);CHKERRQ(ierr); /* copy singular vectors */ ierr = DSGetArray(svd->ds,DS_MAT_U,&pU);CHKERRQ(ierr); ierr = DSGetArray(svd->ds,DS_MAT_VT,&pVT);CHKERRQ(ierr); for (i=0;iwhich == SVD_SMALLEST) k = n - i - 1; else k = i; svd->sigma[k] = PetscRealPart(w[i]); ierr = VecGetArray(svd->U[k],&pu);CHKERRQ(ierr); ierr = VecGetArray(svd->V[k],&pv);CHKERRQ(ierr); if (M>=N) { for (j=0;jU[k],&pu);CHKERRQ(ierr); ierr = VecRestoreArray(svd->V[k],&pv);CHKERRQ(ierr); } ierr = DSRestoreArray(svd->ds,DS_MAT_U,&pU);CHKERRQ(ierr); ierr = DSRestoreArray(svd->ds,DS_MAT_VT,&pVT);CHKERRQ(ierr); svd->nconv = n; svd->reason = SVD_CONVERGED_TOL; ierr = MatDestroy(&mat);CHKERRQ(ierr); ierr = PetscFree(w);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDReset_LAPACK" PetscErrorCode SVDReset_LAPACK(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = VecDestroyVecs(svd->n,&svd->U);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDDestroy_LAPACK" PetscErrorCode SVDDestroy_LAPACK(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(svd->data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCreate_LAPACK" PETSC_EXTERN PetscErrorCode SVDCreate_LAPACK(SVD svd) { PetscFunctionBegin; svd->ops->setup = SVDSetUp_LAPACK; svd->ops->solve = SVDSolve_LAPACK; svd->ops->destroy = SVDDestroy_LAPACK; svd->ops->reset = SVDReset_LAPACK; if (svd->transmode == PETSC_DECIDE) svd->transmode = SVD_TRANSPOSE_IMPLICIT; /* don't build the transpose */ PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/impls/lapack/makefile0000644000175000017500000000214412211062077021076 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = svdlapack.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = SVD LOCDIR = src/svd/impls/lapack/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/impls/lapack/makefile.html0000644000175000017500000000374012211062077022044 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = svdlapack.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = SVD
LOCDIR   = src/svd/impls/lapack/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/svd/impls/lapack/index.html0000644000175000017500000000205712211062077021376 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

svdlapack.c
makefile
slepc-3.4.2.dfsg.orig/src/svd/makefile0000644000175000017500000000214312211062077016516 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/svdimpl.h ../../include/slepcsvd.h DIRS = interface impls examples LOCDIR = src/svd/ MANSEC = SVD include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/makefile.html0000644000175000017500000000373712211062077017473 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/svdimpl.h ../../include/slepcsvd.h
DIRS     = interface impls examples
LOCDIR   = src/svd/
MANSEC   = SVD

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/svd/interface/0000755000175000017500000000000012214143515016756 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/interface/svdsolve.c.html0000644000175000017500000007212412211062077021740 0ustar gladkgladk
Actual source code: svdsolve.c

  1: /*
  2:       SVD routines related to the solution process.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>   /*I "slepcsvd.h" I*/

 28: /*@
 29:    SVDSolve - Solves the singular value problem.

 31:    Collective on SVD

 33:    Input Parameter:
 34: .  svd - singular value solver context obtained from SVDCreate()

 36:    Options Database Keys:
 37: +  -svd_view - print information about the solver used
 38: -  -svd_view_mat binary - save the matrix to the default binary viewer

 40:    Level: beginner

 42: .seealso: SVDCreate(), SVDSetUp(), SVDDestroy()
 43: @*/
 44: PetscErrorCode SVDSolve(SVD svd)
 45: {
 46:   PetscErrorCode    ierr;
 47:   PetscBool         flg;
 48:   PetscInt          i,*workperm;
 49:   PetscViewer       viewer;
 50:   PetscViewerFormat format;
 51:   PetscErrorCode    (*which_func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);

 55:   PetscLogEventBegin(SVD_Solve,svd,0,0,0);

 57:   /* call setup */
 58:   SVDSetUp(svd);
 59:   svd->its = 0;
 60:   svd->nconv = 0;
 61:   for (i=0;i<svd->ncv;i++) {
 62:     svd->sigma[i]  = 0.0;
 63:     svd->errest[i] = 0.0;
 64:   }
 65:   SVDMonitor(svd,svd->its,svd->nconv,svd->sigma,svd->errest,svd->ncv);

 67:   which_func = (svd->which==SVD_LARGEST)? SlepcCompareLargestReal: SlepcCompareSmallestReal;
 68:   DSSetEigenvalueComparison(svd->ds,which_func,NULL);

 70:   (*svd->ops->solve)(svd);

 72:   /* sort singular triplets */
 73:   if (svd->which == SVD_SMALLEST) {
 74:     for (i=0;i<svd->nconv;i++) svd->perm[i] = i;
 75:     PetscSortRealWithPermutation(svd->nconv,svd->sigma,svd->perm);
 76:   } else {
 77:     PetscMalloc(sizeof(PetscInt)*svd->nconv,&workperm);
 78:     for (i=0;i<svd->nconv;i++) workperm[i] = i;
 79:     PetscSortRealWithPermutation(svd->nconv,svd->sigma,workperm);
 80:     for (i=0;i<svd->nconv;i++) svd->perm[i] = workperm[svd->nconv-i-1];
 81:     PetscFree(workperm);
 82:   }

 84:   PetscLogEventEnd(SVD_Solve,svd,0,0,0);

 86:   /* various viewers */
 87:   MatViewFromOptions(svd->OP,((PetscObject)svd)->prefix,"-svd_view_mat");

 89:   PetscOptionsGetViewer(PetscObjectComm((PetscObject)svd),((PetscObject)svd)->prefix,"-svd_view",&viewer,&format,&flg);
 90:   if (flg && !PetscPreLoadingOn) {
 91:     PetscViewerPushFormat(viewer,format);
 92:     SVDView(svd,viewer);
 93:     PetscViewerPopFormat(viewer);
 94:     PetscViewerDestroy(&viewer);
 95:   }

 97:   /* Remove the initial subspace */
 98:   svd->nini = 0;
 99:   return(0);
100: }

104: /*@
105:    SVDGetIterationNumber - Gets the current iteration number. If the
106:    call to SVDSolve() is complete, then it returns the number of iterations
107:    carried out by the solution method.

109:    Not Collective

111:    Input Parameter:
112: .  svd - the singular value solver context

114:    Output Parameter:
115: .  its - number of iterations

117:    Level: intermediate

119:    Notes:
120:       During the i-th iteration this call returns i-1. If SVDSolve() is
121:       complete, then parameter "its" contains either the iteration number at
122:       which convergence was successfully reached, or failure was detected.
123:       Call SVDGetConvergedReason() to determine if the solver converged or
124:       failed and why.

126: @*/
127: PetscErrorCode SVDGetIterationNumber(SVD svd,PetscInt *its)
128: {
132:   *its = svd->its;
133:   return(0);
134: }

138: /*@C
139:    SVDGetConvergedReason - Gets the reason why the SVDSolve() iteration was
140:    stopped.

142:    Not Collective

144:    Input Parameter:
145: .  svd - the singular value solver context

147:    Output Parameter:
148: .  reason - negative value indicates diverged, positive value converged
149:    (see SVDConvergedReason)

151:    Possible values for reason:
152: +  SVD_CONVERGED_TOL - converged up to tolerance
153: .  SVD_DIVERGED_ITS - required more than its to reach convergence
154: -  SVD_DIVERGED_BREAKDOWN - generic breakdown in method

156:    Level: intermediate

158:    Notes: Can only be called after the call to SVDSolve() is complete.

160: .seealso: SVDSetTolerances(), SVDSolve(), SVDConvergedReason
161: @*/
162: PetscErrorCode SVDGetConvergedReason(SVD svd,SVDConvergedReason *reason)
163: {
167:   *reason = svd->reason;
168:   return(0);
169: }

173: /*@
174:    SVDGetConverged - Gets the number of converged singular values.

176:    Not Collective

178:    Input Parameter:
179: .  svd - the singular value solver context

181:    Output Parameter:
182: .  nconv - number of converged singular values

184:    Note:
185:    This function should be called after SVDSolve() has finished.

187:    Level: beginner

189: @*/
190: PetscErrorCode SVDGetConverged(SVD svd,PetscInt *nconv)
191: {
195:   *nconv = svd->nconv;
196:   return(0);
197: }

201: /*@
202:    SVDGetSingularTriplet - Gets the i-th triplet of the singular value decomposition
203:    as computed by SVDSolve(). The solution consists in the singular value and its left
204:    and right singular vectors.

206:    Not Collective, but vectors are shared by all processors that share the SVD

208:    Input Parameters:
209: +  svd - singular value solver context
210: -  i   - index of the solution

212:    Output Parameters:
213: +  sigma - singular value
214: .  u     - left singular vector
215: -  v     - right singular vector

217:    Note:
218:    The index i should be a value between 0 and nconv-1 (see SVDGetConverged()).
219:    Both U or V can be NULL if singular vectors are not required.

221:    Level: beginner

223: .seealso: SVDSolve(),  SVDGetConverged()
224: @*/
225: PetscErrorCode SVDGetSingularTriplet(SVD svd,PetscInt i,PetscReal *sigma,Vec u,Vec v)
226: {
228:   PetscReal      norm;
229:   PetscInt       j,M,N;
230:   Vec            w;

236:   if (svd->reason == SVD_CONVERGED_ITERATING) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSolve must be called first");
237:   if (i<0 || i>=svd->nconv) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");
238:   *sigma = svd->sigma[svd->perm[i]];
239:   MatGetSize(svd->OP,&M,&N);
240:   if (M<N) { w = u; u = v; v = w; }
241:   if (u) {
242:     if (!svd->U) {
243:       VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);
244:       PetscLogObjectParents(svd,svd->ncv,svd->U);
245:       for (j=0;j<svd->nconv;j++) {
246:         SVDMatMult(svd,PETSC_FALSE,svd->V[j],svd->U[j]);
247:         IPOrthogonalize(svd->ip,0,NULL,j,NULL,svd->U,svd->U[j],NULL,&norm,NULL);
248:         VecScale(svd->U[j],1.0/norm);
249:       }
250:     }
251:     VecCopy(svd->U[svd->perm[i]],u);
252:   }
253:   if (v) {
254:     VecCopy(svd->V[svd->perm[i]],v);
255:   }
256:   return(0);
257: }

261: /*@
262:    SVDComputeResidualNorms - Computes the norms of the residual vectors associated with
263:    the i-th computed singular triplet.

265:    Collective on SVD

267:    Input Parameters:
268: +  svd  - the singular value solver context
269: -  i    - the solution index

271:    Output Parameters:
272: +  norm1 - the norm ||A*v-sigma*u||_2 where sigma is the
273:            singular value, u and v are the left and right singular vectors.
274: -  norm2 - the norm ||A^T*u-sigma*v||_2 with the same sigma, u and v

276:    Note:
277:    The index i should be a value between 0 and nconv-1 (see SVDGetConverged()).
278:    Both output parameters can be NULL on input if not needed.

280:    Level: beginner

282: .seealso: SVDSolve(), SVDGetConverged(), SVDComputeRelativeError()
283: @*/
284: PetscErrorCode SVDComputeResidualNorms(SVD svd,PetscInt i,PetscReal *norm1,PetscReal *norm2)
285: {
287:   Vec            u,v,x = NULL,y = NULL;
288:   PetscReal      sigma;
289:   PetscInt       M,N;

294:   if (svd->reason == SVD_CONVERGED_ITERATING) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSolve must be called first");
295:   if (i<0 || i>=svd->nconv) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range");

297:   MatGetVecs(svd->OP,&v,&u);
298:   SVDGetSingularTriplet(svd,i,&sigma,u,v);
299:   if (norm1) {
300:     VecDuplicate(u,&x);
301:     MatMult(svd->OP,v,x);
302:     VecAXPY(x,-sigma,u);
303:     VecNorm(x,NORM_2,norm1);
304:   }
305:   if (norm2) {
306:     VecDuplicate(v,&y);
307:     if (svd->A && svd->AT) {
308:       MatGetSize(svd->OP,&M,&N);
309:       if (M<N) {
310:         MatMult(svd->A,u,y);
311:       } else {
312:         MatMult(svd->AT,u,y);
313:       }
314:     } else {
315: #if defined(PETSC_USE_COMPLEX)
316:       MatMultHermitianTranspose(svd->OP,u,y);
317: #else
318:       MatMultTranspose(svd->OP,u,y);
319: #endif
320:     }
321:     VecAXPY(y,-sigma,v);
322:     VecNorm(y,NORM_2,norm2);
323:   }

325:   VecDestroy(&v);
326:   VecDestroy(&u);
327:   VecDestroy(&x);
328:   VecDestroy(&y);
329:   return(0);
330: }

334: /*@
335:    SVDComputeRelativeError - Computes the relative error bound associated
336:    with the i-th singular triplet.

338:    Collective on SVD

340:    Input Parameter:
341: +  svd - the singular value solver context
342: -  i   - the solution index

344:    Output Parameter:
345: .  error - the relative error bound, computed as sqrt(n1^2+n2^2)/sigma
346:    where n1 = ||A*v-sigma*u||_2 , n2 = ||A^T*u-sigma*v||_2 , sigma is the singular value,
347:    u and v are the left and right singular vectors.
348:    If sigma is too small the relative error is computed as sqrt(n1^2+n2^2).

350:    Level: beginner

352: .seealso: SVDSolve(), SVDComputeResidualNorms()
353: @*/
354: PetscErrorCode SVDComputeRelativeError(SVD svd,PetscInt i,PetscReal *error)
355: {
357:   PetscReal      sigma,norm1,norm2;

363:   SVDGetSingularTriplet(svd,i,&sigma,NULL,NULL);
364:   SVDComputeResidualNorms(svd,i,&norm1,&norm2);
365:   *error = PetscSqrtReal(norm1*norm1+norm2*norm2);
366:   if (sigma>*error) *error /= sigma;
367:   return(0);
368: }

372: /*@
373:    SVDGetOperationCounters - Gets the total number of matrix vector and dot
374:    products used by the SVD object during the last SVDSolve() call.

376:    Not Collective

378:    Input Parameter:
379: .  svd - SVD context

381:    Output Parameter:
382: +  matvecs - number of matrix vector product operations
383: -  dots    - number of dot product operations

385:    Notes:
386:    These counters are reset to zero at each successive call to SVDSolve().

388:    Level: intermediate

390: @*/
391: PetscErrorCode SVDGetOperationCounters(SVD svd,PetscInt* matvecs,PetscInt* dots)
392: {

397:   if (matvecs) *matvecs = svd->matvecs;
398:   if (dots) {
399:     if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
400:     IPGetOperationCounters(svd->ip,dots);
401:   }
402:   return(0);
403: }
slepc-3.4.2.dfsg.orig/src/svd/interface/svdopts.c0000644000175000017500000005421712211062077020635 0ustar gladkgladk/* SVD routines for setting solver options. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #undef __FUNCT__ #define __FUNCT__ "SVDSetTransposeMode" /*@ SVDSetTransposeMode - Sets how to handle the transpose of the matrix associated with the singular value problem. Logically Collective on SVD Input Parameters: + svd - the singular value solver context - mode - how to compute the transpose, one of SVD_TRANSPOSE_EXPLICIT or SVD_TRANSPOSE_IMPLICIT (see notes below) Options Database Key: . -svd_transpose_mode - Indicates the mode flag, where is one of 'explicit' or 'implicit'. Notes: In the SVD_TRANSPOSE_EXPLICIT mode, the transpose of the matrix is explicitly built. The option SVD_TRANSPOSE_IMPLICIT does not build the transpose, but handles it implicitly via MatMultTranspose() (or MatMultHermitianTranspose() in the complex case) operations. This is likely to be more inefficient than SVD_TRANSPOSE_EXPLICIT, both in sequential and in parallel, but requires less storage. The default is SVD_TRANSPOSE_EXPLICIT if the matrix has defined the MatTranspose operation, and SVD_TRANSPOSE_IMPLICIT otherwise. Level: advanced .seealso: SVDGetTransposeMode(), SVDSolve(), SVDSetOperator(), SVDGetOperator(), SVDTransposeMode @*/ PetscErrorCode SVDSetTransposeMode(SVD svd,SVDTransposeMode mode) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveEnum(svd,mode,2); if (mode == PETSC_DEFAULT || mode == PETSC_DECIDE) mode = (SVDTransposeMode)PETSC_DECIDE; else switch (mode) { case SVD_TRANSPOSE_EXPLICIT: case SVD_TRANSPOSE_IMPLICIT: if (svd->transmode!=mode) { svd->transmode = mode; svd->setupcalled = 0; } break; default: SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Invalid transpose mode"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetTransposeMode" /*@C SVDGetTransposeMode - Gets the mode used to compute the transpose of the matrix associated with the singular value problem. Not Collective Input Parameter: . svd - the singular value solver context Output paramter: . mode - how to compute the transpose, one of SVD_TRANSPOSE_EXPLICIT or SVD_TRANSPOSE_IMPLICIT Level: advanced .seealso: SVDSetTransposeMode(), SVDSolve(), SVDSetOperator(), SVDGetOperator(), SVDTransposeMode @*/ PetscErrorCode SVDGetTransposeMode(SVD svd,SVDTransposeMode *mode) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(mode,2); *mode = svd->transmode; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetTolerances" /*@ SVDSetTolerances - Sets the tolerance and maximum iteration count used by the default SVD convergence testers. Logically Collective on SVD Input Parameters: + svd - the singular value solver context . tol - the convergence tolerance - maxits - maximum number of iterations to use Options Database Keys: + -svd_tol - Sets the convergence tolerance - -svd_max_it - Sets the maximum number of iterations allowed (use PETSC_DECIDE to compute an educated guess based on basis and matrix sizes) Notes: Pass 0 to retain the previous value of any parameter. Level: intermediate .seealso: SVDGetTolerances() @*/ PetscErrorCode SVDSetTolerances(SVD svd,PetscReal tol,PetscInt maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveReal(svd,tol,2); PetscValidLogicalCollectiveInt(svd,maxits,3); if (tol) { if (tol == PETSC_DEFAULT) { tol = PETSC_DEFAULT; } else { if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0"); svd->tol = tol; } } if (maxits) { if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) { svd->max_it = 0; svd->setupcalled = 0; } else { if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0"); svd->max_it = maxits; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetTolerances" /*@ SVDGetTolerances - Gets the tolerance and maximum iteration count used by the default SVD convergence tests. Not Collective Input Parameter: . svd - the singular value solver context Output Parameters: + tol - the convergence tolerance - maxits - maximum number of iterations Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: SVDSetTolerances() @*/ PetscErrorCode SVDGetTolerances(SVD svd,PetscReal *tol,PetscInt *maxits) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (tol) *tol = svd->tol; if (maxits) *maxits = svd->max_it; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetDimensions" /*@ SVDSetDimensions - Sets the number of singular values to compute and the dimension of the subspace. Logically Collective on SVD Input Parameters: + svd - the singular value solver context . nsv - number of singular values to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Options Database Keys: + -svd_nsv - Sets the number of singular values . -svd_ncv - Sets the dimension of the subspace - -svd_mpd - Sets the maximum projected dimension Notes: Pass 0 to retain the previous value of any parameter. Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method and the number of singular values required. The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nsv is small, the user sets ncv (a reasonable default is 2*nsv); and (b) in cases where nsv is large, the user sets mpd. The value of ncv should always be between nsv and (nsv+mpd), typically ncv=nsv+mpd. If nev is not too large, mpd=nsv is a reasonable choice, otherwise a smaller value should be used. Level: intermediate .seealso: SVDGetDimensions() @*/ PetscErrorCode SVDSetDimensions(SVD svd,PetscInt nsv,PetscInt ncv,PetscInt mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveInt(svd,nsv,2); PetscValidLogicalCollectiveInt(svd,ncv,3); PetscValidLogicalCollectiveInt(svd,mpd,4); if (nsv) { if (nsv<1) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nsv. Must be > 0"); svd->nsv = nsv; } if (ncv) { if (ncv == PETSC_DEFAULT || ncv == PETSC_DECIDE) { svd->ncv = 0; } else { if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0"); svd->ncv = ncv; } svd->setupcalled = 0; } if (mpd) { if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) { svd->mpd = 0; } else { if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0"); svd->mpd = mpd; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetDimensions" /*@ SVDGetDimensions - Gets the number of singular values to compute and the dimension of the subspace. Not Collective Input Parameter: . svd - the singular value context Output Parameters: + nsv - number of singular values to compute . ncv - the maximum dimension of the subspace to be used by the solver - mpd - the maximum dimension allowed for the projected problem Notes: The user can specify NULL for any parameter that is not needed. Level: intermediate .seealso: SVDSetDimensions() @*/ PetscErrorCode SVDGetDimensions(SVD svd,PetscInt *nsv,PetscInt *ncv,PetscInt *mpd) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (nsv) *nsv = svd->nsv; if (ncv) *ncv = svd->ncv; if (mpd) *mpd = svd->mpd; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetWhichSingularTriplets" /*@ SVDSetWhichSingularTriplets - Specifies which singular triplets are to be sought. Logically Collective on SVD Input Parameter: . svd - singular value solver context obtained from SVDCreate() Output Parameter: . which - which singular triplets are to be sought Possible values: The parameter 'which' can have one of these values: + SVD_LARGEST - largest singular values - SVD_SMALLEST - smallest singular values Options Database Keys: + -svd_largest - Sets largest singular values - -svd_smallest - Sets smallest singular values Level: intermediate .seealso: SVDGetWhichSingularTriplets(), SVDWhich @*/ PetscErrorCode SVDSetWhichSingularTriplets(SVD svd,SVDWhich which) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveEnum(svd,which,2); switch (which) { case SVD_LARGEST: case SVD_SMALLEST: if (svd->which != which) { svd->setupcalled = 0; svd->which = which; } break; default: SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetWhichSingularTriplets" /*@C SVDGetWhichSingularTriplets - Returns which singular triplets are to be sought. Not Collective Input Parameter: . svd - singular value solver context obtained from SVDCreate() Output Parameter: . which - which singular triplets are to be sought Notes: See SVDSetWhichSingularTriplets() for possible values of which Level: intermediate .seealso: SVDSetWhichSingularTriplets(), SVDWhich @*/ PetscErrorCode SVDGetWhichSingularTriplets(SVD svd,SVDWhich *which) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(which,2); *which = svd->which; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetFromOptions" /*@ SVDSetFromOptions - Sets SVD options from the options database. This routine must be called before SVDSetUp() if the user is to be allowed to set the solver type. Collective on SVD Input Parameters: . svd - the singular value solver context Notes: To see all options, run your program with the -help option. Level: beginner .seealso: @*/ PetscErrorCode SVDSetFromOptions(SVD svd) { PetscErrorCode ierr; char type[256],monfilename[PETSC_MAX_PATH_LEN]; PetscBool flg; const char *mode_list[2] = {"explicit","implicit"}; PetscInt i,j,k; PetscReal r; PetscViewer monviewer; SlepcConvMonitor ctx; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); svd->setupcalled = 0; if (!SVDRegisterAllCalled) { ierr = SVDRegisterAll();CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)svd);CHKERRQ(ierr); ierr = PetscOptionsList("-svd_type","Singular Value Solver method","SVDSetType",SVDList,(char*)(((PetscObject)svd)->type_name?((PetscObject)svd)->type_name:SVDCROSS),type,256,&flg);CHKERRQ(ierr); if (flg) { ierr = SVDSetType(svd,type);CHKERRQ(ierr); } else if (!((PetscObject)svd)->type_name) { ierr = SVDSetType(svd,SVDCROSS);CHKERRQ(ierr); } ierr = PetscOptionsName("-svd_view","Print detailed information on solver used","SVDView",&flg);CHKERRQ(ierr); ierr = PetscOptionsEList("-svd_transpose_mode","Transpose SVD mode","SVDSetTransposeMode",mode_list,2,svd->transmode == PETSC_DECIDE ? "decide" : mode_list[svd->transmode],&i,&flg);CHKERRQ(ierr); if (flg) { ierr = SVDSetTransposeMode(svd,(SVDTransposeMode)i);CHKERRQ(ierr); } r = i = 0; ierr = PetscOptionsInt("-svd_max_it","Maximum number of iterations","SVDSetTolerances",svd->max_it,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsReal("-svd_tol","Tolerance","SVDSetTolerances",svd->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:svd->tol,&r,NULL);CHKERRQ(ierr); ierr = SVDSetTolerances(svd,r,i);CHKERRQ(ierr); i = j = k = 0; ierr = PetscOptionsInt("-svd_nsv","Number of singular values to compute","SVDSetDimensions",svd->nsv,&i,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-svd_ncv","Number of basis vectors","SVDSetDimensions",svd->ncv,&j,NULL);CHKERRQ(ierr); ierr = PetscOptionsInt("-svd_mpd","Maximum dimension of projected problem","SVDSetDimensions",svd->mpd,&k,NULL);CHKERRQ(ierr); ierr = SVDSetDimensions(svd,i,j,k);CHKERRQ(ierr); ierr = PetscOptionsBoolGroupBegin("-svd_largest","compute largest singular values","SVDSetWhichSingularTriplets",&flg);CHKERRQ(ierr); if (flg) { ierr = SVDSetWhichSingularTriplets(svd,SVD_LARGEST);CHKERRQ(ierr); } ierr = PetscOptionsBoolGroupEnd("-svd_smallest","compute smallest singular values","SVDSetWhichSingularTriplets",&flg);CHKERRQ(ierr); if (flg) { ierr = SVDSetWhichSingularTriplets(svd,SVD_SMALLEST);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-svd_monitor_cancel","Remove any hardwired monitor routines","SVDMonitorCancel",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = SVDMonitorCancel(svd);CHKERRQ(ierr); } ierr = PetscOptionsString("-svd_monitor_all","Monitor approximate singular values and error estimates","SVDMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)svd),monfilename,&monviewer);CHKERRQ(ierr); ierr = SVDMonitorSet(svd,SVDMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); ierr = SVDSetTrackAll(svd,PETSC_TRUE);CHKERRQ(ierr); } ierr = PetscOptionsString("-svd_monitor_conv","Monitor approximate singular values and error estimates as they converge","SVDMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);CHKERRQ(ierr); ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)svd),monfilename,&ctx->viewer);CHKERRQ(ierr); ierr = SVDMonitorSet(svd,SVDMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);CHKERRQ(ierr); } ierr = PetscOptionsString("-svd_monitor","Monitor first unconverged approximate singular value and error estimate","SVDMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr); if (flg) { ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)svd),monfilename,&monviewer);CHKERRQ(ierr); ierr = SVDMonitorSet(svd,SVDMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-svd_monitor_lg","Monitor first unconverged approximate singular value and error estimate graphically","SVDMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = SVDMonitorSet(svd,SVDMonitorLG,NULL,NULL);CHKERRQ(ierr); } flg = PETSC_FALSE; ierr = PetscOptionsBool("-svd_monitor_lg_all","Monitor error estimates graphically","SVDMonitorSet",flg,&flg,NULL);CHKERRQ(ierr); if (flg) { ierr = SVDMonitorSet(svd,SVDMonitorLGAll,NULL,NULL);CHKERRQ(ierr); ierr = SVDSetTrackAll(svd,PETSC_TRUE);CHKERRQ(ierr); } if (svd->ops->setfromoptions) { ierr = (*svd->ops->setfromoptions)(svd);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)svd);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = IPSetFromOptions(svd->ip);CHKERRQ(ierr); if (!svd->ds) { ierr = SVDGetDS(svd,&svd->ds);CHKERRQ(ierr); } ierr = DSSetFromOptions(svd->ds);CHKERRQ(ierr); ierr = PetscRandomSetFromOptions(svd->rand);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetTrackAll" /*@ SVDSetTrackAll - Specifies if the solver must compute the residual norm of all approximate singular value or not. Logically Collective on SVD Input Parameters: + svd - the singular value solver context - trackall - whether to compute all residuals or not Notes: If the user sets trackall=PETSC_TRUE then the solver computes (or estimates) the residual norm for each singular value approximation. Computing the residual is usually an expensive operation and solvers commonly compute only the residual associated to the first unconverged singular value. The options '-svd_monitor_all' and '-svd_monitor_lg_all' automatically activate this option. Level: intermediate .seealso: SVDGetTrackAll() @*/ PetscErrorCode SVDSetTrackAll(SVD svd,PetscBool trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveBool(svd,trackall,2); svd->trackall = trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetTrackAll" /*@ SVDGetTrackAll - Returns the flag indicating whether all residual norms must be computed or not. Not Collective Input Parameter: . svd - the singular value solver context Output Parameter: . trackall - the returned flag Level: intermediate .seealso: SVDSetTrackAll() @*/ PetscErrorCode SVDGetTrackAll(SVD svd,PetscBool *trackall) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(trackall,2); *trackall = svd->trackall; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetOptionsPrefix" /*@C SVDSetOptionsPrefix - Sets the prefix used for searching for all SVD options in the database. Logically Collective on SVD Input Parameters: + svd - the singular value solver context - prefix - the prefix string to prepend to all SVD option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different SVD contexts, one could call .vb SVDSetOptionsPrefix(svd1,"svd1_") SVDSetOptionsPrefix(svd2,"svd2_") .ve Level: advanced .seealso: SVDAppendOptionsPrefix(), SVDGetOptionsPrefix() @*/ PetscErrorCode SVDSetOptionsPrefix(SVD svd,const char *prefix) { PetscErrorCode ierr; PetscBool flg1,flg2; EPS eps; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(svd->ip,prefix);CHKERRQ(ierr); if (!svd->ds) { ierr = SVDGetDS(svd,&svd->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(svd->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectSetOptionsPrefix((PetscObject)svd,prefix);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)svd,SVDCROSS,&flg1);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)svd,SVDCYCLIC,&flg2);CHKERRQ(ierr); if (flg1) { ierr = SVDCrossGetEPS(svd,&eps);CHKERRQ(ierr); } else if (flg2) { ierr = SVDCyclicGetEPS(svd,&eps);CHKERRQ(ierr); } if (flg1 || flg2) { ierr = EPSSetOptionsPrefix(eps,prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(eps,"svd_");CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDAppendOptionsPrefix" /*@C SVDAppendOptionsPrefix - Appends to the prefix used for searching for all SVD options in the database. Logically Collective on SVD Input Parameters: + svd - the singular value solver context - prefix - the prefix string to prepend to all SVD option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: SVDSetOptionsPrefix(), SVDGetOptionsPrefix() @*/ PetscErrorCode SVDAppendOptionsPrefix(SVD svd,const char *prefix) { PetscErrorCode ierr; PetscBool flg1,flg2; EPS eps; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = IPSetOptionsPrefix(svd->ip,prefix);CHKERRQ(ierr); if (!svd->ds) { ierr = SVDGetDS(svd,&svd->ds);CHKERRQ(ierr); } ierr = DSSetOptionsPrefix(svd->ds,prefix);CHKERRQ(ierr); ierr = PetscObjectAppendOptionsPrefix((PetscObject)svd,prefix);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)svd,SVDCROSS,&flg1);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)svd,SVDCYCLIC,&flg2);CHKERRQ(ierr); if (flg1) { ierr = SVDCrossGetEPS(svd,&eps);CHKERRQ(ierr); } else if (flg2) { ierr = SVDCyclicGetEPS(svd,&eps);CHKERRQ(ierr); } if (flg1 || flg2) { ierr = EPSSetOptionsPrefix(eps,((PetscObject)svd)->prefix);CHKERRQ(ierr); ierr = EPSAppendOptionsPrefix(eps,"svd_");CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetOptionsPrefix" /*@C SVDGetOptionsPrefix - Gets the prefix used for searching for all SVD options in the database. Not Collective Input Parameters: . svd - the singular value solver context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: SVDSetOptionsPrefix(), SVDAppendOptionsPrefix() @*/ PetscErrorCode SVDGetOptionsPrefix(SVD svd,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)svd,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdsetup.c0000644000175000017500000002513712211062077021007 0ustar gladkgladk/* SVD routines for setting up the solver. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "SVDSetOperator" /*@ SVDSetOperator - Set the matrix associated with the singular value problem. Collective on SVD and Mat Input Parameters: + svd - the singular value solver context - A - the matrix associated with the singular value problem Level: beginner .seealso: SVDSolve(), SVDGetOperator() @*/ PetscErrorCode SVDSetOperator(SVD svd,Mat mat) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidHeaderSpecific(mat,MAT_CLASSID,2); PetscCheckSameComm(svd,1,mat,2); if (svd->setupcalled) { ierr = SVDReset(svd);CHKERRQ(ierr); } ierr = PetscObjectReference((PetscObject)mat);CHKERRQ(ierr); ierr = MatDestroy(&svd->OP);CHKERRQ(ierr); svd->OP = mat; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetOperator" /*@ SVDGetOperator - Get the matrix associated with the singular value problem. Not collective, though parallel Mats are returned if the SVD is parallel Input Parameter: . svd - the singular value solver context Output Parameters: . A - the matrix associated with the singular value problem Level: advanced .seealso: SVDSolve(), SVDSetOperator() @*/ PetscErrorCode SVDGetOperator(SVD svd,Mat *A) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(A,2); *A = svd->OP; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetUp" /*@ SVDSetUp - Sets up all the internal data structures necessary for the execution of the singular value solver. Collective on SVD Input Parameter: . svd - singular value solver context Level: advanced Notes: This function need not be called explicitly in most cases, since SVDSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time. .seealso: SVDCreate(), SVDSolve(), SVDDestroy() @*/ PetscErrorCode SVDSetUp(SVD svd) { PetscErrorCode ierr; PetscBool flg; PetscInt M,N,k; Vec *T; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (svd->setupcalled) PetscFunctionReturn(0); ierr = PetscLogEventBegin(SVD_SetUp,svd,0,0,0);CHKERRQ(ierr); /* reset the convergence flag from the previous solves */ svd->reason = SVD_CONVERGED_ITERATING; /* Set default solver type (SVDSetFromOptions was not called) */ if (!((PetscObject)svd)->type_name) { ierr = SVDSetType(svd,SVDCROSS);CHKERRQ(ierr); } if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } if (!((PetscObject)svd->ip)->type_name) { ierr = IPSetType_Default(svd->ip);CHKERRQ(ierr); } if (!svd->ds) { ierr = SVDGetDS(svd,&svd->ds);CHKERRQ(ierr); } ierr = DSReset(svd->ds);CHKERRQ(ierr); if (!((PetscObject)svd->rand)->type_name) { ierr = PetscRandomSetFromOptions(svd->rand);CHKERRQ(ierr); } /* check matrix */ if (!svd->OP) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSetOperator must be called first"); /* determine how to build the transpose */ if (svd->transmode == PETSC_DECIDE) { ierr = MatHasOperation(svd->OP,MATOP_TRANSPOSE,&flg);CHKERRQ(ierr); if (flg) svd->transmode = SVD_TRANSPOSE_EXPLICIT; else svd->transmode = SVD_TRANSPOSE_IMPLICIT; } /* build transpose matrix */ ierr = MatDestroy(&svd->A);CHKERRQ(ierr); ierr = MatDestroy(&svd->AT);CHKERRQ(ierr); ierr = MatGetSize(svd->OP,&M,&N);CHKERRQ(ierr); ierr = PetscObjectReference((PetscObject)svd->OP);CHKERRQ(ierr); switch (svd->transmode) { case SVD_TRANSPOSE_EXPLICIT: if (M>=N) { svd->A = svd->OP; ierr = MatTranspose(svd->OP,MAT_INITIAL_MATRIX,&svd->AT);CHKERRQ(ierr); ierr = MatConjugate(svd->AT);CHKERRQ(ierr); } else { ierr = MatTranspose(svd->OP,MAT_INITIAL_MATRIX,&svd->A);CHKERRQ(ierr); ierr = MatConjugate(svd->A);CHKERRQ(ierr); svd->AT = svd->OP; } break; case SVD_TRANSPOSE_IMPLICIT: if (M>=N) { svd->A = svd->OP; svd->AT = NULL; } else { svd->A = NULL; svd->AT = svd->OP; } break; default: SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Invalid transpose mode"); } ierr = VecDestroy(&svd->tr);CHKERRQ(ierr); ierr = VecDestroy(&svd->tl);CHKERRQ(ierr); if (svd->A) { ierr = SlepcMatGetVecsTemplate(svd->A,&svd->tr,&svd->tl);CHKERRQ(ierr); } else { ierr = SlepcMatGetVecsTemplate(svd->AT,&svd->tl,&svd->tr);CHKERRQ(ierr); } ierr = PetscLogObjectParent(svd,svd->tl);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,svd->tr);CHKERRQ(ierr); /* swap initial vectors if necessary */ if (MISL; svd->ISL=svd->IS; svd->IS=T; k=svd->ninil; svd->ninil=svd->nini; svd->nini=k; } /* call specific solver setup */ ierr = (*svd->ops->setup)(svd);CHKERRQ(ierr); /* set tolerance if not yet set */ if (svd->tol==PETSC_DEFAULT) svd->tol = SLEPC_DEFAULT_TOL; if (svd->ncv > M || svd->ncv > N) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"ncv bigger than matrix dimensions"); if (svd->nsv > svd->ncv) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"nsv bigger than ncv"); if (svd->ncv != svd->n) { /* free memory for previous solution */ if (svd->n) { ierr = PetscFree(svd->sigma);CHKERRQ(ierr); ierr = PetscFree(svd->perm);CHKERRQ(ierr); ierr = PetscFree(svd->errest);CHKERRQ(ierr); ierr = VecDestroyVecs(svd->n,&svd->V);CHKERRQ(ierr); } /* allocate memory for next solution */ ierr = PetscMalloc(svd->ncv*sizeof(PetscReal),&svd->sigma);CHKERRQ(ierr); ierr = PetscMalloc(svd->ncv*sizeof(PetscInt),&svd->perm);CHKERRQ(ierr); ierr = PetscMalloc(svd->ncv*sizeof(PetscReal),&svd->errest);CHKERRQ(ierr); ierr = PetscLogObjectMemory(svd,PetscMax(0,svd->ncv-svd->n)*(2*sizeof(PetscReal)+sizeof(PetscInt)));CHKERRQ(ierr); ierr = VecDuplicateVecs(svd->tr,svd->ncv,&svd->V);CHKERRQ(ierr); ierr = PetscLogObjectParents(svd,svd->ncv,svd->V);CHKERRQ(ierr); svd->n = svd->ncv; } /* process initial vectors */ if (svd->nini<0) { svd->nini = -svd->nini; if (svd->nini>svd->ncv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The number of initial vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(svd->ip,&svd->nini,&svd->IS,svd->V);CHKERRQ(ierr); } if (svd->ninil<0 && svd->U) { /* skip this if the solver is not using a left basis */ svd->ninil = -svd->ninil; if (svd->ninil>svd->ncv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The number of left initial vectors is larger than ncv"); ierr = IPOrthonormalizeBasis_Private(svd->ip,&svd->ninil,&svd->ISL,svd->U);CHKERRQ(ierr); } ierr = PetscLogEventEnd(SVD_SetUp,svd,0,0,0);CHKERRQ(ierr); svd->setupcalled = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetInitialSpace" /*@ SVDSetInitialSpace - Specify a basis of vectors that constitute the initial (right) space, that is, a rough approximation to the right singular subspace from which the solver starts to iterate. Collective on SVD and Vec Input Parameter: + svd - the singular value solver context . n - number of vectors - is - set of basis vectors of the initial space Notes: Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored. These vectors do not persist from one SVDSolve() call to the other, so the initial space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted singular space. Then, convergence may be faster. Level: intermediate @*/ PetscErrorCode SVDSetInitialSpace(SVD svd,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveInt(svd,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&svd->nini,&svd->IS);CHKERRQ(ierr); if (n>0) svd->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetInitialSpaceLeft" /*@ SVDSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial left space, that is, a rough approximation to the left singular subspace from which the solver starts to iterate. Collective on SVD and Vec Input Parameter: + svd - the singular value solver context . n - number of vectors - is - set of basis vectors of the initial space Notes: Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored. These vectors do not persist from one SVDSolve() call to the other, so the initial space should be set every time. The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally. Common usage of this function is when the user can provide a rough approximation of the wanted singular space. Then, convergence may be faster. Level: intermediate @*/ PetscErrorCode SVDSetInitialSpaceLeft(SVD svd,PetscInt n,Vec *is) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveInt(svd,n,2); if (n<0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative"); ierr = SlepcBasisReference_Private(n,is,&svd->ninil,&svd->ISL);CHKERRQ(ierr); if (n>0) svd->setupcalled = 0; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdbasic.c0000644000175000017500000005136212211062077020727 0ustar gladkgladk/* The basic SVD routines, Create, View, etc. are here. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ PetscFunctionList SVDList = 0; PetscBool SVDRegisterAllCalled = PETSC_FALSE; PetscClassId SVD_CLASSID = 0; PetscLogEvent SVD_SetUp = 0,SVD_Solve = 0; static PetscBool SVDPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "SVDFinalizePackage" /*@C SVDFinalizePackage - This function destroys everything in the Slepc interface to the SVD package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode SVDFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&SVDList);CHKERRQ(ierr); SVDPackageInitialized = PETSC_FALSE; SVDRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDInitializePackage" /*@C SVDInitializePackage - This function initializes everything in the SVD package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SVDCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode SVDInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (SVDPackageInitialized) PetscFunctionReturn(0); SVDPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Singular Value Solver",&SVD_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = SVDRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("SVDSetUp",SVD_CLASSID,&SVD_SetUp);CHKERRQ(ierr); ierr = PetscLogEventRegister("SVDSolve",SVD_CLASSID,&SVD_Solve);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"svd",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(SVD_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"svd",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(SVD_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(SVDFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDView" /*@C SVDView - Prints the SVD data structure. Collective on SVD Input Parameters: + svd - the singular value solver context - viewer - optional visualization context Options Database Key: . -svd_view - Calls SVDView() at end of SVDSolve() Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: STView(), PetscViewerASCIIOpen() @*/ PetscErrorCode SVDView(SVD svd,PetscViewer viewer) { PetscErrorCode ierr; PetscBool isascii,isshell; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(svd,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)svd,viewer,"SVD Object");CHKERRQ(ierr); if (svd->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*svd->ops->view)(svd,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } switch (svd->transmode) { case SVD_TRANSPOSE_EXPLICIT: ierr = PetscViewerASCIIPrintf(viewer," transpose mode: explicit\n");CHKERRQ(ierr); break; case SVD_TRANSPOSE_IMPLICIT: ierr = PetscViewerASCIIPrintf(viewer," transpose mode: implicit\n");CHKERRQ(ierr); break; default: ierr = PetscViewerASCIIPrintf(viewer," transpose mode: not yet set\n");CHKERRQ(ierr); } if (svd->which == SVD_LARGEST) { ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: largest\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: smallest\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," number of singular values (nsv): %D\n",svd->nsv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %D\n",svd->ncv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum dimension of projected problem (mpd): %D\n",svd->mpd);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %D\n",svd->max_it);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," tolerance: %G\n",svd->tol);CHKERRQ(ierr); if (svd->nini) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial space: %D\n",PetscAbs(svd->nini));CHKERRQ(ierr); } if (svd->ninil) { ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial left space: %D\n",PetscAbs(svd->ninil));CHKERRQ(ierr); } } else { if (svd->ops->view) { ierr = (*svd->ops->view)(svd,viewer);CHKERRQ(ierr); } } ierr = PetscObjectTypeCompareAny((PetscObject)svd,&isshell,SVDCROSS,SVDCYCLIC,"");CHKERRQ(ierr); if (!isshell) { if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = IPView(svd->ip,viewer);CHKERRQ(ierr); if (!svd->ds) { ierr = SVDGetDS(svd,&svd->ds);CHKERRQ(ierr); } ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr); ierr = DSView(svd->ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDPrintSolution" /*@ SVDPrintSolution - Prints the computed singular values. Collective on SVD Input Parameters: + svd - the singular value solver context - viewer - optional visualization context Options Database Key: . -svd_terse - print only minimal information Note: By default, this function prints a table with singular values and associated relative errors. With -svd_terse only the singular values are printed. Level: intermediate .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode SVDPrintSolution(SVD svd,PetscViewer viewer) { PetscBool terse,errok,isascii; PetscReal error,sigma; PetscInt i,j; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(svd,1,viewer,2); if (!svd->sigma) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSolve must be called first"); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (!isascii) PetscFunctionReturn(0); ierr = PetscOptionsHasName(NULL,"-svd_terse",&terse);CHKERRQ(ierr); if (terse) { if (svd->nconvnsv) { ierr = PetscViewerASCIIPrintf(viewer," Problem: less than %D singular values converged\n\n",svd->nsv);CHKERRQ(ierr); } else { errok = PETSC_TRUE; for (i=0;insv;i++) { ierr = SVDComputeRelativeError(svd,i,&error);CHKERRQ(ierr); errok = (errok && errortol)? PETSC_TRUE: PETSC_FALSE; } if (errok) { ierr = PetscViewerASCIIPrintf(viewer," All requested singular values computed up to the required tolerance:");CHKERRQ(ierr); for (i=0;i<=(svd->nsv-1)/8;i++) { ierr = PetscViewerASCIIPrintf(viewer,"\n ");CHKERRQ(ierr); for (j=0;jnsv-8*i);j++) { ierr = SVDGetSingularTriplet(svd,8*i+j,&sigma,NULL,NULL);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%.5F",sigma);CHKERRQ(ierr); if (8*i+j+1nsv) { ierr = PetscViewerASCIIPrintf(viewer,", ");CHKERRQ(ierr); } } } ierr = PetscViewerASCIIPrintf(viewer,"\n\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," Problem: some of the first %D relative errors are higher than the tolerance\n\n",svd->nsv);CHKERRQ(ierr); } } } else { ierr = PetscViewerASCIIPrintf(viewer," Number of converged approximate singular triplets: %D\n\n",svd->nconv);CHKERRQ(ierr); if (svd->nconv>0) { ierr = PetscViewerASCIIPrintf(viewer, " sigma relative error\n" " --------------------- ------------------\n");CHKERRQ(ierr); for (i=0;inconv;i++) { ierr = SVDGetSingularTriplet(svd,i,&sigma,NULL,NULL);CHKERRQ(ierr); ierr = SVDComputeRelativeError(svd,i,&error);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," % 6F %12G\n",sigma,error);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDCreate" /*@C SVDCreate - Creates the default SVD context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . svd - location to put the SVD context Note: The default SVD type is SVDCROSS Level: beginner .seealso: SVDSetUp(), SVDSolve(), SVDDestroy(), SVD @*/ PetscErrorCode SVDCreate(MPI_Comm comm,SVD *outsvd) { PetscErrorCode ierr; SVD svd; PetscFunctionBegin; PetscValidPointer(outsvd,2); *outsvd = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = SVDInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(svd,_p_SVD,struct _SVDOps,SVD_CLASSID,"SVD","Singular Value Decomposition","SVD",comm,SVDDestroy,SVDView);CHKERRQ(ierr); svd->OP = NULL; svd->ip = NULL; svd->ds = NULL; svd->A = NULL; svd->AT = NULL; svd->transmode = (SVDTransposeMode)PETSC_DECIDE; svd->sigma = NULL; svd->perm = NULL; svd->U = NULL; svd->V = NULL; svd->IS = NULL; svd->ISL = NULL; svd->tl = NULL; svd->tr = NULL; svd->rand = NULL; svd->which = SVD_LARGEST; svd->n = 0; svd->nconv = 0; svd->nsv = 1; svd->ncv = 0; svd->mpd = 0; svd->nini = 0; svd->ninil = 0; svd->its = 0; svd->max_it = 0; svd->tol = PETSC_DEFAULT; svd->errest = NULL; svd->data = NULL; svd->setupcalled = 0; svd->reason = SVD_CONVERGED_ITERATING; svd->numbermonitors = 0; svd->matvecs = 0; svd->trackall = PETSC_FALSE; ierr = PetscRandomCreate(comm,&svd->rand);CHKERRQ(ierr); ierr = PetscRandomSetSeed(svd->rand,0x12345678);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,svd->rand);CHKERRQ(ierr); *outsvd = svd; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDReset" /*@ SVDReset - Resets the SVD context to the setupcalled=0 state and removes any allocated objects. Collective on SVD Input Parameter: . svd - singular value solver context obtained from SVDCreate() Level: advanced .seealso: SVDDestroy() @*/ PetscErrorCode SVDReset(SVD svd) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (svd->ops->reset) { ierr = (svd->ops->reset)(svd);CHKERRQ(ierr); } if (svd->ip) { ierr = IPReset(svd->ip);CHKERRQ(ierr); } if (svd->ds) { ierr = DSReset(svd->ds);CHKERRQ(ierr); } ierr = MatDestroy(&svd->OP);CHKERRQ(ierr); ierr = MatDestroy(&svd->A);CHKERRQ(ierr); ierr = MatDestroy(&svd->AT);CHKERRQ(ierr); ierr = VecDestroy(&svd->tl);CHKERRQ(ierr); ierr = VecDestroy(&svd->tr);CHKERRQ(ierr); if (svd->n) { ierr = PetscFree(svd->sigma);CHKERRQ(ierr); ierr = PetscFree(svd->perm);CHKERRQ(ierr); ierr = PetscFree(svd->errest);CHKERRQ(ierr); ierr = VecDestroyVecs(svd->n,&svd->U);CHKERRQ(ierr); ierr = VecDestroyVecs(svd->n,&svd->V);CHKERRQ(ierr); } svd->transmode = (SVDTransposeMode)PETSC_DECIDE; svd->matvecs = 0; svd->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDDestroy" /*@C SVDDestroy - Destroys the SVD context. Collective on SVD Input Parameter: . svd - singular value solver context obtained from SVDCreate() Level: beginner .seealso: SVDCreate(), SVDSetUp(), SVDSolve() @*/ PetscErrorCode SVDDestroy(SVD *svd) { PetscErrorCode ierr; PetscFunctionBegin; if (!*svd) PetscFunctionReturn(0); PetscValidHeaderSpecific(*svd,SVD_CLASSID,1); if (--((PetscObject)(*svd))->refct > 0) { *svd = 0; PetscFunctionReturn(0); } ierr = SVDReset(*svd);CHKERRQ(ierr); if ((*svd)->ops->destroy) { ierr = (*(*svd)->ops->destroy)(*svd);CHKERRQ(ierr); } ierr = IPDestroy(&(*svd)->ip);CHKERRQ(ierr); ierr = DSDestroy(&(*svd)->ds);CHKERRQ(ierr); /* just in case the initial vectors have not been used */ ierr = SlepcBasisDestroy_Private(&(*svd)->nini,&(*svd)->IS);CHKERRQ(ierr); ierr = SlepcBasisDestroy_Private(&(*svd)->ninil,&(*svd)->ISL);CHKERRQ(ierr); ierr = PetscRandomDestroy(&(*svd)->rand);CHKERRQ(ierr); ierr = SVDMonitorCancel(*svd);CHKERRQ(ierr); ierr = PetscHeaderDestroy(svd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetType" /*@C SVDSetType - Selects the particular solver to be used in the SVD object. Logically Collective on SVD Input Parameters: + svd - the singular value solver context - type - a known method Options Database Key: . -svd_type - Sets the method; use -help for a list of available methods Notes: See "slepc/include/slepcsvd.h" for available methods. The default is SVDCROSS. Normally, it is best to use the SVDSetFromOptions() command and then set the SVD type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The SVDSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database. Level: intermediate .seealso: SVDType @*/ PetscErrorCode SVDSetType(SVD svd,SVDType type) { PetscErrorCode ierr,(*r)(SVD); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)svd,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(SVDList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown SVD type given: %s",type); if (svd->ops->destroy) { ierr = (*svd->ops->destroy)(svd);CHKERRQ(ierr); } ierr = PetscMemzero(svd->ops,sizeof(struct _SVDOps));CHKERRQ(ierr); svd->setupcalled = 0; ierr = PetscObjectChangeTypeName((PetscObject)svd,type);CHKERRQ(ierr); ierr = (*r)(svd);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetType" /*@C SVDGetType - Gets the SVD type as a string from the SVD object. Not Collective Input Parameter: . svd - the singular value solver context Output Parameter: . name - name of SVD method Level: intermediate .seealso: SVDSetType() @*/ PetscErrorCode SVDGetType(SVD svd,SVDType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)svd)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDRegister" /*@C SVDRegister - Adds a method to the singular value solver package. Not Collective Input Parameters: + name - name of a new user-defined solver - function - routine to create the solver context Notes: SVDRegister() may be called multiple times to add several user-defined solvers. Sample usage: .vb SVDRegister("my_solver",MySolverCreate); .ve Then, your solver can be chosen with the procedural interface via $ SVDSetType(svd,"my_solver") or at runtime via the option $ -svd_type my_solver Level: advanced .seealso: SVDRegisterAll() @*/ PetscErrorCode SVDRegister(const char *name,PetscErrorCode (*function)(SVD)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&SVDList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetIP" /*@ SVDSetIP - Associates an inner product object to the singular value solver. Collective on SVD Input Parameters: + svd - singular value solver context obtained from SVDCreate() - ip - the inner product object Note: Use SVDGetIP() to retrieve the inner product context (for example, to free it at the end of the computations). Level: advanced .seealso: SVDGetIP() @*/ PetscErrorCode SVDSetIP(SVD svd,IP ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidHeaderSpecific(ip,IP_CLASSID,2); PetscCheckSameComm(svd,1,ip,2); ierr = PetscObjectReference((PetscObject)ip);CHKERRQ(ierr); ierr = IPDestroy(&svd->ip);CHKERRQ(ierr); svd->ip = ip; ierr = PetscLogObjectParent(svd,svd->ip);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetIP" /*@C SVDGetIP - Obtain the inner product object associated to the singular value solver object. Not Collective Input Parameters: . svd - singular value solver context obtained from SVDCreate() Output Parameter: . ip - inner product context Level: advanced .seealso: SVDSetIP() @*/ PetscErrorCode SVDGetIP(SVD svd,IP *ip) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(ip,2); if (!svd->ip) { ierr = IPCreate(PetscObjectComm((PetscObject)svd),&svd->ip);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,svd->ip);CHKERRQ(ierr); } *ip = svd->ip; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDSetDS" /*@ SVDSetDS - Associates a direct solver object to the singular value solver. Collective on SVD Input Parameters: + svd - singular value solver context obtained from SVDCreate() - ds - the direct solver object Note: Use SVDGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations). Level: advanced .seealso: SVDGetDS() @*/ PetscErrorCode SVDSetDS(SVD svd,DS ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidHeaderSpecific(ds,DS_CLASSID,2); PetscCheckSameComm(svd,1,ds,2); ierr = PetscObjectReference((PetscObject)ds);CHKERRQ(ierr); ierr = DSDestroy(&svd->ds);CHKERRQ(ierr); svd->ds = ds; ierr = PetscLogObjectParent(svd,svd->ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetDS" /*@C SVDGetDS - Obtain the direct solver object associated to the singular value solver object. Not Collective Input Parameters: . svd - singular value solver context obtained from SVDCreate() Output Parameter: . ds - direct solver context Level: advanced .seealso: SVDSetDS() @*/ PetscErrorCode SVDGetDS(SVD svd,DS *ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidPointer(ds,2); if (!svd->ds) { ierr = DSCreate(PetscObjectComm((PetscObject)svd),&svd->ds);CHKERRQ(ierr); ierr = PetscLogObjectParent(svd,svd->ds);CHKERRQ(ierr); } *ds = svd->ds; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdmon.c0000644000175000017500000003317412211062077020440 0ustar gladkgladk/* SVD routines related to monitors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "SVDMonitor" /* Runs the user provided monitor routines, if any. */ PetscErrorCode SVDMonitor(SVD svd,PetscInt it,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest) { PetscErrorCode ierr; PetscInt i,n = svd->numbermonitors; PetscFunctionBegin; for (i=0;imonitor[i])(svd,it,nconv,sigma,errest,nest,svd->monitorcontext[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorSet" /*@C SVDMonitorSet - Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested singular triplet. Collective on SVD Input Parameters: + svd - singular value solver context obtained from SVDCreate() . monitor - pointer to function (if this is NULL, it turns off monitoring) - mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired) Calling Sequence of monitor: $ monitor (SVD svd, PetscInt its, PetscInt nconv, PetscReal *sigma, PetscReal* errest, PetscInt nest, void *mctx) + svd - singular value solver context obtained from SVDCreate() . its - iteration number . nconv - number of converged singular triplets . sigma - singular values . errest - relative error estimates for each singular triplet . nest - number of error estimates - mctx - optional monitoring context, as set by SVDMonitorSet() Options Database Keys: + -svd_monitor - print only the first error estimate . -svd_monitor_all - print error estimates at each iteration . -svd_monitor_conv - print the singular value approximations only when convergence has been reached . -svd_monitor_lg - sets line graph monitor for the first unconverged approximate singular value . -svd_monitor_lg_all - sets line graph monitor for all unconverged approximate singular values - -svd_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to SVDMonitorSet(), but does not cancel those set via the options database. Notes: Several different monitoring routines may be set by calling SVDMonitorSet() multiple times; all will be called in the order in which they were set. Level: intermediate .seealso: SVDMonitorFirst(), SVDMonitorAll(), SVDMonitorCancel() @*/ PetscErrorCode SVDMonitorSet(SVD svd,PetscErrorCode (*monitor)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**)) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (svd->numbermonitors >= MAXSVDMONITORS) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Too many SVD monitors set"); svd->monitor[svd->numbermonitors] = monitor; svd->monitorcontext[svd->numbermonitors] = (void*)mctx; svd->monitordestroy[svd->numbermonitors++] = monitordestroy; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorCancel" /*@ SVDMonitorCancel - Clears all monitors for an SVD object. Collective on SVD Input Parameters: . svd - singular value solver context obtained from SVDCreate() Options Database Key: . -svd_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to SVDMonitorSet(), but does not cancel those set via the options database. Level: intermediate .seealso: SVDMonitorSet() @*/ PetscErrorCode SVDMonitorCancel(SVD svd) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); for (i=0; inumbermonitors; i++) { if (svd->monitordestroy[i]) { ierr = (*svd->monitordestroy[i])(&svd->monitorcontext[i]);CHKERRQ(ierr); } } svd->numbermonitors = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetMonitorContext" /*@C SVDGetMonitorContext - Gets the monitor context, as set by SVDMonitorSet() for the FIRST monitor only. Not Collective Input Parameter: . svd - singular value solver context obtained from SVDCreate() Output Parameter: . ctx - monitor context Level: intermediate .seealso: SVDMonitorSet() @*/ PetscErrorCode SVDGetMonitorContext(SVD svd,void **ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); *ctx = svd->monitorcontext[0]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorAll" /*@C SVDMonitorAll - Print the current approximate values and error estimates at each iteration of the singular value solver. Collective on SVD Input Parameters: + svd - singular value solver context . its - iteration number . nconv - number of converged singular triplets so far . sigma - singular values . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorConverged() @*/ PetscErrorCode SVDMonitorAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd)); PetscFunctionBegin; if (its) { ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D SVD nconv=%D Values (Errors)",its,nconv);CHKERRQ(ierr); for (i=0;itablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorFirst" /*@C SVDMonitorFirst - Print the first unconverged approximate values and error estimates at each iteration of the singular value solver. Collective on SVD Input Parameters: + svd - singular value solver context . its - iteration number . nconv - number of converged singular triplets so far . sigma - singular values . errest - error estimates . nest - number of error estimates to display - monctx - monitor context (contains viewer, can be NULL) Level: intermediate .seealso: SVDMonitorSet(), SVDMonitorAll(), SVDMonitorConverged() @*/ PetscErrorCode SVDMonitorFirst(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd)); PetscFunctionBegin; if (its && nconvtablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D SVD nconv=%D first unconverged value (error)",its,nconv);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," %G (%10.8e)\n",sigma[nconv],(double)errest[nconv]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorConverged" /*@C SVDMonitorConverged - Print the approximate values and error estimates as they converge. Collective on SVD Input Parameters: + svd - singular value solver context . its - iteration number . nconv - number of converged singular triplets so far . sigma - singular values . errest - error estimates . nest - number of error estimates to display - monctx - monitor context Note: The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT. Level: intermediate .seealso: SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorAll() @*/ PetscErrorCode SVDMonitorConverged(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx) { PetscErrorCode ierr; PetscInt i; PetscViewer viewer; SlepcConvMonitor ctx = (SlepcConvMonitor)monctx; PetscFunctionBegin; if (!monctx) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONG,"Must provide a context for SVDMonitorConverged"); if (!its) { ctx->oldnconv = 0; } else { viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd)); for (i=ctx->oldnconv;itablevel);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%3D SVD converged value (error) #%D",its,i);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," %G (%10.8e)\n",sigma[i],(double)errest[i]);CHKERRQ(ierr); ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr); } ctx->oldnconv = nconv; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorLG" PetscErrorCode SVDMonitorLG(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw,draw1; PetscDrawLG lg,lg1; PetscErrorCode ierr; PetscReal x,y,p; PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)svd)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); ierr = PetscViewerDrawGetDraw(viewer,1,&draw1);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,1,&lg1);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(svd->tol)-2,0.0);CHKERRQ(ierr); ierr = PetscDrawSetTitle(draw1,"Approximate singular values");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw1);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg1,1);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg1);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);CHKERRQ(ierr); } x = (PetscReal)its; if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0; ierr = PetscDrawLGAddPoint(lg,&x,&y);CHKERRQ(ierr); ierr = PetscDrawLGAddPoint(lg1,&x,svd->sigma);CHKERRQ(ierr); ierr = PetscDrawGetPause(draw1,&p);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,0);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg1);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,p);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMonitorLGAll" PetscErrorCode SVDMonitorLGAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx) { PetscViewer viewer = (PetscViewer)monctx; PetscDraw draw,draw1; PetscDrawLG lg,lg1; PetscErrorCode ierr; PetscReal *x,*y,p; PetscInt i,n = PetscMin(svd->nsv,255); PetscFunctionBegin; if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)svd)); ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr); ierr = PetscViewerDrawGetDraw(viewer,1,&draw1);CHKERRQ(ierr); ierr = PetscViewerDrawGetDrawLG(viewer,1,&lg1);CHKERRQ(ierr); if (!its) { ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg,n);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(svd->tol)-2,0.0);CHKERRQ(ierr); ierr = PetscDrawSetTitle(draw1,"Approximate singular values");CHKERRQ(ierr); ierr = PetscDrawSetDoubleBuffer(draw1);CHKERRQ(ierr); ierr = PetscDrawLGSetDimension(lg1,n);CHKERRQ(ierr); ierr = PetscDrawLGReset(lg1);CHKERRQ(ierr); ierr = PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);CHKERRQ(ierr); } ierr = PetscMalloc(sizeof(PetscReal)*n,&x);CHKERRQ(ierr); ierr = PetscMalloc(sizeof(PetscReal)*n,&y);CHKERRQ(ierr); for (i=0;i 0.0) y[i] = log10(errest[i]); else y[i] = 0.0; } ierr = PetscDrawLGAddPoint(lg,x,y);CHKERRQ(ierr); ierr = PetscDrawLGAddPoint(lg1,x,svd->sigma);CHKERRQ(ierr); ierr = PetscDrawGetPause(draw1,&p);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,0);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg1);CHKERRQ(ierr); ierr = PetscDrawSetPause(draw1,p);CHKERRQ(ierr); ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr); ierr = PetscFree(x);CHKERRQ(ierr); ierr = PetscFree(y);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdbasic.c.html0000644000175000017500000014122512211062077021670 0ustar gladkgladk
Actual source code: svdbasic.c

  1: /*
  2:      The basic SVD routines, Create, View, etc. are here.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>      /*I "slepcsvd.h" I*/

 26: PetscFunctionList SVDList = 0;
 27: PetscBool         SVDRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      SVD_CLASSID = 0;
 29: PetscLogEvent     SVD_SetUp = 0,SVD_Solve = 0;
 30: static PetscBool  SVDPackageInitialized = PETSC_FALSE;

 34: /*@C
 35:    SVDFinalizePackage - This function destroys everything in the Slepc interface
 36:    to the SVD package. It is called from SlepcFinalize().

 38:    Level: developer

 40: .seealso: SlepcFinalize()
 41: @*/
 42: PetscErrorCode SVDFinalizePackage(void)
 43: {

 47:   PetscFunctionListDestroy(&SVDList);
 48:   SVDPackageInitialized = PETSC_FALSE;
 49:   SVDRegisterAllCalled  = PETSC_FALSE;
 50:   return(0);
 51: }

 55: /*@C
 56:    SVDInitializePackage - This function initializes everything in the SVD package. It is called
 57:    from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SVDCreate()
 58:    when using static libraries.

 60:    Level: developer

 62: .seealso: SlepcInitialize()
 63: @*/
 64: PetscErrorCode SVDInitializePackage(void)
 65: {
 66:   char           logList[256];
 67:   char           *className;
 68:   PetscBool      opt;

 72:   if (SVDPackageInitialized) return(0);
 73:   SVDPackageInitialized = PETSC_TRUE;
 74:   /* Register Classes */
 75:   PetscClassIdRegister("Singular Value Solver",&SVD_CLASSID);
 76:   /* Register Constructors */
 77:   SVDRegisterAll();
 78:   /* Register Events */
 79:   PetscLogEventRegister("SVDSetUp",SVD_CLASSID,&SVD_SetUp);
 80:   PetscLogEventRegister("SVDSolve",SVD_CLASSID,&SVD_Solve);
 81:   /* Process info exclusions */
 82:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 83:   if (opt) {
 84:     PetscStrstr(logList,"svd",&className);
 85:     if (className) {
 86:       PetscInfoDeactivateClass(SVD_CLASSID);
 87:     }
 88:   }
 89:   /* Process summary exclusions */
 90:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 91:   if (opt) {
 92:     PetscStrstr(logList,"svd",&className);
 93:     if (className) {
 94:       PetscLogEventDeactivateClass(SVD_CLASSID);
 95:     }
 96:   }
 97:   PetscRegisterFinalize(SVDFinalizePackage);
 98:   return(0);
 99: }

103: /*@C
104:    SVDView - Prints the SVD data structure.

106:    Collective on SVD

108:    Input Parameters:
109: +  svd - the singular value solver context
110: -  viewer - optional visualization context

112:    Options Database Key:
113: .  -svd_view -  Calls SVDView() at end of SVDSolve()

115:    Note:
116:    The available visualization contexts include
117: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
118: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
119:          output where only the first processor opens
120:          the file.  All other processors send their
121:          data to the first processor to print.

123:    The user can open an alternative visualization context with
124:    PetscViewerASCIIOpen() - output to a specified file.

126:    Level: beginner

128: .seealso: STView(), PetscViewerASCIIOpen()
129: @*/
130: PetscErrorCode SVDView(SVD svd,PetscViewer viewer)
131: {
133:   PetscBool      isascii,isshell;

137:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd));

141:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
142:   if (isascii) {
143:     PetscObjectPrintClassNamePrefixType((PetscObject)svd,viewer,"SVD Object");
144:     if (svd->ops->view) {
145:       PetscViewerASCIIPushTab(viewer);
146:       (*svd->ops->view)(svd,viewer);
147:       PetscViewerASCIIPopTab(viewer);
148:     }
149:     switch (svd->transmode) {
150:       case SVD_TRANSPOSE_EXPLICIT:
151:         PetscViewerASCIIPrintf(viewer,"  transpose mode: explicit\n");
152:         break;
153:       case SVD_TRANSPOSE_IMPLICIT:
154:         PetscViewerASCIIPrintf(viewer,"  transpose mode: implicit\n");
155:         break;
156:       default:
157:         PetscViewerASCIIPrintf(viewer,"  transpose mode: not yet set\n");
158:     }
159:     if (svd->which == SVD_LARGEST) {
160:       PetscViewerASCIIPrintf(viewer,"  selected portion of the spectrum: largest\n");
161:     } else {
162:       PetscViewerASCIIPrintf(viewer,"  selected portion of the spectrum: smallest\n");
163:     }
164:     PetscViewerASCIIPrintf(viewer,"  number of singular values (nsv): %D\n",svd->nsv);
165:     PetscViewerASCIIPrintf(viewer,"  number of column vectors (ncv): %D\n",svd->ncv);
166:     PetscViewerASCIIPrintf(viewer,"  maximum dimension of projected problem (mpd): %D\n",svd->mpd);
167:     PetscViewerASCIIPrintf(viewer,"  maximum number of iterations: %D\n",svd->max_it);
168:     PetscViewerASCIIPrintf(viewer,"  tolerance: %G\n",svd->tol);
169:     if (svd->nini) {
170:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial space: %D\n",PetscAbs(svd->nini));
171:     }
172:     if (svd->ninil) {
173:       PetscViewerASCIIPrintf(viewer,"  dimension of user-provided initial left space: %D\n",PetscAbs(svd->ninil));
174:     }
175:   } else {
176:     if (svd->ops->view) {
177:       (*svd->ops->view)(svd,viewer);
178:     }
179:   }
180:   PetscObjectTypeCompareAny((PetscObject)svd,&isshell,SVDCROSS,SVDCYCLIC,"");
181:   if (!isshell) {
182:     if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
183:     IPView(svd->ip,viewer);
184:     if (!svd->ds) { SVDGetDS(svd,&svd->ds); }
185:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);
186:     DSView(svd->ds,viewer);
187:     PetscViewerPopFormat(viewer);
188:   }
189:   return(0);
190: }

194: /*@
195:    SVDPrintSolution - Prints the computed singular values.

197:    Collective on SVD

199:    Input Parameters:
200: +  svd - the singular value solver context
201: -  viewer - optional visualization context

203:    Options Database Key:
204: .  -svd_terse - print only minimal information

206:    Note:
207:    By default, this function prints a table with singular values and associated
208:    relative errors. With -svd_terse only the singular values are printed.

210:    Level: intermediate

212: .seealso: PetscViewerASCIIOpen()
213: @*/
214: PetscErrorCode SVDPrintSolution(SVD svd,PetscViewer viewer)
215: {
216:   PetscBool      terse,errok,isascii;
217:   PetscReal      error,sigma;
218:   PetscInt       i,j;

223:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd));
226:   if (!svd->sigma) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSolve must be called first");
227:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
228:   if (!isascii) return(0);

230:   PetscOptionsHasName(NULL,"-svd_terse",&terse);
231:   if (terse) {
232:     if (svd->nconv<svd->nsv) {
233:       PetscViewerASCIIPrintf(viewer," Problem: less than %D singular values converged\n\n",svd->nsv);
234:     } else {
235:       errok = PETSC_TRUE;
236:       for (i=0;i<svd->nsv;i++) {
237:         SVDComputeRelativeError(svd,i,&error);
238:         errok = (errok && error<svd->tol)? PETSC_TRUE: PETSC_FALSE;
239:       }
240:       if (errok) {
241:         PetscViewerASCIIPrintf(viewer," All requested singular values computed up to the required tolerance:");
242:         for (i=0;i<=(svd->nsv-1)/8;i++) {
243:           PetscViewerASCIIPrintf(viewer,"\n     ");
244:           for (j=0;j<PetscMin(8,svd->nsv-8*i);j++) {
245:             SVDGetSingularTriplet(svd,8*i+j,&sigma,NULL,NULL);
246:             PetscViewerASCIIPrintf(viewer,"%.5F",sigma);
247:             if (8*i+j+1<svd->nsv) { PetscViewerASCIIPrintf(viewer,", "); }
248:           }
249:         }
250:         PetscViewerASCIIPrintf(viewer,"\n\n");
251:       } else {
252:         PetscViewerASCIIPrintf(viewer," Problem: some of the first %D relative errors are higher than the tolerance\n\n",svd->nsv);
253:       }
254:     }
255:   } else {
256:     PetscViewerASCIIPrintf(viewer," Number of converged approximate singular triplets: %D\n\n",svd->nconv);
257:     if (svd->nconv>0) {
258:       PetscViewerASCIIPrintf(viewer,
259:            "          sigma            relative error\n"
260:            "   --------------------- ------------------\n");
261:       for (i=0;i<svd->nconv;i++) {
262:         SVDGetSingularTriplet(svd,i,&sigma,NULL,NULL);
263:         SVDComputeRelativeError(svd,i,&error);
264:         PetscViewerASCIIPrintf(viewer,"       % 6F          %12G\n",sigma,error);
265:       }
266:       PetscViewerASCIIPrintf(viewer,"\n");
267:     }
268:   }
269:   return(0);
270: }

274: /*@C
275:    SVDCreate - Creates the default SVD context.

277:    Collective on MPI_Comm

279:    Input Parameter:
280: .  comm - MPI communicator

282:    Output Parameter:
283: .  svd - location to put the SVD context

285:    Note:
286:    The default SVD type is SVDCROSS

288:    Level: beginner

290: .seealso: SVDSetUp(), SVDSolve(), SVDDestroy(), SVD
291: @*/
292: PetscErrorCode SVDCreate(MPI_Comm comm,SVD *outsvd)
293: {
295:   SVD            svd;

299:   *outsvd = 0;
300: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
301:   SVDInitializePackage();
302: #endif

304:   SlepcHeaderCreate(svd,_p_SVD,struct _SVDOps,SVD_CLASSID,"SVD","Singular Value Decomposition","SVD",comm,SVDDestroy,SVDView);

306:   svd->OP             = NULL;
307:   svd->ip             = NULL;
308:   svd->ds             = NULL;
309:   svd->A              = NULL;
310:   svd->AT             = NULL;
311:   svd->transmode      = (SVDTransposeMode)PETSC_DECIDE;
312:   svd->sigma          = NULL;
313:   svd->perm           = NULL;
314:   svd->U              = NULL;
315:   svd->V              = NULL;
316:   svd->IS             = NULL;
317:   svd->ISL            = NULL;
318:   svd->tl             = NULL;
319:   svd->tr             = NULL;
320:   svd->rand           = NULL;
321:   svd->which          = SVD_LARGEST;
322:   svd->n              = 0;
323:   svd->nconv          = 0;
324:   svd->nsv            = 1;
325:   svd->ncv            = 0;
326:   svd->mpd            = 0;
327:   svd->nini           = 0;
328:   svd->ninil          = 0;
329:   svd->its            = 0;
330:   svd->max_it         = 0;
331:   svd->tol            = PETSC_DEFAULT;
332:   svd->errest         = NULL;
333:   svd->data           = NULL;
334:   svd->setupcalled    = 0;
335:   svd->reason         = SVD_CONVERGED_ITERATING;
336:   svd->numbermonitors = 0;
337:   svd->matvecs        = 0;
338:   svd->trackall       = PETSC_FALSE;

340:   PetscRandomCreate(comm,&svd->rand);
341:   PetscRandomSetSeed(svd->rand,0x12345678);
342:   PetscLogObjectParent(svd,svd->rand);
343:   *outsvd = svd;
344:   return(0);
345: }

349: /*@
350:    SVDReset - Resets the SVD context to the setupcalled=0 state and removes any
351:    allocated objects.

353:    Collective on SVD

355:    Input Parameter:
356: .  svd - singular value solver context obtained from SVDCreate()

358:    Level: advanced

360: .seealso: SVDDestroy()
361: @*/
362: PetscErrorCode SVDReset(SVD svd)
363: {

368:   if (svd->ops->reset) { (svd->ops->reset)(svd); }
369:   if (svd->ip) { IPReset(svd->ip); }
370:   if (svd->ds) { DSReset(svd->ds); }
371:   MatDestroy(&svd->OP);
372:   MatDestroy(&svd->A);
373:   MatDestroy(&svd->AT);
374:   VecDestroy(&svd->tl);
375:   VecDestroy(&svd->tr);
376:   if (svd->n) {
377:     PetscFree(svd->sigma);
378:     PetscFree(svd->perm);
379:     PetscFree(svd->errest);
380:     VecDestroyVecs(svd->n,&svd->U);
381:     VecDestroyVecs(svd->n,&svd->V);
382:   }
383:   svd->transmode   = (SVDTransposeMode)PETSC_DECIDE;
384:   svd->matvecs     = 0;
385:   svd->setupcalled = 0;
386:   return(0);
387: }

391: /*@C
392:    SVDDestroy - Destroys the SVD context.

394:    Collective on SVD

396:    Input Parameter:
397: .  svd - singular value solver context obtained from SVDCreate()

399:    Level: beginner

401: .seealso: SVDCreate(), SVDSetUp(), SVDSolve()
402: @*/
403: PetscErrorCode SVDDestroy(SVD *svd)
404: {

408:   if (!*svd) return(0);
410:   if (--((PetscObject)(*svd))->refct > 0) { *svd = 0; return(0); }
411:   SVDReset(*svd);
412:   if ((*svd)->ops->destroy) { (*(*svd)->ops->destroy)(*svd); }
413:   IPDestroy(&(*svd)->ip);
414:   DSDestroy(&(*svd)->ds);
415:   /* just in case the initial vectors have not been used */
416:   SlepcBasisDestroy_Private(&(*svd)->nini,&(*svd)->IS);
417:   SlepcBasisDestroy_Private(&(*svd)->ninil,&(*svd)->ISL);
418:   PetscRandomDestroy(&(*svd)->rand);
419:   SVDMonitorCancel(*svd);
420:   PetscHeaderDestroy(svd);
421:   return(0);
422: }

426: /*@C
427:    SVDSetType - Selects the particular solver to be used in the SVD object.

429:    Logically Collective on SVD

431:    Input Parameters:
432: +  svd      - the singular value solver context
433: -  type     - a known method

435:    Options Database Key:
436: .  -svd_type <method> - Sets the method; use -help for a list
437:     of available methods

439:    Notes:
440:    See "slepc/include/slepcsvd.h" for available methods. The default
441:    is SVDCROSS.

443:    Normally, it is best to use the SVDSetFromOptions() command and
444:    then set the SVD type from the options database rather than by using
445:    this routine.  Using the options database provides the user with
446:    maximum flexibility in evaluating the different available methods.
447:    The SVDSetType() routine is provided for those situations where it
448:    is necessary to set the iterative solver independently of the command
449:    line or options database.

451:    Level: intermediate

453: .seealso: SVDType
454: @*/
455: PetscErrorCode SVDSetType(SVD svd,SVDType type)
456: {
457:   PetscErrorCode ierr,(*r)(SVD);
458:   PetscBool      match;


464:   PetscObjectTypeCompare((PetscObject)svd,type,&match);
465:   if (match) return(0);

467:   PetscFunctionListFind(SVDList,type,&r);
468:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown SVD type given: %s",type);

470:   if (svd->ops->destroy) { (*svd->ops->destroy)(svd); }
471:   PetscMemzero(svd->ops,sizeof(struct _SVDOps));

473:   svd->setupcalled = 0;
474:   PetscObjectChangeTypeName((PetscObject)svd,type);
475:   (*r)(svd);
476:   return(0);
477: }

481: /*@C
482:    SVDGetType - Gets the SVD type as a string from the SVD object.

484:    Not Collective

486:    Input Parameter:
487: .  svd - the singular value solver context

489:    Output Parameter:
490: .  name - name of SVD method

492:    Level: intermediate

494: .seealso: SVDSetType()
495: @*/
496: PetscErrorCode SVDGetType(SVD svd,SVDType *type)
497: {
501:   *type = ((PetscObject)svd)->type_name;
502:   return(0);
503: }

507: /*@C
508:    SVDRegister - Adds a method to the singular value solver package.

510:    Not Collective

512:    Input Parameters:
513: +  name - name of a new user-defined solver
514: -  function - routine to create the solver context

516:    Notes:
517:    SVDRegister() may be called multiple times to add several user-defined solvers.

519:    Sample usage:
520: .vb
521:    SVDRegister("my_solver",MySolverCreate);
522: .ve

524:    Then, your solver can be chosen with the procedural interface via
525: $     SVDSetType(svd,"my_solver")
526:    or at runtime via the option
527: $     -svd_type my_solver

529:    Level: advanced

531: .seealso: SVDRegisterAll()
532: @*/
533: PetscErrorCode SVDRegister(const char *name,PetscErrorCode (*function)(SVD))
534: {

538:   PetscFunctionListAdd(&SVDList,name,function);
539:   return(0);
540: }

544: /*@
545:    SVDSetIP - Associates an inner product object to the
546:    singular value solver.

548:    Collective on SVD

550:    Input Parameters:
551: +  svd - singular value solver context obtained from SVDCreate()
552: -  ip  - the inner product object

554:    Note:
555:    Use SVDGetIP() to retrieve the inner product context (for example,
556:    to free it at the end of the computations).

558:    Level: advanced

560: .seealso: SVDGetIP()
561: @*/
562: PetscErrorCode SVDSetIP(SVD svd,IP ip)
563: {

570:   PetscObjectReference((PetscObject)ip);
571:   IPDestroy(&svd->ip);
572:   svd->ip = ip;
573:   PetscLogObjectParent(svd,svd->ip);
574:   return(0);
575: }

579: /*@C
580:    SVDGetIP - Obtain the inner product object associated
581:    to the singular value solver object.

583:    Not Collective

585:    Input Parameters:
586: .  svd - singular value solver context obtained from SVDCreate()

588:    Output Parameter:
589: .  ip - inner product context

591:    Level: advanced

593: .seealso: SVDSetIP()
594: @*/
595: PetscErrorCode SVDGetIP(SVD svd,IP *ip)
596: {

602:   if (!svd->ip) {
603:     IPCreate(PetscObjectComm((PetscObject)svd),&svd->ip);
604:     PetscLogObjectParent(svd,svd->ip);
605:   }
606:   *ip = svd->ip;
607:   return(0);
608: }

612: /*@
613:    SVDSetDS - Associates a direct solver object to the singular value solver.

615:    Collective on SVD

617:    Input Parameters:
618: +  svd - singular value solver context obtained from SVDCreate()
619: -  ds  - the direct solver object

621:    Note:
622:    Use SVDGetDS() to retrieve the direct solver context (for example,
623:    to free it at the end of the computations).

625:    Level: advanced

627: .seealso: SVDGetDS()
628: @*/
629: PetscErrorCode SVDSetDS(SVD svd,DS ds)
630: {

637:   PetscObjectReference((PetscObject)ds);
638:   DSDestroy(&svd->ds);
639:   svd->ds = ds;
640:   PetscLogObjectParent(svd,svd->ds);
641:   return(0);
642: }

646: /*@C
647:    SVDGetDS - Obtain the direct solver object associated to the singular value
648:    solver object.

650:    Not Collective

652:    Input Parameters:
653: .  svd - singular value solver context obtained from SVDCreate()

655:    Output Parameter:
656: .  ds - direct solver context

658:    Level: advanced

660: .seealso: SVDSetDS()
661: @*/
662: PetscErrorCode SVDGetDS(SVD svd,DS *ds)
663: {

669:   if (!svd->ds) {
670:     DSCreate(PetscObjectComm((PetscObject)svd),&svd->ds);
671:     PetscLogObjectParent(svd,svd->ds);
672:   }
673:   *ds = svd->ds;
674:   return(0);
675: }

slepc-3.4.2.dfsg.orig/src/svd/interface/makefile0000644000175000017500000000223512211062077020460 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = svdregis.c svdbasic.c svdopts.c svdsetup.c svdsolve.c svdmon.c svdmat.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = SVD LOCDIR = src/svd/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/interface/svdmat.c0000644000175000017500000000530012211062077020416 0ustar gladkgladk/* SVD routines for accessing the problem matrix. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #undef __FUNCT__ #define __FUNCT__ "SVDMatMult" PetscErrorCode SVDMatMult(SVD svd,PetscBool trans,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; svd->matvecs++; if (trans) { if (svd->AT) { ierr = MatMult(svd->AT,x,y);CHKERRQ(ierr); } else { #if defined(PETSC_USE_COMPLEX) ierr = MatMultHermitianTranspose(svd->A,x,y);CHKERRQ(ierr); #else ierr = MatMultTranspose(svd->A,x,y);CHKERRQ(ierr); #endif } } else { if (svd->A) { ierr = MatMult(svd->A,x,y);CHKERRQ(ierr); } else { #if defined(PETSC_USE_COMPLEX) ierr = MatMultHermitianTranspose(svd->AT,x,y);CHKERRQ(ierr); #else ierr = MatMultTranspose(svd->AT,x,y);CHKERRQ(ierr); #endif } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMatGetVecs" PetscErrorCode SVDMatGetVecs(SVD svd,Vec *x,Vec *y) { PetscErrorCode ierr; PetscFunctionBegin; if (svd->A) { ierr = MatGetVecs(svd->A,x,y);CHKERRQ(ierr); } else { ierr = MatGetVecs(svd->AT,y,x);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMatGetSize" PetscErrorCode SVDMatGetSize(SVD svd,PetscInt *m,PetscInt *n) { PetscErrorCode ierr; PetscFunctionBegin; if (svd->A) { ierr = MatGetSize(svd->A,m,n);CHKERRQ(ierr); } else { ierr = MatGetSize(svd->AT,n,m);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDMatGetLocalSize" PetscErrorCode SVDMatGetLocalSize(SVD svd,PetscInt *m,PetscInt *n) { PetscErrorCode ierr; PetscFunctionBegin; if (svd->A) { ierr = MatGetLocalSize(svd->A,m,n);CHKERRQ(ierr); } else { ierr = MatGetLocalSize(svd->AT,n,m);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/makefile.html0000644000175000017500000000403112211062077021417 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = svdregis.c svdbasic.c svdopts.c svdsetup.c svdsolve.c svdmon.c svdmat.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = SVD
LOCDIR   = src/svd/interface/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/svd/interface/index.html0000644000175000017500000000246112211062077020756 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

svdregis.c
svdbasic.c
svdopts.c
svdsetup.c
svdsolve.c
svdmon.c
svdmat.c
makefile
slepc-3.4.2.dfsg.orig/src/svd/interface/svdsetup.c.html0000644000175000017500000005646012211062077021755 0ustar gladkgladk

Actual source code: svdsetup.c

  1: /*
  2:      SVD routines for setting up the solver.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>      /*I "slepcsvd.h" I*/
 25: #include <slepc-private/ipimpl.h>

 29: /*@
 30:    SVDSetOperator - Set the matrix associated with the singular value problem.

 32:    Collective on SVD and Mat

 34:    Input Parameters:
 35: +  svd - the singular value solver context
 36: -  A  - the matrix associated with the singular value problem

 38:    Level: beginner

 40: .seealso: SVDSolve(), SVDGetOperator()
 41: @*/
 42: PetscErrorCode SVDSetOperator(SVD svd,Mat mat)
 43: {

 50:   if (svd->setupcalled) { SVDReset(svd); }
 51:   PetscObjectReference((PetscObject)mat);
 52:   MatDestroy(&svd->OP);
 53:   svd->OP = mat;
 54:   return(0);
 55: }

 59: /*@
 60:    SVDGetOperator - Get the matrix associated with the singular value problem.

 62:    Not collective, though parallel Mats are returned if the SVD is parallel

 64:    Input Parameter:
 65: .  svd - the singular value solver context

 67:    Output Parameters:
 68: .  A    - the matrix associated with the singular value problem

 70:    Level: advanced

 72: .seealso: SVDSolve(), SVDSetOperator()
 73: @*/
 74: PetscErrorCode SVDGetOperator(SVD svd,Mat *A)
 75: {
 79:   *A = svd->OP;
 80:   return(0);
 81: }

 85: /*@
 86:    SVDSetUp - Sets up all the internal data structures necessary for the
 87:    execution of the singular value solver.

 89:    Collective on SVD

 91:    Input Parameter:
 92: .  svd   - singular value solver context

 94:    Level: advanced

 96:    Notes:
 97:    This function need not be called explicitly in most cases, since SVDSolve()
 98:    calls it. It can be useful when one wants to measure the set-up time
 99:    separately from the solve time.

101: .seealso: SVDCreate(), SVDSolve(), SVDDestroy()
102: @*/
103: PetscErrorCode SVDSetUp(SVD svd)
104: {
106:   PetscBool      flg;
107:   PetscInt       M,N,k;
108:   Vec            *T;

112:   if (svd->setupcalled) return(0);
113:   PetscLogEventBegin(SVD_SetUp,svd,0,0,0);

115:   /* reset the convergence flag from the previous solves */
116:   svd->reason = SVD_CONVERGED_ITERATING;

118:   /* Set default solver type (SVDSetFromOptions was not called) */
119:   if (!((PetscObject)svd)->type_name) {
120:     SVDSetType(svd,SVDCROSS);
121:   }
122:   if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
123:   if (!((PetscObject)svd->ip)->type_name) {
124:     IPSetType_Default(svd->ip);
125:   }
126:   if (!svd->ds) { SVDGetDS(svd,&svd->ds); }
127:   DSReset(svd->ds);
128:   if (!((PetscObject)svd->rand)->type_name) {
129:     PetscRandomSetFromOptions(svd->rand);
130:   }

132:   /* check matrix */
133:   if (!svd->OP) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSetOperator must be called first");

135:   /* determine how to build the transpose */
136:   if (svd->transmode == PETSC_DECIDE) {
137:     MatHasOperation(svd->OP,MATOP_TRANSPOSE,&flg);
138:     if (flg) svd->transmode = SVD_TRANSPOSE_EXPLICIT;
139:     else svd->transmode = SVD_TRANSPOSE_IMPLICIT;
140:   }

142:   /* build transpose matrix */
143:   MatDestroy(&svd->A);
144:   MatDestroy(&svd->AT);
145:   MatGetSize(svd->OP,&M,&N);
146:   PetscObjectReference((PetscObject)svd->OP);
147:   switch (svd->transmode) {
148:     case SVD_TRANSPOSE_EXPLICIT:
149:       if (M>=N) {
150:         svd->A = svd->OP;
151:         MatTranspose(svd->OP,MAT_INITIAL_MATRIX,&svd->AT);
152:         MatConjugate(svd->AT);
153:       } else {
154:         MatTranspose(svd->OP,MAT_INITIAL_MATRIX,&svd->A);
155:         MatConjugate(svd->A);
156:         svd->AT = svd->OP;
157:       }
158:       break;
159:     case SVD_TRANSPOSE_IMPLICIT:
160:       if (M>=N) {
161:         svd->A = svd->OP;
162:         svd->AT = NULL;
163:       } else {
164:         svd->A = NULL;
165:         svd->AT = svd->OP;
166:       }
167:       break;
168:     default:
169:       SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Invalid transpose mode");
170:   }

172:   VecDestroy(&svd->tr);
173:   VecDestroy(&svd->tl);
174:   if (svd->A) {
175:     SlepcMatGetVecsTemplate(svd->A,&svd->tr,&svd->tl);
176:   } else {
177:     SlepcMatGetVecsTemplate(svd->AT,&svd->tl,&svd->tr);
178:   }
179:   PetscLogObjectParent(svd,svd->tl);
180:   PetscLogObjectParent(svd,svd->tr);

182:   /* swap initial vectors if necessary */
183:   if (M<N) {
184:     T=svd->ISL; svd->ISL=svd->IS; svd->IS=T;
185:     k=svd->ninil; svd->ninil=svd->nini; svd->nini=k;
186:   }

188:   /* call specific solver setup */
189:   (*svd->ops->setup)(svd);

191:   /* set tolerance if not yet set */
192:   if (svd->tol==PETSC_DEFAULT) svd->tol = SLEPC_DEFAULT_TOL;

194:   if (svd->ncv > M || svd->ncv > N) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"ncv bigger than matrix dimensions");
195:   if (svd->nsv > svd->ncv) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"nsv bigger than ncv");

197:   if (svd->ncv != svd->n) {
198:     /* free memory for previous solution  */
199:     if (svd->n) {
200:       PetscFree(svd->sigma);
201:       PetscFree(svd->perm);
202:       PetscFree(svd->errest);
203:       VecDestroyVecs(svd->n,&svd->V);
204:     }
205:     /* allocate memory for next solution */
206:     PetscMalloc(svd->ncv*sizeof(PetscReal),&svd->sigma);
207:     PetscMalloc(svd->ncv*sizeof(PetscInt),&svd->perm);
208:     PetscMalloc(svd->ncv*sizeof(PetscReal),&svd->errest);
209:     PetscLogObjectMemory(svd,PetscMax(0,svd->ncv-svd->n)*(2*sizeof(PetscReal)+sizeof(PetscInt)));
210:     VecDuplicateVecs(svd->tr,svd->ncv,&svd->V);
211:     PetscLogObjectParents(svd,svd->ncv,svd->V);
212:     svd->n = svd->ncv;
213:   }

215:   /* process initial vectors */
216:   if (svd->nini<0) {
217:     svd->nini = -svd->nini;
218:     if (svd->nini>svd->ncv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The number of initial vectors is larger than ncv");
219:     IPOrthonormalizeBasis_Private(svd->ip,&svd->nini,&svd->IS,svd->V);
220:   }
221:   if (svd->ninil<0 && svd->U) { /* skip this if the solver is not using a left basis */
222:     svd->ninil = -svd->ninil;
223:     if (svd->ninil>svd->ncv) SETERRQ(PetscObjectComm((PetscObject)svd),1,"The number of left initial vectors is larger than ncv");
224:     IPOrthonormalizeBasis_Private(svd->ip,&svd->ninil,&svd->ISL,svd->U);
225:   }

227:   PetscLogEventEnd(SVD_SetUp,svd,0,0,0);
228:   svd->setupcalled = 1;
229:   return(0);
230: }

234: /*@
235:    SVDSetInitialSpace - Specify a basis of vectors that constitute the initial
236:    (right) space, that is, a rough approximation to the right singular subspace
237:    from which the solver starts to iterate.

239:    Collective on SVD and Vec

241:    Input Parameter:
242: +  svd   - the singular value solver context
243: .  n     - number of vectors
244: -  is    - set of basis vectors of the initial space

246:    Notes:
247:    Some solvers start to iterate on a single vector (initial vector). In that case,
248:    the other vectors are ignored.

250:    These vectors do not persist from one SVDSolve() call to the other, so the
251:    initial space should be set every time.

253:    The vectors do not need to be mutually orthonormal, since they are explicitly
254:    orthonormalized internally.

256:    Common usage of this function is when the user can provide a rough approximation
257:    of the wanted singular space. Then, convergence may be faster.

259:    Level: intermediate
260: @*/
261: PetscErrorCode SVDSetInitialSpace(SVD svd,PetscInt n,Vec *is)
262: {

268:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
269:   SlepcBasisReference_Private(n,is,&svd->nini,&svd->IS);
270:   if (n>0) svd->setupcalled = 0;
271:   return(0);
272: }

276: /*@
277:    SVDSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial
278:    left space, that is, a rough approximation to the left singular subspace
279:    from which the solver starts to iterate.

281:    Collective on SVD and Vec

283:    Input Parameter:
284: +  svd   - the singular value solver context
285: .  n     - number of vectors
286: -  is    - set of basis vectors of the initial space

288:    Notes:
289:    Some solvers start to iterate on a single vector (initial vector). In that case,
290:    the other vectors are ignored.

292:    These vectors do not persist from one SVDSolve() call to the other, so the
293:    initial space should be set every time.

295:    The vectors do not need to be mutually orthonormal, since they are explicitly
296:    orthonormalized internally.

298:    Common usage of this function is when the user can provide a rough approximation
299:    of the wanted singular space. Then, convergence may be faster.

301:    Level: intermediate
302: @*/
303: PetscErrorCode SVDSetInitialSpaceLeft(SVD svd,PetscInt n,Vec *is)
304: {

310:   if (n<0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
311:   SlepcBasisReference_Private(n,is,&svd->ninil,&svd->ISL);
312:   if (n>0) svd->setupcalled = 0;
313:   return(0);
314: }

slepc-3.4.2.dfsg.orig/src/svd/interface/svdmon.c.html0000644000175000017500000007157712211062077021414 0ustar gladkgladk
Actual source code: svdmon.c

  1: /*
  2:       SVD routines related to monitors.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>   /*I "slepcsvd.h" I*/
 25: #include <petscdraw.h>

 29: /*
 30:    Runs the user provided monitor routines, if any.
 31: */
 32: PetscErrorCode SVDMonitor(SVD svd,PetscInt it,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest)
 33: {
 35:   PetscInt       i,n = svd->numbermonitors;

 38:   for (i=0;i<n;i++) {
 39:     (*svd->monitor[i])(svd,it,nconv,sigma,errest,nest,svd->monitorcontext[i]);
 40:   }
 41:   return(0);
 42: }

 46: /*@C
 47:    SVDMonitorSet - Sets an ADDITIONAL function to be called at every
 48:    iteration to monitor the error estimates for each requested singular triplet.

 50:    Collective on SVD

 52:    Input Parameters:
 53: +  svd     - singular value solver context obtained from SVDCreate()
 54: .  monitor - pointer to function (if this is NULL, it turns off monitoring)
 55: -  mctx    - [optional] context for private data for the
 56:              monitor routine (use NULL if no context is desired)

 58:    Calling Sequence of monitor:
 59: $     monitor (SVD svd, PetscInt its, PetscInt nconv, PetscReal *sigma, PetscReal* errest, PetscInt nest, void *mctx)

 61: +  svd    - singular value solver context obtained from SVDCreate()
 62: .  its    - iteration number
 63: .  nconv  - number of converged singular triplets
 64: .  sigma  - singular values
 65: .  errest - relative error estimates for each singular triplet
 66: .  nest   - number of error estimates
 67: -  mctx   - optional monitoring context, as set by SVDMonitorSet()

 69:    Options Database Keys:
 70: +    -svd_monitor        - print only the first error estimate
 71: .    -svd_monitor_all    - print error estimates at each iteration
 72: .    -svd_monitor_conv   - print the singular value approximations only when
 73:       convergence has been reached
 74: .    -svd_monitor_lg     - sets line graph monitor for the first unconverged
 75:       approximate singular value
 76: .    -svd_monitor_lg_all - sets line graph monitor for all unconverged
 77:       approximate singular values
 78: -    -svd_monitor_cancel - cancels all monitors that have been hardwired into
 79:       a code by calls to SVDMonitorSet(), but does not cancel those set via
 80:       the options database.

 82:    Notes:
 83:    Several different monitoring routines may be set by calling
 84:    SVDMonitorSet() multiple times; all will be called in the
 85:    order in which they were set.

 87:    Level: intermediate

 89: .seealso: SVDMonitorFirst(), SVDMonitorAll(), SVDMonitorCancel()
 90: @*/
 91: PetscErrorCode SVDMonitorSet(SVD svd,PetscErrorCode (*monitor)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
 92: {
 95:   if (svd->numbermonitors >= MAXSVDMONITORS) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Too many SVD monitors set");
 96:   svd->monitor[svd->numbermonitors]           = monitor;
 97:   svd->monitorcontext[svd->numbermonitors]    = (void*)mctx;
 98:   svd->monitordestroy[svd->numbermonitors++]  = monitordestroy;
 99:   return(0);
100: }

104: /*@
105:    SVDMonitorCancel - Clears all monitors for an SVD object.

107:    Collective on SVD

109:    Input Parameters:
110: .  svd - singular value solver context obtained from SVDCreate()

112:    Options Database Key:
113: .    -svd_monitor_cancel - Cancels all monitors that have been hardwired
114:       into a code by calls to SVDMonitorSet(),
115:       but does not cancel those set via the options database.

117:    Level: intermediate

119: .seealso: SVDMonitorSet()
120: @*/
121: PetscErrorCode SVDMonitorCancel(SVD svd)
122: {
124:   PetscInt       i;

128:   for (i=0; i<svd->numbermonitors; i++) {
129:     if (svd->monitordestroy[i]) {
130:       (*svd->monitordestroy[i])(&svd->monitorcontext[i]);
131:     }
132:   }
133:   svd->numbermonitors = 0;
134:   return(0);
135: }

139: /*@C
140:    SVDGetMonitorContext - Gets the monitor context, as set by
141:    SVDMonitorSet() for the FIRST monitor only.

143:    Not Collective

145:    Input Parameter:
146: .  svd - singular value solver context obtained from SVDCreate()

148:    Output Parameter:
149: .  ctx - monitor context

151:    Level: intermediate

153: .seealso: SVDMonitorSet()
154: @*/
155: PetscErrorCode SVDGetMonitorContext(SVD svd,void **ctx)
156: {
159:   *ctx = svd->monitorcontext[0];
160:   return(0);
161: }

165: /*@C
166:    SVDMonitorAll - Print the current approximate values and
167:    error estimates at each iteration of the singular value solver.

169:    Collective on SVD

171:    Input Parameters:
172: +  svd    - singular value solver context
173: .  its    - iteration number
174: .  nconv  - number of converged singular triplets so far
175: .  sigma  - singular values
176: .  errest - error estimates
177: .  nest   - number of error estimates to display
178: -  monctx - monitor context (contains viewer, can be NULL)

180:    Level: intermediate

182: .seealso: SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorConverged()
183: @*/
184: PetscErrorCode SVDMonitorAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
185: {
187:   PetscInt       i;
188:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd));

191:   if (its) {
192:     PetscViewerASCIIAddTab(viewer,((PetscObject)svd)->tablevel);
193:     PetscViewerASCIIPrintf(viewer,"%3D SVD nconv=%D Values (Errors)",its,nconv);
194:     for (i=0;i<nest;i++) {
195:       PetscViewerASCIIPrintf(viewer," %G (%10.8e)",sigma[i],(double)errest[i]);
196:     }
197:     PetscViewerASCIIPrintf(viewer,"\n");
198:     PetscViewerASCIISubtractTab(viewer,((PetscObject)svd)->tablevel);
199:   }
200:   return(0);
201: }

205: /*@C
206:    SVDMonitorFirst - Print the first unconverged approximate values and
207:    error estimates at each iteration of the singular value solver.

209:    Collective on SVD

211:    Input Parameters:
212: +  svd    - singular value solver context
213: .  its    - iteration number
214: .  nconv  - number of converged singular triplets so far
215: .  sigma  - singular values
216: .  errest - error estimates
217: .  nest   - number of error estimates to display
218: -  monctx - monitor context (contains viewer, can be NULL)

220:    Level: intermediate

222: .seealso: SVDMonitorSet(), SVDMonitorAll(), SVDMonitorConverged()
223: @*/
224: PetscErrorCode SVDMonitorFirst(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
225: {
227:   PetscViewer    viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd));

230:   if (its && nconv<nest) {
231:     PetscViewerASCIIAddTab(viewer,((PetscObject)svd)->tablevel);
232:     PetscViewerASCIIPrintf(viewer,"%3D SVD nconv=%D first unconverged value (error)",its,nconv);
233:     PetscViewerASCIIPrintf(viewer," %G (%10.8e)\n",sigma[nconv],(double)errest[nconv]);
234:     PetscViewerASCIISubtractTab(viewer,((PetscObject)svd)->tablevel);
235:   }
236:   return(0);
237: }

241: /*@C
242:    SVDMonitorConverged - Print the approximate values and error estimates as they converge.

244:    Collective on SVD

246:    Input Parameters:
247: +  svd    - singular value solver context
248: .  its    - iteration number
249: .  nconv  - number of converged singular triplets so far
250: .  sigma  - singular values
251: .  errest - error estimates
252: .  nest   - number of error estimates to display
253: -  monctx - monitor context

255:    Note:
256:    The monitor context must contain a struct with a PetscViewer and a
257:    PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

259:    Level: intermediate

261: .seealso: SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorAll()
262: @*/
263: PetscErrorCode SVDMonitorConverged(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
264: {
265:   PetscErrorCode   ierr;
266:   PetscInt         i;
267:   PetscViewer      viewer;
268:   SlepcConvMonitor ctx = (SlepcConvMonitor)monctx;

271:   if (!monctx) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONG,"Must provide a context for SVDMonitorConverged");
272:   if (!its) {
273:     ctx->oldnconv = 0;
274:   } else {
275:     viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)svd));
276:     for (i=ctx->oldnconv;i<nconv;i++) {
277:       PetscViewerASCIIAddTab(viewer,((PetscObject)svd)->tablevel);
278:       PetscViewerASCIIPrintf(viewer,"%3D SVD converged value (error) #%D",its,i);
279:       PetscViewerASCIIPrintf(viewer," %G (%10.8e)\n",sigma[i],(double)errest[i]);
280:       PetscViewerASCIISubtractTab(viewer,((PetscObject)svd)->tablevel);
281:     }
282:     ctx->oldnconv = nconv;
283:   }
284:   return(0);
285: }

289: PetscErrorCode SVDMonitorLG(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
290: {
291:   PetscViewer    viewer = (PetscViewer)monctx;
292:   PetscDraw      draw,draw1;
293:   PetscDrawLG    lg,lg1;
295:   PetscReal      x,y,p;

298:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)svd));
299:   PetscViewerDrawGetDraw(viewer,0,&draw);
300:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
301:   PetscViewerDrawGetDraw(viewer,1,&draw1);
302:   PetscViewerDrawGetDrawLG(viewer,1,&lg1);

304:   if (!its) {
305:     PetscDrawSetTitle(draw,"Error estimates");
306:     PetscDrawSetDoubleBuffer(draw);
307:     PetscDrawLGSetDimension(lg,1);
308:     PetscDrawLGReset(lg);
309:     PetscDrawLGSetLimits(lg,0,1.0,log10(svd->tol)-2,0.0);

311:     PetscDrawSetTitle(draw1,"Approximate singular values");
312:     PetscDrawSetDoubleBuffer(draw1);
313:     PetscDrawLGSetDimension(lg1,1);
314:     PetscDrawLGReset(lg1);
315:     PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);
316:   }

318:   x = (PetscReal)its;
319:   if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0;
320:   PetscDrawLGAddPoint(lg,&x,&y);

322:   PetscDrawLGAddPoint(lg1,&x,svd->sigma);
323:   PetscDrawGetPause(draw1,&p);
324:   PetscDrawSetPause(draw1,0);
325:   PetscDrawLGDraw(lg1);
326:   PetscDrawSetPause(draw1,p);

328:   PetscDrawLGDraw(lg);
329:   return(0);
330: }

334: PetscErrorCode SVDMonitorLGAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
335: {
336:   PetscViewer    viewer = (PetscViewer)monctx;
337:   PetscDraw      draw,draw1;
338:   PetscDrawLG    lg,lg1;
340:   PetscReal      *x,*y,p;
341:   PetscInt       i,n = PetscMin(svd->nsv,255);

344:   if (!viewer) viewer = PETSC_VIEWER_DRAW_(PetscObjectComm((PetscObject)svd));
345:   PetscViewerDrawGetDraw(viewer,0,&draw);
346:   PetscViewerDrawGetDrawLG(viewer,0,&lg);
347:   PetscViewerDrawGetDraw(viewer,1,&draw1);
348:   PetscViewerDrawGetDrawLG(viewer,1,&lg1);

350:   if (!its) {
351:     PetscDrawSetTitle(draw,"Error estimates");
352:     PetscDrawSetDoubleBuffer(draw);
353:     PetscDrawLGSetDimension(lg,n);
354:     PetscDrawLGReset(lg);
355:     PetscDrawLGSetLimits(lg,0,1.0,log10(svd->tol)-2,0.0);

357:     PetscDrawSetTitle(draw1,"Approximate singular values");
358:     PetscDrawSetDoubleBuffer(draw1);
359:     PetscDrawLGSetDimension(lg1,n);
360:     PetscDrawLGReset(lg1);
361:     PetscDrawLGSetLimits(lg1,0,1.0,1.e20,-1.e20);
362:   }

364:   PetscMalloc(sizeof(PetscReal)*n,&x);
365:   PetscMalloc(sizeof(PetscReal)*n,&y);
366:   for (i=0;i<n;i++) {
367:     x[i] = (PetscReal)its;
368:     if (i < nest && errest[i] > 0.0) y[i] = log10(errest[i]);
369:     else y[i] = 0.0;
370:   }
371:   PetscDrawLGAddPoint(lg,x,y);

373:   PetscDrawLGAddPoint(lg1,x,svd->sigma);
374:   PetscDrawGetPause(draw1,&p);
375:   PetscDrawSetPause(draw1,0);
376:   PetscDrawLGDraw(lg1);
377:   PetscDrawSetPause(draw1,p);

379:   PetscDrawLGDraw(lg);
380:   PetscFree(x);
381:   PetscFree(y);
382:   return(0);
383: }
slepc-3.4.2.dfsg.orig/src/svd/interface/svdregis.c.html0000644000175000017500000001157312211062077021722 0ustar gladkgladk
Actual source code: svdregis.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/svdimpl.h>       /*I "slepcsvd.h" I*/

 24: PETSC_EXTERN PetscErrorCode SVDCreate_Cross(SVD);
 25: PETSC_EXTERN PetscErrorCode SVDCreate_Cyclic(SVD);
 26: PETSC_EXTERN PetscErrorCode SVDCreate_LAPACK(SVD);
 27: PETSC_EXTERN PetscErrorCode SVDCreate_Lanczos(SVD);
 28: PETSC_EXTERN PetscErrorCode SVDCreate_TRLanczos(SVD);

 32: /*@C
 33:    SVDRegisterAll - Registers all the singular value solvers in the SVD package.

 35:    Not Collective

 37:    Level: advanced

 39: .seealso:  SVDRegister()
 40: @*/
 41: PetscErrorCode SVDRegisterAll(void)
 42: {

 46:   SVDRegisterAllCalled = PETSC_TRUE;
 47:   SVDRegister(SVDCROSS,SVDCreate_Cross);
 48:   SVDRegister(SVDCYCLIC,SVDCreate_Cyclic);
 49:   SVDRegister(SVDLAPACK,SVDCreate_LAPACK);
 50:   SVDRegister(SVDLANCZOS,SVDCreate_Lanczos);
 51:   SVDRegister(SVDTRLANCZOS,SVDCreate_TRLanczos);
 52:   return(0);
 53: }
slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-custom/0000755000175000017500000000000012214143515021055 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/interface/ftn-custom/makefile0000644000175000017500000000217412211062077022561 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zsvdf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/svd/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-custom/zsvdf.c0000644000175000017500000002240712211062077022362 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define svddestroy_ SVDDESTROY #define svdmonitorall_ SVDMONITORALL #define svdmonitorlg_ SVDMONITORLG #define svdmonitorlgall_ SVDMONITORLGALL #define svdmonitorconverged_ SVDMONITORCONVERGED #define svdmonitorfirst_ SVDMONITORFIRST #define svdview_ SVDVIEW #define svdcreate_ SVDCREATE #define svdsettype_ SVDSETTYPE #define svdgettype_ SVDGETTYPE #define svdgetip_ SVDGETIP #define svdgetds_ SVDGETDS #define svdmonitorset_ SVDMONITORSET #define svdgettransposemode_ SVDGETTRANSPOSEMODE #define svdgetwhichsingulartriplets_ SVDGETWHICHSINGULARTRIPLETS #define svdsetoptionsprefix_ SVDSETOPTIONSPREFIX #define svdappendoptionsprefix_ SVDAPPENDOPTIONSPREFIX #define svdgetoptionsprefix_ SVDGETOPTIONSPREFIX #define svdgetconvergedreason_ SVDGETCONVERGEDREASON #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define svddestroy_ svddestroy #define svdmonitorall_ svdmonitorall #define svdmonitorlgall_ svdmonitorlgall #define svdmonitorconverged_ svdmonitorconverged #define svdmonitorfirst_ svdmonitorfirst #define svdview_ svdview #define svdcreate_ svdcreate #define svdsettype_ svdsettype #define svdgettype_ svdgettype #define svdgetip_ svdgetip #define svdgetds_ svdgetds #define svdmonitorset_ svdmonitorset #define svdgettransposemode_ svdgettransposemode #define svdgetwhichsingulartriplets_ svdgetwhichsingulartriplets #define svdsetoptionsprefix_ svdsetoptionsprefix #define svdappendoptionsprefix_ svdappendoptionsprefix #define svdgetoptionsprefix_ svdgetoptionsprefix #define svdgetconvergedreason_ svdgetconvergedreason #endif /* These are not usually called from Fortran but allow Fortran users to transparently set these monitors from .F code, hence no STDCALL */ PETSC_EXTERN void svdmonitorall_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = SVDMonitorAll(*svd,*it,*nconv,sigma,errest,*nest,ctx); } PETSC_EXTERN void svdmonitorlg_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = SVDMonitorLG(*svd,*it,*nconv,sigma,errest,*nest,ctx); } PETSC_EXTERN void svdmonitorlgall_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = SVDMonitorLGAll(*svd,*it,*nconv,sigma,errest,*nest,ctx); } PETSC_EXTERN void svdmonitorconverged_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = SVDMonitorConverged(*svd,*it,*nconv,sigma,errest,*nest,ctx); } PETSC_EXTERN void svdmonitorfirst_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr) { *ierr = SVDMonitorFirst(*svd,*it,*nconv,sigma,errest,*nest,ctx); } static struct { PetscFortranCallbackId monitor; PetscFortranCallbackId monitordestroy; } _cb; /* These are not extern C because they are passed into non-extern C user level functions */ #undef __FUNCT__ #define __FUNCT__ "ourmonitor" static PetscErrorCode ourmonitor(SVD svd,PetscInt i,PetscInt nc,PetscReal *sigma,PetscReal *d,PetscInt l,void* ctx) { PetscObjectUseFortranCallback(svd,_cb.monitor,(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*),(&svd,&i,&nc,sigma,d,&l,_ctx,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourdestroy" static PetscErrorCode ourdestroy(void** ctx) { SVD svd = (SVD)*ctx; PetscObjectUseFortranCallback(svd,_cb.monitordestroy,(void*,PetscErrorCode*),(_ctx,&ierr)); return 0; } PETSC_EXTERN void PETSC_STDCALL svddestroy_(SVD *svd,PetscErrorCode *ierr) { *ierr = SVDDestroy(svd); } PETSC_EXTERN void PETSC_STDCALL svdview_(SVD *svd,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = SVDView(*svd,v); } PETSC_EXTERN void PETSC_STDCALL svdcreate_(MPI_Fint *comm,SVD *svd,PetscErrorCode *ierr) { *ierr = SVDCreate(MPI_Comm_f2c(*(comm)),svd); } PETSC_EXTERN void PETSC_STDCALL svdsettype_(SVD *svd,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(type,len,t); *ierr = SVDSetType(*svd,t); FREECHAR(type,t); } PETSC_EXTERN void PETSC_STDCALL svdgettype_(SVD *svd,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { SVDType tname; *ierr = SVDGetType(*svd,&tname);if (*ierr) return; *ierr = PetscStrncpy(name,tname,len); FIXRETURNCHAR(PETSC_TRUE,name,len); } PETSC_EXTERN void PETSC_STDCALL svdgetip_(SVD *svd,IP *ip,PetscErrorCode *ierr) { *ierr = SVDGetIP(*svd,ip); } PETSC_EXTERN void PETSC_STDCALL svdgetds_(SVD *svd,DS *ds,PetscErrorCode *ierr) { *ierr = SVDGetDS(*svd,ds); } PETSC_EXTERN void PETSC_STDCALL svdmonitorset_(SVD *svd,void (PETSC_STDCALL *monitor)(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr) { SlepcConvMonitor ctx; CHKFORTRANNULLOBJECT(mctx); CHKFORTRANNULLFUNCTION(monitordestroy); if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorall_) { *ierr = SVDMonitorSet(*svd,SVDMonitorAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorlg_) { *ierr = SVDMonitorSet(*svd,SVDMonitorLG,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorlgall_) { *ierr = SVDMonitorSet(*svd,SVDMonitorLGAll,0,0); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorconverged_) { if (!FORTRANNULLOBJECT(mctx)) { PetscError(PetscObjectComm((PetscObject)*svd),__LINE__,"svdmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to SVDMonitorSet"); *ierr = 1; return; } *ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx); if (*ierr) return; ctx->viewer = NULL; *ierr = SVDMonitorSet(*svd,SVDMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy); } else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorfirst_) { *ierr = SVDMonitorSet(*svd,SVDMonitorFirst,0,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*svd,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitor,(PetscVoidFunction)monitor,mctx); if (*ierr) return; if (!monitordestroy) { *ierr = SVDMonitorSet(*svd,ourmonitor,*svd,0); } else { *ierr = PetscObjectSetFortranCallback((PetscObject)*svd,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.monitordestroy,(PetscVoidFunction)monitordestroy,mctx); if (*ierr) return; *ierr = SVDMonitorSet(*svd,ourmonitor,*svd,ourdestroy); } } } PETSC_EXTERN void PETSC_STDCALL svdgettransposemode_(SVD *svd,SVDTransposeMode *mode,PetscErrorCode *ierr) { *ierr = SVDGetTransposeMode(*svd,mode); } PETSC_EXTERN void PETSC_STDCALL svdgetwhichsingulartriplets_(SVD *svd,SVDWhich *which,PetscErrorCode *ierr) { *ierr = SVDGetWhichSingularTriplets(*svd,which); } PETSC_EXTERN void PETSC_STDCALL svdsetoptionsprefix_(SVD *svd,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = SVDSetOptionsPrefix(*svd,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL svdappendoptionsprefix_(SVD *svd,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = SVDAppendOptionsPrefix(*svd,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL svdgetoptionsprefix_(SVD *svd,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = SVDGetOptionsPrefix(*svd,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL svdgetconvergedreason_(SVD *svd,SVDConvergedReason *reason,PetscErrorCode *ierr) { *ierr = SVDGetConvergedReason(*svd,reason); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdregis.c0000644000175000017500000000361012211062077020750 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ PETSC_EXTERN PetscErrorCode SVDCreate_Cross(SVD); PETSC_EXTERN PetscErrorCode SVDCreate_Cyclic(SVD); PETSC_EXTERN PetscErrorCode SVDCreate_LAPACK(SVD); PETSC_EXTERN PetscErrorCode SVDCreate_Lanczos(SVD); PETSC_EXTERN PetscErrorCode SVDCreate_TRLanczos(SVD); #undef __FUNCT__ #define __FUNCT__ "SVDRegisterAll" /*@C SVDRegisterAll - Registers all the singular value solvers in the SVD package. Not Collective Level: advanced .seealso: SVDRegister() @*/ PetscErrorCode SVDRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; SVDRegisterAllCalled = PETSC_TRUE; ierr = SVDRegister(SVDCROSS,SVDCreate_Cross);CHKERRQ(ierr); ierr = SVDRegister(SVDCYCLIC,SVDCreate_Cyclic);CHKERRQ(ierr); ierr = SVDRegister(SVDLAPACK,SVDCreate_LAPACK);CHKERRQ(ierr); ierr = SVDRegister(SVDLANCZOS,SVDCreate_Lanczos);CHKERRQ(ierr); ierr = SVDRegister(SVDTRLANCZOS,SVDCreate_TRLanczos);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdsolve.c0000644000175000017500000003105112211062077020767 0ustar gladkgladk/* SVD routines related to the solution process. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcsvd.h" I*/ #undef __FUNCT__ #define __FUNCT__ "SVDSolve" /*@ SVDSolve - Solves the singular value problem. Collective on SVD Input Parameter: . svd - singular value solver context obtained from SVDCreate() Options Database Keys: + -svd_view - print information about the solver used - -svd_view_mat binary - save the matrix to the default binary viewer Level: beginner .seealso: SVDCreate(), SVDSetUp(), SVDDestroy() @*/ PetscErrorCode SVDSolve(SVD svd) { PetscErrorCode ierr; PetscBool flg; PetscInt i,*workperm; PetscViewer viewer; PetscViewerFormat format; PetscErrorCode (*which_func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); ierr = PetscLogEventBegin(SVD_Solve,svd,0,0,0);CHKERRQ(ierr); /* call setup */ ierr = SVDSetUp(svd);CHKERRQ(ierr); svd->its = 0; svd->nconv = 0; for (i=0;incv;i++) { svd->sigma[i] = 0.0; svd->errest[i] = 0.0; } ierr = SVDMonitor(svd,svd->its,svd->nconv,svd->sigma,svd->errest,svd->ncv);CHKERRQ(ierr); which_func = (svd->which==SVD_LARGEST)? SlepcCompareLargestReal: SlepcCompareSmallestReal; ierr = DSSetEigenvalueComparison(svd->ds,which_func,NULL);CHKERRQ(ierr); ierr = (*svd->ops->solve)(svd);CHKERRQ(ierr); /* sort singular triplets */ if (svd->which == SVD_SMALLEST) { for (i=0;inconv;i++) svd->perm[i] = i; ierr = PetscSortRealWithPermutation(svd->nconv,svd->sigma,svd->perm);CHKERRQ(ierr); } else { ierr = PetscMalloc(sizeof(PetscInt)*svd->nconv,&workperm);CHKERRQ(ierr); for (i=0;inconv;i++) workperm[i] = i; ierr = PetscSortRealWithPermutation(svd->nconv,svd->sigma,workperm);CHKERRQ(ierr); for (i=0;inconv;i++) svd->perm[i] = workperm[svd->nconv-i-1]; ierr = PetscFree(workperm);CHKERRQ(ierr); } ierr = PetscLogEventEnd(SVD_Solve,svd,0,0,0);CHKERRQ(ierr); /* various viewers */ ierr = MatViewFromOptions(svd->OP,((PetscObject)svd)->prefix,"-svd_view_mat");CHKERRQ(ierr); ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)svd),((PetscObject)svd)->prefix,"-svd_view",&viewer,&format,&flg);CHKERRQ(ierr); if (flg && !PetscPreLoadingOn) { ierr = PetscViewerPushFormat(viewer,format);CHKERRQ(ierr); ierr = SVDView(svd,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } /* Remove the initial subspace */ svd->nini = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetIterationNumber" /*@ SVDGetIterationNumber - Gets the current iteration number. If the call to SVDSolve() is complete, then it returns the number of iterations carried out by the solution method. Not Collective Input Parameter: . svd - the singular value solver context Output Parameter: . its - number of iterations Level: intermediate Notes: During the i-th iteration this call returns i-1. If SVDSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call SVDGetConvergedReason() to determine if the solver converged or failed and why. @*/ PetscErrorCode SVDGetIterationNumber(SVD svd,PetscInt *its) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidIntPointer(its,2); *its = svd->its; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetConvergedReason" /*@C SVDGetConvergedReason - Gets the reason why the SVDSolve() iteration was stopped. Not Collective Input Parameter: . svd - the singular value solver context Output Parameter: . reason - negative value indicates diverged, positive value converged (see SVDConvergedReason) Possible values for reason: + SVD_CONVERGED_TOL - converged up to tolerance . SVD_DIVERGED_ITS - required more than its to reach convergence - SVD_DIVERGED_BREAKDOWN - generic breakdown in method Level: intermediate Notes: Can only be called after the call to SVDSolve() is complete. .seealso: SVDSetTolerances(), SVDSolve(), SVDConvergedReason @*/ PetscErrorCode SVDGetConvergedReason(SVD svd,SVDConvergedReason *reason) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidIntPointer(reason,2); *reason = svd->reason; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetConverged" /*@ SVDGetConverged - Gets the number of converged singular values. Not Collective Input Parameter: . svd - the singular value solver context Output Parameter: . nconv - number of converged singular values Note: This function should be called after SVDSolve() has finished. Level: beginner @*/ PetscErrorCode SVDGetConverged(SVD svd,PetscInt *nconv) { PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidIntPointer(nconv,2); *nconv = svd->nconv; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetSingularTriplet" /*@ SVDGetSingularTriplet - Gets the i-th triplet of the singular value decomposition as computed by SVDSolve(). The solution consists in the singular value and its left and right singular vectors. Not Collective, but vectors are shared by all processors that share the SVD Input Parameters: + svd - singular value solver context - i - index of the solution Output Parameters: + sigma - singular value . u - left singular vector - v - right singular vector Note: The index i should be a value between 0 and nconv-1 (see SVDGetConverged()). Both U or V can be NULL if singular vectors are not required. Level: beginner .seealso: SVDSolve(), SVDGetConverged() @*/ PetscErrorCode SVDGetSingularTriplet(SVD svd,PetscInt i,PetscReal *sigma,Vec u,Vec v) { PetscErrorCode ierr; PetscReal norm; PetscInt j,M,N; Vec w; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (u) { PetscValidHeaderSpecific(u,VEC_CLASSID,4); PetscCheckSameComm(svd,1,u,4); } if (v) { PetscValidHeaderSpecific(v,VEC_CLASSID,5); PetscCheckSameComm(svd,1,v,5); } if (svd->reason == SVD_CONVERGED_ITERATING) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSolve must be called first"); if (i<0 || i>=svd->nconv) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); *sigma = svd->sigma[svd->perm[i]]; ierr = MatGetSize(svd->OP,&M,&N);CHKERRQ(ierr); if (MU) { ierr = VecDuplicateVecs(svd->tl,svd->ncv,&svd->U);CHKERRQ(ierr); ierr = PetscLogObjectParents(svd,svd->ncv,svd->U);CHKERRQ(ierr); for (j=0;jnconv;j++) { ierr = SVDMatMult(svd,PETSC_FALSE,svd->V[j],svd->U[j]);CHKERRQ(ierr); ierr = IPOrthogonalize(svd->ip,0,NULL,j,NULL,svd->U,svd->U[j],NULL,&norm,NULL);CHKERRQ(ierr); ierr = VecScale(svd->U[j],1.0/norm);CHKERRQ(ierr); } } ierr = VecCopy(svd->U[svd->perm[i]],u);CHKERRQ(ierr); } if (v) { ierr = VecCopy(svd->V[svd->perm[i]],v);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDComputeResidualNorms" /*@ SVDComputeResidualNorms - Computes the norms of the residual vectors associated with the i-th computed singular triplet. Collective on SVD Input Parameters: + svd - the singular value solver context - i - the solution index Output Parameters: + norm1 - the norm ||A*v-sigma*u||_2 where sigma is the singular value, u and v are the left and right singular vectors. - norm2 - the norm ||A^T*u-sigma*v||_2 with the same sigma, u and v Note: The index i should be a value between 0 and nconv-1 (see SVDGetConverged()). Both output parameters can be NULL on input if not needed. Level: beginner .seealso: SVDSolve(), SVDGetConverged(), SVDComputeRelativeError() @*/ PetscErrorCode SVDComputeResidualNorms(SVD svd,PetscInt i,PetscReal *norm1,PetscReal *norm2) { PetscErrorCode ierr; Vec u,v,x = NULL,y = NULL; PetscReal sigma; PetscInt M,N; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveInt(svd,i,2); if (svd->reason == SVD_CONVERGED_ITERATING) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_WRONGSTATE,"SVDSolve must be called first"); if (i<0 || i>=svd->nconv) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Argument 2 out of range"); ierr = MatGetVecs(svd->OP,&v,&u);CHKERRQ(ierr); ierr = SVDGetSingularTriplet(svd,i,&sigma,u,v);CHKERRQ(ierr); if (norm1) { ierr = VecDuplicate(u,&x);CHKERRQ(ierr); ierr = MatMult(svd->OP,v,x);CHKERRQ(ierr); ierr = VecAXPY(x,-sigma,u);CHKERRQ(ierr); ierr = VecNorm(x,NORM_2,norm1);CHKERRQ(ierr); } if (norm2) { ierr = VecDuplicate(v,&y);CHKERRQ(ierr); if (svd->A && svd->AT) { ierr = MatGetSize(svd->OP,&M,&N);CHKERRQ(ierr); if (MA,u,y);CHKERRQ(ierr); } else { ierr = MatMult(svd->AT,u,y);CHKERRQ(ierr); } } else { #if defined(PETSC_USE_COMPLEX) ierr = MatMultHermitianTranspose(svd->OP,u,y);CHKERRQ(ierr); #else ierr = MatMultTranspose(svd->OP,u,y);CHKERRQ(ierr); #endif } ierr = VecAXPY(y,-sigma,v);CHKERRQ(ierr); ierr = VecNorm(y,NORM_2,norm2);CHKERRQ(ierr); } ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDComputeRelativeError" /*@ SVDComputeRelativeError - Computes the relative error bound associated with the i-th singular triplet. Collective on SVD Input Parameter: + svd - the singular value solver context - i - the solution index Output Parameter: . error - the relative error bound, computed as sqrt(n1^2+n2^2)/sigma where n1 = ||A*v-sigma*u||_2 , n2 = ||A^T*u-sigma*v||_2 , sigma is the singular value, u and v are the left and right singular vectors. If sigma is too small the relative error is computed as sqrt(n1^2+n2^2). Level: beginner .seealso: SVDSolve(), SVDComputeResidualNorms() @*/ PetscErrorCode SVDComputeRelativeError(SVD svd,PetscInt i,PetscReal *error) { PetscErrorCode ierr; PetscReal sigma,norm1,norm2; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); PetscValidLogicalCollectiveInt(svd,i,2); PetscValidPointer(error,3); ierr = SVDGetSingularTriplet(svd,i,&sigma,NULL,NULL);CHKERRQ(ierr); ierr = SVDComputeResidualNorms(svd,i,&norm1,&norm2);CHKERRQ(ierr); *error = PetscSqrtReal(norm1*norm1+norm2*norm2); if (sigma>*error) *error /= sigma; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "SVDGetOperationCounters" /*@ SVDGetOperationCounters - Gets the total number of matrix vector and dot products used by the SVD object during the last SVDSolve() call. Not Collective Input Parameter: . svd - SVD context Output Parameter: + matvecs - number of matrix vector product operations - dots - number of dot product operations Notes: These counters are reset to zero at each successive call to SVDSolve(). Level: intermediate @*/ PetscErrorCode SVDGetOperationCounters(SVD svd,PetscInt* matvecs,PetscInt* dots) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(svd,SVD_CLASSID,1); if (matvecs) *matvecs = svd->matvecs; if (dots) { if (!svd->ip) { ierr = SVDGetIP(svd,&svd->ip);CHKERRQ(ierr); } ierr = IPGetOperationCounters(svd->ip,dots);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/svd/interface/svdopts.c.html0000644000175000017500000015734112211062077021602 0ustar gladkgladk
Actual source code: svdopts.c

  1: /*
  2:      SVD routines for setting solver options.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>      /*I "slepcsvd.h" I*/

 28: /*@
 29:    SVDSetTransposeMode - Sets how to handle the transpose of the matrix
 30:    associated with the singular value problem.

 32:    Logically Collective on SVD

 34:    Input Parameters:
 35: +  svd  - the singular value solver context
 36: -  mode - how to compute the transpose, one of SVD_TRANSPOSE_EXPLICIT
 37:           or SVD_TRANSPOSE_IMPLICIT (see notes below)

 39:    Options Database Key:
 40: .  -svd_transpose_mode <mode> - Indicates the mode flag, where <mode>
 41:     is one of 'explicit' or 'implicit'.

 43:    Notes:
 44:    In the SVD_TRANSPOSE_EXPLICIT mode, the transpose of the matrix is
 45:    explicitly built.

 47:    The option SVD_TRANSPOSE_IMPLICIT does not build the transpose, but
 48:    handles it implicitly via MatMultTranspose() (or MatMultHermitianTranspose()
 49:    in the complex case) operations. This is
 50:    likely to be more inefficient than SVD_TRANSPOSE_EXPLICIT, both in
 51:    sequential and in parallel, but requires less storage.

 53:    The default is SVD_TRANSPOSE_EXPLICIT if the matrix has defined the
 54:    MatTranspose operation, and SVD_TRANSPOSE_IMPLICIT otherwise.

 56:    Level: advanced

 58: .seealso: SVDGetTransposeMode(), SVDSolve(), SVDSetOperator(),
 59:    SVDGetOperator(), SVDTransposeMode
 60: @*/
 61: PetscErrorCode SVDSetTransposeMode(SVD svd,SVDTransposeMode mode)
 62: {
 66:   if (mode == PETSC_DEFAULT || mode == PETSC_DECIDE) mode = (SVDTransposeMode)PETSC_DECIDE;
 67:   else switch (mode) {
 68:     case SVD_TRANSPOSE_EXPLICIT:
 69:     case SVD_TRANSPOSE_IMPLICIT:
 70:       if (svd->transmode!=mode) {
 71:         svd->transmode = mode;
 72:         svd->setupcalled = 0;
 73:       }
 74:       break;
 75:     default:
 76:       SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Invalid transpose mode");
 77:   }
 78:   return(0);
 79: }

 83: /*@C
 84:    SVDGetTransposeMode - Gets the mode used to compute the transpose
 85:    of the matrix associated with the singular value problem.

 87:    Not Collective

 89:    Input Parameter:
 90: .  svd  - the singular value solver context

 92:    Output paramter:
 93: .  mode - how to compute the transpose, one of SVD_TRANSPOSE_EXPLICIT
 94:           or SVD_TRANSPOSE_IMPLICIT

 96:    Level: advanced

 98: .seealso: SVDSetTransposeMode(), SVDSolve(), SVDSetOperator(),
 99:    SVDGetOperator(), SVDTransposeMode
100: @*/
101: PetscErrorCode SVDGetTransposeMode(SVD svd,SVDTransposeMode *mode)
102: {
106:   *mode = svd->transmode;
107:   return(0);
108: }

112: /*@
113:    SVDSetTolerances - Sets the tolerance and maximum
114:    iteration count used by the default SVD convergence testers.

116:    Logically Collective on SVD

118:    Input Parameters:
119: +  svd - the singular value solver context
120: .  tol - the convergence tolerance
121: -  maxits - maximum number of iterations to use

123:    Options Database Keys:
124: +  -svd_tol <tol> - Sets the convergence tolerance
125: -  -svd_max_it <maxits> - Sets the maximum number of iterations allowed
126:    (use PETSC_DECIDE to compute an educated guess based on basis and matrix sizes)

128:    Notes:
129:    Pass 0 to retain the previous value of any parameter.

131:    Level: intermediate

133: .seealso: SVDGetTolerances()
134: @*/
135: PetscErrorCode SVDSetTolerances(SVD svd,PetscReal tol,PetscInt maxits)
136: {
141:   if (tol) {
142:     if (tol == PETSC_DEFAULT) {
143:       tol = PETSC_DEFAULT;
144:     } else {
145:       if (tol < 0.0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
146:       svd->tol = tol;
147:     }
148:   }
149:   if (maxits) {
150:     if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
151:       svd->max_it = 0;
152:       svd->setupcalled = 0;
153:     } else {
154:       if (maxits < 0) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
155:       svd->max_it = maxits;
156:     }
157:   }
158:   return(0);
159: }

163: /*@
164:    SVDGetTolerances - Gets the tolerance and maximum
165:    iteration count used by the default SVD convergence tests.

167:    Not Collective

169:    Input Parameter:
170: .  svd - the singular value solver context

172:    Output Parameters:
173: +  tol - the convergence tolerance
174: -  maxits - maximum number of iterations

176:    Notes:
177:    The user can specify NULL for any parameter that is not needed.

179:    Level: intermediate

181: .seealso: SVDSetTolerances()
182: @*/
183: PetscErrorCode SVDGetTolerances(SVD svd,PetscReal *tol,PetscInt *maxits)
184: {
187:   if (tol)    *tol    = svd->tol;
188:   if (maxits) *maxits = svd->max_it;
189:   return(0);
190: }

194: /*@
195:    SVDSetDimensions - Sets the number of singular values to compute
196:    and the dimension of the subspace.

198:    Logically Collective on SVD

200:    Input Parameters:
201: +  svd - the singular value solver context
202: .  nsv - number of singular values to compute
203: .  ncv - the maximum dimension of the subspace to be used by the solver
204: -  mpd - the maximum dimension allowed for the projected problem

206:    Options Database Keys:
207: +  -svd_nsv <nsv> - Sets the number of singular values
208: .  -svd_ncv <ncv> - Sets the dimension of the subspace
209: -  -svd_mpd <mpd> - Sets the maximum projected dimension

211:    Notes:
212:    Pass 0 to retain the previous value of any parameter.

214:    Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
215:    dependent on the solution method and the number of singular values required.

217:    The parameters ncv and mpd are intimately related, so that the user is advised
218:    to set one of them at most. Normal usage is that
219:    (a) in cases where nsv is small, the user sets ncv (a reasonable default is 2*nsv); and
220:    (b) in cases where nsv is large, the user sets mpd.

222:    The value of ncv should always be between nsv and (nsv+mpd), typically
223:    ncv=nsv+mpd. If nev is not too large, mpd=nsv is a reasonable choice, otherwise
224:    a smaller value should be used.

226:    Level: intermediate

228: .seealso: SVDGetDimensions()
229: @*/
230: PetscErrorCode SVDSetDimensions(SVD svd,PetscInt nsv,PetscInt ncv,PetscInt mpd)
231: {
237:   if (nsv) {
238:     if (nsv<1) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nsv. Must be > 0");
239:     svd->nsv = nsv;
240:   }
241:   if (ncv) {
242:     if (ncv == PETSC_DEFAULT || ncv == PETSC_DECIDE) {
243:       svd->ncv = 0;
244:     } else {
245:       if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
246:       svd->ncv = ncv;
247:     }
248:     svd->setupcalled = 0;
249:   }
250:   if (mpd) {
251:     if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
252:       svd->mpd = 0;
253:     } else {
254:       if (mpd<1) SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
255:       svd->mpd = mpd;
256:     }
257:   }
258:   return(0);
259: }

263: /*@
264:    SVDGetDimensions - Gets the number of singular values to compute
265:    and the dimension of the subspace.

267:    Not Collective

269:    Input Parameter:
270: .  svd - the singular value context

272:    Output Parameters:
273: +  nsv - number of singular values to compute
274: .  ncv - the maximum dimension of the subspace to be used by the solver
275: -  mpd - the maximum dimension allowed for the projected problem

277:    Notes:
278:    The user can specify NULL for any parameter that is not needed.

280:    Level: intermediate

282: .seealso: SVDSetDimensions()
283: @*/
284: PetscErrorCode SVDGetDimensions(SVD svd,PetscInt *nsv,PetscInt *ncv,PetscInt *mpd)
285: {
288:   if (nsv) *nsv = svd->nsv;
289:   if (ncv) *ncv = svd->ncv;
290:   if (mpd) *mpd = svd->mpd;
291:   return(0);
292: }

296: /*@
297:     SVDSetWhichSingularTriplets - Specifies which singular triplets are
298:     to be sought.

300:     Logically Collective on SVD

302:     Input Parameter:
303: .   svd - singular value solver context obtained from SVDCreate()

305:     Output Parameter:
306: .   which - which singular triplets are to be sought

308:     Possible values:
309:     The parameter 'which' can have one of these values:

311: +     SVD_LARGEST  - largest singular values
312: -     SVD_SMALLEST - smallest singular values

314:     Options Database Keys:
315: +   -svd_largest  - Sets largest singular values
316: -   -svd_smallest - Sets smallest singular values

318:     Level: intermediate

320: .seealso: SVDGetWhichSingularTriplets(), SVDWhich
321: @*/
322: PetscErrorCode SVDSetWhichSingularTriplets(SVD svd,SVDWhich which)
323: {
327:   switch (which) {
328:     case SVD_LARGEST:
329:     case SVD_SMALLEST:
330:       if (svd->which != which) {
331:         svd->setupcalled = 0;
332:         svd->which = which;
333:       }
334:       break;
335:   default:
336:     SETERRQ(PetscObjectComm((PetscObject)svd),PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' parameter");
337:   }
338:   return(0);
339: }

343: /*@C
344:     SVDGetWhichSingularTriplets - Returns which singular triplets are
345:     to be sought.

347:     Not Collective

349:     Input Parameter:
350: .   svd - singular value solver context obtained from SVDCreate()

352:     Output Parameter:
353: .   which - which singular triplets are to be sought

355:     Notes:
356:     See SVDSetWhichSingularTriplets() for possible values of which

358:     Level: intermediate

360: .seealso: SVDSetWhichSingularTriplets(), SVDWhich
361: @*/
362: PetscErrorCode SVDGetWhichSingularTriplets(SVD svd,SVDWhich *which)
363: {
367:   *which = svd->which;
368:   return(0);
369: }

373: /*@
374:    SVDSetFromOptions - Sets SVD options from the options database.
375:    This routine must be called before SVDSetUp() if the user is to be
376:    allowed to set the solver type.

378:    Collective on SVD

380:    Input Parameters:
381: .  svd - the singular value solver context

383:    Notes:
384:    To see all options, run your program with the -help option.

386:    Level: beginner

388: .seealso:
389: @*/
390: PetscErrorCode SVDSetFromOptions(SVD svd)
391: {
392:   PetscErrorCode   ierr;
393:   char             type[256],monfilename[PETSC_MAX_PATH_LEN];
394:   PetscBool        flg;
395:   const char       *mode_list[2] = {"explicit","implicit"};
396:   PetscInt         i,j,k;
397:   PetscReal        r;
398:   PetscViewer      monviewer;
399:   SlepcConvMonitor ctx;

403:   svd->setupcalled = 0;
404:   if (!SVDRegisterAllCalled) { SVDRegisterAll(); }
405:   PetscObjectOptionsBegin((PetscObject)svd);

407:   PetscOptionsList("-svd_type","Singular Value Solver method","SVDSetType",SVDList,(char*)(((PetscObject)svd)->type_name?((PetscObject)svd)->type_name:SVDCROSS),type,256,&flg);
408:   if (flg) {
409:     SVDSetType(svd,type);
410:   } else if (!((PetscObject)svd)->type_name) {
411:     SVDSetType(svd,SVDCROSS);
412:   }

414:   PetscOptionsName("-svd_view","Print detailed information on solver used","SVDView",&flg);

416:   PetscOptionsEList("-svd_transpose_mode","Transpose SVD mode","SVDSetTransposeMode",mode_list,2,svd->transmode == PETSC_DECIDE ? "decide" : mode_list[svd->transmode],&i,&flg);
417:   if (flg) {
418:     SVDSetTransposeMode(svd,(SVDTransposeMode)i);
419:   }

421:   r = i = 0;
422:   PetscOptionsInt("-svd_max_it","Maximum number of iterations","SVDSetTolerances",svd->max_it,&i,NULL);
423:   PetscOptionsReal("-svd_tol","Tolerance","SVDSetTolerances",svd->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:svd->tol,&r,NULL);
424:   SVDSetTolerances(svd,r,i);

426:   i = j = k = 0;
427:   PetscOptionsInt("-svd_nsv","Number of singular values to compute","SVDSetDimensions",svd->nsv,&i,NULL);
428:   PetscOptionsInt("-svd_ncv","Number of basis vectors","SVDSetDimensions",svd->ncv,&j,NULL);
429:   PetscOptionsInt("-svd_mpd","Maximum dimension of projected problem","SVDSetDimensions",svd->mpd,&k,NULL);
430:   SVDSetDimensions(svd,i,j,k);

432:   PetscOptionsBoolGroupBegin("-svd_largest","compute largest singular values","SVDSetWhichSingularTriplets",&flg);
433:   if (flg) { SVDSetWhichSingularTriplets(svd,SVD_LARGEST); }
434:   PetscOptionsBoolGroupEnd("-svd_smallest","compute smallest singular values","SVDSetWhichSingularTriplets",&flg);
435:   if (flg) { SVDSetWhichSingularTriplets(svd,SVD_SMALLEST); }

437:   flg = PETSC_FALSE;
438:   PetscOptionsBool("-svd_monitor_cancel","Remove any hardwired monitor routines","SVDMonitorCancel",flg,&flg,NULL);
439:   if (flg) {
440:     SVDMonitorCancel(svd);
441:   }

443:   PetscOptionsString("-svd_monitor_all","Monitor approximate singular values and error estimates","SVDMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
444:   if (flg) {
445:     PetscViewerASCIIOpen(PetscObjectComm((PetscObject)svd),monfilename,&monviewer);
446:     SVDMonitorSet(svd,SVDMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
447:     SVDSetTrackAll(svd,PETSC_TRUE);
448:   }
449:   PetscOptionsString("-svd_monitor_conv","Monitor approximate singular values and error estimates as they converge","SVDMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
450:   if (flg) {
451:       PetscNew(struct _n_SlepcConvMonitor,&ctx);
452:       PetscViewerASCIIOpen(PetscObjectComm((PetscObject)svd),monfilename,&ctx->viewer);
453:       SVDMonitorSet(svd,SVDMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
454:   }
455:   PetscOptionsString("-svd_monitor","Monitor first unconverged approximate singular value and error estimate","SVDMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);
456:   if (flg) {
457:     PetscViewerASCIIOpen(PetscObjectComm((PetscObject)svd),monfilename,&monviewer);
458:     SVDMonitorSet(svd,SVDMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);
459:   }
460:   flg = PETSC_FALSE;
461:   PetscOptionsBool("-svd_monitor_lg","Monitor first unconverged approximate singular value and error estimate graphically","SVDMonitorSet",flg,&flg,NULL);
462:   if (flg) {
463:     SVDMonitorSet(svd,SVDMonitorLG,NULL,NULL);
464:   }
465:   flg = PETSC_FALSE;
466:   PetscOptionsBool("-svd_monitor_lg_all","Monitor error estimates graphically","SVDMonitorSet",flg,&flg,NULL);
467:   if (flg) {
468:     SVDMonitorSet(svd,SVDMonitorLGAll,NULL,NULL);
469:     SVDSetTrackAll(svd,PETSC_TRUE);
470:   }
471:   if (svd->ops->setfromoptions) {
472:     (*svd->ops->setfromoptions)(svd);
473:   }

475:   PetscObjectProcessOptionsHandlers((PetscObject)svd);
476:   PetscOptionsEnd();

478:   if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
479:   IPSetFromOptions(svd->ip);
480:   if (!svd->ds) { SVDGetDS(svd,&svd->ds); }
481:   DSSetFromOptions(svd->ds);
482:   PetscRandomSetFromOptions(svd->rand);
483:   return(0);
484: }

488: /*@
489:    SVDSetTrackAll - Specifies if the solver must compute the residual norm of all
490:    approximate singular value or not.

492:    Logically Collective on SVD

494:    Input Parameters:
495: +  svd      - the singular value solver context
496: -  trackall - whether to compute all residuals or not

498:    Notes:
499:    If the user sets trackall=PETSC_TRUE then the solver computes (or estimates)
500:    the residual norm for each singular value approximation. Computing the residual is
501:    usually an expensive operation and solvers commonly compute only the residual
502:    associated to the first unconverged singular value.

504:    The options '-svd_monitor_all' and '-svd_monitor_lg_all' automatically
505:    activate this option.

507:    Level: intermediate

509: .seealso: SVDGetTrackAll()
510: @*/
511: PetscErrorCode SVDSetTrackAll(SVD svd,PetscBool trackall)
512: {
516:   svd->trackall = trackall;
517:   return(0);
518: }

522: /*@
523:    SVDGetTrackAll - Returns the flag indicating whether all residual norms must
524:    be computed or not.

526:    Not Collective

528:    Input Parameter:
529: .  svd - the singular value solver context

531:    Output Parameter:
532: .  trackall - the returned flag

534:    Level: intermediate

536: .seealso: SVDSetTrackAll()
537: @*/
538: PetscErrorCode SVDGetTrackAll(SVD svd,PetscBool *trackall)
539: {
543:   *trackall = svd->trackall;
544:   return(0);
545: }


550: /*@C
551:    SVDSetOptionsPrefix - Sets the prefix used for searching for all
552:    SVD options in the database.

554:    Logically Collective on SVD

556:    Input Parameters:
557: +  svd - the singular value solver context
558: -  prefix - the prefix string to prepend to all SVD option requests

560:    Notes:
561:    A hyphen (-) must NOT be given at the beginning of the prefix name.
562:    The first character of all runtime options is AUTOMATICALLY the
563:    hyphen.

565:    For example, to distinguish between the runtime options for two
566:    different SVD contexts, one could call
567: .vb
568:       SVDSetOptionsPrefix(svd1,"svd1_")
569:       SVDSetOptionsPrefix(svd2,"svd2_")
570: .ve

572:    Level: advanced

574: .seealso: SVDAppendOptionsPrefix(), SVDGetOptionsPrefix()
575: @*/
576: PetscErrorCode SVDSetOptionsPrefix(SVD svd,const char *prefix)
577: {
579:   PetscBool      flg1,flg2;
580:   EPS            eps;

584:   if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
585:   IPSetOptionsPrefix(svd->ip,prefix);
586:   if (!svd->ds) { SVDGetDS(svd,&svd->ds); }
587:   DSSetOptionsPrefix(svd->ds,prefix);
588:   PetscObjectSetOptionsPrefix((PetscObject)svd,prefix);
589:   PetscObjectTypeCompare((PetscObject)svd,SVDCROSS,&flg1);
590:   PetscObjectTypeCompare((PetscObject)svd,SVDCYCLIC,&flg2);
591:   if (flg1) {
592:     SVDCrossGetEPS(svd,&eps);
593:   } else if (flg2) {
594:       SVDCyclicGetEPS(svd,&eps);
595:   }
596:   if (flg1 || flg2) {
597:     EPSSetOptionsPrefix(eps,prefix);
598:     EPSAppendOptionsPrefix(eps,"svd_");
599:   }
600:   return(0);
601: }

605: /*@C
606:    SVDAppendOptionsPrefix - Appends to the prefix used for searching for all
607:    SVD options in the database.

609:    Logically Collective on SVD

611:    Input Parameters:
612: +  svd - the singular value solver context
613: -  prefix - the prefix string to prepend to all SVD option requests

615:    Notes:
616:    A hyphen (-) must NOT be given at the beginning of the prefix name.
617:    The first character of all runtime options is AUTOMATICALLY the hyphen.

619:    Level: advanced

621: .seealso: SVDSetOptionsPrefix(), SVDGetOptionsPrefix()
622: @*/
623: PetscErrorCode SVDAppendOptionsPrefix(SVD svd,const char *prefix)
624: {
626:   PetscBool      flg1,flg2;
627:   EPS            eps;

631:   if (!svd->ip) { SVDGetIP(svd,&svd->ip); }
632:   IPSetOptionsPrefix(svd->ip,prefix);
633:   if (!svd->ds) { SVDGetDS(svd,&svd->ds); }
634:   DSSetOptionsPrefix(svd->ds,prefix);
635:   PetscObjectAppendOptionsPrefix((PetscObject)svd,prefix);
636:   PetscObjectTypeCompare((PetscObject)svd,SVDCROSS,&flg1);
637:   PetscObjectTypeCompare((PetscObject)svd,SVDCYCLIC,&flg2);
638:   if (flg1) {
639:     SVDCrossGetEPS(svd,&eps);
640:   } else if (flg2) {
641:     SVDCyclicGetEPS(svd,&eps);
642:   }
643:   if (flg1 || flg2) {
644:     EPSSetOptionsPrefix(eps,((PetscObject)svd)->prefix);
645:     EPSAppendOptionsPrefix(eps,"svd_");
646:   }
647:   return(0);
648: }

652: /*@C
653:    SVDGetOptionsPrefix - Gets the prefix used for searching for all
654:    SVD options in the database.

656:    Not Collective

658:    Input Parameters:
659: .  svd - the singular value solver context

661:    Output Parameters:
662: .  prefix - pointer to the prefix string used is returned

664:    Notes: On the fortran side, the user should pass in a string 'prefix' of
665:    sufficient length to hold the prefix.

667:    Level: advanced

669: .seealso: SVDSetOptionsPrefix(), SVDAppendOptionsPrefix()
670: @*/
671: PetscErrorCode SVDGetOptionsPrefix(SVD svd,const char *prefix[])
672: {

678:   PetscObjectGetOptionsPrefix((PetscObject)svd,prefix);
679:   return(0);
680: }

slepc-3.4.2.dfsg.orig/src/svd/interface/svdmat.c.html0000644000175000017500000001364312211062077021372 0ustar gladkgladk
Actual source code: svdmat.c

  1: /*
  2:      SVD routines for accessing the problem matrix.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/svdimpl.h>      /*I "slepcsvd.h" I*/

 28: PetscErrorCode SVDMatMult(SVD svd,PetscBool trans,Vec x,Vec y)
 29: {

 33:   svd->matvecs++;
 34:   if (trans) {
 35:     if (svd->AT) {
 36:       MatMult(svd->AT,x,y);
 37:     } else {
 38: #if defined(PETSC_USE_COMPLEX)
 39:       MatMultHermitianTranspose(svd->A,x,y);
 40: #else
 41:       MatMultTranspose(svd->A,x,y);
 42: #endif
 43:     }
 44:   } else {
 45:     if (svd->A) {
 46:       MatMult(svd->A,x,y);
 47:     } else {
 48: #if defined(PETSC_USE_COMPLEX)
 49:       MatMultHermitianTranspose(svd->AT,x,y);
 50: #else
 51:       MatMultTranspose(svd->AT,x,y);
 52: #endif
 53:     }
 54:   }
 55:   return(0);
 56: }

 60: PetscErrorCode SVDMatGetVecs(SVD svd,Vec *x,Vec *y)
 61: {

 65:   if (svd->A) {
 66:     MatGetVecs(svd->A,x,y);
 67:   } else {
 68:     MatGetVecs(svd->AT,y,x);
 69:   }
 70:   return(0);
 71: }

 75: PetscErrorCode SVDMatGetSize(SVD svd,PetscInt *m,PetscInt *n)
 76: {

 80:   if (svd->A) {
 81:     MatGetSize(svd->A,m,n);
 82:   } else {
 83:     MatGetSize(svd->AT,n,m);
 84:   }
 85:   return(0);
 86: }

 90: PetscErrorCode SVDMatGetLocalSize(SVD svd,PetscInt *m,PetscInt *n)
 91: {

 95:   if (svd->A) {
 96:     MatGetLocalSize(svd->A,m,n);
 97:   } else {
 98:     MatGetLocalSize(svd->AT,n,m);
 99:   }
100:   return(0);
101: }
slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/0000755000175000017500000000000012214143515020513 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/svdmonf.c0000644000175000017500000000177012211062077022340 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* svdmon.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdmonitorcancel_ SVDMONITORCANCEL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdmonitorcancel_ svdmonitorcancel #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdmonitorcancel_(SVD *svd, int *__ierr ){ *__ierr = SVDMonitorCancel(*svd); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/svdsolvef.c0000644000175000017500000000631512211062077022677 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* svdsolve.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsolve_ SVDSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsolve_ svdsolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgetiterationnumber_ SVDGETITERATIONNUMBER #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgetiterationnumber_ svdgetiterationnumber #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgetconverged_ SVDGETCONVERGED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgetconverged_ svdgetconverged #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgetsingulartriplet_ SVDGETSINGULARTRIPLET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgetsingulartriplet_ svdgetsingulartriplet #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcomputeresidualnorms_ SVDCOMPUTERESIDUALNORMS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcomputeresidualnorms_ svdcomputeresidualnorms #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdcomputerelativeerror_ SVDCOMPUTERELATIVEERROR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdcomputerelativeerror_ svdcomputerelativeerror #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgetoperationcounters_ SVDGETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgetoperationcounters_ svdgetoperationcounters #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdsolve_(SVD *svd, int *__ierr ){ *__ierr = SVDSolve(*svd); } void PETSC_STDCALL svdgetiterationnumber_(SVD *svd,PetscInt *its, int *__ierr ){ *__ierr = SVDGetIterationNumber(*svd,its); } void PETSC_STDCALL svdgetconverged_(SVD *svd,PetscInt *nconv, int *__ierr ){ *__ierr = SVDGetConverged(*svd,nconv); } void PETSC_STDCALL svdgetsingulartriplet_(SVD *svd,PetscInt *i,PetscReal *sigma,Vec u,Vec v, int *__ierr ){ *__ierr = SVDGetSingularTriplet(*svd,*i,sigma, (Vec)PetscToPointer((u) ), (Vec)PetscToPointer((v) )); } void PETSC_STDCALL svdcomputeresidualnorms_(SVD *svd,PetscInt *i,PetscReal *norm1,PetscReal *norm2, int *__ierr ){ *__ierr = SVDComputeResidualNorms(*svd,*i,norm1,norm2); } void PETSC_STDCALL svdcomputerelativeerror_(SVD *svd,PetscInt *i,PetscReal *error, int *__ierr ){ *__ierr = SVDComputeRelativeError(*svd,*i,error); } void PETSC_STDCALL svdgetoperationcounters_(SVD *svd,PetscInt* matvecs,PetscInt* dots, int *__ierr ){ *__ierr = SVDGetOperationCounters(*svd,matvecs,dots); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/makefile0000644000175000017500000000042012211062077022207 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = svdbasicf.c svdmonf.c svdoptsf.c svdsetupf.c svdsolvef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/svd/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/svdoptsf.c0000644000175000017500000000740112211062077022531 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* svdopts.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsettransposemode_ SVDSETTRANSPOSEMODE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsettransposemode_ svdsettransposemode #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsettolerances_ SVDSETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsettolerances_ svdsettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgettolerances_ SVDGETTOLERANCES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgettolerances_ svdgettolerances #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetdimensions_ SVDSETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetdimensions_ svdsetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgetdimensions_ SVDGETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgetdimensions_ svdgetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetwhichsingulartriplets_ SVDSETWHICHSINGULARTRIPLETS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetwhichsingulartriplets_ svdsetwhichsingulartriplets #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetfromoptions_ SVDSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetfromoptions_ svdsetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsettrackall_ SVDSETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsettrackall_ svdsettrackall #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgettrackall_ SVDGETTRACKALL #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgettrackall_ svdgettrackall #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdsettransposemode_(SVD *svd,SVDTransposeMode *mode, int *__ierr ){ *__ierr = SVDSetTransposeMode(*svd,*mode); } void PETSC_STDCALL svdsettolerances_(SVD *svd,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = SVDSetTolerances(*svd,*tol,*maxits); } void PETSC_STDCALL svdgettolerances_(SVD *svd,PetscReal *tol,PetscInt *maxits, int *__ierr ){ *__ierr = SVDGetTolerances(*svd,tol,maxits); } void PETSC_STDCALL svdsetdimensions_(SVD *svd,PetscInt *nsv,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = SVDSetDimensions(*svd,*nsv,*ncv,*mpd); } void PETSC_STDCALL svdgetdimensions_(SVD *svd,PetscInt *nsv,PetscInt *ncv,PetscInt *mpd, int *__ierr ){ *__ierr = SVDGetDimensions(*svd,nsv,ncv,mpd); } void PETSC_STDCALL svdsetwhichsingulartriplets_(SVD *svd,SVDWhich *which, int *__ierr ){ *__ierr = SVDSetWhichSingularTriplets(*svd,*which); } void PETSC_STDCALL svdsetfromoptions_(SVD *svd, int *__ierr ){ *__ierr = SVDSetFromOptions(*svd); } void PETSC_STDCALL svdsettrackall_(SVD *svd,PetscBool *trackall, int *__ierr ){ *__ierr = SVDSetTrackAll(*svd,*trackall); } void PETSC_STDCALL svdgettrackall_(SVD *svd,PetscBool *trackall, int *__ierr ){ *__ierr = SVDGetTrackAll(*svd,trackall); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/svdbasicf.c0000644000175000017500000000352212211062077022625 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* svdbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdprintsolution_ SVDPRINTSOLUTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdprintsolution_ svdprintsolution #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdreset_ SVDRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdreset_ svdreset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetip_ SVDSETIP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetip_ svdsetip #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetds_ SVDSETDS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetds_ svdsetds #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdprintsolution_(SVD *svd,PetscViewer viewer, int *__ierr ){ *__ierr = SVDPrintSolution(*svd, (PetscViewer)PetscToPointer((viewer) )); } void PETSC_STDCALL svdreset_(SVD *svd, int *__ierr ){ *__ierr = SVDReset(*svd); } void PETSC_STDCALL svdsetip_(SVD *svd,IP *ip, int *__ierr ){ *__ierr = SVDSetIP(*svd,*ip); } void PETSC_STDCALL svdsetds_(SVD *svd,DS *ds, int *__ierr ){ *__ierr = SVDSetDS(*svd,*ds); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/interface/ftn-auto/svdsetupf.c0000644000175000017500000000441512211062077022706 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* svdsetup.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcsvd.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetoperator_ SVDSETOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetoperator_ svdsetoperator #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdgetoperator_ SVDGETOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdgetoperator_ svdgetoperator #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetup_ SVDSETUP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetup_ svdsetup #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetinitialspace_ SVDSETINITIALSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetinitialspace_ svdsetinitialspace #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define svdsetinitialspaceleft_ SVDSETINITIALSPACELEFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define svdsetinitialspaceleft_ svdsetinitialspaceleft #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL svdsetoperator_(SVD *svd,Mat mat, int *__ierr ){ *__ierr = SVDSetOperator(*svd, (Mat)PetscToPointer((mat) )); } void PETSC_STDCALL svdgetoperator_(SVD *svd,Mat *A, int *__ierr ){ *__ierr = SVDGetOperator(*svd,A); } void PETSC_STDCALL svdsetup_(SVD *svd, int *__ierr ){ *__ierr = SVDSetUp(*svd); } void PETSC_STDCALL svdsetinitialspace_(SVD *svd,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = SVDSetInitialSpace(*svd,*n,is); } void PETSC_STDCALL svdsetinitialspaceleft_(SVD *svd,PetscInt *n,Vec *is, int *__ierr ){ *__ierr = SVDSetInitialSpaceLeft(*svd,*n,is); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/svd/index.html0000644000175000017500000000243212211062077017014 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

interface/
impls/
examples/
../../include/slepc-private/svdimpl.h
../../include/slepcsvd.h
makefile
slepc-3.4.2.dfsg.orig/src/st/0000755000175000017500000000000012214143515014650 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/examples/0000755000175000017500000000000012214143515016466 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/examples/tutorials/0000755000175000017500000000000012211062077020514 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/examples/tutorials/output/0000755000175000017500000000000012211062077022054 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/examples/tutorials/output/ex10_1.out0000644000175000017500000000034112211062077023600 0ustar gladkgladk 1-D Laplacian Eigenproblem (shell-enabled), n=30 Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 3.98974, 3.95906, 3.90828, 3.83792 slepc-3.4.2.dfsg.orig/src/st/examples/tutorials/ex10.c.html0000644000175000017500000005405112211062077022405 0ustar gladkgladk

Actual source code: ex10.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Illustrates the use of shell spectral transformations. "
 23:   "The problem to be solved is the same as ex1.c and"
 24:   "corresponds to the Laplacian operator in 1 dimension.\n\n"
 25:   "The command line options are:\n"
 26:   "  -n <n>, where <n> = number of grid subdivisions = matrix dimension.\n\n";

 28: #include <slepceps.h>

 30: /* Define context for user-provided spectral transformation */
 31: typedef struct {
 32:   KSP        ksp;
 33: } SampleShellST;

 35: /* Declare routines for user-provided spectral transformation */
 36: PetscErrorCode STCreate_User(SampleShellST**);
 37: PetscErrorCode STSetUp_User(SampleShellST*,ST);
 38: PetscErrorCode STApply_User(ST,Vec,Vec);
 39: PetscErrorCode STBackTransform_User(ST,PetscInt,PetscScalar*,PetscScalar*);
 40: PetscErrorCode STDestroy_User(SampleShellST*);

 44: int main (int argc,char **argv)
 45: {
 46:   Mat            A;               /* operator matrix */
 47:   EPS            eps;             /* eigenproblem solver context */
 48:   ST             st;              /* spectral transformation context */
 49:   SampleShellST  *shell;          /* user-defined spectral transform context */
 50:   EPSType        type;
 51:   PetscScalar    value[3];
 52:   PetscInt       n=30,i,col[3],Istart,Iend,FirstBlock=0,LastBlock=0,nev;
 53:   PetscBool      isShell;

 56:   SlepcInitialize(&argc,&argv,(char*)0,help);

 58:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 59:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem (shell-enabled), n=%D\n\n",n);

 61:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 62:      Compute the operator matrix that defines the eigensystem, Ax=kx
 63:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 65:   MatCreate(PETSC_COMM_WORLD,&A);
 66:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 67:   MatSetFromOptions(A);
 68:   MatSetUp(A);

 70:   MatGetOwnershipRange(A,&Istart,&Iend);
 71:   if (Istart==0) FirstBlock=PETSC_TRUE;
 72:   if (Iend==n) LastBlock=PETSC_TRUE;
 73:   value[0]=-1.0; value[1]=2.0; value[2]=-1.0;
 74:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 75:     col[0]=i-1; col[1]=i; col[2]=i+1;
 76:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 77:   }
 78:   if (LastBlock) {
 79:     i=n-1; col[0]=n-2; col[1]=n-1;
 80:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 81:   }
 82:   if (FirstBlock) {
 83:     i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0;
 84:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 85:   }

 87:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 88:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 90:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 91:                 Create the eigensolver and set various options
 92:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 94:   /*
 95:      Create eigensolver context
 96:   */
 97:   EPSCreate(PETSC_COMM_WORLD,&eps);

 99:   /*
100:      Set operators. In this case, it is a standard eigenvalue problem
101:   */
102:   EPSSetOperators(eps,A,NULL);
103:   EPSSetProblemType(eps,EPS_HEP);

105:   /*
106:      Set solver parameters at runtime
107:   */
108:   EPSSetFromOptions(eps);

110:   /*
111:      Initialize shell spectral transformation if selected by user
112:   */
113:   EPSGetST(eps,&st);
114:   PetscObjectTypeCompare((PetscObject)st,STSHELL,&isShell);
115:   if (isShell) {
116:     /* (Optional) Create a context for the user-defined spectral tranform;
117:        this context can be defined to contain any application-specific data. */
118:     STCreate_User(&shell);

120:     /* (Required) Set the user-defined routine for applying the operator */
121:     STShellSetApply(st,STApply_User);
122:     STShellSetContext(st,shell);

124:     /* (Optional) Set the user-defined routine for back-transformation */
125:     STShellSetBackTransform(st,STBackTransform_User);

127:     /* (Optional) Set a name for the transformation, used for STView() */
128:     PetscObjectSetName((PetscObject)st,"MyTransformation");

130:     /* (Optional) Do any setup required for the new transformation */
131:     STSetUp_User(shell,st);
132:   }

134:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135:                       Solve the eigensystem
136:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

138:   EPSSolve(eps);

140:   /*
141:      Optional: Get some information from the solver and display it
142:   */
143:   EPSGetType(eps,&type);
144:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
145:   EPSGetDimensions(eps,&nev,NULL,NULL);
146:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

148:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
149:                     Display solution and clean up
150:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

152:   EPSPrintSolution(eps,NULL);
153:   if (isShell) {
154:     STDestroy_User(shell);
155:   }
156:   EPSDestroy(&eps);
157:   MatDestroy(&A);
158:   SlepcFinalize();
159:   return 0;
160: }

162: /***********************************************************************/
163: /*     Routines for a user-defined shell spectral transformation       */
164: /***********************************************************************/

168: /*
169:    STCreate_User - This routine creates a user-defined
170:    spectral transformation context.

172:    Output Parameter:
173: .  shell - user-defined spectral transformation context
174: */
175: PetscErrorCode STCreate_User(SampleShellST **shell)
176: {
177:   SampleShellST  *newctx;

181:   PetscNew(SampleShellST,&newctx);
182:   KSPCreate(PETSC_COMM_WORLD,&newctx->ksp);
183:   KSPAppendOptionsPrefix(newctx->ksp,"st_");
184:   *shell = newctx;
185:   return(0);
186: }
187: /* ------------------------------------------------------------------- */
190: /*
191:    STSetUp_User - This routine sets up a user-defined
192:    spectral transformation context.

194:    Input Parameters:
195: .  shell - user-defined spectral transformation context
196: .  st    - spectral transformation context containing the operator matrices

198:    Output Parameter:
199: .  shell - fully set up user-defined transformation context

201:    Notes:
202:    In this example, the user-defined transformation is simply OP=A^-1.
203:    Therefore, the eigenpairs converge in reversed order. The KSP object
204:    used for the solution of linear systems with A is handled via the
205:    user-defined context SampleShellST.
206: */
207: PetscErrorCode STSetUp_User(SampleShellST *shell,ST st)
208: {
209:   Mat            A;

213:   STGetOperators(st,0,&A);
214:   KSPSetOperators(shell->ksp,A,A,DIFFERENT_NONZERO_PATTERN);
215:   KSPSetFromOptions(shell->ksp);
216:   return(0);
217: }
218: /* ------------------------------------------------------------------- */
221: /*
222:    STApply_User - This routine demonstrates the use of a
223:    user-provided spectral transformation.

225:    Input Parameters:
226: .  ctx - optional user-defined context, as set by STShellSetContext()
227: .  x - input vector

229:    Output Parameter:
230: .  y - output vector

232:    Notes:
233:    The transformation implemented in this code is just OP=A^-1 and
234:    therefore it is of little use, merely as an example of working with
235:    a STSHELL.
236: */
237: PetscErrorCode STApply_User(ST st,Vec x,Vec y)
238: {
239:   SampleShellST  *shell;

243:   STShellGetContext(st,(void**)&shell);
244:   KSPSolve(shell->ksp,x,y);
245:   return(0);
246: }
247: /* ------------------------------------------------------------------- */
250: /*
251:    STBackTransform_User - This routine demonstrates the use of a
252:    user-provided spectral transformation.

254:    Input Parameters:
255: .  ctx  - optional user-defined context, as set by STShellSetContext()
256: .  eigr - pointer to real part of eigenvalues
257: .  eigi - pointer to imaginary part of eigenvalues

259:    Output Parameters:
260: .  eigr - modified real part of eigenvalues
261: .  eigi - modified imaginary part of eigenvalues

263:    Notes:
264:    This code implements the back transformation of eigenvalues in
265:    order to retrieve the eigenvalues of the original problem. In this
266:    example, simply set k_i = 1/k_i.
267: */
268: PetscErrorCode STBackTransform_User(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)
269: {
270:   PetscInt j;

273:   for (j=0;j<n;j++) {
274:     eigr[j] = 1.0 / eigr[j];
275:   }
276:   return(0);
277: }
278: /* ------------------------------------------------------------------- */
281: /*
282:    STDestroy_User - This routine destroys a user-defined
283:    spectral transformation context.

285:    Input Parameter:
286: .  shell - user-defined spectral transformation context
287: */
288: PetscErrorCode STDestroy_User(SampleShellST *shell)
289: {

293:   KSPDestroy(&shell->ksp);
294:   PetscFree(shell);
295:   return(0);
296: }

slepc-3.4.2.dfsg.orig/src/st/examples/tutorials/makefile0000644000175000017500000000302212211062077022211 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/st/examples/tutorials/ EXAMPLESC = ex10.c EXAMPLESF = MANSEC = ST TESTEXAMPLES_C = ex10.PETSc runex10_1 ex10.rm include ${SLEPC_DIR}/conf/slepc_common ex10: ex10.o chkopts -${CLINKER} -o ex10 ex10.o ${SLEPC_LIB} ${RM} ex10.o #------------------------------------------------------------------------------------ runex10_1: -@${MPIEXEC} -np 1 ./ex10 -eps_nev 4 -eps_terse > ex10_1.tmp 2>&1; \ if (${DIFF} output/ex10_1.out ex10_1.tmp) then true; \ else echo "Possible problem with ex10_1, diffs above"; fi; \ ${RM} -f ex10_1.tmp slepc-3.4.2.dfsg.orig/src/st/examples/tutorials/makefile.html0000644000175000017500000000506712211062077023167 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/st/examples/tutorials/
EXAMPLESC  = ex10.c
EXAMPLESF  =
MANSEC     = ST

TESTEXAMPLES_C      = ex10.PETSc runex10_1 ex10.rm

include ${SLEPC_DIR}/conf/slepc_common

ex10: ex10.o chkopts
	-${CLINKER} -o ex10 ex10.o ${SLEPC_LIB}
	${RM} ex10.o

#------------------------------------------------------------------------------------

runex10_1:
	-@${MPIEXEC} -np 1 ./ex10 -eps_nev 4 -eps_terse > ex10_1.tmp 2>&1; \
	   if (${DIFF} output/ex10_1.out ex10_1.tmp) then true; \
	   else echo "Possible problem with ex10_1, diffs above"; fi; \
	   ${RM} -f ex10_1.tmp

slepc-3.4.2.dfsg.orig/src/st/examples/tutorials/index.html0000644000175000017500000000275412211062077022521 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

ex10.c: Illustrates the use of shell spectral transformations
makefile
slepc-3.4.2.dfsg.orig/src/st/examples/tutorials/ex10.c0000644000175000017500000002440612211062077021443 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Illustrates the use of shell spectral transformations. " "The problem to be solved is the same as ex1.c and" "corresponds to the Laplacian operator in 1 dimension.\n\n" "The command line options are:\n" " -n , where = number of grid subdivisions = matrix dimension.\n\n"; #include /* Define context for user-provided spectral transformation */ typedef struct { KSP ksp; } SampleShellST; /* Declare routines for user-provided spectral transformation */ PetscErrorCode STCreate_User(SampleShellST**); PetscErrorCode STSetUp_User(SampleShellST*,ST); PetscErrorCode STApply_User(ST,Vec,Vec); PetscErrorCode STBackTransform_User(ST,PetscInt,PetscScalar*,PetscScalar*); PetscErrorCode STDestroy_User(SampleShellST*); #undef __FUNCT__ #define __FUNCT__ "main" int main (int argc,char **argv) { Mat A; /* operator matrix */ EPS eps; /* eigenproblem solver context */ ST st; /* spectral transformation context */ SampleShellST *shell; /* user-defined spectral transform context */ EPSType type; PetscScalar value[3]; PetscInt n=30,i,col[3],Istart,Iend,FirstBlock=0,LastBlock=0,nev; PetscBool isShell; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem (shell-enabled), n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create eigensolver context */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); /* Set operators. In this case, it is a standard eigenvalue problem */ ierr = EPSSetOperators(eps,A,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); /* Set solver parameters at runtime */ ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* Initialize shell spectral transformation if selected by user */ ierr = EPSGetST(eps,&st);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)st,STSHELL,&isShell);CHKERRQ(ierr); if (isShell) { /* (Optional) Create a context for the user-defined spectral tranform; this context can be defined to contain any application-specific data. */ ierr = STCreate_User(&shell);CHKERRQ(ierr); /* (Required) Set the user-defined routine for applying the operator */ ierr = STShellSetApply(st,STApply_User);CHKERRQ(ierr); ierr = STShellSetContext(st,shell);CHKERRQ(ierr); /* (Optional) Set the user-defined routine for back-transformation */ ierr = STShellSetBackTransform(st,STBackTransform_User);CHKERRQ(ierr); /* (Optional) Set a name for the transformation, used for STView() */ ierr = PetscObjectSetName((PetscObject)st,"MyTransformation");CHKERRQ(ierr); /* (Optional) Do any setup required for the new transformation */ ierr = STSetUp_User(shell,st);CHKERRQ(ierr); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); /* Optional: Get some information from the solver and display it */ ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); if (isShell) { ierr = STDestroy_User(shell);CHKERRQ(ierr); } ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } /***********************************************************************/ /* Routines for a user-defined shell spectral transformation */ /***********************************************************************/ #undef __FUNCT__ #define __FUNCT__ "STCreate_User" /* STCreate_User - This routine creates a user-defined spectral transformation context. Output Parameter: . shell - user-defined spectral transformation context */ PetscErrorCode STCreate_User(SampleShellST **shell) { SampleShellST *newctx; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = PetscNew(SampleShellST,&newctx);CHKERRQ(ierr); ierr = KSPCreate(PETSC_COMM_WORLD,&newctx->ksp);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(newctx->ksp,"st_");CHKERRQ(ierr); *shell = newctx; PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "STSetUp_User" /* STSetUp_User - This routine sets up a user-defined spectral transformation context. Input Parameters: . shell - user-defined spectral transformation context . st - spectral transformation context containing the operator matrices Output Parameter: . shell - fully set up user-defined transformation context Notes: In this example, the user-defined transformation is simply OP=A^-1. Therefore, the eigenpairs converge in reversed order. The KSP object used for the solution of linear systems with A is handled via the user-defined context SampleShellST. */ PetscErrorCode STSetUp_User(SampleShellST *shell,ST st) { Mat A; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = STGetOperators(st,0,&A);CHKERRQ(ierr); ierr = KSPSetOperators(shell->ksp,A,A,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetFromOptions(shell->ksp);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "STApply_User" /* STApply_User - This routine demonstrates the use of a user-provided spectral transformation. Input Parameters: . ctx - optional user-defined context, as set by STShellSetContext() . x - input vector Output Parameter: . y - output vector Notes: The transformation implemented in this code is just OP=A^-1 and therefore it is of little use, merely as an example of working with a STSHELL. */ PetscErrorCode STApply_User(ST st,Vec x,Vec y) { SampleShellST *shell; PetscErrorCode ierr; PetscFunctionBeginUser; ierr = STShellGetContext(st,(void**)&shell);CHKERRQ(ierr); ierr = KSPSolve(shell->ksp,x,y);CHKERRQ(ierr); PetscFunctionReturn(0); } /* ------------------------------------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "STBackTransform_User" /* STBackTransform_User - This routine demonstrates the use of a user-provided spectral transformation. Input Parameters: . ctx - optional user-defined context, as set by STShellSetContext() . eigr - pointer to real part of eigenvalues . eigi - pointer to imaginary part of eigenvalues Output Parameters: . eigr - modified real part of eigenvalues . eigi - modified imaginary part of eigenvalues Notes: This code implements the back transformation of eigenvalues in order to retrieve the eigenvalues of the original problem. In this example, simply set k_i = 1/k_i. */ PetscErrorCode STBackTransform_User(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { PetscInt j; PetscFunctionBeginUser; for (j=0;jksp);CHKERRQ(ierr); ierr = PetscFree(shell);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/examples/makefile0000644000175000017500000000200412211062077020162 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/st/examples/ DIRS = tests tutorials include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/examples/makefile.html0000644000175000017500000000351312211062077021133 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/st/examples/
DIRS     = tests tutorials

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/st/examples/tests/0000755000175000017500000000000012214143515017630 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/examples/tests/output/0000755000175000017500000000000012214143515021170 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/examples/tests/output/test2_1.out0000644000175000017500000000207412211062077023205 0ustar gladkgladk 1-D Laplacian, n=10 ST type shift Vector Object: 1 MPI processes type: seq 1 0 0 0 0 0 0 0 0 1 With shift=0.1 Vector Object: 1 MPI processes type: seq 1.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 1.1 ST type sinvert With shift=0.1 Vector Object: 1 MPI processes type: seq -18.0797 -35.3515 -50.0881 -60.8159 -66.4621 -66.4621 -60.8159 -50.0881 -35.3515 -18.0797 With shift=-0.5 Vector Object: 1 MPI processes type: seq 0.998536 1.49634 1.74231 1.85944 1.9063 1.9063 1.85944 1.74231 1.49634 0.998536 ST type cayley With shift=-0.5, antishift=-0.5 Vector Object: 1 MPI processes type: seq 0.00146413 -0.49634 -0.742313 -0.859444 -0.906296 -0.906296 -0.859444 -0.742313 -0.49634 0.00146413 With shift=1.1, antishift=1.1 Vector Object: 1 MPI processes type: seq -0.48258 -2.53432 -2.89831 -1.17416 0.741569 0.741569 -1.17416 -2.89831 -2.53432 -0.48258 With shift=1.1, antishift=-1 Vector Object: 1 MPI processes type: seq 0.93261 0.839349 0.822804 0.901175 0.988253 0.988253 0.901175 0.822804 0.839349 0.93261 Vector Object: 1 MPI processes type: seq 0 -1 -1 -1 -1 -1 -1 -1 -1 0 slepc-3.4.2.dfsg.orig/src/st/examples/tests/output/test1_2.out0000644000175000017500000000155412211062077023207 0ustar gladkgladkeps type krylovschur 1-D Laplacian Eigenproblem, n=30 Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 eps type arnoldi 1-D Laplacian Eigenproblem, n=30 Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 eps type gd 1-D Laplacian Eigenproblem, n=30 Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 eps type jd 1-D Laplacian Eigenproblem, n=30 Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 slepc-3.4.2.dfsg.orig/src/st/examples/tests/output/test3_1.out0000644000175000017500000000213212211062077023201 0ustar gladkgladk 1-D Laplacian plus diagonal, n=10 ST type shift Vector Object: 1 MPI processes type: seq -1 0 0 0 0 0 0 0 0 0.111111 With shift=0.1 Vector Object: 1 MPI processes type: seq -0.9 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.211111 ST type sinvert With shift=0.1 Vector Object: 1 MPI processes type: seq 0.882432 2.85311 3.53847 1.51614 -3.96103 -11.8538 -18.8197 -20.4937 -14.8222 -5.2929 With shift=-0.5 Vector Object: 1 MPI processes type: seq 0.0585408 1.08781 1.66099 1.89515 1.97204 1.99301 1.99649 1.98947 1.94557 1.68393 ST type cayley With shift=-0.5, antishift=-0.5 Vector Object: 1 MPI processes type: seq 0.941459 -0.0878112 -0.660987 -0.895151 -0.97204 -0.993008 -0.996495 -0.989466 -0.945566 -0.683933 With shift=1.1, antishift=1.1 Vector Object: 1 MPI processes type: seq -0.865819 -2.58404 -2.55982 0.896001 -1.90499 -0.724035 -1.06089 -0.995864 -0.962683 -1.25789 With shift=1.1, antishift=-1 Vector Object: 1 MPI processes type: seq 0.91519 0.837089 0.83819 0.995273 0.867955 0.921635 0.906323 0.909279 0.910787 0.897369 Vector Object: 1 MPI processes type: seq 2 -1 -2 -3 -4 -5 -6 -7 -8 -8 slepc-3.4.2.dfsg.orig/src/st/examples/tests/output/test1_1.out0000644000175000017500000000155412211062077023206 0ustar gladkgladkeps type krylovschur 1-D Laplacian Eigenproblem, n=30 Solution method: krylovschur Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 eps type arnoldi 1-D Laplacian Eigenproblem, n=30 Solution method: arnoldi Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 eps type gd 1-D Laplacian Eigenproblem, n=30 Solution method: gd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 eps type jd 1-D Laplacian Eigenproblem, n=30 Solution method: jd Number of requested eigenvalues: 4 All requested eigenvalues computed up to the required tolerance: 0.01026, 0.04094, 0.09172, 0.16208 slepc-3.4.2.dfsg.orig/src/st/examples/tests/test1.c.html0000644000175000017500000002752212211062077022007 0ustar gladkgladk
Actual source code: test1.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test ST with shell matrices as problem matrices.\n\n";

 24: #include <slepceps.h>

 26: static PetscErrorCode MatGetDiagonal_Shell(Mat S,Vec diag);
 27: static PetscErrorCode MatMultTranspose_Shell(Mat S,Vec x,Vec y);
 28: static PetscErrorCode MatMult_Shell(Mat S,Vec x,Vec y);
 29: static PetscErrorCode MatDuplicate_Shell(Mat S,MatDuplicateOption op,Mat *M);

 33: static PetscErrorCode MyShellMatCreate(Mat *A,Mat *M)
 34: {
 36:   MPI_Comm       comm;
 37:   PetscInt       n;

 40:   MatGetSize(*A,&n,NULL);
 41:   PetscObjectGetComm((PetscObject)*A,&comm);
 42:   MatCreateShell(comm,PETSC_DECIDE,PETSC_DECIDE,n,n,A,M);
 43:   MatSetFromOptions(*M);
 44:   MatShellSetOperation(*M,MATOP_MULT,(void(*)())MatMult_Shell);
 45:   MatShellSetOperation(*M,MATOP_MULT_TRANSPOSE,(void(*)())MatMultTranspose_Shell);
 46:   MatShellSetOperation(*M,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Shell);
 47:   MatShellSetOperation(*M,MATOP_DUPLICATE,(void(*)())MatDuplicate_Shell);
 48:   return(0);
 49: }

 53: int main(int argc,char **argv)
 54: {
 55:   Mat            A,S;         /* problem matrix */
 56:   EPS            eps;         /* eigenproblem solver context */
 57:   EPSType        type;
 58:   PetscScalar    value[3];
 59:   PetscInt       n=30,i,Istart,Iend,col[3],nev;
 60:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

 63:   SlepcInitialize(&argc,&argv,(char*)0,help);

 65:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 66:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);

 68:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 69:      Compute the operator matrix that defines the eigensystem, Ax=kx
 70:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 72:   MatCreate(PETSC_COMM_WORLD,&A);
 73:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 74:   MatSetFromOptions(A);
 75:   MatSetUp(A);

 77:   MatGetOwnershipRange(A,&Istart,&Iend);
 78:   if (Istart==0) FirstBlock=PETSC_TRUE;
 79:   if (Iend==n) LastBlock=PETSC_TRUE;
 80:   value[0]=-1.0; value[1]=2.0; value[2]=-1.0;
 81:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 82:     col[0]=i-1; col[1]=i; col[2]=i+1;
 83:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 84:   }
 85:   if (LastBlock) {
 86:     i=n-1; col[0]=n-2; col[1]=n-1;
 87:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 88:   }
 89:   if (FirstBlock) {
 90:     i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0;
 91:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 92:   }

 94:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 95:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);

 97:   /* Create the shell version of A */
 98:   MyShellMatCreate(&A,&S);

100:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101:                 Create the eigensolver and set various options
102:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

104:   EPSCreate(PETSC_COMM_WORLD,&eps);
105:   EPSSetOperators(eps,S,NULL);
106:   EPSSetProblemType(eps,EPS_HEP);
107:   EPSSetFromOptions(eps);

109:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
110:                       Solve the eigensystem
111:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

113:   EPSSolve(eps);
114:   EPSGetType(eps,&type);
115:   PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);
116:   EPSGetDimensions(eps,&nev,NULL,NULL);
117:   PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);

119:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
120:                     Display solution and clean up
121:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

123:   EPSPrintSolution(eps,NULL);
124:   EPSDestroy(&eps);
125:   MatDestroy(&A);
126:   MatDestroy(&S);
127:   SlepcFinalize();
128:   return 0;
129: }

133: static PetscErrorCode MatMult_Shell(Mat S,Vec x,Vec y)
134: {
135:   PetscErrorCode    ierr;
136:   Mat               *A;

139:   MatShellGetContext(S,&A);
140:   MatMult(*A,x,y);
141:   return(0);
142: }

146: static PetscErrorCode MatMultTranspose_Shell(Mat S,Vec x,Vec y)
147: {
148:   PetscErrorCode    ierr;
149:   Mat               *A;

152:   MatShellGetContext(S,&A);
153:   MatMultTranspose(*A,x,y);
154:   return(0);
155: }

159: static PetscErrorCode MatGetDiagonal_Shell(Mat S,Vec diag)
160: {
161:   PetscErrorCode    ierr;
162:   Mat               *A;

165:   MatShellGetContext(S,&A);
166:   MatGetDiagonal(*A,diag);
167:   return(0);
168: }

172: static PetscErrorCode MatDuplicate_Shell(Mat S,MatDuplicateOption op,Mat *M)
173: {
175:   Mat            *A;

178:   MatShellGetContext(S,&A);
179:   MyShellMatCreate(A,M);
180:   return(0);
181: }

slepc-3.4.2.dfsg.orig/src/st/examples/tests/makefile0000644000175000017500000000573312211062077021340 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/st/examples/tests/ EXAMPLESC = test1.c test2.c EXAMPLESF = MANSEC = ST TESTS = test1 test2 test3 TESTEXAMPLES_C = test1.PETSc runtest1_1 runtest1_2 test1.rm \ test2.PETSc runtest2_1 test2.rm \ test3.PETSc runtest3_1 test3.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o test3: test3.o chkopts -${CLINKER} -o test3 test3.o ${SLEPC_LIB} ${RM} test3.o #------------------------------------------------------------------------------------ EPS = krylovschur arnoldi gd jd TESTCODE = \ [ x${SAVE_OUTPUT} = xyes ] && cp $${test}.tmp output/$${test}.out; \ ${DIFF} output/$${test}.out $${test}.tmp || \ echo "Possible problem with $${test}, diffs above"; \ ${RM} -f $${test}.tmp runtest1_1: -@test=test1_1; \ for eps in ${EPS}; do \ echo "eps type $$eps"; \ ${MPIEXEC} -np 1 ./test1 -eps_type $$eps -st_shift 1 -eps_smallest_real -st_pc_type jacobi -eps_nev 4 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest1_2: -@test=test1_2; \ for eps in ${EPS}; do \ echo "eps type $$eps"; \ ${MPIEXEC} -np 2 ./test1 -eps_type $$eps -st_shift 1 -eps_smallest_real -st_pc_type jacobi -eps_nev 4 -eps_terse 2>&1; \ done > $${test}.tmp; \ ${TESTCODE} runtest2_1: -@test=test2_1; \ ${MPIEXEC} -np 1 ./test2 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest2_2: -@test=test2_1; \ ${MPIEXEC} -np 1 ./test2 -st_matmode inplace 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest2_3: -@test=test2_1; \ ${MPIEXEC} -np 1 ./test2 -st_matmode shell 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest3_1: -@test=test3_1; \ ${MPIEXEC} -np 1 ./test3 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest3_2: -@test=test3_1; \ ${MPIEXEC} -np 1 ./test3 -st_matmode inplace 2>&1 > $${test}.tmp; \ ${TESTCODE} runtest3_3: -@test=test3_1; \ ${MPIEXEC} -np 1 ./test3 -st_matmode shell 2>&1 > $${test}.tmp; \ ${TESTCODE} slepc-3.4.2.dfsg.orig/src/st/examples/tests/makefile.html0000644000175000017500000001137712211062077022304 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/st/examples/tests/
EXAMPLESC  = test1.c test2.c
EXAMPLESF  =
MANSEC     = ST
TESTS      = test1 test2 test3

TESTEXAMPLES_C       = test1.PETSc runtest1_1 runtest1_2 test1.rm \
                       test2.PETSc runtest2_1 test2.rm \
                       test3.PETSc runtest3_1 test3.rm

include ${SLEPC_DIR}/conf/slepc_common

test1: test1.o chkopts
	-${CLINKER} -o test1 test1.o ${SLEPC_LIB}
	${RM} test1.o

test2: test2.o chkopts
	-${CLINKER} -o test2 test2.o ${SLEPC_LIB}
	${RM} test2.o

test3: test3.o chkopts
	-${CLINKER} -o test3 test3.o ${SLEPC_LIB}
	${RM} test3.o

#------------------------------------------------------------------------------------

EPS = krylovschur arnoldi gd jd

TESTCODE = \
	[ x${SAVE_OUTPUT} = xyes ] && cp $${test}.tmp output/$${test}.out; \
	${DIFF} output/$${test}.out $${test}.tmp || \
	echo "Possible problem with $${test}, diffs above"; \
	${RM} -f $${test}.tmp

runtest1_1:
	-@test=test1_1; \
	for eps in ${EPS}; do \
	   echo "eps type $$eps"; \
	   ${MPIEXEC} -np 1 ./test1 -eps_type $$eps -st_shift 1 -eps_smallest_real -st_pc_type jacobi -eps_nev 4 -eps_terse 2>&1; \
	done > $${test}.tmp; \
	${TESTCODE}

runtest1_2:
	-@test=test1_2; \
	for eps in ${EPS}; do \
	   echo "eps type $$eps"; \
	   ${MPIEXEC} -np 2 ./test1 -eps_type $$eps -st_shift 1 -eps_smallest_real -st_pc_type jacobi -eps_nev 4 -eps_terse 2>&1; \
	done > $${test}.tmp; \
	${TESTCODE}

runtest2_1:
	-@test=test2_1; \
	${MPIEXEC} -np 1 ./test2 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest2_2:
	-@test=test2_1; \
	${MPIEXEC} -np 1 ./test2 -st_matmode inplace 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest2_3:
	-@test=test2_1; \
	${MPIEXEC} -np 1 ./test2 -st_matmode shell 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest3_1:
	-@test=test3_1; \
	${MPIEXEC} -np 1 ./test3 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest3_2:
	-@test=test3_1; \
	${MPIEXEC} -np 1 ./test3 -st_matmode inplace 2>&1 > $${test}.tmp; \
	${TESTCODE}

runtest3_3:
	-@test=test3_1; \
	${MPIEXEC} -np 1 ./test3 -st_matmode shell 2>&1 > $${test}.tmp; \
	${TESTCODE}
slepc-3.4.2.dfsg.orig/src/st/examples/tests/test1.c0000644000175000017500000001501412211062077021035 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test ST with shell matrices as problem matrices.\n\n"; #include static PetscErrorCode MatGetDiagonal_Shell(Mat S,Vec diag); static PetscErrorCode MatMultTranspose_Shell(Mat S,Vec x,Vec y); static PetscErrorCode MatMult_Shell(Mat S,Vec x,Vec y); static PetscErrorCode MatDuplicate_Shell(Mat S,MatDuplicateOption op,Mat *M); #undef __FUNCT__ #define __FUNCT__ "MyShellMatCreate" static PetscErrorCode MyShellMatCreate(Mat *A,Mat *M) { PetscErrorCode ierr; MPI_Comm comm; PetscInt n; PetscFunctionBeginUser; ierr = MatGetSize(*A,&n,NULL);CHKERRQ(ierr); ierr = PetscObjectGetComm((PetscObject)*A,&comm);CHKERRQ(ierr); ierr = MatCreateShell(comm,PETSC_DECIDE,PETSC_DECIDE,n,n,A,M);CHKERRQ(ierr); ierr = MatSetFromOptions(*M);CHKERRQ(ierr); ierr = MatShellSetOperation(*M,MATOP_MULT,(void(*)())MatMult_Shell);CHKERRQ(ierr); ierr = MatShellSetOperation(*M,MATOP_MULT_TRANSPOSE,(void(*)())MatMultTranspose_Shell);CHKERRQ(ierr); ierr = MatShellSetOperation(*M,MATOP_GET_DIAGONAL,(void(*)())MatGetDiagonal_Shell);CHKERRQ(ierr); ierr = MatShellSetOperation(*M,MATOP_DUPLICATE,(void(*)())MatDuplicate_Shell);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,S; /* problem matrix */ EPS eps; /* eigenproblem solver context */ EPSType type; PetscScalar value[3]; PetscInt n=30,i,Istart,Iend,col[3],nev; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix that defines the eigensystem, Ax=kx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); /* Create the shell version of A */ ierr = MyShellMatCreate(&A,&S);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the eigensolver and set various options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSCreate(PETSC_COMM_WORLD,&eps);CHKERRQ(ierr); ierr = EPSSetOperators(eps,S,NULL);CHKERRQ(ierr); ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr); ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the eigensystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSSolve(eps);CHKERRQ(ierr); ierr = EPSGetType(eps,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Solution method: %s\n\n",type);CHKERRQ(ierr); ierr = EPSGetDimensions(eps,&nev,NULL,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD," Number of requested eigenvalues: %D\n",nev);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Display solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = EPSPrintSolution(eps,NULL);CHKERRQ(ierr); ierr = EPSDestroy(&eps);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = MatDestroy(&S);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } #undef __FUNCT__ #define __FUNCT__ "MatMult_Shell" static PetscErrorCode MatMult_Shell(Mat S,Vec x,Vec y) { PetscErrorCode ierr; Mat *A; PetscFunctionBeginUser; ierr = MatShellGetContext(S,&A);CHKERRQ(ierr); ierr = MatMult(*A,x,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMultTranspose_Shell" static PetscErrorCode MatMultTranspose_Shell(Mat S,Vec x,Vec y) { PetscErrorCode ierr; Mat *A; PetscFunctionBeginUser; ierr = MatShellGetContext(S,&A);CHKERRQ(ierr); ierr = MatMultTranspose(*A,x,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Shell" static PetscErrorCode MatGetDiagonal_Shell(Mat S,Vec diag) { PetscErrorCode ierr; Mat *A; PetscFunctionBeginUser; ierr = MatShellGetContext(S,&A);CHKERRQ(ierr); ierr = MatGetDiagonal(*A,diag);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatDuplicate_Shell" static PetscErrorCode MatDuplicate_Shell(Mat S,MatDuplicateOption op,Mat *M) { PetscErrorCode ierr; Mat *A; PetscFunctionBeginUser; ierr = MatShellGetContext(S,&A);CHKERRQ(ierr); ierr = MyShellMatCreate(A,M);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/examples/tests/index.html0000644000175000017500000000305012211062077021623 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

test1.c: Test ST with shell matrices as problem matrices
test2.c: Test ST with one matrix
makefile
slepc-3.4.2.dfsg.orig/src/st/examples/tests/test3.c0000644000175000017500000001637112211062077021046 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test ST with two matrices.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,B,M,mat[2]; ST st; Vec v,w; STType type; PetscScalar value[3],sigma,tau; PetscInt n=10,i,Istart,Iend,col[3]; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian plus diagonal, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix for the 1-D Laplacian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatCreate(PETSC_COMM_WORLD,&B);CHKERRQ(ierr); ierr = MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(B);CHKERRQ(ierr); ierr = MatSetUp(B);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); ierr = MatSetValue(B,i,i,(PetscScalar)i,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); ierr = MatSetValue(B,i,i,(PetscScalar)i,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); ierr = MatSetValue(B,i,i,-1.0,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatGetVecs(A,&v,&w);CHKERRQ(ierr); ierr = VecSet(v,1.0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the spectral transformation object - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = STCreate(PETSC_COMM_WORLD,&st);CHKERRQ(ierr); mat[0] = A; mat[1] = B; ierr = STSetOperators(st,2,mat);CHKERRQ(ierr); ierr = STSetFromOptions(st);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apply the transformed operator for several ST's - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* shift, sigma=0.0 */ ierr = STSetUp(st);CHKERRQ(ierr); ierr = STGetType(st,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* shift, sigma=0.1 */ sigma = 0.1; ierr = STSetShift(st,sigma);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* sinvert, sigma=0.1 */ ierr = STPostSolve(st);CHKERRQ(ierr); /* undo changes if inplace */ ierr = STSetType(st,STSINVERT);CHKERRQ(ierr); ierr = STGetType(st,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* sinvert, sigma=-0.5 */ sigma = -0.5; ierr = STSetShift(st,sigma);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* cayley, sigma=-0.5, tau=-0.5 (equal to sigma by default) */ ierr = STPostSolve(st);CHKERRQ(ierr); /* undo changes if inplace */ ierr = STSetType(st,STCAYLEY);CHKERRQ(ierr); ierr = STSetUp(st);CHKERRQ(ierr); ierr = STGetType(st,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = STCayleyGetAntishift(st,&tau);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* cayley, sigma=1.1, tau=1.1 (still equal to sigma) */ sigma = 1.1; ierr = STSetShift(st,sigma);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = STCayleyGetAntishift(st,&tau);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* cayley, sigma=1.1, tau=-1.0 */ tau = -1.0; ierr = STCayleySetAntishift(st,tau);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = STCayleyGetAntishift(st,&tau);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Check inner product matrix in Cayley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = STGetBilinearForm(st,&M);CHKERRQ(ierr); ierr = MatMult(M,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); ierr = STDestroy(&st);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = MatDestroy(&B);CHKERRQ(ierr); ierr = MatDestroy(&M);CHKERRQ(ierr); ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&w);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/st/examples/tests/test2.c0000644000175000017500000001522412211062077021041 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test ST with one matrix.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { Mat A,B,mat[1]; ST st; Vec v,w; STType type; PetscScalar value[3],sigma,tau; PetscInt n=10,i,Istart,Iend,col[3]; PetscBool FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE; PetscErrorCode ierr; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian, n=%D\n\n",n);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the operator matrix for the 1-D Laplacian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); if (Istart==0) FirstBlock=PETSC_TRUE; if (Iend==n) LastBlock=PETSC_TRUE; value[0]=-1.0; value[1]=2.0; value[2]=-1.0; for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) { col[0]=i-1; col[1]=i; col[2]=i+1; ierr = MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (LastBlock) { i=n-1; col[0]=n-2; col[1]=n-1; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } if (FirstBlock) { i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0; ierr = MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);CHKERRQ(ierr); } ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatGetVecs(A,&v,&w);CHKERRQ(ierr); ierr = VecSet(v,1.0);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create the spectral transformation object - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = STCreate(PETSC_COMM_WORLD,&st);CHKERRQ(ierr); mat[0] = A; ierr = STSetOperators(st,1,mat);CHKERRQ(ierr); ierr = STSetFromOptions(st);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apply the transformed operator for several ST's - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* shift, sigma=0.0 */ ierr = STSetUp(st);CHKERRQ(ierr); ierr = STGetType(st,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* shift, sigma=0.1 */ sigma = 0.1; ierr = STSetShift(st,sigma);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* sinvert, sigma=0.1 */ ierr = STPostSolve(st);CHKERRQ(ierr); /* undo changes if inplace */ ierr = STSetType(st,STSINVERT);CHKERRQ(ierr); ierr = STGetType(st,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* sinvert, sigma=-0.5 */ sigma = -0.5; ierr = STSetShift(st,sigma);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* cayley, sigma=-0.5, tau=-0.5 (equal to sigma by default) */ ierr = STPostSolve(st);CHKERRQ(ierr); /* undo changes if inplace */ ierr = STSetType(st,STCAYLEY);CHKERRQ(ierr); ierr = STSetUp(st);CHKERRQ(ierr); ierr = STGetType(st,&type);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = STCayleyGetAntishift(st,&tau);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* cayley, sigma=1.1, tau=1.1 (still equal to sigma) */ sigma = 1.1; ierr = STSetShift(st,sigma);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = STCayleyGetAntishift(st,&tau);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* cayley, sigma=1.1, tau=-1.0 */ tau = -1.0; ierr = STCayleySetAntishift(st,tau);CHKERRQ(ierr); ierr = STGetShift(st,&sigma);CHKERRQ(ierr); ierr = STCayleyGetAntishift(st,&tau);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));CHKERRQ(ierr); ierr = STApply(st,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Check inner product matrix in Cayley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = STGetBilinearForm(st,&B);CHKERRQ(ierr); ierr = MatMult(B,v,w);CHKERRQ(ierr); ierr = VecView(w,NULL);CHKERRQ(ierr); ierr = STDestroy(&st);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = MatDestroy(&B);CHKERRQ(ierr); ierr = VecDestroy(&v);CHKERRQ(ierr); ierr = VecDestroy(&w);CHKERRQ(ierr); ierr = SlepcFinalize(); return 0; } slepc-3.4.2.dfsg.orig/src/st/examples/tests/test2.c.html0000644000175000017500000003337612211062077022014 0ustar gladkgladk

Actual source code: test2.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test ST with one matrix.\n\n";

 24: #include <slepcst.h>

 28: int main(int argc,char **argv)
 29: {
 30:   Mat            A,B,mat[1];
 31:   ST             st;
 32:   Vec            v,w;
 33:   STType         type;
 34:   PetscScalar    value[3],sigma,tau;
 35:   PetscInt       n=10,i,Istart,Iend,col[3];
 36:   PetscBool      FirstBlock=PETSC_FALSE,LastBlock=PETSC_FALSE;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian, n=%D\n\n",n);

 43:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 44:      Compute the operator matrix for the 1-D Laplacian
 45:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 47:   MatCreate(PETSC_COMM_WORLD,&A);
 48:   MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n);
 49:   MatSetFromOptions(A);
 50:   MatSetUp(A);

 52:   MatGetOwnershipRange(A,&Istart,&Iend);
 53:   if (Istart==0) FirstBlock=PETSC_TRUE;
 54:   if (Iend==n) LastBlock=PETSC_TRUE;
 55:   value[0]=-1.0; value[1]=2.0; value[2]=-1.0;
 56:   for (i=(FirstBlock? Istart+1: Istart); i<(LastBlock? Iend-1: Iend); i++) {
 57:     col[0]=i-1; col[1]=i; col[2]=i+1;
 58:     MatSetValues(A,1,&i,3,col,value,INSERT_VALUES);
 59:   }
 60:   if (LastBlock) {
 61:     i=n-1; col[0]=n-2; col[1]=n-1;
 62:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 63:   }
 64:   if (FirstBlock) {
 65:     i=0; col[0]=0; col[1]=1; value[0]=2.0; value[1]=-1.0;
 66:     MatSetValues(A,1,&i,2,col,value,INSERT_VALUES);
 67:   }

 69:   MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
 70:   MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);
 71:   MatGetVecs(A,&v,&w);
 72:   VecSet(v,1.0);

 74:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 75:                 Create the spectral transformation object
 76:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 78:   STCreate(PETSC_COMM_WORLD,&st);
 79:   mat[0] = A;
 80:   STSetOperators(st,1,mat);
 81:   STSetFromOptions(st);

 83:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 84:               Apply the transformed operator for several ST's
 85:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 87:   /* shift, sigma=0.0 */
 88:   STSetUp(st);
 89:   STGetType(st,&type);
 90:   PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);
 91:   STApply(st,v,w);
 92:   VecView(w,NULL);

 94:   /* shift, sigma=0.1 */
 95:   sigma = 0.1;
 96:   STSetShift(st,sigma);
 97:   STGetShift(st,&sigma);
 98:   PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));
 99:   STApply(st,v,w);
100:   VecView(w,NULL);

102:   /* sinvert, sigma=0.1 */
103:   STPostSolve(st);   /* undo changes if inplace */
104:   STSetType(st,STSINVERT);
105:   STGetType(st,&type);
106:   PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);
107:   STGetShift(st,&sigma);
108:   PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));
109:   STApply(st,v,w);
110:   VecView(w,NULL);

112:   /* sinvert, sigma=-0.5 */
113:   sigma = -0.5;
114:   STSetShift(st,sigma);
115:   STGetShift(st,&sigma);
116:   PetscPrintf(PETSC_COMM_WORLD,"With shift=%G\n",PetscRealPart(sigma));
117:   STApply(st,v,w);
118:   VecView(w,NULL);

120:   /* cayley, sigma=-0.5, tau=-0.5 (equal to sigma by default) */
121:   STPostSolve(st);   /* undo changes if inplace */
122:   STSetType(st,STCAYLEY);
123:   STSetUp(st);
124:   STGetType(st,&type);
125:   PetscPrintf(PETSC_COMM_WORLD,"ST type %s\n",type);
126:   STGetShift(st,&sigma);
127:   STCayleyGetAntishift(st,&tau);
128:   PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));
129:   STApply(st,v,w);
130:   VecView(w,NULL);

132:   /* cayley, sigma=1.1, tau=1.1 (still equal to sigma) */
133:   sigma = 1.1;
134:   STSetShift(st,sigma);
135:   STGetShift(st,&sigma);
136:   STCayleyGetAntishift(st,&tau);
137:   PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));
138:   STApply(st,v,w);
139:   VecView(w,NULL);

141:   /* cayley, sigma=1.1, tau=-1.0 */
142:   tau = -1.0;
143:   STCayleySetAntishift(st,tau);
144:   STGetShift(st,&sigma);
145:   STCayleyGetAntishift(st,&tau);
146:   PetscPrintf(PETSC_COMM_WORLD,"With shift=%G, antishift=%G\n",PetscRealPart(sigma),PetscRealPart(tau));
147:   STApply(st,v,w);
148:   VecView(w,NULL);

150:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
151:                   Check inner product matrix in Cayley
152:      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
153:   STGetBilinearForm(st,&B);
154:   MatMult(B,v,w);
155:   VecView(w,NULL);

157:   STDestroy(&st);
158:   MatDestroy(&A);
159:   MatDestroy(&B);
160:   VecDestroy(&v);
161:   VecDestroy(&w);
162:   SlepcFinalize();
163:   return 0;
164: }
slepc-3.4.2.dfsg.orig/src/st/examples/index.html0000644000175000017500000000040012211062077020455 0ustar gladkgladk Generic SLEPc Manual Pages

tests/
tutorials/
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/0000755000175000017500000000000012214143515015774 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/cayley/0000755000175000017500000000000012214143515017262 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/cayley/cayley.c.html0000644000175000017500000006250212211062077021664 0ustar gladkgladk

Actual source code: cayley.c

  1: /*
  2:       Implements the Cayley spectral transform.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/stimpl.h>          /*I "slepcst.h" I*/

 26: typedef struct {
 27:   PetscScalar nu;
 28:   PetscBool   nu_set;
 29:   Vec         w2;
 30: } ST_CAYLEY;

 34: PetscErrorCode STApply_Cayley(ST st,Vec x,Vec y)
 35: {

 39:   /* standard eigenproblem: y = (A - sI)^-1 (A + tI)x */
 40:   /* generalized eigenproblem: y = (A - sB)^-1 (A + tB)x */
 41:   MatMult(st->T[0],x,st->w);
 42:   STMatSolve(st,1,st->w,y);
 43:   return(0);
 44: }

 48: PetscErrorCode STApplyTranspose_Cayley(ST st,Vec x,Vec y)
 49: {

 53:   /* standard eigenproblem: y =  (A + tI)^T (A - sI)^-T x */
 54:   /* generalized eigenproblem: y = (A + tB)^T (A - sB)^-T x */
 55:   STMatSolveTranspose(st,1,x,st->w);
 56:   MatMultTranspose(st->T[0],st->w,y);
 57:   return(0);
 58: }

 62: static PetscErrorCode MatMult_Cayley(Mat B,Vec x,Vec y)
 63: {
 65:   ST             st;
 66:   ST_CAYLEY      *ctx;
 67:   PetscScalar    nu;

 70:   MatShellGetContext(B,(void**)&st);
 71:   ctx = (ST_CAYLEY*)st->data;
 72:   nu = ctx->nu;

 74:   if (st->shift_matrix == ST_MATMODE_INPLACE) { nu = nu + st->sigma; };

 76:   if (st->nmat>1) {
 77:     /* generalized eigenproblem: y = (A + tB)x */
 78:     MatMult(st->A[0],x,y);
 79:     MatMult(st->A[1],x,ctx->w2);
 80:     VecAXPY(y,nu,ctx->w2);
 81:   } else {
 82:     /* standard eigenproblem: y = (A + tI)x */
 83:     MatMult(st->A[0],x,y);
 84:     VecAXPY(y,nu,x);
 85:   }
 86:   return(0);
 87: }

 91: PetscErrorCode STGetBilinearForm_Cayley(ST st,Mat *B)
 92: {

 96:   STSetUp(st);
 97:   *B = st->T[0];
 98:   PetscObjectReference((PetscObject)*B);
 99:   return(0);
100: }

104: PetscErrorCode STBackTransform_Cayley(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)
105: {
106:   ST_CAYLEY   *ctx = (ST_CAYLEY*)st->data;
107:   PetscInt    j;
108: #if !defined(PETSC_USE_COMPLEX)
109:   PetscScalar t,i,r;
110: #endif

113: #if !defined(PETSC_USE_COMPLEX)
114:   for (j=0;j<n;j++) {
115:     if (eigi[j] == 0.0) eigr[j] = (ctx->nu + eigr[j] * st->sigma) / (eigr[j] - 1.0);
116:     else {
117:       r = eigr[j];
118:       i = eigi[j];
119:       r = st->sigma * (r * r + i * i - r) + ctx->nu * (r - 1);
120:       i = - st->sigma * i - ctx->nu * i;
121:       t = i * i + r * (r - 2.0) + 1.0;
122:       eigr[j] = r / t;
123:       eigi[j] = i / t;
124:     }
125:   }
126: #else
127:   for (j=0;j<n;j++) {
128:     eigr[j] = (ctx->nu + eigr[j] * st->sigma) / (eigr[j] - 1.0);
129:   }
130: #endif
131:   return(0);
132: }

136: PetscErrorCode STPostSolve_Cayley(ST st)
137: {

141:   if (st->shift_matrix == ST_MATMODE_INPLACE) {
142:     if (st->nmat>1) {
143:       MatAXPY(st->A[0],st->sigma,st->A[1],st->str);
144:     } else {
145:       MatShift(st->A[0],st->sigma);
146:     }
147:     st->Astate[0] = ((PetscObject)st->A[0])->state;
148:     st->setupcalled = 0;
149:   }
150:   return(0);
151: }

155: PetscErrorCode STSetUp_Cayley(ST st)
156: {
158:   PetscInt       n,m;
159:   ST_CAYLEY      *ctx = (ST_CAYLEY*)st->data;

162:   /* if the user did not set the shift, use the target value */
163:   if (!st->sigma_set) st->sigma = st->defsigma;

165:   if (!ctx->nu_set) ctx->nu = st->sigma;
166:   if (ctx->nu == 0.0 && st->sigma == 0.0) SETERRQ(PetscObjectComm((PetscObject)st),1,"Values of shift and antishift cannot be zero simultaneously");

168:   /* T[0] = A+nu*B */
169:   if (st->shift_matrix==ST_MATMODE_INPLACE) {
170:     MatGetLocalSize(st->A[0],&n,&m);
171:     MatCreateShell(PetscObjectComm((PetscObject)st),n,m,PETSC_DETERMINE,PETSC_DETERMINE,st,&st->T[0]);
172:     MatShellSetOperation(st->T[0],MATOP_MULT,(void(*)(void))MatMult_Cayley);
173:     PetscLogObjectParent(st,st->T[0]);
174:   } else {
175:     STMatGAXPY_Private(st,ctx->nu,0.0,1,0,PETSC_TRUE);
176:   }

178:   /* T[1] = A-sigma*B */
179:   STMatGAXPY_Private(st,-st->sigma,0.0,1,1,PETSC_TRUE);

181:   if (st->nmat>1) {
182:     VecDestroy(&ctx->w2);
183:     MatGetVecs(st->A[1],&ctx->w2,NULL);
184:     PetscLogObjectParent(st,ctx->w2);
185:   }
186:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
187:   KSPSetOperators(st->ksp,st->T[1],st->T[1],DIFFERENT_NONZERO_PATTERN);
188:   KSPSetUp(st->ksp);
189:   st->kspidx = 1;
190:   return(0);
191: }

195: PetscErrorCode STSetShift_Cayley(ST st,PetscScalar newshift)
196: {
198:   ST_CAYLEY      *ctx = (ST_CAYLEY*)st->data;
199:   MatStructure   flg;

202:   if (newshift==0.0 && (!ctx->nu_set || (ctx->nu_set && ctx->nu==0.0))) SETERRQ(PetscObjectComm((PetscObject)st),1,"Values of shift and antishift cannot be zero simultaneously");

204:   /* Nothing to be done if STSetUp has not been called yet */
205:   if (!st->setupcalled) return(0);

207:   if (!ctx->nu_set) {
208:     if (st->shift_matrix!=ST_MATMODE_INPLACE) {
209:       STMatGAXPY_Private(st,newshift,ctx->nu,1,0,PETSC_FALSE);
210:     }
211:     ctx->nu = newshift;
212:   }
213:   STMatGAXPY_Private(st,-newshift,-st->sigma,1,1,PETSC_FALSE);

215:   if (st->kspidx==1) {  /* Update KSP operator */
216:     /* Check if the new KSP matrix has the same zero structure */
217:     if (st->nmat>1 && st->str == DIFFERENT_NONZERO_PATTERN && (st->sigma == 0.0 || newshift == 0.0)) flg = DIFFERENT_NONZERO_PATTERN;
218:     else flg = SAME_NONZERO_PATTERN;
219:     KSPSetOperators(st->ksp,st->T[1],st->T[1],flg);
220:     KSPSetUp(st->ksp);
221:   }
222:   return(0);
223: }

227: PetscErrorCode STSetFromOptions_Cayley(ST st)
228: {
230:   PetscScalar    nu;
231:   PetscBool      flg;
232:   ST_CAYLEY      *ctx = (ST_CAYLEY*)st->data;
233:   PC             pc;
234:   PCType         pctype;
235:   KSPType        ksptype;

238:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
239:   KSPGetPC(st->ksp,&pc);
240:   KSPGetType(st->ksp,&ksptype);
241:   PCGetType(pc,&pctype);
242:   if (!pctype && !ksptype) {
243:     if (st->shift_matrix == ST_MATMODE_SHELL) {
244:       /* in shell mode use GMRES with Jacobi as the default */
245:       KSPSetType(st->ksp,KSPGMRES);
246:       PCSetType(pc,PCJACOBI);
247:     } else {
248:       /* use direct solver as default */
249:       KSPSetType(st->ksp,KSPPREONLY);
250:       PCSetType(pc,PCREDUNDANT);
251:     }
252:   }

254:   PetscOptionsHead("ST Cayley Options");
255:   PetscOptionsScalar("-st_cayley_antishift","Value of the antishift","STCayleySetAntishift",ctx->nu,&nu,&flg);
256:   if (flg) {
257:     STCayleySetAntishift(st,nu);
258:   }
259:   PetscOptionsTail();
260:   return(0);
261: }

265: static PetscErrorCode STCayleySetAntishift_Cayley(ST st,PetscScalar newshift)
266: {
268:   ST_CAYLEY *ctx = (ST_CAYLEY*)st->data;

271:   if (st->setupcalled && st->shift_matrix!=ST_MATMODE_INPLACE) {
272:     STMatGAXPY_Private(st,newshift,ctx->nu,1,0,PETSC_FALSE);
273:   }
274:   ctx->nu     = newshift;
275:   ctx->nu_set = PETSC_TRUE;
276:   return(0);
277: }

281: /*@
282:    STCayleySetAntishift - Sets the value of the anti-shift for the Cayley
283:    spectral transformation.

285:    Logically Collective on ST

287:    Input Parameters:
288: +  st  - the spectral transformation context
289: -  nu  - the anti-shift

291:    Options Database Key:
292: .  -st_cayley_antishift - Sets the value of the anti-shift

294:    Level: intermediate

296:    Note:
297:    In the generalized Cayley transform, the operator can be expressed as
298:    OP = inv(A - sigma B)*(A + nu B). This function sets the value of nu.
299:    Use STSetShift() for setting sigma.

301: .seealso: STSetShift(), STCayleyGetAntishift()
302: @*/
303: PetscErrorCode STCayleySetAntishift(ST st,PetscScalar nu)
304: {

310:   PetscTryMethod(st,"STCayleySetAntishift_C",(ST,PetscScalar),(st,nu));
311:   return(0);
312: }
315: static PetscErrorCode STCayleyGetAntishift_Cayley(ST st,PetscScalar *nu)
316: {
317:   ST_CAYLEY *ctx = (ST_CAYLEY*)st->data;

320:   *nu = ctx->nu;
321:   return(0);
322: }

326: /*@
327:    STCayleyGetAntishift - Gets the value of the anti-shift used in the Cayley
328:    spectral transformation.

330:    Not Collective

332:    Input Parameter:
333: .  st  - the spectral transformation context

335:    Output Parameter:
336: .  nu  - the anti-shift

338:    Level: intermediate

340: .seealso: STGetShift(), STCayleySetAntishift()
341: @*/
342: PetscErrorCode STCayleyGetAntishift(ST st,PetscScalar *nu)
343: {

349:   PetscTryMethod(st,"STCayleyGetAntishift_C",(ST,PetscScalar*),(st,nu));
350:   return(0);
351: }

355: PetscErrorCode STView_Cayley(ST st,PetscViewer viewer)
356: {
358:   char           str[50];
359:   ST_CAYLEY      *ctx = (ST_CAYLEY*)st->data;

362:   SlepcSNPrintfScalar(str,50,ctx->nu,PETSC_FALSE);
363:   PetscViewerASCIIPrintf(viewer,"  Cayley: antishift: %s\n",str);
364:   return(0);
365: }

369: PetscErrorCode STReset_Cayley(ST st)
370: {
372:   ST_CAYLEY      *ctx = (ST_CAYLEY*)st->data;

375:   VecDestroy(&ctx->w2);
376:   return(0);
377: }

381: PetscErrorCode STDestroy_Cayley(ST st)
382: {

386:   PetscFree(st->data);
387:   PetscObjectComposeFunction((PetscObject)st,"STCayleySetAntishift_C",NULL);
388:   PetscObjectComposeFunction((PetscObject)st,"STCayleyGetAntishift_C",NULL);
389:   return(0);
390: }

394: PETSC_EXTERN PetscErrorCode STCreate_Cayley(ST st)
395: {

399:   PetscNewLog(st,ST_CAYLEY,&st->data);
400:   st->ops->apply           = STApply_Cayley;
401:   st->ops->getbilinearform = STGetBilinearForm_Cayley;
402:   st->ops->applytrans      = STApplyTranspose_Cayley;
403:   st->ops->postsolve       = STPostSolve_Cayley;
404:   st->ops->backtransform   = STBackTransform_Cayley;
405:   st->ops->setfromoptions  = STSetFromOptions_Cayley;
406:   st->ops->setup           = STSetUp_Cayley;
407:   st->ops->setshift        = STSetShift_Cayley;
408:   st->ops->destroy         = STDestroy_Cayley;
409:   st->ops->reset           = STReset_Cayley;
410:   st->ops->view            = STView_Cayley;
411:   st->ops->checknullspace  = STCheckNullSpace_Default;
412:   PetscObjectComposeFunction((PetscObject)st,"STCayleySetAntishift_C",STCayleySetAntishift_Cayley);
413:   PetscObjectComposeFunction((PetscObject)st,"STCayleyGetAntishift_C",STCayleyGetAntishift_Cayley);
414:   return(0);
415: }

slepc-3.4.2.dfsg.orig/src/st/impls/cayley/makefile0000644000175000017500000000213712211062077020765 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = cayley.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/impls/cayley/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/cayley/makefile.html0000644000175000017500000000373012211062077021730 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = cayley.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/impls/cayley/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/cayley/index.html0000644000175000017500000000267312211062077021267 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

cayley.c
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/cayley/cayley.c0000644000175000017500000003121712211062077020720 0ustar gladkgladk/* Implements the Cayley spectral transform. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ typedef struct { PetscScalar nu; PetscBool nu_set; Vec w2; } ST_CAYLEY; #undef __FUNCT__ #define __FUNCT__ "STApply_Cayley" PetscErrorCode STApply_Cayley(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; /* standard eigenproblem: y = (A - sI)^-1 (A + tI)x */ /* generalized eigenproblem: y = (A - sB)^-1 (A + tB)x */ ierr = MatMult(st->T[0],x,st->w);CHKERRQ(ierr); ierr = STMatSolve(st,1,st->w,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApplyTranspose_Cayley" PetscErrorCode STApplyTranspose_Cayley(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; /* standard eigenproblem: y = (A + tI)^T (A - sI)^-T x */ /* generalized eigenproblem: y = (A + tB)^T (A - sB)^-T x */ ierr = STMatSolveTranspose(st,1,x,st->w);CHKERRQ(ierr); ierr = MatMultTranspose(st->T[0],st->w,y);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Cayley" static PetscErrorCode MatMult_Cayley(Mat B,Vec x,Vec y) { PetscErrorCode ierr; ST st; ST_CAYLEY *ctx; PetscScalar nu; PetscFunctionBegin; ierr = MatShellGetContext(B,(void**)&st);CHKERRQ(ierr); ctx = (ST_CAYLEY*)st->data; nu = ctx->nu; if (st->shift_matrix == ST_MATMODE_INPLACE) { nu = nu + st->sigma; }; if (st->nmat>1) { /* generalized eigenproblem: y = (A + tB)x */ ierr = MatMult(st->A[0],x,y);CHKERRQ(ierr); ierr = MatMult(st->A[1],x,ctx->w2);CHKERRQ(ierr); ierr = VecAXPY(y,nu,ctx->w2);CHKERRQ(ierr); } else { /* standard eigenproblem: y = (A + tI)x */ ierr = MatMult(st->A[0],x,y);CHKERRQ(ierr); ierr = VecAXPY(y,nu,x);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetBilinearForm_Cayley" PetscErrorCode STGetBilinearForm_Cayley(ST st,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; ierr = STSetUp(st);CHKERRQ(ierr); *B = st->T[0]; ierr = PetscObjectReference((PetscObject)*B);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STBackTransform_Cayley" PetscErrorCode STBackTransform_Cayley(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PetscInt j; #if !defined(PETSC_USE_COMPLEX) PetscScalar t,i,r; #endif PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) for (j=0;jnu + eigr[j] * st->sigma) / (eigr[j] - 1.0); else { r = eigr[j]; i = eigi[j]; r = st->sigma * (r * r + i * i - r) + ctx->nu * (r - 1); i = - st->sigma * i - ctx->nu * i; t = i * i + r * (r - 2.0) + 1.0; eigr[j] = r / t; eigi[j] = i / t; } } #else for (j=0;jnu + eigr[j] * st->sigma) / (eigr[j] - 1.0); } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPostSolve_Cayley" PetscErrorCode STPostSolve_Cayley(ST st) { PetscErrorCode ierr; PetscFunctionBegin; if (st->shift_matrix == ST_MATMODE_INPLACE) { if (st->nmat>1) { ierr = MatAXPY(st->A[0],st->sigma,st->A[1],st->str);CHKERRQ(ierr); } else { ierr = MatShift(st->A[0],st->sigma);CHKERRQ(ierr); } st->Astate[0] = ((PetscObject)st->A[0])->state; st->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetUp_Cayley" PetscErrorCode STSetUp_Cayley(ST st) { PetscErrorCode ierr; PetscInt n,m; ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PetscFunctionBegin; /* if the user did not set the shift, use the target value */ if (!st->sigma_set) st->sigma = st->defsigma; if (!ctx->nu_set) ctx->nu = st->sigma; if (ctx->nu == 0.0 && st->sigma == 0.0) SETERRQ(PetscObjectComm((PetscObject)st),1,"Values of shift and antishift cannot be zero simultaneously"); /* T[0] = A+nu*B */ if (st->shift_matrix==ST_MATMODE_INPLACE) { ierr = MatGetLocalSize(st->A[0],&n,&m);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)st),n,m,PETSC_DETERMINE,PETSC_DETERMINE,st,&st->T[0]);CHKERRQ(ierr); ierr = MatShellSetOperation(st->T[0],MATOP_MULT,(void(*)(void))MatMult_Cayley);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,st->T[0]);CHKERRQ(ierr); } else { ierr = STMatGAXPY_Private(st,ctx->nu,0.0,1,0,PETSC_TRUE);CHKERRQ(ierr); } /* T[1] = A-sigma*B */ ierr = STMatGAXPY_Private(st,-st->sigma,0.0,1,1,PETSC_TRUE);CHKERRQ(ierr); if (st->nmat>1) { ierr = VecDestroy(&ctx->w2);CHKERRQ(ierr); ierr = MatGetVecs(st->A[1],&ctx->w2,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,ctx->w2);CHKERRQ(ierr); } if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetOperators(st->ksp,st->T[1],st->T[1],DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); st->kspidx = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetShift_Cayley" PetscErrorCode STSetShift_Cayley(ST st,PetscScalar newshift) { PetscErrorCode ierr; ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; MatStructure flg; PetscFunctionBegin; if (newshift==0.0 && (!ctx->nu_set || (ctx->nu_set && ctx->nu==0.0))) SETERRQ(PetscObjectComm((PetscObject)st),1,"Values of shift and antishift cannot be zero simultaneously"); /* Nothing to be done if STSetUp has not been called yet */ if (!st->setupcalled) PetscFunctionReturn(0); if (!ctx->nu_set) { if (st->shift_matrix!=ST_MATMODE_INPLACE) { ierr = STMatGAXPY_Private(st,newshift,ctx->nu,1,0,PETSC_FALSE);CHKERRQ(ierr); } ctx->nu = newshift; } ierr = STMatGAXPY_Private(st,-newshift,-st->sigma,1,1,PETSC_FALSE);CHKERRQ(ierr); if (st->kspidx==1) { /* Update KSP operator */ /* Check if the new KSP matrix has the same zero structure */ if (st->nmat>1 && st->str == DIFFERENT_NONZERO_PATTERN && (st->sigma == 0.0 || newshift == 0.0)) flg = DIFFERENT_NONZERO_PATTERN; else flg = SAME_NONZERO_PATTERN; ierr = KSPSetOperators(st->ksp,st->T[1],st->T[1],flg);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions_Cayley" PetscErrorCode STSetFromOptions_Cayley(ST st) { PetscErrorCode ierr; PetscScalar nu; PetscBool flg; ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PC pc; PCType pctype; KSPType ksptype; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = KSPGetType(st->ksp,&ksptype);CHKERRQ(ierr); ierr = PCGetType(pc,&pctype);CHKERRQ(ierr); if (!pctype && !ksptype) { if (st->shift_matrix == ST_MATMODE_SHELL) { /* in shell mode use GMRES with Jacobi as the default */ ierr = KSPSetType(st->ksp,KSPGMRES);CHKERRQ(ierr); ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); } else { /* use direct solver as default */ ierr = KSPSetType(st->ksp,KSPPREONLY);CHKERRQ(ierr); ierr = PCSetType(pc,PCREDUNDANT);CHKERRQ(ierr); } } ierr = PetscOptionsHead("ST Cayley Options");CHKERRQ(ierr); ierr = PetscOptionsScalar("-st_cayley_antishift","Value of the antishift","STCayleySetAntishift",ctx->nu,&nu,&flg);CHKERRQ(ierr); if (flg) { ierr = STCayleySetAntishift(st,nu);CHKERRQ(ierr); } ierr = PetscOptionsTail();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCayleySetAntishift_Cayley" static PetscErrorCode STCayleySetAntishift_Cayley(ST st,PetscScalar newshift) { PetscErrorCode ierr; ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PetscFunctionBegin; if (st->setupcalled && st->shift_matrix!=ST_MATMODE_INPLACE) { ierr = STMatGAXPY_Private(st,newshift,ctx->nu,1,0,PETSC_FALSE);CHKERRQ(ierr); } ctx->nu = newshift; ctx->nu_set = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCayleySetAntishift" /*@ STCayleySetAntishift - Sets the value of the anti-shift for the Cayley spectral transformation. Logically Collective on ST Input Parameters: + st - the spectral transformation context - nu - the anti-shift Options Database Key: . -st_cayley_antishift - Sets the value of the anti-shift Level: intermediate Note: In the generalized Cayley transform, the operator can be expressed as OP = inv(A - sigma B)*(A + nu B). This function sets the value of nu. Use STSetShift() for setting sigma. .seealso: STSetShift(), STCayleyGetAntishift() @*/ PetscErrorCode STCayleySetAntishift(ST st,PetscScalar nu) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveScalar(st,nu,2); ierr = PetscTryMethod(st,"STCayleySetAntishift_C",(ST,PetscScalar),(st,nu));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCayleyGetAntishift_Cayley" static PetscErrorCode STCayleyGetAntishift_Cayley(ST st,PetscScalar *nu) { ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PetscFunctionBegin; *nu = ctx->nu; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCayleyGetAntishift" /*@ STCayleyGetAntishift - Gets the value of the anti-shift used in the Cayley spectral transformation. Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: . nu - the anti-shift Level: intermediate .seealso: STGetShift(), STCayleySetAntishift() @*/ PetscErrorCode STCayleyGetAntishift(ST st,PetscScalar *nu) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidScalarPointer(nu,2); ierr = PetscTryMethod(st,"STCayleyGetAntishift_C",(ST,PetscScalar*),(st,nu));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STView_Cayley" PetscErrorCode STView_Cayley(ST st,PetscViewer viewer) { PetscErrorCode ierr; char str[50]; ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PetscFunctionBegin; ierr = SlepcSNPrintfScalar(str,50,ctx->nu,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," Cayley: antishift: %s\n",str);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STReset_Cayley" PetscErrorCode STReset_Cayley(ST st) { PetscErrorCode ierr; ST_CAYLEY *ctx = (ST_CAYLEY*)st->data; PetscFunctionBegin; ierr = VecDestroy(&ctx->w2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STDestroy_Cayley" PetscErrorCode STDestroy_Cayley(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(st->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STCayleySetAntishift_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STCayleyGetAntishift_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCreate_Cayley" PETSC_EXTERN PetscErrorCode STCreate_Cayley(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(st,ST_CAYLEY,&st->data);CHKERRQ(ierr); st->ops->apply = STApply_Cayley; st->ops->getbilinearform = STGetBilinearForm_Cayley; st->ops->applytrans = STApplyTranspose_Cayley; st->ops->postsolve = STPostSolve_Cayley; st->ops->backtransform = STBackTransform_Cayley; st->ops->setfromoptions = STSetFromOptions_Cayley; st->ops->setup = STSetUp_Cayley; st->ops->setshift = STSetShift_Cayley; st->ops->destroy = STDestroy_Cayley; st->ops->reset = STReset_Cayley; st->ops->view = STView_Cayley; st->ops->checknullspace = STCheckNullSpace_Default; ierr = PetscObjectComposeFunction((PetscObject)st,"STCayleySetAntishift_C",STCayleySetAntishift_Cayley);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STCayleyGetAntishift_C",STCayleyGetAntishift_Cayley);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/impls/cayley/ftn-auto/0000755000175000017500000000000012214143515021017 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/cayley/ftn-auto/cayleyf.c0000644000175000017500000000257212211062077022625 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* cayley.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define stcayleysetantishift_ STCAYLEYSETANTISHIFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stcayleysetantishift_ stcayleysetantishift #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stcayleygetantishift_ STCAYLEYGETANTISHIFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stcayleygetantishift_ stcayleygetantishift #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL stcayleysetantishift_(ST *st,PetscScalar *nu, int *__ierr ){ *__ierr = STCayleySetAntishift(*st,*nu); } void PETSC_STDCALL stcayleygetantishift_(ST *st,PetscScalar *nu, int *__ierr ){ *__ierr = STCayleyGetAntishift(*st,nu); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/impls/cayley/ftn-auto/makefile0000644000175000017500000000034312211062077022517 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = cayleyf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/st/impls/cayley/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/shift/0000755000175000017500000000000012214143515017111 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/shift/shift.c0000644000175000017500000001477112211062077020404 0ustar gladkgladk/* Shift spectral transformation, applies (A + sigma I) as operator, or inv(B)(A + sigma B) for generalized problems - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ #undef __FUNCT__ #define __FUNCT__ "STApply_Shift" PetscErrorCode STApply_Shift(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; if (st->nmat>1) { /* generalized eigenproblem: y = B^-1 (A + sB) x */ ierr = MatMult(st->T[0],x,st->w);CHKERRQ(ierr); ierr = STMatSolve(st,1,st->w,y);CHKERRQ(ierr); } else { /* standard eigenproblem: y = (A + sI) x */ ierr = MatMult(st->T[0],x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApplyTranspose_Shift" PetscErrorCode STApplyTranspose_Shift(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; if (st->nmat>1) { /* generalized eigenproblem: y = (A + sB)^T B^-T x */ ierr = STMatSolveTranspose(st,1,x,st->w);CHKERRQ(ierr); ierr = MatMultTranspose(st->T[0],st->w,y);CHKERRQ(ierr); } else { /* standard eigenproblem: y = (A^T + sI) x */ ierr = MatMultTranspose(st->T[0],x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STBackTransform_Shift" PetscErrorCode STBackTransform_Shift(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { PetscInt j; PetscFunctionBegin; for (j=0;jsigma; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPostSolve_Shift" PetscErrorCode STPostSolve_Shift(ST st) { PetscErrorCode ierr; PetscScalar s; PetscFunctionBegin; if (st->shift_matrix == ST_MATMODE_INPLACE) { if (st->nmat>1) { if (st->nmat==3) { ierr = MatAXPY(st->A[0],-st->sigma*st->sigma,st->A[2],st->str);CHKERRQ(ierr); ierr = MatAXPY(st->A[1],2.0*st->sigma,st->A[2],st->str);CHKERRQ(ierr); s = st->sigma; } else s = -st->sigma; ierr = MatAXPY(st->A[0],s,st->A[1],st->str);CHKERRQ(ierr); } else { ierr = MatShift(st->A[0],st->sigma);CHKERRQ(ierr); } st->Astate[0] = ((PetscObject)st->A[0])->state; st->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetUp_Shift" PetscErrorCode STSetUp_Shift(ST st) { PetscErrorCode ierr; PetscFunctionBegin; if (st->nmat<3) { /* T[1] = B */ if (st->nmat>1) { ierr = PetscObjectReference((PetscObject)st->A[1]);CHKERRQ(ierr); } st->T[1] = st->A[1]; /* T[0] = A+sigma*B */ ierr = STMatGAXPY_Private(st,st->sigma,0.0,1,0,PETSC_TRUE);CHKERRQ(ierr); } else { /* T[2] = C */ ierr = PetscObjectReference((PetscObject)st->A[2]);CHKERRQ(ierr); st->T[2] = st->A[2]; /* T[0] = A-sigma*B+sigma*sigma*C */ ierr = STMatGAXPY_Private(st,-st->sigma,0.0,2,0,PETSC_TRUE);CHKERRQ(ierr); /* T[1] = B-2*sigma*C */ ierr = STMatGAXPY_Private(st,-2.0*st->sigma,0.0,1,1,PETSC_TRUE);CHKERRQ(ierr); } if (st->nmat==2) { if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetOperators(st->ksp,st->T[1],st->T[1],DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); st->kspidx = 1; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetShift_Shift" PetscErrorCode STSetShift_Shift(ST st,PetscScalar newshift) { PetscErrorCode ierr; MatStructure flg; PetscFunctionBegin; /* Nothing to be done if STSetUp has not been called yet */ if (!st->setupcalled) PetscFunctionReturn(0); if (st->nmat<3) { ierr = STMatGAXPY_Private(st,newshift,st->sigma,1,0,PETSC_FALSE);CHKERRQ(ierr); } else { ierr = STMatGAXPY_Private(st,-newshift,-st->sigma,2,2,PETSC_FALSE);CHKERRQ(ierr); ierr = STMatGAXPY_Private(st,-2.0*newshift,-2.0*st->sigma,1,1,PETSC_FALSE);CHKERRQ(ierr); } if (st->kspidx==0 || (st->nmat==3 && st->kspidx==1)) { /* Update KSP operator */ /* Check if the new KSP matrix has the same zero structure */ if (st->nmat>1 && st->str == DIFFERENT_NONZERO_PATTERN && (st->sigma == 0.0 || newshift == 0.0)) flg = DIFFERENT_NONZERO_PATTERN; else flg = SAME_NONZERO_PATTERN; ierr = KSPSetOperators(st->ksp,st->T[st->kspidx],st->T[st->kspidx],flg);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions_Shift" PetscErrorCode STSetFromOptions_Shift(ST st) { PetscErrorCode ierr; PC pc; PCType pctype; KSPType ksptype; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = KSPGetType(st->ksp,&ksptype);CHKERRQ(ierr); ierr = PCGetType(pc,&pctype);CHKERRQ(ierr); if (!pctype && !ksptype) { if (st->shift_matrix == ST_MATMODE_SHELL) { /* in shell mode use GMRES with Jacobi as the default */ ierr = KSPSetType(st->ksp,KSPGMRES);CHKERRQ(ierr); ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); } else { /* use direct solver as default */ ierr = KSPSetType(st->ksp,KSPPREONLY);CHKERRQ(ierr); ierr = PCSetType(pc,PCREDUNDANT);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCreate_Shift" PETSC_EXTERN PetscErrorCode STCreate_Shift(ST st) { PetscFunctionBegin; st->ops->apply = STApply_Shift; st->ops->getbilinearform = STGetBilinearForm_Default; st->ops->applytrans = STApplyTranspose_Shift; st->ops->postsolve = STPostSolve_Shift; st->ops->backtransform = STBackTransform_Shift; st->ops->setfromoptions = STSetFromOptions_Shift; st->ops->setup = STSetUp_Shift; st->ops->setshift = STSetShift_Shift; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/impls/shift/shift.c.html0000644000175000017500000003156012211062077021342 0ustar gladkgladk

Actual source code: shift.c

  1: /*
  2:     Shift spectral transformation, applies (A + sigma I) as operator, or
  3:     inv(B)(A + sigma B) for generalized problems

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/stimpl.h>          /*I "slepcst.h" I*/

 29: PetscErrorCode STApply_Shift(ST st,Vec x,Vec y)
 30: {

 34:   if (st->nmat>1) {
 35:     /* generalized eigenproblem: y = B^-1 (A + sB) x */
 36:     MatMult(st->T[0],x,st->w);
 37:     STMatSolve(st,1,st->w,y);
 38:   } else {
 39:     /* standard eigenproblem: y = (A + sI) x */
 40:     MatMult(st->T[0],x,y);
 41:   }
 42:   return(0);
 43: }

 47: PetscErrorCode STApplyTranspose_Shift(ST st,Vec x,Vec y)
 48: {

 52:   if (st->nmat>1) {
 53:     /* generalized eigenproblem: y = (A + sB)^T B^-T  x */
 54:     STMatSolveTranspose(st,1,x,st->w);
 55:     MatMultTranspose(st->T[0],st->w,y);
 56:   } else {
 57:     /* standard eigenproblem: y = (A^T + sI) x */
 58:     MatMultTranspose(st->T[0],x,y);
 59:   }
 60:   return(0);
 61: }

 65: PetscErrorCode STBackTransform_Shift(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)
 66: {
 67:   PetscInt j;

 70:   for (j=0;j<n;j++) {
 71:     eigr[j] -= st->sigma;
 72:   }
 73:   return(0);
 74: }

 78: PetscErrorCode STPostSolve_Shift(ST st)
 79: {
 81:   PetscScalar    s;

 84:   if (st->shift_matrix == ST_MATMODE_INPLACE) {
 85:     if (st->nmat>1) {
 86:       if (st->nmat==3) {
 87:         MatAXPY(st->A[0],-st->sigma*st->sigma,st->A[2],st->str);
 88:         MatAXPY(st->A[1],2.0*st->sigma,st->A[2],st->str);
 89:         s = st->sigma;
 90:       } else s = -st->sigma;
 91:       MatAXPY(st->A[0],s,st->A[1],st->str);
 92:     } else {
 93:       MatShift(st->A[0],st->sigma);
 94:     }
 95:     st->Astate[0] = ((PetscObject)st->A[0])->state;
 96:     st->setupcalled = 0;
 97:   }
 98:   return(0);
 99: }

103: PetscErrorCode STSetUp_Shift(ST st)
104: {

108:   if (st->nmat<3) {
109:     /* T[1] = B */
110:     if (st->nmat>1) { PetscObjectReference((PetscObject)st->A[1]); }
111:     st->T[1] = st->A[1];
112:     /* T[0] = A+sigma*B  */
113:     STMatGAXPY_Private(st,st->sigma,0.0,1,0,PETSC_TRUE);
114:   } else {
115:     /* T[2] = C */
116:     PetscObjectReference((PetscObject)st->A[2]);
117:     st->T[2] = st->A[2];
118:     /* T[0] = A-sigma*B+sigma*sigma*C */
119:     STMatGAXPY_Private(st,-st->sigma,0.0,2,0,PETSC_TRUE);
120:     /* T[1] = B-2*sigma*C  */
121:     STMatGAXPY_Private(st,-2.0*st->sigma,0.0,1,1,PETSC_TRUE);
122:   }
123:   if (st->nmat==2) {
124:     if (!st->ksp) { STGetKSP(st,&st->ksp); }
125:     KSPSetOperators(st->ksp,st->T[1],st->T[1],DIFFERENT_NONZERO_PATTERN);
126:     KSPSetUp(st->ksp);
127:     st->kspidx = 1;
128:   }
129:   return(0);
130: }

134: PetscErrorCode STSetShift_Shift(ST st,PetscScalar newshift)
135: {
137:   MatStructure   flg;

140:   /* Nothing to be done if STSetUp has not been called yet */
141:   if (!st->setupcalled) return(0);

143:   if (st->nmat<3) {
144:     STMatGAXPY_Private(st,newshift,st->sigma,1,0,PETSC_FALSE);
145:   } else {
146:     STMatGAXPY_Private(st,-newshift,-st->sigma,2,2,PETSC_FALSE);
147:     STMatGAXPY_Private(st,-2.0*newshift,-2.0*st->sigma,1,1,PETSC_FALSE);
148:   }

150:   if (st->kspidx==0 || (st->nmat==3 && st->kspidx==1)) {  /* Update KSP operator */
151:     /* Check if the new KSP matrix has the same zero structure */
152:     if (st->nmat>1 && st->str == DIFFERENT_NONZERO_PATTERN && (st->sigma == 0.0 || newshift == 0.0)) flg = DIFFERENT_NONZERO_PATTERN;
153:     else flg = SAME_NONZERO_PATTERN;
154:     KSPSetOperators(st->ksp,st->T[st->kspidx],st->T[st->kspidx],flg);
155:     KSPSetUp(st->ksp);
156:   }
157:   return(0);
158: }

162: PetscErrorCode STSetFromOptions_Shift(ST st)
163: {
165:   PC             pc;
166:   PCType         pctype;
167:   KSPType        ksptype;

170:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
171:   KSPGetPC(st->ksp,&pc);
172:   KSPGetType(st->ksp,&ksptype);
173:   PCGetType(pc,&pctype);
174:   if (!pctype && !ksptype) {
175:     if (st->shift_matrix == ST_MATMODE_SHELL) {
176:       /* in shell mode use GMRES with Jacobi as the default */
177:       KSPSetType(st->ksp,KSPGMRES);
178:       PCSetType(pc,PCJACOBI);
179:     } else {
180:       /* use direct solver as default */
181:       KSPSetType(st->ksp,KSPPREONLY);
182:       PCSetType(pc,PCREDUNDANT);
183:     }
184:   }
185:   return(0);
186: }

190: PETSC_EXTERN PetscErrorCode STCreate_Shift(ST st)
191: {
193:   st->ops->apply           = STApply_Shift;
194:   st->ops->getbilinearform = STGetBilinearForm_Default;
195:   st->ops->applytrans      = STApplyTranspose_Shift;
196:   st->ops->postsolve       = STPostSolve_Shift;
197:   st->ops->backtransform   = STBackTransform_Shift;
198:   st->ops->setfromoptions  = STSetFromOptions_Shift;
199:   st->ops->setup           = STSetUp_Shift;
200:   st->ops->setshift        = STSetShift_Shift;
201:   return(0);
202: }

slepc-3.4.2.dfsg.orig/src/st/impls/shift/makefile0000644000175000017500000000213512211062077020612 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = shift.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/impls/shift/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/shift/makefile.html0000644000175000017500000000372612211062077021564 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = shift.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/impls/shift/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/shift/index.html0000644000175000017500000000267112211062077021114 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

shift.c
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/precond/0000755000175000017500000000000012214143515017426 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/precond/precond.c0000644000175000017500000003053112211062077021226 0ustar gladkgladk/* Implements the ST class for preconditioned eigenvalue methods. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ typedef struct { PetscBool setmat; } ST_PRECOND; #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions_Precond" PetscErrorCode STSetFromOptions_Precond(ST st) { PetscErrorCode ierr; PC pc; PCType pctype; Mat P; PetscBool t0,t1; KSP ksp; PetscFunctionBegin; ierr = STGetKSP(st,&ksp);CHKERRQ(ierr); ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr); ierr = PetscObjectGetType((PetscObject)pc,&pctype);CHKERRQ(ierr); ierr = STPrecondGetMatForPC(st,&P);CHKERRQ(ierr); if (!pctype && st->A[0]) { if (P || st->shift_matrix == ST_MATMODE_SHELL) { ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); } else { ierr = MatHasOperation(st->A[0],MATOP_DUPLICATE,&t0);CHKERRQ(ierr); if (st->nmat>1) { ierr = MatHasOperation(st->A[0],MATOP_AXPY,&t1);CHKERRQ(ierr); } else t1 = PETSC_TRUE; ierr = PCSetType(pc,(t0 && t1)?PCJACOBI:PCNONE);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetUp_Precond" PetscErrorCode STSetUp_Precond(ST st) { Mat P; PC pc; PetscBool t0,setmat,destroyP=PETSC_FALSE,builtP; PetscErrorCode ierr; PetscFunctionBegin; /* if the user did not set the shift, use the target value */ if (!st->sigma_set) st->sigma = st->defsigma; /* If either pc is none and no matrix has to be set, or pc is shell , exit */ ierr = STSetFromOptions_Precond(st);CHKERRQ(ierr); if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)pc,PCSHELL,&t0);CHKERRQ(ierr); if (t0) PetscFunctionReturn(0); ierr = PetscObjectTypeCompare((PetscObject)pc,PCNONE,&t0);CHKERRQ(ierr); ierr = STPrecondGetKSPHasMat(st,&setmat);CHKERRQ(ierr); if (t0 && !setmat) PetscFunctionReturn(0); /* Check if a user matrix is set */ ierr = STPrecondGetMatForPC(st,&P);CHKERRQ(ierr); /* If not, create A - shift*B */ if (P) { builtP = PETSC_FALSE; destroyP = PETSC_TRUE; ierr = PetscObjectReference((PetscObject)P);CHKERRQ(ierr); } else { builtP = PETSC_TRUE; if (!(PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) && st->nmat>1) { P = st->A[1]; destroyP = PETSC_FALSE; } else if (st->sigma == 0.0) { P = st->A[0]; destroyP = PETSC_FALSE; } else if (PetscAbsScalar(st->sigma) < PETSC_MAX_REAL && st->shift_matrix != ST_MATMODE_SHELL) { if (st->shift_matrix == ST_MATMODE_INPLACE) { P = st->A[0]; destroyP = PETSC_FALSE; } else { ierr = MatDuplicate(st->A[0],MAT_COPY_VALUES,&P);CHKERRQ(ierr); destroyP = PETSC_TRUE; } if (st->nmat>1) { ierr = MatAXPY(P,-st->sigma,st->A[1],st->str);CHKERRQ(ierr); } else { ierr = MatShift(P,-st->sigma);CHKERRQ(ierr); } /* TODO: in case of ST_MATMODE_INPLACE should keep the Hermitian flag of st->A and restore at the end */ ierr = STMatSetHermitian(st,P);CHKERRQ(ierr); } else builtP = PETSC_FALSE; } /* If P was not possible to obtain, set pc to PCNONE */ if (!P) { ierr = PCSetType(pc,PCNONE);CHKERRQ(ierr); /* If some matrix has to be set to ksp, a shell matrix is created */ if (setmat) { ierr = STMatShellCreate(st,-st->sigma,0,NULL,&P);CHKERRQ(ierr); ierr = STMatSetHermitian(st,P);CHKERRQ(ierr); destroyP = PETSC_TRUE; } } ierr = KSPSetOperators(st->ksp,setmat?P:NULL,P,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); if (destroyP) { ierr = MatDestroy(&P);CHKERRQ(ierr); } else if (st->shift_matrix == ST_MATMODE_INPLACE && builtP) { if (st->sigma != 0.0 && PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) { if (st->nmat>1) { ierr = MatAXPY(st->A[0],st->sigma,st->A[1],st->str);CHKERRQ(ierr); } else { ierr = MatShift(st->A[0],st->sigma);CHKERRQ(ierr); } } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetShift_Precond" PetscErrorCode STSetShift_Precond(ST st,PetscScalar newshift) { PetscErrorCode ierr; PetscFunctionBegin; /* Nothing to be done if STSetUp has not been called yet */ if (!st->setupcalled) PetscFunctionReturn(0); st->sigma = newshift; if (st->shift_matrix != ST_MATMODE_SHELL) { ierr = STSetUp_Precond(st);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondGetMatForPC_Precond" static PetscErrorCode STPrecondGetMatForPC_Precond(ST st,Mat *mat) { PetscErrorCode ierr; PC pc; PetscBool flag; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = PCGetOperatorsSet(pc,NULL,&flag);CHKERRQ(ierr); if (flag) { ierr = PCGetOperators(pc,NULL,mat,NULL);CHKERRQ(ierr); } else *mat = NULL; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondGetMatForPC" /*@ STPrecondGetMatForPC - Returns the matrix previously set by STPrecondSetMatForPC(). Not Collective, but the Mat is shared by all processors that share the ST Input Parameter: . st - the spectral transformation context Output Parameter: . mat - the matrix that will be used in constructing the preconditioner or NULL if no matrix was set by STPrecondSetMatForPC(). Level: advanced .seealso: STPrecondSetMatForPC() @*/ PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(mat,2); ierr = PetscTryMethod(st,"STPrecondGetMatForPC_C",(ST,Mat*),(st,mat));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondSetMatForPC_Precond" static PetscErrorCode STPrecondSetMatForPC_Precond(ST st,Mat mat) { PC pc; Mat A; PetscBool flag; PetscErrorCode ierr; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); /* Yes, all these lines are needed to safely set mat as the preconditioner matrix in pc */ ierr = PCGetOperatorsSet(pc,&flag,NULL);CHKERRQ(ierr); if (flag) { ierr = PCGetOperators(pc,&A,NULL,NULL);CHKERRQ(ierr); ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr); } else A = NULL; ierr = PetscObjectReference((PetscObject)mat);CHKERRQ(ierr); ierr = PCSetOperators(pc,A,mat,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = MatDestroy(&mat);CHKERRQ(ierr); ierr = STPrecondSetKSPHasMat(st,PETSC_TRUE);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondSetMatForPC" /*@ STPrecondSetMatForPC - Sets the matrix that must be used to build the preconditioner. Logically Collective on ST and Mat Input Parameter: + st - the spectral transformation context - mat - the matrix that will be used in constructing the preconditioner Level: advanced Notes: This matrix will be passed to the KSP object (via KSPSetOperators) as the matrix to be used when constructing the preconditioner. If no matrix is set or mat is set to NULL, A - sigma*B will be used to build the preconditioner, being sigma the value set by STSetShift(). .seealso: STPrecondSetMatForPC(), STSetShift() @*/ PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidHeaderSpecific(mat,MAT_CLASSID,2); PetscCheckSameComm(st,1,mat,2); ierr = PetscTryMethod(st,"STPrecondSetMatForPC_C",(ST,Mat),(st,mat));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondSetKSPHasMat_Precond" static PetscErrorCode STPrecondSetKSPHasMat_Precond(ST st,PetscBool setmat) { ST_PRECOND *data = (ST_PRECOND*)st->data; PetscFunctionBegin; data->setmat = setmat; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondSetKSPHasMat" /*@ STPrecondSetKSPHasMat - Sets a flag indicating that during STSetUp the coefficient matrix of the KSP linear system (A) must be set to be the same matrix as the preconditioner (P). Collective on ST Input Parameter: + st - the spectral transformation context - setmat - the flag Notes: In most cases, the preconditioner matrix is used only in the PC object, but in external solvers this matrix must be provided also as the A-matrix in the KSP object. Level: developer .seealso: STPrecondGetKSPHasMat(), STSetShift() @*/ PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveBool(st,setmat,2); ierr = PetscTryMethod(st,"STPrecondSetKSPHasMat_C",(ST,PetscBool),(st,setmat));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondGetKSPHasMat_Precond" static PetscErrorCode STPrecondGetKSPHasMat_Precond(ST st,PetscBool *setmat) { ST_PRECOND *data = (ST_PRECOND*)st->data; PetscFunctionBegin; *setmat = data->setmat; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPrecondGetKSPHasMat" /*@ STPrecondGetKSPHasMat - Returns the flag indicating if the coefficient matrix of the KSP linear system (A) is set to be the same matrix as the preconditioner (P). Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: . setmat - the flag Level: developer .seealso: STPrecondSetKSPHasMat(), STSetShift() @*/ PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(setmat,2); ierr = PetscTryMethod(st,"STPrecondGetKSPHasMat_C",(ST,PetscBool*),(st,setmat));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STDestroy_Precond" PetscErrorCode STDestroy_Precond(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(st->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondGetMatForPC_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondSetMatForPC_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondGetKSPHasMat_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondSetKSPHasMat_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCreate_Precond" PETSC_EXTERN PetscErrorCode STCreate_Precond(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(st,ST_PRECOND,&st->data);CHKERRQ(ierr); st->ops->getbilinearform = STGetBilinearForm_Default; st->ops->setup = STSetUp_Precond; st->ops->setshift = STSetShift_Precond; st->ops->destroy = STDestroy_Precond; st->ops->setfromoptions = STSetFromOptions_Precond; ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondGetMatForPC_C",STPrecondGetMatForPC_Precond);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondSetMatForPC_C",STPrecondSetMatForPC_Precond);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondGetKSPHasMat_C",STPrecondGetKSPHasMat_Precond);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STPrecondSetKSPHasMat_C",STPrecondSetKSPHasMat_Precond);CHKERRQ(ierr); ierr = STPrecondSetKSPHasMat_Precond(st,PETSC_TRUE);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/impls/precond/makefile0000644000175000017500000000214112211062077021124 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = precond.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/impls/precond/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/precond/makefile.html0000644000175000017500000000373212211062077022076 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = precond.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/impls/precond/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/precond/index.html0000644000175000017500000000267512211062077021435 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

precond.c
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/precond/precond.c.html0000644000175000017500000006335312211062077022201 0ustar gladkgladk

Actual source code: precond.c

  1: /*
  2:       Implements the ST class for preconditioned eigenvalue methods.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/stimpl.h>          /*I "slepcst.h" I*/

 26: typedef struct {
 27:   PetscBool setmat;
 28: } ST_PRECOND;

 32: PetscErrorCode STSetFromOptions_Precond(ST st)
 33: {
 35:   PC             pc;
 36:   PCType         pctype;
 37:   Mat            P;
 38:   PetscBool      t0,t1;
 39:   KSP            ksp;

 42:   STGetKSP(st,&ksp);
 43:   KSPGetPC(ksp,&pc);
 44:   PetscObjectGetType((PetscObject)pc,&pctype);
 45:   STPrecondGetMatForPC(st,&P);
 46:   if (!pctype && st->A[0]) {
 47:     if (P || st->shift_matrix == ST_MATMODE_SHELL) {
 48:       PCSetType(pc,PCJACOBI);
 49:     } else {
 50:       MatHasOperation(st->A[0],MATOP_DUPLICATE,&t0);
 51:       if (st->nmat>1) {
 52:         MatHasOperation(st->A[0],MATOP_AXPY,&t1);
 53:       } else t1 = PETSC_TRUE;
 54:       PCSetType(pc,(t0 && t1)?PCJACOBI:PCNONE);
 55:     }
 56:   }
 57:   return(0);
 58: }

 62: PetscErrorCode STSetUp_Precond(ST st)
 63: {
 64:   Mat            P;
 65:   PC             pc;
 66:   PetscBool      t0,setmat,destroyP=PETSC_FALSE,builtP;

 70:   /* if the user did not set the shift, use the target value */
 71:   if (!st->sigma_set) st->sigma = st->defsigma;

 73:   /* If either pc is none and no matrix has to be set, or pc is shell , exit */
 74:   STSetFromOptions_Precond(st);
 75:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
 76:   KSPGetPC(st->ksp,&pc);
 77:   PetscObjectTypeCompare((PetscObject)pc,PCSHELL,&t0);
 78:   if (t0) return(0);
 79:   PetscObjectTypeCompare((PetscObject)pc,PCNONE,&t0);
 80:   STPrecondGetKSPHasMat(st,&setmat);
 81:   if (t0 && !setmat) return(0);

 83:   /* Check if a user matrix is set */
 84:   STPrecondGetMatForPC(st,&P);

 86:   /* If not, create A - shift*B */
 87:   if (P) {
 88:     builtP = PETSC_FALSE;
 89:     destroyP = PETSC_TRUE;
 90:     PetscObjectReference((PetscObject)P);
 91:   } else {
 92:     builtP = PETSC_TRUE;

 94:     if (!(PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) && st->nmat>1) {
 95:       P = st->A[1];
 96:       destroyP = PETSC_FALSE;
 97:     } else if (st->sigma == 0.0) {
 98:       P = st->A[0];
 99:       destroyP = PETSC_FALSE;
100:     } else if (PetscAbsScalar(st->sigma) < PETSC_MAX_REAL && st->shift_matrix != ST_MATMODE_SHELL) {
101:       if (st->shift_matrix == ST_MATMODE_INPLACE) {
102:         P = st->A[0];
103:         destroyP = PETSC_FALSE;
104:       } else {
105:         MatDuplicate(st->A[0],MAT_COPY_VALUES,&P);
106:         destroyP = PETSC_TRUE;
107:       }
108:       if (st->nmat>1) {
109:         MatAXPY(P,-st->sigma,st->A[1],st->str);
110:       } else {
111:         MatShift(P,-st->sigma);
112:       }
113:       /* TODO: in case of ST_MATMODE_INPLACE should keep the Hermitian flag of st->A and restore at the end */
114:       STMatSetHermitian(st,P);
115:     } else builtP = PETSC_FALSE;
116:   }

118:   /* If P was not possible to obtain, set pc to PCNONE */
119:   if (!P) {
120:     PCSetType(pc,PCNONE);

122:     /* If some matrix has to be set to ksp, a shell matrix is created */
123:     if (setmat) {
124:       STMatShellCreate(st,-st->sigma,0,NULL,&P);
125:       STMatSetHermitian(st,P);
126:       destroyP = PETSC_TRUE;
127:     }
128:   }

130:   KSPSetOperators(st->ksp,setmat?P:NULL,P,DIFFERENT_NONZERO_PATTERN);

132:   if (destroyP) {
133:     MatDestroy(&P);
134:   } else if (st->shift_matrix == ST_MATMODE_INPLACE && builtP) {
135:     if (st->sigma != 0.0 && PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) {
136:       if (st->nmat>1) {
137:         MatAXPY(st->A[0],st->sigma,st->A[1],st->str);
138:       } else {
139:         MatShift(st->A[0],st->sigma);
140:       }
141:     }
142:   }
143:   return(0);
144: }

148: PetscErrorCode STSetShift_Precond(ST st,PetscScalar newshift)
149: {

153:   /* Nothing to be done if STSetUp has not been called yet */
154:   if (!st->setupcalled) return(0);
155:   st->sigma = newshift;
156:   if (st->shift_matrix != ST_MATMODE_SHELL) {
157:     STSetUp_Precond(st);
158:   }
159:   return(0);
160: }

164: static PetscErrorCode STPrecondGetMatForPC_Precond(ST st,Mat *mat)
165: {
167:   PC             pc;
168:   PetscBool      flag;

171:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
172:   KSPGetPC(st->ksp,&pc);
173:   PCGetOperatorsSet(pc,NULL,&flag);
174:   if (flag) {
175:     PCGetOperators(pc,NULL,mat,NULL);
176:   } else *mat = NULL;
177:   return(0);
178: }

182: /*@
183:    STPrecondGetMatForPC - Returns the matrix previously set by STPrecondSetMatForPC().

185:    Not Collective, but the Mat is shared by all processors that share the ST

187:    Input Parameter:
188: .  st - the spectral transformation context

190:    Output Parameter:
191: .  mat - the matrix that will be used in constructing the preconditioner or
192:    NULL if no matrix was set by STPrecondSetMatForPC().

194:    Level: advanced

196: .seealso: STPrecondSetMatForPC()
197: @*/
198: PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat)
199: {

205:   PetscTryMethod(st,"STPrecondGetMatForPC_C",(ST,Mat*),(st,mat));
206:   return(0);
207: }

211: static PetscErrorCode STPrecondSetMatForPC_Precond(ST st,Mat mat)
212: {
213:   PC             pc;
214:   Mat            A;
215:   PetscBool      flag;

219:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
220:   KSPGetPC(st->ksp,&pc);
221:   /* Yes, all these lines are needed to safely set mat as the preconditioner
222:      matrix in pc */
223:   PCGetOperatorsSet(pc,&flag,NULL);
224:   if (flag) {
225:     PCGetOperators(pc,&A,NULL,NULL);
226:     PetscObjectReference((PetscObject)A);
227:   } else A = NULL;
228:   PetscObjectReference((PetscObject)mat);
229:   PCSetOperators(pc,A,mat,DIFFERENT_NONZERO_PATTERN);
230:   MatDestroy(&A);
231:   MatDestroy(&mat);
232:   STPrecondSetKSPHasMat(st,PETSC_TRUE);
233:   return(0);
234: }

238: /*@
239:    STPrecondSetMatForPC - Sets the matrix that must be used to build the preconditioner.

241:    Logically Collective on ST and Mat

243:    Input Parameter:
244: +  st - the spectral transformation context
245: -  mat - the matrix that will be used in constructing the preconditioner

247:    Level: advanced

249:    Notes:
250:    This matrix will be passed to the KSP object (via KSPSetOperators) as
251:    the matrix to be used when constructing the preconditioner.
252:    If no matrix is set or mat is set to NULL, A - sigma*B will
253:    be used to build the preconditioner, being sigma the value set by STSetShift().

255: .seealso: STPrecondSetMatForPC(), STSetShift()
256: @*/
257: PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat)
258: {

265:   PetscTryMethod(st,"STPrecondSetMatForPC_C",(ST,Mat),(st,mat));
266:   return(0);
267: }

271: static PetscErrorCode STPrecondSetKSPHasMat_Precond(ST st,PetscBool setmat)
272: {
273:   ST_PRECOND *data = (ST_PRECOND*)st->data;

276:   data->setmat = setmat;
277:   return(0);
278: }

282: /*@
283:    STPrecondSetKSPHasMat - Sets a flag indicating that during STSetUp the coefficient
284:    matrix of the KSP linear system (A) must be set to be the same matrix as the
285:    preconditioner (P).

287:    Collective on ST

289:    Input Parameter:
290: +  st - the spectral transformation context
291: -  setmat - the flag

293:    Notes:
294:    In most cases, the preconditioner matrix is used only in the PC object, but
295:    in external solvers this matrix must be provided also as the A-matrix in
296:    the KSP object.

298:    Level: developer

300: .seealso: STPrecondGetKSPHasMat(), STSetShift()
301: @*/
302: PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat)
303: {

309:   PetscTryMethod(st,"STPrecondSetKSPHasMat_C",(ST,PetscBool),(st,setmat));
310:   return(0);
311: }

315: static PetscErrorCode STPrecondGetKSPHasMat_Precond(ST st,PetscBool *setmat)
316: {
317:   ST_PRECOND *data = (ST_PRECOND*)st->data;

320:   *setmat = data->setmat;
321:   return(0);
322: }

326: /*@
327:    STPrecondGetKSPHasMat - Returns the flag indicating if the coefficient
328:    matrix of the KSP linear system (A) is set to be the same matrix as the
329:    preconditioner (P).

331:    Not Collective

333:    Input Parameter:
334: .  st - the spectral transformation context

336:    Output Parameter:
337: .  setmat - the flag

339:    Level: developer

341: .seealso: STPrecondSetKSPHasMat(), STSetShift()
342: @*/
343: PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat)
344: {

350:   PetscTryMethod(st,"STPrecondGetKSPHasMat_C",(ST,PetscBool*),(st,setmat));
351:   return(0);
352: }

356: PetscErrorCode STDestroy_Precond(ST st)
357: {

361:   PetscFree(st->data);
362:   PetscObjectComposeFunction((PetscObject)st,"STPrecondGetMatForPC_C",NULL);
363:   PetscObjectComposeFunction((PetscObject)st,"STPrecondSetMatForPC_C",NULL);
364:   PetscObjectComposeFunction((PetscObject)st,"STPrecondGetKSPHasMat_C",NULL);
365:   PetscObjectComposeFunction((PetscObject)st,"STPrecondSetKSPHasMat_C",NULL);
366:   return(0);
367: }

371: PETSC_EXTERN PetscErrorCode STCreate_Precond(ST st)
372: {

376:   PetscNewLog(st,ST_PRECOND,&st->data);
377:   st->ops->getbilinearform = STGetBilinearForm_Default;
378:   st->ops->setup           = STSetUp_Precond;
379:   st->ops->setshift        = STSetShift_Precond;
380:   st->ops->destroy         = STDestroy_Precond;
381:   st->ops->setfromoptions  = STSetFromOptions_Precond;

383:   PetscObjectComposeFunction((PetscObject)st,"STPrecondGetMatForPC_C",STPrecondGetMatForPC_Precond);
384:   PetscObjectComposeFunction((PetscObject)st,"STPrecondSetMatForPC_C",STPrecondSetMatForPC_Precond);
385:   PetscObjectComposeFunction((PetscObject)st,"STPrecondGetKSPHasMat_C",STPrecondGetKSPHasMat_Precond);
386:   PetscObjectComposeFunction((PetscObject)st,"STPrecondSetKSPHasMat_C",STPrecondSetKSPHasMat_Precond);

388:   STPrecondSetKSPHasMat_Precond(st,PETSC_TRUE);
389:   return(0);
390: }

slepc-3.4.2.dfsg.orig/src/st/impls/precond/ftn-auto/0000755000175000017500000000000012214143515021163 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/precond/ftn-auto/makefile0000644000175000017500000000034512211062077022665 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = precondf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/st/impls/precond/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/precond/ftn-auto/precondf.c0000644000175000017500000000412412211062077023130 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* precond.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define stprecondgetmatforpc_ STPRECONDGETMATFORPC #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stprecondgetmatforpc_ stprecondgetmatforpc #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stprecondsetmatforpc_ STPRECONDSETMATFORPC #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stprecondsetmatforpc_ stprecondsetmatforpc #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stprecondsetksphasmat_ STPRECONDSETKSPHASMAT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stprecondsetksphasmat_ stprecondsetksphasmat #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stprecondgetksphasmat_ STPRECONDGETKSPHASMAT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stprecondgetksphasmat_ stprecondgetksphasmat #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL stprecondgetmatforpc_(ST *st,Mat *mat, int *__ierr ){ *__ierr = STPrecondGetMatForPC(*st,mat); } void PETSC_STDCALL stprecondsetmatforpc_(ST *st,Mat mat, int *__ierr ){ *__ierr = STPrecondSetMatForPC(*st, (Mat)PetscToPointer((mat) )); } void PETSC_STDCALL stprecondsetksphasmat_(ST *st,PetscBool *setmat, int *__ierr ){ *__ierr = STPrecondSetKSPHasMat(*st,*setmat); } void PETSC_STDCALL stprecondgetksphasmat_(ST *st,PetscBool *setmat, int *__ierr ){ *__ierr = STPrecondGetKSPHasMat(*st,setmat); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/impls/sinvert/0000755000175000017500000000000012211062077017466 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/sinvert/sinvert.c0000644000175000017500000001573712211062077021341 0ustar gladkgladk/* Implements the shift-and-invert technique for eigenvalue problems. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ #undef __FUNCT__ #define __FUNCT__ "STApply_Sinvert" PetscErrorCode STApply_Sinvert(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; if (st->nmat>1) { /* generalized eigenproblem: y = (A - sB)^-1 B x */ ierr = MatMult(st->T[0],x,st->w);CHKERRQ(ierr); ierr = STMatSolve(st,1,st->w,y);CHKERRQ(ierr); } else { /* standard eigenproblem: y = (A - sI)^-1 x */ ierr = STMatSolve(st,1,x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApplyTranspose_Sinvert" PetscErrorCode STApplyTranspose_Sinvert(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; if (st->nmat>1) { /* generalized eigenproblem: y = B^T (A - sB)^-T x */ ierr = STMatSolveTranspose(st,1,x,st->w);CHKERRQ(ierr); ierr = MatMultTranspose(st->T[0],st->w,y);CHKERRQ(ierr); } else { /* standard eigenproblem: y = (A - sI)^-T x */ ierr = STMatSolveTranspose(st,1,x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STBackTransform_Sinvert" PetscErrorCode STBackTransform_Sinvert(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { PetscInt j; #if !defined(PETSC_USE_COMPLEX) PetscScalar t; #endif PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) for (j=0;jsigma; else { t = eigr[j] * eigr[j] + eigi[j] * eigi[j]; eigr[j] = eigr[j] / t + st->sigma; eigi[j] = - eigi[j] / t; } } #else for (j=0;jsigma; } #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPostSolve_Sinvert" PetscErrorCode STPostSolve_Sinvert(ST st) { PetscErrorCode ierr; PetscScalar s; PetscFunctionBegin; if (st->shift_matrix == ST_MATMODE_INPLACE) { if (st->nmat>1) { if (st->nmat==3) { ierr = MatAXPY(st->A[0],-st->sigma*st->sigma,st->A[2],st->str);CHKERRQ(ierr); ierr = MatAXPY(st->A[1],-2.0*st->sigma,st->A[2],st->str);CHKERRQ(ierr); s = -st->sigma; } else s = st->sigma; ierr = MatAXPY(st->A[0],s,st->A[1],st->str);CHKERRQ(ierr); } else { ierr = MatShift(st->A[0],st->sigma);CHKERRQ(ierr); } st->Astate[0] = ((PetscObject)st->A[0])->state; st->setupcalled = 0; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetUp_Sinvert" PetscErrorCode STSetUp_Sinvert(ST st) { PetscErrorCode ierr; PetscScalar gamma; PetscFunctionBegin; /* if the user did not set the shift, use the target value */ if (!st->sigma_set) st->sigma = st->defsigma; if (st->nmat<3) { /* T[0] = B */ if (st->nmat>1) { ierr = PetscObjectReference((PetscObject)st->A[1]);CHKERRQ(ierr); } st->T[0] = st->A[1]; gamma = -st->sigma; } else { /* T[0] = C */ ierr = PetscObjectReference((PetscObject)st->A[2]);CHKERRQ(ierr); st->T[0] = st->A[2]; /* T[2] = A+sigma*B+sigma*sigma*C */ ierr = STMatGAXPY_Private(st,st->sigma,0.0,2,2,PETSC_TRUE);CHKERRQ(ierr); gamma = 2.0*st->sigma; } /* T[1] = A-sigma*B or B+2*sigma*C */ ierr = STMatGAXPY_Private(st,gamma,0.0,1,1,PETSC_TRUE);CHKERRQ(ierr); if (st->nmat<3) { if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetOperators(st->ksp,st->T[1],st->T[1],DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); st->kspidx = 1; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetShift_Sinvert" PetscErrorCode STSetShift_Sinvert(ST st,PetscScalar newshift) { PetscErrorCode ierr; MatStructure flg; PetscScalar alpha,beta; PetscFunctionBegin; /* Nothing to be done if STSetUp has not been called yet */ if (!st->setupcalled) PetscFunctionReturn(0); if (st->nmat<3) { alpha = -newshift; beta = -st->sigma; } else { ierr = STMatGAXPY_Private(st,newshift,st->sigma,2,2,PETSC_FALSE);CHKERRQ(ierr); alpha = 2.0*newshift; beta = 2.0*st->sigma; } ierr = STMatGAXPY_Private(st,alpha,beta,1,1,PETSC_FALSE);CHKERRQ(ierr); if (st->kspidx==1 || (st->nmat==3 && st->kspidx==2)) { /* Update KSP operator */ /* Check if the new KSP matrix has the same zero structure */ if (st->nmat>1 && st->str == DIFFERENT_NONZERO_PATTERN && (st->sigma == 0.0 || newshift == 0.0)) flg = DIFFERENT_NONZERO_PATTERN; else flg = SAME_NONZERO_PATTERN; ierr = KSPSetOperators(st->ksp,st->T[st->kspidx],st->T[st->kspidx],flg);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions_Sinvert" PetscErrorCode STSetFromOptions_Sinvert(ST st) { PetscErrorCode ierr; PC pc; PCType pctype; KSPType ksptype; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = KSPGetType(st->ksp,&ksptype);CHKERRQ(ierr); ierr = PCGetType(pc,&pctype);CHKERRQ(ierr); if (!pctype && !ksptype) { if (st->shift_matrix == ST_MATMODE_SHELL) { /* in shell mode use GMRES with Jacobi as the default */ ierr = KSPSetType(st->ksp,KSPGMRES);CHKERRQ(ierr); ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); } else { /* use direct solver as default */ ierr = KSPSetType(st->ksp,KSPPREONLY);CHKERRQ(ierr); ierr = PCSetType(pc,PCREDUNDANT);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCreate_Sinvert" PETSC_EXTERN PetscErrorCode STCreate_Sinvert(ST st) { PetscFunctionBegin; st->ops->apply = STApply_Sinvert; st->ops->getbilinearform = STGetBilinearForm_Default; st->ops->applytrans = STApplyTranspose_Sinvert; st->ops->postsolve = STPostSolve_Sinvert; st->ops->backtransform = STBackTransform_Sinvert; st->ops->setup = STSetUp_Sinvert; st->ops->setshift = STSetShift_Sinvert; st->ops->setfromoptions = STSetFromOptions_Sinvert; st->ops->checknullspace = STCheckNullSpace_Default; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/impls/sinvert/sinvert.c.html0000644000175000017500000003444712211062077022303 0ustar gladkgladk
Actual source code: sinvert.c

  1: /*
  2:       Implements the shift-and-invert technique for eigenvalue problems.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/stimpl.h>          /*I "slepcst.h" I*/

 28: PetscErrorCode STApply_Sinvert(ST st,Vec x,Vec y)
 29: {

 33:   if (st->nmat>1) {
 34:     /* generalized eigenproblem: y = (A - sB)^-1 B x */
 35:     MatMult(st->T[0],x,st->w);
 36:     STMatSolve(st,1,st->w,y);
 37:   } else {
 38:     /* standard eigenproblem: y = (A - sI)^-1 x */
 39:     STMatSolve(st,1,x,y);
 40:   }
 41:   return(0);
 42: }

 46: PetscErrorCode STApplyTranspose_Sinvert(ST st,Vec x,Vec y)
 47: {

 51:   if (st->nmat>1) {
 52:     /* generalized eigenproblem: y = B^T (A - sB)^-T x */
 53:     STMatSolveTranspose(st,1,x,st->w);
 54:     MatMultTranspose(st->T[0],st->w,y);
 55:   } else {
 56:     /* standard eigenproblem: y = (A - sI)^-T x */
 57:     STMatSolveTranspose(st,1,x,y);
 58:   }
 59:   return(0);
 60: }

 64: PetscErrorCode STBackTransform_Sinvert(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)
 65: {
 66:   PetscInt    j;
 67: #if !defined(PETSC_USE_COMPLEX)
 68:   PetscScalar t;
 69: #endif

 72: #if !defined(PETSC_USE_COMPLEX)
 73:   for (j=0;j<n;j++) {
 74:     if (eigi[j] == 0) eigr[j] = 1.0 / eigr[j] + st->sigma;
 75:     else {
 76:       t = eigr[j] * eigr[j] + eigi[j] * eigi[j];
 77:       eigr[j] = eigr[j] / t + st->sigma;
 78:       eigi[j] = - eigi[j] / t;
 79:     }
 80:   }
 81: #else
 82:   for (j=0;j<n;j++) {
 83:     eigr[j] = 1.0 / eigr[j] + st->sigma;
 84:   }
 85: #endif
 86:   return(0);
 87: }

 91: PetscErrorCode STPostSolve_Sinvert(ST st)
 92: {
 94:   PetscScalar    s;

 97:   if (st->shift_matrix == ST_MATMODE_INPLACE) {
 98:     if (st->nmat>1) {
 99:       if (st->nmat==3) {
100:         MatAXPY(st->A[0],-st->sigma*st->sigma,st->A[2],st->str);
101:         MatAXPY(st->A[1],-2.0*st->sigma,st->A[2],st->str);
102:         s = -st->sigma;
103:       } else s = st->sigma;
104:       MatAXPY(st->A[0],s,st->A[1],st->str);
105:     } else {
106:       MatShift(st->A[0],st->sigma);
107:     }
108:     st->Astate[0] = ((PetscObject)st->A[0])->state;
109:     st->setupcalled = 0;
110:   }
111:   return(0);
112: }

116: PetscErrorCode STSetUp_Sinvert(ST st)
117: {
119:   PetscScalar    gamma;

122:   /* if the user did not set the shift, use the target value */
123:   if (!st->sigma_set) st->sigma = st->defsigma;
124:   if (st->nmat<3) {
125:     /* T[0] = B */
126:     if (st->nmat>1) { PetscObjectReference((PetscObject)st->A[1]); }
127:     st->T[0] = st->A[1];
128:     gamma = -st->sigma;
129:   } else {
130:     /* T[0] = C */
131:     PetscObjectReference((PetscObject)st->A[2]);
132:     st->T[0] = st->A[2];
133:     /* T[2] = A+sigma*B+sigma*sigma*C */
134:     STMatGAXPY_Private(st,st->sigma,0.0,2,2,PETSC_TRUE);
135:     gamma = 2.0*st->sigma;
136:   }
137:   /* T[1] = A-sigma*B or B+2*sigma*C  */
138:   STMatGAXPY_Private(st,gamma,0.0,1,1,PETSC_TRUE);
139:   if (st->nmat<3) {
140:     if (!st->ksp) { STGetKSP(st,&st->ksp); }
141:     KSPSetOperators(st->ksp,st->T[1],st->T[1],DIFFERENT_NONZERO_PATTERN);
142:     KSPSetUp(st->ksp);
143:     st->kspidx = 1;
144:   }
145:   return(0);
146: }

150: PetscErrorCode STSetShift_Sinvert(ST st,PetscScalar newshift)
151: {
153:   MatStructure   flg;
154:   PetscScalar    alpha,beta;

157:   /* Nothing to be done if STSetUp has not been called yet */
158:   if (!st->setupcalled) return(0);
159:   if (st->nmat<3) {
160:     alpha = -newshift; beta = -st->sigma;
161:   } else {
162:     STMatGAXPY_Private(st,newshift,st->sigma,2,2,PETSC_FALSE);
163:     alpha = 2.0*newshift; beta = 2.0*st->sigma;
164:   }
165:   STMatGAXPY_Private(st,alpha,beta,1,1,PETSC_FALSE);
166:   if (st->kspidx==1 || (st->nmat==3 && st->kspidx==2)) {  /* Update KSP operator */
167:     /* Check if the new KSP matrix has the same zero structure */
168:     if (st->nmat>1 && st->str == DIFFERENT_NONZERO_PATTERN && (st->sigma == 0.0 || newshift == 0.0)) flg = DIFFERENT_NONZERO_PATTERN;
169:     else flg = SAME_NONZERO_PATTERN;
170:     KSPSetOperators(st->ksp,st->T[st->kspidx],st->T[st->kspidx],flg);
171:     KSPSetUp(st->ksp);
172:   }
173:   return(0);
174: }

178: PetscErrorCode STSetFromOptions_Sinvert(ST st)
179: {
181:   PC             pc;
182:   PCType         pctype;
183:   KSPType        ksptype;

186:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
187:   KSPGetPC(st->ksp,&pc);
188:   KSPGetType(st->ksp,&ksptype);
189:   PCGetType(pc,&pctype);
190:   if (!pctype && !ksptype) {
191:     if (st->shift_matrix == ST_MATMODE_SHELL) {
192:       /* in shell mode use GMRES with Jacobi as the default */
193:       KSPSetType(st->ksp,KSPGMRES);
194:       PCSetType(pc,PCJACOBI);
195:     } else {
196:       /* use direct solver as default */
197:       KSPSetType(st->ksp,KSPPREONLY);
198:       PCSetType(pc,PCREDUNDANT);
199:     }
200:   }
201:   return(0);
202: }

206: PETSC_EXTERN PetscErrorCode STCreate_Sinvert(ST st)
207: {
209:   st->ops->apply           = STApply_Sinvert;
210:   st->ops->getbilinearform = STGetBilinearForm_Default;
211:   st->ops->applytrans      = STApplyTranspose_Sinvert;
212:   st->ops->postsolve       = STPostSolve_Sinvert;
213:   st->ops->backtransform   = STBackTransform_Sinvert;
214:   st->ops->setup           = STSetUp_Sinvert;
215:   st->ops->setshift        = STSetShift_Sinvert;
216:   st->ops->setfromoptions  = STSetFromOptions_Sinvert;
217:   st->ops->checknullspace  = STCheckNullSpace_Default;
218:   return(0);
219: }

slepc-3.4.2.dfsg.orig/src/st/impls/sinvert/makefile0000644000175000017500000000214112211062077021164 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = sinvert.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/impls/sinvert/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/sinvert/makefile.html0000644000175000017500000000373212211062077022136 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = sinvert.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/impls/sinvert/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/sinvert/index.html0000644000175000017500000000267512211062077021475 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

sinvert.c
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/makefile0000644000175000017500000000210012211062077017465 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = shell shift sinvert cayley fold precond LOCDIR = src/st/impls/ MANSEC = ST include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/makefile.html0000644000175000017500000000367112211062077020446 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = shell shift sinvert cayley fold precond
LOCDIR   = src/st/impls/
MANSEC   = ST

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/index.html0000644000175000017500000000313212211062077017770 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

shell/
shift/
sinvert/
cayley/
fold/
precond/
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/fold/0000755000175000017500000000000012214143515016720 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/fold/fold.c.html0000644000175000017500000003572312211062077020765 0ustar gladkgladk

Actual source code: fold.c

  1: /*
  2:     Folding spectral transformation, applies (A + sigma I)^2 as operator, or
  3:     inv(B)(A + sigma I)^2 for generalized problems

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/stimpl.h>          /*I "slepcst.h" I*/

 27: typedef struct {
 28:   Vec         w2;
 29: } ST_FOLD;

 33: PetscErrorCode STApply_Fold(ST st,Vec x,Vec y)
 34: {
 35:   PetscErrorCode     ierr;
 36:   ST_FOLD            *ctx = (ST_FOLD*)st->data;
 37:   PetscInt           its;
 38:   KSPConvergedReason reason;

 41:   if (st->nmat>1) {
 42:     /* generalized eigenproblem: y = (B^-1 A + sI)^2 x */
 43:     MatMult(st->A[0],x,st->w);
 44:     KSPSolve(st->ksp,st->w,ctx->w2);
 45:     KSPGetConvergedReason(st->ksp,&reason);
 46:     if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]);
 47:     KSPGetIterationNumber(st->ksp,&its);
 48:     st->lineariterations += its;
 49:     if (st->sigma != 0.0) {
 50:       VecAXPY(ctx->w2,-st->sigma,x);
 51:     }
 52:     MatMult(st->A[0],ctx->w2,st->w);
 53:     KSPSolve(st->ksp,st->w,y);
 54:     KSPGetConvergedReason(st->ksp,&reason);
 55:     if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]);
 56:     KSPGetIterationNumber(st->ksp,&its);
 57:     st->lineariterations += its;
 58:     if (st->sigma != 0.0) {
 59:       VecAXPY(y,-st->sigma,ctx->w2);
 60:     }
 61:   } else {
 62:     /* standard eigenproblem: y = (A + sI)^2 x */
 63:     MatMult(st->A[0],x,st->w);
 64:     if (st->sigma != 0.0) {
 65:       VecAXPY(st->w,-st->sigma,x);
 66:     }
 67:     MatMult(st->A[0],st->w,y);
 68:     if (st->sigma != 0.0) {
 69:       VecAXPY(y,-st->sigma,st->w);
 70:     }
 71:   }
 72:   return(0);
 73: }

 77: PetscErrorCode STApplyTranspose_Fold(ST st,Vec x,Vec y)
 78: {
 79:   PetscErrorCode     ierr;
 80:   ST_FOLD            *ctx = (ST_FOLD*)st->data;
 81:   PetscInt           its;
 82:   KSPConvergedReason reason;

 85:   if (st->nmat>1) {
 86:     /* generalized eigenproblem: y = (A^T B^-T + sI)^2 x */
 87:     KSPSolveTranspose(st->ksp,x,st->w);
 88:     KSPGetConvergedReason(st->ksp,&reason);
 89:     if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]);
 90:     KSPGetIterationNumber(st->ksp,&its);
 91:     st->lineariterations += its;
 92:     MatMult(st->A[0],st->w,ctx->w2);
 93:     if (st->sigma != 0.0) {
 94:       VecAXPY(ctx->w2,-st->sigma,x);
 95:     }
 96:     KSPSolveTranspose(st->ksp,ctx->w2,st->w);
 97:     KSPGetConvergedReason(st->ksp,&reason);
 98:     if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]);
 99:     KSPGetIterationNumber(st->ksp,&its);
100:     st->lineariterations += its;
101:     MatMult(st->A[0],st->w,y);
102:     if (st->sigma != 0.0) {
103:       VecAXPY(y,-st->sigma,ctx->w2);
104:     }
105:   } else {
106:     /* standard eigenproblem: y = (A^T + sI)^2 x */
107:     MatMultTranspose(st->A[0],x,st->w);
108:     if (st->sigma != 0.0) {
109:       VecAXPY(st->w,-st->sigma,x);
110:     }
111:     MatMultTranspose(st->A[0],st->w,y);
112:     if (st->sigma != 0.0) {
113:       VecAXPY(y,-st->sigma,st->w);
114:     }
115:   }
116:   return(0);
117: }

121: PetscErrorCode STBackTransform_Fold(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)
122: {
123:   PetscInt    j;
124: #if !defined(PETSC_USE_COMPLEX)
125:   PetscScalar r,x,y;
126: #endif

129:   for (j=0;j<n;j++) {
130: #if !defined(PETSC_USE_COMPLEX)
131:     if (eigi[j] == 0.0) {
132: #endif
133:       eigr[j] = st->sigma + PetscSqrtScalar(eigr[j]);
134: #if !defined(PETSC_USE_COMPLEX)
135:     } else {
136:       r = SlepcAbsEigenvalue(eigr[j],eigi[j]);
137:       x = PetscSqrtScalar((r + eigr[j]) / 2);
138:       y = PetscSqrtScalar((r - eigr[j]) / 2);
139:       if (eigi[j] < 0.0) y = - y;
140:       eigr[j] = st->sigma + x;
141:       eigi[j] = y;
142:     }
143: #endif
144:   }
145:   return(0);
146: }

150: PetscErrorCode STSetUp_Fold(ST st)
151: {
153:   ST_FOLD        *ctx = (ST_FOLD*)st->data;

156:   /* if the user did not set the shift, use the target value */
157:   if (!st->sigma_set) st->sigma = st->defsigma;

159:   if (st->nmat>1) {
160:     if (!st->ksp) { STGetKSP(st,&st->ksp); }
161:     KSPSetOperators(st->ksp,st->A[1],st->A[1],DIFFERENT_NONZERO_PATTERN);
162:     KSPSetUp(st->ksp);
163:     VecDestroy(&ctx->w2);
164:     MatGetVecs(st->A[1],&ctx->w2,NULL);
165:     PetscLogObjectParent(st,ctx->w2);
166:   }
167:   return(0);
168: }

172: PetscErrorCode STSetFromOptions_Fold(ST st)
173: {
175:   PC             pc;
176:   PCType         pctype;
177:   KSPType        ksptype;

180:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
181:   KSPGetPC(st->ksp,&pc);
182:   KSPGetType(st->ksp,&ksptype);
183:   PCGetType(pc,&pctype);
184:   if (!pctype && !ksptype) {
185:     if (st->shift_matrix == ST_MATMODE_SHELL) {
186:       /* in shell mode use GMRES with Jacobi as the default */
187:       KSPSetType(st->ksp,KSPGMRES);
188:       PCSetType(pc,PCJACOBI);
189:     } else {
190:       /* use direct solver as default */
191:       KSPSetType(st->ksp,KSPPREONLY);
192:       PCSetType(pc,PCREDUNDANT);
193:     }
194:   }
195:   return(0);
196: }

200: PetscErrorCode STReset_Fold(ST st)
201: {
203:   ST_FOLD        *ctx = (ST_FOLD*)st->data;

206:   VecDestroy(&ctx->w2);
207:   return(0);
208: }

212: PetscErrorCode STDestroy_Fold(ST st)
213: {

217:   PetscFree(st->data);
218:   return(0);
219: }

223: PETSC_EXTERN PetscErrorCode STCreate_Fold(ST st)
224: {

228:   PetscNewLog(st,ST_FOLD,&st->data);
229:   st->ops->apply           = STApply_Fold;
230:   st->ops->getbilinearform = STGetBilinearForm_Default;
231:   st->ops->applytrans      = STApplyTranspose_Fold;
232:   st->ops->backtransform   = STBackTransform_Fold;
233:   st->ops->setup           = STSetUp_Fold;
234:   st->ops->setfromoptions  = STSetFromOptions_Fold;
235:   st->ops->destroy         = STDestroy_Fold;
236:   st->ops->reset           = STReset_Fold;
237:   return(0);
238: }

slepc-3.4.2.dfsg.orig/src/st/impls/fold/makefile0000644000175000017500000000213312211062077020417 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = fold.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/impls/fold/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/fold/fold.c0000644000175000017500000001760512211062077020021 0ustar gladkgladk/* Folding spectral transformation, applies (A + sigma I)^2 as operator, or inv(B)(A + sigma I)^2 for generalized problems - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ typedef struct { Vec w2; } ST_FOLD; #undef __FUNCT__ #define __FUNCT__ "STApply_Fold" PetscErrorCode STApply_Fold(ST st,Vec x,Vec y) { PetscErrorCode ierr; ST_FOLD *ctx = (ST_FOLD*)st->data; PetscInt its; KSPConvergedReason reason; PetscFunctionBegin; if (st->nmat>1) { /* generalized eigenproblem: y = (B^-1 A + sI)^2 x */ ierr = MatMult(st->A[0],x,st->w);CHKERRQ(ierr); ierr = KSPSolve(st->ksp,st->w,ctx->w2);CHKERRQ(ierr); ierr = KSPGetConvergedReason(st->ksp,&reason);CHKERRQ(ierr); if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]); ierr = KSPGetIterationNumber(st->ksp,&its);CHKERRQ(ierr); st->lineariterations += its; if (st->sigma != 0.0) { ierr = VecAXPY(ctx->w2,-st->sigma,x);CHKERRQ(ierr); } ierr = MatMult(st->A[0],ctx->w2,st->w);CHKERRQ(ierr); ierr = KSPSolve(st->ksp,st->w,y);CHKERRQ(ierr); ierr = KSPGetConvergedReason(st->ksp,&reason);CHKERRQ(ierr); if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]); ierr = KSPGetIterationNumber(st->ksp,&its);CHKERRQ(ierr); st->lineariterations += its; if (st->sigma != 0.0) { ierr = VecAXPY(y,-st->sigma,ctx->w2);CHKERRQ(ierr); } } else { /* standard eigenproblem: y = (A + sI)^2 x */ ierr = MatMult(st->A[0],x,st->w);CHKERRQ(ierr); if (st->sigma != 0.0) { ierr = VecAXPY(st->w,-st->sigma,x);CHKERRQ(ierr); } ierr = MatMult(st->A[0],st->w,y);CHKERRQ(ierr); if (st->sigma != 0.0) { ierr = VecAXPY(y,-st->sigma,st->w);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApplyTranspose_Fold" PetscErrorCode STApplyTranspose_Fold(ST st,Vec x,Vec y) { PetscErrorCode ierr; ST_FOLD *ctx = (ST_FOLD*)st->data; PetscInt its; KSPConvergedReason reason; PetscFunctionBegin; if (st->nmat>1) { /* generalized eigenproblem: y = (A^T B^-T + sI)^2 x */ ierr = KSPSolveTranspose(st->ksp,x,st->w);CHKERRQ(ierr); ierr = KSPGetConvergedReason(st->ksp,&reason);CHKERRQ(ierr); if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]); ierr = KSPGetIterationNumber(st->ksp,&its);CHKERRQ(ierr); st->lineariterations += its; ierr = MatMult(st->A[0],st->w,ctx->w2);CHKERRQ(ierr); if (st->sigma != 0.0) { ierr = VecAXPY(ctx->w2,-st->sigma,x);CHKERRQ(ierr); } ierr = KSPSolveTranspose(st->ksp,ctx->w2,st->w);CHKERRQ(ierr); ierr = KSPGetConvergedReason(st->ksp,&reason);CHKERRQ(ierr); if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]); ierr = KSPGetIterationNumber(st->ksp,&its);CHKERRQ(ierr); st->lineariterations += its; ierr = MatMult(st->A[0],st->w,y);CHKERRQ(ierr); if (st->sigma != 0.0) { ierr = VecAXPY(y,-st->sigma,ctx->w2);CHKERRQ(ierr); } } else { /* standard eigenproblem: y = (A^T + sI)^2 x */ ierr = MatMultTranspose(st->A[0],x,st->w);CHKERRQ(ierr); if (st->sigma != 0.0) { ierr = VecAXPY(st->w,-st->sigma,x);CHKERRQ(ierr); } ierr = MatMultTranspose(st->A[0],st->w,y);CHKERRQ(ierr); if (st->sigma != 0.0) { ierr = VecAXPY(y,-st->sigma,st->w);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STBackTransform_Fold" PetscErrorCode STBackTransform_Fold(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { PetscInt j; #if !defined(PETSC_USE_COMPLEX) PetscScalar r,x,y; #endif PetscFunctionBegin; for (j=0;jsigma + PetscSqrtScalar(eigr[j]); #if !defined(PETSC_USE_COMPLEX) } else { r = SlepcAbsEigenvalue(eigr[j],eigi[j]); x = PetscSqrtScalar((r + eigr[j]) / 2); y = PetscSqrtScalar((r - eigr[j]) / 2); if (eigi[j] < 0.0) y = - y; eigr[j] = st->sigma + x; eigi[j] = y; } #endif } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetUp_Fold" PetscErrorCode STSetUp_Fold(ST st) { PetscErrorCode ierr; ST_FOLD *ctx = (ST_FOLD*)st->data; PetscFunctionBegin; /* if the user did not set the shift, use the target value */ if (!st->sigma_set) st->sigma = st->defsigma; if (st->nmat>1) { if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetOperators(st->ksp,st->A[1],st->A[1],DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); ierr = VecDestroy(&ctx->w2);CHKERRQ(ierr); ierr = MatGetVecs(st->A[1],&ctx->w2,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,ctx->w2);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions_Fold" PetscErrorCode STSetFromOptions_Fold(ST st) { PetscErrorCode ierr; PC pc; PCType pctype; KSPType ksptype; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = KSPGetType(st->ksp,&ksptype);CHKERRQ(ierr); ierr = PCGetType(pc,&pctype);CHKERRQ(ierr); if (!pctype && !ksptype) { if (st->shift_matrix == ST_MATMODE_SHELL) { /* in shell mode use GMRES with Jacobi as the default */ ierr = KSPSetType(st->ksp,KSPGMRES);CHKERRQ(ierr); ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); } else { /* use direct solver as default */ ierr = KSPSetType(st->ksp,KSPPREONLY);CHKERRQ(ierr); ierr = PCSetType(pc,PCREDUNDANT);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STReset_Fold" PetscErrorCode STReset_Fold(ST st) { PetscErrorCode ierr; ST_FOLD *ctx = (ST_FOLD*)st->data; PetscFunctionBegin; ierr = VecDestroy(&ctx->w2);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STDestroy_Fold" PetscErrorCode STDestroy_Fold(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(st->data);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCreate_Fold" PETSC_EXTERN PetscErrorCode STCreate_Fold(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(st,ST_FOLD,&st->data);CHKERRQ(ierr); st->ops->apply = STApply_Fold; st->ops->getbilinearform = STGetBilinearForm_Default; st->ops->applytrans = STApplyTranspose_Fold; st->ops->backtransform = STBackTransform_Fold; st->ops->setup = STSetUp_Fold; st->ops->setfromoptions = STSetFromOptions_Fold; st->ops->destroy = STDestroy_Fold; st->ops->reset = STReset_Fold; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/impls/fold/makefile.html0000644000175000017500000000372412211062077021371 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = fold.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/impls/fold/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/fold/index.html0000644000175000017500000000266712211062077020730 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

fold.c
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/shell/0000755000175000017500000000000012214143515017103 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/shell/shell.c0000644000175000017500000002575212211062077020371 0ustar gladkgladk/* This provides a simple shell interface for programmers to create their own spectral transformations without writing much interface code. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ typedef struct { void *ctx; /* user provided context */ PetscErrorCode (*apply)(ST,Vec,Vec); PetscErrorCode (*applytrans)(ST,Vec,Vec); PetscErrorCode (*backtransform)(ST,PetscInt n,PetscScalar*,PetscScalar*); } ST_Shell; #undef __FUNCT__ #define __FUNCT__ "STShellGetContext" /*@C STShellGetContext - Returns the user-provided context associated with a shell ST Not Collective Input Parameter: . st - spectral transformation context Output Parameter: . ctx - the user provided context Level: advanced Notes: This routine is intended for use within various shell routines .seealso: STShellSetContext() @*/ PetscErrorCode STShellGetContext(ST st,void **ctx) { PetscErrorCode ierr; PetscBool flg; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(ctx,2); ierr = PetscObjectTypeCompare((PetscObject)st,STSHELL,&flg);CHKERRQ(ierr); if (!flg) *ctx = 0; else *ctx = ((ST_Shell*)(st->data))->ctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetContext" /*@ STShellSetContext - Sets the context for a shell ST Logically Collective on ST Input Parameters: + st - the shell ST - ctx - the context Level: advanced Fortran Notes: The context can only be an integer or a PetscObject; unfortunately it cannot be a Fortran array or derived type. .seealso: STShellGetContext() @*/ PetscErrorCode STShellSetContext(ST st,void *ctx) { ST_Shell *shell = (ST_Shell*)st->data; PetscErrorCode ierr; PetscBool flg; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); ierr = PetscObjectTypeCompare((PetscObject)st,STSHELL,&flg);CHKERRQ(ierr); if (flg) { shell->ctx = ctx; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApply_Shell" PetscErrorCode STApply_Shell(ST st,Vec x,Vec y) { PetscErrorCode ierr; ST_Shell *shell = (ST_Shell*)st->data; PetscFunctionBegin; if (!shell->apply) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_USER,"No apply() routine provided to Shell ST"); PetscStackPush("STSHELL apply() user function"); CHKMEMQ; ierr = (*shell->apply)(st,x,y);CHKERRQ(ierr); CHKMEMQ; PetscStackPop; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApplyTranspose_Shell" PetscErrorCode STApplyTranspose_Shell(ST st,Vec x,Vec y) { PetscErrorCode ierr; ST_Shell *shell = (ST_Shell*)st->data; PetscFunctionBegin; if (!shell->applytrans) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_USER,"No applytranspose() routine provided to Shell ST"); PetscStackPush("STSHELL applytranspose() user function"); CHKMEMQ; ierr = (*shell->applytrans)(st,x,y);CHKERRQ(ierr); CHKMEMQ; PetscStackPop; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STBackTransform_Shell" PetscErrorCode STBackTransform_Shell(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { PetscErrorCode ierr; ST_Shell *shell = (ST_Shell*)st->data; PetscFunctionBegin; if (shell->backtransform) { PetscStackPush("STSHELL backtransform() user function"); CHKMEMQ; ierr = (*shell->backtransform)(st,n,eigr,eigi);CHKERRQ(ierr); CHKMEMQ; PetscStackPop; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STDestroy_Shell" PetscErrorCode STDestroy_Shell(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFree(st->data);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STShellSetApply_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyTranspose_C",NULL);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STShellSetBackTransform_C",NULL);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetApply_Shell" static PetscErrorCode STShellSetApply_Shell(ST st,PetscErrorCode (*apply)(ST,Vec,Vec)) { ST_Shell *shell = (ST_Shell*)st->data; PetscFunctionBegin; shell->apply = apply; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetApplyTranspose_Shell" static PetscErrorCode STShellSetApplyTranspose_Shell(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec)) { ST_Shell *shell = (ST_Shell*)st->data; PetscFunctionBegin; shell->applytrans = applytrans; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetBackTransform_Shell" static PetscErrorCode STShellSetBackTransform_Shell(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*)) { ST_Shell *shell = (ST_Shell*)st->data; PetscFunctionBegin; shell->backtransform = backtr; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetApply" /*@C STShellSetApply - Sets routine to use as the application of the operator to a vector in the user-defined spectral transformation. Logically Collective on ST Input Parameters: + st - the spectral transformation context - apply - the application-provided transformation routine Calling sequence of apply: .vb PetscErrorCode apply (ST st,Vec xin,Vec xout) .ve + st - the spectral transformation context . xin - input vector - xout - output vector Level: developer .seealso: STShellSetBackTransform(), STShellSetApplyTranspose() @*/ PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec)) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); ierr = PetscTryMethod(st,"STShellSetApply_C",(ST,PetscErrorCode (*)(ST,Vec,Vec)),(st,apply));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetApplyTranspose" /*@C STShellSetApplyTranspose - Sets routine to use as the application of the transposed operator to a vector in the user-defined spectral transformation. Logically Collective on ST Input Parameters: + st - the spectral transformation context - applytrans - the application-provided transformation routine Calling sequence of apply: .vb PetscErrorCode applytrans (ST st,Vec xin,Vec xout) .ve + st - the spectral transformation context . xin - input vector - xout - output vector Level: developer .seealso: STShellSetApply(), STShellSetBackTransform() @*/ PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec)) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); ierr = PetscTryMethod(st,"STShellSetApplyTranspose_C",(ST,PetscErrorCode (*)(ST,Vec,Vec)),(st,applytrans));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STShellSetBackTransform" /*@C STShellSetBackTransform - Sets the routine to be called after the eigensolution process has finished in order to transform back the computed eigenvalues. Logically Collective on ST Input Parameters: + st - the spectral transformation context - backtr - the application-provided backtransform routine Calling sequence of backtr: .vb PetscErrorCode backtr(ST st,PetscScalar *eigr,PetscScalar *eigi) .ve + st - the spectral transformation context . eigr - pointer ot the real part of the eigenvalue to transform back - eigi - pointer ot the imaginary part Level: developer .seealso: STShellSetApply(), STShellSetApplyTranspose() @*/ PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*)) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); ierr = PetscTryMethod(st,"STShellSetBackTransform_C",(ST,PetscErrorCode (*)(ST,PetscInt,PetscScalar*,PetscScalar*)),(st,backtr));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions_Shell" PetscErrorCode STSetFromOptions_Shell(ST st) { PetscErrorCode ierr; PC pc; PCType pctype; KSPType ksptype; PetscFunctionBegin; if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = KSPGetType(st->ksp,&ksptype);CHKERRQ(ierr); ierr = PCGetType(pc,&pctype);CHKERRQ(ierr); if (!pctype && !ksptype) { if (st->shift_matrix == ST_MATMODE_SHELL) { /* in shell mode use GMRES with Jacobi as the default */ ierr = KSPSetType(st->ksp,KSPGMRES);CHKERRQ(ierr); ierr = PCSetType(pc,PCJACOBI);CHKERRQ(ierr); } else { /* use direct solver as default */ ierr = KSPSetType(st->ksp,KSPPREONLY);CHKERRQ(ierr); ierr = PCSetType(pc,PCREDUNDANT);CHKERRQ(ierr); } } PetscFunctionReturn(0); } /*MC STSHELL - Creates a new spectral transformation class. This is intended to provide a simple class to use with EPS. You should not use this if you plan to make a complete class. Level: advanced Usage: $ PetscErrorCode (*apply)(void*,Vec,Vec); $ PetscErrorCode (*applytrans)(void*,Vec,Vec); $ PetscErrorCode (*backtr)(void*,PetscScalar*,PetscScalar*); $ STCreate(comm,&st); $ STSetType(st,STSHELL); $ STShellSetApply(st,apply); $ STShellSetApplyTranspose(st,applytrans); $ STShellSetBackTransform(st,backtr); (optional) M*/ #undef __FUNCT__ #define __FUNCT__ "STCreate_Shell" PETSC_EXTERN PetscErrorCode STCreate_Shell(ST st) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscNewLog(st,ST_Shell,&st->data);CHKERRQ(ierr); st->ops->apply = STApply_Shell; st->ops->applytrans = STApplyTranspose_Shell; st->ops->backtransform = STBackTransform_Shell; st->ops->setfromoptions = STSetFromOptions_Shell; st->ops->destroy = STDestroy_Shell; ierr = PetscObjectComposeFunction((PetscObject)st,"STShellSetApply_C",STShellSetApply_Shell);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyTranspose_C",STShellSetApplyTranspose_Shell);CHKERRQ(ierr); ierr = PetscObjectComposeFunction((PetscObject)st,"STShellSetBackTransform_C",STShellSetBackTransform_Shell);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/impls/shell/shell.c.html0000644000175000017500000006364212211062077021334 0ustar gladkgladk

Actual source code: shell.c

  1: /*
  2:    This provides a simple shell interface for programmers to
  3:    create their own spectral transformations without writing much
  4:    interface code.

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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 <slepc-private/stimpl.h>        /*I "slepcst.h" I*/

 28: typedef struct {
 29:   void           *ctx;                       /* user provided context */
 30:   PetscErrorCode (*apply)(ST,Vec,Vec);
 31:   PetscErrorCode (*applytrans)(ST,Vec,Vec);
 32:   PetscErrorCode (*backtransform)(ST,PetscInt n,PetscScalar*,PetscScalar*);
 33: } ST_Shell;

 37: /*@C
 38:    STShellGetContext - Returns the user-provided context associated with a shell ST

 40:    Not Collective

 42:    Input Parameter:
 43: .  st - spectral transformation context

 45:    Output Parameter:
 46: .  ctx - the user provided context

 48:    Level: advanced

 50:    Notes:
 51:    This routine is intended for use within various shell routines

 53: .seealso: STShellSetContext()
 54: @*/
 55: PetscErrorCode STShellGetContext(ST st,void **ctx)
 56: {
 58:   PetscBool      flg;

 63:   PetscObjectTypeCompare((PetscObject)st,STSHELL,&flg);
 64:   if (!flg) *ctx = 0;
 65:   else      *ctx = ((ST_Shell*)(st->data))->ctx;
 66:   return(0);
 67: }

 71: /*@
 72:    STShellSetContext - Sets the context for a shell ST

 74:    Logically Collective on ST

 76:    Input Parameters:
 77: +  st - the shell ST
 78: -  ctx - the context

 80:    Level: advanced

 82:    Fortran Notes: The context can only be an integer or a PetscObject;
 83:       unfortunately it cannot be a Fortran array or derived type.

 85: .seealso: STShellGetContext()
 86: @*/
 87: PetscErrorCode STShellSetContext(ST st,void *ctx)
 88: {
 89:   ST_Shell       *shell = (ST_Shell*)st->data;
 91:   PetscBool      flg;

 95:   PetscObjectTypeCompare((PetscObject)st,STSHELL,&flg);
 96:   if (flg) {
 97:     shell->ctx = ctx;
 98:   }
 99:   return(0);
100: }

104: PetscErrorCode STApply_Shell(ST st,Vec x,Vec y)
105: {
107:   ST_Shell       *shell = (ST_Shell*)st->data;

110:   if (!shell->apply) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_USER,"No apply() routine provided to Shell ST");
111:   PetscStackPush("STSHELL apply() user function");
112:   CHKMEMQ;
113:   (*shell->apply)(st,x,y);
114:   CHKMEMQ;
115:   PetscStackPop;
116:   return(0);
117: }

121: PetscErrorCode STApplyTranspose_Shell(ST st,Vec x,Vec y)
122: {
124:   ST_Shell       *shell = (ST_Shell*)st->data;

127:   if (!shell->applytrans) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_USER,"No applytranspose() routine provided to Shell ST");
128:   PetscStackPush("STSHELL applytranspose() user function");
129:   CHKMEMQ;
130:   (*shell->applytrans)(st,x,y);
131:   CHKMEMQ;
132:   PetscStackPop;
133:   return(0);
134: }

138: PetscErrorCode STBackTransform_Shell(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)
139: {
141:   ST_Shell       *shell = (ST_Shell*)st->data;

144:   if (shell->backtransform) {
145:     PetscStackPush("STSHELL backtransform() user function");
146:     CHKMEMQ;
147:     (*shell->backtransform)(st,n,eigr,eigi);
148:     CHKMEMQ;
149:     PetscStackPop;
150:   }
151:   return(0);
152: }

156: PetscErrorCode STDestroy_Shell(ST st)
157: {

161:   PetscFree(st->data);
162:   PetscObjectComposeFunction((PetscObject)st,"STShellSetApply_C",NULL);
163:   PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyTranspose_C",NULL);
164:   PetscObjectComposeFunction((PetscObject)st,"STShellSetBackTransform_C",NULL);
165:   return(0);
166: }

170: static PetscErrorCode STShellSetApply_Shell(ST st,PetscErrorCode (*apply)(ST,Vec,Vec))
171: {
172:   ST_Shell *shell = (ST_Shell*)st->data;

175:   shell->apply = apply;
176:   return(0);
177: }

181: static PetscErrorCode STShellSetApplyTranspose_Shell(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec))
182: {
183:   ST_Shell *shell = (ST_Shell*)st->data;

186:   shell->applytrans = applytrans;
187:   return(0);
188: }

192: static PetscErrorCode STShellSetBackTransform_Shell(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*))
193: {
194:   ST_Shell *shell = (ST_Shell*)st->data;

197:   shell->backtransform = backtr;
198:   return(0);
199: }

203: /*@C
204:    STShellSetApply - Sets routine to use as the application of the
205:    operator to a vector in the user-defined spectral transformation.

207:    Logically Collective on ST

209:    Input Parameters:
210: +  st    - the spectral transformation context
211: -  apply - the application-provided transformation routine

213:    Calling sequence of apply:
214: .vb
215:    PetscErrorCode apply (ST st,Vec xin,Vec xout)
216: .ve

218: +  st   - the spectral transformation context
219: .  xin  - input vector
220: -  xout - output vector

222:    Level: developer

224: .seealso: STShellSetBackTransform(), STShellSetApplyTranspose()
225: @*/
226: PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec))
227: {

232:   PetscTryMethod(st,"STShellSetApply_C",(ST,PetscErrorCode (*)(ST,Vec,Vec)),(st,apply));
233:   return(0);
234: }

238: /*@C
239:    STShellSetApplyTranspose - Sets routine to use as the application of the
240:    transposed operator to a vector in the user-defined spectral transformation.

242:    Logically Collective on ST

244:    Input Parameters:
245: +  st    - the spectral transformation context
246: -  applytrans - the application-provided transformation routine

248:    Calling sequence of apply:
249: .vb
250:    PetscErrorCode applytrans (ST st,Vec xin,Vec xout)
251: .ve

253: +  st   - the spectral transformation context
254: .  xin  - input vector
255: -  xout - output vector

257:    Level: developer

259: .seealso: STShellSetApply(), STShellSetBackTransform()
260: @*/
261: PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec))
262: {

267:   PetscTryMethod(st,"STShellSetApplyTranspose_C",(ST,PetscErrorCode (*)(ST,Vec,Vec)),(st,applytrans));
268:   return(0);
269: }

273: /*@C
274:    STShellSetBackTransform - Sets the routine to be called after the
275:    eigensolution process has finished in order to transform back the
276:    computed eigenvalues.

278:    Logically Collective on ST

280:    Input Parameters:
281: +  st     - the spectral transformation context
282: -  backtr - the application-provided backtransform routine

284:    Calling sequence of backtr:
285: .vb
286:    PetscErrorCode backtr(ST st,PetscScalar *eigr,PetscScalar *eigi)
287: .ve

289: +  st   - the spectral transformation context
290: .  eigr - pointer ot the real part of the eigenvalue to transform back
291: -  eigi - pointer ot the imaginary part

293:    Level: developer

295: .seealso: STShellSetApply(), STShellSetApplyTranspose()
296: @*/
297: PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*))
298: {

303:   PetscTryMethod(st,"STShellSetBackTransform_C",(ST,PetscErrorCode (*)(ST,PetscInt,PetscScalar*,PetscScalar*)),(st,backtr));
304:   return(0);
305: }

309: PetscErrorCode STSetFromOptions_Shell(ST st)
310: {
312:   PC             pc;
313:   PCType         pctype;
314:   KSPType        ksptype;

317:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
318:   KSPGetPC(st->ksp,&pc);
319:   KSPGetType(st->ksp,&ksptype);
320:   PCGetType(pc,&pctype);
321:   if (!pctype && !ksptype) {
322:     if (st->shift_matrix == ST_MATMODE_SHELL) {
323:       /* in shell mode use GMRES with Jacobi as the default */
324:       KSPSetType(st->ksp,KSPGMRES);
325:       PCSetType(pc,PCJACOBI);
326:     } else {
327:       /* use direct solver as default */
328:       KSPSetType(st->ksp,KSPPREONLY);
329:       PCSetType(pc,PCREDUNDANT);
330:     }
331:   }
332:   return(0);
333: }

335: /*MC
336:    STSHELL - Creates a new spectral transformation class.
337:           This is intended to provide a simple class to use with EPS.
338:           You should not use this if you plan to make a complete class.

340:   Level: advanced

342:   Usage:
343: $             PetscErrorCode (*apply)(void*,Vec,Vec);
344: $             PetscErrorCode (*applytrans)(void*,Vec,Vec);
345: $             PetscErrorCode (*backtr)(void*,PetscScalar*,PetscScalar*);
346: $             STCreate(comm,&st);
347: $             STSetType(st,STSHELL);
348: $             STShellSetApply(st,apply);
349: $             STShellSetApplyTranspose(st,applytrans);
350: $             STShellSetBackTransform(st,backtr);    (optional)

352: M*/

356: PETSC_EXTERN PetscErrorCode STCreate_Shell(ST st)
357: {

361:   PetscNewLog(st,ST_Shell,&st->data);
362:   st->ops->apply          = STApply_Shell;
363:   st->ops->applytrans     = STApplyTranspose_Shell;
364:   st->ops->backtransform  = STBackTransform_Shell;
365:   st->ops->setfromoptions = STSetFromOptions_Shell;
366:   st->ops->destroy        = STDestroy_Shell;
367:   PetscObjectComposeFunction((PetscObject)st,"STShellSetApply_C",STShellSetApply_Shell);
368:   PetscObjectComposeFunction((PetscObject)st,"STShellSetApplyTranspose_C",STShellSetApplyTranspose_Shell);
369:   PetscObjectComposeFunction((PetscObject)st,"STShellSetBackTransform_C",STShellSetBackTransform_Shell);
370:   return(0);
371: }

slepc-3.4.2.dfsg.orig/src/st/impls/shell/makefile0000644000175000017500000000213512211062077020604 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = shell.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/impls/shell/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/shell/makefile.html0000644000175000017500000000372612211062077021556 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = shell.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/impls/shell/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/impls/shell/index.html0000644000175000017500000000267112211062077021106 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

shell.c
makefile
slepc-3.4.2.dfsg.orig/src/st/impls/shell/ftn-custom/0000755000175000017500000000000012214143515021202 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/shell/ftn-custom/makefile0000644000175000017500000000217612211062077022710 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zshell.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/st/impls/shell/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/impls/shell/ftn-custom/zshell.c0000644000175000017500000000731412211062077022654 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define stshellgetcontext_ STSHELLGETCONTEXT #define stshellsetapply_ STSHELLSETAPPLY #define stshellsetapplytranspose_ STSHELLSETAPPLYTRANSPOSE #define stshellsetbacktransform_ STSHELLSETBACKTRANSFORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define stshellgetcontext_ stshellgetcontext #define stshellsetapply_ stshellsetapply #define stshellsetapplytranspose_ stshellsetapplytranspose #define stshellsetbacktransform_ stshellsetbacktransform #endif static struct { PetscFortranCallbackId apply; PetscFortranCallbackId applytranspose; PetscFortranCallbackId backtransform; } _cb; /* These are not extern C because they are passed into non-extern C user level functions */ #undef __FUNCT__ #define __FUNCT__ "ourshellapply" static PetscErrorCode ourshellapply(ST st,Vec x,Vec y) { PetscObjectUseFortranCallback(st,_cb.apply,(ST*,Vec*,Vec*,PetscErrorCode*),(&st,&x,&y,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourshellapplytranspose" static PetscErrorCode ourshellapplytranspose(ST st,Vec x,Vec y) { PetscObjectUseFortranCallback(st,_cb.applytranspose,(ST*,Vec*,Vec*,PetscErrorCode*),(&st,&x,&y,&ierr)); return 0; } #undef __FUNCT__ #define __FUNCT__ "ourshellbacktransform" static PetscErrorCode ourshellbacktransform(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi) { PetscObjectUseFortranCallback(st,_cb.backtransform,(ST*,PetscInt*,PetscScalar*,PetscScalar*,PetscErrorCode*),(&st,&n,eigr,eigi,&ierr)); return 0; } PETSC_EXTERN void PETSC_STDCALL stshellgetcontext_(ST *st,void **ctx,PetscErrorCode *ierr) { *ierr = STShellGetContext(*st,ctx); } PETSC_EXTERN void PETSC_STDCALL stshellsetapply_(ST *st,void (PETSC_STDCALL *apply)(void*,Vec*,Vec*,PetscErrorCode*),PetscErrorCode *ierr) { *ierr = PetscObjectSetFortranCallback((PetscObject)*st,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.apply,(PetscVoidFunction)apply,NULL); if (*ierr) return; *ierr = STShellSetApply(*st,ourshellapply); } PETSC_EXTERN void PETSC_STDCALL stshellsetapplytranspose_(ST *st,void (PETSC_STDCALL *applytranspose)(void*,Vec*,Vec*,PetscErrorCode*),PetscErrorCode *ierr) { *ierr = PetscObjectSetFortranCallback((PetscObject)*st,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.applytranspose,(PetscVoidFunction)applytranspose,NULL); if (*ierr) return; *ierr = STShellSetApplyTranspose(*st,ourshellapplytranspose); } PETSC_EXTERN void PETSC_STDCALL stshellsetbacktransform_(ST *st,void (PETSC_STDCALL *backtransform)(void*,PetscScalar*,PetscScalar*,PetscErrorCode*),PetscErrorCode *ierr) { *ierr = PetscObjectSetFortranCallback((PetscObject)*st,PETSC_FORTRAN_CALLBACK_CLASS,&_cb.backtransform,(PetscVoidFunction)backtransform,NULL); if (*ierr) return; *ierr = STShellSetBackTransform(*st,ourshellbacktransform); } slepc-3.4.2.dfsg.orig/src/st/impls/shell/ftn-auto/0000755000175000017500000000000012214143515020640 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/impls/shell/ftn-auto/shellf.c0000644000175000017500000000200612211062077022257 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* shell.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define stshellsetcontext_ STSHELLSETCONTEXT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stshellsetcontext_ stshellsetcontext #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL stshellsetcontext_(ST *st,void*ctx, int *__ierr ){ *__ierr = STShellSetContext(*st,ctx); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/impls/shell/ftn-auto/makefile0000644000175000017500000000034112211062077022336 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = shellf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/st/impls/shell/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/makefile0000644000175000017500000000213712211062077016353 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/stimpl.h ../../include/slepcst.h DIRS = interface impls examples LOCDIR = src/st/ MANSEC = ST include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/makefile.html0000644000175000017500000000373012211062077017316 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/stimpl.h ../../include/slepcst.h
DIRS     = interface impls examples
LOCDIR   = src/st/
MANSEC   = ST

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/interface/0000755000175000017500000000000012214143515016610 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/interface/stsolve.c.html0000644000175000017500000007162112211062077021425 0ustar gladkgladk
Actual source code: stsolve.c

  1: /*
  2:     The ST (spectral transformation) interface routines, callable by users.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/stimpl.h>            /*I "slepcst.h" I*/

 28: /*@
 29:    STApply - Applies the spectral transformation operator to a vector, for
 30:    instance (A - sB)^-1 B in the case of the shift-and-invert tranformation
 31:    and generalized eigenproblem.

 33:    Collective on ST and Vec

 35:    Input Parameters:
 36: +  st - the spectral transformation context
 37: -  x  - input vector

 39:    Output Parameter:
 40: .  y - output vector

 42:    Level: developer

 44: .seealso: STApplyTranspose()
 45: @*/
 46: PetscErrorCode STApply(ST st,Vec x,Vec y)
 47: {

 54:   if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors");

 56:   if (!st->setupcalled) { STSetUp(st); }

 58:   if (!st->ops->apply) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_SUP,"ST does not have apply");
 59:   PetscLogEventBegin(ST_Apply,st,x,y,0);
 60:   st->applys++;
 61:   if (st->D) { /* with balancing */
 62:     VecPointwiseDivide(st->wb,x,st->D);
 63:     (*st->ops->apply)(st,st->wb,y);
 64:     VecPointwiseMult(y,y,st->D);
 65:   } else {
 66:     (*st->ops->apply)(st,x,y);
 67:   }
 68:   PetscLogEventEnd(ST_Apply,st,x,y,0);
 69:   return(0);
 70: }

 74: /*@
 75:    STGetBilinearForm - Returns the matrix used in the bilinear form with a
 76:    generalized problem with semi-definite B.

 78:    Not collective, though a parallel Mat may be returned

 80:    Input Parameters:
 81: .  st - the spectral transformation context

 83:    Output Parameter:
 84: .  B - output matrix

 86:    Notes:
 87:    The output matrix B must be destroyed after use. It will be NULL in
 88:    case of standard eigenproblems.

 90:    Level: developer
 91: @*/
 92: PetscErrorCode STGetBilinearForm(ST st,Mat *B)
 93: {

 99:   if (!st->A) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_WRONGSTATE,"Matrices must be set first");
100:   (*st->ops->getbilinearform)(st,B);
101:   return(0);
102: }

106: PetscErrorCode STGetBilinearForm_Default(ST st,Mat *B)
107: {

111:   if (st->nmat==1) *B = NULL;
112:   else {
113:     *B = st->A[1];
114:     PetscObjectReference((PetscObject)*B);
115:   }
116:   return(0);
117: }

121: /*@
122:    STApplyTranspose - Applies the transpose of the operator to a vector, for
123:    instance B^T(A - sB)^-T in the case of the shift-and-invert tranformation
124:    and generalized eigenproblem.

126:    Collective on ST and Vec

128:    Input Parameters:
129: +  st - the spectral transformation context
130: -  x  - input vector

132:    Output Parameter:
133: .  y - output vector

135:    Level: developer

137: .seealso: STApply()
138: @*/
139: PetscErrorCode STApplyTranspose(ST st,Vec x,Vec y)
140: {

147:   if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors");

149:   if (!st->setupcalled) { STSetUp(st); }

151:   if (!st->ops->applytrans) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_SUP,"ST does not have applytrans");
152:   PetscLogEventBegin(ST_ApplyTranspose,st,x,y,0);
153:   st->applys++;
154:   if (st->D) { /* with balancing */
155:     VecPointwiseMult(st->wb,x,st->D);
156:     (*st->ops->applytrans)(st,st->wb,y);
157:     VecPointwiseDivide(y,y,st->D);
158:   } else {
159:     (*st->ops->applytrans)(st,x,y);
160:   }
161:   PetscLogEventEnd(ST_ApplyTranspose,st,x,y,0);
162:   return(0);
163: }

167: /*@
168:    STComputeExplicitOperator - Computes the explicit operator associated
169:    to the eigenvalue problem with the specified spectral transformation.

171:    Collective on ST

173:    Input Parameter:
174: .  st - the spectral transform context

176:    Output Parameter:
177: .  mat - the explicit operator

179:    Notes:
180:    This routine builds a matrix containing the explicit operator. For
181:    example, in generalized problems with shift-and-invert spectral
182:    transformation the result would be matrix (A - s B)^-1 B.

184:    This computation is done by applying the operator to columns of the
185:    identity matrix. This is analogous to MatComputeExplicitOperator().

187:    Level: advanced

189: .seealso: STApply()
190: @*/
191: PetscErrorCode STComputeExplicitOperator(ST st,Mat *mat)
192: {
193:   PetscErrorCode    ierr;
194:   Vec               in,out;
195:   PetscInt          i,M,m,*rows,start,end;
196:   const PetscScalar *array;
197:   PetscScalar       one = 1.0;
198:   PetscMPIInt       size;

203:   if (!st->A) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_WRONGSTATE,"Matrices must be set first");
204:   MPI_Comm_size(PetscObjectComm((PetscObject)st),&size);

206:   MatGetVecs(st->A[0],&in,&out);
207:   VecGetSize(out,&M);
208:   VecGetLocalSize(out,&m);
209:   VecSetOption(in,VEC_IGNORE_OFF_PROC_ENTRIES,PETSC_TRUE);
210:   VecGetOwnershipRange(out,&start,&end);
211:   PetscMalloc(m*sizeof(PetscInt),&rows);
212:   for (i=0;i<m;i++) rows[i] = start + i;

214:   MatCreate(PetscObjectComm((PetscObject)st),mat);
215:   MatSetSizes(*mat,m,m,M,M);
216:   if (size == 1) {
217:     MatSetType(*mat,MATSEQDENSE);
218:     MatSeqDenseSetPreallocation(*mat,NULL);
219:   } else {
220:     MatSetType(*mat,MATMPIAIJ);
221:     MatMPIAIJSetPreallocation(*mat,m,NULL,M-m,NULL);
222:   }

224:   for (i=0;i<M;i++) {
225:     VecSet(in,0.0);
226:     VecSetValues(in,1,&i,&one,INSERT_VALUES);
227:     VecAssemblyBegin(in);
228:     VecAssemblyEnd(in);

230:     STApply(st,in,out);

232:     VecGetArrayRead(out,&array);
233:     MatSetValues(*mat,m,rows,1,&i,array,INSERT_VALUES);
234:     VecRestoreArrayRead(out,&array);
235:   }
236:   PetscFree(rows);
237:   VecDestroy(&in);
238:   VecDestroy(&out);
239:   MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);
240:   MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);
241:   return(0);
242: }

246: /*@
247:    STSetUp - Prepares for the use of a spectral transformation.

249:    Collective on ST

251:    Input Parameter:
252: .  st - the spectral transformation context

254:    Level: advanced

256: .seealso: STCreate(), STApply(), STDestroy()
257: @*/
258: PetscErrorCode STSetUp(ST st)
259: {
260:   PetscInt       i,n,k;

265:   if (!st->A) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_WRONGSTATE,"Matrices must be set first");
266:   if (st->setupcalled) return(0);
267:   PetscInfo(st,"Setting up new ST\n");
268:   PetscLogEventBegin(ST_SetUp,st,0,0,0);
269:   if (!((PetscObject)st)->type_name) {
270:     STSetType(st,STSHIFT);
271:   }
272:   if (!st->T) {
273:     PetscMalloc(PetscMax(2,st->nmat)*sizeof(Mat),&st->T);
274:     PetscLogObjectMemory(st,PetscMax(2,st->nmat)*sizeof(Mat));
275:   }
276:   for (i=0;i<PetscMax(2,st->nmat);i++) st->T[i] = NULL;
277:   if (!st->w) {
278:     MatGetVecs(st->A[0],&st->w,NULL);
279:     PetscLogObjectParent(st,st->w);
280:   }
281:   if (st->D) {
282:     MatGetLocalSize(st->A[0],NULL,&n);
283:     VecGetLocalSize(st->D,&k);
284:     if (n != k) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Balance matrix has wrong dimension %D (should be %D)",k,n);
285:     if (!st->wb) {
286:       VecDuplicate(st->D,&st->wb);
287:       PetscLogObjectParent(st,st->wb);
288:     }
289:   }
290:   if (st->ops->setup) { (*st->ops->setup)(st); }
291:   st->setupcalled = 1;
292:   PetscLogEventEnd(ST_SetUp,st,0,0,0);
293:   return(0);
294: }

298: /*
299:    Computes a generalized AXPY operation on the A[:] matrices provided by the user,
300:    and stores the result in one of the T[:] matrices. The computation is different
301:    depending on whether the ST has two or three matrices. Also, in quadratic problems
302:    this function is used to compute two matrices, those corresponding to degree 1 and 2.

304:    Builds matrix in T[k] as follows:
305:    deg=1: T[k] = A+alpha*B (if st->nmat==2) or B+2*alpha*C (if st->nmat==3)
306:    deg=2: T[k] = A+alpha*B+alpha*alpha*C
307: */
308: PetscErrorCode STMatGAXPY_Private(ST st,PetscScalar alpha,PetscScalar beta,PetscInt deg,PetscInt k,PetscBool initial)
309: {
311:   PetscScalar    gamma;
312:   PetscInt       matIdx[3],t,i;

315:   if (st->nmat==3 && deg==1) t = 1;
316:   else t = 0;
317:   switch (st->shift_matrix) {
318:   case ST_MATMODE_INPLACE:
319:     if (initial) {
320:       PetscObjectReference((PetscObject)st->A[t]);
321:       st->T[k] = st->A[t];
322:       gamma = alpha;
323:     } else gamma = alpha-beta;
324:     if (gamma != 0.0) {
325:       if (st->nmat>1) {
326:         MatAXPY(st->T[k],gamma,st->A[t+1],st->str);
327:         if (st->nmat==3 && deg==2) {
328:           MatAXPY(st->T[k],gamma*gamma,st->A[2],st->str);
329:         }
330:       } else {
331:         MatShift(st->T[k],gamma);
332:       }
333:     }
334:     break;
335:   case ST_MATMODE_SHELL:
336:     if (initial) {
337:       if (st->nmat>1) {
338:         for (i=0;i<=deg;i++) {
339:           matIdx[i] = t+i;
340:         }
341:         STMatShellCreate(st,alpha,deg+1,matIdx,&st->T[k]);
342:       } else {
343:         STMatShellCreate(st,alpha,deg,NULL,&st->T[k]);
344:       }
345:       PetscLogObjectParent(st,st->T[k]);
346:     } else {
347:       STMatShellShift(st->T[k],alpha);
348:     }
349:     break;
350:   default:
351:     if (alpha == 0.0) {
352:       if (!initial) {
353:         MatDestroy(&st->T[k]);
354:       }
355:       PetscObjectReference((PetscObject)st->A[t]);
356:       st->T[k] = st->A[t];
357:     } else {
358:       if (initial) {
359:         MatDuplicate(st->A[t],MAT_COPY_VALUES,&st->T[k]);
360:         PetscLogObjectParent(st,st->T[k]);
361:       } else {
362:         if (beta==0.0) {
363:           MatDestroy(&st->T[k]);
364:           MatDuplicate(st->A[t],MAT_COPY_VALUES,&st->T[k]);
365:           PetscLogObjectParent(st,st->T[k]);
366:         } else {
367:           MatCopy(st->A[t],st->T[k],SAME_NONZERO_PATTERN);
368:         }
369:       }
370:       if (st->nmat>1) {
371:         MatAXPY(st->T[k],alpha,st->A[t+1],st->str);
372:         if (st->nmat==3 && deg==2) {
373:           MatAXPY(st->T[k],alpha*alpha,st->A[2],st->str);
374:         }
375:       } else {
376:         MatShift(st->T[k],alpha);
377:       }
378:     }
379:   }
380:   STMatSetHermitian(st,st->T[k]);
381:   return(0);
382: }

386: /*@
387:    STPostSolve - Optional post-solve phase, intended for any actions that must
388:    be performed on the ST object after the eigensolver has finished.

390:    Collective on ST

392:    Input Parameters:
393: .  st  - the spectral transformation context

395:    Level: developer

397: .seealso: EPSSolve()
398: @*/
399: PetscErrorCode STPostSolve(ST st)
400: {

405:   if (st->ops->postsolve) {
406:     (*st->ops->postsolve)(st);
407:   }
408:   return(0);
409: }

413: /*@
414:    STBackTransform - Back-transformation phase, intended for
415:    spectral transformations which require to transform the computed
416:    eigenvalues back to the original eigenvalue problem.

418:    Not Collective

420:    Input Parameters:
421:    st   - the spectral transformation context
422:    eigr - real part of a computed eigenvalue
423:    eigi - imaginary part of a computed eigenvalue

425:    Level: developer
426: @*/
427: PetscErrorCode STBackTransform(ST st,PetscInt n,PetscScalar* eigr,PetscScalar* eigi)
428: {

433:   if (st->ops->backtransform) {
434:     (*st->ops->backtransform)(st,n,eigr,eigi);
435:   }
436:   return(0);
437: }
slepc-3.4.2.dfsg.orig/src/st/interface/stfunc.c.html0000644000175000017500000014012412211062077021223 0ustar gladkgladk
Actual source code: stfunc.c

  1: /*
  2:     The ST (spectral transformation) interface routines, callable by users.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/stimpl.h>            /*I "slepcst.h" I*/

 26: PetscClassId     ST_CLASSID = 0;
 27: PetscLogEvent    ST_SetUp = 0,ST_Apply = 0,ST_ApplyTranspose = 0;
 28: static PetscBool STPackageInitialized = PETSC_FALSE;

 32: /*@C
 33:    STFinalizePackage - This function destroys everything in the Slepc interface
 34:    to the ST package. It is called from SlepcFinalize().

 36:    Level: developer

 38: .seealso: SlepcFinalize()
 39: @*/
 40: PetscErrorCode STFinalizePackage(void)
 41: {

 45:   PetscFunctionListDestroy(&STList);
 46:   STPackageInitialized = PETSC_FALSE;
 47:   STRegisterAllCalled  = PETSC_FALSE;
 48:   return(0);
 49: }

 53: /*@C
 54:    STInitializePackage - This function initializes everything in the ST package. It is called
 55:    from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to STCreate()
 56:    when using static libraries.

 58:    Level: developer

 60: .seealso: SlepcInitialize()
 61: @*/
 62: PetscErrorCode STInitializePackage(void)
 63: {
 64:   char           logList[256];
 65:   char           *className;
 66:   PetscBool      opt;

 70:   if (STPackageInitialized) return(0);
 71:   STPackageInitialized = PETSC_TRUE;
 72:   /* Register Classes */
 73:   PetscClassIdRegister("Spectral Transform",&ST_CLASSID);
 74:   /* Register Constructors */
 75:   STRegisterAll();
 76:   /* Register Events */
 77:   PetscLogEventRegister("STSetUp",ST_CLASSID,&ST_SetUp);
 78:   PetscLogEventRegister("STApply",ST_CLASSID,&ST_Apply);
 79:   PetscLogEventRegister("STApplyTranspose",ST_CLASSID,&ST_ApplyTranspose);
 80:   /* Process info exclusions */
 81:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 82:   if (opt) {
 83:     PetscStrstr(logList,"st",&className);
 84:     if (className) {
 85:       PetscInfoDeactivateClass(ST_CLASSID);
 86:     }
 87:   }
 88:   /* Process summary exclusions */
 89:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 90:   if (opt) {
 91:     PetscStrstr(logList,"st",&className);
 92:     if (className) {
 93:       PetscLogEventDeactivateClass(ST_CLASSID);
 94:     }
 95:   }
 96:   PetscRegisterFinalize(STFinalizePackage);
 97:   return(0);
 98: }

102: /*@
103:    STReset - Resets the ST context and removes any allocated objects.

105:    Collective on ST

107:    Input Parameter:
108: .  st - the spectral transformation context

110:    Level: advanced

112: .seealso: STDestroy()
113: @*/
114: PetscErrorCode STReset(ST st)
115: {

120:   if (st->ops->reset) { (*st->ops->reset)(st); }
121:   if (st->ksp) { KSPReset(st->ksp); }
122:   MatDestroyMatrices(PetscMax(2,st->nmat),&st->T);
123:   VecDestroy(&st->w);
124:   VecDestroy(&st->wb);
125:   STResetOperationCounters(st);
126:   st->kspidx = -1;
127:   st->setupcalled = 0;
128:   return(0);
129: }

133: /*@C
134:    STDestroy - Destroys ST context that was created with STCreate().

136:    Collective on ST

138:    Input Parameter:
139: .  st - the spectral transformation context

141:    Level: beginner

143: .seealso: STCreate(), STSetUp()
144: @*/
145: PetscErrorCode STDestroy(ST *st)
146: {

150:   if (!*st) return(0);
152:   if (--((PetscObject)(*st))->refct > 0) { *st = 0; return(0); }
153:   STReset(*st);
154:   MatDestroyMatrices(PetscMax(2,(*st)->nmat),&(*st)->A);
155:   PetscFree((*st)->Astate);
156:   if ((*st)->ops->destroy) { (*(*st)->ops->destroy)(*st); }
157:   VecDestroy(&(*st)->D);
158:   KSPDestroy(&(*st)->ksp);
159:   PetscHeaderDestroy(st);
160:   return(0);
161: }

165: /*@C
166:    STCreate - Creates a spectral transformation context.

168:    Collective on MPI_Comm

170:    Input Parameter:
171: .  comm - MPI communicator

173:    Output Parameter:
174: .  st - location to put the spectral transformation context

176:    Level: beginner

178: .seealso: STSetUp(), STApply(), STDestroy(), ST
179: @*/
180: PetscErrorCode STCreate(MPI_Comm comm,ST *newst)
181: {
183:   ST             st;

187:   *newst = 0;
188: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
189:   STInitializePackage();
190: #endif

192:   SlepcHeaderCreate(st,_p_ST,struct _STOps,ST_CLASSID,"ST","Spectral Transformation","ST",comm,STDestroy,STView);

194:   st->A            = 0;
195:   st->Astate       = 0;
196:   st->T            = 0;
197:   st->nmat         = 0;
198:   st->sigma        = 0.0;
199:   st->sigma_set    = PETSC_FALSE;
200:   st->defsigma     = 0.0;
201:   st->data         = 0;
202:   st->setupcalled  = 0;
203:   st->ksp          = 0;
204:   st->kspidx       = -1;
205:   st->w            = 0;
206:   st->D            = 0;
207:   st->wb           = 0;
208:   st->shift_matrix = ST_MATMODE_COPY;
209:   st->str          = DIFFERENT_NONZERO_PATTERN;

211:   *newst = st;
212:   return(0);
213: }

217: /*@
218:    STSetOperators - Sets the matrices associated with the eigenvalue problem.

220:    Collective on ST and Mat

222:    Input Parameters:
223: +  st - the spectral transformation context
224: .  n  - number of matrices in array A
225: -  A  - the array of matrices associated with the eigensystem

227:    Notes:
228:    It must be called before STSetUp(). If it is called again after STSetUp() then
229:    the ST object is reset.

231:    Level: intermediate

233: .seealso: STGetOperators(), STGetNumMatrices(), STSetUp(), STReset()
234:  @*/
235: PetscErrorCode STSetOperators(ST st,PetscInt n,Mat A[])
236: {
237:   PetscInt       i;

243:   if (n <= 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Must have one or more matrices, you have %D",n);
246:   if (st->setupcalled) { STReset(st); }
247:   MatDestroyMatrices(PetscMax(2,st->nmat),&st->A);
248:   PetscMalloc(PetscMax(2,n)*sizeof(Mat),&st->A);
249:   PetscLogObjectMemory(st,PetscMax(2,n)*sizeof(Mat));
250:   PetscFree(st->Astate);
251:   PetscMalloc(PetscMax(2,n)*sizeof(PetscInt),&st->Astate);
252:   PetscLogObjectMemory(st,PetscMax(2,n)*sizeof(PetscInt));
253:   for (i=0;i<n;i++) {
255:     PetscObjectReference((PetscObject)A[i]);
256:     st->A[i] = A[i];
257:     st->Astate[i] = ((PetscObject)A[i])->state;
258:   }
259:   if (n==1) {
260:     st->A[1] = NULL;
261:     st->Astate[1] = 0;
262:   }
263:   st->nmat = n;
264:   return(0);
265: }

269: /*@
270:    STGetOperators - Gets the matrices associated with the original eigensystem.

272:    Not collective, though parallel Mats are returned if the ST is parallel

274:    Input Parameter:
275: +  st - the spectral transformation context
276: -  k  - the index of the requested matrix (starting in 0)

278:    Output Parameters:
279: .  A - the requested matrix

281:    Level: intermediate

283: .seealso: STSetOperators(), STGetNumMatrices()
284: @*/
285: PetscErrorCode STGetOperators(ST st,PetscInt k,Mat *A)
286: {
290:   if (k<0 || k>=st->nmat) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat-1);
291:   if (((PetscObject)st->A[k])->state!=st->Astate[k]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot retrieve original matrices (have been modified)");
292:   *A = st->A[k];
293:   return(0);
294: }

298: /*@
299:    STGetNumMatrices - Returns the number of matrices stored in the ST.

301:    Not collective

303:    Input Parameter:
304: .  st - the spectral transformation context

306:    Output Parameters:
307: .  n - the number of matrices passed in STSetOperators()

309:    Level: intermediate

311: .seealso: STSetOperators()
312: @*/
313: PetscErrorCode STGetNumMatrices(ST st,PetscInt *n)
314: {
318:   *n = st->nmat;
319:   return(0);
320: }

324: /*@
325:    STSetShift - Sets the shift associated with the spectral transformation.

327:    Logically Collective on ST

329:    Input Parameters:
330: +  st - the spectral transformation context
331: -  shift - the value of the shift

333:    Note:
334:    In some spectral transformations, changing the shift may have associated
335:    a lot of work, for example recomputing a factorization.

337:    Level: beginner

339: @*/
340: PetscErrorCode STSetShift(ST st,PetscScalar shift)
341: {

347:   if (st->sigma != shift) {
348:     if (st->ops->setshift) {
349:       (*st->ops->setshift)(st,shift);
350:     }
351:   }
352:   st->sigma = shift;
353:   st->sigma_set = PETSC_TRUE;
354:   return(0);
355: }

359: /*@
360:    STGetShift - Gets the shift associated with the spectral transformation.

362:    Not Collective

364:    Input Parameter:
365: .  st - the spectral transformation context

367:    Output Parameter:
368: .  shift - the value of the shift

370:    Level: beginner

372: @*/
373: PetscErrorCode STGetShift(ST st,PetscScalar* shift)
374: {
378:   *shift = st->sigma;
379:   return(0);
380: }

384: /*@
385:    STSetDefaultShift - Sets the value of the shift that should be employed if
386:    the user did not specify one.

388:    Logically Collective on ST

390:    Input Parameters:
391: +  st - the spectral transformation context
392: -  defaultshift - the default value of the shift

394:    Level: developer

396: @*/
397: PetscErrorCode STSetDefaultShift(ST st,PetscScalar defaultshift)
398: {
402:   st->defsigma = defaultshift;
403:   return(0);
404: }

408: /*@
409:    STSetBalanceMatrix - Sets the diagonal matrix to be used for balancing.

411:    Collective on ST and Vec

413:    Input Parameters:
414: +  st - the spectral transformation context
415: -  D  - the diagonal matrix (represented as a vector)

417:    Notes:
418:    If this matrix is set, STApply will effectively apply D*OP*D^{-1}.

420:    Balancing is usually set via EPSSetBalance, but the advanced user may use
421:    this function to bypass the usual balancing methods.

423:    Level: developer

425: .seealso: EPSSetBalance(), STApply(), STGetBalanceMatrix()
426: @*/
427: PetscErrorCode STSetBalanceMatrix(ST st,Vec D)
428: {

435:   PetscObjectReference((PetscObject)D);
436:   VecDestroy(&st->D);
437:   st->D = D;
438:   st->setupcalled = 0;
439:   return(0);
440: }

444: /*@
445:    STGetBalanceMatrix - Gets the balance matrix used by the spectral transformation.

447:    Not collective, but vector is shared by all processors that share the ST

449:    Input Parameter:
450: .  st - the spectral transformation context

452:    Output Parameter:
453: .  D  - the diagonal matrix (represented as a vector)

455:    Note:
456:    If the matrix was not set, a null pointer will be returned.

458:    Level: developer

460: .seealso: STSetBalanceMatrix()
461: @*/
462: PetscErrorCode STGetBalanceMatrix(ST st,Vec *D)
463: {
467:   *D = st->D;
468:   return(0);
469: }

473: /*@C
474:    STSetOptionsPrefix - Sets the prefix used for searching for all
475:    ST options in the database.

477:    Logically Collective on ST

479:    Input Parameters:
480: +  st     - the spectral transformation context
481: -  prefix - the prefix string to prepend to all ST option requests

483:    Notes:
484:    A hyphen (-) must NOT be given at the beginning of the prefix name.
485:    The first character of all runtime options is AUTOMATICALLY the
486:    hyphen.

488:    Level: advanced

490: .seealso: STAppendOptionsPrefix(), STGetOptionsPrefix()
491: @*/
492: PetscErrorCode STSetOptionsPrefix(ST st,const char *prefix)
493: {

498:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
499:   KSPSetOptionsPrefix(st->ksp,prefix);
500:   KSPAppendOptionsPrefix(st->ksp,"st_");
501:   PetscObjectSetOptionsPrefix((PetscObject)st,prefix);
502:   return(0);
503: }

507: /*@C
508:    STAppendOptionsPrefix - Appends to the prefix used for searching for all
509:    ST options in the database.

511:    Logically Collective on ST

513:    Input Parameters:
514: +  st     - the spectral transformation context
515: -  prefix - the prefix string to prepend to all ST option requests

517:    Notes:
518:    A hyphen (-) must NOT be given at the beginning of the prefix name.
519:    The first character of all runtime options is AUTOMATICALLY the
520:    hyphen.

522:    Level: advanced

524: .seealso: STSetOptionsPrefix(), STGetOptionsPrefix()
525: @*/
526: PetscErrorCode STAppendOptionsPrefix(ST st,const char *prefix)
527: {

532:   PetscObjectAppendOptionsPrefix((PetscObject)st,prefix);
533:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
534:   KSPSetOptionsPrefix(st->ksp,((PetscObject)st)->prefix);
535:   KSPAppendOptionsPrefix(st->ksp,"st_");
536:   return(0);
537: }

541: /*@C
542:    STGetOptionsPrefix - Gets the prefix used for searching for all
543:    ST options in the database.

545:    Not Collective

547:    Input Parameters:
548: .  st - the spectral transformation context

550:    Output Parameters:
551: .  prefix - pointer to the prefix string used, is returned

553:    Notes: On the Fortran side, the user should pass in a string 'prefix' of
554:    sufficient length to hold the prefix.

556:    Level: advanced

558: .seealso: STSetOptionsPrefix(), STAppendOptionsPrefix()
559: @*/
560: PetscErrorCode STGetOptionsPrefix(ST st,const char *prefix[])
561: {

567:   PetscObjectGetOptionsPrefix((PetscObject)st,prefix);
568:   return(0);
569: }

573: /*@C
574:    STView - Prints the ST data structure.

576:    Collective on ST

578:    Input Parameters:
579: +  st - the ST context
580: -  viewer - optional visualization context

582:    Note:
583:    The available visualization contexts include
584: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
585: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
586:          output where only the first processor opens
587:          the file.  All other processors send their
588:          data to the first processor to print.

590:    The user can open an alternative visualization contexts with
591:    PetscViewerASCIIOpen() (output to a specified file).

593:    Level: beginner

595: .seealso: EPSView(), PetscViewerASCIIOpen()
596: @*/
597: PetscErrorCode STView(ST st,PetscViewer viewer)
598: {
600:   STType         cstr;
601:   const char*    pat;
602:   char           str[50];
603:   PetscBool      isascii,isstring,flg;

607:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)st));

611:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
612:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);
613:   if (isascii) {
614:     PetscObjectPrintClassNamePrefixType((PetscObject)st,viewer,"ST Object");
615:     if (st->ops->view) {
616:       PetscViewerASCIIPushTab(viewer);
617:       (*st->ops->view)(st,viewer);
618:       PetscViewerASCIIPopTab(viewer);
619:     }
620:     SlepcSNPrintfScalar(str,50,st->sigma,PETSC_FALSE);
621:     PetscViewerASCIIPrintf(viewer,"  shift: %s\n",str);
622:     PetscViewerASCIIPrintf(viewer,"  number of matrices: %D\n",st->nmat);
623:     switch (st->shift_matrix) {
624:     case ST_MATMODE_COPY:
625:       break;
626:     case ST_MATMODE_INPLACE:
627:       PetscViewerASCIIPrintf(viewer,"  shifting the matrix and unshifting at exit\n");
628:       break;
629:     case ST_MATMODE_SHELL:
630:       PetscViewerASCIIPrintf(viewer,"  using a shell matrix\n");
631:       break;
632:     }
633:     if (st->nmat>1 && st->shift_matrix != ST_MATMODE_SHELL) {
634:       switch (st->str) {
635:         case SAME_NONZERO_PATTERN:      pat = "same nonzero pattern";break;
636:         case DIFFERENT_NONZERO_PATTERN: pat = "different nonzero pattern";break;
637:         case SUBSET_NONZERO_PATTERN:    pat = "subset nonzero pattern";break;
638:         default: SETERRQ(PetscObjectComm((PetscObject)st),1,"Wrong structure flag");
639:       }
640:       PetscViewerASCIIPrintf(viewer,"  all matrices have %s\n",pat);
641:     }
642:   } else if (isstring) {
643:     STGetType(st,&cstr);
644:     PetscViewerStringSPrintf(viewer," %-7.7s",cstr);
645:     if (st->ops->view) { (*st->ops->view)(st,viewer); }
646:   }
647:   PetscObjectTypeCompareAny((PetscObject)st,&flg,STSHIFT,STFOLD,"");
648:   if (st->nmat>1 || !flg) {
649:     if (!st->ksp) { STGetKSP(st,&st->ksp); }
650:     PetscViewerASCIIPushTab(viewer);
651:     KSPView(st->ksp,viewer);
652:     PetscViewerASCIIPopTab(viewer);
653:   }
654:   return(0);
655: }

659: /*@C
660:    STRegister - Adds a method to the spectral transformation package.

662:    Not collective

664:    Input Parameters:
665: +  name - name of a new user-defined transformation
666: -  function - routine to create method context

668:    Notes:
669:    STRegister() may be called multiple times to add several user-defined
670:    spectral transformations.

672:    Sample usage:
673: .vb
674:    STRegister("my_solver",MySolverCreate);
675: .ve

677:    Then, your solver can be chosen with the procedural interface via
678: $     STSetType(st,"my_solver")
679:    or at runtime via the option
680: $     -st_type my_solver

682:    Level: advanced

684: .seealso: STRegisterAll()
685: @*/
686: PetscErrorCode STRegister(const char *name,PetscErrorCode (*function)(ST))
687: {

691:   PetscFunctionListAdd(&STList,name,function);
692:   return(0);
693: }

slepc-3.4.2.dfsg.orig/src/st/interface/stset.c.html0000644000175000017500000006274012211062077021072 0ustar gladkgladk
Actual source code: stset.c

  1: /*
  2:     Routines to set ST methods and options.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/stimpl.h>      /*I "slepcst.h" I*/

 26: PetscBool         STRegisterAllCalled = PETSC_FALSE;
 27: PetscFunctionList STList = 0;

 31: /*@C
 32:    STSetType - Builds ST for a particular spectral transformation.

 34:    Logically Collective on ST

 36:    Input Parameter:
 37: +  st   - the spectral transformation context.
 38: -  type - a known type

 40:    Options Database Key:
 41: .  -st_type <type> - Sets ST type

 43:    Use -help for a list of available transformations

 45:    Notes:
 46:    See "slepc/include/slepcst.h" for available transformations

 48:    Normally, it is best to use the EPSSetFromOptions() command and
 49:    then set the ST type from the options database rather than by using
 50:    this routine.  Using the options database provides the user with
 51:    maximum flexibility in evaluating the many different transformations.

 53:    Level: intermediate

 55: .seealso: EPSSetType()

 57: @*/
 58: PetscErrorCode STSetType(ST st,STType type)
 59: {
 60:   PetscErrorCode ierr,(*r)(ST);
 61:   PetscBool      match;


 67:   PetscObjectTypeCompare((PetscObject)st,type,&match);
 68:   if (match) return(0);

 70:    PetscFunctionListFind(STList,type,&r);
 71:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested ST type %s",type);

 73:   if (st->ops->destroy) { (*st->ops->destroy)(st); }
 74:   PetscMemzero(st->ops,sizeof(struct _STOps));

 76:   st->setupcalled = 0;
 77:   PetscObjectChangeTypeName((PetscObject)st,type);
 78:   (*r)(st);
 79:   return(0);
 80: }

 84: /*@C
 85:    STGetType - Gets the ST type name (as a string) from the ST context.

 87:    Not Collective

 89:    Input Parameter:
 90: .  st - the spectral transformation context

 92:    Output Parameter:
 93: .  name - name of the spectral transformation

 95:    Level: intermediate

 97: .seealso: STSetType()

 99: @*/
100: PetscErrorCode STGetType(ST st,STType *type)
101: {
105:   *type = ((PetscObject)st)->type_name;
106:   return(0);
107: }

111: /*@
112:    STSetFromOptions - Sets ST options from the options database.
113:    This routine must be called before STSetUp() if the user is to be
114:    allowed to set the type of transformation.

116:    Collective on ST

118:    Input Parameter:
119: .  st - the spectral transformation context

121:    Level: beginner
122: @*/
123: PetscErrorCode STSetFromOptions(ST st)
124: {
126:   PetscInt       i;
127:   PetscScalar    s;
128:   char           type[256];
129:   PetscBool      flg;
130:   const char     *mode_list[3] = {"copy","inplace","shell"};
131:   const char     *structure_list[3] = {"same","different","subset"};

135:   if (!STRegisterAllCalled) { STRegisterAll(); }
136:   PetscObjectOptionsBegin((PetscObject)st);
137:     PetscOptionsList("-st_type","Spectral Transformation type","STSetType",STList,(char*)(((PetscObject)st)->type_name?((PetscObject)st)->type_name:STSHIFT),type,256,&flg);
138:     if (flg) {
139:       STSetType(st,type);
140:     }
141:     /*
142:       Set the type if it was never set.
143:     */
144:     if (!((PetscObject)st)->type_name) {
145:       STSetType(st,STSHIFT);
146:     }

148:     PetscOptionsScalar("-st_shift","Value of the shift","STSetShift",st->sigma,&s,&flg);
149:     if (flg) {
150:       STSetShift(st,s);
151:     }

153:     PetscOptionsEList("-st_matmode","Shift matrix mode","STSetMatMode",mode_list,3,mode_list[st->shift_matrix],&i,&flg);
154:     if (flg) st->shift_matrix = (STMatMode)i;

156:     PetscOptionsEList("-st_matstructure","Shift nonzero pattern","STSetMatStructure",structure_list,3,structure_list[st->str],&i,&flg);
157:     if (flg) {
158:       switch (i) {
159:         case 0: STSetMatStructure(st,SAME_NONZERO_PATTERN); break;
160:         case 1: STSetMatStructure(st,DIFFERENT_NONZERO_PATTERN); break;
161:         case 2: STSetMatStructure(st,SUBSET_NONZERO_PATTERN); break;
162:       }
163:     }

165:     if (st->ops->setfromoptions) {
166:       (*st->ops->setfromoptions)(st);
167:     }
168:     PetscObjectProcessOptionsHandlers((PetscObject)st);
169:   PetscOptionsEnd();
170:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
171:   KSPSetFromOptions(st->ksp);
172:   return(0);
173: }

177: /*@
178:    STSetMatStructure - Sets an internal MatStructure attribute to
179:    indicate which is the relation of the sparsity pattern of the two matrices
180:    A and B constituting the generalized eigenvalue problem.

182:    Logically Collective on ST

184:    Input Parameters:
185: +  st  - the spectral transformation context
186: -  str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN or
187:          SUBSET_NONZERO_PATTERN

189:    Options Database Key:
190: .  -st_matstructure <str> - Indicates the structure flag, where <str> is one
191:          of 'same' (A and B have the same nonzero pattern), 'different' (A
192:          and B have different nonzero pattern) or 'subset' (B's nonzero
193:          pattern is a subset of A's).

195:    Notes:
196:    By default, the sparsity patterns are assumed to be different. If the
197:    patterns are equal or a subset then it is recommended to set this attribute
198:    for efficiency reasons (in particular, for internal MatAXPY() operations).

200:    This function has no effect in the case of standard eigenproblems.

202:    Level: advanced

204: .seealso: STSetOperators(), MatAXPY()
205: @*/
206: PetscErrorCode STSetMatStructure(ST st,MatStructure str)
207: {
211:   switch (str) {
212:     case SAME_NONZERO_PATTERN:
213:     case DIFFERENT_NONZERO_PATTERN:
214:     case SUBSET_NONZERO_PATTERN:
215:       st->str = str;
216:       break;
217:     default:
218:       SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_OUTOFRANGE,"Invalid matrix structure flag");
219:   }
220:   return(0);
221: }

225: /*@
226:    STGetMatStructure - Gets the internal MatStructure attribute to
227:    indicate which is the relation of the sparsity pattern of the two matrices
228:    A and B constituting the generalized eigenvalue problem.

230:    Not Collective

232:    Input Parameters:
233: .  st  - the spectral transformation context

235:    Output Parameters:
236: .  str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN or
237:          SUBSET_NONZERO_PATTERN

239:    Note:
240:    This function has no effect in the case of standard eigenproblems.

242:    Level: advanced

244: .seealso: STSetMatStructure(), STSetOperators(), MatAXPY()
245: @*/
246: PetscErrorCode STGetMatStructure(ST st,MatStructure *str)
247: {
251:   *str = st->str;
252:   return(0);
253: }

257: /*@
258:    STSetMatMode - Sets a flag to indicate how the matrix is
259:    being shifted in the shift-and-invert and Cayley spectral transformations.

261:    Logically Collective on ST

263:    Input Parameters:
264: +  st - the spectral transformation context
265: -  mode - the mode flag, one of ST_MATMODE_COPY,
266:           ST_MATMODE_INPLACE or ST_MATMODE_SHELL

268:    Options Database Key:
269: .  -st_matmode <mode> - Indicates the mode flag, where <mode> is one of
270:           'copy', 'inplace' or 'shell' (see explanation below).

272:    Notes:
273:    By default (ST_MATMODE_COPY), a copy of matrix A is made and then
274:    this copy is shifted explicitly, e.g. A <- (A - s B).

276:    With ST_MATMODE_INPLACE, the original matrix A is shifted at
277:    STSetUp() and unshifted at the end of the computations. With respect to
278:    the previous one, this mode avoids a copy of matrix A. However, a
279:    backdraw is that the recovered matrix might be slightly different
280:    from the original one (due to roundoff).

282:    With ST_MATMODE_SHELL, the solver works with an implicit shell
283:    matrix that represents the shifted matrix. This mode is the most efficient
284:    in creating the shifted matrix but it places serious limitations to the
285:    linear solves performed in each iteration of the eigensolver (typically,
286:    only interative solvers with Jacobi preconditioning can be used).

288:    In the case of generalized problems, in the two first modes the matrix
289:    A - s B has to be computed explicitly. The efficiency of this computation
290:    can be controlled with STSetMatStructure().

292:    Level: intermediate

294: .seealso: STSetOperators(), STSetMatStructure(), STGetMatMode(), STMatMode
295: @*/
296: PetscErrorCode STSetMatMode(ST st,STMatMode mode)
297: {
301:   st->shift_matrix = mode;
302:   st->setupcalled = 0;
303:   return(0);
304: }

308: /*@C
309:    STGetMatMode - Gets a flag that indicates how the matrix is being
310:    shifted in the shift-and-invert and Cayley spectral transformations.

312:    Not Collective

314:    Input Parameter:
315: .  st - the spectral transformation context

317:    Output Parameter:
318: .  mode - the mode flag

320:    Level: intermediate

322: .seealso: STSetMatMode(), STMatMode
323: @*/
324: PetscErrorCode STGetMatMode(ST st,STMatMode *mode)
325: {
329:   *mode = st->shift_matrix;
330:   return(0);
331: }

slepc-3.4.2.dfsg.orig/src/st/interface/shellmat.c.html0000644000175000017500000002662112211062077021537 0ustar gladkgladk
Actual source code: shellmat.c

  1: /*
  2:       This file contains the subroutines which implement various operations
  3:       of the matrix associated to the shift-and-invert technique for eigenvalue
  4:       problems, and also a subroutine to create it.

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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 <slepc-private/stimpl.h>

 28: typedef struct {
 29:   PetscScalar alpha;
 30:   ST          st;
 31:   Vec         z;
 32:   PetscInt    nmat;
 33:   PetscInt    *matIdx;
 34: } ST_SHELLMAT;

 38: PetscErrorCode STMatShellShift(Mat A,PetscScalar alpha)
 39: {
 41:   ST_SHELLMAT    *ctx;

 44:   MatShellGetContext(A,(void**)&ctx);
 45:   ctx->alpha = alpha;
 46:   return(0);
 47: }

 51: static PetscErrorCode MatMult_Shell(Mat A,Vec x,Vec y)
 52: {
 54:   ST_SHELLMAT    *ctx;
 55:   ST             st;
 56:   PetscInt       i;

 59:   MatShellGetContext(A,(void**)&ctx);
 60:   st = ctx->st;
 61:   if (ctx->alpha != 0.0) {
 62:     MatMult(st->A[ctx->matIdx[ctx->nmat-1]],x,y);
 63:     if (ctx->nmat>1) {  /*  */
 64:       for (i=ctx->nmat-2;i>=0;i--) {
 65:         MatMult(st->A[ctx->matIdx[i]],x,ctx->z);
 66:         VecAYPX(y,ctx->alpha,ctx->z);
 67:       }
 68:     } else {    /* y = (A + alpha*I) x */
 69:       VecAXPY(y,ctx->alpha,x);
 70:     }
 71:   } else {
 72:     MatMult(st->A[ctx->matIdx[0]],x,y);
 73:   }
 74:   return(0);
 75: }

 79: static PetscErrorCode MatMultTranspose_Shell(Mat A,Vec x,Vec y)
 80: {
 82:   ST_SHELLMAT    *ctx;
 83:   ST             st;
 84:   PetscInt       i;

 87:   MatShellGetContext(A,(void**)&ctx);
 88:   st = ctx->st;
 89:   if (ctx->alpha != 0.0) {
 90:     MatMultTranspose(st->A[ctx->matIdx[ctx->nmat-1]],x,y);
 91:     if (st->nmat>1) {  /* y = (A + alpha*B) x */
 92:       for (i=ctx->nmat-2;i>=0;i--) {
 93:         MatMultTranspose(st->A[ctx->matIdx[i]],x,y);
 94:         VecAYPX(y,ctx->alpha,ctx->z);
 95:       }
 96:     } else {    /* y = (A + alpha*I) x */
 97:       VecAXPY(y,ctx->alpha,x);
 98:     }
 99:   } else {
100:     MatMultTranspose(st->A[ctx->matIdx[0]],x,y);
101:   }
102:   return(0);
103: }

107: static PetscErrorCode MatGetDiagonal_Shell(Mat A,Vec diag)
108: {
110:   ST_SHELLMAT    *ctx;
111:   ST             st;
112:   Vec            diagb;
113:   PetscInt       i;

116:   MatShellGetContext(A,(void**)&ctx);
117:   st = ctx->st;
118:   if (ctx->alpha != 0.0) {
119:     MatGetDiagonal(st->A[ctx->matIdx[ctx->nmat-1]],diag);
120:     if (st->nmat>1) {
121:       VecDuplicate(diag,&diagb);
122:       for (i=ctx->nmat-2;i>=0;i--) {
123:         MatGetDiagonal(st->A[ctx->matIdx[i]],diagb);
124:         VecAYPX(diag,ctx->alpha,diagb);
125:       }
126:       VecDestroy(&diagb);
127:     } else {
128:       VecShift(diag,ctx->alpha);
129:     }
130:   } else {
131:     MatGetDiagonal(st->A[ctx->matIdx[0]],diag);
132:   }
133:   return(0);
134: }

138: static PetscErrorCode MatDestroy_Shell(Mat A)
139: {
141:   ST_SHELLMAT    *ctx;

144:   MatShellGetContext(A,(void**)&ctx);
145:   VecDestroy(&ctx->z);
146:   PetscFree(ctx->matIdx);
147:   PetscFree(ctx);
148:   return(0);
149: }

153: PetscErrorCode STMatShellCreate(ST st,PetscScalar alpha,PetscInt nmat,PetscInt *matIdx,Mat *mat)
154: {
156:   PetscInt       n,m,N,M,i;
157:   PetscBool      has=PETSC_FALSE,hasA,hasB;
158:   ST_SHELLMAT    *ctx;

161:   MatGetSize(st->A[0],&M,&N);
162:   MatGetLocalSize(st->A[0],&m,&n);
163:   PetscNew(ST_SHELLMAT,&ctx);
164:   ctx->st = st;
165:   ctx->alpha = alpha;
166:   ctx->nmat = matIdx?nmat:st->nmat;
167:   PetscMalloc(ctx->nmat*sizeof(PetscInt),&ctx->matIdx);
168:   if (matIdx) {
169:     for (i=0;i<ctx->nmat;i++) ctx->matIdx[i] = matIdx[i];
170:   } else {
171:     ctx->matIdx[0] = 0;
172:     if (ctx->nmat>1) ctx->matIdx[1] = 1;
173:   }
174:   MatGetVecs(st->A[0],&ctx->z,NULL);
175:   MatCreateShell(PetscObjectComm((PetscObject)st),m,n,M,N,(void*)ctx,mat);
176:   MatShellSetOperation(*mat,MATOP_MULT,(void(*)(void))MatMult_Shell);
177:   MatShellSetOperation(*mat,MATOP_MULT_TRANSPOSE,(void(*)(void))MatMultTranspose_Shell);
178:   MatShellSetOperation(*mat,MATOP_DESTROY,(void(*)(void))MatDestroy_Shell);

180:   MatHasOperation(st->A[ctx->matIdx[0]],MATOP_GET_DIAGONAL,&hasA);
181:   if (st->nmat>1) {
182:     has = hasA;
183:     for (i=1;i<ctx->nmat;i++) {
184:       MatHasOperation(st->A[ctx->matIdx[i]],MATOP_GET_DIAGONAL,&hasB);
185:       has = (has && hasB)? PETSC_TRUE: PETSC_FALSE;
186:     }
187:   }
188:   if ((hasA && st->nmat==1) || has) {
189:     MatShellSetOperation(*mat,MATOP_GET_DIAGONAL,(void(*)(void))MatGetDiagonal_Shell);
190:   }
191:   return(0);
192: }

slepc-3.4.2.dfsg.orig/src/st/interface/stsolve.c0000644000175000017500000003322012211062077020453 0ustar gladkgladk/* The ST (spectral transformation) interface routines, callable by users. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ #undef __FUNCT__ #define __FUNCT__ "STApply" /*@ STApply - Applies the spectral transformation operator to a vector, for instance (A - sB)^-1 B in the case of the shift-and-invert tranformation and generalized eigenproblem. Collective on ST and Vec Input Parameters: + st - the spectral transformation context - x - input vector Output Parameter: . y - output vector Level: developer .seealso: STApplyTranspose() @*/ PetscErrorCode STApply(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidHeaderSpecific(y,VEC_CLASSID,3); if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors"); if (!st->setupcalled) { ierr = STSetUp(st);CHKERRQ(ierr); } if (!st->ops->apply) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_SUP,"ST does not have apply"); ierr = PetscLogEventBegin(ST_Apply,st,x,y,0);CHKERRQ(ierr); st->applys++; if (st->D) { /* with balancing */ ierr = VecPointwiseDivide(st->wb,x,st->D);CHKERRQ(ierr); ierr = (*st->ops->apply)(st,st->wb,y);CHKERRQ(ierr); ierr = VecPointwiseMult(y,y,st->D);CHKERRQ(ierr); } else { ierr = (*st->ops->apply)(st,x,y);CHKERRQ(ierr); } ierr = PetscLogEventEnd(ST_Apply,st,x,y,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetBilinearForm" /*@ STGetBilinearForm - Returns the matrix used in the bilinear form with a generalized problem with semi-definite B. Not collective, though a parallel Mat may be returned Input Parameters: . st - the spectral transformation context Output Parameter: . B - output matrix Notes: The output matrix B must be destroyed after use. It will be NULL in case of standard eigenproblems. Level: developer @*/ PetscErrorCode STGetBilinearForm(ST st,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(B,2); if (!st->A) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_WRONGSTATE,"Matrices must be set first"); ierr = (*st->ops->getbilinearform)(st,B);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetBilinearForm_Default" PetscErrorCode STGetBilinearForm_Default(ST st,Mat *B) { PetscErrorCode ierr; PetscFunctionBegin; if (st->nmat==1) *B = NULL; else { *B = st->A[1]; ierr = PetscObjectReference((PetscObject)*B);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STApplyTranspose" /*@ STApplyTranspose - Applies the transpose of the operator to a vector, for instance B^T(A - sB)^-T in the case of the shift-and-invert tranformation and generalized eigenproblem. Collective on ST and Vec Input Parameters: + st - the spectral transformation context - x - input vector Output Parameter: . y - output vector Level: developer .seealso: STApply() @*/ PetscErrorCode STApplyTranspose(ST st,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidHeaderSpecific(x,VEC_CLASSID,2); PetscValidHeaderSpecific(y,VEC_CLASSID,3); if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors"); if (!st->setupcalled) { ierr = STSetUp(st);CHKERRQ(ierr); } if (!st->ops->applytrans) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_SUP,"ST does not have applytrans"); ierr = PetscLogEventBegin(ST_ApplyTranspose,st,x,y,0);CHKERRQ(ierr); st->applys++; if (st->D) { /* with balancing */ ierr = VecPointwiseMult(st->wb,x,st->D);CHKERRQ(ierr); ierr = (*st->ops->applytrans)(st,st->wb,y);CHKERRQ(ierr); ierr = VecPointwiseDivide(y,y,st->D);CHKERRQ(ierr); } else { ierr = (*st->ops->applytrans)(st,x,y);CHKERRQ(ierr); } ierr = PetscLogEventEnd(ST_ApplyTranspose,st,x,y,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STComputeExplicitOperator" /*@ STComputeExplicitOperator - Computes the explicit operator associated to the eigenvalue problem with the specified spectral transformation. Collective on ST Input Parameter: . st - the spectral transform context Output Parameter: . mat - the explicit operator Notes: This routine builds a matrix containing the explicit operator. For example, in generalized problems with shift-and-invert spectral transformation the result would be matrix (A - s B)^-1 B. This computation is done by applying the operator to columns of the identity matrix. This is analogous to MatComputeExplicitOperator(). Level: advanced .seealso: STApply() @*/ PetscErrorCode STComputeExplicitOperator(ST st,Mat *mat) { PetscErrorCode ierr; Vec in,out; PetscInt i,M,m,*rows,start,end; const PetscScalar *array; PetscScalar one = 1.0; PetscMPIInt size; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(mat,2); if (!st->A) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_WRONGSTATE,"Matrices must be set first"); ierr = MPI_Comm_size(PetscObjectComm((PetscObject)st),&size);CHKERRQ(ierr); ierr = MatGetVecs(st->A[0],&in,&out);CHKERRQ(ierr); ierr = VecGetSize(out,&M);CHKERRQ(ierr); ierr = VecGetLocalSize(out,&m);CHKERRQ(ierr); ierr = VecSetOption(in,VEC_IGNORE_OFF_PROC_ENTRIES,PETSC_TRUE);CHKERRQ(ierr); ierr = VecGetOwnershipRange(out,&start,&end);CHKERRQ(ierr); ierr = PetscMalloc(m*sizeof(PetscInt),&rows);CHKERRQ(ierr); for (i=0;iA) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_WRONGSTATE,"Matrices must be set first"); if (st->setupcalled) PetscFunctionReturn(0); ierr = PetscInfo(st,"Setting up new ST\n");CHKERRQ(ierr); ierr = PetscLogEventBegin(ST_SetUp,st,0,0,0);CHKERRQ(ierr); if (!((PetscObject)st)->type_name) { ierr = STSetType(st,STSHIFT);CHKERRQ(ierr); } if (!st->T) { ierr = PetscMalloc(PetscMax(2,st->nmat)*sizeof(Mat),&st->T);CHKERRQ(ierr); ierr = PetscLogObjectMemory(st,PetscMax(2,st->nmat)*sizeof(Mat));CHKERRQ(ierr); } for (i=0;inmat);i++) st->T[i] = NULL; if (!st->w) { ierr = MatGetVecs(st->A[0],&st->w,NULL);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,st->w);CHKERRQ(ierr); } if (st->D) { ierr = MatGetLocalSize(st->A[0],NULL,&n);CHKERRQ(ierr); ierr = VecGetLocalSize(st->D,&k);CHKERRQ(ierr); if (n != k) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Balance matrix has wrong dimension %D (should be %D)",k,n); if (!st->wb) { ierr = VecDuplicate(st->D,&st->wb);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,st->wb);CHKERRQ(ierr); } } if (st->ops->setup) { ierr = (*st->ops->setup)(st);CHKERRQ(ierr); } st->setupcalled = 1; ierr = PetscLogEventEnd(ST_SetUp,st,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STMatGAXPY_Private" /* Computes a generalized AXPY operation on the A[:] matrices provided by the user, and stores the result in one of the T[:] matrices. The computation is different depending on whether the ST has two or three matrices. Also, in quadratic problems this function is used to compute two matrices, those corresponding to degree 1 and 2. Builds matrix in T[k] as follows: deg=1: T[k] = A+alpha*B (if st->nmat==2) or B+2*alpha*C (if st->nmat==3) deg=2: T[k] = A+alpha*B+alpha*alpha*C */ PetscErrorCode STMatGAXPY_Private(ST st,PetscScalar alpha,PetscScalar beta,PetscInt deg,PetscInt k,PetscBool initial) { PetscErrorCode ierr; PetscScalar gamma; PetscInt matIdx[3],t,i; PetscFunctionBegin; if (st->nmat==3 && deg==1) t = 1; else t = 0; switch (st->shift_matrix) { case ST_MATMODE_INPLACE: if (initial) { ierr = PetscObjectReference((PetscObject)st->A[t]);CHKERRQ(ierr); st->T[k] = st->A[t]; gamma = alpha; } else gamma = alpha-beta; if (gamma != 0.0) { if (st->nmat>1) { ierr = MatAXPY(st->T[k],gamma,st->A[t+1],st->str);CHKERRQ(ierr); if (st->nmat==3 && deg==2) { ierr = MatAXPY(st->T[k],gamma*gamma,st->A[2],st->str);CHKERRQ(ierr); } } else { ierr = MatShift(st->T[k],gamma);CHKERRQ(ierr); } } break; case ST_MATMODE_SHELL: if (initial) { if (st->nmat>1) { for (i=0;i<=deg;i++) { matIdx[i] = t+i; } ierr = STMatShellCreate(st,alpha,deg+1,matIdx,&st->T[k]);CHKERRQ(ierr); } else { ierr = STMatShellCreate(st,alpha,deg,NULL,&st->T[k]);CHKERRQ(ierr); } ierr = PetscLogObjectParent(st,st->T[k]);CHKERRQ(ierr); } else { ierr = STMatShellShift(st->T[k],alpha);CHKERRQ(ierr); } break; default: if (alpha == 0.0) { if (!initial) { ierr = MatDestroy(&st->T[k]);CHKERRQ(ierr); } ierr = PetscObjectReference((PetscObject)st->A[t]);CHKERRQ(ierr); st->T[k] = st->A[t]; } else { if (initial) { ierr = MatDuplicate(st->A[t],MAT_COPY_VALUES,&st->T[k]);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,st->T[k]);CHKERRQ(ierr); } else { if (beta==0.0) { ierr = MatDestroy(&st->T[k]);CHKERRQ(ierr); ierr = MatDuplicate(st->A[t],MAT_COPY_VALUES,&st->T[k]);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,st->T[k]);CHKERRQ(ierr); } else { ierr = MatCopy(st->A[t],st->T[k],SAME_NONZERO_PATTERN);CHKERRQ(ierr); } } if (st->nmat>1) { ierr = MatAXPY(st->T[k],alpha,st->A[t+1],st->str);CHKERRQ(ierr); if (st->nmat==3 && deg==2) { ierr = MatAXPY(st->T[k],alpha*alpha,st->A[2],st->str);CHKERRQ(ierr); } } else { ierr = MatShift(st->T[k],alpha);CHKERRQ(ierr); } } } ierr = STMatSetHermitian(st,st->T[k]);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STPostSolve" /*@ STPostSolve - Optional post-solve phase, intended for any actions that must be performed on the ST object after the eigensolver has finished. Collective on ST Input Parameters: . st - the spectral transformation context Level: developer .seealso: EPSSolve() @*/ PetscErrorCode STPostSolve(ST st) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (st->ops->postsolve) { ierr = (*st->ops->postsolve)(st);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STBackTransform" /*@ STBackTransform - Back-transformation phase, intended for spectral transformations which require to transform the computed eigenvalues back to the original eigenvalue problem. Not Collective Input Parameters: st - the spectral transformation context eigr - real part of a computed eigenvalue eigi - imaginary part of a computed eigenvalue Level: developer @*/ PetscErrorCode STBackTransform(ST st,PetscInt n,PetscScalar* eigr,PetscScalar* eigi) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (st->ops->backtransform) { ierr = (*st->ops->backtransform)(st,n,eigr,eigi);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/interface/makefile0000644000175000017500000000221412211062077020307 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = stfunc.c stset.c stsolve.c stsles.c stregis.c shellmat.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = ST LOCDIR = src/st/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/interface/makefile.html0000644000175000017500000000400512211062077021252 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = stfunc.c stset.c stsolve.c stsles.c stregis.c shellmat.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = ST
LOCDIR   = src/st/interface/

include ${SLEPC_DIR}/conf/slepc_common


slepc-3.4.2.dfsg.orig/src/st/interface/index.html0000644000175000017500000000321612211062077020607 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

stfunc.c
stset.c
stsolve.c
stsles.c
stregis.c
shellmat.c
makefile
slepc-3.4.2.dfsg.orig/src/st/interface/stregis.c.html0000644000175000017500000001224212211062077021400 0ustar gladkgladk

Actual source code: stregis.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/stimpl.h>          /*I   "slepcst.h"   I*/

 24: PETSC_EXTERN PetscErrorCode STCreate_Shell(ST);
 25: PETSC_EXTERN PetscErrorCode STCreate_Shift(ST);
 26: PETSC_EXTERN PetscErrorCode STCreate_Sinvert(ST);
 27: PETSC_EXTERN PetscErrorCode STCreate_Cayley(ST);
 28: PETSC_EXTERN PetscErrorCode STCreate_Fold(ST);
 29: PETSC_EXTERN PetscErrorCode STCreate_Precond(ST);

 33: /*@C
 34:    STRegisterAll - Registers all of the spectral transformations in the ST package.

 36:    Not Collective

 38:    Level: advanced

 40: .seealso: STRegister()
 41: @*/
 42: PetscErrorCode STRegisterAll(void)
 43: {

 47:   STRegisterAllCalled = PETSC_TRUE;
 48:   STRegister(STSHELL,STCreate_Shell);
 49:   STRegister(STSHIFT,STCreate_Shift);
 50:   STRegister(STSINVERT,STCreate_Sinvert);
 51:   STRegister(STCAYLEY,STCreate_Cayley);
 52:   STRegister(STFOLD,STCreate_Fold);
 53:   STRegister(STPRECOND,STCreate_Precond);
 54:   return(0);
 55: }

slepc-3.4.2.dfsg.orig/src/st/interface/stsles.c.html0000644000175000017500000007422412211062077021245 0ustar gladkgladk
Actual source code: stsles.c

  1: /*
  2:     The ST (spectral transformation) interface routines related to the
  3:     KSP object associated to it.

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

  9:    This file is part of SLEPc.

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

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

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

 25: #include <slepc-private/stimpl.h>            /*I "slepcst.h" I*/
 26: #include <slepcsys.h>

 30: /*@
 31:    STMatMult - Computes the matrix-vector product y = T[k] x, where T[k] is
 32:    the k-th matrix of the spectral transformation.

 34:    Collective on ST

 36:    Input Parameters:
 37: +  st - the spectral transformation context
 38: .  k  - index of matrix to use
 39: -  x  - the vector to be multiplied

 41:    Output Parameter:
 42: .  y - the result

 44:    Level: developer

 46: .seealso: STMatMultTranspose()
 47: @*/
 48: PetscErrorCode STMatMult(ST st,PetscInt k,Vec x,Vec y)
 49: {

 53:   if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat);
 54:   if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors");

 56:   if (!st->setupcalled) { STSetUp(st); }
 57:   if (!st->T[k]) {
 58:     /* T[k]=NULL means identity matrix */
 59:     VecCopy(x,y);
 60:   } else {
 61:     MatMult(st->T[k],x,y);
 62:   }
 63:   return(0);
 64: }

 68: /*@
 69:    STMatMultTranspose - Computes the matrix-vector product y = T[k]' x, where T[k] is
 70:    the k-th matrix of the spectral transformation.

 72:    Collective on ST

 74:    Input Parameters:
 75: +  st - the spectral transformation context
 76: .  k  - index of matrix to use
 77: -  x  - the vector to be multiplied

 79:    Output Parameter:
 80: .  y - the result

 82:    Level: developer

 84: .seealso: STMatMult()
 85: @*/
 86: PetscErrorCode STMatMultTranspose(ST st,PetscInt k,Vec x,Vec y)
 87: {

 91:   if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat);
 92:   if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors");

 94:   if (!st->setupcalled) { STSetUp(st); }
 95:   if (!st->T[k]) {
 96:     /* T[k]=NULL means identity matrix */
 97:     VecCopy(x,y);
 98:   } else {
 99:     MatMultTranspose(st->T[k],x,y);
100:   }
101:   return(0);
102: }

106: /*@
107:    STMatSolve - Solves T[k] x = b, where T[k] is the k-th matrix of
108:    the spectral transformation, using a KSP object stored internally.

110:    Collective on ST

112:    Input Parameters:
113: +  st - the spectral transformation context
114: .  k  - index of matrix to use
115: -  b  - right hand side vector

117:    Output Parameter:
118: .  x - computed solution

120:    Level: developer

122: .seealso: STMatSolveTranspose()
123: @*/
124: PetscErrorCode STMatSolve(ST st,PetscInt k,Vec b,Vec x)
125: {
126:   PetscErrorCode     ierr;
127:   PetscInt           its;
128:   PetscBool          flg;
129:   KSPConvergedReason reason;

132:   if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat);
133:   if (x == b) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and b must be different vectors");

135:   if (!st->setupcalled) { STSetUp(st); }
136:   PetscObjectTypeCompareAny((PetscObject)st,&flg,STFOLD,STPRECOND,STSHELL,"");
137:   if (!flg && !st->T[k]) {
138:     /* T[k]=NULL means identity matrix */
139:     VecCopy(b,x);
140:     return(0);
141:   }
142:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
143:   if (!flg && k!=st->kspidx) {
144:     /* change of coefficient matrix; should not happen normally */
145:     KSPSetOperators(st->ksp,st->T[k],st->T[k],DIFFERENT_NONZERO_PATTERN);
146:     KSPSetUp(st->ksp);
147:     st->kspidx = k;
148:   }
149:   KSPSolve(st->ksp,b,x);
150:   KSPGetConvergedReason(st->ksp,&reason);
151:   if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]);
152:   KSPGetIterationNumber(st->ksp,&its);
153:   st->lineariterations += its;
154:   PetscInfo1(st,"Linear solve iterations=%D\n",its);
155:   return(0);
156: }

160: /*@
161:    STMatSolveTranspose - Solves T[k]' x = b, where T[k] is the k-th matrix of
162:    the spectral transformation, using a KSP object stored internally.

164:    Collective on ST

166:    Input Parameters:
167: .  st - the spectral transformation context
168: .  b  - right hand side vector

170:    Output Parameter:
171: .  x - computed solution

173:    Level: developer

175: .seealso: STMatSolve()
176: @*/
177: PetscErrorCode STMatSolveTranspose(ST st,PetscInt k,Vec b,Vec x)
178: {
179:   PetscErrorCode     ierr;
180:   PetscInt           its;
181:   PetscBool          flg;
182:   KSPConvergedReason reason;

185:   if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat);
186:   PetscObjectTypeCompareAny((PetscObject)st,&flg,STFOLD,STPRECOND,STSHELL,"");
187:   if (x == b) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and b must be different vectors");

189:   if (!st->setupcalled) { STSetUp(st); }
190:   if (!flg && !st->T[k]) {
191:     /* T[k]=NULL means identity matrix */
192:     VecCopy(b,x);
193:     return(0);
194:   }
195:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
196:   if (!flg && k!=st->kspidx) {
197:     /* change of coefficient matrix; should not happen normally */
198:     KSPSetOperators(st->ksp,st->T[k],st->T[k],DIFFERENT_NONZERO_PATTERN);
199:     KSPSetUp(st->ksp);
200:     st->kspidx = k;
201:   }
202:   KSPSolveTranspose(st->ksp,b,x);
203:   KSPGetConvergedReason(st->ksp,&reason);
204:   if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]);
205:   KSPGetIterationNumber(st->ksp,&its);
206:   st->lineariterations += its;
207:   PetscInfo1(st,"Linear solve iterations=%D\n",its);
208:   return(0);
209: }

213: /*
214:    STMatSetHermitian - Sets the Hermitian flag to the ST matrix.

216:    Input Parameters:
217: .  st - the spectral transformation context
218: .  M  - matrix
219: */
220: PetscErrorCode STMatSetHermitian(ST st,Mat M)
221: {
222: #if defined(PETSC_USE_COMPLEX)
224:   PetscBool      set,aherm,mherm;
225:   PetscInt       i;
226: #endif

229: #if defined(PETSC_USE_COMPLEX)
230:   mherm = PETSC_FALSE;
231:   for (i=0;i<st->nmat;i++) {
232:     MatIsHermitianKnown(st->A[i],&set,&aherm);
233:     if (!set) aherm = PETSC_FALSE;
234:     mherm = (mherm && aherm)? PETSC_TRUE: PETSC_FALSE;
235:     if (PetscRealPart(st->sigma)==0.0) break;
236:   }
237:   mherm = (mherm && PetscImaginaryPart(st->sigma)==0.0)? PETSC_TRUE: PETSC_FALSE;
238:   MatSetOption(M,MAT_HERMITIAN,mherm);
239: #endif
240:   return(0);
241: }

245: /*@
246:    STSetKSP - Sets the KSP object associated with the spectral
247:    transformation.

249:    Collective on ST

251:    Input Parameters:
252: +  st   - the spectral transformation context
253: -  ksp  - the linear system context

255:    Level: advanced

257: @*/
258: PetscErrorCode STSetKSP(ST st,KSP ksp)
259: {

266:   PetscObjectReference((PetscObject)ksp);
267:   KSPDestroy(&st->ksp);
268:   st->ksp = ksp;
269:   PetscLogObjectParent(st,st->ksp);
270:   return(0);
271: }

275: /*@
276:    STGetKSP - Gets the KSP object associated with the spectral
277:    transformation.

279:    Not Collective

281:    Input Parameter:
282: .  st - the spectral transformation context

284:    Output Parameter:
285: .  ksp  - the linear system context

287:    Notes:
288:    On output, the value of ksp can be NULL if the combination of
289:    eigenproblem type and selected transformation does not require to
290:    solve a linear system of equations.

292:    Level: intermediate

294: @*/
295: PetscErrorCode STGetKSP(ST st,KSP* ksp)
296: {

302:   if (!st->ksp) {
303:     KSPCreate(PetscObjectComm((PetscObject)st),&st->ksp);
304:     KSPSetOptionsPrefix(st->ksp,((PetscObject)st)->prefix);
305:     KSPAppendOptionsPrefix(st->ksp,"st_");
306:     PetscObjectIncrementTabLevel((PetscObject)st->ksp,(PetscObject)st,1);
307:     PetscLogObjectParent(st,st->ksp);
308:     KSPSetTolerances(st->ksp,SLEPC_DEFAULT_TOL,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);
309:   }
310:   *ksp = st->ksp;
311:   return(0);
312: }

316: /*@
317:    STGetOperationCounters - Gets the total number of operator applications
318:    and linear solver iterations used by the ST object.

320:    Not Collective

322:    Input Parameter:
323: .  st - the spectral transformation context

325:    Output Parameter:
326: +  ops  - number of operator applications
327: -  lits - number of linear solver iterations

329:    Notes:
330:    Any output parameter may be NULL on input if not needed.

332:    Level: intermediate

334: .seealso: STResetOperationCounters()
335: @*/
336: PetscErrorCode STGetOperationCounters(ST st,PetscInt* ops,PetscInt* lits)
337: {
340:   if (ops) *ops = st->applys;
341:   if (lits) *lits = st->lineariterations;
342:   return(0);
343: }

347: /*@
348:    STResetOperationCounters - Resets the counters for operator applications,
349:    inner product operations and total number of linear iterations used by
350:    the ST object.

352:    Logically Collective on ST

354:    Input Parameter:
355: .  st - the spectral transformation context

357:    Level: intermediate

359: .seealso: STGetOperationCounters()
360: @*/
361: PetscErrorCode STResetOperationCounters(ST st)
362: {
365:   st->lineariterations = 0;
366:   st->applys = 0;
367:   return(0);
368: }

372: PetscErrorCode STCheckNullSpace_Default(ST st,PetscInt n,const Vec V[])
373: {
375:   PetscInt       i,c;
376:   PetscReal      norm;
377:   Vec            *T,w;
378:   Mat            A;
379:   PC             pc;
380:   MatNullSpace   nullsp;

383:   PetscMalloc(n*sizeof(Vec),&T);
384:   if (!st->ksp) { STGetKSP(st,&st->ksp); }
385:   KSPGetPC(st->ksp,&pc);
386:   PCGetOperators(pc,&A,NULL,NULL);
387:   MatGetVecs(A,NULL,&w);
388:   c = 0;
389:   for (i=0;i<n;i++) {
390:     MatMult(A,V[i],w);
391:     VecNorm(w,NORM_2,&norm);
392:     if (norm < 1e-8) {
393:       PetscInfo2(st,"Vector %D norm=%g\n",i,(double)norm);
394:       T[c] = V[i];
395:       c++;
396:     }
397:   }
398:   VecDestroy(&w);
399:   if (c>0) {
400:     MatNullSpaceCreate(PetscObjectComm((PetscObject)st),PETSC_FALSE,c,T,&nullsp);
401:     KSPSetNullSpace(st->ksp,nullsp);
402:     MatNullSpaceDestroy(&nullsp);
403:   }
404:   PetscFree(T);
405:   return(0);
406: }

410: /*@
411:    STCheckNullSpace - Given a set of vectors, this function tests each of
412:    them to be a nullspace vector of the coefficient matrix of the associated
413:    KSP object. All these nullspace vectors are passed to the KSP object.

415:    Collective on ST

417:    Input Parameters:
418: +  st - the spectral transformation context
419: .  n  - number of vectors
420: -  V  - vectors to be checked

422:    Note:
423:    This function allows to handle singular pencils and to solve some problems
424:    in which the nullspace is important (see the users guide for details).

426:    Level: developer

428: .seealso: EPSSetDeflationSpace()
429: @*/
430: PetscErrorCode STCheckNullSpace(ST st,PetscInt n,const Vec V[])
431: {

437:   if (n>0 && st->ops->checknullspace) {
440:     (*st->ops->checknullspace)(st,n,V);
441:   }
442:   return(0);
443: }


slepc-3.4.2.dfsg.orig/src/st/interface/stfunc.c0000644000175000017500000004745712211062077020277 0ustar gladkgladk/* The ST (spectral transformation) interface routines, callable by users. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ PetscClassId ST_CLASSID = 0; PetscLogEvent ST_SetUp = 0,ST_Apply = 0,ST_ApplyTranspose = 0; static PetscBool STPackageInitialized = PETSC_FALSE; #undef __FUNCT__ #define __FUNCT__ "STFinalizePackage" /*@C STFinalizePackage - This function destroys everything in the Slepc interface to the ST package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode STFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&STList);CHKERRQ(ierr); STPackageInitialized = PETSC_FALSE; STRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STInitializePackage" /*@C STInitializePackage - This function initializes everything in the ST package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to STCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode STInitializePackage(void) { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (STPackageInitialized) PetscFunctionReturn(0); STPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Spectral Transform",&ST_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = STRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("STSetUp",ST_CLASSID,&ST_SetUp);CHKERRQ(ierr); ierr = PetscLogEventRegister("STApply",ST_CLASSID,&ST_Apply);CHKERRQ(ierr); ierr = PetscLogEventRegister("STApplyTranspose",ST_CLASSID,&ST_ApplyTranspose);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"st",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(ST_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"st",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(ST_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(STFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STReset" /*@ STReset - Resets the ST context and removes any allocated objects. Collective on ST Input Parameter: . st - the spectral transformation context Level: advanced .seealso: STDestroy() @*/ PetscErrorCode STReset(ST st) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (st->ops->reset) { ierr = (*st->ops->reset)(st);CHKERRQ(ierr); } if (st->ksp) { ierr = KSPReset(st->ksp);CHKERRQ(ierr); } ierr = MatDestroyMatrices(PetscMax(2,st->nmat),&st->T);CHKERRQ(ierr); ierr = VecDestroy(&st->w);CHKERRQ(ierr); ierr = VecDestroy(&st->wb);CHKERRQ(ierr); ierr = STResetOperationCounters(st);CHKERRQ(ierr); st->kspidx = -1; st->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STDestroy" /*@C STDestroy - Destroys ST context that was created with STCreate(). Collective on ST Input Parameter: . st - the spectral transformation context Level: beginner .seealso: STCreate(), STSetUp() @*/ PetscErrorCode STDestroy(ST *st) { PetscErrorCode ierr; PetscFunctionBegin; if (!*st) PetscFunctionReturn(0); PetscValidHeaderSpecific(*st,ST_CLASSID,1); if (--((PetscObject)(*st))->refct > 0) { *st = 0; PetscFunctionReturn(0); } ierr = STReset(*st);CHKERRQ(ierr); ierr = MatDestroyMatrices(PetscMax(2,(*st)->nmat),&(*st)->A);CHKERRQ(ierr); ierr = PetscFree((*st)->Astate);CHKERRQ(ierr); if ((*st)->ops->destroy) { ierr = (*(*st)->ops->destroy)(*st);CHKERRQ(ierr); } ierr = VecDestroy(&(*st)->D);CHKERRQ(ierr); ierr = KSPDestroy(&(*st)->ksp);CHKERRQ(ierr); ierr = PetscHeaderDestroy(st);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCreate" /*@C STCreate - Creates a spectral transformation context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . st - location to put the spectral transformation context Level: beginner .seealso: STSetUp(), STApply(), STDestroy(), ST @*/ PetscErrorCode STCreate(MPI_Comm comm,ST *newst) { PetscErrorCode ierr; ST st; PetscFunctionBegin; PetscValidPointer(newst,2); *newst = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = STInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(st,_p_ST,struct _STOps,ST_CLASSID,"ST","Spectral Transformation","ST",comm,STDestroy,STView);CHKERRQ(ierr); st->A = 0; st->Astate = 0; st->T = 0; st->nmat = 0; st->sigma = 0.0; st->sigma_set = PETSC_FALSE; st->defsigma = 0.0; st->data = 0; st->setupcalled = 0; st->ksp = 0; st->kspidx = -1; st->w = 0; st->D = 0; st->wb = 0; st->shift_matrix = ST_MATMODE_COPY; st->str = DIFFERENT_NONZERO_PATTERN; *newst = st; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetOperators" /*@ STSetOperators - Sets the matrices associated with the eigenvalue problem. Collective on ST and Mat Input Parameters: + st - the spectral transformation context . n - number of matrices in array A - A - the array of matrices associated with the eigensystem Notes: It must be called before STSetUp(). If it is called again after STSetUp() then the ST object is reset. Level: intermediate .seealso: STGetOperators(), STGetNumMatrices(), STSetUp(), STReset() @*/ PetscErrorCode STSetOperators(ST st,PetscInt n,Mat A[]) { PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveInt(st,n,2); if (n <= 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Must have one or more matrices, you have %D",n); PetscValidPointer(A,3); PetscCheckSameComm(st,1,*A,3); if (st->setupcalled) { ierr = STReset(st);CHKERRQ(ierr); } ierr = MatDestroyMatrices(PetscMax(2,st->nmat),&st->A);CHKERRQ(ierr); ierr = PetscMalloc(PetscMax(2,n)*sizeof(Mat),&st->A);CHKERRQ(ierr); ierr = PetscLogObjectMemory(st,PetscMax(2,n)*sizeof(Mat));CHKERRQ(ierr); ierr = PetscFree(st->Astate);CHKERRQ(ierr); ierr = PetscMalloc(PetscMax(2,n)*sizeof(PetscInt),&st->Astate);CHKERRQ(ierr); ierr = PetscLogObjectMemory(st,PetscMax(2,n)*sizeof(PetscInt));CHKERRQ(ierr); for (i=0;iA[i] = A[i]; st->Astate[i] = ((PetscObject)A[i])->state; } if (n==1) { st->A[1] = NULL; st->Astate[1] = 0; } st->nmat = n; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetOperators" /*@ STGetOperators - Gets the matrices associated with the original eigensystem. Not collective, though parallel Mats are returned if the ST is parallel Input Parameter: + st - the spectral transformation context - k - the index of the requested matrix (starting in 0) Output Parameters: . A - the requested matrix Level: intermediate .seealso: STSetOperators(), STGetNumMatrices() @*/ PetscErrorCode STGetOperators(ST st,PetscInt k,Mat *A) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(A,3); if (k<0 || k>=st->nmat) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat-1); if (((PetscObject)st->A[k])->state!=st->Astate[k]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot retrieve original matrices (have been modified)"); *A = st->A[k]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetNumMatrices" /*@ STGetNumMatrices - Returns the number of matrices stored in the ST. Not collective Input Parameter: . st - the spectral transformation context Output Parameters: . n - the number of matrices passed in STSetOperators() Level: intermediate .seealso: STSetOperators() @*/ PetscErrorCode STGetNumMatrices(ST st,PetscInt *n) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(n,2); *n = st->nmat; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetShift" /*@ STSetShift - Sets the shift associated with the spectral transformation. Logically Collective on ST Input Parameters: + st - the spectral transformation context - shift - the value of the shift Note: In some spectral transformations, changing the shift may have associated a lot of work, for example recomputing a factorization. Level: beginner @*/ PetscErrorCode STSetShift(ST st,PetscScalar shift) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveScalar(st,shift,2); if (st->sigma != shift) { if (st->ops->setshift) { ierr = (*st->ops->setshift)(st,shift);CHKERRQ(ierr); } } st->sigma = shift; st->sigma_set = PETSC_TRUE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetShift" /*@ STGetShift - Gets the shift associated with the spectral transformation. Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: . shift - the value of the shift Level: beginner @*/ PetscErrorCode STGetShift(ST st,PetscScalar* shift) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidScalarPointer(shift,2); *shift = st->sigma; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetDefaultShift" /*@ STSetDefaultShift - Sets the value of the shift that should be employed if the user did not specify one. Logically Collective on ST Input Parameters: + st - the spectral transformation context - defaultshift - the default value of the shift Level: developer @*/ PetscErrorCode STSetDefaultShift(ST st,PetscScalar defaultshift) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveScalar(st,defaultshift,2); st->defsigma = defaultshift; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetBalanceMatrix" /*@ STSetBalanceMatrix - Sets the diagonal matrix to be used for balancing. Collective on ST and Vec Input Parameters: + st - the spectral transformation context - D - the diagonal matrix (represented as a vector) Notes: If this matrix is set, STApply will effectively apply D*OP*D^{-1}. Balancing is usually set via EPSSetBalance, but the advanced user may use this function to bypass the usual balancing methods. Level: developer .seealso: EPSSetBalance(), STApply(), STGetBalanceMatrix() @*/ PetscErrorCode STSetBalanceMatrix(ST st,Vec D) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidHeaderSpecific(D,VEC_CLASSID,2); PetscCheckSameComm(st,1,D,2); ierr = PetscObjectReference((PetscObject)D);CHKERRQ(ierr); ierr = VecDestroy(&st->D);CHKERRQ(ierr); st->D = D; st->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetBalanceMatrix" /*@ STGetBalanceMatrix - Gets the balance matrix used by the spectral transformation. Not collective, but vector is shared by all processors that share the ST Input Parameter: . st - the spectral transformation context Output Parameter: . D - the diagonal matrix (represented as a vector) Note: If the matrix was not set, a null pointer will be returned. Level: developer .seealso: STSetBalanceMatrix() @*/ PetscErrorCode STGetBalanceMatrix(ST st,Vec *D) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(D,2); *D = st->D; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetOptionsPrefix" /*@C STSetOptionsPrefix - Sets the prefix used for searching for all ST options in the database. Logically Collective on ST Input Parameters: + st - the spectral transformation context - prefix - the prefix string to prepend to all ST option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: STAppendOptionsPrefix(), STGetOptionsPrefix() @*/ PetscErrorCode STSetOptionsPrefix(ST st,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetOptionsPrefix(st->ksp,prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(st->ksp,"st_");CHKERRQ(ierr); ierr = PetscObjectSetOptionsPrefix((PetscObject)st,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STAppendOptionsPrefix" /*@C STAppendOptionsPrefix - Appends to the prefix used for searching for all ST options in the database. Logically Collective on ST Input Parameters: + st - the spectral transformation context - prefix - the prefix string to prepend to all ST option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: STSetOptionsPrefix(), STGetOptionsPrefix() @*/ PetscErrorCode STAppendOptionsPrefix(ST st,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); ierr = PetscObjectAppendOptionsPrefix((PetscObject)st,prefix);CHKERRQ(ierr); if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetOptionsPrefix(st->ksp,((PetscObject)st)->prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(st->ksp,"st_");CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetOptionsPrefix" /*@C STGetOptionsPrefix - Gets the prefix used for searching for all ST options in the database. Not Collective Input Parameters: . st - the spectral transformation context Output Parameters: . prefix - pointer to the prefix string used, is returned Notes: On the Fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: STSetOptionsPrefix(), STAppendOptionsPrefix() @*/ PetscErrorCode STGetOptionsPrefix(ST st,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)st,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STView" /*@C STView - Prints the ST data structure. Collective on ST Input Parameters: + st - the ST context - viewer - optional visualization context Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization contexts with PetscViewerASCIIOpen() (output to a specified file). Level: beginner .seealso: EPSView(), PetscViewerASCIIOpen() @*/ PetscErrorCode STView(ST st,PetscViewer viewer) { PetscErrorCode ierr; STType cstr; const char* pat; char str[50]; PetscBool isascii,isstring,flg; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)st)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(st,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);CHKERRQ(ierr); if (isascii) { ierr = PetscObjectPrintClassNamePrefixType((PetscObject)st,viewer,"ST Object");CHKERRQ(ierr); if (st->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*st->ops->view)(st,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } ierr = SlepcSNPrintfScalar(str,50,st->sigma,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," shift: %s\n",str);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer," number of matrices: %D\n",st->nmat);CHKERRQ(ierr); switch (st->shift_matrix) { case ST_MATMODE_COPY: break; case ST_MATMODE_INPLACE: ierr = PetscViewerASCIIPrintf(viewer," shifting the matrix and unshifting at exit\n");CHKERRQ(ierr); break; case ST_MATMODE_SHELL: ierr = PetscViewerASCIIPrintf(viewer," using a shell matrix\n");CHKERRQ(ierr); break; } if (st->nmat>1 && st->shift_matrix != ST_MATMODE_SHELL) { switch (st->str) { case SAME_NONZERO_PATTERN: pat = "same nonzero pattern";break; case DIFFERENT_NONZERO_PATTERN: pat = "different nonzero pattern";break; case SUBSET_NONZERO_PATTERN: pat = "subset nonzero pattern";break; default: SETERRQ(PetscObjectComm((PetscObject)st),1,"Wrong structure flag"); } ierr = PetscViewerASCIIPrintf(viewer," all matrices have %s\n",pat);CHKERRQ(ierr); } } else if (isstring) { ierr = STGetType(st,&cstr);CHKERRQ(ierr); ierr = PetscViewerStringSPrintf(viewer," %-7.7s",cstr);CHKERRQ(ierr); if (st->ops->view) { ierr = (*st->ops->view)(st,viewer);CHKERRQ(ierr); } } ierr = PetscObjectTypeCompareAny((PetscObject)st,&flg,STSHIFT,STFOLD,"");CHKERRQ(ierr); if (st->nmat>1 || !flg) { if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = KSPView(st->ksp,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STRegister" /*@C STRegister - Adds a method to the spectral transformation package. Not collective Input Parameters: + name - name of a new user-defined transformation - function - routine to create method context Notes: STRegister() may be called multiple times to add several user-defined spectral transformations. Sample usage: .vb STRegister("my_solver",MySolverCreate); .ve Then, your solver can be chosen with the procedural interface via $ STSetType(st,"my_solver") or at runtime via the option $ -st_type my_solver Level: advanced .seealso: STRegisterAll() @*/ PetscErrorCode STRegister(const char *name,PetscErrorCode (*function)(ST)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&STList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/interface/ftn-custom/0000755000175000017500000000000012214143515020707 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/interface/ftn-custom/zstf.c0000644000175000017500000000717012211062077022046 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define stsettype_ STSETTYPE #define stgettype_ STGETTYPE #define stcreate_ STCREATE #define stdestroy_ STDESTROY #define stsetoptionsprefix_ STSETOPTIONSPREFIX #define stappendoptionsprefix_ STAPPENDOPTIONSPREFIX #define stgetoptionsprefix_ STGETOPTIONSPREFIX #define stview_ STVIEW #define stgetmatmode_ STGETMATMODE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define stsettype_ stsettype #define stgettype_ stgettype #define stcreate_ stcreate #define stdestroy_ stdestroy #define stsetoptionsprefix_ stsetoptionsprefix #define stappendoptionsprefix_ stappendoptionsprefix #define stgetoptionsprefix_ stgetoptionsprefix #define stview_ stview #define stgetmatmode_ stgetmatmode #endif PETSC_EXTERN void PETSC_STDCALL stsettype_(ST *st,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(type,len,t); *ierr = STSetType(*st,t); FREECHAR(type,t); } PETSC_EXTERN void PETSC_STDCALL stgettype_(ST *st,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { STType tname; *ierr = STGetType(*st,&tname); if (*ierr) return; *ierr = PetscStrncpy(name,tname,len); FIXRETURNCHAR(PETSC_TRUE,name,len); } PETSC_EXTERN void PETSC_STDCALL stcreate_(MPI_Fint *comm,ST *newst,PetscErrorCode *ierr) { *ierr = STCreate(MPI_Comm_f2c(*(comm)),newst); } PETSC_EXTERN void PETSC_STDCALL stdestroy_(ST *st,PetscErrorCode *ierr) { *ierr = STDestroy(st); } PETSC_EXTERN void PETSC_STDCALL stsetoptionsprefix_(ST *st,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = STSetOptionsPrefix(*st,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL stappendoptionsprefix_(ST *st,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = STAppendOptionsPrefix(*st,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL stgetoptionsprefix_(ST *st,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = STGetOptionsPrefix(*st,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL stview_(ST *st,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = STView(*st,v); } PETSC_EXTERN void PETSC_STDCALL stgetmatmode_(ST *st,STMatMode *mode,PetscErrorCode *ierr) { *ierr = STGetMatMode(*st,mode); } slepc-3.4.2.dfsg.orig/src/st/interface/ftn-custom/makefile0000644000175000017500000000217212211062077022411 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zstf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/st/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/interface/stsles.c0000644000175000017500000003223512211062077020276 0ustar gladkgladk/* The ST (spectral transformation) interface routines related to the KSP object associated to it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "STMatMult" /*@ STMatMult - Computes the matrix-vector product y = T[k] x, where T[k] is the k-th matrix of the spectral transformation. Collective on ST Input Parameters: + st - the spectral transformation context . k - index of matrix to use - x - the vector to be multiplied Output Parameter: . y - the result Level: developer .seealso: STMatMultTranspose() @*/ PetscErrorCode STMatMult(ST st,PetscInt k,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat); if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors"); if (!st->setupcalled) { ierr = STSetUp(st);CHKERRQ(ierr); } if (!st->T[k]) { /* T[k]=NULL means identity matrix */ ierr = VecCopy(x,y);CHKERRQ(ierr); } else { ierr = MatMult(st->T[k],x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STMatMultTranspose" /*@ STMatMultTranspose - Computes the matrix-vector product y = T[k]' x, where T[k] is the k-th matrix of the spectral transformation. Collective on ST Input Parameters: + st - the spectral transformation context . k - index of matrix to use - x - the vector to be multiplied Output Parameter: . y - the result Level: developer .seealso: STMatMult() @*/ PetscErrorCode STMatMultTranspose(ST st,PetscInt k,Vec x,Vec y) { PetscErrorCode ierr; PetscFunctionBegin; if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat); if (x == y) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and y must be different vectors"); if (!st->setupcalled) { ierr = STSetUp(st);CHKERRQ(ierr); } if (!st->T[k]) { /* T[k]=NULL means identity matrix */ ierr = VecCopy(x,y);CHKERRQ(ierr); } else { ierr = MatMultTranspose(st->T[k],x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STMatSolve" /*@ STMatSolve - Solves T[k] x = b, where T[k] is the k-th matrix of the spectral transformation, using a KSP object stored internally. Collective on ST Input Parameters: + st - the spectral transformation context . k - index of matrix to use - b - right hand side vector Output Parameter: . x - computed solution Level: developer .seealso: STMatSolveTranspose() @*/ PetscErrorCode STMatSolve(ST st,PetscInt k,Vec b,Vec x) { PetscErrorCode ierr; PetscInt its; PetscBool flg; KSPConvergedReason reason; PetscFunctionBegin; if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat); if (x == b) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and b must be different vectors"); if (!st->setupcalled) { ierr = STSetUp(st);CHKERRQ(ierr); } ierr = PetscObjectTypeCompareAny((PetscObject)st,&flg,STFOLD,STPRECOND,STSHELL,"");CHKERRQ(ierr); if (!flg && !st->T[k]) { /* T[k]=NULL means identity matrix */ ierr = VecCopy(b,x);CHKERRQ(ierr); PetscFunctionReturn(0); } if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } if (!flg && k!=st->kspidx) { /* change of coefficient matrix; should not happen normally */ ierr = KSPSetOperators(st->ksp,st->T[k],st->T[k],DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); st->kspidx = k; } ierr = KSPSolve(st->ksp,b,x);CHKERRQ(ierr); ierr = KSPGetConvergedReason(st->ksp,&reason);CHKERRQ(ierr); if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]); ierr = KSPGetIterationNumber(st->ksp,&its);CHKERRQ(ierr); st->lineariterations += its; ierr = PetscInfo1(st,"Linear solve iterations=%D\n",its);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STMatSolveTranspose" /*@ STMatSolveTranspose - Solves T[k]' x = b, where T[k] is the k-th matrix of the spectral transformation, using a KSP object stored internally. Collective on ST Input Parameters: . st - the spectral transformation context . b - right hand side vector Output Parameter: . x - computed solution Level: developer .seealso: STMatSolve() @*/ PetscErrorCode STMatSolveTranspose(ST st,PetscInt k,Vec b,Vec x) { PetscErrorCode ierr; PetscInt its; PetscBool flg; KSPConvergedReason reason; PetscFunctionBegin; if (k<0 || k>=PetscMax(2,st->nmat)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",st->nmat); ierr = PetscObjectTypeCompareAny((PetscObject)st,&flg,STFOLD,STPRECOND,STSHELL,"");CHKERRQ(ierr); if (x == b) SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_IDN,"x and b must be different vectors"); if (!st->setupcalled) { ierr = STSetUp(st);CHKERRQ(ierr); } if (!flg && !st->T[k]) { /* T[k]=NULL means identity matrix */ ierr = VecCopy(b,x);CHKERRQ(ierr); PetscFunctionReturn(0); } if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } if (!flg && k!=st->kspidx) { /* change of coefficient matrix; should not happen normally */ ierr = KSPSetOperators(st->ksp,st->T[k],st->T[k],DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); ierr = KSPSetUp(st->ksp);CHKERRQ(ierr); st->kspidx = k; } ierr = KSPSolveTranspose(st->ksp,b,x);CHKERRQ(ierr); ierr = KSPGetConvergedReason(st->ksp,&reason);CHKERRQ(ierr); if (reason<0) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_NOT_CONVERGED,"KSP did not converge (reason=%s)",KSPConvergedReasons[reason]); ierr = KSPGetIterationNumber(st->ksp,&its);CHKERRQ(ierr); st->lineariterations += its; ierr = PetscInfo1(st,"Linear solve iterations=%D\n",its);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STMatSetHermitian" /* STMatSetHermitian - Sets the Hermitian flag to the ST matrix. Input Parameters: . st - the spectral transformation context . M - matrix */ PetscErrorCode STMatSetHermitian(ST st,Mat M) { #if defined(PETSC_USE_COMPLEX) PetscErrorCode ierr; PetscBool set,aherm,mherm; PetscInt i; #endif PetscFunctionBegin; #if defined(PETSC_USE_COMPLEX) mherm = PETSC_FALSE; for (i=0;inmat;i++) { ierr = MatIsHermitianKnown(st->A[i],&set,&aherm);CHKERRQ(ierr); if (!set) aherm = PETSC_FALSE; mherm = (mherm && aherm)? PETSC_TRUE: PETSC_FALSE; if (PetscRealPart(st->sigma)==0.0) break; } mherm = (mherm && PetscImaginaryPart(st->sigma)==0.0)? PETSC_TRUE: PETSC_FALSE; ierr = MatSetOption(M,MAT_HERMITIAN,mherm);CHKERRQ(ierr); #endif PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetKSP" /*@ STSetKSP - Sets the KSP object associated with the spectral transformation. Collective on ST Input Parameters: + st - the spectral transformation context - ksp - the linear system context Level: advanced @*/ PetscErrorCode STSetKSP(ST st,KSP ksp) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidHeaderSpecific(ksp,KSP_CLASSID,2); PetscCheckSameComm(st,1,ksp,2); ierr = PetscObjectReference((PetscObject)ksp);CHKERRQ(ierr); ierr = KSPDestroy(&st->ksp);CHKERRQ(ierr); st->ksp = ksp; ierr = PetscLogObjectParent(st,st->ksp);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetKSP" /*@ STGetKSP - Gets the KSP object associated with the spectral transformation. Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: . ksp - the linear system context Notes: On output, the value of ksp can be NULL if the combination of eigenproblem type and selected transformation does not require to solve a linear system of equations. Level: intermediate @*/ PetscErrorCode STGetKSP(ST st,KSP* ksp) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(ksp,2); if (!st->ksp) { ierr = KSPCreate(PetscObjectComm((PetscObject)st),&st->ksp);CHKERRQ(ierr); ierr = KSPSetOptionsPrefix(st->ksp,((PetscObject)st)->prefix);CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(st->ksp,"st_");CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)st->ksp,(PetscObject)st,1);CHKERRQ(ierr); ierr = PetscLogObjectParent(st,st->ksp);CHKERRQ(ierr); ierr = KSPSetTolerances(st->ksp,SLEPC_DEFAULT_TOL,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT);CHKERRQ(ierr); } *ksp = st->ksp; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetOperationCounters" /*@ STGetOperationCounters - Gets the total number of operator applications and linear solver iterations used by the ST object. Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: + ops - number of operator applications - lits - number of linear solver iterations Notes: Any output parameter may be NULL on input if not needed. Level: intermediate .seealso: STResetOperationCounters() @*/ PetscErrorCode STGetOperationCounters(ST st,PetscInt* ops,PetscInt* lits) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (ops) *ops = st->applys; if (lits) *lits = st->lineariterations; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STResetOperationCounters" /*@ STResetOperationCounters - Resets the counters for operator applications, inner product operations and total number of linear iterations used by the ST object. Logically Collective on ST Input Parameter: . st - the spectral transformation context Level: intermediate .seealso: STGetOperationCounters() @*/ PetscErrorCode STResetOperationCounters(ST st) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); st->lineariterations = 0; st->applys = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCheckNullSpace_Default" PetscErrorCode STCheckNullSpace_Default(ST st,PetscInt n,const Vec V[]) { PetscErrorCode ierr; PetscInt i,c; PetscReal norm; Vec *T,w; Mat A; PC pc; MatNullSpace nullsp; PetscFunctionBegin; ierr = PetscMalloc(n*sizeof(Vec),&T);CHKERRQ(ierr); if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPGetPC(st->ksp,&pc);CHKERRQ(ierr); ierr = PCGetOperators(pc,&A,NULL,NULL);CHKERRQ(ierr); ierr = MatGetVecs(A,NULL,&w);CHKERRQ(ierr); c = 0; for (i=0;i0) { ierr = MatNullSpaceCreate(PetscObjectComm((PetscObject)st),PETSC_FALSE,c,T,&nullsp);CHKERRQ(ierr); ierr = KSPSetNullSpace(st->ksp,nullsp);CHKERRQ(ierr); ierr = MatNullSpaceDestroy(&nullsp);CHKERRQ(ierr); } ierr = PetscFree(T);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STCheckNullSpace" /*@ STCheckNullSpace - Given a set of vectors, this function tests each of them to be a nullspace vector of the coefficient matrix of the associated KSP object. All these nullspace vectors are passed to the KSP object. Collective on ST Input Parameters: + st - the spectral transformation context . n - number of vectors - V - vectors to be checked Note: This function allows to handle singular pencils and to solve some problems in which the nullspace is important (see the users guide for details). Level: developer .seealso: EPSSetDeflationSpace() @*/ PetscErrorCode STCheckNullSpace(ST st,PetscInt n,const Vec V[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveInt(st,n,2); if (n>0 && st->ops->checknullspace) { PetscValidPointer(V,3); PetscValidHeaderSpecific(V[0],VEC_CLASSID,3); ierr = (*st->ops->checknullspace)(st,n,V);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/interface/shellmat.c0000644000175000017500000001416512211062077020574 0ustar gladkgladk/* This file contains the subroutines which implement various operations of the matrix associated to the shift-and-invert technique for eigenvalue problems, and also a subroutine to create it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include typedef struct { PetscScalar alpha; ST st; Vec z; PetscInt nmat; PetscInt *matIdx; } ST_SHELLMAT; #undef __FUNCT__ #define __FUNCT__ "STMatShellShift" PetscErrorCode STMatShellShift(Mat A,PetscScalar alpha) { PetscErrorCode ierr; ST_SHELLMAT *ctx; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ctx->alpha = alpha; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMult_Shell" static PetscErrorCode MatMult_Shell(Mat A,Vec x,Vec y) { PetscErrorCode ierr; ST_SHELLMAT *ctx; ST st; PetscInt i; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); st = ctx->st; if (ctx->alpha != 0.0) { ierr = MatMult(st->A[ctx->matIdx[ctx->nmat-1]],x,y);CHKERRQ(ierr); if (ctx->nmat>1) { /* */ for (i=ctx->nmat-2;i>=0;i--) { ierr = MatMult(st->A[ctx->matIdx[i]],x,ctx->z);CHKERRQ(ierr); ierr = VecAYPX(y,ctx->alpha,ctx->z);CHKERRQ(ierr); } } else { /* y = (A + alpha*I) x */ ierr = VecAXPY(y,ctx->alpha,x);CHKERRQ(ierr); } } else { ierr = MatMult(st->A[ctx->matIdx[0]],x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatMultTranspose_Shell" static PetscErrorCode MatMultTranspose_Shell(Mat A,Vec x,Vec y) { PetscErrorCode ierr; ST_SHELLMAT *ctx; ST st; PetscInt i; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); st = ctx->st; if (ctx->alpha != 0.0) { ierr = MatMultTranspose(st->A[ctx->matIdx[ctx->nmat-1]],x,y);CHKERRQ(ierr); if (st->nmat>1) { /* y = (A + alpha*B) x */ for (i=ctx->nmat-2;i>=0;i--) { ierr = MatMultTranspose(st->A[ctx->matIdx[i]],x,y);CHKERRQ(ierr); ierr = VecAYPX(y,ctx->alpha,ctx->z);CHKERRQ(ierr); } } else { /* y = (A + alpha*I) x */ ierr = VecAXPY(y,ctx->alpha,x);CHKERRQ(ierr); } } else { ierr = MatMultTranspose(st->A[ctx->matIdx[0]],x,y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatGetDiagonal_Shell" static PetscErrorCode MatGetDiagonal_Shell(Mat A,Vec diag) { PetscErrorCode ierr; ST_SHELLMAT *ctx; ST st; Vec diagb; PetscInt i; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); st = ctx->st; if (ctx->alpha != 0.0) { ierr = MatGetDiagonal(st->A[ctx->matIdx[ctx->nmat-1]],diag);CHKERRQ(ierr); if (st->nmat>1) { ierr = VecDuplicate(diag,&diagb);CHKERRQ(ierr); for (i=ctx->nmat-2;i>=0;i--) { ierr = MatGetDiagonal(st->A[ctx->matIdx[i]],diagb);CHKERRQ(ierr); ierr = VecAYPX(diag,ctx->alpha,diagb);CHKERRQ(ierr); } ierr = VecDestroy(&diagb);CHKERRQ(ierr); } else { ierr = VecShift(diag,ctx->alpha);CHKERRQ(ierr); } } else { ierr = MatGetDiagonal(st->A[ctx->matIdx[0]],diag);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "MatDestroy_Shell" static PetscErrorCode MatDestroy_Shell(Mat A) { PetscErrorCode ierr; ST_SHELLMAT *ctx; PetscFunctionBegin; ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr); ierr = VecDestroy(&ctx->z);CHKERRQ(ierr); ierr = PetscFree(ctx->matIdx);CHKERRQ(ierr); ierr = PetscFree(ctx);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STMatShellCreate" PetscErrorCode STMatShellCreate(ST st,PetscScalar alpha,PetscInt nmat,PetscInt *matIdx,Mat *mat) { PetscErrorCode ierr; PetscInt n,m,N,M,i; PetscBool has=PETSC_FALSE,hasA,hasB; ST_SHELLMAT *ctx; PetscFunctionBegin; ierr = MatGetSize(st->A[0],&M,&N);CHKERRQ(ierr); ierr = MatGetLocalSize(st->A[0],&m,&n);CHKERRQ(ierr); ierr = PetscNew(ST_SHELLMAT,&ctx);CHKERRQ(ierr); ctx->st = st; ctx->alpha = alpha; ctx->nmat = matIdx?nmat:st->nmat; ierr = PetscMalloc(ctx->nmat*sizeof(PetscInt),&ctx->matIdx);CHKERRQ(ierr); if (matIdx) { for (i=0;inmat;i++) ctx->matIdx[i] = matIdx[i]; } else { ctx->matIdx[0] = 0; if (ctx->nmat>1) ctx->matIdx[1] = 1; } ierr = MatGetVecs(st->A[0],&ctx->z,NULL);CHKERRQ(ierr); ierr = MatCreateShell(PetscObjectComm((PetscObject)st),m,n,M,N,(void*)ctx,mat);CHKERRQ(ierr); ierr = MatShellSetOperation(*mat,MATOP_MULT,(void(*)(void))MatMult_Shell);CHKERRQ(ierr); ierr = MatShellSetOperation(*mat,MATOP_MULT_TRANSPOSE,(void(*)(void))MatMultTranspose_Shell);CHKERRQ(ierr); ierr = MatShellSetOperation(*mat,MATOP_DESTROY,(void(*)(void))MatDestroy_Shell);CHKERRQ(ierr); ierr = MatHasOperation(st->A[ctx->matIdx[0]],MATOP_GET_DIAGONAL,&hasA);CHKERRQ(ierr); if (st->nmat>1) { has = hasA; for (i=1;inmat;i++) { ierr = MatHasOperation(st->A[ctx->matIdx[i]],MATOP_GET_DIAGONAL,&hasB);CHKERRQ(ierr); has = (has && hasB)? PETSC_TRUE: PETSC_FALSE; } } if ((hasA && st->nmat==1) || has) { ierr = MatShellSetOperation(*mat,MATOP_GET_DIAGONAL,(void(*)(void))MatGetDiagonal_Shell);CHKERRQ(ierr); } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/interface/stset.c0000644000175000017500000002460412211062077020124 0ustar gladkgladk/* Routines to set ST methods and options. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ PetscBool STRegisterAllCalled = PETSC_FALSE; PetscFunctionList STList = 0; #undef __FUNCT__ #define __FUNCT__ "STSetType" /*@C STSetType - Builds ST for a particular spectral transformation. Logically Collective on ST Input Parameter: + st - the spectral transformation context. - type - a known type Options Database Key: . -st_type - Sets ST type Use -help for a list of available transformations Notes: See "slepc/include/slepcst.h" for available transformations Normally, it is best to use the EPSSetFromOptions() command and then set the ST type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the many different transformations. Level: intermediate .seealso: EPSSetType() @*/ PetscErrorCode STSetType(ST st,STType type) { PetscErrorCode ierr,(*r)(ST); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)st,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(STList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested ST type %s",type); if (st->ops->destroy) { ierr = (*st->ops->destroy)(st);CHKERRQ(ierr); } ierr = PetscMemzero(st->ops,sizeof(struct _STOps));CHKERRQ(ierr); st->setupcalled = 0; ierr = PetscObjectChangeTypeName((PetscObject)st,type);CHKERRQ(ierr); ierr = (*r)(st);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetType" /*@C STGetType - Gets the ST type name (as a string) from the ST context. Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: . name - name of the spectral transformation Level: intermediate .seealso: STSetType() @*/ PetscErrorCode STGetType(ST st,STType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)st)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetFromOptions" /*@ STSetFromOptions - Sets ST options from the options database. This routine must be called before STSetUp() if the user is to be allowed to set the type of transformation. Collective on ST Input Parameter: . st - the spectral transformation context Level: beginner @*/ PetscErrorCode STSetFromOptions(ST st) { PetscErrorCode ierr; PetscInt i; PetscScalar s; char type[256]; PetscBool flg; const char *mode_list[3] = {"copy","inplace","shell"}; const char *structure_list[3] = {"same","different","subset"}; PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); if (!STRegisterAllCalled) { ierr = STRegisterAll();CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)st);CHKERRQ(ierr); ierr = PetscOptionsList("-st_type","Spectral Transformation type","STSetType",STList,(char*)(((PetscObject)st)->type_name?((PetscObject)st)->type_name:STSHIFT),type,256,&flg);CHKERRQ(ierr); if (flg) { ierr = STSetType(st,type);CHKERRQ(ierr); } /* Set the type if it was never set. */ if (!((PetscObject)st)->type_name) { ierr = STSetType(st,STSHIFT);CHKERRQ(ierr); } ierr = PetscOptionsScalar("-st_shift","Value of the shift","STSetShift",st->sigma,&s,&flg);CHKERRQ(ierr); if (flg) { ierr = STSetShift(st,s);CHKERRQ(ierr); } ierr = PetscOptionsEList("-st_matmode","Shift matrix mode","STSetMatMode",mode_list,3,mode_list[st->shift_matrix],&i,&flg);CHKERRQ(ierr); if (flg) st->shift_matrix = (STMatMode)i; ierr = PetscOptionsEList("-st_matstructure","Shift nonzero pattern","STSetMatStructure",structure_list,3,structure_list[st->str],&i,&flg);CHKERRQ(ierr); if (flg) { switch (i) { case 0: ierr = STSetMatStructure(st,SAME_NONZERO_PATTERN);CHKERRQ(ierr); break; case 1: ierr = STSetMatStructure(st,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); break; case 2: ierr = STSetMatStructure(st,SUBSET_NONZERO_PATTERN);CHKERRQ(ierr); break; } } if (st->ops->setfromoptions) { ierr = (*st->ops->setfromoptions)(st);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)st);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); if (!st->ksp) { ierr = STGetKSP(st,&st->ksp);CHKERRQ(ierr); } ierr = KSPSetFromOptions(st->ksp);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetMatStructure" /*@ STSetMatStructure - Sets an internal MatStructure attribute to indicate which is the relation of the sparsity pattern of the two matrices A and B constituting the generalized eigenvalue problem. Logically Collective on ST Input Parameters: + st - the spectral transformation context - str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN or SUBSET_NONZERO_PATTERN Options Database Key: . -st_matstructure - Indicates the structure flag, where is one of 'same' (A and B have the same nonzero pattern), 'different' (A and B have different nonzero pattern) or 'subset' (B's nonzero pattern is a subset of A's). Notes: By default, the sparsity patterns are assumed to be different. If the patterns are equal or a subset then it is recommended to set this attribute for efficiency reasons (in particular, for internal MatAXPY() operations). This function has no effect in the case of standard eigenproblems. Level: advanced .seealso: STSetOperators(), MatAXPY() @*/ PetscErrorCode STSetMatStructure(ST st,MatStructure str) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveEnum(st,str,2); switch (str) { case SAME_NONZERO_PATTERN: case DIFFERENT_NONZERO_PATTERN: case SUBSET_NONZERO_PATTERN: st->str = str; break; default: SETERRQ(PetscObjectComm((PetscObject)st),PETSC_ERR_ARG_OUTOFRANGE,"Invalid matrix structure flag"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetMatStructure" /*@ STGetMatStructure - Gets the internal MatStructure attribute to indicate which is the relation of the sparsity pattern of the two matrices A and B constituting the generalized eigenvalue problem. Not Collective Input Parameters: . st - the spectral transformation context Output Parameters: . str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN or SUBSET_NONZERO_PATTERN Note: This function has no effect in the case of standard eigenproblems. Level: advanced .seealso: STSetMatStructure(), STSetOperators(), MatAXPY() @*/ PetscErrorCode STGetMatStructure(ST st,MatStructure *str) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(str,2); *str = st->str; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STSetMatMode" /*@ STSetMatMode - Sets a flag to indicate how the matrix is being shifted in the shift-and-invert and Cayley spectral transformations. Logically Collective on ST Input Parameters: + st - the spectral transformation context - mode - the mode flag, one of ST_MATMODE_COPY, ST_MATMODE_INPLACE or ST_MATMODE_SHELL Options Database Key: . -st_matmode - Indicates the mode flag, where is one of 'copy', 'inplace' or 'shell' (see explanation below). Notes: By default (ST_MATMODE_COPY), a copy of matrix A is made and then this copy is shifted explicitly, e.g. A <- (A - s B). With ST_MATMODE_INPLACE, the original matrix A is shifted at STSetUp() and unshifted at the end of the computations. With respect to the previous one, this mode avoids a copy of matrix A. However, a backdraw is that the recovered matrix might be slightly different from the original one (due to roundoff). With ST_MATMODE_SHELL, the solver works with an implicit shell matrix that represents the shifted matrix. This mode is the most efficient in creating the shifted matrix but it places serious limitations to the linear solves performed in each iteration of the eigensolver (typically, only interative solvers with Jacobi preconditioning can be used). In the case of generalized problems, in the two first modes the matrix A - s B has to be computed explicitly. The efficiency of this computation can be controlled with STSetMatStructure(). Level: intermediate .seealso: STSetOperators(), STSetMatStructure(), STGetMatMode(), STMatMode @*/ PetscErrorCode STSetMatMode(ST st,STMatMode mode) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidLogicalCollectiveEnum(st,mode,2); st->shift_matrix = mode; st->setupcalled = 0; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "STGetMatMode" /*@C STGetMatMode - Gets a flag that indicates how the matrix is being shifted in the shift-and-invert and Cayley spectral transformations. Not Collective Input Parameter: . st - the spectral transformation context Output Parameter: . mode - the mode flag Level: intermediate .seealso: STSetMatMode(), STMatMode @*/ PetscErrorCode STGetMatMode(ST st,STMatMode *mode) { PetscFunctionBegin; PetscValidHeaderSpecific(st,ST_CLASSID,1); PetscValidPointer(mode,2); *mode = st->shift_matrix; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/interface/stregis.c0000644000175000017500000000372212211062077020440 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcst.h" I*/ PETSC_EXTERN PetscErrorCode STCreate_Shell(ST); PETSC_EXTERN PetscErrorCode STCreate_Shift(ST); PETSC_EXTERN PetscErrorCode STCreate_Sinvert(ST); PETSC_EXTERN PetscErrorCode STCreate_Cayley(ST); PETSC_EXTERN PetscErrorCode STCreate_Fold(ST); PETSC_EXTERN PetscErrorCode STCreate_Precond(ST); #undef __FUNCT__ #define __FUNCT__ "STRegisterAll" /*@C STRegisterAll - Registers all of the spectral transformations in the ST package. Not Collective Level: advanced .seealso: STRegister() @*/ PetscErrorCode STRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; STRegisterAllCalled = PETSC_TRUE; ierr = STRegister(STSHELL,STCreate_Shell);CHKERRQ(ierr); ierr = STRegister(STSHIFT,STCreate_Shift);CHKERRQ(ierr); ierr = STRegister(STSINVERT,STCreate_Sinvert);CHKERRQ(ierr); ierr = STRegister(STCAYLEY,STCreate_Cayley);CHKERRQ(ierr); ierr = STRegister(STFOLD,STCreate_Fold);CHKERRQ(ierr); ierr = STRegister(STPRECOND,STCreate_Precond);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/st/interface/ftn-auto/0000755000175000017500000000000012214143515020345 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/st/interface/ftn-auto/stfuncf.c0000644000175000017500000000667112211062077022173 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* stfunc.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define streset_ STRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define streset_ streset #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetoperators_ STSETOPERATORS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetoperators_ stsetoperators #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetoperators_ STGETOPERATORS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetoperators_ stgetoperators #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetnummatrices_ STGETNUMMATRICES #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetnummatrices_ stgetnummatrices #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetshift_ STSETSHIFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetshift_ stsetshift #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetshift_ STGETSHIFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetshift_ stgetshift #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetdefaultshift_ STSETDEFAULTSHIFT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetdefaultshift_ stsetdefaultshift #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetbalancematrix_ STSETBALANCEMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetbalancematrix_ stsetbalancematrix #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetbalancematrix_ STGETBALANCEMATRIX #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetbalancematrix_ stgetbalancematrix #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL streset_(ST *st, int *__ierr ){ *__ierr = STReset(*st); } void PETSC_STDCALL stsetoperators_(ST *st,PetscInt *n,Mat A[], int *__ierr ){ *__ierr = STSetOperators(*st,*n,A); } void PETSC_STDCALL stgetoperators_(ST *st,PetscInt *k,Mat *A, int *__ierr ){ *__ierr = STGetOperators(*st,*k,A); } void PETSC_STDCALL stgetnummatrices_(ST *st,PetscInt *n, int *__ierr ){ *__ierr = STGetNumMatrices(*st,n); } void PETSC_STDCALL stsetshift_(ST *st,PetscScalar *shift, int *__ierr ){ *__ierr = STSetShift(*st,*shift); } void PETSC_STDCALL stgetshift_(ST *st,PetscScalar* shift, int *__ierr ){ *__ierr = STGetShift(*st,shift); } void PETSC_STDCALL stsetdefaultshift_(ST *st,PetscScalar *defaultshift, int *__ierr ){ *__ierr = STSetDefaultShift(*st,*defaultshift); } void PETSC_STDCALL stsetbalancematrix_(ST *st,Vec D, int *__ierr ){ *__ierr = STSetBalanceMatrix(*st, (Vec)PetscToPointer((D) )); } void PETSC_STDCALL stgetbalancematrix_(ST *st,Vec *D, int *__ierr ){ *__ierr = STGetBalanceMatrix(*st,D); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/interface/ftn-auto/stsetf.c0000644000175000017500000000366712211062077022035 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* stset.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetfromoptions_ STSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetfromoptions_ stsetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetmatstructure_ STSETMATSTRUCTURE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetmatstructure_ stsetmatstructure #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetmatstructure_ STGETMATSTRUCTURE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetmatstructure_ stgetmatstructure #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetmatmode_ STSETMATMODE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetmatmode_ stsetmatmode #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL stsetfromoptions_(ST *st, int *__ierr ){ *__ierr = STSetFromOptions(*st); } void PETSC_STDCALL stsetmatstructure_(ST *st,MatStructure *str, int *__ierr ){ *__ierr = STSetMatStructure(*st,*str); } void PETSC_STDCALL stgetmatstructure_(ST *st,MatStructure *str, int *__ierr ){ *__ierr = STGetMatStructure(*st,str); } void PETSC_STDCALL stsetmatmode_(ST *st,STMatMode *mode, int *__ierr ){ *__ierr = STSetMatMode(*st,*mode); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/interface/ftn-auto/makefile0000644000175000017500000000037612211062077022053 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = stfuncf.c stsetf.c stslesf.c stsolvef.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/st/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/st/interface/ftn-auto/stsolvef.c0000644000175000017500000000562612211062077022367 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* stsolve.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define stapply_ STAPPLY #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stapply_ stapply #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetbilinearform_ STGETBILINEARFORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetbilinearform_ stgetbilinearform #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stapplytranspose_ STAPPLYTRANSPOSE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stapplytranspose_ stapplytranspose #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stcomputeexplicitoperator_ STCOMPUTEEXPLICITOPERATOR #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stcomputeexplicitoperator_ stcomputeexplicitoperator #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetup_ STSETUP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetup_ stsetup #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stpostsolve_ STPOSTSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stpostsolve_ stpostsolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stbacktransform_ STBACKTRANSFORM #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stbacktransform_ stbacktransform #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL stapply_(ST *st,Vec x,Vec y, int *__ierr ){ *__ierr = STApply(*st, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) )); } void PETSC_STDCALL stgetbilinearform_(ST *st,Mat *B, int *__ierr ){ *__ierr = STGetBilinearForm(*st,B); } void PETSC_STDCALL stapplytranspose_(ST *st,Vec x,Vec y, int *__ierr ){ *__ierr = STApplyTranspose(*st, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) )); } void PETSC_STDCALL stcomputeexplicitoperator_(ST *st,Mat *mat, int *__ierr ){ *__ierr = STComputeExplicitOperator(*st,mat); } void PETSC_STDCALL stsetup_(ST *st, int *__ierr ){ *__ierr = STSetUp(*st); } void PETSC_STDCALL stpostsolve_(ST *st, int *__ierr ){ *__ierr = STPostSolve(*st); } void PETSC_STDCALL stbacktransform_(ST *st,PetscInt *n,PetscScalar* eigr,PetscScalar* eigi, int *__ierr ){ *__ierr = STBackTransform(*st,*n,eigr,eigi); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/interface/ftn-auto/stslesf.c0000644000175000017500000000735712211062077022210 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* stsles.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcst.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define stmatmult_ STMATMULT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stmatmult_ stmatmult #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stmatmulttranspose_ STMATMULTTRANSPOSE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stmatmulttranspose_ stmatmulttranspose #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stmatsolve_ STMATSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stmatsolve_ stmatsolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stmatsolvetranspose_ STMATSOLVETRANSPOSE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stmatsolvetranspose_ stmatsolvetranspose #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stsetksp_ STSETKSP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stsetksp_ stsetksp #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetksp_ STGETKSP #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetksp_ stgetksp #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stgetoperationcounters_ STGETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stgetoperationcounters_ stgetoperationcounters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stresetoperationcounters_ STRESETOPERATIONCOUNTERS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stresetoperationcounters_ stresetoperationcounters #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define stchecknullspace_ STCHECKNULLSPACE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define stchecknullspace_ stchecknullspace #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL stmatmult_(ST *st,PetscInt *k,Vec x,Vec y, int *__ierr ){ *__ierr = STMatMult(*st,*k, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) )); } void PETSC_STDCALL stmatmulttranspose_(ST *st,PetscInt *k,Vec x,Vec y, int *__ierr ){ *__ierr = STMatMultTranspose(*st,*k, (Vec)PetscToPointer((x) ), (Vec)PetscToPointer((y) )); } void PETSC_STDCALL stmatsolve_(ST *st,PetscInt *k,Vec b,Vec x, int *__ierr ){ *__ierr = STMatSolve(*st,*k, (Vec)PetscToPointer((b) ), (Vec)PetscToPointer((x) )); } void PETSC_STDCALL stmatsolvetranspose_(ST *st,PetscInt *k,Vec b,Vec x, int *__ierr ){ *__ierr = STMatSolveTranspose(*st,*k, (Vec)PetscToPointer((b) ), (Vec)PetscToPointer((x) )); } void PETSC_STDCALL stsetksp_(ST *st,KSP ksp, int *__ierr ){ *__ierr = STSetKSP(*st, (KSP)PetscToPointer((ksp) )); } void PETSC_STDCALL stgetksp_(ST *st,KSP* ksp, int *__ierr ){ *__ierr = STGetKSP(*st,ksp); } void PETSC_STDCALL stgetoperationcounters_(ST *st,PetscInt* ops,PetscInt* lits, int *__ierr ){ *__ierr = STGetOperationCounters(*st,ops,lits); } void PETSC_STDCALL stresetoperationcounters_(ST *st, int *__ierr ){ *__ierr = STResetOperationCounters(*st); } void PETSC_STDCALL stchecknullspace_(ST *st,PetscInt *n, Vec V[], int *__ierr ){ *__ierr = STCheckNullSpace(*st,*n,V); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/st/index.html0000644000175000017500000000325012211062077016645 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

interface/
impls/
examples/
../../include/slepc-private/stimpl.h
../../include/slepcst.h
makefile
slepc-3.4.2.dfsg.orig/src/ds/0000755000175000017500000000000012214143515014630 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/examples/0000755000175000017500000000000012214143515016446 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/examples/makefile0000644000175000017500000000177212211062077020155 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: LOCDIR = src/ds/examples/ DIRS = tests include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/examples/makefile.html0000644000175000017500000000350112211062077021110 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL:

LOCDIR   = src/ds/examples/
DIRS     = tests

include ${SLEPC_DIR}/conf/slepc_common

slepc-3.4.2.dfsg.orig/src/ds/examples/tests/0000755000175000017500000000000012211062077017610 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/examples/tests/test6.c.html0000644000175000017500000002426412211062077021774 0ustar gladkgladk
Actual source code: test6.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSGHIEP with compact storage.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscReal      *T,*s,re,im;
 34:   PetscScalar    *eigr,*eigi;
 35:   PetscInt       i,n=10,l=2,k=5,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type GHIEP with compact storage - dimension %D.\n",n);
 42:   PetscOptionsGetInt(NULL,"-l",&l,NULL);
 43:   PetscOptionsGetInt(NULL,"-k",&k,NULL);
 44:   if (l>n || k>n || l>k) SETERRQ(PETSC_COMM_WORLD,1,"Wrong value of dimensions");
 45:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 47:   /* Create DS object */
 48:   DSCreate(PETSC_COMM_WORLD,&ds);
 49:   DSSetType(ds,DSGHIEP);
 50:   DSSetFromOptions(ds);
 51:   ld = n+2;  /* test leading dimension larger than n */
 52:   DSAllocate(ds,ld);
 53:   DSSetDimensions(ds,n,0,l,k);
 54:   DSSetCompact(ds,PETSC_TRUE);

 56:   /* Set up viewer */
 57:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 58:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 59:   DSView(ds,viewer);
 60:   PetscViewerPopFormat(viewer);
 61:   if (verbose) {
 62:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 63:   }

 65:   /* Fill arrow-tridiagonal matrix */
 66:   DSGetArrayReal(ds,DS_MAT_T,&T);
 67:   DSGetArrayReal(ds,DS_MAT_D,&s);
 68:   for (i=0;i<n;i++) T[i] = (PetscReal)(i+1);
 69:   for (i=k;i<n-1;i++) T[i+ld] = 1.0;
 70:   for (i=l;i<k;i++) T[i+2*ld] = 1.0;
 71:   T[2*ld+l+1] = -7; T[ld+k+1] = -7;
 72:   /* Signature matrix */
 73:   for (i=0;i<n;i++) s[i] = 1.0;
 74:   s[l+1] = -1.0;
 75:   s[k+1] = -1.0;
 76:   DSRestoreArrayReal(ds,DS_MAT_T,&T);
 77:   DSRestoreArrayReal(ds,DS_MAT_D,&s);
 78:   if (l==0 && k==0) {
 79:     DSSetState(ds,DS_STATE_INTERMEDIATE);
 80:   } else {
 81:     DSSetState(ds,DS_STATE_RAW);
 82:   }
 83:   if (verbose) {
 84:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 85:     DSView(ds,viewer);
 86:   }

 88:   /* Solve */
 89:   PetscMalloc(n*sizeof(PetscScalar),&eigr);
 90:   PetscMalloc(n*sizeof(PetscScalar),&eigi);
 91:   PetscMemzero(eigi,n*sizeof(PetscScalar));
 92:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 93:   DSSolve(ds,eigr,eigi);
 94:   DSSort(ds,eigr,eigi,NULL,NULL,NULL);
 95:   if (verbose) {
 96:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 97:     DSView(ds,viewer);
 98:   }

100:   /* Print eigenvalues */
101:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
102:   for (i=0;i<n;i++) {
103: #if defined(PETSC_USE_COMPLEX)
104:     re = PetscRealPart(eigr[i]);
105:     im = PetscImaginaryPart(eigr[i]);
106: #else
107:     re = eigr[i];
108:     im = eigi[i];
109: #endif
110:     if (PetscAbs(im)<1e-10) {
111:       PetscViewerASCIIPrintf(viewer,"  %.5F\n",re);
112:     } else {
113:       PetscViewerASCIIPrintf(viewer,"  %.5F%+.5Fi\n",re,im);
114:     }
115:   }
116:   PetscFree(eigr);
117:   PetscFree(eigi);
118:   DSDestroy(&ds);
119:   SlepcFinalize();
120:   return 0;
121: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test10.c.html0000644000175000017500000001554412211062077022050 0ustar gladkgladk
Actual source code: test10.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test matrix exponential in DSHEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for DSViewMat_Private() */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscScalar    *A;
 34:   PetscInt       i,j,n=10,ld;
 35:   PetscViewer    viewer;
 36:   PetscBool      verbose;

 38:   SlepcInitialize(&argc,&argv,(char*)0,help);
 39:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 40:   PetscPrintf(PETSC_COMM_WORLD,"Compute symmetric matrix exponential - dimension %D.\n",n);
 41:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 43:   /* Create DS object */
 44:   DSCreate(PETSC_COMM_WORLD,&ds);
 45:   DSSetType(ds,DSHEP);
 46:   DSSetFromOptions(ds);
 47:   ld = n+2;  /* test leading dimension larger than n */
 48:   DSAllocate(ds,ld);
 49:   DSSetDimensions(ds,n,0,0,0);

 51:   /* Set up viewer */
 52:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 53:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 54:   DSView(ds,viewer);
 55:   PetscViewerPopFormat(viewer);
 56:   if (verbose) {
 57:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 58:   }

 60:   /* Fill with a symmetric Toeplitz matrix */
 61:   DSGetArray(ds,DS_MAT_A,&A);
 62:   for (i=0;i<n;i++) A[i+i*ld]=2.0;
 63:   for (j=1;j<3;j++) {
 64:     for (i=0;i<n-j;i++) { A[i+(i+j)*ld]=1.0; A[(i+j)+i*ld]=1.0; }
 65:   }
 66:   DSRestoreArray(ds,DS_MAT_A,&A);
 67:   DSSetState(ds,DS_STATE_RAW);
 68:   if (verbose) {
 69:     PetscPrintf(PETSC_COMM_WORLD,"Matrix A - - - - - - - -\n");
 70:     DSView(ds,viewer);
 71:   }

 73:   /* Compute matrix exponential */
 74:   DSComputeFunction(ds,SLEPC_FUNCTION_EXP);
 75:   if (verbose) {
 76:     PetscPrintf(PETSC_COMM_WORLD,"Computed f(A) - - - - - - -\n");
 77:     DSViewMat_Private(ds,viewer,DS_MAT_F);
 78:   }

 80:   DSDestroy(&ds);
 81:   SlepcFinalize();
 82:   return 0;
 83: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test5.c0000644000175000017500000001030112211062077021013 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSGHIEP.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscReal re,im; PetscScalar *A,*B,*eigr,*eigi; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type GHIEP - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSGHIEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with a symmetric Toeplitz matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = DSGetArray(ds,DS_MAT_B,&B);CHKERRQ(ierr); for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSGHIEP with compact storage.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscReal *T,*s,re,im; PetscScalar *eigr,*eigi; PetscInt i,n=10,l=2,k=5,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type GHIEP with compact storage - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-l",&l,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-k",&k,NULL);CHKERRQ(ierr); if (l>n || k>n || l>k) SETERRQ(PETSC_COMM_WORLD,1,"Wrong value of dimensions"); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSGHIEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,l,k);CHKERRQ(ierr); ierr = DSSetCompact(ds,PETSC_TRUE);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill arrow-tridiagonal matrix */ ierr = DSGetArrayReal(ds,DS_MAT_T,&T);CHKERRQ(ierr); ierr = DSGetArrayReal(ds,DS_MAT_D,&s);CHKERRQ(ierr); for (i=0;iActual source code: test9.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSGHEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscReal      re;
 34:   PetscScalar    *A,*B,*eig;
 35:   PetscInt       i,j,n=10,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"Solve a System of type GHEP - dimension %D.\n",n);
 42:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 44:   /* Create DS object */
 45:   DSCreate(PETSC_COMM_WORLD,&ds);
 46:   DSSetType(ds,DSGHEP);
 47:   DSSetFromOptions(ds);
 48:   ld = n+2;  /* test leading dimension larger than n */
 49:   DSAllocate(ds,ld);
 50:   DSSetDimensions(ds,n,0,0,0);

 52:   /* Set up viewer */
 53:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 54:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 55:   DSView(ds,viewer);
 56:   PetscViewerPopFormat(viewer);
 57:   if (verbose) {
 58:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 59:   }

 61:   /* Fill with a symmetric Toeplitz matrix */
 62:   DSGetArray(ds,DS_MAT_A,&A);
 63:   DSGetArray(ds,DS_MAT_B,&B);
 64:   for (i=0;i<n;i++) A[i+i*ld]=2.0;
 65:   for (j=1;j<3;j++) {
 66:     for (i=0;i<n-j;i++) { A[i+(i+j)*ld]=1.0; A[(i+j)+i*ld]=1.0; }
 67:   }
 68:   for (j=1;j<3;j++) { A[0+j*ld]=-1.0*(j+2); A[j+0*ld]=-1.0*(j+2); }
 69:   /* Diagonal matrix */
 70:   for (i=0;i<n;i++) B[i+i*ld]=0.1*(i+1);
 71:   DSRestoreArray(ds,DS_MAT_A,&A);
 72:   DSRestoreArray(ds,DS_MAT_B,&B);
 73:   DSSetState(ds,DS_STATE_RAW);
 74:   if (verbose) {
 75:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 76:     DSView(ds,viewer);
 77:   }

 79:   /* Solve */
 80:   PetscMalloc(n*sizeof(PetscScalar),&eig);
 81:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 82:   DSSolve(ds,eig,NULL);
 83:   DSSort(ds,eig,NULL,NULL,NULL,NULL);
 84:   if (verbose) {
 85:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 86:     DSView(ds,viewer);
 87:   }

 89:   /* Print eigenvalues */
 90:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
 91:   for (i=0;i<n;i++) {
 92:     re = PetscRealPart(eig[i]);
 93:     PetscViewerASCIIPrintf(viewer,"  %.5F\n",re);
 94:   }
 95:   PetscFree(eig);
 96:   DSDestroy(&ds);
 97:   SlepcFinalize();
 98:   return 0;
 99: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test4.c0000644000175000017500000001006612211062077021022 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSGNHEP.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscScalar *A,*B,*wr,*wi; PetscReal re,im; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type GNHEP - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSGNHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill A with Grcar matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = PetscMemzero(A,sizeof(PetscScalar)*ld*n);CHKERRQ(ierr); for (i=1;iActual source code: test1.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSNHEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscScalar    *A,*wr,*wi;
 34:   PetscReal      re,im;
 35:   PetscInt       i,j,n=10,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose,extrarow;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type NHEP - dimension %D.\n",n);
 42:   PetscOptionsHasName(NULL,"-verbose",&verbose);
 43:   PetscOptionsHasName(NULL,"-extrarow",&extrarow);

 45:   /* Create DS object */
 46:   DSCreate(PETSC_COMM_WORLD,&ds);
 47:   DSSetType(ds,DSNHEP);
 48:   DSSetFromOptions(ds);
 49:   ld = n+2;  /* test leading dimension larger than n */
 50:   DSAllocate(ds,ld);
 51:   DSSetDimensions(ds,n,0,0,0);
 52:   DSSetExtraRow(ds,extrarow);

 54:   /* Set up viewer */
 55:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 56:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 57:   DSView(ds,viewer);
 58:   PetscViewerPopFormat(viewer);
 59:   if (verbose) {
 60:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 61:   }

 63:   /* Fill with Grcar matrix */
 64:   DSGetArray(ds,DS_MAT_A,&A);
 65:   for (i=1;i<n;i++) A[i+(i-1)*ld]=-1.0;
 66:   for (j=0;j<4;j++) {
 67:     for (i=0;i<n-j;i++) A[i+(i+j)*ld]=1.0;
 68:   }
 69:   if (extrarow) A[n+(n-1)*ld]=-1.0;
 70:   DSRestoreArray(ds,DS_MAT_A,&A);
 71:   DSSetState(ds,DS_STATE_INTERMEDIATE);
 72:   if (verbose) {
 73:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 74:     DSView(ds,viewer);
 75:   }

 77:   /* Solve */
 78:   PetscMalloc(n*sizeof(PetscScalar),&wr);
 79:   PetscMalloc(n*sizeof(PetscScalar),&wi);
 80:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 81:   DSSolve(ds,wr,wi);
 82:   DSSort(ds,wr,wi,NULL,NULL,NULL);
 83:   if (extrarow) { DSUpdateExtraRow(ds); }
 84:   if (verbose) {
 85:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 86:     DSView(ds,viewer);
 87:   }

 89:   /* Print eigenvalues */
 90:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
 91:   for (i=0;i<n;i++) {
 92: #if defined(PETSC_USE_COMPLEX)
 93:     re = PetscRealPart(wr[i]);
 94:     im = PetscImaginaryPart(wr[i]);
 95: #else
 96:     re = wr[i];
 97:     im = wi[i];
 98: #endif
 99:     if (PetscAbs(im)<1e-10) {
100:       PetscViewerASCIIPrintf(viewer,"  %.5F\n",re);
101:     } else {
102:       PetscViewerASCIIPrintf(viewer,"  %.5F%+.5Fi\n",re,im);
103:     }
104:   }

106:   PetscFree(wr);
107:   PetscFree(wi);
108:   DSDestroy(&ds);
109:   SlepcFinalize();
110:   return 0;
111: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test9.c0000644000175000017500000000734012211062077021030 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSGHEP.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscReal re; PetscScalar *A,*B,*eig; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a System of type GHEP - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSGHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with a symmetric Toeplitz matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); ierr = DSGetArray(ds,DS_MAT_B,&B);CHKERRQ(ierr); for (i=0;iActual source code: test12.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSNEP.\n\n";

 24: #include <slepcds.h>

 28: int main(int argc,char **argv)
 29: {
 31:   DS             ds;
 32:   FN             f1,f2,f3,funs[3];
 33:   PetscScalar    *Id,*A,*B,*wr,*wi,coeffs[2];
 34:   PetscReal      tau=0.001,h,a=20,xi,re,im;
 35:   PetscInt       i,n=10,ld,nev;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscOptionsGetReal(NULL,"-tau",&tau,NULL);
 42:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type NEP - dimension %D, tau=%G.\n",n,tau);
 43:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 45:   /* Create DS object */
 46:   DSCreate(PETSC_COMM_WORLD,&ds);
 47:   DSSetType(ds,DSNEP);
 48:   DSSetFromOptions(ds);

 50:   /* Set functions (prior to DSAllocate) */
 51:   FNCreate(PETSC_COMM_WORLD,&f1);
 52:   FNSetType(f1,FNRATIONAL);
 53:   coeffs[0] = -1.0; coeffs[1] = 0.0;
 54:   FNSetParameters(f1,2,coeffs,0,NULL);

 56:   FNCreate(PETSC_COMM_WORLD,&f2);
 57:   FNSetType(f2,FNRATIONAL);
 58:   coeffs[0] = 1.0;
 59:   FNSetParameters(f2,1,coeffs,0,NULL);

 61:   FNCreate(PETSC_COMM_WORLD,&f3);
 62:   FNSetType(f3,FNEXP);
 63:   coeffs[0] = -tau;
 64:   FNSetParameters(f3,1,coeffs,0,NULL);

 66:   funs[0] = f1;
 67:   funs[1] = f2;
 68:   funs[2] = f3;
 69:   DSSetFN(ds,3,funs);

 71:   /* Set dimensions */
 72:   ld = n+2;  /* test leading dimension larger than n */
 73:   DSAllocate(ds,ld);
 74:   DSSetDimensions(ds,n,0,0,0);

 76:   /* Set up viewer */
 77:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 78:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 79:   DSView(ds,viewer);
 80:   PetscViewerPopFormat(viewer);
 81:   if (verbose) {
 82:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 83:   }

 85:   /* Fill matrices */
 86:   DSGetArray(ds,DS_MAT_E0,&Id);
 87:   for (i=0;i<n;i++) Id[i+i*ld]=1.0;
 88:   DSRestoreArray(ds,DS_MAT_E0,&Id);
 89:   h = PETSC_PI/(PetscReal)(n+1);
 90:   DSGetArray(ds,DS_MAT_E1,&A);
 91:   for (i=0;i<n;i++) A[i+i*ld]=-2.0/(h*h)+a;
 92:   for (i=1;i<n;i++) {
 93:     A[i+(i-1)*ld]=1.0/(h*h);
 94:     A[(i-1)+i*ld]=1.0/(h*h);
 95:   }
 96:   DSRestoreArray(ds,DS_MAT_E1,&A);
 97:   DSGetArray(ds,DS_MAT_E2,&B);
 98:   for (i=0;i<n;i++) {
 99:     xi = (i+1)*h;
100:     B[i+i*ld] = -4.1+xi*(1.0-PetscExpReal(xi-PETSC_PI));
101:   }
102:   DSRestoreArray(ds,DS_MAT_E2,&B);

104:   if (verbose) {
105:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
106:     DSView(ds,viewer);
107:   }

109:   /* Solve */
110:   PetscMalloc(n*sizeof(PetscScalar),&wr);
111:   PetscMalloc(n*sizeof(PetscScalar),&wi);
112:   DSSolve(ds,wr,wi);
113:   if (verbose) {
114:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
115:     DSView(ds,viewer);
116:   }

118:   /* Print first eigenvalue */
119:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalue =\n",n);
120:   nev = 1;
121:   for (i=0;i<nev;i++) {
122: #if defined(PETSC_USE_COMPLEX)
123:     re = PetscRealPart(wr[i]);
124:     im = PetscImaginaryPart(wr[i]);
125: #else
126:     re = wr[i];
127:     im = wi[i];
128: #endif
129:     if (PetscAbs(im)<1e-10) {
130:       PetscViewerASCIIPrintf(viewer,"  %.5F\n",re);
131:     } else {
132:       PetscViewerASCIIPrintf(viewer,"  %.5F%+.5Fi\n",re,im);
133:     }
134:   }

136:   PetscFree(wr);
137:   PetscFree(wi);
138:   FNDestroy(&f1);
139:   FNDestroy(&f2);
140:   FNDestroy(&f3);
141:   DSDestroy(&ds);
142:   SlepcFinalize();
143:   return 0;
144: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/makefile0000644000175000017500000001301512211062077021310 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = CPPFLAGS = FPPFLAGS = LOCDIR = src/ds/examples/tests/ EXAMPLESC = test1.c test2.c test3.c test4.c test5.c test6.c test7.c test8.c test9.c \ test10.c test11.c test12.c EXAMPLESF = MANSEC = DS TESTS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \ test2.PETSc runtest2_1 test2.rm \ test3.PETSc runtest3_1 test3.rm \ test4.PETSc runtest4_1 test4.rm \ test5.PETSc runtest5_1 test5.rm \ test6.PETSc runtest6_1 test6.rm \ test7.PETSc runtest7_1 test7.rm \ test8.PETSc runtest8_1 test8.rm \ test9.PETSc runtest9_1 test9.rm \ test10.PETSc runtest10_1 test10.rm \ test11.PETSc runtest11_1 test11.rm \ test12.PETSc runtest12_1 test12.rm include ${SLEPC_DIR}/conf/slepc_common test1: test1.o chkopts -${CLINKER} -o test1 test1.o ${SLEPC_LIB} ${RM} test1.o test2: test2.o chkopts -${CLINKER} -o test2 test2.o ${SLEPC_LIB} ${RM} test2.o test3: test3.o chkopts -${CLINKER} -o test3 test3.o ${SLEPC_LIB} ${RM} test3.o test4: test4.o chkopts -${CLINKER} -o test4 test4.o ${SLEPC_LIB} ${RM} test4.o test5: test5.o chkopts -${CLINKER} -o test5 test5.o ${SLEPC_LIB} ${RM} test5.o test6: test6.o chkopts -${CLINKER} -o test6 test6.o ${SLEPC_LIB} ${RM} test6.o test7: test7.o chkopts -${CLINKER} -o test7 test7.o ${SLEPC_LIB} ${RM} test7.o test8: test8.o chkopts -${CLINKER} -o test8 test8.o ${SLEPC_LIB} ${RM} test8.o test9: test9.o chkopts -${CLINKER} -o test9 test9.o ${SLEPC_LIB} ${RM} test9.o test10: test10.o chkopts -${CLINKER} -o test10 test10.o ${SLEPC_LIB} ${RM} test10.o test11: test11.o chkopts -${CLINKER} -o test11 test11.o ${SLEPC_LIB} ${RM} test11.o test12: test12.o chkopts -${CLINKER} -o test12 test12.o ${SLEPC_LIB} ${RM} test12.o #------------------------------------------------------------------------------------ runtest1_1: -@${MPIEXEC} -np 1 ./test1 > test1_1.tmp 2>&1; \ if (${DIFF} output/test1_1.out test1_1.tmp) then true; \ else echo "Possible problem with test1_1, diffs above"; fi; \ ${RM} -f test1_1.tmp runtest2_1: -@${MPIEXEC} -np 1 ./test2 -n 12 > test2_1.tmp 2>&1; \ if (${DIFF} output/test2_1.out test2_1.tmp) then true; \ else echo "Possible problem with test2_1, diffs above"; fi; \ ${RM} -f test2_1.tmp runtest3_1: -@${MPIEXEC} -np 1 ./test3 > test3_1.tmp 2>&1; \ if (${DIFF} output/test3_1.out test3_1.tmp) then true; \ else echo "Possible problem with test3_1, diffs above"; fi; \ ${RM} -f test3_1.tmp runtest4_1: -@${MPIEXEC} -np 1 ./test4 > test4_1.tmp 2>&1; \ if (${DIFF} output/test4_1.out test4_1.tmp) then true; \ else echo "Possible problem with test4_1, diffs above"; fi; \ ${RM} -f test4_1.tmp runtest5_1: -@${MPIEXEC} -np 1 ./test5 > test5_1.tmp 2>&1; \ if (${DIFF} output/test5_1.out test5_1.tmp) then true; \ else echo "Possible problem with test5_1, diffs above"; fi; \ ${RM} -f test5_1.tmp runtest6_1: -@${MPIEXEC} -np 1 ./test6 > test6_1.tmp 2>&1; \ if (${DIFF} output/test6_1.out test6_1.tmp) then true; \ else echo "Possible problem with test6_1, diffs above"; fi; \ ${RM} -f test6_1.tmp runtest7_1: -@${MPIEXEC} -np 1 ./test7 > test7_1.tmp 2>&1; \ if (${DIFF} output/test7_1.out test7_1.tmp) then true; \ else echo "Possible problem with test7_1, diffs above"; fi; \ ${RM} -f test7_1.tmp runtest8_1: -@${MPIEXEC} -np 1 ./test8 > test8_1.tmp 2>&1; \ if (${DIFF} output/test8_1.out test8_1.tmp) then true; \ else echo "Possible problem with test8_1, diffs above"; fi; \ ${RM} -f test8_1.tmp runtest9_1: -@${MPIEXEC} -np 1 ./test9 > test9_1.tmp 2>&1; \ if (${DIFF} output/test9_1.out test9_1.tmp) then true; \ else echo "Possible problem with test9_1, diffs above"; fi; \ ${RM} -f test9_1.tmp runtest10_1: -@${MPIEXEC} -np 1 ./test10 > test10_1.tmp 2>&1; \ if (${DIFF} output/test10_1.out test10_1.tmp) then true; \ else echo "Possible problem with test9_1, diffs above"; fi; \ ${RM} -f test10_1.tmp runtest11_1: -@${MPIEXEC} -np 1 ./test11 > test11_1.tmp 2>&1; \ if (${DIFF} output/test11_1.out test11_1.tmp) then true; \ else echo "Possible problem with test9_1, diffs above"; fi; \ ${RM} -f test11_1.tmp runtest12_1: -@${MPIEXEC} -np 1 ./test12 > test12_1.tmp 2>&1; \ if (${DIFF} output/test12_1.out test12_1.tmp) then true; \ else echo "Possible problem with test9_1, diffs above"; fi; \ ${RM} -f test12_1.tmp slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test8.c.html0000644000175000017500000002122712211062077021772 0ustar gladkgladk
Actual source code: test8.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSSVD with compact storage.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscReal      *T,sigma;
 34:   PetscScalar    *w;
 35:   PetscInt       i,n=10,m,l=2,k=5,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   m = n;
 42:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type SVD with compact storage - dimension %Dx%D.\n",n,m);
 43:   PetscOptionsGetInt(NULL,"-l",&l,NULL);
 44:   PetscOptionsGetInt(NULL,"-k",&k,NULL);
 45:   if (l>n || k>n || l>k) SETERRQ(PETSC_COMM_WORLD,1,"Wrong value of dimensions");
 46:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 48:   /* Create DS object */
 49:   DSCreate(PETSC_COMM_WORLD,&ds);
 50:   DSSetType(ds,DSSVD);
 51:   DSSetFromOptions(ds);
 52:   ld = n+2;  /* test leading dimension larger than n */
 53:   DSAllocate(ds,ld);
 54:   DSSetDimensions(ds,n,m,l,k);
 55:   DSSetCompact(ds,PETSC_TRUE);

 57:   /* Set up viewer */
 58:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 59:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 60:   DSView(ds,viewer);
 61:   PetscViewerPopFormat(viewer);
 62:   if (verbose) {
 63:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 64:   }

 66:   /* Fill upper arrow-tridiagonal matrix */
 67:   DSGetArrayReal(ds,DS_MAT_T,&T);
 68:   for (i=0;i<n;i++) T[i] = (PetscReal)(i+1);
 69:   for (i=l;i<n-1;i++) T[i+ld] = 1.0;
 70:   DSRestoreArrayReal(ds,DS_MAT_T,&T);
 71:   if (l==0 && k==0) {
 72:     DSSetState(ds,DS_STATE_INTERMEDIATE);
 73:   } else {
 74:     DSSetState(ds,DS_STATE_RAW);
 75:   }
 76:   if (verbose) {
 77:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 78:     DSView(ds,viewer);
 79:   }

 81:   /* Solve */
 82:   PetscMalloc(n*sizeof(PetscScalar),&w);
 83:   DSSetEigenvalueComparison(ds,SlepcCompareLargestReal,NULL);
 84:   DSSolve(ds,w,NULL);
 85:   DSSort(ds,w,NULL,NULL,NULL,NULL);
 86:   if (verbose) {
 87:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 88:     DSView(ds,viewer);
 89:   }

 91:   /* Print singular values */
 92:   PetscPrintf(PETSC_COMM_WORLD,"Computed singular values =\n",n);
 93:   for (i=0;i<n;i++) {
 94:     sigma = PetscRealPart(w[i]);
 95:     PetscViewerASCIIPrintf(viewer,"  %.5F\n",sigma);
 96:   }
 97:   PetscFree(w);
 98:   DSDestroy(&ds);
 99:   SlepcFinalize();
100:   return 0;
101: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/makefile.html0000644000175000017500000002112112211062077022250 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS     =
FFLAGS     =
CPPFLAGS   =
FPPFLAGS   =
LOCDIR     = src/ds/examples/tests/
EXAMPLESC  = test1.c test2.c test3.c test4.c test5.c test6.c test7.c test8.c test9.c \
             test10.c test11.c test12.c
EXAMPLESF  =
MANSEC     = DS
TESTS      = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12

TESTEXAMPLES_C       = test1.PETSc runtest1_1 test1.rm \
                       test2.PETSc runtest2_1 test2.rm \
                       test3.PETSc runtest3_1 test3.rm \
                       test4.PETSc runtest4_1 test4.rm \
                       test5.PETSc runtest5_1 test5.rm \
                       test6.PETSc runtest6_1 test6.rm \
                       test7.PETSc runtest7_1 test7.rm \
                       test8.PETSc runtest8_1 test8.rm \
                       test9.PETSc runtest9_1 test9.rm \
                       test10.PETSc runtest10_1 test10.rm \
                       test11.PETSc runtest11_1 test11.rm \
                       test12.PETSc runtest12_1 test12.rm

include ${SLEPC_DIR}/conf/slepc_common

test1: test1.o chkopts
	-${CLINKER} -o test1 test1.o ${SLEPC_LIB}
	${RM} test1.o

test2: test2.o chkopts
	-${CLINKER} -o test2 test2.o ${SLEPC_LIB}
	${RM} test2.o

test3: test3.o chkopts
	-${CLINKER} -o test3 test3.o ${SLEPC_LIB}
	${RM} test3.o

test4: test4.o chkopts
	-${CLINKER} -o test4 test4.o ${SLEPC_LIB}
	${RM} test4.o

test5: test5.o chkopts
	-${CLINKER} -o test5 test5.o ${SLEPC_LIB}
	${RM} test5.o

test6: test6.o chkopts
	-${CLINKER} -o test6 test6.o ${SLEPC_LIB}
	${RM} test6.o

test7: test7.o chkopts
	-${CLINKER} -o test7 test7.o ${SLEPC_LIB}
	${RM} test7.o

test8: test8.o chkopts
	-${CLINKER} -o test8 test8.o ${SLEPC_LIB}
	${RM} test8.o

test9: test9.o chkopts
	-${CLINKER} -o test9 test9.o ${SLEPC_LIB}
	${RM} test9.o

test10: test10.o chkopts
	-${CLINKER} -o test10 test10.o ${SLEPC_LIB}
	${RM} test10.o

test11: test11.o chkopts
	-${CLINKER} -o test11 test11.o ${SLEPC_LIB}
	${RM} test11.o

test12: test12.o chkopts
	-${CLINKER} -o test12 test12.o ${SLEPC_LIB}
	${RM} test12.o

#------------------------------------------------------------------------------------

runtest1_1:
	-@${MPIEXEC} -np 1 ./test1 > test1_1.tmp 2>&1; \
	  if (${DIFF} output/test1_1.out test1_1.tmp) then true; \
	  else echo "Possible problem with test1_1, diffs above"; fi; \
	  ${RM} -f test1_1.tmp

runtest2_1:
	-@${MPIEXEC} -np 1 ./test2 -n 12 > test2_1.tmp 2>&1; \
	  if (${DIFF} output/test2_1.out test2_1.tmp) then true; \
	  else echo "Possible problem with test2_1, diffs above"; fi; \
	  ${RM} -f test2_1.tmp

runtest3_1:
	-@${MPIEXEC} -np 1 ./test3 > test3_1.tmp 2>&1; \
	  if (${DIFF} output/test3_1.out test3_1.tmp) then true; \
	  else echo "Possible problem with test3_1, diffs above"; fi; \
	  ${RM} -f test3_1.tmp

runtest4_1:
	-@${MPIEXEC} -np 1 ./test4 > test4_1.tmp 2>&1; \
	  if (${DIFF} output/test4_1.out test4_1.tmp) then true; \
	  else echo "Possible problem with test4_1, diffs above"; fi; \
	  ${RM} -f test4_1.tmp

runtest5_1:
	-@${MPIEXEC} -np 1 ./test5 > test5_1.tmp 2>&1; \
	  if (${DIFF} output/test5_1.out test5_1.tmp) then true; \
	  else echo "Possible problem with test5_1, diffs above"; fi; \
	  ${RM} -f test5_1.tmp

runtest6_1:
	-@${MPIEXEC} -np 1 ./test6 > test6_1.tmp 2>&1; \
	  if (${DIFF} output/test6_1.out test6_1.tmp) then true; \
	  else echo "Possible problem with test6_1, diffs above"; fi; \
	  ${RM} -f test6_1.tmp

runtest7_1:
	-@${MPIEXEC} -np 1 ./test7 > test7_1.tmp 2>&1; \
	  if (${DIFF} output/test7_1.out test7_1.tmp) then true; \
	  else echo "Possible problem with test7_1, diffs above"; fi; \
	  ${RM} -f test7_1.tmp

runtest8_1:
	-@${MPIEXEC} -np 1 ./test8 > test8_1.tmp 2>&1; \
	  if (${DIFF} output/test8_1.out test8_1.tmp) then true; \
	  else echo "Possible problem with test8_1, diffs above"; fi; \
	  ${RM} -f test8_1.tmp

runtest9_1:
	-@${MPIEXEC} -np 1 ./test9 > test9_1.tmp 2>&1; \
	  if (${DIFF} output/test9_1.out test9_1.tmp) then true; \
	  else echo "Possible problem with test9_1, diffs above"; fi; \
	  ${RM} -f test9_1.tmp

runtest10_1:
	-@${MPIEXEC} -np 1 ./test10 > test10_1.tmp 2>&1; \
	  if (${DIFF} output/test10_1.out test10_1.tmp) then true; \
	  else echo "Possible problem with test9_1, diffs above"; fi; \
	  ${RM} -f test10_1.tmp

runtest11_1:
	-@${MPIEXEC} -np 1 ./test11 > test11_1.tmp 2>&1; \
	  if (${DIFF} output/test11_1.out test11_1.tmp) then true; \
	  else echo "Possible problem with test9_1, diffs above"; fi; \
	  ${RM} -f test11_1.tmp

runtest12_1:
	-@${MPIEXEC} -np 1 ./test12 > test12_1.tmp 2>&1; \
	  if (${DIFF} output/test12_1.out test12_1.tmp) then true; \
	  else echo "Possible problem with test9_1, diffs above"; fi; \
	  ${RM} -f test12_1.tmp

slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test8.c0000644000175000017500000000756212211062077021035 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSSVD with compact storage.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscReal *T,sigma; PetscScalar *w; PetscInt i,n=10,m,l=2,k=5,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); m = n; ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type SVD with compact storage - dimension %Dx%D.\n",n,m);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-l",&l,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-k",&k,NULL);CHKERRQ(ierr); if (l>n || k>n || l>k) SETERRQ(PETSC_COMM_WORLD,1,"Wrong value of dimensions"); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSSVD);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,m,l,k);CHKERRQ(ierr); ierr = DSSetCompact(ds,PETSC_TRUE);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill upper arrow-tridiagonal matrix */ ierr = DSGetArrayReal(ds,DS_MAT_T,&T);CHKERRQ(ierr); for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSNHEP.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscScalar *A,*wr,*wi; PetscReal re,im; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose,extrarow; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type NHEP - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-extrarow",&extrarow);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSNHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); ierr = DSSetExtraRow(ds,extrarow);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with Grcar matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); for (i=1;i Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

test1.c: Test DSNHEP
test2.c: Test DSHEP
test3.c: Test DSHEP with compact storage
test4.c: Test DSGNHEP
test5.c: Test DSGHIEP
test6.c: Test DSGHIEP with compact storage
test7.c: Test DSSVD
test8.c: Test DSSVD with compact storage
test9.c: Test DSGHEP
test10.c: Test matrix exponential in DSHEP
test11.c: Test matrix exponential in DSNHEP
test12.c: Test DSNEP
makefile
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test3.c0000644000175000017500000001006112211062077021014 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSHEP with compact storage.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscReal *T; PetscScalar *eig; PetscInt i,n=10,l=2,k=5,ld; PetscViewer viewer; PetscBool verbose,extrarow; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type HEP with compact storage - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-l",&l,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-k",&k,NULL);CHKERRQ(ierr); if (l>n || k>n || l>k) SETERRQ(PETSC_COMM_WORLD,1,"Wrong value of dimensions"); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-extrarow",&extrarow);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,l,k);CHKERRQ(ierr); ierr = DSSetCompact(ds,PETSC_TRUE);CHKERRQ(ierr); ierr = DSSetExtraRow(ds,extrarow);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill arrow-tridiagonal matrix */ ierr = DSGetArrayReal(ds,DS_MAT_T,&T);CHKERRQ(ierr); for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test matrix exponential in DSNHEP.\n\n"; #include #include /* for DSViewMat_Private() */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscScalar *A; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Compute non-symmetric matrix exponential - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSNHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with a symmetric Toeplitz matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); for (i=1;iActual source code: test11.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test matrix exponential in DSNHEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for DSViewMat_Private() */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscScalar    *A;
 34:   PetscInt       i,j,n=10,ld;
 35:   PetscViewer    viewer;
 36:   PetscBool      verbose;

 38:   SlepcInitialize(&argc,&argv,(char*)0,help);
 39:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 40:   PetscPrintf(PETSC_COMM_WORLD,"Compute non-symmetric matrix exponential - dimension %D.\n",n);
 41:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 43:   /* Create DS object */
 44:   DSCreate(PETSC_COMM_WORLD,&ds);
 45:   DSSetType(ds,DSNHEP);
 46:   DSSetFromOptions(ds);
 47:   ld = n+2;  /* test leading dimension larger than n */
 48:   DSAllocate(ds,ld);
 49:   DSSetDimensions(ds,n,0,0,0);

 51:   /* Set up viewer */
 52:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 53:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 54:   DSView(ds,viewer);
 55:   PetscViewerPopFormat(viewer);
 56:   if (verbose) {
 57:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 58:   }

 60:   /* Fill with a symmetric Toeplitz matrix */
 61:   DSGetArray(ds,DS_MAT_A,&A);
 62:   for (i=1;i<n;i++) A[i+(i-1)*ld]=-1.0;
 63:   for (j=0;j<4;j++) {
 64:     for (i=0;i<n-j;i++) A[i+(i+j)*ld]=1.0;
 65:   }
 66:   DSRestoreArray(ds,DS_MAT_A,&A);
 67:   DSSetState(ds,DS_STATE_INTERMEDIATE);
 68:   if (verbose) {
 69:     PetscPrintf(PETSC_COMM_WORLD,"Matrix A - - - - - - - -\n");
 70:     DSView(ds,viewer);
 71:   }

 73:   /* Compute matrix exponential */
 74:   DSComputeFunction(ds,SLEPC_FUNCTION_EXP);
 75:   if (verbose) {
 76:     PetscPrintf(PETSC_COMM_WORLD,"Computed f(A) - - - - - - -\n");
 77:     DSViewMat_Private(ds,viewer,DS_MAT_F);
 78:   }

 80:   DSDestroy(&ds);
 81:   SlepcFinalize();
 82:   return 0;
 83: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test7.c.html0000644000175000017500000002051012211062077021763 0ustar gladkgladk
Actual source code: test7.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSSVD.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscReal      sigma;
 34:   PetscScalar    *A,*w;
 35:   PetscInt       i,j,k,n=15,m=10,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscOptionsGetInt(NULL,"-m",&m,NULL);
 42:   k = PetscMin(n,m);
 43:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type SVD - dimension %Dx%D.\n",n,m);
 44:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 46:   /* Create DS object */
 47:   DSCreate(PETSC_COMM_WORLD,&ds);
 48:   DSSetType(ds,DSSVD);
 49:   DSSetFromOptions(ds);
 50:   ld = n+2;  /* test leading dimension larger than n */
 51:   DSAllocate(ds,ld);
 52:   DSSetDimensions(ds,n,m,0,0);

 54:   /* Set up viewer */
 55:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 56:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 57:   DSView(ds,viewer);
 58:   PetscViewerPopFormat(viewer);
 59:   if (verbose) {
 60:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 61:   }

 63:   /* Fill with a rectangular Toeplitz matrix */
 64:   DSGetArray(ds,DS_MAT_A,&A);
 65:   for (i=0;i<k;i++) A[i+i*ld]=1.0;
 66:   for (j=1;j<3;j++) {
 67:     for (i=0;i<n-j;i++) { if ((i+j)<m) A[i+(i+j)*ld]=(PetscScalar)(j+1); }
 68:   }
 69:   for (j=1;j<n/2;j++) {
 70:     for (i=0;i<n-j;i++) { if ((i+j)<n && i<m) A[(i+j)+i*ld]=-1.0; }
 71:   }
 72:   DSRestoreArray(ds,DS_MAT_A,&A);
 73:   DSSetState(ds,DS_STATE_RAW);
 74:   if (verbose) {
 75:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 76:     DSView(ds,viewer);
 77:   }

 79:   /* Solve */
 80:   PetscMalloc(k*sizeof(PetscScalar),&w);
 81:   DSSetEigenvalueComparison(ds,SlepcCompareLargestReal,NULL);
 82:   DSSolve(ds,w,NULL);
 83:   DSSort(ds,w,NULL,NULL,NULL,NULL);
 84:   if (verbose) {
 85:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 86:     DSView(ds,viewer);
 87:   }

 89:   /* Print singular values */
 90:   PetscPrintf(PETSC_COMM_WORLD,"Computed singular values =\n",n);
 91:   for (i=0;i<k;i++) {
 92:     sigma = PetscRealPart(w[i]);
 93:     PetscViewerASCIIPrintf(viewer,"  %.5F\n",sigma);
 94:   }
 95:   PetscFree(w);
 96:   DSDestroy(&ds);
 97:   SlepcFinalize();
 98:   return 0;
 99: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test2.c0000644000175000017500000000731512211062077021023 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSHEP.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscScalar *A,*eig; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose,extrarow; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type HEP - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-extrarow",&extrarow);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); ierr = DSSetExtraRow(ds,extrarow);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with a symmetric Toeplitz matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); for (i=0;i. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test matrix exponential in DSHEP.\n\n"; #include #include /* for DSViewMat_Private() */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscScalar *A; PetscInt i,j,n=10,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Compute symmetric matrix exponential - dimension %D.\n",n);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSHEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with a symmetric Toeplitz matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); for (i=0;iActual source code: test2.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSHEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscScalar    *A,*eig;
 34:   PetscInt       i,j,n=10,ld;
 35:   PetscViewer    viewer;
 36:   PetscBool      verbose,extrarow;

 38:   SlepcInitialize(&argc,&argv,(char*)0,help);
 39:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 40:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type HEP - dimension %D.\n",n);
 41:   PetscOptionsHasName(NULL,"-verbose",&verbose);
 42:   PetscOptionsHasName(NULL,"-extrarow",&extrarow);

 44:   /* Create DS object */
 45:   DSCreate(PETSC_COMM_WORLD,&ds);
 46:   DSSetType(ds,DSHEP);
 47:   DSSetFromOptions(ds);
 48:   ld = n+2;  /* test leading dimension larger than n */
 49:   DSAllocate(ds,ld);
 50:   DSSetDimensions(ds,n,0,0,0);
 51:   DSSetExtraRow(ds,extrarow);

 53:   /* Set up viewer */
 54:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 55:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 56:   DSView(ds,viewer);
 57:   PetscViewerPopFormat(viewer);
 58:   if (verbose) {
 59:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 60:   }

 62:   /* Fill with a symmetric Toeplitz matrix */
 63:   DSGetArray(ds,DS_MAT_A,&A);
 64:   for (i=0;i<n;i++) A[i+i*ld]=2.0;
 65:   for (j=1;j<3;j++) {
 66:     for (i=0;i<n-j;i++) { A[i+(i+j)*ld]=1.0; A[(i+j)+i*ld]=1.0; }
 67:   }
 68:   if (extrarow) { A[n+(n-2)*ld]=1.0; A[n+(n-1)*ld]=1.0; }
 69:   DSRestoreArray(ds,DS_MAT_A,&A);
 70:   DSSetState(ds,DS_STATE_RAW);
 71:   if (verbose) {
 72:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 73:     DSView(ds,viewer);
 74:   }

 76:   /* Solve */
 77:   PetscMalloc(n*sizeof(PetscScalar),&eig);
 78:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 79:   DSSolve(ds,eig,NULL);
 80:   DSSort(ds,eig,NULL,NULL,NULL,NULL);
 81:   if (extrarow) { DSUpdateExtraRow(ds); }
 82:   if (verbose) {
 83:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 84:     DSView(ds,viewer);
 85:   }

 87:   /* Print eigenvalues */
 88:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
 89:   for (i=0;i<n;i++) {
 90:     PetscViewerASCIIPrintf(viewer,"  %.5F\n",PetscRealPart(eig[i]));
 91:   }

 93:   PetscFree(eig);
 94:   DSDestroy(&ds);
 95:   SlepcFinalize();
 96:   return 0;
 97: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test3.c.html0000644000175000017500000002202112211062077021756 0ustar gladkgladk
Actual source code: test3.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSHEP with compact storage.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscReal      *T;
 34:   PetscScalar    *eig;
 35:   PetscInt       i,n=10,l=2,k=5,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose,extrarow;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type HEP with compact storage - dimension %D.\n",n);
 42:   PetscOptionsGetInt(NULL,"-l",&l,NULL);
 43:   PetscOptionsGetInt(NULL,"-k",&k,NULL);
 44:   if (l>n || k>n || l>k) SETERRQ(PETSC_COMM_WORLD,1,"Wrong value of dimensions");
 45:   PetscOptionsHasName(NULL,"-verbose",&verbose);
 46:   PetscOptionsHasName(NULL,"-extrarow",&extrarow);

 48:   /* Create DS object */
 49:   DSCreate(PETSC_COMM_WORLD,&ds);
 50:   DSSetType(ds,DSHEP);
 51:   DSSetFromOptions(ds);
 52:   ld = n+2;  /* test leading dimension larger than n */
 53:   DSAllocate(ds,ld);
 54:   DSSetDimensions(ds,n,0,l,k);
 55:   DSSetCompact(ds,PETSC_TRUE);
 56:   DSSetExtraRow(ds,extrarow);

 58:   /* Set up viewer */
 59:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 60:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 61:   DSView(ds,viewer);
 62:   PetscViewerPopFormat(viewer);
 63:   if (verbose) {
 64:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 65:   }

 67:   /* Fill arrow-tridiagonal matrix */
 68:   DSGetArrayReal(ds,DS_MAT_T,&T);
 69:   for (i=0;i<n;i++) T[i] = (PetscReal)(i+1);
 70:   for (i=l;i<n-1;i++) T[i+ld] = 1.0;
 71:   if (extrarow) T[n-1+ld] = 1.0;
 72:   DSRestoreArrayReal(ds,DS_MAT_T,&T);
 73:   if (l==0 && k==0) {
 74:     DSSetState(ds,DS_STATE_INTERMEDIATE);
 75:   } else {
 76:     DSSetState(ds,DS_STATE_RAW);
 77:   }
 78:   if (verbose) {
 79:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 80:     DSView(ds,viewer);
 81:   }

 83:   /* Solve */
 84:   PetscMalloc(n*sizeof(PetscScalar),&eig);
 85:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 86:   DSSolve(ds,eig,NULL);
 87:   DSSort(ds,eig,NULL,NULL,NULL,NULL);
 88:   if (extrarow) { DSUpdateExtraRow(ds); }
 89:   if (verbose) {
 90:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 91:     DSView(ds,viewer);
 92:   }

 94:   /* Print eigenvalues */
 95:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
 96:   for (i=0;i<n;i++) {
 97:     PetscViewerASCIIPrintf(viewer,"  %.5F\n",PetscRealPart(eig[i]));
 98:   }

100:   PetscFree(eig);
101:   DSDestroy(&ds);
102:   SlepcFinalize();
103:   return 0;
104: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test12.c0000644000175000017500000001163312211062077021102 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSNEP.\n\n"; #include #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; FN f1,f2,f3,funs[3]; PetscScalar *Id,*A,*B,*wr,*wi,coeffs[2]; PetscReal tau=0.001,h,a=20,xi,re,im; PetscInt i,n=10,ld,nev; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,"-tau",&tau,NULL);CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type NEP - dimension %D, tau=%G.\n",n,tau);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSNEP);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); /* Set functions (prior to DSAllocate) */ ierr = FNCreate(PETSC_COMM_WORLD,&f1);CHKERRQ(ierr); ierr = FNSetType(f1,FNRATIONAL);CHKERRQ(ierr); coeffs[0] = -1.0; coeffs[1] = 0.0; ierr = FNSetParameters(f1,2,coeffs,0,NULL);CHKERRQ(ierr); ierr = FNCreate(PETSC_COMM_WORLD,&f2);CHKERRQ(ierr); ierr = FNSetType(f2,FNRATIONAL);CHKERRQ(ierr); coeffs[0] = 1.0; ierr = FNSetParameters(f2,1,coeffs,0,NULL);CHKERRQ(ierr); ierr = FNCreate(PETSC_COMM_WORLD,&f3);CHKERRQ(ierr); ierr = FNSetType(f3,FNEXP);CHKERRQ(ierr); coeffs[0] = -tau; ierr = FNSetParameters(f3,1,coeffs,0,NULL);CHKERRQ(ierr); funs[0] = f1; funs[1] = f2; funs[2] = f3; ierr = DSSetFN(ds,3,funs);CHKERRQ(ierr); /* Set dimensions */ ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,0,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill matrices */ ierr = DSGetArray(ds,DS_MAT_E0,&Id);CHKERRQ(ierr); for (i=0;iActual source code: test4.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSGNHEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscScalar    *A,*B,*wr,*wi;
 34:   PetscReal      re,im;
 35:   PetscInt       i,j,n=10,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type GNHEP - dimension %D.\n",n);
 42:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 44:   /* Create DS object */
 45:   DSCreate(PETSC_COMM_WORLD,&ds);
 46:   DSSetType(ds,DSGNHEP);
 47:   DSSetFromOptions(ds);
 48:   ld = n+2;  /* test leading dimension larger than n */
 49:   DSAllocate(ds,ld);
 50:   DSSetDimensions(ds,n,0,0,0);

 52:   /* Set up viewer */
 53:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 54:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 55:   DSView(ds,viewer);
 56:   PetscViewerPopFormat(viewer);
 57:   if (verbose) {
 58:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 59:   }

 61:   /* Fill A with Grcar matrix */
 62:   DSGetArray(ds,DS_MAT_A,&A);
 63:   PetscMemzero(A,sizeof(PetscScalar)*ld*n);
 64:   for (i=1;i<n;i++) A[i+(i-1)*ld]=-1.0;
 65:   for (j=0;j<4;j++) {
 66:     for (i=0;i<n-j;i++) A[i+(i+j)*ld]=1.0;
 67:   }
 68:   DSRestoreArray(ds,DS_MAT_A,&A);
 69:   /* Fill B with an identity matrix */
 70:   DSGetArray(ds,DS_MAT_B,&B);
 71:   PetscMemzero(B,sizeof(PetscScalar)*ld*n);
 72:   for (i=0;i<n;i++) B[i+i*ld]=1.0;
 73:   DSRestoreArray(ds,DS_MAT_B,&B);

 75:   if (verbose) {
 76:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 77:     DSView(ds,viewer);
 78:   }

 80:   /* Solve */
 81:   PetscMalloc(n*sizeof(PetscScalar),&wr);
 82:   PetscMalloc(n*sizeof(PetscScalar),&wi);
 83:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 84:   DSSolve(ds,wr,wi);
 85:   DSSort(ds,wr,wi,NULL,NULL,NULL);
 86:   if (verbose) {
 87:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 88:     DSView(ds,viewer);
 89:   }

 91:   /* Print eigenvalues */
 92:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
 93:   for (i=0;i<n;i++) {
 94: #if defined(PETSC_USE_COMPLEX)
 95:     re = PetscRealPart(wr[i]);
 96:     im = PetscImaginaryPart(wr[i]);
 97: #else
 98:     re = wr[i];
 99:     im = wi[i];
100: #endif
101:     if (PetscAbs(im)<1e-10) {
102:       PetscViewerASCIIPrintf(viewer,"  %.5F\n",re);
103:     } else {
104:       PetscViewerASCIIPrintf(viewer,"  %.5F%+.5Fi\n",re,im);
105:     }
106:   }

108:   PetscFree(wr);
109:   PetscFree(wi);
110:   DSDestroy(&ds);
111:   SlepcFinalize();
112:   return 0;
113: }
slepc-3.4.2.dfsg.orig/src/ds/examples/tests/test7.c0000644000175000017500000000727312211062077021033 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static char help[] = "Test DSSVD.\n\n"; #include #include /* for the definition of SlepcCompare* */ #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { PetscErrorCode ierr; DS ds; PetscReal sigma; PetscScalar *A,*w; PetscInt i,j,k,n=15,m=10,ld; PetscViewer viewer; PetscBool verbose; SlepcInitialize(&argc,&argv,(char*)0,help); ierr = PetscOptionsGetInt(NULL,"-n",&n,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,"-m",&m,NULL);CHKERRQ(ierr); k = PetscMin(n,m); ierr = PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type SVD - dimension %Dx%D.\n",n,m);CHKERRQ(ierr); ierr = PetscOptionsHasName(NULL,"-verbose",&verbose);CHKERRQ(ierr); /* Create DS object */ ierr = DSCreate(PETSC_COMM_WORLD,&ds);CHKERRQ(ierr); ierr = DSSetType(ds,DSSVD);CHKERRQ(ierr); ierr = DSSetFromOptions(ds);CHKERRQ(ierr); ld = n+2; /* test leading dimension larger than n */ ierr = DSAllocate(ds,ld);CHKERRQ(ierr); ierr = DSSetDimensions(ds,n,m,0,0);CHKERRQ(ierr); /* Set up viewer */ ierr = PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr); ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);CHKERRQ(ierr); ierr = DSView(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); if (verbose) { ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); } /* Fill with a rectangular Toeplitz matrix */ ierr = DSGetArray(ds,DS_MAT_A,&A);CHKERRQ(ierr); for (i=0;iActual source code: test5.c
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: static char help[] = "Test DSGHIEP.\n\n";

 24: #include <slepcds.h>
 25: #include <slepc-private/dsimpl.h>    /* for the definition of SlepcCompare* */

 29: int main(int argc,char **argv)
 30: {
 32:   DS             ds;
 33:   PetscReal      re,im;
 34:   PetscScalar    *A,*B,*eigr,*eigi;
 35:   PetscInt       i,j,n=10,ld;
 36:   PetscViewer    viewer;
 37:   PetscBool      verbose;

 39:   SlepcInitialize(&argc,&argv,(char*)0,help);
 40:   PetscOptionsGetInt(NULL,"-n",&n,NULL);
 41:   PetscPrintf(PETSC_COMM_WORLD,"Solve a Dense System of type GHIEP - dimension %D.\n",n);
 42:   PetscOptionsHasName(NULL,"-verbose",&verbose);

 44:   /* Create DS object */
 45:   DSCreate(PETSC_COMM_WORLD,&ds);
 46:   DSSetType(ds,DSGHIEP);
 47:   DSSetFromOptions(ds);
 48:   ld = n+2;  /* test leading dimension larger than n */
 49:   DSAllocate(ds,ld);
 50:   DSSetDimensions(ds,n,0,0,0);

 52:   /* Set up viewer */
 53:   PetscViewerASCIIGetStdout(PETSC_COMM_WORLD,&viewer);
 54:   PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO_DETAIL);
 55:   DSView(ds,viewer);
 56:   PetscViewerPopFormat(viewer);
 57:   if (verbose) {
 58:     PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
 59:   }

 61:   /* Fill with a symmetric Toeplitz matrix */
 62:   DSGetArray(ds,DS_MAT_A,&A);
 63:   DSGetArray(ds,DS_MAT_B,&B);
 64:   for (i=0;i<n;i++) A[i+i*ld]=2.0;
 65:   for (j=1;j<3;j++) {
 66:     for (i=0;i<n-j;i++) { A[i+(i+j)*ld]=1.0; A[(i+j)+i*ld]=1.0; }
 67:   }
 68:   for (j=1;j<3;j++) { A[0+j*ld]=-1.0*(j+2); A[j+0*ld]=-1.0*(j+2); }
 69:   /* Signature matrix */
 70:   for (i=0;i<n;i++) B[i+i*ld]=1.0;
 71:   B[0] = -1.0;
 72:   B[n-1+(n-1)*ld] = -1.0;
 73:   DSRestoreArray(ds,DS_MAT_A,&A);
 74:   DSRestoreArray(ds,DS_MAT_B,&B);
 75:   DSSetState(ds,DS_STATE_RAW);
 76:   if (verbose) {
 77:     PetscPrintf(PETSC_COMM_WORLD,"Initial - - - - - - - - -\n");
 78:     DSView(ds,viewer);
 79:   }

 81:   /* Solve */
 82:   PetscMalloc(n*sizeof(PetscScalar),&eigr);
 83:   PetscMalloc(n*sizeof(PetscScalar),&eigi);
 84:   PetscMemzero(eigi,n*sizeof(PetscScalar));
 85:   DSSetEigenvalueComparison(ds,SlepcCompareLargestMagnitude,NULL);
 86:   DSSolve(ds,eigr,eigi);
 87:   DSSort(ds,eigr,eigi,NULL,NULL,NULL);
 88:   if (verbose) {
 89:     PetscPrintf(PETSC_COMM_WORLD,"After solve - - - - - - - - -\n");
 90:     DSView(ds,viewer);
 91:   }

 93:   /* Print eigenvalues */
 94:   PetscPrintf(PETSC_COMM_WORLD,"Computed eigenvalues =\n",n);
 95:   for (i=0;i<n;i++) {
 96: #if defined(PETSC_USE_COMPLEX)
 97:     re = PetscRealPart(eigr[i]);
 98:     im = PetscImaginaryPart(eigr[i]);
 99: #else
100:     re = eigr[i];
101:     im = eigi[i];
102: #endif
103:     if (PetscAbs(im)<1e-10) {
104:       PetscViewerASCIIPrintf(viewer,"  %.5F\n",re);
105:     } else {
106:       PetscViewerASCIIPrintf(viewer,"  %.5F%+.5Fi\n",re,im);
107:     }
108:   }
109:   PetscFree(eigr);
110:   PetscFree(eigi);
111:   DSDestroy(&ds);
112:   SlepcFinalize();
113:   return 0;
114: }
slepc-3.4.2.dfsg.orig/src/ds/examples/index.html0000644000175000017500000000033012211062077020437 0ustar gladkgladk Generic SLEPc Manual Pages

tests/
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/0000755000175000017500000000000012214143515015754 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/nep/0000755000175000017500000000000012214143515016536 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/nep/dsnep.c.html0000644000175000017500000004534512211062077020771 0ustar gladkgladk

Actual source code: dsnep.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 27: PetscErrorCode DSAllocate_NEP(DS ds,PetscInt ld)
 28: {

 32:   if (!ds->nf) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"DSNEP requires passing some functions via DSSetFN()");
 33:   DSAllocateMat_Private(ds,DS_MAT_X);
 34:   PetscFree(ds->perm);
 35:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 36:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 37:   return(0);
 38: }

 42: PetscErrorCode DSView_NEP(DS ds,PetscViewer viewer)
 43: {
 44:   PetscErrorCode    ierr;
 45:   PetscViewerFormat format;
 46:   PetscInt          i;

 49:   PetscViewerGetFormat(viewer,&format);
 50:   if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) return(0);
 51:   for (i=0;i<ds->nf;i++) {
 52:     FNView(ds->f[i],viewer);
 53:     DSViewMat_Private(ds,viewer,DSMatExtra[i]);
 54:   }
 55:   if (ds->state>DS_STATE_INTERMEDIATE) {
 56:     DSViewMat_Private(ds,viewer,DS_MAT_X);
 57:   }
 58:   return(0);
 59: }

 63: PetscErrorCode DSVectors_NEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
 64: {
 66:   if (rnorm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
 67:   switch (mat) {
 68:     case DS_MAT_X:
 69:       break;
 70:     case DS_MAT_Y:
 71:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
 72:       break;
 73:     default:
 74:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
 75:   }
 76:   return(0);
 77: }

 81: PetscErrorCode DSNormalize_NEP(DS ds,DSMatType mat,PetscInt col)
 82: {
 84:   PetscInt       i,i0,i1;
 85:   PetscBLASInt   ld,n,one = 1;
 86:   PetscScalar    norm,*x;

 89:   switch (mat) {
 90:     case DS_MAT_X:
 91:       break;
 92:     case DS_MAT_Y:
 93:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
 94:       break;
 95:     default:
 96:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
 97:   }
 98:   PetscBLASIntCast(ds->n,&n);
 99:   PetscBLASIntCast(ds->ld,&ld);
100:   DSGetArray(ds,mat,&x);
101:   if (col < 0) {
102:     i0 = 0; i1 = ds->n;
103:   } else {
104:     i0 = col; i1 = col+1;
105:   }
106:   for (i=i0;i<i1;i++) {
107:     norm = BLASnrm2_(&n,&x[ld*i],&one);
108:     norm = 1.0/norm;
109:     PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
110:   }
111:   return(0);
112: }

116: PetscErrorCode DSSort_NEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
117: {
119:   PetscInt       n,l,i,*perm,ld=ds->ld;
120:   PetscScalar    *A;

123:   if (!ds->comparison) return(0);
124:   n = ds->n;
125:   l = ds->l;
126:   A  = ds->mat[DS_MAT_A];
127:   perm = ds->perm;
128:   for (i=l;i<n;i++) wr[i] = A[i+i*ld];
129:   if (rr) {
130:     DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_FALSE);
131:   } else {
132:     DSSortEigenvalues_Private(ds,wr,NULL,perm,PETSC_FALSE);
133:   }
134:   for (i=l;i<n;i++) A[i+i*ld] = wr[perm[i]];
135:   for (i=l;i<n;i++) wr[i] = A[i+i*ld];
136:   DSPermuteColumns_Private(ds,l,n,DS_MAT_Q,perm);
137:   return(0);
138: }

142: PetscErrorCode DSSolve_NEP_SLP(DS ds,PetscScalar *wr,PetscScalar *wi)
143: {
144: #if defined(SLEPC_MISSING_LAPACK_GGEV)
146:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GGEV - Lapack routine is unavailable");
147: #else
149:   PetscScalar    *A,*B,*W,*X,*work,*alpha,*beta;
150:   PetscScalar    norm,sigma,lambda,mu,re,re2;
151:   PetscBLASInt   info,n,ld,lrwork=0,lwork,one=1;
152:   PetscInt       it,pos,j,maxit=100,result;
153:   PetscReal      tol;
154: #if defined(PETSC_USE_COMPLEX)
155:   PetscReal      *rwork;
156: #else
157:   PetscReal      *alphai,im,im2;
158: #endif

161:   if (!ds->mat[DS_MAT_A]) {
162:     DSAllocateMat_Private(ds,DS_MAT_A);
163:   }
164:   if (!ds->mat[DS_MAT_B]) {
165:     DSAllocateMat_Private(ds,DS_MAT_B);
166:   }
167:   if (!ds->mat[DS_MAT_W]) {
168:     DSAllocateMat_Private(ds,DS_MAT_W);
169:   }
170:   PetscBLASIntCast(ds->n,&n);
171:   PetscBLASIntCast(ds->ld,&ld);
172: #if defined(PETSC_USE_COMPLEX)
173:   PetscBLASIntCast(2*ds->n+2*ds->n,&lwork);
174:   PetscBLASIntCast(8*ds->n,&lrwork);
175: #else
176:   PetscBLASIntCast(3*ds->n+8*ds->n,&lwork);
177: #endif
178:   DSAllocateWork_Private(ds,lwork,lrwork,0);
179:   alpha = ds->work;
180:   beta = ds->work + ds->n;
181: #if defined(PETSC_USE_COMPLEX)
182:   work = ds->work + 2*ds->n;
183:   lwork -= 2*ds->n;
184: #else
185:   alphai = ds->work + 2*ds->n;
186:   work = ds->work + 3*ds->n;
187:   lwork -= 3*ds->n;
188: #endif
189:   A = ds->mat[DS_MAT_A];
190:   B = ds->mat[DS_MAT_B];
191:   W = ds->mat[DS_MAT_W];
192:   X = ds->mat[DS_MAT_X];

194:   sigma = 0.0;
195:   lambda = sigma;
196:   tol = 1000*n*PETSC_MACHINE_EPSILON;

198:   for (it=0;it<maxit;it++) {

200:     /* evaluate T and T' */
201:     DSComputeMatrix(ds,lambda,PETSC_FALSE,DS_MAT_A);
202:     DSComputeMatrix(ds,lambda,PETSC_TRUE,DS_MAT_B);

204:     /* % compute eigenvalue correction mu and eigenvector u */
205: #if defined(PETSC_USE_COMPLEX)
206:     rwork = ds->rwork;
207:     PetscStackCallBLAS("LAPACKggev",LAPACKggev_("N","V",&n,A,&ld,B,&ld,alpha,beta,NULL,&ld,W,&ld,work,&lwork,rwork,&info));
208:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack ZGGEV %d",info);
209: #else
210:     PetscStackCallBLAS("LAPACKggev",LAPACKggev_("N","V",&n,A,&ld,B,&ld,alpha,alphai,beta,NULL,&ld,W,&ld,work,&lwork,&info));
211:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DGGEV %d",info);
212: #endif

214:     /* find smallest eigenvalue */
215:     j = 0;
216:     if (beta[j]==0.0) re = (PetscRealPart(alpha[j])>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
217:     else re = alpha[j]/beta[j];
218: #if !defined(PETSC_USE_COMPLEX)
219:     if (beta[j]==0.0) im = (alphai[j]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
220:     else im = alphai[j]/beta[j];
221: #endif
222:     pos = 0;
223:     for (j=1;j<n;j++) {
224:       if (beta[j]==0.0) re2 = (PetscRealPart(alpha[j])>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
225:       else re2 = alpha[j]/beta[j];
226: #if !defined(PETSC_USE_COMPLEX)
227:       if (beta[j]==0.0) im2 = (alphai[j]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
228:       else im2 = alphai[j]/beta[j];
229:       SlepcCompareSmallestMagnitude(re,im,re2,im2,&result,NULL);
230: #else
231:       SlepcCompareSmallestMagnitude(re,0.0,re2,0.0,&result,NULL);
232: #endif
233:       if (result > 0) {
234:         re = re2;
235: #if !defined(PETSC_USE_COMPLEX)
236:         im = im2;
237: #endif
238:         pos = j;
239:       }
240:     }

242: #if !defined(PETSC_USE_COMPLEX)
243:     if (im!=0.0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"DSNEP found a complex eigenvalue; try rerunning with complex scalars");
244: #endif
245:     mu = alpha[pos];
246:     PetscMemcpy(X,W+pos*ld,n*sizeof(PetscScalar));
247:     norm = BLASnrm2_(&n,X,&one);
248:     norm = 1.0/norm;
249:     PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,X,&one));

251:     /* correct eigenvalue approximation */
252:     lambda = lambda - mu;
253:     if (PetscAbsScalar(mu)<=tol) break;
254:   }

256:   wr[0] = lambda;
257:   if (wi) wi[0] = 0.0;

259:   if (it==maxit) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_CONV_FAILED,"DSNEP did not converge");
260:   return(0);
261: #endif
262: }

266: PETSC_EXTERN PetscErrorCode DSCreate_NEP(DS ds)
267: {
269:   ds->ops->allocate      = DSAllocate_NEP;
270:   ds->ops->view          = DSView_NEP;
271:   ds->ops->vectors       = DSVectors_NEP;
272:   ds->ops->solve[0]      = DSSolve_NEP_SLP;
273:   ds->ops->sort          = DSSort_NEP;
274:   ds->ops->normalize     = DSNormalize_NEP;
275:   return(0);
276: }

slepc-3.4.2.dfsg.orig/src/ds/impls/nep/makefile0000644000175000017500000000213112211062077020233 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dsnep.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/nep/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/nep/makefile.html0000644000175000017500000000372212211062077021205 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dsnep.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/nep/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/nep/index.html0000644000175000017500000000124412211062077020534 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dsnep.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/nep/dsnep.c0000644000175000017500000002134312211062077020016 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocate_NEP" PetscErrorCode DSAllocate_NEP(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; if (!ds->nf) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"DSNEP requires passing some functions via DSSetFN()"); ierr = DSAllocateMat_Private(ds,DS_MAT_X);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView_NEP" PetscErrorCode DSView_NEP(DS ds,PetscViewer viewer) { PetscErrorCode ierr; PetscViewerFormat format; PetscInt i; PetscFunctionBegin; ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) PetscFunctionReturn(0); for (i=0;inf;i++) { ierr = FNView(ds->f[i],viewer);CHKERRQ(ierr); ierr = DSViewMat_Private(ds,viewer,DSMatExtra[i]);CHKERRQ(ierr); } if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_X);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_NEP" PetscErrorCode DSVectors_NEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm) { PetscFunctionBegin; if (rnorm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); switch (mat) { case DS_MAT_X: break; case DS_MAT_Y: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSNormalize_NEP" PetscErrorCode DSNormalize_NEP(DS ds,DSMatType mat,PetscInt col) { PetscErrorCode ierr; PetscInt i,i0,i1; PetscBLASInt ld,n,one = 1; PetscScalar norm,*x; PetscFunctionBegin; switch (mat) { case DS_MAT_X: break; case DS_MAT_Y: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSGetArray(ds,mat,&x);CHKERRQ(ierr); if (col < 0) { i0 = 0; i1 = ds->n; } else { i0 = col; i1 = col+1; } for (i=i0;ild; PetscScalar *A; PetscFunctionBegin; if (!ds->comparison) PetscFunctionReturn(0); n = ds->n; l = ds->l; A = ds->mat[DS_MAT_A]; perm = ds->perm; for (i=l;imat[DS_MAT_A]) { ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); } if (!ds->mat[DS_MAT_B]) { ierr = DSAllocateMat_Private(ds,DS_MAT_B);CHKERRQ(ierr); } if (!ds->mat[DS_MAT_W]) { ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); } ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscBLASIntCast(2*ds->n+2*ds->n,&lwork);CHKERRQ(ierr); ierr = PetscBLASIntCast(8*ds->n,&lrwork);CHKERRQ(ierr); #else ierr = PetscBLASIntCast(3*ds->n+8*ds->n,&lwork);CHKERRQ(ierr); #endif ierr = DSAllocateWork_Private(ds,lwork,lrwork,0);CHKERRQ(ierr); alpha = ds->work; beta = ds->work + ds->n; #if defined(PETSC_USE_COMPLEX) work = ds->work + 2*ds->n; lwork -= 2*ds->n; #else alphai = ds->work + 2*ds->n; work = ds->work + 3*ds->n; lwork -= 3*ds->n; #endif A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; W = ds->mat[DS_MAT_W]; X = ds->mat[DS_MAT_X]; sigma = 0.0; lambda = sigma; tol = 1000*n*PETSC_MACHINE_EPSILON; for (it=0;itrwork; PetscStackCallBLAS("LAPACKggev",LAPACKggev_("N","V",&n,A,&ld,B,&ld,alpha,beta,NULL,&ld,W,&ld,work,&lwork,rwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack ZGGEV %d",info); #else PetscStackCallBLAS("LAPACKggev",LAPACKggev_("N","V",&n,A,&ld,B,&ld,alpha,alphai,beta,NULL,&ld,W,&ld,work,&lwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DGGEV %d",info); #endif /* find smallest eigenvalue */ j = 0; if (beta[j]==0.0) re = (PetscRealPart(alpha[j])>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else re = alpha[j]/beta[j]; #if !defined(PETSC_USE_COMPLEX) if (beta[j]==0.0) im = (alphai[j]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else im = alphai[j]/beta[j]; #endif pos = 0; for (j=1;j0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else re2 = alpha[j]/beta[j]; #if !defined(PETSC_USE_COMPLEX) if (beta[j]==0.0) im2 = (alphai[j]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else im2 = alphai[j]/beta[j]; ierr = SlepcCompareSmallestMagnitude(re,im,re2,im2,&result,NULL);CHKERRQ(ierr); #else ierr = SlepcCompareSmallestMagnitude(re,0.0,re2,0.0,&result,NULL);CHKERRQ(ierr); #endif if (result > 0) { re = re2; #if !defined(PETSC_USE_COMPLEX) im = im2; #endif pos = j; } } #if !defined(PETSC_USE_COMPLEX) if (im!=0.0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"DSNEP found a complex eigenvalue; try rerunning with complex scalars"); #endif mu = alpha[pos]; ierr = PetscMemcpy(X,W+pos*ld,n*sizeof(PetscScalar));CHKERRQ(ierr); norm = BLASnrm2_(&n,X,&one); norm = 1.0/norm; PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,X,&one)); /* correct eigenvalue approximation */ lambda = lambda - mu; if (PetscAbsScalar(mu)<=tol) break; } wr[0] = lambda; if (wi) wi[0] = 0.0; if (it==maxit) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_CONV_FAILED,"DSNEP did not converge"); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSCreate_NEP" PETSC_EXTERN PetscErrorCode DSCreate_NEP(DS ds) { PetscFunctionBegin; ds->ops->allocate = DSAllocate_NEP; ds->ops->view = DSView_NEP; ds->ops->vectors = DSVectors_NEP; ds->ops->solve[0] = DSSolve_NEP_SLP; ds->ops->sort = DSSort_NEP; ds->ops->normalize = DSNormalize_NEP; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/gnhep/0000755000175000017500000000000012214143515017055 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/gnhep/makefile0000644000175000017500000000213512211062077020556 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dsgnhep.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/gnhep/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/gnhep/makefile.html0000644000175000017500000000372612211062077021530 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dsgnhep.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/gnhep/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/gnhep/index.html0000644000175000017500000000125012211062077021050 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dsgnhep.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/gnhep/dsgnhep.c0000644000175000017500000005355312211062077020664 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include /* 1) Patterns of A and B DS_STATE_RAW: DS_STATE_INTERM/CONDENSED 0 n-1 0 n-1 ------------- ------------- 0 |* * * * * *| 0 |* * * * * *| |* * * * * *| | * * * * *| |* * * * * *| | * * * *| |* * * * * *| | * * * *| |* * * * * *| | * *| n-1 |* * * * * *| n-1 | *| ------------- ------------- 2) Moreover, P and Q are assumed to be the identity in DS_STATE_INTERMEDIATE. */ static PetscErrorCode CleanDenseSchur(PetscInt n,PetscInt k,PetscScalar *S,PetscInt ldS,PetscScalar *T,PetscInt ldT,PetscScalar *X,PetscInt ldX,PetscScalar *Y,PetscInt ldY,PetscBool doProd); #undef __FUNCT__ #define __FUNCT__ "DSAllocate_GNHEP" PetscErrorCode DSAllocate_GNHEP(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_B);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_Z);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView_GNHEP" PetscErrorCode DSView_GNHEP(DS ds,PetscViewer viewer) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSViewMat_Private(ds,viewer,DS_MAT_A);CHKERRQ(ierr); ierr = DSViewMat_Private(ds,viewer,DS_MAT_B);CHKERRQ(ierr); if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Z);CHKERRQ(ierr); ierr = DSViewMat_Private(ds,viewer,DS_MAT_Q);CHKERRQ(ierr); } if (ds->mat[DS_MAT_X]) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_X);CHKERRQ(ierr); } if (ds->mat[DS_MAT_Y]) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_GNHEP_Eigen_Some" PetscErrorCode DSVectors_GNHEP_Eigen_Some(DS ds,PetscInt *k,PetscBool left) { #if defined(SLEPC_MISSING_LAPACK_TGEVC) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGEVC - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; PetscBLASInt n,ld,mout,info,*select,mm; PetscScalar *X,*Y,*A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B],fone=1.0,fzero=0.0; PetscBool iscomplex = PETSC_FALSE; const char *side; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); if (left) { X = NULL; Y = &ds->mat[DS_MAT_Y][ld*(*k)]; side = "L"; } else { X = &ds->mat[DS_MAT_X][ld*(*k)]; Y = NULL; side = "R"; } ierr = DSAllocateWork_Private(ds,0,0,ld);CHKERRQ(ierr); select = ds->iwork; for (i=0;istate <= DS_STATE_INTERMEDIATE) { ierr = DSSetIdentity(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = DSSetIdentity(ds,DS_MAT_Z);CHKERRQ(ierr); } ierr = CleanDenseSchur(n,0,A,ld,B,ld,ds->mat[DS_MAT_Q],ld,ds->mat[DS_MAT_Z],ld,PETSC_TRUE);CHKERRQ(ierr); if (ds->state < DS_STATE_CONDENSED) { ierr = DSSetState(ds,DS_STATE_CONDENSED);CHKERRQ(ierr); } #if defined(PETSC_USE_COMPLEX) mm = 1; ierr = DSAllocateWork_Private(ds,2*ld,2*ld,0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,"S",select,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&mm,&mout,ds->work,ds->rwork,&info)); #else if ((*k)work,&info)); #endif if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTGEVC %i",info); if (select[(*k)] == 0 || mout != mm) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"Unsupported the computation of the second vector in a complex pair"); /* Backtransform: (X/Y) <- (Q/Z) * (X/Y) */ ierr = PetscMemcpy(ds->work,left?Y:X,mm*ld*sizeof(PetscScalar));CHKERRQ(ierr); PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&mm,&n,&fone,ds->mat[left?DS_MAT_Z:DS_MAT_Q],&ld,ds->work,&ld,&fzero,left?Y:X,&ld)); /* Update k to the last vector index in the conjugate pair */ if (iscomplex) (*k)++; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSVectors_GNHEP_Eigen_All" PetscErrorCode DSVectors_GNHEP_Eigen_All(DS ds,PetscBool left) { #if defined(SLEPC_MISSING_LAPACK_TGEVC) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGEVC - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscBLASInt n,ld,mout,info; PetscScalar *X,*Y,*A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B]; const char *side,*back; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); if (left) { X = NULL; Y = ds->mat[DS_MAT_Y]; side = "L"; } else { X = ds->mat[DS_MAT_X]; Y = NULL; side = "R"; } if (ds->state <= DS_STATE_INTERMEDIATE) { ierr = DSSetIdentity(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = DSSetIdentity(ds,DS_MAT_Z);CHKERRQ(ierr); } ierr = CleanDenseSchur(n,0,A,ld,B,ld,ds->mat[DS_MAT_Q],ld,ds->mat[DS_MAT_Z],ld,PETSC_TRUE);CHKERRQ(ierr); if (ds->state>=DS_STATE_CONDENSED) { /* DSSolve() has been called, backtransform with matrix Q */ back = "B"; ierr = PetscMemcpy(left?Y:X,ds->mat[left?DS_MAT_Z:DS_MAT_Q],ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { back = "A"; ierr = DSSetState(ds,DS_STATE_CONDENSED);CHKERRQ(ierr); } #if defined(PETSC_USE_COMPLEX) ierr = DSAllocateWork_Private(ds,2*ld,2*ld,0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,back,NULL,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,ds->rwork,&info)); #else ierr = DSAllocateWork_Private(ds,6*ld,0,0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,back,NULL,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,&info)); #endif if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTGEVC %i",info); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSVectors_GNHEP" PetscErrorCode DSVectors_GNHEP(DS ds,DSMatType mat,PetscInt *k,PetscReal *rnorm) { PetscErrorCode ierr; PetscFunctionBegin; if (rnorm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); switch (mat) { case DS_MAT_X: case DS_MAT_Y: if (k) { ierr = DSVectors_GNHEP_Eigen_Some(ds,k,mat == DS_MAT_Y?PETSC_TRUE:PETSC_FALSE);CHKERRQ(ierr); } else { ierr = DSVectors_GNHEP_Eigen_All(ds,mat == DS_MAT_Y?PETSC_TRUE:PETSC_FALSE);CHKERRQ(ierr); } break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSNormalize_GNHEP" PetscErrorCode DSNormalize_GNHEP(DS ds,DSMatType mat,PetscInt col) { PetscErrorCode ierr; PetscInt i,i0,i1; PetscBLASInt ld,n,one = 1; PetscScalar *A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B],norm,*x; #if !defined(PETSC_USE_COMPLEX) PetscScalar norm0; #endif PetscFunctionBegin; switch (mat) { case DS_MAT_X: case DS_MAT_Y: case DS_MAT_Q: case DS_MAT_Z: /* Supported matrices */ break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSGetArray(ds,mat,&x);CHKERRQ(ierr); if (col < 0) { i0 = 0; i1 = ds->n; } else if (col>0 && (A[ds->ld*(col-1)+col] != 0.0 || (B && B[ds->ld*(col-1)+col] != 0.0))) { i0 = col-1; i1 = col+1; } else { i0 = col; i1 = col+1; } for (i=i0;ild*i+i+1] != 0.0 || (B && B[ds->ld*i+i+1] != 0.0))) { norm = BLASnrm2_(&n,&x[ld*i],&one); norm0 = BLASnrm2_(&n,&x[ld*(i+1)],&one); norm = 1.0/SlepcAbsEigenvalue(norm,norm0); PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one)); PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*(i+1)],&one)); i++; } else #endif { norm = BLASnrm2_(&n,&x[ld*i],&one); norm = 1.0/norm; PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one)); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSort_GNHEP_Arbitrary" PetscErrorCode DSSort_GNHEP_Arbitrary(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k) { #if defined(SLEPC_MISSING_LAPACK_TGSEN) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGSEN - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; PetscBLASInt info,n,ld,mout,lwork,liwork,*iwork,*selection,zero_=0,true_=1; PetscScalar *S = ds->mat[DS_MAT_A],*T = ds->mat[DS_MAT_B],*Q = ds->mat[DS_MAT_Q],*Z = ds->mat[DS_MAT_Z],*work,*beta; PetscFunctionBegin; if (!ds->comparison) PetscFunctionReturn(0); ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) lwork = 4*n+16; #else lwork = 1; #endif liwork = 1; ierr = DSAllocateWork_Private(ds,lwork+2*n,0,liwork+n);CHKERRQ(ierr); beta = ds->work; work = ds->work + n; lwork = ds->lwork - n; selection = ds->iwork; iwork = ds->iwork + n; liwork = ds->liwork - n; /* Compute the selected eigenvalue to be in the leading position */ ierr = DSSortEigenvalues_Private(ds,rr,ri,ds->perm,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscMemzero(selection,n*sizeof(PetscBLASInt));CHKERRQ(ierr); for (i=0; i<*k; i++) selection[ds->perm[i]] = 1; #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKtgsen",LAPACKtgsen_(&zero_,&true_,&true_,selection,&n,S,&ld,T,&ld,wr,wi,beta,Z,&ld,Q,&ld,&mout,NULL,NULL,NULL,work,&lwork,iwork,&liwork,&info)); #else PetscStackCallBLAS("LAPACKtgsen",LAPACKtgsen_(&zero_,&true_,&true_,selection,&n,S,&ld,T,&ld,wr,beta,Z,&ld,Q,&ld,&mout,NULL,NULL,NULL,work,&lwork,iwork,&liwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTGSEN %d",info); *k = mout; for (i=0;i0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else wr[i] /= beta[i]; #if !defined(PETSC_USE_COMPLEX) if (beta[i]==0.0) wi[i] = (wi[i]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else wi[i] /= beta[i]; #endif } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSSort_GNHEP_Total" PetscErrorCode DSSort_GNHEP_Total(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(SLEPC_MISSING_LAPACK_TGEXC) || !defined(PETSC_USE_COMPLEX) && (defined(SLEPC_MISSING_LAPACK_LAMCH) || defined(SLEPC_MISSING_LAPACK_LAG2)) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGEXC/LAMCH/LAG2 - Lapack routines are unavailable"); #else PetscErrorCode ierr; PetscScalar re; PetscInt i,j,pos,result; PetscBLASInt ifst,ilst,info,n,ld,one=1; PetscScalar *S = ds->mat[DS_MAT_A],*T = ds->mat[DS_MAT_B],*Z = ds->mat[DS_MAT_Z],*Q = ds->mat[DS_MAT_Q]; #if !defined(PETSC_USE_COMPLEX) PetscBLASInt lwork; PetscScalar *work,a,safmin,scale1,scale2,im; #endif PetscFunctionBegin; if (!ds->comparison) PetscFunctionReturn(0); ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) lwork = -1; PetscStackCallBLAS("LAPACKtgexc",LAPACKtgexc_(&one,&one,&ld,NULL,&ld,NULL,&ld,NULL,&ld,NULL,&ld,&one,&one,&a,&lwork,&info)); safmin = LAPACKlamch_("S"); lwork = a; ierr = DSAllocateWork_Private(ds,lwork,0,0);CHKERRQ(ierr); work = ds->work; #endif /* selection sort */ for (i=ds->l;icomparison)(re,im,wr[j],wi[j],&result,ds->comparisonctx);CHKERRQ(ierr); #else ierr = (*ds->comparison)(re,0.0,wr[j],0.0,&result,ds->comparisonctx);CHKERRQ(ierr); #endif if (result > 0) { re = wr[j]; #if !defined(PETSC_USE_COMPLEX) im = wi[j]; #endif pos = j; } #if !defined(PETSC_USE_COMPLEX) if (wi[j] != 0) j++; #endif } if (pos) { /* interchange blocks */ ierr = PetscBLASIntCast(pos+1,&ifst);CHKERRQ(ierr); ierr = PetscBLASIntCast(i+1,&ilst);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKtgexc",LAPACKtgexc_(&one,&one,&n,S,&ld,T,&ld,Z,&ld,Q,&ld,&ifst,&ilst,work,&lwork,&info)); #else PetscStackCallBLAS("LAPACKtgexc",LAPACKtgexc_(&one,&one,&n,S,&ld,T,&ld,Z,&ld,Q,&ld,&ifst,&ilst,&info)); #endif if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTGEXC %i",info); /* recover original eigenvalues from T and S matrices */ for (j=i;j0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else wr[j] = S[j*ld+j] / T[j*ld+j]; #if !defined(PETSC_USE_COMPLEX) wi[j] = 0.0; #endif } } } #if !defined(PETSC_USE_COMPLEX) if (wi[i] != 0.0) i++; #endif } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSSort_GNHEP" PetscErrorCode DSSort_GNHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k) { PetscErrorCode ierr; PetscFunctionBegin; if (!rr || wr == rr) { ierr = DSSort_GNHEP_Total(ds,wr,wi);CHKERRQ(ierr); } else { ierr = DSSort_GNHEP_Arbitrary(ds,wr,wi,rr,ri,k);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "CleanDenseSchur" /* Write zeros from the column k to n in the lower triangular part of the matrices S and T, and inside 2-by-2 diagonal blocks of T in order to make (S,T) a valid Schur decompositon. */ static PetscErrorCode CleanDenseSchur(PetscInt n,PetscInt k,PetscScalar *S,PetscInt ldS,PetscScalar *T,PetscInt ldT,PetscScalar *X,PetscInt ldX,PetscScalar *Y,PetscInt ldY,PetscBool doProd) { #if defined(SLEPC_MISSING_LAPACK_LASV2) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LASV2 - Lapack routine is unavailable"); #else PetscInt i,j; #if defined(PETSC_USE_COMPLEX) PetscScalar s; #else PetscErrorCode ierr; PetscBLASInt ldS_,ldT_,n_i,n_i_2,one=1,n_,i_2,i_; PetscScalar b11,b22,sr,cr,sl,cl; #endif PetscFunctionBegin; if (!doProd && X) { for (i=0;imat[DS_MAT_A],*B = ds->mat[DS_MAT_B],*Z = ds->mat[DS_MAT_Z],*Q = ds->mat[DS_MAT_Q]; PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) PetscValidPointer(wi,3); #endif ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); lwork = -1; #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,wi,NULL,Z,&ld,Q,&ld,&a,&lwork,NULL,&info)); lwork = (PetscBLASInt)a; ierr = DSAllocateWork_Private(ds,lwork+ld,0,0);CHKERRQ(ierr); beta = ds->work; work = beta+ds->n; ierr = PetscBLASIntCast(ds->lwork-ds->n,&lwork);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,wi,beta,Z,&ld,Q,&ld,work,&lwork,NULL,&info)); #else PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,NULL,Z,&ld,Q,&ld,&a,&lwork,NULL,NULL,&info)); lwork = (PetscBLASInt)PetscRealPart(a); ierr = DSAllocateWork_Private(ds,lwork+ld,8*ld,0);CHKERRQ(ierr); beta = ds->work; work = beta+ds->n; ierr = PetscBLASIntCast(ds->lwork-ds->n,&lwork);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,beta,Z,&ld,Q,&ld,work,&lwork,ds->rwork,NULL,&info)); #endif if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xGGES %i",info); for (i=0;i0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else wr[i] /= beta[i]; #if !defined(PETSC_USE_COMPLEX) if (beta[i]==0.0) wi[i] = (wi[i]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL; else wi[i] /= beta[i]; #else if (wi) wi[i] = 0.0; #endif } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSCreate_GNHEP" PETSC_EXTERN PetscErrorCode DSCreate_GNHEP(DS ds) { PetscFunctionBegin; ds->ops->allocate = DSAllocate_GNHEP; ds->ops->view = DSView_GNHEP; ds->ops->vectors = DSVectors_GNHEP; ds->ops->solve[0] = DSSolve_GNHEP; ds->ops->sort = DSSort_GNHEP; ds->ops->normalize = DSNormalize_GNHEP; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/gnhep/dsgnhep.c.html0000644000175000017500000013265512211062077021630 0ustar gladkgladk

Actual source code: dsgnhep.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 25: /*
 26:   1) Patterns of A and B
 27:       DS_STATE_RAW:       DS_STATE_INTERM/CONDENSED
 28:        0       n-1              0       n-1
 29:       -------------            -------------
 30:     0 |* * * * * *|          0 |* * * * * *|
 31:       |* * * * * *|            |  * * * * *|
 32:       |* * * * * *|            |    * * * *|
 33:       |* * * * * *|            |    * * * *|
 34:       |* * * * * *|            |        * *|
 35:   n-1 |* * * * * *|        n-1 |          *|
 36:       -------------            -------------

 38:   2) Moreover, P and Q are assumed to be the identity in DS_STATE_INTERMEDIATE.
 39: */


 42: static PetscErrorCode CleanDenseSchur(PetscInt n,PetscInt k,PetscScalar *S,PetscInt ldS,PetscScalar *T,PetscInt ldT,PetscScalar *X,PetscInt ldX,PetscScalar *Y,PetscInt ldY,PetscBool doProd);

 46: PetscErrorCode DSAllocate_GNHEP(DS ds,PetscInt ld)
 47: {

 51:   DSAllocateMat_Private(ds,DS_MAT_A);
 52:   DSAllocateMat_Private(ds,DS_MAT_B);
 53:   DSAllocateMat_Private(ds,DS_MAT_Z);
 54:   DSAllocateMat_Private(ds,DS_MAT_Q);
 55:   PetscFree(ds->perm);
 56:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 57:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 58:   return(0);
 59: }

 63: PetscErrorCode DSView_GNHEP(DS ds,PetscViewer viewer)
 64: {

 68:   DSViewMat_Private(ds,viewer,DS_MAT_A);
 69:   DSViewMat_Private(ds,viewer,DS_MAT_B);
 70:   if (ds->state>DS_STATE_INTERMEDIATE) {
 71:     DSViewMat_Private(ds,viewer,DS_MAT_Z);
 72:     DSViewMat_Private(ds,viewer,DS_MAT_Q);
 73:   }
 74:   if (ds->mat[DS_MAT_X]) {
 75:     DSViewMat_Private(ds,viewer,DS_MAT_X);
 76:   }
 77:   if (ds->mat[DS_MAT_Y]) {
 78:     DSViewMat_Private(ds,viewer,DS_MAT_Y);
 79:   }
 80:   return(0);
 81: }

 85: PetscErrorCode DSVectors_GNHEP_Eigen_Some(DS ds,PetscInt *k,PetscBool left)
 86: {
 87: #if defined(SLEPC_MISSING_LAPACK_TGEVC)
 89:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGEVC - Lapack routine is unavailable");
 90: #else
 92:   PetscInt       i;
 93:   PetscBLASInt   n,ld,mout,info,*select,mm;
 94:   PetscScalar    *X,*Y,*A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B],fone=1.0,fzero=0.0;
 95:   PetscBool      iscomplex = PETSC_FALSE;
 96:   const char     *side;

 99:   PetscBLASIntCast(ds->n,&n);
100:   PetscBLASIntCast(ds->ld,&ld);
101:   if (left) {
102:     X = NULL;
103:     Y = &ds->mat[DS_MAT_Y][ld*(*k)];
104:     side = "L";
105:   } else {
106:     X = &ds->mat[DS_MAT_X][ld*(*k)];
107:     Y = NULL;
108:     side = "R";
109:   }
110:   DSAllocateWork_Private(ds,0,0,ld);
111:   select = ds->iwork;
112:   for (i=0;i<n;i++) select[i] = 0;
113:   select[*k] = 1;
114:   if (ds->state <= DS_STATE_INTERMEDIATE) {
115:     DSSetIdentity(ds,DS_MAT_Q);
116:     DSSetIdentity(ds,DS_MAT_Z);
117:   }
118:   CleanDenseSchur(n,0,A,ld,B,ld,ds->mat[DS_MAT_Q],ld,ds->mat[DS_MAT_Z],ld,PETSC_TRUE);
119:   if (ds->state < DS_STATE_CONDENSED) {
120:     DSSetState(ds,DS_STATE_CONDENSED);
121:   }
122: #if defined(PETSC_USE_COMPLEX)
123:   mm = 1;
124:   DSAllocateWork_Private(ds,2*ld,2*ld,0);
125:   PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,"S",select,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&mm,&mout,ds->work,ds->rwork,&info));
126: #else
127:   if ((*k)<n-1 && (A[ld*(*k)+(*k)+1] != 0.0 || B[ld*(*k)+(*k)+1] != 0.0)) iscomplex = PETSC_TRUE;
128:   mm = iscomplex ? 2 : 1;
129:   DSAllocateWork_Private(ds,6*ld,0,0);
130:   PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,"S",select,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&mm,&mout,ds->work,&info));
131: #endif
132:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTGEVC %i",info);
133:   if (select[(*k)] == 0 || mout != mm) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"Unsupported the computation of the second vector in a complex pair");
134:   /* Backtransform: (X/Y) <- (Q/Z) * (X/Y) */
135:   PetscMemcpy(ds->work,left?Y:X,mm*ld*sizeof(PetscScalar));
136:   PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&mm,&n,&fone,ds->mat[left?DS_MAT_Z:DS_MAT_Q],&ld,ds->work,&ld,&fzero,left?Y:X,&ld));
137:   /* Update k to the last vector index in the conjugate pair */
138:   if (iscomplex) (*k)++;
139:   return(0);
140: #endif
141: }

145: PetscErrorCode DSVectors_GNHEP_Eigen_All(DS ds,PetscBool left)
146: {
147: #if defined(SLEPC_MISSING_LAPACK_TGEVC)
149:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGEVC - Lapack routine is unavailable");
150: #else
152:   PetscBLASInt   n,ld,mout,info;
153:   PetscScalar    *X,*Y,*A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B];
154:   const char     *side,*back;

157:   PetscBLASIntCast(ds->n,&n);
158:   PetscBLASIntCast(ds->ld,&ld);
159:   if (left) {
160:     X = NULL;
161:     Y = ds->mat[DS_MAT_Y];
162:     side = "L";
163:   } else {
164:     X = ds->mat[DS_MAT_X];
165:     Y = NULL;
166:     side = "R";
167:   }
168:   if (ds->state <= DS_STATE_INTERMEDIATE) {
169:     DSSetIdentity(ds,DS_MAT_Q);
170:     DSSetIdentity(ds,DS_MAT_Z);
171:   }
172:   CleanDenseSchur(n,0,A,ld,B,ld,ds->mat[DS_MAT_Q],ld,ds->mat[DS_MAT_Z],ld,PETSC_TRUE);
173:   if (ds->state>=DS_STATE_CONDENSED) {
174:     /* DSSolve() has been called, backtransform with matrix Q */
175:     back = "B";
176:     PetscMemcpy(left?Y:X,ds->mat[left?DS_MAT_Z:DS_MAT_Q],ld*ld*sizeof(PetscScalar));
177:   } else {
178:     back = "A";
179:     DSSetState(ds,DS_STATE_CONDENSED);
180:   }
181: #if defined(PETSC_USE_COMPLEX)
182:   DSAllocateWork_Private(ds,2*ld,2*ld,0);
183:   PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,back,NULL,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,ds->rwork,&info));
184: #else
185:   DSAllocateWork_Private(ds,6*ld,0,0);
186:   PetscStackCallBLAS("LAPACKtgevc",LAPACKtgevc_(side,back,NULL,&n,A,&ld,B,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,&info));
187: #endif
188:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTGEVC %i",info);
189:   return(0);
190: #endif
191: }

195: PetscErrorCode DSVectors_GNHEP(DS ds,DSMatType mat,PetscInt *k,PetscReal *rnorm)
196: {

200:   if (rnorm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
201:   switch (mat) {
202:     case DS_MAT_X:
203:     case DS_MAT_Y:
204:       if (k) {
205:         DSVectors_GNHEP_Eigen_Some(ds,k,mat == DS_MAT_Y?PETSC_TRUE:PETSC_FALSE);
206:       } else {
207:         DSVectors_GNHEP_Eigen_All(ds,mat == DS_MAT_Y?PETSC_TRUE:PETSC_FALSE);
208:       }
209:       break;
210:     default:
211:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
212:   }
213:   return(0);
214: }

218: PetscErrorCode DSNormalize_GNHEP(DS ds,DSMatType mat,PetscInt col)
219: {
221:   PetscInt       i,i0,i1;
222:   PetscBLASInt   ld,n,one = 1;
223:   PetscScalar    *A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B],norm,*x;
224: #if !defined(PETSC_USE_COMPLEX)
225:   PetscScalar    norm0;
226: #endif

229:   switch (mat) {
230:     case DS_MAT_X:
231:     case DS_MAT_Y:
232:     case DS_MAT_Q:
233:     case DS_MAT_Z:
234:       /* Supported matrices */
235:       break;
236:     case DS_MAT_U:
237:     case DS_MAT_VT:
238:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
239:       break;
240:     default:
241:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
242:   }

244:   PetscBLASIntCast(ds->n,&n);
245:   PetscBLASIntCast(ds->ld,&ld);
246:   DSGetArray(ds,mat,&x);
247:   if (col < 0) {
248:     i0 = 0; i1 = ds->n;
249:   } else if (col>0 && (A[ds->ld*(col-1)+col] != 0.0 || (B && B[ds->ld*(col-1)+col] != 0.0))) {
250:     i0 = col-1; i1 = col+1;
251:   } else {
252:     i0 = col; i1 = col+1;
253:   }
254:   for (i=i0;i<i1;i++) {
255: #if !defined(PETSC_USE_COMPLEX)
256:     if (i<n-1 && (A[ds->ld*i+i+1] != 0.0 || (B && B[ds->ld*i+i+1] != 0.0))) {
257:       norm = BLASnrm2_(&n,&x[ld*i],&one);
258:       norm0 = BLASnrm2_(&n,&x[ld*(i+1)],&one);
259:       norm = 1.0/SlepcAbsEigenvalue(norm,norm0);
260:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
261:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*(i+1)],&one));
262:       i++;
263:     } else
264: #endif
265:     {
266:       norm = BLASnrm2_(&n,&x[ld*i],&one);
267:       norm = 1.0/norm;
268:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
269:     }
270:   }
271:   return(0);
272: }

276: PetscErrorCode DSSort_GNHEP_Arbitrary(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
277: {
278: #if defined(SLEPC_MISSING_LAPACK_TGSEN)
280:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGSEN - Lapack routine is unavailable");
281: #else
283:   PetscInt       i;
284:   PetscBLASInt   info,n,ld,mout,lwork,liwork,*iwork,*selection,zero_=0,true_=1;
285:   PetscScalar    *S = ds->mat[DS_MAT_A],*T = ds->mat[DS_MAT_B],*Q = ds->mat[DS_MAT_Q],*Z = ds->mat[DS_MAT_Z],*work,*beta;

288:   if (!ds->comparison) return(0);
289:   PetscBLASIntCast(ds->n,&n);
290:   PetscBLASIntCast(ds->ld,&ld);
291: #if !defined(PETSC_USE_COMPLEX)
292:   lwork = 4*n+16;
293: #else
294:   lwork = 1;
295: #endif
296:   liwork = 1;
297:   DSAllocateWork_Private(ds,lwork+2*n,0,liwork+n);
298:   beta = ds->work;
299:   work = ds->work + n;
300:   lwork = ds->lwork - n;
301:   selection = ds->iwork;
302:   iwork = ds->iwork + n;
303:   liwork = ds->liwork - n;
304:   /* Compute the selected eigenvalue to be in the leading position */
305:   DSSortEigenvalues_Private(ds,rr,ri,ds->perm,PETSC_FALSE);
306:   PetscMemzero(selection,n*sizeof(PetscBLASInt));
307:   for (i=0; i<*k; i++) selection[ds->perm[i]] = 1;
308: #if !defined(PETSC_USE_COMPLEX)
309:   PetscStackCallBLAS("LAPACKtgsen",LAPACKtgsen_(&zero_,&true_,&true_,selection,&n,S,&ld,T,&ld,wr,wi,beta,Z,&ld,Q,&ld,&mout,NULL,NULL,NULL,work,&lwork,iwork,&liwork,&info));
310: #else
311:   PetscStackCallBLAS("LAPACKtgsen",LAPACKtgsen_(&zero_,&true_,&true_,selection,&n,S,&ld,T,&ld,wr,beta,Z,&ld,Q,&ld,&mout,NULL,NULL,NULL,work,&lwork,iwork,&liwork,&info));
312: #endif
313:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTGSEN %d",info);
314:   *k = mout;
315:   for (i=0;i<n;i++) {
316:     if (beta[i]==0.0) wr[i] = (PetscRealPart(wr[i])>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
317:     else wr[i] /= beta[i];
318: #if !defined(PETSC_USE_COMPLEX)
319:     if (beta[i]==0.0) wi[i] = (wi[i]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
320:     else wi[i] /= beta[i];
321: #endif
322:   }
323:   return(0);
324: #endif
325: }

329: PetscErrorCode DSSort_GNHEP_Total(DS ds,PetscScalar *wr,PetscScalar *wi)
330: {
331: #if defined(SLEPC_MISSING_LAPACK_TGEXC) || !defined(PETSC_USE_COMPLEX) && (defined(SLEPC_MISSING_LAPACK_LAMCH) || defined(SLEPC_MISSING_LAPACK_LAG2))
333:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TGEXC/LAMCH/LAG2 - Lapack routines are unavailable");
334: #else
336:   PetscScalar    re;
337:   PetscInt       i,j,pos,result;
338:   PetscBLASInt   ifst,ilst,info,n,ld,one=1;
339:   PetscScalar    *S = ds->mat[DS_MAT_A],*T = ds->mat[DS_MAT_B],*Z = ds->mat[DS_MAT_Z],*Q = ds->mat[DS_MAT_Q];
340: #if !defined(PETSC_USE_COMPLEX)
341:   PetscBLASInt   lwork;
342:   PetscScalar    *work,a,safmin,scale1,scale2,im;
343: #endif

346:   if (!ds->comparison) return(0);
347:   PetscBLASIntCast(ds->n,&n);
348:   PetscBLASIntCast(ds->ld,&ld);
349: #if !defined(PETSC_USE_COMPLEX)
350:   lwork = -1;
351:   PetscStackCallBLAS("LAPACKtgexc",LAPACKtgexc_(&one,&one,&ld,NULL,&ld,NULL,&ld,NULL,&ld,NULL,&ld,&one,&one,&a,&lwork,&info));
352:   safmin = LAPACKlamch_("S");
353:   lwork = a;
354:   DSAllocateWork_Private(ds,lwork,0,0);
355:   work = ds->work;
356: #endif
357:   /* selection sort */
358:   for (i=ds->l;i<n-1;i++) {
359:     re = wr[i];
360: #if !defined(PETSC_USE_COMPLEX)
361:     im = wi[i];
362: #endif
363:     pos = 0;
364:     j = i+1; /* j points to the next eigenvalue */
365: #if !defined(PETSC_USE_COMPLEX)
366:     if (im != 0) j=i+2;
367: #endif
368:     /* find minimum eigenvalue */
369:     for (;j<n;j++) {
370: #if !defined(PETSC_USE_COMPLEX)
371:       (*ds->comparison)(re,im,wr[j],wi[j],&result,ds->comparisonctx);
372: #else
373:       (*ds->comparison)(re,0.0,wr[j],0.0,&result,ds->comparisonctx);
374: #endif
375:       if (result > 0) {
376:         re = wr[j];
377: #if !defined(PETSC_USE_COMPLEX)
378:         im = wi[j];
379: #endif
380:         pos = j;
381:       }
382: #if !defined(PETSC_USE_COMPLEX)
383:       if (wi[j] != 0) j++;
384: #endif
385:     }
386:     if (pos) {
387:       /* interchange blocks */
388:       PetscBLASIntCast(pos+1,&ifst);
389:       PetscBLASIntCast(i+1,&ilst);
390: #if !defined(PETSC_USE_COMPLEX)
391:       PetscStackCallBLAS("LAPACKtgexc",LAPACKtgexc_(&one,&one,&n,S,&ld,T,&ld,Z,&ld,Q,&ld,&ifst,&ilst,work,&lwork,&info));
392: #else
393:       PetscStackCallBLAS("LAPACKtgexc",LAPACKtgexc_(&one,&one,&n,S,&ld,T,&ld,Z,&ld,Q,&ld,&ifst,&ilst,&info));
394: #endif
395:       if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTGEXC %i",info);
396:       /* recover original eigenvalues from T and S matrices */
397:       for (j=i;j<n;j++) {
398: #if !defined(PETSC_USE_COMPLEX)
399:         if (j<n-1 && S[j*ld+j+1] != 0.0) {
400:           /* complex conjugate eigenvalue */
401:           PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(S+j*ld+j,&ld,T+j*ld+j,&ld,&safmin,&scale1,&scale2,&re,&a,&im));
402:           wr[j] = re / scale1;
403:           wi[j] = im / scale1;
404:           wr[j+1] = a / scale2;
405:           wi[j+1] = -wi[j];
406:           j++;
407:         } else
408: #endif
409:         {
410:           if (T[j*ld+j] == 0.0) wr[j] = (PetscRealPart(S[j*ld+j])>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
411:           else wr[j] = S[j*ld+j] / T[j*ld+j];
412: #if !defined(PETSC_USE_COMPLEX)
413:           wi[j] = 0.0;
414: #endif
415:         }
416:       }
417:     }
418: #if !defined(PETSC_USE_COMPLEX)
419:     if (wi[i] != 0.0) i++;
420: #endif
421:   }
422:   return(0);
423: #endif
424: }

428: PetscErrorCode DSSort_GNHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
429: {

433:   if (!rr || wr == rr) {
434:     DSSort_GNHEP_Total(ds,wr,wi);
435:   } else {
436:     DSSort_GNHEP_Arbitrary(ds,wr,wi,rr,ri,k);
437:   }
438:   return(0);
439: }

443: /*
444:    Write zeros from the column k to n in the lower triangular part of the
445:    matrices S and T, and inside 2-by-2 diagonal blocks of T in order to
446:    make (S,T) a valid Schur decompositon.
447: */
448: static PetscErrorCode CleanDenseSchur(PetscInt n,PetscInt k,PetscScalar *S,PetscInt ldS,PetscScalar *T,PetscInt ldT,PetscScalar *X,PetscInt ldX,PetscScalar *Y,PetscInt ldY,PetscBool doProd)
449: {
450: #if defined(SLEPC_MISSING_LAPACK_LASV2)
452:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LASV2 - Lapack routine is unavailable");
453: #else
454:   PetscInt       i,j;
455: #if defined(PETSC_USE_COMPLEX)
456:   PetscScalar    s;
457: #else
459:   PetscBLASInt   ldS_,ldT_,n_i,n_i_2,one=1,n_,i_2,i_;
460:   PetscScalar    b11,b22,sr,cr,sl,cl;
461: #endif

464:   if (!doProd && X) {
465:     for (i=0;i<n;i++) for (j=0;j<n;j++) X[ldX*i+j] = 0.0;
466:     for (i=0;i<n;i++) X[ldX*i+i] = 1.0;
467:   }
468:   if (!doProd && Y) {
469:     for (i=0;i<n;i++) for (j=0;j<n;j++) Y[ldY*i+j] = 0.0;
470:     for (i=0;i<n;i++) Y[ldX*i+i] = 1.0;
471:   }

473: #if defined(PETSC_USE_COMPLEX)
474:   for (i=k; i<n; i++) {
475:     /* Some functions need the diagonal elements in T be real */
476:     if (T && PetscImaginaryPart(T[ldT*i+i]) != 0.0) {
477:       s = PetscConj(T[ldT*i+i])/PetscAbsScalar(T[ldT*i+i]);
478:       for (j=0;j<=i;j++) {
479:         T[ldT*i+j] *= s;
480:         S[ldS*i+j] *= s;
481:       }
482:       T[ldT*i+i] = PetscRealPart(T[ldT*i+i]);
483:       if (X) for (j=0;j<n;j++) X[ldX*i+j] *= s;
484:     }
485:     j = i+1;
486:     if (j<n) {
487:       S[ldS*i+j] = 0.0;
488:       if (T) T[ldT*i+j] = 0.0;
489:     }
490:   }
491: #else
492:   PetscBLASIntCast(ldS,&ldS_);
493:   PetscBLASIntCast(ldT,&ldT_);
494:   PetscBLASIntCast(n,&n_);
495:   for (i=k;i<n-1;i++) {
496:     if (S[ldS*i+i+1] != 0.0) {
497:       /* Check if T(i+1,i) and T(i,i+1) are zero */
498:       if (T[ldT*(i+1)+i] != 0.0 || T[ldT*i+i+1] != 0.0) {
499:         /* Check if T(i+1,i) and T(i,i+1) are negligible */
500:         if (PetscAbs(T[ldT*(i+1)+i])+PetscAbs(T[ldT*i+i+1]) < (PetscAbs(T[ldT*i+i])+PetscAbs(T[ldT*(i+1)+i+1]))*PETSC_MACHINE_EPSILON) {
501:           T[ldT*i+i+1] = 0.0;
502:           T[ldT*(i+1)+i] = 0.0;

504:         } else {
505:           /* If one of T(i+1,i) or T(i,i+1) is negligible, we make zero the other element */
506:           if (PetscAbs(T[ldT*i+i+1]) < (PetscAbs(T[ldT*i+i])+PetscAbs(T[ldT*(i+1)+i+1])+PetscAbs(T[ldT*(i+1)+i]))*PETSC_MACHINE_EPSILON) {
507:             PetscStackCallBLAS("LAPACKlasv2",LAPACKlasv2_(&T[ldT*i+i],&T[ldT*(i+1)+i],&T[ldT*(i+1)+i+1],&b22,&b11,&sl,&cl,&sr,&cr));
508:           } else if (PetscAbs(T[ldT*(i+1)+i]) < (PetscAbs(T[ldT*i+i])+PetscAbs(T[ldT*(i+1)+i+1])+PetscAbs(T[ldT*i+i+1]))*PETSC_MACHINE_EPSILON) {
509:             PetscStackCallBLAS("LAPACKlasv2",LAPACKlasv2_(&T[ldT*i+i],&T[ldT*i+i+1],&T[ldT*(i+1)+i+1],&b22,&b11,&sr,&cr,&sl,&cl));
510:           } else {
511:             SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported format. Call DSSolve before this function");
512:           }
513:           PetscBLASIntCast(n-i,&n_i);
514:           n_i_2 = n_i - 2;
515:           PetscBLASIntCast(i+2,&i_2);
516:           PetscBLASIntCast(i,&i_);
517:           if (b11 < 0.0) {
518:             cr  = -cr;
519:             sr  = -sr;
520:             b11 = -b11;
521:             b22 = -b22;
522:           }
523:           PetscStackCallBLAS("BLASrot",BLASrot_(&n_i,&S[ldS*i+i],&ldS_,&S[ldS*i+i+1],&ldS_,&cl,&sl));
524:           PetscStackCallBLAS("BLASrot",BLASrot_(&i_2,&S[ldS*i],&one,&S[ldS*(i+1)],&one,&cr,&sr));
525:           PetscStackCallBLAS("BLASrot",BLASrot_(&n_i_2,&T[ldT*(i+2)+i],&ldT_,&T[ldT*(i+2)+i+1],&ldT_,&cl,&sl));
526:           PetscStackCallBLAS("BLASrot",BLASrot_(&i_,&T[ldT*i],&one,&T[ldT*(i+1)],&one,&cr,&sr));
527:           if (X) PetscStackCallBLAS("BLASrot",BLASrot_(&n_,&X[ldX*i],&one,&X[ldX*(i+1)],&one,&cr,&sr));
528:           if (Y) PetscStackCallBLAS("BLASrot",BLASrot_(&n_,&Y[ldY*i],&one,&Y[ldY*(i+1)],&one,&cl,&sl));
529:           T[ldT*i+i] = b11;
530:           T[ldT*i+i+1] = 0.0;
531:           T[ldT*(i+1)+i] = 0.0;
532:           T[ldT*(i+1)+i+1] = b22;
533:         }
534:       }
535:     i++;
536:     }
537:   }
538: #endif
539:   return(0);
540: #endif
541: }

545: PetscErrorCode DSSolve_GNHEP(DS ds,PetscScalar *wr,PetscScalar *wi)
546: {
547: #if defined(PETSC_MISSING_LAPACK_GGES)
549:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GGES - Lapack routines are unavailable");
550: #else
552:   PetscScalar    *work,*beta,a;
553:   PetscInt       i;
554:   PetscBLASInt   lwork,info,n,ld,iaux;
555:   PetscScalar    *A = ds->mat[DS_MAT_A],*B = ds->mat[DS_MAT_B],*Z = ds->mat[DS_MAT_Z],*Q = ds->mat[DS_MAT_Q];

558: #if !defined(PETSC_USE_COMPLEX)
560: #endif
561:   PetscBLASIntCast(ds->n,&n);
562:   PetscBLASIntCast(ds->ld,&ld);
563:   lwork = -1;
564: #if !defined(PETSC_USE_COMPLEX)
565:   PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,wi,NULL,Z,&ld,Q,&ld,&a,&lwork,NULL,&info));
566:   lwork = (PetscBLASInt)a;
567:   DSAllocateWork_Private(ds,lwork+ld,0,0);
568:   beta = ds->work;
569:   work = beta+ds->n;
570:   PetscBLASIntCast(ds->lwork-ds->n,&lwork);
571:   PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,wi,beta,Z,&ld,Q,&ld,work,&lwork,NULL,&info));
572: #else
573:   PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,NULL,Z,&ld,Q,&ld,&a,&lwork,NULL,NULL,&info));
574:   lwork = (PetscBLASInt)PetscRealPart(a);
575:   DSAllocateWork_Private(ds,lwork+ld,8*ld,0);
576:   beta = ds->work;
577:   work = beta+ds->n;
578:   PetscBLASIntCast(ds->lwork-ds->n,&lwork);
579:   PetscStackCallBLAS("LAPACKgges",LAPACKgges_("V","V","N",NULL,&n,A,&ld,B,&ld,&iaux,wr,beta,Z,&ld,Q,&ld,work,&lwork,ds->rwork,NULL,&info));
580: #endif
581:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xGGES %i",info);
582:   for (i=0;i<n;i++) {
583:     if (beta[i]==0.0) wr[i] = (PetscRealPart(wr[i])>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
584:     else wr[i] /= beta[i];
585: #if !defined(PETSC_USE_COMPLEX)
586:     if (beta[i]==0.0) wi[i] = (wi[i]>0.0)? PETSC_MAX_REAL: PETSC_MIN_REAL;
587:     else wi[i] /= beta[i];
588: #else
589:     if (wi) wi[i] = 0.0;
590: #endif
591:   }
592:   return(0);
593: #endif
594: }

598: PETSC_EXTERN PetscErrorCode DSCreate_GNHEP(DS ds)
599: {
601:   ds->ops->allocate      = DSAllocate_GNHEP;
602:   ds->ops->view          = DSView_GNHEP;
603:   ds->ops->vectors       = DSVectors_GNHEP;
604:   ds->ops->solve[0]      = DSSolve_GNHEP;
605:   ds->ops->sort          = DSSort_GNHEP;
606:   ds->ops->normalize     = DSNormalize_GNHEP;
607:   return(0);
608: }

slepc-3.4.2.dfsg.orig/src/ds/impls/makefile0000644000175000017500000000207012211062077017453 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib LIBBASE = libslepc DIRS = hep nhep ghep ghiep gnhep svd nep LOCDIR = src/ds/impls/ MANSEC = DS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/makefile.html0000644000175000017500000000366112211062077020425 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

LIBBASE  = libslepc
DIRS     = hep nhep ghep ghiep gnhep svd nep
LOCDIR   = src/ds/impls/
MANSEC   = DS

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/index.html0000644000175000017500000000151512211062077017753 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

hep/
nhep/
ghep/
ghiep/
gnhep/
svd/
nep/
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/svd/0000755000175000017500000000000012211062077016550 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/svd/dssvd.c.html0000644000175000017500000005631612211062077021015 0ustar gladkgladk

Actual source code: dssvd.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 27: PetscErrorCode DSAllocate_SVD(DS ds,PetscInt ld)
 28: {

 32:   DSAllocateMat_Private(ds,DS_MAT_A);
 33:   DSAllocateMat_Private(ds,DS_MAT_U);
 34:   DSAllocateMat_Private(ds,DS_MAT_VT);
 35:   DSAllocateMatReal_Private(ds,DS_MAT_T);
 36:   PetscFree(ds->perm);
 37:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 38:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 39:   return(0);
 40: }

 42: /*   0       l           k                 n-1
 43:     -----------------------------------------
 44:     |*       ·           ·                  |
 45:     |  *     ·           ·                  |
 46:     |    *   ·           ·                  |
 47:     |      * ·           ·                  |
 48:     |        o           o                  |
 49:     |          o         o                  |
 50:     |            o       o                  |
 51:     |              o     o                  |
 52:     |                o   o                  |
 53:     |                  o o                  |
 54:     |                    o x                |
 55:     |                      x x              |
 56:     |                        x x            |
 57:     |                          x x          |
 58:     |                            x x        |
 59:     |                              x x      |
 60:     |                                x x    |
 61:     |                                  x x  |
 62:     |                                    x x|
 63:     |                                      x|
 64:     -----------------------------------------
 65: */

 69: static PetscErrorCode DSSwitchFormat_SVD(DS ds,PetscBool tocompact)
 70: {
 72:   PetscReal      *T = ds->rmat[DS_MAT_T];
 73:   PetscScalar    *A = ds->mat[DS_MAT_A];
 74:   PetscInt       i,m=ds->m,k=ds->k,ld=ds->ld;

 77:   if (!m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set");
 78:   if (tocompact) { /* switch from dense (arrow) to compact storage */
 79:     PetscMemzero(T,3*ld*sizeof(PetscReal));
 80:     for (i=0;i<k;i++) {
 81:       T[i] = PetscRealPart(A[i+i*ld]);
 82:       T[i+ld] = PetscRealPart(A[i+k*ld]);
 83:     }
 84:     for (i=k;i<m-1;i++) {
 85:       T[i] = PetscRealPart(A[i+i*ld]);
 86:       T[i+ld] = PetscRealPart(A[i+(i+1)*ld]);
 87:     }
 88:     T[m-1] = PetscRealPart(A[m-1+(m-1)*ld]);
 89:   } else { /* switch from compact (arrow) to dense storage */
 90:     PetscMemzero(A,ld*ld*sizeof(PetscScalar));
 91:     for (i=0;i<k;i++) {
 92:       A[i+i*ld] = T[i];
 93:       A[i+k*ld] = T[i+ld];
 94:     }
 95:     A[k+k*ld] = T[k];
 96:     for (i=k+1;i<m;i++) {
 97:       A[i+i*ld] = T[i];
 98:       A[i-1+i*ld] = T[i-1+ld];
 99:     }
100:   }
101:   return(0);
102: }

106: PetscErrorCode DSView_SVD(DS ds,PetscViewer viewer)
107: {
108:   PetscErrorCode    ierr;
109:   PetscViewerFormat format;
110:   PetscInt          i,j,r,c;
111:   PetscReal         value;

114:   PetscViewerGetFormat(viewer,&format);
115:   if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
116:     return(0);
117:   }
118:   if (ds->compact) {
119:     if (!ds->m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set");
120:     PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);
121:     if (format == PETSC_VIEWER_ASCII_MATLAB) {
122:       PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",ds->n,ds->m);
123:       PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",2*ds->n);
124:       PetscViewerASCIIPrintf(viewer,"zzz = [\n");
125:       for (i=0;i<PetscMin(ds->n,ds->m);i++) {
126:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_T]+i));
127:       }
128:       for (i=0;i<PetscMin(ds->n,ds->m)-1;i++) {
129:         r = PetscMax(i+2,ds->k+1);
130:         c = i+1;
131:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",c,r,*(ds->rmat[DS_MAT_T]+ds->ld+i));
132:       }
133:       PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(zzz);\n",DSMatName[DS_MAT_T]);
134:     } else {
135:       for (i=0;i<ds->n;i++) {
136:         for (j=0;j<ds->m;j++) {
137:           if (i==j) value = *(ds->rmat[DS_MAT_T]+i);
138:           else if (i<ds->k && j==ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+PetscMin(i,j));
139:           else if (i==j+1 && i>ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+i-1);
140:           else value = 0.0;
141:           PetscViewerASCIIPrintf(viewer," %18.16e ",value);
142:         }
143:         PetscViewerASCIIPrintf(viewer,"\n");
144:       }
145:     }
146:     PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);
147:     PetscViewerFlush(viewer);
148:   } else {
149:     DSViewMat_Private(ds,viewer,DS_MAT_A);
150:   }
151:   if (ds->state>DS_STATE_INTERMEDIATE) {
152:     DSViewMat_Private(ds,viewer,DS_MAT_U);
153:     DSViewMat_Private(ds,viewer,DS_MAT_VT);
154:   }
155:   return(0);
156: }

160: PetscErrorCode DSVectors_SVD(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
161: {
163:   switch (mat) {
164:     case DS_MAT_U:
165:     case DS_MAT_VT:
166:       break;
167:     default:
168:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
169:   }
170:   return(0);
171: }

175: PetscErrorCode DSSort_SVD(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
176: {
178:   PetscInt       n,l,i,*perm,ld=ds->ld;
179:   PetscScalar    *A;
180:   PetscReal      *d;

183:   if (!ds->comparison) return(0);
184:   l = ds->l;
185:   n = PetscMin(ds->n,ds->m);
186:   A  = ds->mat[DS_MAT_A];
187:   d = ds->rmat[DS_MAT_T];
188:   perm = ds->perm;
189:   if (!rr) {
190:     DSSortEigenvaluesReal_Private(ds,d,perm);
191:   } else {
192:     DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_FALSE);
193:   }
194:   for (i=l;i<n;i++) wr[i] = d[perm[i]];
195:   DSPermuteBoth_Private(ds,l,n,DS_MAT_U,DS_MAT_VT,perm);
196:   for (i=l;i<n;i++) d[i] = PetscRealPart(wr[i]);
197:   if (!ds->compact) {
198:     for (i=l;i<n;i++) A[i+i*ld] = wr[i];
199:   }
200:   return(0);
201: }

205: PetscErrorCode DSSolve_SVD_DC(DS ds,PetscScalar *wr,PetscScalar *wi)
206: {
207: #if defined(SLEPC_MISSING_LAPACK_GESDD) || defined(SLEPC_MISSING_LAPACK_BDSDC)
209:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GESDD/BDSDC - Lapack routines are unavailable");
210: #else
212:   PetscInt       i;
213:   PetscBLASInt   n1,n2,n3,m2,m3,info,l,n,m,nm,ld,off,lwork;
214:   PetscScalar    *A,*U,*VT,qwork;
215:   PetscReal      *d,*e,*Ur,*VTr;
216: #if defined(PETSC_USE_COMPLEX)
217:   PetscInt       j;
218: #endif

221:   PetscBLASIntCast(ds->n,&n);
222:   PetscBLASIntCast(ds->m,&m);
223:   PetscBLASIntCast(ds->l,&l);
224:   PetscBLASIntCast(ds->ld,&ld);
225:   PetscBLASIntCast(ds->k-l+1,&n1); /* size of leading block, excl. locked */
226:   PetscBLASIntCast(n-ds->k-1,&n2); /* size of trailing block */
227:   PetscBLASIntCast(m-ds->k-1,&m2);
228:   n3 = n1+n2;
229:   m3 = n1+m2;
230:   off = l+l*ld;
231:   A  = ds->mat[DS_MAT_A];
232:   U  = ds->mat[DS_MAT_U];
233:   VT = ds->mat[DS_MAT_VT];
234:   d  = ds->rmat[DS_MAT_T];
235:   e  = ds->rmat[DS_MAT_T]+ld;
236:   PetscMemzero(U,ld*ld*sizeof(PetscScalar));
237:   for (i=0;i<l;i++) U[i+i*ld] = 1.0;
238:   PetscMemzero(VT,ld*ld*sizeof(PetscScalar));
239:   for (i=0;i<l;i++) VT[i+i*ld] = 1.0;

241:   if (ds->state>DS_STATE_RAW) {
242:     /* Solve bidiagonal SVD problem */
243:     for (i=0;i<l;i++) wr[i] = d[i];
244:     DSAllocateWork_Private(ds,0,3*ld*ld+4*ld,8*ld);
245: #if defined(PETSC_USE_COMPLEX)
246:     DSAllocateMatReal_Private(ds,DS_MAT_U);
247:     DSAllocateMatReal_Private(ds,DS_MAT_VT);
248:     Ur  = ds->rmat[DS_MAT_U];
249:     VTr = ds->rmat[DS_MAT_VT];
250: #else
251:     Ur  = U;
252:     VTr = VT;
253: #endif
254:     PetscStackCallBLAS("LAPACKbdsdc",LAPACKbdsdc_("U","I",&n3,d+l,e+l,Ur+off,&ld,VTr+off,&ld,NULL,NULL,ds->rwork,ds->iwork,&info));
255:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xBDSDC %d",info);
256: #if defined(PETSC_USE_COMPLEX)
257:     for (i=l;i<n;i++) {
258:       for (j=0;j<n;j++) {
259:         U[i+j*ld] = Ur[i+j*ld];
260:         VT[i+j*ld] = VTr[i+j*ld];
261:       }
262:     }
263: #endif
264:   } else {
265:     /* Solve general rectangular SVD problem */
266:     if (ds->compact) { DSSwitchFormat_SVD(ds,PETSC_FALSE); }
267:     for (i=0;i<l;i++) wr[i] = d[i];
268:     nm = PetscMin(n,m);
269:     DSAllocateWork_Private(ds,0,0,8*nm);
270:     lwork = -1;
271: #if defined(PETSC_USE_COMPLEX)
272:     DSAllocateWork_Private(ds,0,5*nm*nm+7*nm,0);
273:     PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,&qwork,&lwork,ds->rwork,ds->iwork,&info));
274: #else
275:     PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,&qwork,&lwork,ds->iwork,&info));
276: #endif
277:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGESDD %d",info);
278:     lwork = (PetscBLASInt)PetscRealPart(qwork);
279:     DSAllocateWork_Private(ds,lwork,0,0);
280: #if defined(PETSC_USE_COMPLEX)
281:     PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,ds->work,&lwork,ds->rwork,ds->iwork,&info));
282: #else
283:     PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,ds->work,&lwork,ds->iwork,&info));
284: #endif
285:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGESDD %d",info);
286:   }
287:   for (i=l;i<PetscMin(ds->n,ds->m);i++) wr[i] = d[i];

289:   /* Create diagonal matrix as a result */
290:   if (ds->compact) {
291:     PetscMemzero(e,(n-1)*sizeof(PetscReal));
292:   } else {
293:     for (i=l;i<n;i++) {
294:       PetscMemzero(A+l+i*ld,(n-l)*sizeof(PetscScalar));
295:     }
296:     for (i=l;i<n;i++) A[i+i*ld] = d[i];
297:   }
298:   return(0);
299: #endif
300: }

304: PETSC_EXTERN PetscErrorCode DSCreate_SVD(DS ds)
305: {
307:   ds->ops->allocate      = DSAllocate_SVD;
308:   ds->ops->view          = DSView_SVD;
309:   ds->ops->vectors       = DSVectors_SVD;
310:   ds->ops->solve[0]      = DSSolve_SVD_DC;
311:   ds->ops->sort          = DSSort_SVD;
312:   return(0);
313: }

slepc-3.4.2.dfsg.orig/src/ds/impls/svd/makefile0000644000175000017500000000213112211062077020245 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dssvd.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/svd/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/svd/makefile.html0000644000175000017500000000372212211062077021217 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dssvd.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/svd/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/svd/index.html0000644000175000017500000000124412211062077020546 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dssvd.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/svd/dssvd.c0000644000175000017500000002655712211062077020056 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocate_SVD" PetscErrorCode DSAllocate_SVD(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_U);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_VT);CHKERRQ(ierr); ierr = DSAllocateMatReal_Private(ds,DS_MAT_T);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } /* 0 l k n-1 ----------------------------------------- |* · · | | * · · | | * · · | | * · · | | o o | | o o | | o o | | o o | | o o | | o o | | o x | | x x | | x x | | x x | | x x | | x x | | x x | | x x | | x x| | x| ----------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "DSSwitchFormat_SVD" static PetscErrorCode DSSwitchFormat_SVD(DS ds,PetscBool tocompact) { PetscErrorCode ierr; PetscReal *T = ds->rmat[DS_MAT_T]; PetscScalar *A = ds->mat[DS_MAT_A]; PetscInt i,m=ds->m,k=ds->k,ld=ds->ld; PetscFunctionBegin; if (!m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set"); if (tocompact) { /* switch from dense (arrow) to compact storage */ ierr = PetscMemzero(T,3*ld*sizeof(PetscReal));CHKERRQ(ierr); for (i=0;icompact) { if (!ds->m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set"); ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_MATLAB) { ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",ds->n,ds->m);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",2*ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr); for (i=0;in,ds->m);i++) { ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_T]+i));CHKERRQ(ierr); } for (i=0;in,ds->m)-1;i++) { r = PetscMax(i+2,ds->k+1); c = i+1; ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",c,r,*(ds->rmat[DS_MAT_T]+ds->ld+i));CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(zzz);\n",DSMatName[DS_MAT_T]);CHKERRQ(ierr); } else { for (i=0;in;i++) { for (j=0;jm;j++) { if (i==j) value = *(ds->rmat[DS_MAT_T]+i); else if (ik && j==ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+PetscMin(i,j)); else if (i==j+1 && i>ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+i-1); else value = 0.0; ierr = PetscViewerASCIIPrintf(viewer," %18.16e ",value);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } } ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerFlush(viewer);CHKERRQ(ierr); } else { ierr = DSViewMat_Private(ds,viewer,DS_MAT_A);CHKERRQ(ierr); } if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_U);CHKERRQ(ierr); ierr = DSViewMat_Private(ds,viewer,DS_MAT_VT);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_SVD" PetscErrorCode DSVectors_SVD(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm) { PetscFunctionBegin; switch (mat) { case DS_MAT_U: case DS_MAT_VT: break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSort_SVD" PetscErrorCode DSSort_SVD(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k) { PetscErrorCode ierr; PetscInt n,l,i,*perm,ld=ds->ld; PetscScalar *A; PetscReal *d; PetscFunctionBegin; if (!ds->comparison) PetscFunctionReturn(0); l = ds->l; n = PetscMin(ds->n,ds->m); A = ds->mat[DS_MAT_A]; d = ds->rmat[DS_MAT_T]; perm = ds->perm; if (!rr) { ierr = DSSortEigenvaluesReal_Private(ds,d,perm);CHKERRQ(ierr); } else { ierr = DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_FALSE);CHKERRQ(ierr); } for (i=l;icompact) { for (i=l;in,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->m,&m);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->l,&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->k-l+1,&n1);CHKERRQ(ierr); /* size of leading block, excl. locked */ ierr = PetscBLASIntCast(n-ds->k-1,&n2);CHKERRQ(ierr); /* size of trailing block */ ierr = PetscBLASIntCast(m-ds->k-1,&m2);CHKERRQ(ierr); n3 = n1+n2; m3 = n1+m2; off = l+l*ld; A = ds->mat[DS_MAT_A]; U = ds->mat[DS_MAT_U]; VT = ds->mat[DS_MAT_VT]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T]+ld; ierr = PetscMemzero(U,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;istate>DS_STATE_RAW) { /* Solve bidiagonal SVD problem */ for (i=0;irmat[DS_MAT_U]; VTr = ds->rmat[DS_MAT_VT]; #else Ur = U; VTr = VT; #endif PetscStackCallBLAS("LAPACKbdsdc",LAPACKbdsdc_("U","I",&n3,d+l,e+l,Ur+off,&ld,VTr+off,&ld,NULL,NULL,ds->rwork,ds->iwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xBDSDC %d",info); #if defined(PETSC_USE_COMPLEX) for (i=l;icompact) { ierr = DSSwitchFormat_SVD(ds,PETSC_FALSE);CHKERRQ(ierr); } for (i=0;irwork,ds->iwork,&info)); #else PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,&qwork,&lwork,ds->iwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGESDD %d",info); lwork = (PetscBLASInt)PetscRealPart(qwork); ierr = DSAllocateWork_Private(ds,lwork,0,0);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,ds->work,&lwork,ds->rwork,ds->iwork,&info)); #else PetscStackCallBLAS("LAPACKgesdd",LAPACKgesdd_("A",&n3,&m3,A+off,&ld,d+l,U+off,&ld,VT+off,&ld,ds->work,&lwork,ds->iwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGESDD %d",info); } for (i=l;in,ds->m);i++) wr[i] = d[i]; /* Create diagonal matrix as a result */ if (ds->compact) { ierr = PetscMemzero(e,(n-1)*sizeof(PetscReal));CHKERRQ(ierr); } else { for (i=l;iops->allocate = DSAllocate_SVD; ds->ops->view = DSView_SVD; ds->ops->vectors = DSVectors_SVD; ds->ops->solve[0] = DSSolve_SVD_DC; ds->ops->sort = DSSort_SVD; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/nhep/0000755000175000017500000000000012214143515016706 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/nhep/dsnhep.c0000644000175000017500000007127312211062077020345 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocate_NHEP" PetscErrorCode DSAllocate_NHEP(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView_NHEP" PetscErrorCode DSView_NHEP(DS ds,PetscViewer viewer) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSViewMat_Private(ds,viewer,DS_MAT_A);CHKERRQ(ierr); if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Q);CHKERRQ(ierr); } if (ds->mat[DS_MAT_X]) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_X);CHKERRQ(ierr); } if (ds->mat[DS_MAT_Y]) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Y);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_NHEP_Refined_Some" PetscErrorCode DSVectors_NHEP_Refined_Some(DS ds,PetscInt *k,PetscReal *rnorm,PetscBool left) { #if defined(SLEPC_MISSING_LAPACK_GESVD) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GESVD - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i,j; PetscBLASInt info,ld,n,n1,lwork,inc=1; PetscScalar sdummy,done=1.0,zero=0.0; PetscReal *sigma; PetscBool iscomplex = PETSC_FALSE; PetscScalar *A = ds->mat[DS_MAT_A]; PetscScalar *Q = ds->mat[DS_MAT_Q]; PetscScalar *X = ds->mat[left?DS_MAT_Y:DS_MAT_X]; PetscScalar *W; PetscFunctionBegin; if (left) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented for left vectors"); ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); n1 = n+1; if ((*k)mat[DS_MAT_W]; lwork = 5*ld; sigma = ds->rwork+5*ld; /* build A-w*I in W */ for (j=0;jwork,&lwork,&info)); #else PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("N","O",&n1,&n,W,&ld,sigma,&sdummy,&ld,&sdummy,&ld,ds->work,&lwork,ds->rwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGESVD %d",info); /* the smallest singular value is the new error estimate */ if (rnorm) *rnorm = sigma[n-1]; /* update vector with right singular vector associated to smallest singular value, accumulating the transformation matrix Q */ PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&n,&done,Q,&ld,W+n-1,&ld,&zero,X+(*k)*ld,&inc)); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSVectors_NHEP_Refined_All" PetscErrorCode DSVectors_NHEP_Refined_All(DS ds,PetscBool left) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; for (i=0;in;i++) { ierr = DSVectors_NHEP_Refined_Some(ds,&i,NULL,left);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_NHEP_Eigen_Some" PetscErrorCode DSVectors_NHEP_Eigen_Some(DS ds,PetscInt *k,PetscReal *rnorm,PetscBool left) { #if defined(SLEPC_MISSING_LAPACK_TREVC) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TREVC - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; PetscBLASInt mm=1,mout,info,ld,n,inc = 1; PetscScalar tmp,done=1.0,zero=0.0; PetscReal norm; PetscBool iscomplex = PETSC_FALSE; PetscBLASInt *select; PetscScalar *A = ds->mat[DS_MAT_A]; PetscScalar *Q = ds->mat[DS_MAT_Q]; PetscScalar *X = ds->mat[left?DS_MAT_Y:DS_MAT_X]; PetscScalar *Y; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSAllocateWork_Private(ds,0,0,ld);CHKERRQ(ierr); select = ds->iwork; for (i=0;iwork,&info)); #else ierr = DSAllocateWork_Private(ds,2*ld,ld,0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(left?"L":"R","S",select,&n,A,&ld,Y,&ld,Y,&ld,&mm,&mout,ds->work,ds->rwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTREVC %d",info); if (mout != mm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Inconsistent arguments"); /* accumulate and normalize eigenvectors */ if (ds->state>=DS_STATE_CONDENSED) { ierr = PetscMemcpy(ds->work,Y,mout*ld*sizeof(PetscScalar));CHKERRQ(ierr); PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&n,&done,Q,&ld,ds->work,&inc,&zero,Y,&inc)); #if !defined(PETSC_USE_COMPLEX) if (iscomplex) PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&n,&done,Q,&ld,ds->work+ld,&inc,&zero,Y+ld,&inc)); #endif norm = BLASnrm2_(&n,Y,&inc); #if !defined(PETSC_USE_COMPLEX) if (iscomplex) { tmp = BLASnrm2_(&n,Y+ld,&inc); norm = SlepcAbsEigenvalue(norm,tmp); } #endif tmp = 1.0 / norm; PetscStackCallBLAS("BLASscal",BLASscal_(&n,&tmp,Y,&inc)); #if !defined(PETSC_USE_COMPLEX) if (iscomplex) PetscStackCallBLAS("BLASscal",BLASscal_(&n,&tmp,Y+ld,&inc)); #endif } /* set output arguments */ if (iscomplex) (*k)++; if (rnorm) { if (iscomplex) *rnorm = SlepcAbsEigenvalue(Y[n-1],Y[n-1+ld]); else *rnorm = PetscAbsScalar(Y[n-1]); } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSVectors_NHEP_Eigen_All" PetscErrorCode DSVectors_NHEP_Eigen_All(DS ds,PetscBool left) { #if defined(SLEPC_MISSING_LAPACK_TREVC) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TREVC - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscBLASInt n,ld,mout,info; PetscScalar *X,*Y,*A = ds->mat[DS_MAT_A]; const char *side,*back; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); if (left) { X = NULL; Y = ds->mat[DS_MAT_Y]; side = "L"; } else { X = ds->mat[DS_MAT_X]; Y = NULL; side = "R"; } if (ds->state>=DS_STATE_CONDENSED) { /* DSSolve() has been called, backtransform with matrix Q */ back = "B"; ierr = PetscMemcpy(left?Y:X,ds->mat[DS_MAT_Q],ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); } else back = "A"; #if !defined(PETSC_USE_COMPLEX) ierr = DSAllocateWork_Private(ds,3*ld,0,0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(side,back,NULL,&n,A,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,&info)); #else ierr = DSAllocateWork_Private(ds,2*ld,ld,0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(side,back,NULL,&n,A,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,ds->rwork,&info)); #endif if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTREVC %i",info); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSVectors_NHEP" PetscErrorCode DSVectors_NHEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm) { PetscErrorCode ierr; PetscFunctionBegin; switch (mat) { case DS_MAT_X: if (ds->refined) { if (!ds->extrarow) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Refined vectors require activating the extra row"); if (j) { ierr = DSVectors_NHEP_Refined_Some(ds,j,rnorm,PETSC_FALSE);CHKERRQ(ierr); } else { ierr = DSVectors_NHEP_Refined_All(ds,PETSC_FALSE);CHKERRQ(ierr); } } else { if (j) { ierr = DSVectors_NHEP_Eigen_Some(ds,j,rnorm,PETSC_FALSE);CHKERRQ(ierr); } else { ierr = DSVectors_NHEP_Eigen_All(ds,PETSC_FALSE);CHKERRQ(ierr); } } break; case DS_MAT_Y: if (ds->refined) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); if (j) { ierr = DSVectors_NHEP_Eigen_Some(ds,j,rnorm,PETSC_TRUE);CHKERRQ(ierr); } else { ierr = DSVectors_NHEP_Eigen_All(ds,PETSC_TRUE);CHKERRQ(ierr); } break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } if (ds->state < DS_STATE_CONDENSED) { ierr = DSSetState(ds,DS_STATE_CONDENSED);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSNormalize_NHEP" PetscErrorCode DSNormalize_NHEP(DS ds,DSMatType mat,PetscInt col) { PetscErrorCode ierr; PetscInt i,i0,i1; PetscBLASInt ld,n,one = 1; PetscScalar *A = ds->mat[DS_MAT_A],norm,*x; #if !defined(PETSC_USE_COMPLEX) PetscScalar norm0; #endif PetscFunctionBegin; switch (mat) { case DS_MAT_X: case DS_MAT_Y: case DS_MAT_Q: /* Supported matrices */ break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSGetArray(ds,mat,&x);CHKERRQ(ierr); if (col < 0) { i0 = 0; i1 = ds->n; } else if (col>0 && A[ds->ld*(col-1)+col] != 0.0) { i0 = col-1; i1 = col+1; } else { i0 = col; i1 = col+1; } for (i=i0;ild*i+i+1] != 0.0) { norm = BLASnrm2_(&n,&x[ld*i],&one); norm0 = BLASnrm2_(&n,&x[ld*(i+1)],&one); norm = 1.0/SlepcAbsEigenvalue(norm,norm0); PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one)); PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*(i+1)],&one)); i++; } else #endif { norm = BLASnrm2_(&n,&x[ld*i],&one); norm = 1.0/norm; PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one)); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSort_NHEP_Arbitrary" PetscErrorCode DSSort_NHEP_Arbitrary(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k) { #if defined(SLEPC_MISSING_LAPACK_TRSEN) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TRSEN - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; PetscBLASInt info,n,ld,mout,lwork,*selection; PetscScalar *T = ds->mat[DS_MAT_A],*Q = ds->mat[DS_MAT_Q],*work; #if !defined(PETSC_USE_COMPLEX) PetscBLASInt *iwork,liwork; #endif PetscFunctionBegin; if (!k) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Must supply argument k"); ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) lwork = n; liwork = 1; ierr = DSAllocateWork_Private(ds,lwork,0,liwork+n);CHKERRQ(ierr); work = ds->work; lwork = ds->lwork; selection = ds->iwork; iwork = ds->iwork + n; liwork = ds->liwork - n; #else lwork = 1; ierr = DSAllocateWork_Private(ds,lwork,0,n);CHKERRQ(ierr); work = ds->work; selection = ds->iwork; #endif /* Compute the selected eigenvalue to be in the leading position */ ierr = DSSortEigenvalues_Private(ds,rr,ri,ds->perm,PETSC_FALSE);CHKERRQ(ierr); ierr = PetscMemzero(selection,n*sizeof(PetscBLASInt));CHKERRQ(ierr); for (i=0;i<*k;i++) selection[ds->perm[i]] = 1; #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKtrsen",LAPACKtrsen_("N","V",selection,&n,T,&ld,Q,&ld,wr,wi,&mout,NULL,NULL,work,&lwork,iwork,&liwork,&info)); #else PetscStackCallBLAS("LAPACKtrsen",LAPACKtrsen_("N","V",selection,&n,T,&ld,Q,&ld,wr,&mout,NULL,NULL,work,&lwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTRSEN %d",info); *k = mout; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSSort_NHEP_Total" PetscErrorCode DSSort_NHEP_Total(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(SLEPC_MISSING_LAPACK_TREXC) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TREXC - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscScalar re; PetscInt i,j,pos,result; PetscBLASInt ifst,ilst,info,n,ld; PetscScalar *T = ds->mat[DS_MAT_A]; PetscScalar *Q = ds->mat[DS_MAT_Q]; #if !defined(PETSC_USE_COMPLEX) PetscScalar *work,im; #endif PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) ierr = DSAllocateWork_Private(ds,ld,0,0);CHKERRQ(ierr); work = ds->work; #endif /* selection sort */ for (i=ds->l;icomparison)(re,im,wr[j],wi[j],&result,ds->comparisonctx);CHKERRQ(ierr); #else ierr = (*ds->comparison)(re,0.0,wr[j],0.0,&result,ds->comparisonctx);CHKERRQ(ierr); #endif if (result > 0) { re = wr[j]; #if !defined(PETSC_USE_COMPLEX) im = wi[j]; #endif pos = j; } #if !defined(PETSC_USE_COMPLEX) if (wi[j] != 0) j++; #endif } if (pos) { /* interchange blocks */ ierr = PetscBLASIntCast(pos+1,&ifst);CHKERRQ(ierr); ierr = PetscBLASIntCast(i+1,&ilst);CHKERRQ(ierr); #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKtrexc",LAPACKtrexc_("V",&n,T,&ld,Q,&ld,&ifst,&ilst,work,&info)); #else PetscStackCallBLAS("LAPACKtrexc",LAPACKtrexc_("V",&n,T,&ld,Q,&ld,&ifst,&ilst,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTREXC %d",info); /* recover original eigenvalues from T matrix */ for (j=i;jn,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); A = ds->mat[DS_MAT_A]; Q = ds->mat[DS_MAT_Q]; ierr = DSAllocateWork_Private(ds,2*ld,0,0);CHKERRQ(ierr); x = ds->work; y = ds->work+ld; for (i=0;ik = n; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSolve_NHEP" PetscErrorCode DSSolve_NHEP(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(SLEPC_MISSING_LAPACK_GEHRD) || defined(SLEPC_MISSING_LAPACK_ORGHR) || defined(PETSC_MISSING_LAPACK_HSEQR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEHRD/ORGHR/HSEQR - Lapack routines are unavailable"); #else PetscErrorCode ierr; PetscScalar *work,*tau; PetscInt i,j; PetscBLASInt ilo,lwork,info,n,ld; PetscScalar *A = ds->mat[DS_MAT_A]; PetscScalar *Q = ds->mat[DS_MAT_Q]; PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) PetscValidPointer(wi,3); #endif ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->l+1,&ilo);CHKERRQ(ierr); ierr = DSAllocateWork_Private(ds,ld+ld*ld,0,0);CHKERRQ(ierr); tau = ds->work; work = ds->work+ld; lwork = ld*ld; /* initialize orthogonal matrix */ ierr = PetscMemzero(Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;istatel;j++) { if (j==n-1 || A[j+1+j*ld] == 0.0) { /* real eigenvalue */ wr[j] = A[j+j*ld]; wi[j] = 0.0; } else { /* complex eigenvalue */ wr[j] = A[j+j*ld]; wr[j+1] = A[j+j*ld]; wi[j] = PetscSqrtReal(PetscAbsReal(A[j+1+j*ld])) * PetscSqrtReal(PetscAbsReal(A[j+(j+1)*ld])); wi[j+1] = -wi[j]; j++; } } #else PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","V",&n,&ilo,&n,A,&ld,wr,Q,&ld,work,&lwork,&info)); if (wi) for (i=ds->l;ild,l=ds->l; PetscScalar *A; PetscFunctionBegin; if (ds->state==DS_STATE_CONDENSED) ds->t = ds->n; A = ds->mat[DS_MAT_A]; /* be careful not to break a diagonal 2x2 block */ if (A[n+(n-1)*ld]==0.0) newn = n; else { if (nn-1) newn = n+1; else newn = n-1; } if (ds->extrarow && ds->k==ds->n) { /* copy entries of extra row to the new position, then clean last row */ for (i=l;in+i*ld]; for (i=l;in;i++) A[ds->n+i*ld] = 0.0; } ds->k = 0; ds->n = newn; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSCond_NHEP" PetscErrorCode DSCond_NHEP(DS ds,PetscReal *cond) { #if defined(PETSC_MISSING_LAPACK_GETRF) || defined(SLEPC_MISSING_LAPACK_GETRI) || defined(SLEPC_MISSING_LAPACK_LANGE) || defined(SLEPC_MISSING_LAPACK_LANHS) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF/GETRI/LANGE/LANHS - Lapack routines are unavailable"); #else PetscErrorCode ierr; PetscScalar *work; PetscReal *rwork; PetscBLASInt *ipiv; PetscBLASInt lwork,info,n,ld; PetscReal hn,hin; PetscScalar *A; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); lwork = 8*ld; ierr = DSAllocateWork_Private(ds,lwork,ld,ld);CHKERRQ(ierr); work = ds->work; rwork = ds->rwork; ipiv = ds->iwork; /* use workspace matrix W to avoid overwriting A */ ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); A = ds->mat[DS_MAT_W]; ierr = PetscMemcpy(A,ds->mat[DS_MAT_A],sizeof(PetscScalar)*ds->ld*ds->ld);CHKERRQ(ierr); /* norm of A */ if (ds->staten,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); A = ds->mat[DS_MAT_A]; if (!recover) { ierr = DSAllocateWork_Private(ds,0,0,ld);CHKERRQ(ierr); ipiv = ds->iwork; if (!g) { ierr = DSAllocateWork_Private(ds,ld,0,0);CHKERRQ(ierr); g = ds->work; } /* use workspace matrix W to factor A-tau*eye(n) */ ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); B = ds->mat[DS_MAT_W]; ierr = PetscMemcpy(B,A,sizeof(PetscScalar)*ld*ld);CHKERRQ(ierr); /* Vector g initialy stores b = beta*e_n^T */ ierr = PetscMemzero(g,n*sizeof(PetscScalar));CHKERRQ(ierr); g[n-1] = beta; /* g = (A-tau*eye(n))'\b */ for (i=0;i0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_MAT_LU_ZRPVT,"Bad LU factorization"); ierr = PetscLogFlops(2.0*n*n*n/3.0);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgetrs",LAPACKgetrs_("C",&n,&one,B,&ld,ipiv,g,&ld,&info)); if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"GETRS - Bad solve"); ierr = PetscLogFlops(2.0*n*n-n);CHKERRQ(ierr); /* A = A + g*b' */ for (i=0;iwork; Q = ds->mat[DS_MAT_Q]; /* g^ = -Q(:,idx)'*g */ ierr = PetscBLASIntCast(ds->l+ds->k,&ncol);CHKERRQ(ierr); PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&n,&ncol,&dmone,Q,&ld,g,&one,&dzero,ghat,&one)); /* A = A + g^*b' */ for (i=0;il+ds->k;i++) for (j=ds->l;jl+ds->k;j++) A[i+j*ld] += ghat[i]*Q[n-1+j*ld]*beta; /* g~ = (I-Q(:,idx)*Q(:,idx)')*g = g+Q(:,idx)*g^ */ PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&ncol,&done,Q,&ld,ghat,&one,&done,g,&one)); } /* Compute gamma factor */ if (gamma) { gnorm = 0.0; for (i=0;in,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ld2 = ld*ld; ierr = DSAllocateWork_Private(ds,0,ld,ld);CHKERRQ(ierr); ipiv = ds->iwork; if (!ds->mat[DS_MAT_W]) { ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); } if (!ds->mat[DS_MAT_Z]) { ierr = DSAllocateMat_Private(ds,DS_MAT_Z);CHKERRQ(ierr); } A = ds->mat[DS_MAT_A]; A2 = ds->mat[DS_MAT_Z]; Q = ds->mat[DS_MAT_Q]; P = ds->mat[DS_MAT_F]; W = ds->mat[DS_MAT_W]; /* Pade' coefficients */ c[0] = 1.0; for (k=1;k<=p;k++) { c[k] = c[k-1]*(p+1-k)/(k*(2*p+1-k)); } /* Scaling */ s = LAPACKlange_("I",&n,&n,A,&ld,ds->rwork); if (s>0.5) { s = PetscMax(0,(int)(PetscLogReal(s)/PetscLogReal(2.0)) + 2); scale = PetscPowScalar(2,(-1)*s); PetscStackCallBLAS("BLASscal",BLASscal_(&ld2,&scale,A,&inc)); } /* Horner evaluation */ PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,A,&ld,A,&ld,&zero,A2,&ld)); ierr = PetscMemzero(Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMemzero(P,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (j=0;j0;k--) { if (odd==1) { PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,Q,&ld,A2,&ld,&zero,W,&ld)); aux = Q; Q = W; W = aux; for (j=0;jmat[DS_MAT_F]) { ierr = PetscMemcpy(ds->mat[DS_MAT_F],P,ld2*sizeof(PetscScalar));CHKERRQ(ierr); } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSCreate_NHEP" PETSC_EXTERN PetscErrorCode DSCreate_NHEP(DS ds) { PetscFunctionBegin; ds->ops->allocate = DSAllocate_NHEP; ds->ops->view = DSView_NHEP; ds->ops->vectors = DSVectors_NHEP; ds->ops->solve[0] = DSSolve_NHEP; ds->ops->sort = DSSort_NHEP; ds->ops->truncate = DSTruncate_NHEP; ds->ops->update = DSUpdateExtraRow_NHEP; ds->ops->cond = DSCond_NHEP; ds->ops->transharm = DSTranslateHarmonic_NHEP; ds->ops->normalize = DSNormalize_NHEP; ds->ops->computefun[SLEPC_FUNCTION_EXP][0] = DSFunction_EXP_NHEP_PADE; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/nhep/makefile0000644000175000017500000000213312211062077020405 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dsnhep.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/nhep/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/nhep/makefile.html0000644000175000017500000000372412211062077021357 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dsnhep.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/nhep/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/nhep/index.html0000644000175000017500000000124612211062077020706 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dsnhep.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/nhep/dsnhep.c.html0000644000175000017500000017217312211062077021311 0ustar gladkgladk

Actual source code: dsnhep.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 27: PetscErrorCode DSAllocate_NHEP(DS ds,PetscInt ld)
 28: {

 32:   DSAllocateMat_Private(ds,DS_MAT_A);
 33:   DSAllocateMat_Private(ds,DS_MAT_Q);
 34:   PetscFree(ds->perm);
 35:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 36:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 37:   return(0);
 38: }

 42: PetscErrorCode DSView_NHEP(DS ds,PetscViewer viewer)
 43: {

 47:   DSViewMat_Private(ds,viewer,DS_MAT_A);
 48:   if (ds->state>DS_STATE_INTERMEDIATE) {
 49:     DSViewMat_Private(ds,viewer,DS_MAT_Q);
 50:   }
 51:   if (ds->mat[DS_MAT_X]) {
 52:     DSViewMat_Private(ds,viewer,DS_MAT_X);
 53:   }
 54:   if (ds->mat[DS_MAT_Y]) {
 55:     DSViewMat_Private(ds,viewer,DS_MAT_Y);
 56:   }
 57:   return(0);
 58: }

 62: PetscErrorCode DSVectors_NHEP_Refined_Some(DS ds,PetscInt *k,PetscReal *rnorm,PetscBool left)
 63: {
 64: #if defined(SLEPC_MISSING_LAPACK_GESVD)
 66:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GESVD - Lapack routine is unavailable");
 67: #else
 69:   PetscInt       i,j;
 70:   PetscBLASInt   info,ld,n,n1,lwork,inc=1;
 71:   PetscScalar    sdummy,done=1.0,zero=0.0;
 72:   PetscReal      *sigma;
 73:   PetscBool      iscomplex = PETSC_FALSE;
 74:   PetscScalar    *A = ds->mat[DS_MAT_A];
 75:   PetscScalar    *Q = ds->mat[DS_MAT_Q];
 76:   PetscScalar    *X = ds->mat[left?DS_MAT_Y:DS_MAT_X];
 77:   PetscScalar    *W;

 80:   if (left) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented for left vectors");
 81:   PetscBLASIntCast(ds->n,&n);
 82:   PetscBLASIntCast(ds->ld,&ld);
 83:   n1 = n+1;
 84:   if ((*k)<n-1 && A[(*k)+1+(*k)*ld]!=0.0) iscomplex = PETSC_TRUE;
 85:   if (iscomplex) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented for complex eigenvalues yet");
 86:   DSAllocateWork_Private(ds,5*ld,6*ld,0);
 87:   DSAllocateMat_Private(ds,DS_MAT_W);
 88:   W = ds->mat[DS_MAT_W];
 89:   lwork = 5*ld;
 90:   sigma = ds->rwork+5*ld;

 92:   /* build A-w*I in W */
 93:   for (j=0;j<n;j++)
 94:     for (i=0;i<=n;i++)
 95:       W[i+j*ld] = A[i+j*ld];
 96:   for (i=0;i<n;i++)
 97:     W[i+i*ld] -= A[(*k)+(*k)*ld];

 99:   /* compute SVD of W */
100: #if !defined(PETSC_USE_COMPLEX)
101:   PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("N","O",&n1,&n,W,&ld,sigma,&sdummy,&ld,&sdummy,&ld,ds->work,&lwork,&info));
102: #else
103:   PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("N","O",&n1,&n,W,&ld,sigma,&sdummy,&ld,&sdummy,&ld,ds->work,&lwork,ds->rwork,&info));
104: #endif
105:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGESVD %d",info);

107:   /* the smallest singular value is the new error estimate */
108:   if (rnorm) *rnorm = sigma[n-1];

110:   /* update vector with right singular vector associated to smallest singular value,
111:      accumulating the transformation matrix Q */
112:   PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&n,&done,Q,&ld,W+n-1,&ld,&zero,X+(*k)*ld,&inc));
113:   return(0);
114: #endif
115: }

119: PetscErrorCode DSVectors_NHEP_Refined_All(DS ds,PetscBool left)
120: {
122:   PetscInt       i;

125:   for (i=0;i<ds->n;i++) {
126:     DSVectors_NHEP_Refined_Some(ds,&i,NULL,left);
127:   }
128:   return(0);
129: }

133: PetscErrorCode DSVectors_NHEP_Eigen_Some(DS ds,PetscInt *k,PetscReal *rnorm,PetscBool left)
134: {
135: #if defined(SLEPC_MISSING_LAPACK_TREVC)
137:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TREVC - Lapack routine is unavailable");
138: #else
140:   PetscInt       i;
141:   PetscBLASInt   mm=1,mout,info,ld,n,inc = 1;
142:   PetscScalar    tmp,done=1.0,zero=0.0;
143:   PetscReal      norm;
144:   PetscBool      iscomplex = PETSC_FALSE;
145:   PetscBLASInt   *select;
146:   PetscScalar    *A = ds->mat[DS_MAT_A];
147:   PetscScalar    *Q = ds->mat[DS_MAT_Q];
148:   PetscScalar    *X = ds->mat[left?DS_MAT_Y:DS_MAT_X];
149:   PetscScalar    *Y;

152:   PetscBLASIntCast(ds->n,&n);
153:   PetscBLASIntCast(ds->ld,&ld);
154:   DSAllocateWork_Private(ds,0,0,ld);
155:   select = ds->iwork;
156:   for (i=0;i<n;i++) select[i] = (PetscBLASInt)PETSC_FALSE;

158:   /* Compute k-th eigenvector Y of A */
159:   Y = X+(*k)*ld;
160:   select[*k] = (PetscBLASInt)PETSC_TRUE;
161: #if !defined(PETSC_USE_COMPLEX)
162:   if ((*k)<n-1 && A[(*k)+1+(*k)*ld]!=0.0) iscomplex = PETSC_TRUE;
163:   mm = iscomplex? 2: 1;
164:   if (iscomplex) select[(*k)+1] = (PetscBLASInt)PETSC_TRUE;
165:   DSAllocateWork_Private(ds,3*ld,0,0);
166:   PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(left?"L":"R","S",select,&n,A,&ld,Y,&ld,Y,&ld,&mm,&mout,ds->work,&info));
167: #else
168:   DSAllocateWork_Private(ds,2*ld,ld,0);
169:   PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(left?"L":"R","S",select,&n,A,&ld,Y,&ld,Y,&ld,&mm,&mout,ds->work,ds->rwork,&info));
170: #endif
171:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTREVC %d",info);
172:   if (mout != mm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Inconsistent arguments");

174:   /* accumulate and normalize eigenvectors */
175:   if (ds->state>=DS_STATE_CONDENSED) {
176:     PetscMemcpy(ds->work,Y,mout*ld*sizeof(PetscScalar));
177:     PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&n,&done,Q,&ld,ds->work,&inc,&zero,Y,&inc));
178: #if !defined(PETSC_USE_COMPLEX)
179:     if (iscomplex) PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&n,&done,Q,&ld,ds->work+ld,&inc,&zero,Y+ld,&inc));
180: #endif
181:     norm = BLASnrm2_(&n,Y,&inc);
182: #if !defined(PETSC_USE_COMPLEX)
183:     if (iscomplex) {
184:       tmp = BLASnrm2_(&n,Y+ld,&inc);
185:       norm = SlepcAbsEigenvalue(norm,tmp);
186:     }
187: #endif
188:     tmp = 1.0 / norm;
189:     PetscStackCallBLAS("BLASscal",BLASscal_(&n,&tmp,Y,&inc));
190: #if !defined(PETSC_USE_COMPLEX)
191:     if (iscomplex) PetscStackCallBLAS("BLASscal",BLASscal_(&n,&tmp,Y+ld,&inc));
192: #endif
193:   }

195:   /* set output arguments */
196:   if (iscomplex) (*k)++;
197:   if (rnorm) {
198:     if (iscomplex) *rnorm = SlepcAbsEigenvalue(Y[n-1],Y[n-1+ld]);
199:     else *rnorm = PetscAbsScalar(Y[n-1]);
200:   }
201:   return(0);
202: #endif
203: }

207: PetscErrorCode DSVectors_NHEP_Eigen_All(DS ds,PetscBool left)
208: {
209: #if defined(SLEPC_MISSING_LAPACK_TREVC)
211:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TREVC - Lapack routine is unavailable");
212: #else
214:   PetscBLASInt   n,ld,mout,info;
215:   PetscScalar    *X,*Y,*A = ds->mat[DS_MAT_A];
216:   const char     *side,*back;

219:   PetscBLASIntCast(ds->n,&n);
220:   PetscBLASIntCast(ds->ld,&ld);
221:   if (left) {
222:     X = NULL;
223:     Y = ds->mat[DS_MAT_Y];
224:     side = "L";
225:   } else {
226:     X = ds->mat[DS_MAT_X];
227:     Y = NULL;
228:     side = "R";
229:   }
230:   if (ds->state>=DS_STATE_CONDENSED) {
231:     /* DSSolve() has been called, backtransform with matrix Q */
232:     back = "B";
233:     PetscMemcpy(left?Y:X,ds->mat[DS_MAT_Q],ld*ld*sizeof(PetscScalar));
234:   } else back = "A";
235: #if !defined(PETSC_USE_COMPLEX)
236:   DSAllocateWork_Private(ds,3*ld,0,0);
237:   PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(side,back,NULL,&n,A,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,&info));
238: #else
239:   DSAllocateWork_Private(ds,2*ld,ld,0);
240:   PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_(side,back,NULL,&n,A,&ld,Y,&ld,X,&ld,&n,&mout,ds->work,ds->rwork,&info));
241: #endif
242:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTREVC %i",info);
243:   return(0);
244: #endif
245: }

249: PetscErrorCode DSVectors_NHEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
250: {

254:   switch (mat) {
255:     case DS_MAT_X:
256:       if (ds->refined) {
257:         if (!ds->extrarow) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Refined vectors require activating the extra row");
258:         if (j) {
259:           DSVectors_NHEP_Refined_Some(ds,j,rnorm,PETSC_FALSE);
260:         } else {
261:           DSVectors_NHEP_Refined_All(ds,PETSC_FALSE);
262:         }
263:       } else {
264:         if (j) {
265:           DSVectors_NHEP_Eigen_Some(ds,j,rnorm,PETSC_FALSE);
266:         } else {
267:           DSVectors_NHEP_Eigen_All(ds,PETSC_FALSE);
268:         }
269:       }
270:       break;
271:     case DS_MAT_Y:
272:       if (ds->refined) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
273:       if (j) {
274:         DSVectors_NHEP_Eigen_Some(ds,j,rnorm,PETSC_TRUE);
275:       } else {
276:         DSVectors_NHEP_Eigen_All(ds,PETSC_TRUE);
277:       }
278:       break;
279:     case DS_MAT_U:
280:     case DS_MAT_VT:
281:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
282:       break;
283:     default:
284:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
285:   }
286:   if (ds->state < DS_STATE_CONDENSED) {
287:     DSSetState(ds,DS_STATE_CONDENSED);
288:   }
289:   return(0);
290: }

294: PetscErrorCode DSNormalize_NHEP(DS ds,DSMatType mat,PetscInt col)
295: {
297:   PetscInt       i,i0,i1;
298:   PetscBLASInt   ld,n,one = 1;
299:   PetscScalar    *A = ds->mat[DS_MAT_A],norm,*x;
300: #if !defined(PETSC_USE_COMPLEX)
301:   PetscScalar    norm0;
302: #endif

305:   switch (mat) {
306:     case DS_MAT_X:
307:     case DS_MAT_Y:
308:     case DS_MAT_Q:
309:       /* Supported matrices */
310:       break;
311:     case DS_MAT_U:
312:     case DS_MAT_VT:
313:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
314:       break;
315:     default:
316:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
317:   }

319:   PetscBLASIntCast(ds->n,&n);
320:   PetscBLASIntCast(ds->ld,&ld);
321:   DSGetArray(ds,mat,&x);
322:   if (col < 0) {
323:     i0 = 0; i1 = ds->n;
324:   } else if (col>0 && A[ds->ld*(col-1)+col] != 0.0) {
325:     i0 = col-1; i1 = col+1;
326:   } else {
327:     i0 = col; i1 = col+1;
328:   }
329:   for (i=i0;i<i1;i++) {
330: #if !defined(PETSC_USE_COMPLEX)
331:     if (i<n-1 && A[ds->ld*i+i+1] != 0.0) {
332:       norm = BLASnrm2_(&n,&x[ld*i],&one);
333:       norm0 = BLASnrm2_(&n,&x[ld*(i+1)],&one);
334:       norm = 1.0/SlepcAbsEigenvalue(norm,norm0);
335:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
336:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*(i+1)],&one));
337:       i++;
338:     } else
339: #endif
340:     {
341:       norm = BLASnrm2_(&n,&x[ld*i],&one);
342:       norm = 1.0/norm;
343:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
344:     }
345:   }
346:   return(0);
347: }

351: PetscErrorCode DSSort_NHEP_Arbitrary(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
352: {
353: #if defined(SLEPC_MISSING_LAPACK_TRSEN)
355:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TRSEN - Lapack routine is unavailable");
356: #else
358:   PetscInt       i;
359:   PetscBLASInt   info,n,ld,mout,lwork,*selection;
360:   PetscScalar    *T = ds->mat[DS_MAT_A],*Q = ds->mat[DS_MAT_Q],*work;
361: #if !defined(PETSC_USE_COMPLEX)
362:   PetscBLASInt   *iwork,liwork;
363: #endif

366:   if (!k) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Must supply argument k");
367:   PetscBLASIntCast(ds->n,&n);
368:   PetscBLASIntCast(ds->ld,&ld);
369: #if !defined(PETSC_USE_COMPLEX)
370:   lwork = n;
371:   liwork = 1;
372:   DSAllocateWork_Private(ds,lwork,0,liwork+n);
373:   work = ds->work;
374:   lwork = ds->lwork;
375:   selection = ds->iwork;
376:   iwork = ds->iwork + n;
377:   liwork = ds->liwork - n;
378: #else
379:   lwork = 1;
380:   DSAllocateWork_Private(ds,lwork,0,n);
381:   work = ds->work;
382:   selection = ds->iwork;
383: #endif
384:   /* Compute the selected eigenvalue to be in the leading position */
385:   DSSortEigenvalues_Private(ds,rr,ri,ds->perm,PETSC_FALSE);
386:   PetscMemzero(selection,n*sizeof(PetscBLASInt));
387:   for (i=0;i<*k;i++) selection[ds->perm[i]] = 1;
388: #if !defined(PETSC_USE_COMPLEX)
389:   PetscStackCallBLAS("LAPACKtrsen",LAPACKtrsen_("N","V",selection,&n,T,&ld,Q,&ld,wr,wi,&mout,NULL,NULL,work,&lwork,iwork,&liwork,&info));
390: #else
391:   PetscStackCallBLAS("LAPACKtrsen",LAPACKtrsen_("N","V",selection,&n,T,&ld,Q,&ld,wr,&mout,NULL,NULL,work,&lwork,&info));
392: #endif
393:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTRSEN %d",info);
394:   *k = mout;
395:   return(0);
396: #endif
397: }

401: PetscErrorCode DSSort_NHEP_Total(DS ds,PetscScalar *wr,PetscScalar *wi)
402: {
403: #if defined(SLEPC_MISSING_LAPACK_TREXC)
405:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"TREXC - Lapack routine is unavailable");
406: #else
408:   PetscScalar    re;
409:   PetscInt       i,j,pos,result;
410:   PetscBLASInt   ifst,ilst,info,n,ld;
411:   PetscScalar    *T = ds->mat[DS_MAT_A];
412:   PetscScalar    *Q = ds->mat[DS_MAT_Q];
413: #if !defined(PETSC_USE_COMPLEX)
414:   PetscScalar    *work,im;
415: #endif

418:   PetscBLASIntCast(ds->n,&n);
419:   PetscBLASIntCast(ds->ld,&ld);
420: #if !defined(PETSC_USE_COMPLEX)
421:   DSAllocateWork_Private(ds,ld,0,0);
422:   work = ds->work;
423: #endif
424:   /* selection sort */
425:   for (i=ds->l;i<n-1;i++) {
426:     re = wr[i];
427: #if !defined(PETSC_USE_COMPLEX)
428:     im = wi[i];
429: #endif
430:     pos = 0;
431:     j=i+1; /* j points to the next eigenvalue */
432: #if !defined(PETSC_USE_COMPLEX)
433:     if (im != 0) j=i+2;
434: #endif
435:     /* find minimum eigenvalue */
436:     for (;j<n;j++) {
437: #if !defined(PETSC_USE_COMPLEX)
438:       (*ds->comparison)(re,im,wr[j],wi[j],&result,ds->comparisonctx);
439: #else
440:       (*ds->comparison)(re,0.0,wr[j],0.0,&result,ds->comparisonctx);
441: #endif
442:       if (result > 0) {
443:         re = wr[j];
444: #if !defined(PETSC_USE_COMPLEX)
445:         im = wi[j];
446: #endif
447:         pos = j;
448:       }
449: #if !defined(PETSC_USE_COMPLEX)
450:       if (wi[j] != 0) j++;
451: #endif
452:     }
453:     if (pos) {
454:       /* interchange blocks */
455:       PetscBLASIntCast(pos+1,&ifst);
456:       PetscBLASIntCast(i+1,&ilst);
457: #if !defined(PETSC_USE_COMPLEX)
458:       PetscStackCallBLAS("LAPACKtrexc",LAPACKtrexc_("V",&n,T,&ld,Q,&ld,&ifst,&ilst,work,&info));
459: #else
460:       PetscStackCallBLAS("LAPACKtrexc",LAPACKtrexc_("V",&n,T,&ld,Q,&ld,&ifst,&ilst,&info));
461: #endif
462:       if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xTREXC %d",info);
463:       /* recover original eigenvalues from T matrix */
464:       for (j=i;j<n;j++) {
465:         wr[j] = T[j+j*ld];
466: #if !defined(PETSC_USE_COMPLEX)
467:         if (j<n-1 && T[j+1+j*ld] != 0.0) {
468:           /* complex conjugate eigenvalue */
469:           wi[j] = PetscSqrtReal(PetscAbsReal(T[j+1+j*ld])) *
470:                   PetscSqrtReal(PetscAbsReal(T[j+(j+1)*ld]));
471:           wr[j+1] = wr[j];
472:           wi[j+1] = -wi[j];
473:           j++;
474:         } else {
475:           wi[j] = 0.0;
476:         }
477: #endif
478:       }
479:     }
480: #if !defined(PETSC_USE_COMPLEX)
481:     if (wi[i] != 0) i++;
482: #endif
483:   }
484:   return(0);
485: #endif
486: }

490: PetscErrorCode DSSort_NHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
491: {

495:   if (!rr || wr == rr) {
496:     DSSort_NHEP_Total(ds,wr,wi);
497:   } else {
498:     DSSort_NHEP_Arbitrary(ds,wr,wi,rr,ri,k);
499:   }
500:   return(0);
501: }

505: PetscErrorCode DSUpdateExtraRow_NHEP(DS ds)
506: {
508:   PetscInt       i;
509:   PetscBLASInt   n,ld,incx=1;
510:   PetscScalar    *A,*Q,*x,*y,one=1.0,zero=0.0;

513:   PetscBLASIntCast(ds->n,&n);
514:   PetscBLASIntCast(ds->ld,&ld);
515:   A  = ds->mat[DS_MAT_A];
516:   Q  = ds->mat[DS_MAT_Q];
517:   DSAllocateWork_Private(ds,2*ld,0,0);
518:   x = ds->work;
519:   y = ds->work+ld;
520:   for (i=0;i<n;i++) x[i] = A[n+i*ld];
521:   PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&n,&n,&one,Q,&ld,x,&incx,&zero,y,&incx));
522:   for (i=0;i<n;i++) A[n+i*ld] = y[i];
523:   ds->k = n;
524:   return(0);
525: }

529: PetscErrorCode DSSolve_NHEP(DS ds,PetscScalar *wr,PetscScalar *wi)
530: {
531: #if defined(SLEPC_MISSING_LAPACK_GEHRD) || defined(SLEPC_MISSING_LAPACK_ORGHR) || defined(PETSC_MISSING_LAPACK_HSEQR)
533:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEHRD/ORGHR/HSEQR - Lapack routines are unavailable");
534: #else
536:   PetscScalar    *work,*tau;
537:   PetscInt       i,j;
538:   PetscBLASInt   ilo,lwork,info,n,ld;
539:   PetscScalar    *A = ds->mat[DS_MAT_A];
540:   PetscScalar    *Q = ds->mat[DS_MAT_Q];

543: #if !defined(PETSC_USE_COMPLEX)
545: #endif
546:   PetscBLASIntCast(ds->n,&n);
547:   PetscBLASIntCast(ds->ld,&ld);
548:   PetscBLASIntCast(ds->l+1,&ilo);
549:   DSAllocateWork_Private(ds,ld+ld*ld,0,0);
550:   tau  = ds->work;
551:   work = ds->work+ld;
552:   lwork = ld*ld;

554:   /* initialize orthogonal matrix */
555:   PetscMemzero(Q,ld*ld*sizeof(PetscScalar));
556:   for (i=0;i<n;i++)
557:     Q[i+i*ld] = 1.0;
558:   if (n==1) return(0);

560:   /* reduce to upper Hessenberg form */
561:   if (ds->state<DS_STATE_INTERMEDIATE) {
562:     PetscStackCallBLAS("LAPACKgehrd",LAPACKgehrd_(&n,&ilo,&n,A,&ld,tau,work,&lwork,&info));
563:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGEHRD %d",info);
564:     for (j=0;j<n-1;j++) {
565:       for (i=j+2;i<n;i++) {
566:         Q[i+j*ld] = A[i+j*ld];
567:         A[i+j*ld] = 0.0;
568:       }
569:     }
570:     PetscStackCallBLAS("LAPACKorghr",LAPACKorghr_(&n,&ilo,&n,Q,&ld,tau,work,&lwork,&info));
571:     if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xORGHR %d",info);
572:   }

574:   /* compute the (real) Schur form */
575: #if !defined(PETSC_USE_COMPLEX)
576:   PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","V",&n,&ilo,&n,A,&ld,wr,wi,Q,&ld,work,&lwork,&info));
577:   for (j=0;j<ds->l;j++) {
578:     if (j==n-1 || A[j+1+j*ld] == 0.0) {
579:       /* real eigenvalue */
580:       wr[j] = A[j+j*ld];
581:       wi[j] = 0.0;
582:     } else {
583:       /* complex eigenvalue */
584:       wr[j] = A[j+j*ld];
585:       wr[j+1] = A[j+j*ld];
586:       wi[j] = PetscSqrtReal(PetscAbsReal(A[j+1+j*ld])) *
587:               PetscSqrtReal(PetscAbsReal(A[j+(j+1)*ld]));
588:       wi[j+1] = -wi[j];
589:       j++;
590:     }
591:   }
592: #else
593:   PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","V",&n,&ilo,&n,A,&ld,wr,Q,&ld,work,&lwork,&info));
594:   if (wi) for (i=ds->l;i<n;i++) wi[i] = 0.0;
595: #endif
596:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xHSEQR %d",info);
597:   return(0);
598: #endif
599: }

603: PetscErrorCode DSTruncate_NHEP(DS ds,PetscInt n)
604: {
605:   PetscInt       i,newn,ld=ds->ld,l=ds->l;
606:   PetscScalar    *A;

609:   if (ds->state==DS_STATE_CONDENSED) ds->t = ds->n;
610:   A = ds->mat[DS_MAT_A];
611:   /* be careful not to break a diagonal 2x2 block */
612:   if (A[n+(n-1)*ld]==0.0) newn = n;
613:   else {
614:     if (n<ds->n-1) newn = n+1;
615:     else newn = n-1;
616:   }
617:   if (ds->extrarow && ds->k==ds->n) {
618:     /* copy entries of extra row to the new position, then clean last row */
619:     for (i=l;i<newn;i++) A[newn+i*ld] = A[ds->n+i*ld];
620:     for (i=l;i<ds->n;i++) A[ds->n+i*ld] = 0.0;
621:   }
622:   ds->k = 0;
623:   ds->n = newn;
624:   return(0);
625: }

629: PetscErrorCode DSCond_NHEP(DS ds,PetscReal *cond)
630: {
631: #if defined(PETSC_MISSING_LAPACK_GETRF) || defined(SLEPC_MISSING_LAPACK_GETRI) || defined(SLEPC_MISSING_LAPACK_LANGE) || defined(SLEPC_MISSING_LAPACK_LANHS)
633:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF/GETRI/LANGE/LANHS - Lapack routines are unavailable");
634: #else
636:   PetscScalar    *work;
637:   PetscReal      *rwork;
638:   PetscBLASInt   *ipiv;
639:   PetscBLASInt   lwork,info,n,ld;
640:   PetscReal      hn,hin;
641:   PetscScalar    *A;

644:   PetscBLASIntCast(ds->n,&n);
645:   PetscBLASIntCast(ds->ld,&ld);
646:   lwork = 8*ld;
647:   DSAllocateWork_Private(ds,lwork,ld,ld);
648:   work  = ds->work;
649:   rwork = ds->rwork;
650:   ipiv  = ds->iwork;

652:   /* use workspace matrix W to avoid overwriting A */
653:   DSAllocateMat_Private(ds,DS_MAT_W);
654:   A = ds->mat[DS_MAT_W];
655:   PetscMemcpy(A,ds->mat[DS_MAT_A],sizeof(PetscScalar)*ds->ld*ds->ld);

657:   /* norm of A */
658:   if (ds->state<DS_STATE_INTERMEDIATE) hn = LAPACKlange_("I",&n,&n,A,&ld,rwork);
659:   else hn = LAPACKlanhs_("I",&n,A,&ld,rwork);

661:   /* norm of inv(A) */
662:   PetscStackCallBLAS("LAPACKgetrf",LAPACKgetrf_(&n,&n,A,&ld,ipiv,&info));
663:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGETRF %d",info);
664:   PetscStackCallBLAS("LAPACKgetri",LAPACKgetri_(&n,A,&ld,ipiv,work,&lwork,&info));
665:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGETRI %d",info);
666:   hin = LAPACKlange_("I",&n,&n,A,&ld,rwork);

668:   *cond = hn*hin;
669:   return(0);
670: #endif
671: }

675: PetscErrorCode DSTranslateHarmonic_NHEP(DS ds,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *gin,PetscReal *gamma)
676: {
677: #if defined(PETSC_MISSING_LAPACK_GETRF) || defined(PETSC_MISSING_LAPACK_GETRS)
679:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF/GETRS - Lapack routines are unavailable");
680: #else
682:   PetscInt       i,j;
683:   PetscBLASInt   *ipiv,info,n,ld,one=1,ncol;
684:   PetscScalar    *A,*B,*Q,*g=gin,*ghat;
685:   PetscScalar    done=1.0,dmone=-1.0,dzero=0.0;
686:   PetscReal      gnorm;

689:   PetscBLASIntCast(ds->n,&n);
690:   PetscBLASIntCast(ds->ld,&ld);
691:   A  = ds->mat[DS_MAT_A];

693:   if (!recover) {

695:     DSAllocateWork_Private(ds,0,0,ld);
696:     ipiv = ds->iwork;
697:     if (!g) {
698:       DSAllocateWork_Private(ds,ld,0,0);
699:       g = ds->work;
700:     }
701:     /* use workspace matrix W to factor A-tau*eye(n) */
702:     DSAllocateMat_Private(ds,DS_MAT_W);
703:     B = ds->mat[DS_MAT_W];
704:     PetscMemcpy(B,A,sizeof(PetscScalar)*ld*ld);

706:     /* Vector g initialy stores b = beta*e_n^T */
707:     PetscMemzero(g,n*sizeof(PetscScalar));
708:     g[n-1] = beta;

710:     /* g = (A-tau*eye(n))'\b */
711:     for (i=0;i<n;i++)
712:       B[i+i*ld] -= tau;
713:     PetscStackCallBLAS("LAPACKgetrf",LAPACKgetrf_(&n,&n,B,&ld,ipiv,&info));
714:     if (info<0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"Bad argument to LU factorization");
715:     if (info>0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_MAT_LU_ZRPVT,"Bad LU factorization");
716:     PetscLogFlops(2.0*n*n*n/3.0);
717:     PetscStackCallBLAS("LAPACKgetrs",LAPACKgetrs_("C",&n,&one,B,&ld,ipiv,g,&ld,&info));
718:     if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_LIB,"GETRS - Bad solve");
719:     PetscLogFlops(2.0*n*n-n);

721:     /* A = A + g*b' */
722:     for (i=0;i<n;i++)
723:       A[i+(n-1)*ld] += g[i]*beta;

725:   } else { /* recover */

728:     DSAllocateWork_Private(ds,ld,0,0);
729:     ghat = ds->work;
730:     Q    = ds->mat[DS_MAT_Q];

732:     /* g^ = -Q(:,idx)'*g */
733:     PetscBLASIntCast(ds->l+ds->k,&ncol);
734:     PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&n,&ncol,&dmone,Q,&ld,g,&one,&dzero,ghat,&one));

736:     /* A = A + g^*b' */
737:     for (i=0;i<ds->l+ds->k;i++)
738:       for (j=ds->l;j<ds->l+ds->k;j++)
739:         A[i+j*ld] += ghat[i]*Q[n-1+j*ld]*beta;

741:     /* g~ = (I-Q(:,idx)*Q(:,idx)')*g = g+Q(:,idx)*g^ */
742:     PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n,&ncol,&done,Q,&ld,ghat,&one,&done,g,&one));
743:   }

745:   /* Compute gamma factor */
746:   if (gamma) {
747:     gnorm = 0.0;
748:     for (i=0;i<n;i++)
749:       gnorm = gnorm + PetscRealPart(g[i]*PetscConj(g[i]));
750:     *gamma = PetscSqrtReal(1.0+gnorm);
751:   }
752:   return(0);
753: #endif
754: }

756: #define MAX_PADE 6

760: PetscErrorCode DSFunction_EXP_NHEP_PADE(DS ds)
761: {
762: #if defined(PETSC_MISSING_LAPACK_GESV) || defined(SLEPC_MISSING_LAPACK_LANGE)
764:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GESV/LANGE - Lapack routines are unavailable");
765: #else
767:   PetscBLASInt   n,ld,ld2,*ipiv,info,inc=1;
768:   PetscInt       j,k,odd;
769:   const PetscInt p=MAX_PADE;
770:   PetscReal      c[MAX_PADE+1],s;
771:   PetscScalar    scale,mone=-1.0,one=1.0,two=2.0,zero=0.0;
772:   PetscScalar    *A,*A2,*Q,*P,*W,*aux;

775:   PetscBLASIntCast(ds->n,&n);
776:   PetscBLASIntCast(ds->ld,&ld);
777:   ld2 = ld*ld;
778:   DSAllocateWork_Private(ds,0,ld,ld);
779:   ipiv = ds->iwork;
780:   if (!ds->mat[DS_MAT_W]) { DSAllocateMat_Private(ds,DS_MAT_W); }
781:   if (!ds->mat[DS_MAT_Z]) { DSAllocateMat_Private(ds,DS_MAT_Z); }
782:   A  = ds->mat[DS_MAT_A];
783:   A2 = ds->mat[DS_MAT_Z];
784:   Q  = ds->mat[DS_MAT_Q];
785:   P  = ds->mat[DS_MAT_F];
786:   W  = ds->mat[DS_MAT_W];

788:   /* Pade' coefficients */
789:   c[0] = 1.0;
790:   for (k=1;k<=p;k++) {
791:     c[k] = c[k-1]*(p+1-k)/(k*(2*p+1-k));
792:   }

794:   /* Scaling */
795:   s = LAPACKlange_("I",&n,&n,A,&ld,ds->rwork);
796:   if (s>0.5) {
797:     s = PetscMax(0,(int)(PetscLogReal(s)/PetscLogReal(2.0)) + 2);
798:     scale = PetscPowScalar(2,(-1)*s);
799:     PetscStackCallBLAS("BLASscal",BLASscal_(&ld2,&scale,A,&inc));
800:   }

802:   /* Horner evaluation */
803:   PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,A,&ld,A,&ld,&zero,A2,&ld));
804:   PetscMemzero(Q,ld*ld*sizeof(PetscScalar));
805:   PetscMemzero(P,ld*ld*sizeof(PetscScalar));
806:   for (j=0;j<n;j++) {
807:     Q[j+j*ld] = c[p];
808:     P[j+j*ld] = c[p-1];
809:   }

811:   odd = 1;
812:   for (k=p-1;k>0;k--) {
813:     if (odd==1) {
814:       PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,Q,&ld,A2,&ld,&zero,W,&ld));
815:       aux = Q;
816:       Q = W;
817:       W = aux;
818:       for (j=0;j<n;j++)
819:         Q[j+j*ld] = Q[j+j*ld] + c[k-1];
820:     } else {
821:       PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,P,&ld,A2,&ld,&zero,W,&ld));
822:       aux = P;
823:       P = W;
824:       W = aux;
825:       for (j=0;j<n;j++)
826:         P[j+j*ld] = P[j+j*ld] + c[k-1];
827:     }
828:     odd = 1-odd;
829:   }
830:   if (odd==1) {
831:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,Q,&ld,A,&ld,&zero,W,&ld));
832:     aux = Q;
833:     Q = W;
834:     W = aux;
835:     PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&ld2,&mone,P,&inc,Q,&inc));
836:     PetscStackCallBLAS("LAPACKgesv",LAPACKgesv_(&n,&n,Q,&ld,ipiv,P,&ld,&info));
837:     PetscStackCallBLAS("BLASscal",BLASscal_(&ld2,&two,P,&inc));
838:     for (j=0;j<n;j++)
839:       P[j+j*ld] = P[j+j*ld] + 1.0;
840:     PetscStackCallBLAS("BLASscal",BLASscal_(&ld2,&mone,P,&inc));
841:   } else {
842:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,P,&ld,A,&ld,&zero,W,&ld));
843:     aux = P;
844:     P = W;
845:     W = aux;
846:     PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&ld2,&mone,P,&inc,Q,&inc));
847:     PetscStackCallBLAS("LAPACKgesv",LAPACKgesv_(&n,&n,Q,&ld,ipiv,P,&ld,&info));
848:     PetscStackCallBLAS("BLASscal",BLASscal_(&ld2,&two,P,&inc));
849:     for (j=0;j<n;j++)
850:       P[j+j*ld] = P[j+j*ld] + 1.0;
851:   }

853:   for (k=1;k<=s;k++) {
854:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,P,&ld,P,&ld,&zero,W,&ld));
855:     PetscMemcpy(P,W,ld2*sizeof(PetscScalar));
856:   }
857:   if (P!=ds->mat[DS_MAT_F]) {
858:     PetscMemcpy(ds->mat[DS_MAT_F],P,ld2*sizeof(PetscScalar));
859:   }
860:   return(0);
861: #endif
862: }

866: PETSC_EXTERN PetscErrorCode DSCreate_NHEP(DS ds)
867: {
869:   ds->ops->allocate      = DSAllocate_NHEP;
870:   ds->ops->view          = DSView_NHEP;
871:   ds->ops->vectors       = DSVectors_NHEP;
872:   ds->ops->solve[0]      = DSSolve_NHEP;
873:   ds->ops->sort          = DSSort_NHEP;
874:   ds->ops->truncate      = DSTruncate_NHEP;
875:   ds->ops->update        = DSUpdateExtraRow_NHEP;
876:   ds->ops->cond          = DSCond_NHEP;
877:   ds->ops->transharm     = DSTranslateHarmonic_NHEP;
878:   ds->ops->normalize     = DSNormalize_NHEP;

880:   ds->ops->computefun[SLEPC_FUNCTION_EXP][0] = DSFunction_EXP_NHEP_PADE;
881:   return(0);
882: }

slepc-3.4.2.dfsg.orig/src/ds/impls/ghep/0000755000175000017500000000000012214143515016677 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/ghep/dsghep.c.html0000644000175000017500000004007612211062077021267 0ustar gladkgladk
Actual source code: dsghep.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 27: PetscErrorCode DSAllocate_GHEP(DS ds,PetscInt ld)
 28: {

 32:   DSAllocateMat_Private(ds,DS_MAT_A);
 33:   DSAllocateMat_Private(ds,DS_MAT_B);
 34:   DSAllocateMat_Private(ds,DS_MAT_Q);
 35:   PetscFree(ds->perm);
 36:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 37:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 38:   return(0);
 39: }

 43: PetscErrorCode DSView_GHEP(DS ds,PetscViewer viewer)
 44: {

 48:   DSViewMat_Private(ds,viewer,DS_MAT_A);
 49:   DSViewMat_Private(ds,viewer,DS_MAT_B);
 50:   if (ds->state>DS_STATE_INTERMEDIATE) {
 51:     DSViewMat_Private(ds,viewer,DS_MAT_Q);
 52:   }
 53:   return(0);
 54: }

 58: PetscErrorCode DSVectors_GHEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
 59: {
 60:   PetscScalar    *Q = ds->mat[DS_MAT_Q];
 61:   PetscInt       ld = ds->ld,i;

 65:   if (rnorm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
 66:   switch (mat) {
 67:     case DS_MAT_X:
 68:     case DS_MAT_Y:
 69:       if (j) {
 70:         if (ds->state>=DS_STATE_CONDENSED) {
 71:           PetscMemcpy(ds->mat[mat]+(*j)*ld,Q+(*j)*ld,ld*sizeof(PetscScalar));
 72:         } else {
 73:           PetscMemzero(ds->mat[mat]+(*j)*ld,ld*sizeof(PetscScalar));
 74:           *(ds->mat[mat]+(*j)+(*j)*ld) = 1.0;
 75:         }
 76:       } else {
 77:         if (ds->state>=DS_STATE_CONDENSED) {
 78:           PetscMemcpy(ds->mat[mat],Q,ld*ld*sizeof(PetscScalar));
 79:         } else {
 80:           PetscMemzero(ds->mat[mat],ld*ld*sizeof(PetscScalar));
 81:           for (i=0;i<ds->n;i++) *(ds->mat[mat]+i+i*ld) = 1.0;
 82:         }
 83:       }
 84:       break;
 85:     case DS_MAT_U:
 86:     case DS_MAT_VT:
 87:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
 88:       break;
 89:     default:
 90:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
 91:   }
 92:   return(0);
 93: }

 97: PetscErrorCode DSNormalize_GHEP(DS ds,DSMatType mat,PetscInt col)
 98: {
100:   PetscInt       i,i0,i1;
101:   PetscBLASInt   ld,n,one = 1;
102:   PetscScalar    norm,*x;

105:   switch (mat) {
106:     case DS_MAT_X:
107:     case DS_MAT_Y:
108:     case DS_MAT_Q:
109:       break;
110:     case DS_MAT_U:
111:     case DS_MAT_VT:
112:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
113:       break;
114:     default:
115:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
116:   }
117:   /* All the matrices resulting from DSVectors and DSSolve are B-normalized,
118:      but function returns 2-normalized vectors. */
119:   PetscBLASIntCast(ds->n,&n);
120:   PetscBLASIntCast(ds->ld,&ld);
121:   DSGetArray(ds,mat,&x);
122:   if (col < 0) {
123:     i0 = 0; i1 = ds->n;
124:   } else {
125:     i0 = col; i1 = col+1;
126:   }
127:   for (i=i0;i<i1;i++) {
128:     norm = BLASnrm2_(&n,&x[ld*i],&one);
129:     norm = 1.0/norm;
130:     PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
131:   }
132:   return(0);
133: }

137: PetscErrorCode DSSort_GHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
138: {
140:   PetscInt       n,l,i,*perm,ld=ds->ld;
141:   PetscScalar    *A;

144:   if (!ds->comparison) return(0);
145:   n = ds->n;
146:   l = ds->l;
147:   A  = ds->mat[DS_MAT_A];
148:   perm = ds->perm;
149:   for (i=l;i<n;i++) wr[i] = A[i+i*ld];
150:   if (rr) {
151:     DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_FALSE);
152:   } else {
153:     DSSortEigenvalues_Private(ds,wr,NULL,perm,PETSC_FALSE);
154:   }
155:   for (i=l;i<n;i++) A[i+i*ld] = wr[perm[i]];
156:   for (i=l;i<n;i++) wr[i] = A[i+i*ld];
157:   DSPermuteColumns_Private(ds,l,n,DS_MAT_Q,perm);
158:   return(0);
159: }

163: PetscErrorCode DSSolve_GHEP(DS ds,PetscScalar *wr,PetscScalar *wi)
164: {
165: #if defined(SLEPC_MISSING_LAPACK_SYGVD)
167:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SYGVD - Lapack routine is unavailable");
168: #else
170:   PetscScalar    *work,*A,*B,*Q;
171:   PetscBLASInt   itype = 1,*iwork,info,n1,liwork,ld,lrwork=0,lwork;
172:   PetscInt       off,i;
173: #if defined(PETSC_USE_COMPLEX)
174:   PetscReal      *rwork,*rr;
175: #endif

178:   PetscBLASIntCast(ds->n-ds->l,&n1);
179:   PetscBLASIntCast(ds->ld,&ld);
180:   PetscBLASIntCast(5*ds->n+3,&liwork);
181: #if defined(PETSC_USE_COMPLEX)
182:   PetscBLASIntCast(ds->n*ds->n+2*ds->n,&lwork);
183:   PetscBLASIntCast(2*ds->n*ds->n+5*ds->n+1+n1,&lrwork);
184: #else
185:   PetscBLASIntCast(2*ds->n*ds->n+6*ds->n+1,&lwork);
186: #endif
187:   DSAllocateWork_Private(ds,lwork,lrwork,liwork);
188:   work = ds->work;
189:   iwork = ds->iwork;
190:   off = ds->l+ds->l*ld;
191:   A = ds->mat[DS_MAT_A];
192:   B = ds->mat[DS_MAT_B];
193:   Q = ds->mat[DS_MAT_Q];
194: #if defined(PETSC_USE_COMPLEX)
195:   rr = ds->rwork;
196:   rwork = ds->rwork + n1;
197:   lrwork = ds->lrwork - n1;
198:   PetscStackCallBLAS("LAPACKsygvd",LAPACKsygvd_(&itype,"V","U",&n1,A+off,&ld,B+off,&ld,rr,work,&lwork,rwork,&lrwork,iwork,&liwork,&info));
199:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack ZHEGVD %d",info);
200:   for (i=0;i<n1;i++) wr[ds->l+i] = rr[i];
201: #else
202:   PetscStackCallBLAS("LAPACKsygvd",LAPACKsygvd_(&itype,"V","U",&n1,A+off,&ld,B+off,&ld,wr+ds->l,work,&lwork,iwork,&liwork,&info));
203:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DSYGVD %d",info);
204: #endif
205:   PetscMemzero(Q+ds->l*ld,n1*ld*sizeof(PetscScalar));
206:   for (i=ds->l;i<ds->n;i++) {
207:     PetscMemcpy(Q+ds->l+i*ld,A+ds->l+i*ld,n1*sizeof(PetscScalar));
208:   }
209:   PetscMemzero(B+ds->l*ld,n1*ld*sizeof(PetscScalar));
210:   PetscMemzero(A+ds->l*ld,n1*ld*sizeof(PetscScalar));
211:   for (i=ds->l;i<ds->n;i++) {
212:     if (wi) wi[i] = 0.0;
213:     B[i+i*ld] = 1.0;
214:     A[i+i*ld] = wr[i];
215:   }
216:   return(0);
217: #endif
218: }

222: PETSC_EXTERN PetscErrorCode DSCreate_GHEP(DS ds)
223: {
225:   ds->ops->allocate      = DSAllocate_GHEP;
226:   ds->ops->view          = DSView_GHEP;
227:   ds->ops->vectors       = DSVectors_GHEP;
228:   ds->ops->solve[0]      = DSSolve_GHEP;
229:   ds->ops->sort          = DSSort_GHEP;
230:   ds->ops->normalize     = DSNormalize_GHEP;
231:   return(0);
232: }

slepc-3.4.2.dfsg.orig/src/ds/impls/ghep/makefile0000644000175000017500000000213312211062077020376 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dsghep.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/ghep/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/ghep/makefile.html0000644000175000017500000000372412211062077021350 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dsghep.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/ghep/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/ghep/index.html0000644000175000017500000000124612211062077020677 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dsghep.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/ghep/dsghep.c0000644000175000017500000001723012211062077020320 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocate_GHEP" PetscErrorCode DSAllocate_GHEP(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_B);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView_GHEP" PetscErrorCode DSView_GHEP(DS ds,PetscViewer viewer) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSViewMat_Private(ds,viewer,DS_MAT_A);CHKERRQ(ierr); ierr = DSViewMat_Private(ds,viewer,DS_MAT_B);CHKERRQ(ierr); if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Q);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_GHEP" PetscErrorCode DSVectors_GHEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm) { PetscScalar *Q = ds->mat[DS_MAT_Q]; PetscInt ld = ds->ld,i; PetscErrorCode ierr; PetscFunctionBegin; if (rnorm) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); switch (mat) { case DS_MAT_X: case DS_MAT_Y: if (j) { if (ds->state>=DS_STATE_CONDENSED) { ierr = PetscMemcpy(ds->mat[mat]+(*j)*ld,Q+(*j)*ld,ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { ierr = PetscMemzero(ds->mat[mat]+(*j)*ld,ld*sizeof(PetscScalar));CHKERRQ(ierr); *(ds->mat[mat]+(*j)+(*j)*ld) = 1.0; } } else { if (ds->state>=DS_STATE_CONDENSED) { ierr = PetscMemcpy(ds->mat[mat],Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { ierr = PetscMemzero(ds->mat[mat],ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;in;i++) *(ds->mat[mat]+i+i*ld) = 1.0; } } break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSNormalize_GHEP" PetscErrorCode DSNormalize_GHEP(DS ds,DSMatType mat,PetscInt col) { PetscErrorCode ierr; PetscInt i,i0,i1; PetscBLASInt ld,n,one = 1; PetscScalar norm,*x; PetscFunctionBegin; switch (mat) { case DS_MAT_X: case DS_MAT_Y: case DS_MAT_Q: break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } /* All the matrices resulting from DSVectors and DSSolve are B-normalized, but function returns 2-normalized vectors. */ ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSGetArray(ds,mat,&x);CHKERRQ(ierr); if (col < 0) { i0 = 0; i1 = ds->n; } else { i0 = col; i1 = col+1; } for (i=i0;ild; PetscScalar *A; PetscFunctionBegin; if (!ds->comparison) PetscFunctionReturn(0); n = ds->n; l = ds->l; A = ds->mat[DS_MAT_A]; perm = ds->perm; for (i=l;in-ds->l,&n1);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(5*ds->n+3,&liwork);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) ierr = PetscBLASIntCast(ds->n*ds->n+2*ds->n,&lwork);CHKERRQ(ierr); ierr = PetscBLASIntCast(2*ds->n*ds->n+5*ds->n+1+n1,&lrwork);CHKERRQ(ierr); #else ierr = PetscBLASIntCast(2*ds->n*ds->n+6*ds->n+1,&lwork);CHKERRQ(ierr); #endif ierr = DSAllocateWork_Private(ds,lwork,lrwork,liwork);CHKERRQ(ierr); work = ds->work; iwork = ds->iwork; off = ds->l+ds->l*ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; Q = ds->mat[DS_MAT_Q]; #if defined(PETSC_USE_COMPLEX) rr = ds->rwork; rwork = ds->rwork + n1; lrwork = ds->lrwork - n1; PetscStackCallBLAS("LAPACKsygvd",LAPACKsygvd_(&itype,"V","U",&n1,A+off,&ld,B+off,&ld,rr,work,&lwork,rwork,&lrwork,iwork,&liwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack ZHEGVD %d",info); for (i=0;il+i] = rr[i]; #else PetscStackCallBLAS("LAPACKsygvd",LAPACKsygvd_(&itype,"V","U",&n1,A+off,&ld,B+off,&ld,wr+ds->l,work,&lwork,iwork,&liwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DSYGVD %d",info); #endif ierr = PetscMemzero(Q+ds->l*ld,n1*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=ds->l;in;i++) { ierr = PetscMemcpy(Q+ds->l+i*ld,A+ds->l+i*ld,n1*sizeof(PetscScalar));CHKERRQ(ierr); } ierr = PetscMemzero(B+ds->l*ld,n1*ld*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMemzero(A+ds->l*ld,n1*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=ds->l;in;i++) { if (wi) wi[i] = 0.0; B[i+i*ld] = 1.0; A[i+i*ld] = wr[i]; } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSCreate_GHEP" PETSC_EXTERN PetscErrorCode DSCreate_GHEP(DS ds) { PetscFunctionBegin; ds->ops->allocate = DSAllocate_GHEP; ds->ops->view = DSView_GHEP; ds->ops->vectors = DSVectors_GHEP; ds->ops->solve[0] = DSSolve_GHEP; ds->ops->sort = DSSort_GHEP; ds->ops->normalize = DSNormalize_GHEP; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/0000755000175000017500000000000012214143515017050 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep_hz.c0000644000175000017500000003176412211062077021353 0ustar gladkgladk/* HZ iteration for generalized symmetric-indefinite eigenproblem. Based on Matlab code from David Watkins. References: [1] D.S. Watkins, The Matrix Eigenvalue Problem: GR and Krylov Subspace Methods, SIAM, 2007. [2] M.A. Brebner, J. Grad, "Eigenvalues of Ax = lambda Bx for real symmetric matrices A and B computed by reduction to pseudosymmetric form and the HR process", Linear Alg. Appl. 43:99-118, 1982. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "UnifiedRotation" /* Sets up a 2-by-2 matrix to eliminate y in the vector [x y]'. Transformation is rotator if sygn = 1 and hyperbolic if sygn = -1. */ static PetscErrorCode UnifiedRotation(PetscReal x,PetscReal y,PetscReal sygn,PetscReal *rot,PetscReal *rcond,PetscBool *swap) { PetscReal nrm,c,s; PetscFunctionBegin; *swap = PETSC_FALSE; if (y == 0) { rot[0] = 1.0; rot[1] = 0.0; rot[2] = 0.0; rot[3] = 1.0; *rcond = 1.0; } else { nrm = PetscMax(PetscAbs(x),PetscAbs(y)); c = x/nrm; s = y/nrm; if (sygn == 1.0) { /* set up a rotator */ nrm = PetscSqrtReal(c*c+s*s); c = c/nrm; s = s/nrm; /* rot = [c s; -s c]; */ rot[0] = c; rot[1] = -s; rot[2] = s; rot[3] = c; *rcond = 1.0; } else if (sygn == -1) { /* set up a hyperbolic transformation */ nrm = c*c-s*s; if (nrm > 0) nrm = PetscSqrtReal(nrm); else if (nrm < 0) { nrm = PetscSqrtReal(-nrm); *swap = PETSC_TRUE; } else /* breakdown */ SETERRQ(PETSC_COMM_SELF,1,"Breakdown in construction of hyperbolic transformation"); c = c/nrm; s = s/nrm; /* rot = [c -s; -s c]; */ rot[0] = c; rot[1] = -s; rot[2] = -s; rot[3] = c; *rcond = PetscAbs(PetscAbs(s)-PetscAbs(c))/(PetscAbs(s)+PetscAbs(c)); } else SETERRQ(PETSC_COMM_SELF,1,"Value of sygn sent to transetup must be 1 or -1"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "HZStep" static PetscErrorCode HZStep(PetscBLASInt ntop,PetscBLASInt nn,PetscReal tr,PetscReal dt,PetscReal *aa,PetscReal *bb,PetscReal *dd,PetscScalar *uu,PetscInt n,PetscInt ld,PetscBool *flag) { PetscErrorCode ierr; PetscBLASInt one=1; PetscInt k,jj,ii; PetscBLASInt n_; PetscReal bulge10,bulge20,bulge30,bulge31,bulge41,bulge42; PetscReal sygn,rcond=1.0,worstcond,rot[4],buf[2],t; PetscScalar rtmp; PetscBool swap; PetscFunctionBegin; worstcond = 1.0; ierr = PetscBLASIntCast(n,&n_);CHKERRQ(ierr); /* Build initial bulge that sets step in motion */ bulge10 = dd[ntop+1]*(aa[ntop]*(aa[ntop] - dd[ntop]*tr) + dt*dd[ntop]*dd[ntop]) + dd[ntop]*bb[ntop]*bb[ntop]; bulge20 = bb[ntop]*(dd[ntop+1]*aa[ntop] + dd[ntop]*aa[ntop+1] - dd[ntop]*dd[ntop+1]*tr); bulge30 = bb[ntop]*bb[ntop+1]*dd[ntop]; bulge31 = 0.0; bulge41 = 0.0; bulge42 = 0.0; /* Chase the bulge */ for (jj=ntop;jjntop && PetscMax(PetscMax(PetscAbs(bulge10),PetscAbs(bulge20)),PetscAbs(bulge30)) ntop) bb[jj-1] = rot[0]*bulge10 + rot[2]*bulge20; buf[0] = rot[0]*rot[0]*aa[jj] + 2*rot[0]*rot[2]*bb[jj] + rot[2]*rot[2]*aa[jj+1]; buf[1] = rot[1]*rot[1]*aa[jj] + 2*rot[3]*rot[1]*bb[jj] + rot[3]*rot[3]*aa[jj+1]; bb[jj] = rot[1]*rot[0]*aa[jj] + rot[3]*rot[2]*aa[jj+1] + (rot[3]*rot[0] + rot[1]*rot[2])*bb[jj]; aa[jj] = buf[0]; aa[jj+1] = buf[1]; if (jj + 1 < nn-1) { /* buf = [ bulge31 bb(jj+1) ] * rot' */ buf[0] = rot[0]*bulge31 + rot[2]*bb[jj+1]; buf[1] = rot[1]*bulge31 + rot[3]*bb[jj+1]; bulge31 = buf[0]; bb[jj+1] = buf[1]; } if (jj + 2 < nn-1) { /* buf = [bulge41 bulge42] * rot' */ buf[0] = rot[0]*bulge41 + rot[2]*bulge42; buf[1] = rot[1]*bulge41 + rot[3]*bulge42; bulge41 = buf[0]; bulge42 = buf[1]; } /* Apply transforming matrix rot to D */ if (swap == 1) { buf[0] = dd[jj]; dd[jj] = dd[jj+1]; dd[jj+1] = buf[0]; } /* Accumulate transforming matrix, uu(jj:jj+1,:) = rot*uu(jj:jj+1,:) */ if (sygn==1) { PetscStackCallBLAS("BLASrot",BLASrot_(&n_,uu+jj*ld,&one,uu+(jj+1)*ld,&one,&rot[0],&rot[2])); } else { if (PetscAbsReal(rot[0])>PetscAbsReal(rot[1])) { /* Type I */ t = rot[1]/rot[0]; for (ii=0;ii= cgd && nits < nstop) { /* Check for zeros on the subdiagonal */ jj = nbot - 1; while (jj>=cgd && PetscAbs(bb[jj])>PETSC_MACHINE_EPSILON*(PetscAbs(aa[jj])+PetscAbs(aa[jj+1]))) jj = jj-1; if (jj>=cgd) bb[jj]=0; ntop = jj + 1; /* starting point for step */ if (ntop == nbot) { /* isolate single eigenvalue */ nbot = ntop - 1; its = 0; } else if (ntop+1 == nbot) { /* isolate pair of eigenvalues */ htr = 0.5*(aa[ntop]*dd[ntop] + aa[nbot]*dd[nbot]); det = dd[ntop]*dd[nbot]*(aa[ntop]*aa[nbot]-bb[ntop]*bb[ntop]); dis = htr*htr - det; if (dis > 0) { /* distinct real eigenvalues */ if (dd[ntop] == dd[nbot]) { /* separate the eigenvalues by a Jacobi rotator */ dif = aa[ntop]-aa[nbot]; if (2.0*PetscAbs(bb[ntop])<=dif) { tn = 2*bb[ntop]/dif; tn = tn/(1.0 + PetscSqrtScalar(1.0+tn*tn)); } else { kt = dif/(2.0*bb[ntop]); tn = PetscSign(kt)/(PetscAbs(kt)+PetscSqrtScalar(1.0+kt*kt)); } c = 1.0/PetscSqrtScalar(1.0 + tn*tn); s = c*tn; aa[ntop] = aa[ntop] + tn*bb[ntop]; aa[nbot] = aa[nbot] - tn*bb[ntop]; bb[ntop] = 0; j2 = nn-cgd; PetscStackCallBLAS("BLASrot",BLASrot_(&j2,uu+ntop*ld+cgd,&one,uu+nbot*ld+cgd,&one,&c,&s)); } else { dis = PetscSqrtScalar(dis); if (htr < 0) dis = -dis; } } nbot = ntop - 1; } else { /* Do an HZ iteration */ its = its + 1; nits = nits + 1; tr = aa[nbot-1]*dd[nbot-1] + aa[nbot]*dd[nbot]; dt = dd[nbot-1]*dd[nbot]*(aa[nbot-1]*aa[nbot]-bb[nbot-1]*bb[nbot-1]); for (ntry=1;ntry<=6;ntry++) { ierr = HZStep(ntop,nbot+1,tr,dt,aa,bb,dd,uu,nn,ld,&flag);CHKERRQ(ierr); if (!flag) break; else if (ntry == 6) SETERRQ(PETSC_COMM_SELF,1,"Unable to complete hz step on six tries"); else { tr = 0.9*tr; dt = 0.81*dt; } } } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSolve_GHIEP_HZ" PetscErrorCode DSSolve_GHIEP_HZ(DS ds,PetscScalar *wr,PetscScalar *wi) { PetscErrorCode ierr; PetscInt off; PetscBLASInt n1,ld; PetscScalar *A,*B,*Q; PetscReal *d,*e,*s; #if defined(PETSC_USE_COMPLEX) PetscInt i; #endif PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) PetscValidPointer(wi,3); #endif ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); n1 = ds->n - ds->l; off = ds->l + ds->l*ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T] + ld; s = ds->rmat[DS_MAT_D]; /* Quick return */ if (n1 == 1) { *(Q+off) = 1; if (ds->compact) { wr[ds->l] = d[ds->l]/s[ds->l]; wi[ds->l] = 0.0; } else { d[ds->l] = PetscRealPart(A[off]); s[ds->l] = PetscRealPart(B[off]); wr[ds->l] = d[ds->l]/s[ds->l]; wi[ds->l] = 0.0; } PetscFunctionReturn(0); } /* Reduce to pseudotriadiagonal form */ ierr = DSIntermediate_GHIEP(ds);CHKERRQ(ierr); ierr = HZIteration(ds->n,ds->l,d,e,s,Q,ld);CHKERRQ(ierr); if (!ds->compact) { ierr = DSSwitchFormat_GHIEP(ds,PETSC_FALSE);CHKERRQ(ierr); } /* Undo from diagonal the blocks whith real eigenvalues*/ ierr = DSGHIEPRealBlocks(ds);CHKERRQ(ierr); /* Recover eigenvalues from diagonal */ ierr = DSGHIEPComplexEigs(ds,0,ds->n,wr,wi);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) if (wi) { for (i=ds->l;in;i++) wi[i] = 0.0; } #endif ds->t = ds->n; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep.c0000644000175000017500000007613112211062077020647 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocate_GHIEP" PetscErrorCode DSAllocate_GHIEP(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_B);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = DSAllocateMatReal_Private(ds,DS_MAT_T);CHKERRQ(ierr); ierr = DSAllocateMatReal_Private(ds,DS_MAT_D);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSwitchFormat_GHIEP" PetscErrorCode DSSwitchFormat_GHIEP(DS ds,PetscBool tocompact) { PetscErrorCode ierr; PetscReal *T,*S; PetscScalar *A,*B; PetscInt i,n,ld; PetscFunctionBegin; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; T = ds->rmat[DS_MAT_T]; S = ds->rmat[DS_MAT_D]; n = ds->n; ld = ds->ld; if (tocompact) { /* switch from dense (arrow) to compact storage */ ierr = PetscMemzero(T,3*ld*sizeof(PetscReal));CHKERRQ(ierr); ierr = PetscMemzero(S,ld*sizeof(PetscReal));CHKERRQ(ierr); for (i=0;il;i< ds->k;i++) T[2*ld+i] = PetscRealPart(A[ds->k+i*ld]); } else { /* switch from compact (arrow) to dense storage */ ierr = PetscMemzero(A,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMemzero(B,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;il;ik;i++) { A[ds->k+i*ld] = T[2*ld+i]; A[i+ds->k*ld] = T[2*ld+i]; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView_GHIEP" PetscErrorCode DSView_GHIEP(DS ds,PetscViewer viewer) { PetscErrorCode ierr; PetscViewerFormat format; PetscInt i,j; PetscReal value; const char *methodname[] = { "HR method", "QR + Inverse Iteration", "QR", "DQDS + Inverse Iteration " }; const int nmeth=sizeof(methodname)/sizeof(methodname[0]); PetscFunctionBegin; ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) { if (ds->method>=nmeth) { ierr = PetscViewerASCIIPrintf(viewer,"solving the problem with: INVALID METHOD\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer,"solving the problem with: %s\n",methodname[ds->method]);CHKERRQ(ierr); } PetscFunctionReturn(0); } if (ds->compact) { ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_MATLAB) { ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",ds->n,ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",3*ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr); for (i=0;in;i++) { ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_T]+i));CHKERRQ(ierr); } for (i=0;in-1;i++) { if (*(ds->rmat[DS_MAT_T]+ds->ld+i) !=0 && i!=ds->k-1) { ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+2,i+1,*(ds->rmat[DS_MAT_T]+ds->ld+i));CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,i+2,*(ds->rmat[DS_MAT_T]+ds->ld+i));CHKERRQ(ierr); } } for (i = ds->l;ik;i++) { ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",ds->k+1,i+1,*(ds->rmat[DS_MAT_T]+2*ds->ld+i));CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,ds->k+1,*(ds->rmat[DS_MAT_T]+2*ds->ld+i));CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(zzz);\n",DSMatName[DS_MAT_A]);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",ds->n,ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"omega = zeros(%D,3);\n",3*ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"omega = [\n");CHKERRQ(ierr); for (i=0;in;i++) { ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_D]+i));CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(omega);\n",DSMatName[DS_MAT_B]);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer,"T\n");CHKERRQ(ierr); for (i=0;in;i++) { for (j=0;jn;j++) { if (i==j) value = *(ds->rmat[DS_MAT_T]+i); else if (i==j+1 || j==i+1) value = *(ds->rmat[DS_MAT_T]+ds->ld+PetscMin(i,j)); else if ((ik && j==ds->k) || (i==ds->k && jk)) value = *(ds->rmat[DS_MAT_T]+2*ds->ld+PetscMin(i,j)); else value = 0.0; ierr = PetscViewerASCIIPrintf(viewer," %18.16e ",value);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"omega\n");CHKERRQ(ierr); for (i=0;in;i++) { for (j=0;jn;j++) { if (i==j) value = *(ds->rmat[DS_MAT_D]+i); else value = 0.0; ierr = PetscViewerASCIIPrintf(viewer," %18.16e ",value);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } } ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerFlush(viewer);CHKERRQ(ierr); } else { ierr = DSViewMat_Private(ds,viewer,DS_MAT_A);CHKERRQ(ierr); ierr = DSViewMat_Private(ds,viewer,DS_MAT_B);CHKERRQ(ierr); } if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Q);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_GHIEP_Eigen_Some" PetscErrorCode DSVectors_GHIEP_Eigen_Some(DS ds,PetscInt *idx,PetscReal *rnorm) { PetscErrorCode ierr; PetscReal b[4],M[4],d1,d2,s1,s2,e; PetscReal scal1,scal2,wr1,wr2,wi,ep,norm; PetscScalar *Q,*X,Y[4],alpha,zeroS = 0.0; PetscInt k; PetscBLASInt two = 2,n_,ld,one=1; #if !defined(PETSC_USE_COMPLEX) PetscBLASInt four=4; #endif PetscFunctionBegin; X = ds->mat[DS_MAT_X]; Q = ds->mat[DS_MAT_Q]; k = *idx; ierr = PetscBLASIntCast(ds->n,&n_);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); if (k < ds->n-1) { e = (ds->compact)?*(ds->rmat[DS_MAT_T]+ld+k):PetscRealPart(*(ds->mat[DS_MAT_A]+(k+1)+ld*k)); } else e = 0.0; if (e == 0.0) {/* Real */ if (ds->state>=DS_STATE_CONDENSED) { ierr = PetscMemcpy(X+k*ld,Q+k*ld,ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { ierr = PetscMemzero(X+k*ds->ld,ds->ld*sizeof(PetscScalar));CHKERRQ(ierr); X[k+k*ds->ld] = 1.0; } if (rnorm) { *rnorm = PetscAbsScalar(X[ds->n-1+k*ld]); } } else { /* 2x2 block */ if (ds->compact) { s1 = *(ds->rmat[DS_MAT_D]+k); d1 = *(ds->rmat[DS_MAT_T]+k); s2 = *(ds->rmat[DS_MAT_D]+k+1); d2 = *(ds->rmat[DS_MAT_T]+k+1); } else { s1 = PetscRealPart(*(ds->mat[DS_MAT_B]+k*ld+k)); d1 = PetscRealPart(*(ds->mat[DS_MAT_A]+k+k*ld)); s2 = PetscRealPart(*(ds->mat[DS_MAT_B]+(k+1)*ld+k+1)); d2 = PetscRealPart(*(ds->mat[DS_MAT_A]+k+1+(k+1)*ld)); } M[0] = d1; M[1] = e; M[2] = e; M[3]= d2; b[0] = s1; b[1] = 0.0; b[2] = 0.0; b[3] = s2; ep = LAPACKlamch_("S"); /* Compute eigenvalues of the block */ PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(M,&two,b,&two,&ep,&scal1,&scal2,&wr1,&wr2,&wi)); if (wi==0.0) /* Real eigenvalues */ SETERRQ(PETSC_COMM_SELF,1,"Real block in DSVectors_GHIEP"); else { /* Complex eigenvalues */ if (scal1state >= DS_STATE_CONDENSED) { alpha = norm; PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n_,&two,&two,&alpha,ds->mat[DS_MAT_Q]+k*ld,&ld,Y,&two,&zeroS,X+k*ld,&ld)); if (rnorm) *rnorm = SlepcAbsEigenvalue(X[ds->n-1+k*ld],X[ds->n-1+(k+1)*ld]); } else { ierr = PetscMemzero(X+k*ld,2*ld*sizeof(PetscScalar));CHKERRQ(ierr); X[k*ld+k] = Y[0]*norm; X[k*ld+k+1] = Y[1]*norm; X[(k+1)*ld+k] = Y[2]*norm; X[(k+1)*ld+k+1] = Y[3]*norm; } #else if (SlepcAbs(s1*d1-wr1,wi)state >= DS_STATE_CONDENSED) { alpha = norm; PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n_,&two,&alpha,ds->mat[DS_MAT_Q]+k*ld,&ld,Y,&one,&zeroS,X+k*ld,&one)); if (rnorm) *rnorm = PetscAbsScalar(X[ds->n-1+k*ld]); } else { ierr = PetscMemzero(X+k*ld,2*ld*sizeof(PetscScalar));CHKERRQ(ierr); X[k*ld+k] = Y[0]*norm; X[k*ld+k+1] = Y[1]*norm; } X[(k+1)*ld+k] = PetscConj(X[k*ld+k]); X[(k+1)*ld+k+1] = PetscConj(X[k*ld+k+1]); #endif (*idx)++; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_GHIEP" PetscErrorCode DSVectors_GHIEP(DS ds,DSMatType mat,PetscInt *k,PetscReal *rnorm) { PetscInt i; PetscReal e; PetscErrorCode ierr; PetscFunctionBegin; switch (mat) { case DS_MAT_X: if (k) { ierr = DSVectors_GHIEP_Eigen_Some(ds,k,rnorm);CHKERRQ(ierr); } else { for (i=0; in; i++) { e = (ds->compact)?*(ds->rmat[DS_MAT_T]+ds->ld+i):PetscRealPart(*(ds->mat[DS_MAT_A]+(i+1)+ds->ld*i)); if (e == 0.0) {/* real */ if (ds->state >= DS_STATE_CONDENSED) { ierr = PetscMemcpy(ds->mat[mat]+i*ds->ld,ds->mat[DS_MAT_Q]+i*ds->ld,ds->ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { ierr = PetscMemzero(ds->mat[mat]+i*ds->ld,ds->ld*sizeof(PetscScalar));CHKERRQ(ierr); *(ds->mat[mat]+i+i*ds->ld) = 1.0; } } else { ierr = DSVectors_GHIEP_Eigen_Some(ds,&i,rnorm);CHKERRQ(ierr); } } } break; case DS_MAT_Y: case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGHIEPComplexEigs" /* Extract the eigenvalues contained in the block-diagonal of the indefinite problem. Only the index range n0..n1 is processed. */ PetscErrorCode DSGHIEPComplexEigs(DS ds,PetscInt n0,PetscInt n1,PetscScalar *wr,PetscScalar *wi) { PetscInt k,ld; PetscBLASInt two=2; PetscScalar *A,*B; PetscReal *D,*T; PetscReal b[4],M[4],d1,d2,s1,s2,e; PetscReal scal1,scal2,ep,wr1,wr2,wi1; PetscFunctionBegin; ld = ds->ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; D = ds->rmat[DS_MAT_D]; T = ds->rmat[DS_MAT_T]; for (k=n0;kcompact)?T[ld+k]:PetscRealPart(A[(k+1)+ld*k]); } else { e = 0.0; } if (e==0.0) { /* real eigenvalue */ wr[k] = (ds->compact)?T[k]/D[k]:A[k+k*ld]/B[k+k*ld]; #if !defined(PETSC_USE_COMPLEX) wi[k] = 0.0 ; #endif } else { /* diagonal block */ if (ds->compact) { s1 = D[k]; d1 = T[k]; s2 = D[k+1]; d2 = T[k+1]; } else { s1 = PetscRealPart(B[k*ld+k]); d1 = PetscRealPart(A[k+k*ld]); s2 = PetscRealPart(B[(k+1)*ld+k+1]); d2 = PetscRealPart(A[k+1+(k+1)*ld]); } M[0] = d1; M[1] = e; M[2] = e; M[3]= d2; b[0] = s1; b[1] = 0.0; b[2] = 0.0; b[3] = s2; ep = LAPACKlamch_("S"); /* Compute eigenvalues of the block */ PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(M,&two,b,&two,&ep,&scal1,&scal2,&wr1,&wr2,&wi1)); if (scal1n; d = ds->rmat[DS_MAT_T]; e = d + ds->ld; s = ds->rmat[DS_MAT_D]; ierr = DSAllocateWork_Private(ds,ds->ld,ds->ld,0);CHKERRQ(ierr); perm = ds->perm; if (!rr) { rr = wr; ri = wi; } ierr = DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_TRUE);CHKERRQ(ierr); if (!ds->compact) { ierr = DSSwitchFormat_GHIEP(ds,PETSC_TRUE);CHKERRQ(ierr); } ierr = PetscMemcpy(ds->work,wr,n*sizeof(PetscScalar));CHKERRQ(ierr); for (i=ds->l;iwork + perm[i]); } #if !defined(PETSC_USE_COMPLEX) ierr = PetscMemcpy(ds->work,wi,n*sizeof(PetscScalar));CHKERRQ(ierr); for (i=ds->l;iwork + perm[i]); } #endif ierr = PetscMemcpy(ds->rwork,s,n*sizeof(PetscReal));CHKERRQ(ierr); for (i=ds->l;irwork+perm[i]); } ierr = PetscMemcpy(ds->rwork,d,n*sizeof(PetscReal));CHKERRQ(ierr); for (i=ds->l;irwork + perm[i]); } ierr = PetscMemcpy(ds->rwork,e,(n-1)*sizeof(PetscReal));CHKERRQ(ierr); ierr = PetscMemzero(e+ds->l,(n-1-ds->l)*sizeof(PetscScalar));CHKERRQ(ierr); for (i=ds->l;irwork + perm[i]); } if (!ds->compact) { ierr = DSSwitchFormat_GHIEP(ds,PETSC_FALSE);CHKERRQ(ierr); } ierr = DSPermuteColumns_Private(ds,ds->l,n,DS_MAT_Q,perm);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGHIEPInverseIteration" /* Get eigenvectors with inverse iteration. The system matrix is in Hessenberg form. */ PetscErrorCode DSGHIEPInverseIteration(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(PETSC_MISSING_LAPACK_HSEIN) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"HSEIN - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i,off; PetscBLASInt *select,*infoC,ld,n1,mout,info; PetscScalar *A,*B,*H,*X; PetscReal *s,*d,*e; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->n-ds->l,&n1);CHKERRQ(ierr); ierr = DSAllocateWork_Private(ds,ld*ld+2*ld,ld,2*ld);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; H = ds->mat[DS_MAT_W]; s = ds->rmat[DS_MAT_D]; d = ds->rmat[DS_MAT_T]; e = d + ld; select = ds->iwork; infoC = ds->iwork + ld; off = ds->l+ds->l*ld; if (ds->compact) { H[off] = d[ds->l]*s[ds->l]; H[off+ld] = e[ds->l]*s[ds->l]; for (i=ds->l+1;in-1;i++) { H[i+(i-1)*ld] = e[i-1]*s[i]; H[i+i*ld] = d[i]*s[i]; H[i+(i+1)*ld] = e[i]*s[i]; } H[ds->n-1+(ds->n-2)*ld] = e[ds->n-2]*s[ds->n-1]; H[ds->n-1+(ds->n-1)*ld] = d[ds->n-1]*s[ds->n-1]; } else { s[ds->l] = PetscRealPart(B[off]); H[off] = A[off]*s[ds->l]; H[off+ld] = A[off+ld]*s[ds->l]; for (i=ds->l+1;in-1;i++) { s[i] = PetscRealPart(B[i+i*ld]); H[i+(i-1)*ld] = A[i+(i-1)*ld]*s[i]; H[i+i*ld] = A[i+i*ld]*s[i]; H[i+(i+1)*ld] = A[i+(i+1)*ld]*s[i]; } s[ds->n-1] = PetscRealPart(B[ds->n-1+(ds->n-1)*ld]); H[ds->n-1+(ds->n-2)*ld] = A[ds->n-1+(ds->n-2)*ld]*s[ds->n-1]; H[ds->n-1+(ds->n-1)*ld] = A[ds->n-1+(ds->n-1)*ld]*s[ds->n-1]; } ierr = DSAllocateMat_Private(ds,DS_MAT_X);CHKERRQ(ierr); X = ds->mat[DS_MAT_X]; for (i=0;il,wi+ds->l,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,NULL,infoC,&info)); #else PetscStackCallBLAS("LAPACKhsein",LAPACKhsein_("R","N","N",select,&n1,H+off,&ld,wr+ds->l,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,ds->rwork,NULL,infoC,&info)); #endif if (info<0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in hsein routine %d",-i); if (info>0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Convergence error in hsein routine %d",i); ierr = DSGHIEPOrthogEigenv(ds,DS_MAT_X,wr,wi,PETSC_TRUE);CHKERRQ(ierr); PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSGHIEPRealBlocks" /* Undo 2x2 blocks that have real eigenvalues. */ PetscErrorCode DSGHIEPRealBlocks(DS ds) { PetscErrorCode ierr; PetscInt i; PetscReal e,d1,d2,s1,s2,ss1,ss2,t,dd,ss; PetscReal maxy,ep,scal1,scal2,snorm; PetscReal *T,*D,b[4],M[4],wr1,wr2,wi; PetscScalar *A,*B,Y[4],oneS = 1.0,zeroS = 0.0; PetscBLASInt m,two=2,ld; PetscBool isreal; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->n-ds->l,&m);CHKERRQ(ierr); A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; T = ds->rmat[DS_MAT_T]; D = ds->rmat[DS_MAT_D]; ierr = DSAllocateWork_Private(ds,2*m,0,0);CHKERRQ(ierr); for (i=ds->l;in-1;i++) { e = (ds->compact)?T[ld+i]:PetscRealPart(A[(i+1)+ld*i]); if (e != 0.0) { /* 2x2 block */ if (ds->compact) { s1 = D[i]; d1 = T[i]; s2 = D[i+1]; d2 = T[i+1]; } else { s1 = PetscRealPart(B[i*ld+i]); d1 = PetscRealPart(A[i*ld+i]); s2 = PetscRealPart(B[(i+1)*ld+i+1]); d2 = PetscRealPart(A[(i+1)*ld+i+1]); } isreal = PETSC_FALSE; if (s1==s2) { /* apply a Jacobi rotation to compute the eigendecomposition */ dd = d1-d2; if (2*PetscAbsReal(e) <= dd) { t = 2*e/dd; t = t/(1 + PetscSqrtReal(1+t*t)); } else { t = dd/(2*e); ss = (t>=0)?1.0:-1.0; t = ss/(PetscAbsReal(t)+PetscSqrtReal(1+t*t)); } Y[0] = 1/PetscSqrtReal(1 + t*t); Y[3] = Y[0]; /* c */ Y[1] = Y[0]*t; Y[2] = -Y[1]; /* s */ wr1 = d1+t*e; wr2 = d2-t*e; ss1 = s1; ss2 = s2; isreal = PETSC_TRUE; } else { ss1 = 1.0; ss2 = 1.0, M[0] = d1; M[1] = e; M[2] = e; M[3]= d2; b[0] = s1; b[1] = 0.0; b[2] = 0.0; b[3] = s2; ep = LAPACKlamch_("S"); /* Compute eigenvalues of the block */ PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(M,&two,b,&two,&ep,&scal1,&scal2,&wr1,&wr2,&wi)); if (wi==0.0) { /* Real eigenvalues */ isreal = PETSC_TRUE; if (scal1compact) { D[i] = ss1;; T[i] = wr1; D[i+1] = ss2; T[i+1] = wr2; T[ld+i] = 0.0; } else { B[i*ld+i] = ss1; A[i*ld+i] = wr1; B[(i+1)*ld+i+1] = ss2; A[(i+1)*ld+i+1] = wr2; A[(i+1)+ld*i] = 0.0; A[i+ld*(i+1)] = 0.0; } PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&m,&two,&two,&oneS,ds->mat[DS_MAT_Q]+ds->l+i*ld,&ld,Y,&two,&zeroS,ds->work,&m)); ierr = PetscMemcpy(ds->mat[DS_MAT_Q]+ds->l+i*ld,ds->work,m*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMemcpy(ds->mat[DS_MAT_Q]+ds->l+(i+1)*ld,ds->work+m,m*sizeof(PetscScalar));CHKERRQ(ierr); } i++; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSolve_GHIEP_QR_II" PetscErrorCode DSSolve_GHIEP_QR_II(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(PETSC_MISSING_LAPACK_HSEQR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"HSEQR - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i,off; PetscBLASInt n1,ld,one,info,lwork; PetscScalar *H,*A,*B,*Q; PetscReal *d,*e,*s; PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) PetscValidPointer(wi,3); #endif one = 1; ierr = PetscBLASIntCast(ds->n-ds->l,&n1);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); off = ds->l + ds->l*ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T] + ld; s = ds->rmat[DS_MAT_D]; ierr = DSAllocateWork_Private(ds,ld*ld,2*ld,ld*2);CHKERRQ(ierr); lwork = ld*ld; /* Quick return if possible */ if (n1 == 1) { *(Q+off) = 1; if (!ds->compact) { d[ds->l] = PetscRealPart(A[off]); s[ds->l] = PetscRealPart(B[off]); } wr[ds->l] = d[ds->l]/s[ds->l]; if (wi) wi[ds->l] = 0.0; PetscFunctionReturn(0); } /* Reduce to pseudotriadiagonal form */ ierr = DSIntermediate_GHIEP(ds);CHKERRQ(ierr); /* Compute Eigenvalues (QR)*/ ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); H = ds->mat[DS_MAT_W]; if (ds->compact) { H[off] = d[ds->l]*s[ds->l]; H[off+ld] = e[ds->l]*s[ds->l]; for (i=ds->l+1;in-1;i++) { H[i+(i-1)*ld] = e[i-1]*s[i]; H[i+i*ld] = d[i]*s[i]; H[i+(i+1)*ld] = e[i]*s[i]; } H[ds->n-1+(ds->n-2)*ld] = e[ds->n-2]*s[ds->n-1]; H[ds->n-1+(ds->n-1)*ld] = d[ds->n-1]*s[ds->n-1]; } else { s[ds->l] = PetscRealPart(B[off]); H[off] = A[off]*s[ds->l]; H[off+ld] = A[off+ld]*s[ds->l]; for (i=ds->l+1;in-1;i++) { s[i] = PetscRealPart(B[i+i*ld]); H[i+(i-1)*ld] = A[i+(i-1)*ld]*s[i]; H[i+i*ld] = A[i+i*ld]*s[i]; H[i+(i+1)*ld] = A[i+(i+1)*ld]*s[i]; } s[ds->n-1] = PetscRealPart(B[ds->n-1+(ds->n-1)*ld]); H[ds->n-1+(ds->n-2)*ld] = A[ds->n-1+(ds->n-2)*ld]*s[ds->n-1]; H[ds->n-1+(ds->n-1)*ld] = A[ds->n-1+(ds->n-1)*ld]*s[ds->n-1]; } #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("E","N",&n1,&one,&n1,H+off,&ld,wr+ds->l,wi+ds->l,NULL,&ld,ds->work,&lwork,&info)); #else PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("E","N",&n1,&one,&n1,H+off,&ld,wr+ds->l,NULL,&ld,ds->work,&lwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xHSEQR %d",&info); /* Compute Eigenvectors with Inverse Iteration */ ierr = DSGHIEPInverseIteration(ds,wr,wi);CHKERRQ(ierr); /* Recover eigenvalues from diagonal */ ierr = DSGHIEPComplexEigs(ds,0,ds->l,wr,wi);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) if (wi) { for (i=ds->l;in;i++) wi[i] = 0.0; } #endif PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSSolve_GHIEP_QR" PetscErrorCode DSSolve_GHIEP_QR(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(SLEPC_MISSING_LAPACK_GEHRD) || defined(SLEPC_MISSING_LAPACK_ORGHR) || defined(PETSC_MISSING_LAPACK_HSEQR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEHRD/ORGHR/HSEQR - Lapack routines are unavailable"); #else PetscErrorCode ierr; PetscInt i,off; PetscBLASInt n1,ld,one,info,lwork,mout; PetscScalar *H,*A,*B,*Q,*X; PetscReal *d,*e,*s; PetscFunctionBegin; #if !defined(PETSC_USE_COMPLEX) PetscValidPointer(wi,3); #endif one = 1; ierr = PetscBLASIntCast(ds->n-ds->l,&n1);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); off = ds->l + ds->l*ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T] + ld; s = ds->rmat[DS_MAT_D]; ierr = DSAllocateWork_Private(ds,ld+ld*ld,2*ld,ld*2);CHKERRQ(ierr); lwork = ld*ld; /* Quick return if possible */ if (n1 == 1) { *(Q+off) = 1; if (!ds->compact) { d[ds->l] = PetscRealPart(A[off]); s[ds->l] = PetscRealPart(B[off]); } wr[ds->l] = d[ds->l]/s[ds->l]; if (wi) wi[ds->l] = 0.0; PetscFunctionReturn(0); } /* Reduce to pseudotriadiagonal form */ ierr = DSIntermediate_GHIEP(ds);CHKERRQ(ierr); /* form standard problem in H */ ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); H = ds->mat[DS_MAT_W]; if (ds->compact) { H[off] = d[ds->l]*s[ds->l]; H[off+ld] = e[ds->l]*s[ds->l]; for (i=ds->l+1;in-1;i++) { H[i+(i-1)*ld] = e[i-1]*s[i]; H[i+i*ld] = d[i]*s[i]; H[i+(i+1)*ld] = e[i]*s[i]; } H[ds->n-1+(ds->n-2)*ld] = e[ds->n-2]*s[ds->n-1]; H[ds->n-1+(ds->n-1)*ld] = d[ds->n-1]*s[ds->n-1]; } else { s[ds->l] = PetscRealPart(B[off]); H[off] = A[off]*s[ds->l]; H[off+ld] = A[off+ld]*s[ds->l]; for (i=ds->l+1;in-1;i++) { s[i] = PetscRealPart(B[i+i*ld]); H[i+(i-1)*ld] = A[i+(i-1)*ld]*s[i]; H[i+i*ld] = A[i+i*ld]*s[i]; H[i+(i+1)*ld] = A[i+(i+1)*ld]*s[i]; } s[ds->n-1] = PetscRealPart(B[ds->n-1+(ds->n-1)*ld]); H[ds->n-1+(ds->n-2)*ld] = A[ds->n-1+(ds->n-2)*ld]*s[ds->n-1]; H[ds->n-1+(ds->n-1)*ld] = A[ds->n-1+(ds->n-1)*ld]*s[ds->n-1]; } /* Compute the real Schur form */ ierr = DSAllocateMat_Private(ds,DS_MAT_X);CHKERRQ(ierr); X = ds->mat[DS_MAT_X]; #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","I",&n1,&one,&n1,H+off,&ld,wr+ds->l,wi+ds->l,X+off,&ld,ds->work,&lwork,&info)); #else PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","I",&n1,&one,&n1,H+off,&ld,wr+ds->l,X+off,&ld,ds->work,&lwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xHSEQR %d",&info); /* Compute eigenvectors */ #if !defined(PETSC_USE_COMPLEX) PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_("R","B",NULL,&n1,H+off,&ld,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,&info)); #else PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_("R","B",NULL,&n1,H+off,&ld,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,ds->rwork,&info)); #endif if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTREVC %i",&info); /* Compute real s-orthonormal basis */ ierr = DSGHIEPOrthogEigenv(ds,DS_MAT_X,wr,wi,PETSC_TRUE);CHKERRQ(ierr); /* Recover eigenvalues from diagonal */ ierr = DSGHIEPComplexEigs(ds,0,ds->l,wr,wi);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) if (wi) { for (i=ds->l;in;i++) wi[i] = 0.0; } #endif PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSNormalize_GHIEP" PetscErrorCode DSNormalize_GHIEP(DS ds,DSMatType mat,PetscInt col) { PetscErrorCode ierr; PetscInt i,i0,i1; PetscBLASInt ld,n,one = 1; PetscScalar *A = ds->mat[DS_MAT_A],norm,*x; #if !defined(PETSC_USE_COMPLEX) PetscScalar norm0; #endif PetscFunctionBegin; switch (mat) { case DS_MAT_X: case DS_MAT_Y: case DS_MAT_Q: /* Supported matrices */ break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSGetArray(ds,mat,&x);CHKERRQ(ierr); if (col < 0) { i0 = 0; i1 = ds->n; } else if (col>0 && A[ds->ld*(col-1)+col] != 0.0) { i0 = col-1; i1 = col+1; } else { i0 = col; i1 = col+1; } for (i=i0; ild*i+i+1] != 0.0) { norm = BLASnrm2_(&n,&x[ld*i],&one); norm0 = BLASnrm2_(&n,&x[ld*(i+1)],&one); norm = 1.0/SlepcAbsEigenvalue(norm,norm0); PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one)); PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*(i+1)],&one)); i++; } else #endif { norm = BLASnrm2_(&n,&x[ld*i],&one); norm = 1.0/norm; PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one)); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSCreate_GHIEP" PETSC_EXTERN PetscErrorCode DSCreate_GHIEP(DS ds) { PetscFunctionBegin; ds->ops->allocate = DSAllocate_GHIEP; ds->ops->view = DSView_GHIEP; ds->ops->vectors = DSVectors_GHIEP; ds->ops->solve[0] = DSSolve_GHIEP_HZ; ds->ops->solve[1] = DSSolve_GHIEP_QR_II; ds->ops->solve[2] = DSSolve_GHIEP_QR; ds->ops->solve[3] = DSSolve_GHIEP_DQDS_II; ds->ops->sort = DSSort_GHIEP; ds->ops->normalize = DSNormalize_GHIEP; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep_hz.c.html0000644000175000017500000006325212211062077022313 0ustar gladkgladk

Actual source code: dsghiep_hz.c

  1: /*
  2:    HZ iteration for generalized symmetric-indefinite eigenproblem.
  3:    Based on Matlab code from David Watkins.

  5:    References:

  7:        [1] D.S. Watkins, The Matrix Eigenvalue Problem: GR and Krylov Subspace
  8:            Methods, SIAM, 2007.

 10:        [2] M.A. Brebner, J. Grad, "Eigenvalues of Ax = lambda Bx for real
 11:            symmetric matrices A and B computed by reduction to pseudosymmetric
 12:            form and the HR process", Linear Alg. Appl. 43:99-118, 1982.

 14:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 15:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 16:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 18:    This file is part of SLEPc.

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

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

 29:    You  should have received a copy of the GNU Lesser General  Public  License
 30:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 31:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 32: */
 33: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 34: #include <slepcblaslapack.h>

 38: /*
 39:    Sets up a 2-by-2 matrix to eliminate y in the vector [x y]'.
 40:    Transformation is rotator if sygn = 1 and hyperbolic if sygn = -1.
 41: */
 42: static PetscErrorCode UnifiedRotation(PetscReal x,PetscReal y,PetscReal sygn,PetscReal *rot,PetscReal *rcond,PetscBool *swap)
 43: {
 44:   PetscReal nrm,c,s;

 47:   *swap = PETSC_FALSE;
 48:   if (y == 0) {
 49:     rot[0] = 1.0; rot[1] = 0.0; rot[2] = 0.0; rot[3] = 1.0;
 50:     *rcond = 1.0;
 51:   } else {
 52:     nrm = PetscMax(PetscAbs(x),PetscAbs(y));
 53:     c = x/nrm; s = y/nrm;
 54:     if (sygn == 1.0) {  /* set up a rotator */
 55:       nrm = PetscSqrtReal(c*c+s*s);
 56:       c = c/nrm; s = s/nrm;
 57:       /* rot = [c s; -s c]; */
 58:       rot[0] = c; rot[1] = -s; rot[2] = s; rot[3] = c;
 59:       *rcond = 1.0;
 60:     } else if (sygn == -1) {  /* set up a hyperbolic transformation */
 61:       nrm = c*c-s*s;
 62:       if (nrm > 0) nrm = PetscSqrtReal(nrm);
 63:       else if (nrm < 0) {
 64:         nrm = PetscSqrtReal(-nrm);
 65:         *swap = PETSC_TRUE;
 66:       } else   /* breakdown */
 67:         SETERRQ(PETSC_COMM_SELF,1,"Breakdown in construction of hyperbolic transformation");
 68:       c = c/nrm; s = s/nrm;
 69:       /* rot = [c -s; -s c]; */
 70:       rot[0] = c; rot[1] = -s; rot[2] = -s; rot[3] = c;
 71:       *rcond = PetscAbs(PetscAbs(s)-PetscAbs(c))/(PetscAbs(s)+PetscAbs(c));
 72:     } else SETERRQ(PETSC_COMM_SELF,1,"Value of sygn sent to transetup must be 1 or -1");
 73:   }
 74:   return(0);
 75: }

 79: static PetscErrorCode HZStep(PetscBLASInt ntop,PetscBLASInt nn,PetscReal tr,PetscReal dt,PetscReal *aa,PetscReal *bb,PetscReal *dd,PetscScalar *uu,PetscInt n,PetscInt ld,PetscBool *flag)
 80: {
 82:   PetscBLASInt   one=1;
 83:   PetscInt       k,jj,ii;
 84:   PetscBLASInt   n_;
 85:   PetscReal      bulge10,bulge20,bulge30,bulge31,bulge41,bulge42;
 86:   PetscReal      sygn,rcond=1.0,worstcond,rot[4],buf[2],t;
 87:   PetscScalar    rtmp;
 88:   PetscBool      swap;

 91:   worstcond = 1.0;
 92:   PetscBLASIntCast(n,&n_);

 94:   /* Build initial bulge that sets step in motion */
 95:   bulge10 = dd[ntop+1]*(aa[ntop]*(aa[ntop] - dd[ntop]*tr) + dt*dd[ntop]*dd[ntop]) + dd[ntop]*bb[ntop]*bb[ntop];
 96:   bulge20 = bb[ntop]*(dd[ntop+1]*aa[ntop] + dd[ntop]*aa[ntop+1] - dd[ntop]*dd[ntop+1]*tr);
 97:   bulge30 = bb[ntop]*bb[ntop+1]*dd[ntop];
 98:   bulge31 = 0.0;
 99:   bulge41 = 0.0;
100:   bulge42 = 0.0;

102:   /* Chase the bulge */
103:   for (jj=ntop;jj<nn-1;jj++) {

105:     /* Check for trivial bulge */
106:     if (jj>ntop && PetscMax(PetscMax(PetscAbs(bulge10),PetscAbs(bulge20)),PetscAbs(bulge30))<PETSC_MACHINE_EPSILON*(PetscAbs(aa[jj]) + PetscAbs(aa[jj+1]))) {
107:       bb[jj-1] = 0.0;  /* deflate and move on */

109:     } else { /* carry out the step */

111:       /* Annihilate tip entry bulge30 */
112:       if (bulge30 != 0.0) {

114:         /* Make an interchange if necessary to ensure that the
115:            first transformation is othogonal, not hyperbolic.  */
116:         if (dd[jj+1] != dd[jj+2]) { /* make an interchange */
117:           if (dd[jj] != dd[jj+1]) {  /* interchange 1st and 2nd */
118:             buf[0] = bulge20; bulge20 = bulge10; bulge10 = buf[0];
119:             buf[0] = aa[jj]; aa[jj] = aa[jj+1]; aa[jj+1] = buf[0];
120:             buf[0] = bb[jj+1]; bb[jj+1] = bulge31; bulge31 = buf[0];
121:             buf[0] = dd[jj]; dd[jj] = dd[jj+1]; dd[jj+1] = buf[0];
122:             for (k=0;k<n;k++) {
123:               rtmp = uu[k+jj*ld]; uu[k+jj*ld] = uu[k+(jj+1)*ld]; uu[k+(jj+1)*ld] = rtmp;
124:             }
125:           } else {  /* interchange 1st and 3rd */
126:             buf[0] = bulge30; bulge30 = bulge10; bulge10 = buf[0];
127:             buf[0] = aa[jj]; aa[jj] = aa[jj+2]; aa[jj+2] = buf[0];
128:             buf[0] = bb[jj]; bb[jj] = bb[jj+1]; bb[jj+1] = buf[0];
129:             buf[0] = dd[jj]; dd[jj] = dd[jj+2]; dd[jj+2] = buf[0];
130:             if (jj + 2 < nn-1) {
131:               bulge41 = bb[jj+2];
132:               bb[jj+2] = 0;
133:             }
134:             for (k=0;k<n;k++) {
135:               rtmp = uu[k+jj*ld]; uu[k+jj*ld] = uu[k+(jj+2)*ld]; uu[k+(jj+2)*ld] = rtmp;
136:             }
137:           }
138:         }

140:         /* Set up transforming matrix rot. */
141:         UnifiedRotation(bulge20,bulge30,1,rot,&rcond,&swap);

143:         /* Apply transforming matrix rot to T. */
144:         bulge20 = rot[0]*bulge20 + rot[2]*bulge30;
145:         buf[0] = rot[0]*bb[jj] + rot[2]*bulge31;
146:         buf[1] = rot[1]*bb[jj] + rot[3]*bulge31;
147:         bb[jj] = buf[0];
148:         bulge31 = buf[1];
149:         buf[0] = rot[0]*rot[0]*aa[jj+1] + 2.0*rot[0]*rot[2]*bb[jj+1] + rot[2]*rot[2]*aa[jj+2];
150:         buf[1] = rot[1]*rot[1]*aa[jj+1] + 2.0*rot[3]*rot[1]*bb[jj+1] + rot[3]*rot[3]*aa[jj+2];
151:         bb[jj+1] = rot[1]*rot[0]*aa[jj+1] + rot[3]*rot[2]*aa[jj+2] + (rot[3]*rot[0] + rot[1]*rot[2])*bb[jj+1];
152:         aa[jj+1] = buf[0];
153:         aa[jj+2] = buf[1];
154:         if (jj + 2 < nn-1) {
155:           bulge42 = bb[jj+2]*rot[2];
156:           bb[jj+2] = bb[jj+2]*rot[3];
157:         }

159:         /* Accumulate transforming matrix */
160:         PetscStackCallBLAS("BLASrot",BLASrot_(&n_,uu+(jj+1)*ld,&one,uu+(jj+2)*ld,&one,&rot[0],&rot[2]));
161:       }

163:       /* Annihilate inner entry bulge20 */
164:       if (bulge20 != 0.0) {

166:         /* Begin by setting up transforming matrix rot */
167:         sygn = dd[jj]*dd[jj+1];
168:         UnifiedRotation(bulge10,bulge20,sygn,rot,&rcond,&swap);
169:         if (rcond<PETSC_MACHINE_EPSILON) {
170:           SETERRQ1(PETSC_COMM_SELF,0,"Transforming matrix is numerically singular rcond=%g",rcond);
171:           *flag = PETSC_TRUE;
172:           return(0);
173:         }
174:         if (rcond < worstcond) worstcond = rcond;

176:         /* Apply transforming matrix rot to T */
177:         if (jj > ntop) bb[jj-1] = rot[0]*bulge10 + rot[2]*bulge20;
178:         buf[0] = rot[0]*rot[0]*aa[jj] + 2*rot[0]*rot[2]*bb[jj] + rot[2]*rot[2]*aa[jj+1];
179:         buf[1] = rot[1]*rot[1]*aa[jj] + 2*rot[3]*rot[1]*bb[jj] + rot[3]*rot[3]*aa[jj+1];
180:         bb[jj] = rot[1]*rot[0]*aa[jj] + rot[3]*rot[2]*aa[jj+1] + (rot[3]*rot[0] + rot[1]*rot[2])*bb[jj];
181:         aa[jj] = buf[0];
182:         aa[jj+1] = buf[1];
183:         if (jj + 1 < nn-1) {
184:           /* buf = [ bulge31 bb(jj+1) ] * rot' */
185:           buf[0] = rot[0]*bulge31 + rot[2]*bb[jj+1];
186:           buf[1] = rot[1]*bulge31 + rot[3]*bb[jj+1];
187:           bulge31 = buf[0];
188:           bb[jj+1] = buf[1];
189:         }
190:         if (jj + 2 < nn-1) {
191:           /* buf = [bulge41 bulge42] * rot' */
192:           buf[0] = rot[0]*bulge41 + rot[2]*bulge42;
193:           buf[1] = rot[1]*bulge41 + rot[3]*bulge42;
194:           bulge41 = buf[0];
195:           bulge42 = buf[1];
196:         }

198:         /* Apply transforming matrix rot to D */
199:         if (swap == 1) {
200:           buf[0] = dd[jj]; dd[jj] = dd[jj+1]; dd[jj+1] = buf[0];
201:         }

203:         /* Accumulate transforming matrix, uu(jj:jj+1,:) = rot*uu(jj:jj+1,:) */
204:         if (sygn==1) {
205:           PetscStackCallBLAS("BLASrot",BLASrot_(&n_,uu+jj*ld,&one,uu+(jj+1)*ld,&one,&rot[0],&rot[2]));
206:         } else {
207:           if (PetscAbsReal(rot[0])>PetscAbsReal(rot[1])) { /* Type I */
208:             t = rot[1]/rot[0];
209:             for (ii=0;ii<n;ii++) {
210:               uu[jj*ld+ii] = rot[0]*uu[jj*ld+ii] + rot[1]*uu[(jj+1)*ld+ii];
211:               uu[(jj+1)*ld+ii] = t*uu[jj*ld+ii] + uu[(jj+1)*ld+ii]/rot[0];
212:             }
213:           } else { /* Type II */
214:             t = rot[0]/rot[1];
215:             for (ii=0;ii<n;ii++) {
216:               rtmp = uu[jj*ld+ii];
217:               uu[jj*ld+ii] = rot[0]*uu[jj*ld+ii] + rot[1]*uu[(jj+1)*ld+ii];
218:               uu[(jj+1)*ld+ii] = t*uu[jj*ld+ii] + rtmp/rot[1];
219:             }
220:           }
221:         }
222:       }
223:     }

225:     /* Adjust bulge for next step */
226:     bulge10 = bb[jj];
227:     bulge20 = bulge31;
228:     bulge30 = bulge41;
229:     bulge31 = bulge42;
230:     bulge41 = 0.0;
231:     bulge42 = 0.0;
232:   }
233:   return(0);
234: }

238: static PetscErrorCode HZIteration(PetscBLASInt nn,PetscBLASInt cgd,PetscReal *aa,PetscReal *bb,PetscReal *dd,PetscScalar *uu,PetscBLASInt ld)
239: {
241:   PetscBLASInt   j2,one=1;
242:   PetscInt       its,nits,nstop,jj,ntop,nbot,ntry;
243:   PetscReal      htr,det,dis,dif,tn,kt,c,s,tr,dt;
244:   PetscBool      flag=PETSC_FALSE;

247:   its = 0;
248:   nbot = nn-1;
249:   nits = 0;
250:   nstop = 40*(nn - cgd);

252:   while (nbot >= cgd && nits < nstop) {

254:     /* Check for zeros on the subdiagonal */
255:     jj = nbot - 1;
256:     while (jj>=cgd && PetscAbs(bb[jj])>PETSC_MACHINE_EPSILON*(PetscAbs(aa[jj])+PetscAbs(aa[jj+1]))) jj = jj-1;
257:     if (jj>=cgd) bb[jj]=0;
258:     ntop = jj + 1;  /* starting point for step */
259:     if (ntop == nbot) {  /* isolate single eigenvalue */
260:       nbot = ntop - 1;
261:       its = 0;
262:     } else if (ntop+1 == nbot) {  /* isolate pair of eigenvalues */
263:       htr = 0.5*(aa[ntop]*dd[ntop] + aa[nbot]*dd[nbot]);
264:       det = dd[ntop]*dd[nbot]*(aa[ntop]*aa[nbot]-bb[ntop]*bb[ntop]);
265:       dis = htr*htr - det;
266:       if (dis > 0) {  /* distinct real eigenvalues */
267:         if (dd[ntop] == dd[nbot]) {  /* separate the eigenvalues by a Jacobi rotator */
268:           dif = aa[ntop]-aa[nbot];
269:           if (2.0*PetscAbs(bb[ntop])<=dif) {
270:             tn = 2*bb[ntop]/dif;
271:             tn = tn/(1.0 + PetscSqrtScalar(1.0+tn*tn));
272:           } else {
273:             kt = dif/(2.0*bb[ntop]);
274:             tn = PetscSign(kt)/(PetscAbs(kt)+PetscSqrtScalar(1.0+kt*kt));
275:           }
276:           c = 1.0/PetscSqrtScalar(1.0 + tn*tn);
277:           s = c*tn;
278:           aa[ntop] = aa[ntop] + tn*bb[ntop];
279:           aa[nbot] = aa[nbot] - tn*bb[ntop];
280:           bb[ntop] = 0;
281:           j2 = nn-cgd;
282:           PetscStackCallBLAS("BLASrot",BLASrot_(&j2,uu+ntop*ld+cgd,&one,uu+nbot*ld+cgd,&one,&c,&s));
283:         } else {
284:           dis = PetscSqrtScalar(dis);
285:           if (htr < 0) dis = -dis;
286:         }
287:       }
288:       nbot = ntop - 1;
289:     } else {  /* Do an HZ iteration */
290:       its = its + 1;
291:       nits = nits + 1;
292:       tr = aa[nbot-1]*dd[nbot-1] + aa[nbot]*dd[nbot];
293:       dt = dd[nbot-1]*dd[nbot]*(aa[nbot-1]*aa[nbot]-bb[nbot-1]*bb[nbot-1]);
294:       for (ntry=1;ntry<=6;ntry++) {
295:         HZStep(ntop,nbot+1,tr,dt,aa,bb,dd,uu,nn,ld,&flag);
296:         if (!flag) break;
297:         else if (ntry == 6)
298:           SETERRQ(PETSC_COMM_SELF,1,"Unable to complete hz step on six tries");
299:         else {
300:           tr = 0.9*tr; dt = 0.81*dt;
301:         }
302:       }
303:     }
304:   }
305:   return(0);
306: }

310: PetscErrorCode DSSolve_GHIEP_HZ(DS ds,PetscScalar *wr,PetscScalar *wi)
311: {
313:   PetscInt       off;
314:   PetscBLASInt   n1,ld;
315:   PetscScalar    *A,*B,*Q;
316:   PetscReal      *d,*e,*s;
317: #if defined(PETSC_USE_COMPLEX)
318:   PetscInt       i;
319: #endif

322: #if !defined(PETSC_USE_COMPLEX)
324: #endif
325:   PetscBLASIntCast(ds->ld,&ld);
326:   n1  = ds->n - ds->l;
327:   off = ds->l + ds->l*ld;
328:   A   = ds->mat[DS_MAT_A];
329:   B   = ds->mat[DS_MAT_B];
330:   Q   = ds->mat[DS_MAT_Q];
331:   d   = ds->rmat[DS_MAT_T];
332:   e   = ds->rmat[DS_MAT_T] + ld;
333:   s   = ds->rmat[DS_MAT_D];
334:   /* Quick return */
335:   if (n1 == 1) {
336:     *(Q+off) = 1;
337:     if (ds->compact) {
338:       wr[ds->l] = d[ds->l]/s[ds->l]; wi[ds->l] = 0.0;
339:     } else {
340:       d[ds->l] = PetscRealPart(A[off]); s[ds->l] = PetscRealPart(B[off]);
341:       wr[ds->l] = d[ds->l]/s[ds->l]; wi[ds->l] = 0.0;
342:     }
343:     return(0);
344:   }
345:   /* Reduce to pseudotriadiagonal form */
346:   DSIntermediate_GHIEP(ds);
347:   HZIteration(ds->n,ds->l,d,e,s,Q,ld);
348:   if (!ds->compact) {
349:     DSSwitchFormat_GHIEP(ds,PETSC_FALSE);
350:   }
351:   /* Undo from diagonal the blocks whith real eigenvalues*/
352:   DSGHIEPRealBlocks(ds);

354:   /* Recover eigenvalues from diagonal */
355:   DSGHIEPComplexEigs(ds,0,ds->n,wr,wi);
356: #if defined(PETSC_USE_COMPLEX)
357:   if (wi) {
358:     for (i=ds->l;i<ds->n;i++) wi[i] = 0.0;
359:   }
360: #endif
361:   ds->t = ds->n;
362:   return(0);
363: }

slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep_dqds.c.html0000644000175000017500000016254312211062077022630 0ustar gladkgladk
Actual source code: dsghiep_dqds.c

  1: /*
  2:    DQDS-type dense solver for generalized symmetric-indefinite eigenproblem.
  3:    Based on Matlab code from Carla Ferreira.

  5:    References:

  7:        [1] C. Ferreira, B. Parlett, "Real DQDS for the nonsymmetric tridiagonal
  8:            eigenvalue problem", preprint, 2012.

 10:        [2] C. Ferreira. The unsymmetric tridiagonal eigenvalue problem. Ph.D
 11:            Thesis, University of Minho, 2007.

 13:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 14:    SLEPc - Scalable Library for Eigenvalue Problem Computations
 15:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

 17:    This file is part of SLEPc.

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

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

 28:    You  should have received a copy of the GNU Lesser General  Public  License
 29:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 30:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 31: */
 32: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 33: #include <slepcblaslapack.h>

 37: /*
 38:   INPUT:
 39:     a ---- diagonal of J
 40:     b ---- subdiagonal of J;
 41:     the superdiagonal of J is all 1's

 43:   OUTPUT:
 44:     For an eigenvalue lambda of J we have:
 45:       gl=<real(lambda)<=gr
 46:       -sigma=<imag(lambda)<=sigma
 47: */
 48: static PetscErrorCode ScanJ(PetscInt n,PetscReal *a,PetscReal *b,PetscReal *gl,PetscReal *gr,PetscReal *sigma)
 49: {
 50:   PetscInt  i;
 51:   PetscReal b0,b1,rad;

 54:   /* For original matrix C, C_bal=T+S; T-symmetric and S=skew-symmetric
 55:    C_bal is the balanced form of C */
 56:   /* Bounds on the imaginary part of C (Gersgorin bound for S)*/
 57:   *sigma = 0.0;
 58:   b0 = 0.0;
 59:   for (i=0;i<n-1;i++) {
 60:     if (b[i]<0.0) b1 = PetscSqrtReal(-b[i]);
 61:     else b1 = 0.0;
 62:     *sigma = PetscMax(*sigma,b1+b0);
 63:     b0 = b1;
 64:   }
 65:   *sigma = PetscMax(*sigma,b0);
 66:   /* Gersgorin bounds for T (=Gersgorin bounds on the real part for C) */
 67:   rad = (b[0]>0.0)?PetscSqrtReal(b[0]):0.0; /* rad = b1+b0, b0 = 0 */
 68:   *gr = a[0]+rad;
 69:   *gl = a[0]-rad;
 70:   b0 = rad;
 71:   for (i=1;i<n-1;i++) {
 72:     b1 = (b[i]>0.0)?PetscSqrtReal(b[i]):0.0;
 73:     rad = b0+b1;
 74:     *gr = PetscMax(*gr,a[i]+rad);
 75:     *gl = PetscMin(*gl,a[i]-rad);
 76:     b0 = b1;
 77:   }
 78:   rad = b0;
 79:   *gr = PetscMax(*gr,a[n-1]+rad);
 80:   *gl = PetscMin(*gl,a[n-1]-rad);
 81:   return(0);
 82: }

 86: /*
 87:   INPUT:
 88:     a  - vector with the diagonal elements
 89:     b  - vector with the subdiagonal elements
 90:     gl - Gersgorin left bound (real axis)
 91:     gr - Gersgorin right bound (real axis)
 92:   OUTPUT:
 93:     eigvalue - multiple eigenvalue (if there is an eigenvalue)
 94:     m        - its multiplicity    (m=0 if there isn't a multiple eigenvalue)
 95:     X        - matrix of generalized eigenvectors
 96:     shift
 97: */
 98: static PetscErrorCode Prologue(PetscInt n,PetscReal *a,PetscReal *b,PetscReal gl,PetscReal gr,PetscInt *m,PetscReal *shift,PetscReal *work,PetscReal nw)
 99: {

102:   PetscReal      mu,tol,*a1,*y,*yp,*x,*xp;
103:   PetscInt       i,k,nwall=0;

106:   *m = 0;
107:   mu = 0.0;
108:   for (i=0;i<n;i++) mu += a[i];
109:   mu /= n;
110:   tol = n*PETSC_MACHINE_EPSILON*(gr-gl);
111:   nwall = 5*n+4;
112:   if (!work || nw<nwall) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",9);
113:   a1 = work; /* size n */
114:   y = work+n; /* size n+1 */
115:   yp = y+n+1; /* size n+1. yp is the derivative of y (p for "prime") */
116:   x = yp+n+1; /* size n+1 */
117:   xp = x+n+1; /* size n+1 */
118:   for (i=0;i<n;i++) a1[i] = mu-a[i];
119:   x[0] = 1;
120:   xp[0] = 0;
121:   x[1] = a1[0];
122:   xp[1] = 1;
123:   for (i=1;i<n;i++) {
124:     x[i+1]=a1[i]*x[i]-b[i-1]*x[i-1];
125:     xp[i+1]=a1[i]*xp[i]+x[i]-b[i-1]*xp[i-1];
126:   }
127:   *shift = mu;
128:   if (PetscAbsReal(x[n])<tol) {
129:     /* mu is an eigenvalue */
130:     *m = *m+1;
131:     if (PetscAbsReal(xp[n])<tol) {
132:       /* mu is a multiple eigenvalue; Is it the one-point spectrum case? */
133:       k = 0;
134:       while (PetscAbsReal(xp[n])<tol && k<n-1) {
135:         PetscMemcpy(x,y,(n+1)*sizeof(PetscReal));
136:         PetscMemcpy(xp,yp,(n+1)*sizeof(PetscReal));
137:         x[k] = 0.0;
138:         k++;
139:         x[k] = 1.0;
140:         xp[k] = 0.0;
141:         x[k+1] = a1[k] + y[k];
142:         xp[k+1] = 1+yp[k];
143:         for (i=k+1;i<n;i++) {
144:           x[i+1] = a1[i]*x[i]-b[i-1]*x[i-1]+y[i];
145:           xp[i+1]=a1[i]*xp[i]+x[i]-b[i-1]*xp[i-1]+yp[i];
146:         }
147:         *m = *m+1;
148:       }
149:     }
150:   }
151: /*
152:   When mu is not an eigenvalue or it it an eigenvalue but it is not the one-point spectrum case, we will always have shift=mu

154:   Need to check for overflow!

156:   After calling Prologue, eigenComplexdqds and eigen3dqds will test if m==n in which case we have the one-point spectrum case;
157:   If m!=0, the only output to be used is the shift returned.
158: */
159:   return(0);
160: }

164: static PetscErrorCode LUfac(PetscInt n,PetscReal *a,PetscReal *b,PetscReal shift,PetscReal tol,PetscReal norm,PetscReal *L,PetscReal *U,PetscInt *fail,PetscReal *work,PetscInt nw)
165: {
166:   PetscInt       nwall,i;
167:   PetscReal      *a1;

170:   nwall = n;
171:   if (!work || nw<nwall) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",11);
172:   a1 = work;
173:   for (i=0;i<n;i++) a1[i] = a[i]-shift;
174:   *fail = 0;
175:   for (i=0;i<n-1;i++) {
176:     U[i] = a1[i];
177:     L[i] = b[i]/U[i];
178:     a1[i+1] = a1[i+1]-L[i];
179:   }
180:   U[n-1] = a1[n-1];

182:   /* Check if there are NaN values */
183:   for (i=0;i<n-1 && !*fail;i++) {
184:     if (PetscIsInfOrNanReal(L[i])) *fail=1;
185:     if (PetscIsInfOrNanReal(U[i])) *fail=1;
186:   }
187:   if (!*fail && PetscIsInfOrNanReal(U[n-1])) *fail=1;

189:   for (i=0;i<n-1 && !*fail;i++) {
190:     if (PetscAbsReal(L[i])>tol*norm) *fail = 1;  /* This demands IEEE arithmetic */
191:     if (PetscAbsReal(U[i])>tol*norm) *fail = 1;
192:   }
193:   if (!*fail && PetscAbsReal(U[n-1])>tol*norm) *fail = 1;
194:   return(0);
195: }

199: static PetscErrorCode RealDQDS(PetscInt n,PetscReal *L,PetscReal *U,PetscReal shift,PetscReal tol,PetscReal norm,PetscReal *L1,PetscReal *U1,PetscInt *fail)
200: {
201:   PetscReal d;
202:   PetscInt  i;

205:   *fail = 0;
206:   d = U[0]-shift;
207:   for (i=0;i<n-1;i++) {
208:     U1[i] = d+L[i];
209:     L1[i] = L[i]*(U[i+1]/U1[i]);
210:     d = d*(U[i+1]/U1[i])-shift;
211:   }
212:   U1[n-1]=d;

214:   /* The following demands IEEE arithmetic */
215:   for (i=0;i<n-1 && !*fail;i++) {
216:     if (PetscIsInfOrNanReal(L1[i])) *fail=1;
217:     if (PetscIsInfOrNanReal(U1[i])) *fail=1;
218:   }
219:   if (!*fail && PetscIsInfOrNanReal(U1[n-1])) *fail=1;
220:   for (i=0;i<n-1 && !*fail;i++) {
221:     if (PetscAbsReal(L1[i])>tol*norm) *fail=1;
222:     if (PetscAbsReal(U1[i])>tol*norm) *fail=1;
223:   }
224:   if (!*fail && PetscAbsReal(U1[n-1])>tol*norm) *fail=1;
225:   return(0);
226: }

230: static PetscErrorCode TridqdsZhuang3(PetscInt n,PetscReal *e,PetscReal *q,PetscReal sum,PetscReal prod,PetscReal tol,PetscReal norm,PetscReal tolDef,PetscInt *fail)
231: {
232:   PetscReal xl,yl,xr,yr,zr;
233:   PetscInt  i;

236:   *fail = 0;
237:   xr = 1.0;
238:   yr = e[0];
239:   zr = 0.0;
240:   /* Step 1 */
241:   /* the efect of Z1 */
242:   xr = xr*q[0]+yr;
243:   /* the inverse of L1 */
244:   xl = (q[0]+e[0])*(q[0]+e[0])+q[1]*e[0]-sum*(q[0]+e[0])+prod;
245:   yl = -(q[2]*e[1]*q[1]*e[0])/xl;
246:   xl = -(q[1]*e[0]*(q[0]+e[0]+q[1]+e[1]-sum))/xl;
247:   /* the efect of L1 */
248:   q[0] = xr-xl;
249:   xr = yr-xl;
250:   yr = zr-yl-xl*e[1];
251:   /*the inverse of Y1 */
252:   xr = xr/q[0];
253:   yr = yr/q[0];
254:   /*the effect of Y1 inverse */
255:   e[0] = xl+yr+xr*q[1];
256:   xl = yl+zr+yr*q[2];      /* zr=0  when n=3 */
257:   /*the effect of Y1 */
258:   xr = 1.0-xr;
259:   yr = e[1]-yr;

261:   /* STEP n-1 */

263:   if (PetscAbsReal(e[n-3])>tolDef*PetscAbsReal(xl) || PetscAbsReal(e[n-3])>tolDef*PetscAbsReal(q[n-3])) {
264:     /* the efect of Zn-1 */
265:     xr = xr*q[n-2]+yr;
266:     /* the inverse of Ln-1 */
267:     xl = -xl/e[n-3];
268:     /* the efect of Ln-1 */
269:     q[n-2] = xr-xl;
270:     xr = yr-xl;
271:     /*the inverse of Yn-1 */
272:     xr = xr/q[n-2];
273:     /*the effect of the inverse of Yn-1 */
274:     e[n-2] = xl+xr*q[n-1];
275:     /*the effects of Yn-1 */
276:     xr = 1.0-xr;
277:     /* STEP n */
278:     /*the effect of Zn */
279:     xr = xr*q[n-1];
280:     /*the inverse of Ln=I */
281:     /*the effect of Ln */
282:     q[n-1] = xr;
283:     /* the inverse of  Yn-1=I */

285:   } else { /* Free deflation */
286:     e[n-2] = (e[n-3]+(xr*q[n-2]+yr)+q[n-1])*0.5;       /* Sum=trace/2 */
287:     q[n-2] = (e[n-3]+q[n-2]*xr)*q[n-1]-xl;             /* det */
288:     q[n-1] = e[n-2]*e[n-2]-q[n-2];
289:     *fail = 2;
290:   }

292:   /* The following demands IEEE arithmetic */
293:   for (i=0;i<n-1 && !*fail;i++) {
294:     if (PetscIsInfOrNanReal(e[i])) *fail=1;
295:     if (PetscIsInfOrNanReal(q[i])) *fail=1;
296:   }
297:   if (!*fail && PetscIsInfOrNanReal(q[n-1])) *fail=1;
298:   for (i=0;i<n-1 && !*fail;i++) {
299:     if (PetscAbsReal(e[i])>tol*norm) *fail=1;
300:     if (PetscAbsReal(q[i])>tol*norm) *fail=1;
301:   }
302:   if (!*fail && PetscAbsReal(q[n-1])>tol*norm) *fail=1;
303:   return(0);
304: }

308: static PetscErrorCode TridqdsZhuang(PetscInt n,PetscReal *e,PetscReal *q,PetscReal sum,PetscReal prod,PetscReal tol,PetscReal norm,PetscReal tolDef,PetscReal *e1,PetscReal *q1,PetscInt *fail)
309: {
311:   PetscInt       i;
312:   PetscReal      xl,yl,xr,yr,zr;

315:   for (i=0;i<n-1;i++) {
316:     e1[i] = e[i];
317:     q1[i] = q[i];
318:   }
319:   q1[n-1] = q[n-1];
320:   *fail = 0;
321:   if (n>3) {   /* For n>3 */
322:     *fail = 0;
323:     xr = 1;
324:     yr = e1[0];
325:     zr = 0;
326:     /* step 1 */
327:     /* the efect of Z1 */
328:     xr = xr*q1[0]+yr;
329:     /* the inverse of L1 */
330:     xl = (q1[0]+e1[0])*(q1[0]+e1[0])+q1[1]*e1[0]-sum*(q1[0]+e1[0])+prod;
331:     yl = -(q1[2]*e1[1]*q1[1]*e1[0])/xl;
332:     xl = -(q1[1]*e1[0]*(q1[0]+e1[0]+q1[1]+e1[1]-sum))/xl;
333:     /* the efect of L1 */
334:     q1[0] = xr-xl;
335:     xr = yr-xl;
336:     yr = zr-yl-xl*e1[1];
337:     zr = -yl*e1[2];
338:     /* the inverse of Y1 */
339:     xr = xr/q1[0];
340:     yr = yr/q1[0];
341:     zr = zr/q1[0];
342:     /* the effect of Y1 inverse */
343:     e1[0] = xl+yr+xr*q1[1];
344:     xl = yl+zr+yr*q1[2];
345:     yl = zr*q1[3];
346:     /* the effect of Y1 */
347:     xr = 1-xr;
348:     yr = e1[1]-yr;
349:     zr = -zr;
350:     /* step i=2,...,n-3 */
351:     for (i=1;i<n-3;i++) {
352:       /* the efect of Zi */
353:       xr = xr*q1[i]+yr;
354:       /* the inverse of Li */
355:       xl = -xl/e1[i-1];
356:       yl = -yl/e1[i-1];
357:       /* the efect of Li */
358:       q1[i] = xr-xl;
359:       xr = yr-xl;
360:       yr = zr-yl-xl*e1[i+1];
361:       zr = -yl*e1[i+2];
362:       /* the inverse of Yi */
363:       xr = xr/q1[i];
364:       yr = yr/q1[i];
365:       zr = zr/q1[i];
366:       /* the effect of the inverse of Yi */
367:       e1[i] = xl+yr+xr*q1[i+1];
368:       xl = yl+zr+yr*q1[i+2];
369:       yl = zr*q1[i+3];
370:       /* the effects of Yi */
371:       xr = 1.0-xr;
372:       yr = e1[i+1]-yr;
373:       zr = -zr;
374:     }

376:     /* STEP n-2            zr is no longer needed */

378:     /* the efect of Zn-2 */
379:     xr = xr*q1[n-3]+yr;
380:     /* the inverse of Ln-2 */
381:     xl = -xl/e1[n-4];
382:     yl = -yl/e1[n-4];
383:     /* the efect of Ln-2 */
384:     q1[n-3] = xr-xl;
385:     xr = yr-xl;
386:     yr = zr-yl-xl*e1[n-2];
387:     /* the inverse of Yn-2 */
388:     xr = xr/q1[n-3];
389:     yr = yr/q1[n-3];
390:     /* the effect of the inverse of Yn-2 */
391:     e1[n-3] = xl+yr+xr*q1[n-2];
392:     xl = yl+yr*q1[n-1];
393:     /* the effect of Yn-2 */
394:     xr = 1.0-xr;
395:     yr = e1[n-2]-yr;

397:     /* STEP n-1           yl and yr are no longer needed */
398:     /* Testing for EARLY DEFLATION */

400:     if (PetscAbsReal(e1[n-3])>tolDef*PetscAbsReal(xl) || PetscAbsReal(e1[n-3])>tolDef*PetscAbsReal(q1[n-3])) {
401:       /* the efect of Zn-1 */
402:       xr = xr*q1[n-2]+yr;
403:       /* the inverse of Ln-1 */
404:       xl = -xl/e1[n-3];
405:       /* the efect of Ln-1 */
406:       q1[n-2] = xr-xl;
407:       xr = yr-xl;
408:       /*the inverse of Yn-1 */
409:       xr = xr/q1[n-2];
410:       /*the effect of the inverse of Yn-1 */
411:       e1[n-2] = xl+xr*q1[n-1];
412:       /*the effects of Yn-1 */
413:       xr = 1.0-xr;

415:       /* STEP n;     xl no longer needed */
416:       /* the effect of Zn */
417:       xr = xr*q1[n-1];
418:       /* the inverse of Ln = I */
419:       /* the effect of Ln */
420:       q1[n-1] = xr;
421:       /* the inverse of  Yn-1=I */

423:     } else {  /* FREE DEFLATION */
424:       e1[n-2] = (e1[n-3]+xr*q1[n-2]+yr+q1[n-1])*0.5;     /* sum=trace/2 */
425:       q1[n-2] = (e1[n-3]+q1[n-2]*xr)*q1[n-1]-xl;         /* det */
426:       q1[n-1] = e1[n-2]*e1[n-2]-q1[n-2];
427:       *fail = 2;
428:     }

430:     for (i=0;i<n-1 && !*fail;i++) {
431:       if (PetscIsInfOrNanReal(e1[i])) *fail=1;
432:       if (PetscIsInfOrNanReal(q1[i])) *fail=1;
433:     }
434:     if (!*fail && PetscIsInfOrNanReal(q1[n-1])) *fail=1;
435:     for (i=0;i<n-1 && !*fail;i++) {
436:       if (PetscAbsReal(e1[i])>tol*norm) *fail = 1;  /* This demands IEEE arithmetic */
437:       if (PetscAbsReal(q1[i])>tol*norm) *fail = 1;
438:     }
439:     if (!*fail && PetscAbsReal(q1[n-1])>tol*norm) *fail = 1;

441:   } else {  /* The case n=3 */
442:     TridqdsZhuang3(n,e1,q1,sum,prod,tol,norm,tolDef,fail);
443:   }
444:   return(0);
445: }

449: static PetscErrorCode DSGHIEP_Eigen3DQDS(PetscInt n,PetscReal *a,PetscReal *b,PetscReal *c,PetscScalar *wr,PetscScalar *wi,PetscReal *work,PetscInt nw)
450: {
451:   PetscInt       totalIt=0;       /* Total Number of Iterations  */
452:   PetscInt       totalFail=0;     /* Total number of failures */
453:   PetscInt       nFail=0;         /* Number of failures per transformation */
454:   PetscReal      tolZero=1.0/16;  /* Tolerance for zero shifts */
455:   PetscInt       maxIt=10*n;      /* Maximum number of iterations */
456:   PetscInt       maxFail=10*n;    /* Maximum number of failures allowed per each transformation */
457:   PetscReal      tolDef=PETSC_MACHINE_EPSILON;  /* Tolerance for deflation eps, 10*eps, 100*eps */
458:   PetscReal      tolGrowth=100000;
460:   PetscInt       i,k,nwu=0,nwall,begin,ind,flag,dim,m;
461:   PetscReal      norm,gr,gl,sigma,delta,meanEig,*U,*L,*U1,*L1,*split;
462:   PetscReal      acShift,initialShift,shift=0.0,sum,det,disc,prod,x1,x2;
463:   PetscInt       lastSplit;
464:   PetscBool      test1,test2;

467:   dim = n;
468:   /* Test if the matrix is unreduced */
469:   for (i=0;i<n-1;i++) {
470:     if (PetscAbsReal(b[i])==0.0 || PetscAbsReal(c[i])==0.0) SETERRQ(PETSC_COMM_SELF,1,"Initial tridiagonal matrix is not unreduced");
471:   }
472:   nwall = 9*n+4;
473:   if (!work || nw<nwall) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",8);
474:   U = work;
475:   L = work+n;
476:   U1 = work+2*n;
477:   L1 = work+3*n;
478:   nwu = 4*n;
479:   if (wi) {
480:     PetscMemzero(wi,n*sizeof(PetscScalar));
481:   }
482:   /* Normalization - the J form of C */
483:   for (i=0;i<n-1;i++) b[i] *= c[i]; /* subdiagonal of the J form */

485:   /* Scan matrix J  ---- Finding a box of inclusion for the eigenvalues */
486:   norm = 0.0;
487:   for (i=0;i<n-1;i++) {
488:     norm = PetscMax(norm,PetscMax(PetscAbsReal(a[i]),PetscAbsReal(b[i])));
489:   }
490:   norm = PetscMax(norm,PetscMax(1,PetscAbsReal(a[n-1])));
491:   ScanJ(n,a,b,&gl,&gr,&sigma);
492:   delta = (gr-gl)/n; /* How much to add to the shift, in case of failure (element growth) */
493:   meanEig = 0.0;
494:   for (i=0;i<n;i++) meanEig += a[i];
495:   meanEig /= n; /* shift = initial shift = mean of eigenvalues */
496:   Prologue(n,a,b,gl,gr,&m,&shift,work+nwu,nwall-nwu);
497:   if (m==n) { /* Multiple eigenvalue, we have the one-point spectrum case */
498:     for (i=0;i<dim;i++) {
499:       wr[i] = shift;
500:       if (wi) wi[i] = 0.0;
501:     }
502:     return(0);
503:   }
504:   /* Initial LU Factorization */
505:   if (delta==0.0) shift=0.0;  /* The case when all eigenvalues are pure imaginary */
506:   LUfac(n,a,b,shift,tolGrowth,norm,L,U,&flag,work+nwu,nwall-nwu); /* flag=1 failure; flag=0 successful transformation*/
507:   while (flag==1 && nFail<maxFail) {
508:     shift=shift+delta;
509:     if (shift>gr || shift<gl) { /* Successive failures */
510:       shift=meanEig;
511:       delta=-delta;
512:     }
513:     nFail=nFail+1;
514:     LUfac(n,a,b,shift,tolGrowth,norm,L,U,&flag,work+nwu,nwall-nwu); /* flag=1 failure; flag=0 successful transformation*/
515:   }
516:   if (nFail==maxFail) SETERRQ(PETSC_COMM_SELF,1,"Maximun number of failures reached in Initial LU factorization");
517:   /* Successful Initial transformation */
518:   totalFail = totalFail+nFail;
519:   nFail = 0;
520:   acShift = 0;
521:   initialShift = shift;
522:   shift = 0;
523:   begin = 0;
524:   lastSplit = 0;
525:   split = work+nwu;
526:   nwu += n;
527:   split[lastSplit] = begin;
528:   while (begin!=-1) {
529:     while (n-begin>2 && totalIt<maxIt) {
530:       /* Check for deflation before performing a transformation */
531:       test1 = (PetscAbsReal(L[n-2])<tolDef*PetscAbsReal(U[n-2])
532:             && PetscAbsReal(L[n-2])<tolDef*PetscAbsReal(U[n-1]+acShift)
533:             && PetscAbsReal(L[n-2]*U[n])<tolDef*PetscAbsReal(acShift+U[n-1])
534:             && PetscAbsReal(L[n-2])*(PetscAbsReal(U[n-2])+1)<tolDef*PetscAbsReal(acShift+U[n-1]))? PETSC_TRUE: PETSC_FALSE;
535:       if (flag==2) {  /* Early 2x2 deflation */
536:         test2 = PETSC_TRUE;
537:       } else {
538:         if (n-begin>4) {
539:           test2 = (PetscAbsReal(L[n-3])<tolDef*PetscAbsReal(U[n-3])
540:                && PetscAbsReal(L[n-3]*(U[n-4]+L[n-4]))< tolDef*PetscAbsReal(U[n-4]*(U[n-3]+L[n-3])+L[n-4]*L[n-3]))? PETSC_TRUE: PETSC_FALSE;
541:         } else { /* n-begin+1=3 */
542:           test2 = (PetscAbsReal(L[begin])<tolDef*PetscAbsReal(U[begin]))? PETSC_TRUE: PETSC_FALSE;
543:         }
544:       }
545:       while (test2 || test1) {
546:         /* 2x2 deflation */
547:         if (test2) {
548:           if (flag==2) { /* Early deflation */
549:             sum = L[n-2];
550:             det = U[n-2];
551:             disc = U[n-1];
552:             flag = 0;
553:           } else {
554:             sum = (L[n-2]+(U[n-2]+U[n-1]))/2;
555:             disc = (L[n-2]*(L[n-2]+2*(U[n-2]+U[n-1]))+(U[n-2]-U[n-1])*(U[n-2]-U[n-1]))/4;
556:             det = U[n-2]*U[n-1];
557:           }
558:           if (disc<=0) {
559: #if !defined(PETSC_USE_COMPLEX)
560:             wr[--n] = sum+acShift; wi[n] = PetscSqrtReal(-disc);
561:             wr[--n] = sum+acShift; wi[n] = -PetscSqrtReal(-disc);
562: #else
563:             wr[--n] = sum-PETSC_i*PetscSqrtReal(-disc)+acShift; if (wi) wi[n] = 0.0;
564:             wr[--n] = sum+PETSC_i*PetscSqrtReal(-disc)+acShift; if (wi) wi[n] = 0.0;
565: #endif
566:           } else {
567:             if (sum==0.0) {
568:               x1 = PetscSqrtReal(disc);
569:               x2 = -x1;
570:             } else {
571:               x1 = ((sum>=0.0)?1.0:-1.0)*(PetscAbsReal(sum)+PetscSqrtReal(disc));
572:               x2 = det/x1;
573:             }
574:             wr[--n] = x1+acShift;
575:             wr[--n] = x2+acShift;
576:           }
577:         } else { /* test1 -- 1x1 deflation */
578:           x1 = U[n-1]+acShift;
579:           wr[--n] = x1;
580:         }

582:         if (n<=begin+2) {
583:           break;
584:         } else {
585:           test1 = (PetscAbsReal(L[n-2])<tolDef*PetscAbsReal(U[n-2])
586:                 && PetscAbsReal(L[n-2])<tolDef*PetscAbsReal(U[n-1]+acShift)
587:                 && PetscAbsReal(L[n-2]*U[n-1])<tolDef*PetscAbsReal(acShift+U[n-1])
588:                 && PetscAbsReal(L[n-2])*(PetscAbsReal(U[n-2])+1)< tolDef*PetscAbsReal(acShift+U[n-1]))? PETSC_TRUE: PETSC_FALSE;
589:           if (n-begin>4) {
590:             test2 = (PetscAbsReal(L[n-3])<tolDef*PetscAbsReal(U[n-3])
591:                   && PetscAbsReal(L[n-3]*(U[n-4]+L[n-4]))< tolDef*PetscAbsReal(U[n-4]*(U[n-3]+L[n-3])+L[n-4]*L[n-3]))? PETSC_TRUE: PETSC_FALSE;
592:           } else { /* n-begin+1=3 */
593:             test2 = (PetscAbsReal(L[begin])<tolDef*PetscAbsReal(U[begin]))? PETSC_TRUE: PETSC_FALSE;
594:           }
595:         }
596:       } /* end "WHILE deflations" */
597:       /* After deflation */
598:       if (n>begin+3) {
599:         ind = begin;
600:         for (k=n-4;k>=begin+1;k--) {
601:           if (PetscAbsReal(L[k])<tolDef*PetscAbsReal(U[k])
602:            && PetscAbsReal(L[k]*U[k+1]*(U[k+2]+L[k+2])*(U[k-1]+L[k-1]))<tolDef*PetscAbsReal((U[k-1]*(U[k]+L[k])+L[k-1]*L[k])*(U[k+1]*(U[k+2]+L[k+2])+L[k+1]*L[k+2]))) {
603:             ind=k;
604:             break;
605:           }
606:         }
607:         if (ind>begin || PetscAbsReal(L[begin]) <tolDef*PetscAbsReal(U[begin])) {
608:           lastSplit = lastSplit+1;
609:           split[lastSplit] = begin;
610:           L[ind] = acShift; /* Use of L[ind] to save acShift */
611:           begin = ind+1;
612:         }
613:       }

615:       if (n>begin+2) {
616:         disc = (L[n-2]*(L[n-2]+2*(U[n-2]+U[n-1]))+(U[n-2]-U[n-1])*(U[n-2]-U[n-1]))/4;
617:         if ((PetscAbsReal(L[n-2])>tolZero) && (PetscAbsReal(L[n-3])>tolZero)) { /* L's are big */
618:           shift = 0;
619:           sum = 0; /* Needed in case of failure */
620:           prod = 0;
621:           RealDQDS(n-begin,L+begin,U+begin,0,tolGrowth,norm,L1+begin,U1+begin,&flag);
622:           if (flag) {  /* Failure */
623:             TridqdsZhuang(n-begin,L+begin,U+begin,0.0,0.0,tolGrowth,norm,tolDef,L1+begin,U1+begin,&flag);
624:             shift = 0.0;
625:             while (flag==1 && nFail<maxFail) {  /* Successive failures */
626:               shift = shift+delta;
627:               if (shift>gr-acShift || shift<gl-acShift) {
628:                 shift = meanEig-acShift;
629:                 delta = -delta;
630:               }
631:               nFail++;
632:               RealDQDS(n-begin,L+begin,U+begin,0,tolGrowth,norm,L1+begin,U1+begin,&flag);
633:             }
634:           }
635:         } else { /* L's are small */
636:           if (disc<0) {  /* disc <0   Complex case; Francis shift; 3dqds */
637:             sum = U[n-2]+L[n-2]+U[n-1];
638:             prod = U[n-2]*U[n-1];
639:             TridqdsZhuang(n-begin,L+begin,U+begin,sum,prod,tolGrowth,norm,tolDef,L1+begin,U1+begin,&flag);
640:             shift = 0.0; /* Restoring transformation */
641:             while (flag==1 && nFail<maxFail) { /* In case of failure */
642:               shift = shift+U[n-1];  /* first time shift=0 */
643:               RealDQDS(n-begin,L+begin,U+begin,shift,tolGrowth,norm,L1+begin,U1+begin,&flag);
644:               nFail++;
645:             }
646:           } else  { /* disc >0  Real case; real Wilkinson shift; dqds */
647:             sum = (L[n-2]+U[n-2]+U[n-1])/2;
648:             if (sum==0.0) {
649:               x1 = PetscSqrtReal(disc);
650:               x2 = -x1;
651:             } else {
652:               x1 = ((sum>=0)?1.0:-1.0)*(PetscAbsReal(sum)+PetscSqrtReal(disc));
653:               x2 = U[n-2]*U[n-1]/x1;
654:             }
655:             /* Take the eigenvalue closest to UL(n,n) */
656:             if (PetscAbsReal(x1-U[n-1])<PetscAbsReal(x2-U[n-1])) {
657:               shift = x1;
658:             } else {
659:               shift = x2;
660:             }
661:             RealDQDS(n-begin,L+begin,U+begin,shift,tolGrowth,norm,L1+begin,U1+begin,&flag);
662:             /* In case of failure */
663:             while (flag==1 && nFail<maxFail) {
664:               sum = 2*shift;
665:               prod = shift*shift;
666:               TridqdsZhuang(n-1-begin,L+begin,U+begin,sum,prod,tolGrowth,norm,tolDef,L1+begin,U1+begin,&flag);
667:               /* In case of successive failures */
668:               if (shift==0.0) {
669:                 shift = PetscMin(PetscAbsReal(L[n-2]),PetscAbsReal(L[n-3]))*delta;
670:               } else {
671:                 shift=shift+delta;
672:               }
673:               if (shift>gr-acShift || shift<gl-acShift) {
674:                 shift = meanEig-acShift;
675:                 delta = -delta;
676:               }
677:               if (!flag) { /* We changed from real dqds to 3dqds */
678:                 shift=0;
679:               }
680:               nFail++;
681:             }
682:           }
683:         } /* end "if tolZero" */
684:         if (nFail==maxFail) SETERRQ(PETSC_COMM_SELF,1,"Maximun number of failures reached. No convergence in DQDS");
685:         /* Successful Transformation; flag==0 */
686:         totalIt++;
687:         acShift = shift+acShift;
688:         for (i=begin;i<n-1;i++) {
689:           L[i] = L1[i];
690:           U[i] = U1[i];
691:         }
692:         U[n-1] = U1[n-1];
693:         totalFail = totalFail+nFail;
694:         nFail = 0;
695:       }  /* end "if n>begin+1" */
696:     }  /* end WHILE 1 */
697:     if (totalIt>=maxIt) SETERRQ(PETSC_COMM_SELF,1,"Maximun number of iterations reached. No convergence in DQDS");
698:     /* END: n=2 or n=1  % n=begin+1 or n=begin */
699:     if (n==begin+2) {
700:       sum = (L[n-2]+U[n-2]+U[n-1])/2;
701:       disc = (L[n-2]*(L[n-2]+2*(U[n-2]+U[n-1]))+(U[n-2]-U[n-1])*(U[n-2]-U[n-1]))/4;
702:         if (disc<=0)  {  /* Complex case */
703:         /* Deflation 2 */
704: #if !defined(PETSC_USE_COMPLEX)
705:         wr[--n] = sum+acShift; wi[n] = PetscSqrtReal(-disc);
706:         wr[--n] = sum+acShift; wi[n] = -PetscSqrtReal(-disc);
707: #else
708:         wr[--n] = sum-PETSC_i*PetscSqrtReal(-disc)+acShift; if (wi) wi[n] = 0.0;
709:         wr[--n] = sum+PETSC_i*PetscSqrtReal(-disc)+acShift; if (wi) wi[n] = 0.0;
710: #endif
711:       } else  { /* Real case */
712:         if (sum==0.0) {
713:           x1 = PetscSqrtReal(disc);
714:           x2 = -x1;
715:         } else {
716:           x1 = ((sum>=0)?1.0:-1.0)*(PetscAbsReal(sum)+PetscSqrtReal(disc));
717:           x2 = U[n-2]*U[n-1]/x1;
718:         }
719:         /* Deflation 2 */
720:         wr[--n] = x2+acShift;
721:         wr[--n] = x1+acShift;
722:       }
723:     } else { /* n=1   n=begin */
724:       /* deflation 1 */
725:       x1 = U[n-1]+acShift;
726:       wr[--n] = x1;
727:     }
728:     switch (n) {
729:       case 0:
730:         begin = -1;
731:         break;
732:       case 1:
733:         acShift = L[begin-1];
734:         begin = split[lastSplit];
735:         lastSplit--;
736:         break;
737:       default : /* n>=2 */
738:         acShift = L[begin-1];
739:         begin = split[lastSplit];
740:         lastSplit--;
741:     }
742:   }/* While begin~=-1 */
743:   for (i=0;i<dim;i++) {
744:     wr[i] = wr[i]+initialShift;
745:   }
746:   return(0);
747: }

751: PetscErrorCode DSSolve_GHIEP_DQDS_II(DS ds,PetscScalar *wr,PetscScalar *wi)
752: {
754:   PetscInt       i,off,ld,nwall,nwu;
755:   PetscScalar    *A,*B,*Q,*vi;
756:   PetscReal      *d,*e,*s,*a,*b,*c;

759: #if !defined(PETSC_USE_COMPLEX)
761: #endif
762:   ld = ds->ld;
763:   off = ds->l + ds->l*ld;
764:   A = ds->mat[DS_MAT_A];
765:   B = ds->mat[DS_MAT_B];
766:   Q = ds->mat[DS_MAT_Q];
767:   d = ds->rmat[DS_MAT_T];
768:   e = ds->rmat[DS_MAT_T] + ld;
769:   c = ds->rmat[DS_MAT_T] + 2*ld;
770:   s = ds->rmat[DS_MAT_D];
771:   /* Quick return if possible */
772:   if (ds->n-ds->l == 1) {
773:     *(Q+off) = 1;
774:     if (!ds->compact) {
775:       d[ds->l] = PetscRealPart(A[off]);
776:       s[ds->l] = PetscRealPart(B[off]);
777:     }
778:     wr[ds->l] = d[ds->l]/s[ds->l];
779:     if (wi) wi[ds->l] = 0.0;
780:     return(0);
781:   }
782:   nwall = 12*ld+4;
783:   DSAllocateWork_Private(ds,0,nwall,0);
784:   /* Reduce to pseudotriadiagonal form */
785:   DSIntermediate_GHIEP(ds);

787:   /* Compute Eigenvalues (DQDS)*/
788:   /* Form pseudosymmetric tridiagonal */
789:   a = ds->rwork;
790:   b = a+ld;
791:   c = b+ld;
792:   nwu = 3*ld;
793:   if (ds->compact) {
794:     for (i=ds->l;i<ds->n-1;i++) {
795:       a[i] = d[i]*s[i];
796:       b[i] = e[i]*s[i+1];
797:       c[i] = e[i]*s[i];
798:     }
799:     a[ds->n-1] = d[ds->n-1]*s[ds->n-1];
800:   } else {
801:     for (i=ds->l;i<ds->n-1;i++) {
802:       a[i] = PetscRealPart(A[i+i*ld]*B[i+i*ld]);
803:       b[i] = PetscRealPart(A[i+1+i*ld]*s[i+1]);
804:       c[i] = PetscRealPart(A[i+(i+1)*ld]*s[i]);
805:     }
806:     a[ds->n-1] = PetscRealPart(A[ds->n-1+(ds->n-1)*ld]*B[ds->n-1+(ds->n-1)*ld]);
807:   }
808:   vi = (wi)?wi+ds->l:NULL;
809:   DSGHIEP_Eigen3DQDS(ds->n-ds->l,a+ds->l,b+ds->l,c+ds->l,wr+ds->l,vi,ds->rwork+nwu,nwall-nwu);

811:   /* Compute Eigenvectors with Inverse Iteration */
812:   DSGHIEPInverseIteration(ds,wr,wi);

814:   /* Recover eigenvalues from diagonal */
815:   DSGHIEPComplexEigs(ds,0,ds->l,wr,wi);
816: #if defined(PETSC_USE_COMPLEX)
817:   if (wi) {
818:     for (i=ds->l;i<ds->n;i++) wi[i] = 0.0;
819:   }
820: #endif
821:   return(0);
822: }

slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/makefile0000644000175000017500000000221012211062077020543 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dsghiep_ivit.c dsghiep.c dsghiep_hz.c dsghiep_dqds.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/ghiep/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep_dqds.c0000644000175000017500000006562312211062077021666 0ustar gladkgladk/* DQDS-type dense solver for generalized symmetric-indefinite eigenproblem. Based on Matlab code from Carla Ferreira. References: [1] C. Ferreira, B. Parlett, "Real DQDS for the nonsymmetric tridiagonal eigenvalue problem", preprint, 2012. [2] C. Ferreira. The unsymmetric tridiagonal eigenvalue problem. Ph.D Thesis, University of Minho, 2007. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "ScanJ" /* INPUT: a ---- diagonal of J b ---- subdiagonal of J; the superdiagonal of J is all 1's OUTPUT: For an eigenvalue lambda of J we have: gl=0.0)?PetscSqrtReal(b[0]):0.0; /* rad = b1+b0, b0 = 0 */ *gr = a[0]+rad; *gl = a[0]-rad; b0 = rad; for (i=1;i0.0)?PetscSqrtReal(b[i]):0.0; rad = b0+b1; *gr = PetscMax(*gr,a[i]+rad); *gl = PetscMin(*gl,a[i]-rad); b0 = b1; } rad = b0; *gr = PetscMax(*gr,a[n-1]+rad); *gl = PetscMin(*gl,a[n-1]-rad); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "Prologue" /* INPUT: a - vector with the diagonal elements b - vector with the subdiagonal elements gl - Gersgorin left bound (real axis) gr - Gersgorin right bound (real axis) OUTPUT: eigvalue - multiple eigenvalue (if there is an eigenvalue) m - its multiplicity (m=0 if there isn't a multiple eigenvalue) X - matrix of generalized eigenvectors shift */ static PetscErrorCode Prologue(PetscInt n,PetscReal *a,PetscReal *b,PetscReal gl,PetscReal gr,PetscInt *m,PetscReal *shift,PetscReal *work,PetscReal nw) { PetscErrorCode ierr; PetscReal mu,tol,*a1,*y,*yp,*x,*xp; PetscInt i,k,nwall=0; PetscFunctionBegin; *m = 0; mu = 0.0; for (i=0;itol*norm) *fail = 1; /* This demands IEEE arithmetic */ if (PetscAbsReal(U[i])>tol*norm) *fail = 1; } if (!*fail && PetscAbsReal(U[n-1])>tol*norm) *fail = 1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "RealDQDS" static PetscErrorCode RealDQDS(PetscInt n,PetscReal *L,PetscReal *U,PetscReal shift,PetscReal tol,PetscReal norm,PetscReal *L1,PetscReal *U1,PetscInt *fail) { PetscReal d; PetscInt i; PetscFunctionBegin; *fail = 0; d = U[0]-shift; for (i=0;itol*norm) *fail=1; if (PetscAbsReal(U1[i])>tol*norm) *fail=1; } if (!*fail && PetscAbsReal(U1[n-1])>tol*norm) *fail=1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "TridqdsZhuang3" static PetscErrorCode TridqdsZhuang3(PetscInt n,PetscReal *e,PetscReal *q,PetscReal sum,PetscReal prod,PetscReal tol,PetscReal norm,PetscReal tolDef,PetscInt *fail) { PetscReal xl,yl,xr,yr,zr; PetscInt i; PetscFunctionBegin; *fail = 0; xr = 1.0; yr = e[0]; zr = 0.0; /* Step 1 */ /* the efect of Z1 */ xr = xr*q[0]+yr; /* the inverse of L1 */ xl = (q[0]+e[0])*(q[0]+e[0])+q[1]*e[0]-sum*(q[0]+e[0])+prod; yl = -(q[2]*e[1]*q[1]*e[0])/xl; xl = -(q[1]*e[0]*(q[0]+e[0]+q[1]+e[1]-sum))/xl; /* the efect of L1 */ q[0] = xr-xl; xr = yr-xl; yr = zr-yl-xl*e[1]; /*the inverse of Y1 */ xr = xr/q[0]; yr = yr/q[0]; /*the effect of Y1 inverse */ e[0] = xl+yr+xr*q[1]; xl = yl+zr+yr*q[2]; /* zr=0 when n=3 */ /*the effect of Y1 */ xr = 1.0-xr; yr = e[1]-yr; /* STEP n-1 */ if (PetscAbsReal(e[n-3])>tolDef*PetscAbsReal(xl) || PetscAbsReal(e[n-3])>tolDef*PetscAbsReal(q[n-3])) { /* the efect of Zn-1 */ xr = xr*q[n-2]+yr; /* the inverse of Ln-1 */ xl = -xl/e[n-3]; /* the efect of Ln-1 */ q[n-2] = xr-xl; xr = yr-xl; /*the inverse of Yn-1 */ xr = xr/q[n-2]; /*the effect of the inverse of Yn-1 */ e[n-2] = xl+xr*q[n-1]; /*the effects of Yn-1 */ xr = 1.0-xr; /* STEP n */ /*the effect of Zn */ xr = xr*q[n-1]; /*the inverse of Ln=I */ /*the effect of Ln */ q[n-1] = xr; /* the inverse of Yn-1=I */ } else { /* Free deflation */ e[n-2] = (e[n-3]+(xr*q[n-2]+yr)+q[n-1])*0.5; /* Sum=trace/2 */ q[n-2] = (e[n-3]+q[n-2]*xr)*q[n-1]-xl; /* det */ q[n-1] = e[n-2]*e[n-2]-q[n-2]; *fail = 2; } /* The following demands IEEE arithmetic */ for (i=0;itol*norm) *fail=1; if (PetscAbsReal(q[i])>tol*norm) *fail=1; } if (!*fail && PetscAbsReal(q[n-1])>tol*norm) *fail=1; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "TridqdsZhuang" static PetscErrorCode TridqdsZhuang(PetscInt n,PetscReal *e,PetscReal *q,PetscReal sum,PetscReal prod,PetscReal tol,PetscReal norm,PetscReal tolDef,PetscReal *e1,PetscReal *q1,PetscInt *fail) { PetscErrorCode ierr; PetscInt i; PetscReal xl,yl,xr,yr,zr; PetscFunctionBegin; for (i=0;i3) { /* For n>3 */ *fail = 0; xr = 1; yr = e1[0]; zr = 0; /* step 1 */ /* the efect of Z1 */ xr = xr*q1[0]+yr; /* the inverse of L1 */ xl = (q1[0]+e1[0])*(q1[0]+e1[0])+q1[1]*e1[0]-sum*(q1[0]+e1[0])+prod; yl = -(q1[2]*e1[1]*q1[1]*e1[0])/xl; xl = -(q1[1]*e1[0]*(q1[0]+e1[0]+q1[1]+e1[1]-sum))/xl; /* the efect of L1 */ q1[0] = xr-xl; xr = yr-xl; yr = zr-yl-xl*e1[1]; zr = -yl*e1[2]; /* the inverse of Y1 */ xr = xr/q1[0]; yr = yr/q1[0]; zr = zr/q1[0]; /* the effect of Y1 inverse */ e1[0] = xl+yr+xr*q1[1]; xl = yl+zr+yr*q1[2]; yl = zr*q1[3]; /* the effect of Y1 */ xr = 1-xr; yr = e1[1]-yr; zr = -zr; /* step i=2,...,n-3 */ for (i=1;itolDef*PetscAbsReal(xl) || PetscAbsReal(e1[n-3])>tolDef*PetscAbsReal(q1[n-3])) { /* the efect of Zn-1 */ xr = xr*q1[n-2]+yr; /* the inverse of Ln-1 */ xl = -xl/e1[n-3]; /* the efect of Ln-1 */ q1[n-2] = xr-xl; xr = yr-xl; /*the inverse of Yn-1 */ xr = xr/q1[n-2]; /*the effect of the inverse of Yn-1 */ e1[n-2] = xl+xr*q1[n-1]; /*the effects of Yn-1 */ xr = 1.0-xr; /* STEP n; xl no longer needed */ /* the effect of Zn */ xr = xr*q1[n-1]; /* the inverse of Ln = I */ /* the effect of Ln */ q1[n-1] = xr; /* the inverse of Yn-1=I */ } else { /* FREE DEFLATION */ e1[n-2] = (e1[n-3]+xr*q1[n-2]+yr+q1[n-1])*0.5; /* sum=trace/2 */ q1[n-2] = (e1[n-3]+q1[n-2]*xr)*q1[n-1]-xl; /* det */ q1[n-1] = e1[n-2]*e1[n-2]-q1[n-2]; *fail = 2; } for (i=0;itol*norm) *fail = 1; /* This demands IEEE arithmetic */ if (PetscAbsReal(q1[i])>tol*norm) *fail = 1; } if (!*fail && PetscAbsReal(q1[n-1])>tol*norm) *fail = 1; } else { /* The case n=3 */ ierr = TridqdsZhuang3(n,e1,q1,sum,prod,tol,norm,tolDef,fail);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGHIEP_Eigen3DQDS" static PetscErrorCode DSGHIEP_Eigen3DQDS(PetscInt n,PetscReal *a,PetscReal *b,PetscReal *c,PetscScalar *wr,PetscScalar *wi,PetscReal *work,PetscInt nw) { PetscInt totalIt=0; /* Total Number of Iterations */ PetscInt totalFail=0; /* Total number of failures */ PetscInt nFail=0; /* Number of failures per transformation */ PetscReal tolZero=1.0/16; /* Tolerance for zero shifts */ PetscInt maxIt=10*n; /* Maximum number of iterations */ PetscInt maxFail=10*n; /* Maximum number of failures allowed per each transformation */ PetscReal tolDef=PETSC_MACHINE_EPSILON; /* Tolerance for deflation eps, 10*eps, 100*eps */ PetscReal tolGrowth=100000; PetscErrorCode ierr; PetscInt i,k,nwu=0,nwall,begin,ind,flag,dim,m; PetscReal norm,gr,gl,sigma,delta,meanEig,*U,*L,*U1,*L1,*split; PetscReal acShift,initialShift,shift=0.0,sum,det,disc,prod,x1,x2; PetscInt lastSplit; PetscBool test1,test2; PetscFunctionBegin; dim = n; /* Test if the matrix is unreduced */ for (i=0;igr || shift2 && totalIt4) { test2 = (PetscAbsReal(L[n-3])=0.0)?1.0:-1.0)*(PetscAbsReal(sum)+PetscSqrtReal(disc)); x2 = det/x1; } wr[--n] = x1+acShift; wr[--n] = x2+acShift; } } else { /* test1 -- 1x1 deflation */ x1 = U[n-1]+acShift; wr[--n] = x1; } if (n<=begin+2) { break; } else { test1 = (PetscAbsReal(L[n-2])4) { test2 = (PetscAbsReal(L[n-3])begin+3) { ind = begin; for (k=n-4;k>=begin+1;k--) { if (PetscAbsReal(L[k])begin || PetscAbsReal(L[begin]) begin+2) { disc = (L[n-2]*(L[n-2]+2*(U[n-2]+U[n-1]))+(U[n-2]-U[n-1])*(U[n-2]-U[n-1]))/4; if ((PetscAbsReal(L[n-2])>tolZero) && (PetscAbsReal(L[n-3])>tolZero)) { /* L's are big */ shift = 0; sum = 0; /* Needed in case of failure */ prod = 0; ierr = RealDQDS(n-begin,L+begin,U+begin,0,tolGrowth,norm,L1+begin,U1+begin,&flag);CHKERRQ(ierr); if (flag) { /* Failure */ ierr = TridqdsZhuang(n-begin,L+begin,U+begin,0.0,0.0,tolGrowth,norm,tolDef,L1+begin,U1+begin,&flag);CHKERRQ(ierr); shift = 0.0; while (flag==1 && nFailgr-acShift || shift0 Real case; real Wilkinson shift; dqds */ sum = (L[n-2]+U[n-2]+U[n-1])/2; if (sum==0.0) { x1 = PetscSqrtReal(disc); x2 = -x1; } else { x1 = ((sum>=0)?1.0:-1.0)*(PetscAbsReal(sum)+PetscSqrtReal(disc)); x2 = U[n-2]*U[n-1]/x1; } /* Take the eigenvalue closest to UL(n,n) */ if (PetscAbsReal(x1-U[n-1])gr-acShift || shiftbegin+1" */ } /* end WHILE 1 */ if (totalIt>=maxIt) SETERRQ(PETSC_COMM_SELF,1,"Maximun number of iterations reached. No convergence in DQDS"); /* END: n=2 or n=1 % n=begin+1 or n=begin */ if (n==begin+2) { sum = (L[n-2]+U[n-2]+U[n-1])/2; disc = (L[n-2]*(L[n-2]+2*(U[n-2]+U[n-1]))+(U[n-2]-U[n-1])*(U[n-2]-U[n-1]))/4; if (disc<=0) { /* Complex case */ /* Deflation 2 */ #if !defined(PETSC_USE_COMPLEX) wr[--n] = sum+acShift; wi[n] = PetscSqrtReal(-disc); wr[--n] = sum+acShift; wi[n] = -PetscSqrtReal(-disc); #else wr[--n] = sum-PETSC_i*PetscSqrtReal(-disc)+acShift; if (wi) wi[n] = 0.0; wr[--n] = sum+PETSC_i*PetscSqrtReal(-disc)+acShift; if (wi) wi[n] = 0.0; #endif } else { /* Real case */ if (sum==0.0) { x1 = PetscSqrtReal(disc); x2 = -x1; } else { x1 = ((sum>=0)?1.0:-1.0)*(PetscAbsReal(sum)+PetscSqrtReal(disc)); x2 = U[n-2]*U[n-1]/x1; } /* Deflation 2 */ wr[--n] = x2+acShift; wr[--n] = x1+acShift; } } else { /* n=1 n=begin */ /* deflation 1 */ x1 = U[n-1]+acShift; wr[--n] = x1; } switch (n) { case 0: begin = -1; break; case 1: acShift = L[begin-1]; begin = split[lastSplit]; lastSplit--; break; default : /* n>=2 */ acShift = L[begin-1]; begin = split[lastSplit]; lastSplit--; } }/* While begin~=-1 */ for (i=0;ild; off = ds->l + ds->l*ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T] + ld; c = ds->rmat[DS_MAT_T] + 2*ld; s = ds->rmat[DS_MAT_D]; /* Quick return if possible */ if (ds->n-ds->l == 1) { *(Q+off) = 1; if (!ds->compact) { d[ds->l] = PetscRealPart(A[off]); s[ds->l] = PetscRealPart(B[off]); } wr[ds->l] = d[ds->l]/s[ds->l]; if (wi) wi[ds->l] = 0.0; PetscFunctionReturn(0); } nwall = 12*ld+4; ierr = DSAllocateWork_Private(ds,0,nwall,0);CHKERRQ(ierr); /* Reduce to pseudotriadiagonal form */ ierr = DSIntermediate_GHIEP(ds);CHKERRQ(ierr); /* Compute Eigenvalues (DQDS)*/ /* Form pseudosymmetric tridiagonal */ a = ds->rwork; b = a+ld; c = b+ld; nwu = 3*ld; if (ds->compact) { for (i=ds->l;in-1;i++) { a[i] = d[i]*s[i]; b[i] = e[i]*s[i+1]; c[i] = e[i]*s[i]; } a[ds->n-1] = d[ds->n-1]*s[ds->n-1]; } else { for (i=ds->l;in-1;i++) { a[i] = PetscRealPart(A[i+i*ld]*B[i+i*ld]); b[i] = PetscRealPart(A[i+1+i*ld]*s[i+1]); c[i] = PetscRealPart(A[i+(i+1)*ld]*s[i]); } a[ds->n-1] = PetscRealPart(A[ds->n-1+(ds->n-1)*ld]*B[ds->n-1+(ds->n-1)*ld]); } vi = (wi)?wi+ds->l:NULL; ierr = DSGHIEP_Eigen3DQDS(ds->n-ds->l,a+ds->l,b+ds->l,c+ds->l,wr+ds->l,vi,ds->rwork+nwu,nwall-nwu);CHKERRQ(ierr); /* Compute Eigenvectors with Inverse Iteration */ ierr = DSGHIEPInverseIteration(ds,wr,wi);CHKERRQ(ierr); /* Recover eigenvalues from diagonal */ ierr = DSGHIEPComplexEigs(ds,0,ds->l,wr,wi);CHKERRQ(ierr); #if defined(PETSC_USE_COMPLEX) if (wi) { for (i=ds->l;in;i++) wi[i] = 0.0; } #endif PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/makefile.html0000644000175000017500000000400112211062077021506 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dsghiep_ivit.c dsghiep.c dsghiep_hz.c dsghiep_dqds.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/ghiep/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/index.html0000644000175000017500000000150312211062077021044 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dsghiep_ivit.c
dsghiep.c
dsghiep_hz.c
dsghiep_dqds.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep_ivit.c0000644000175000017500000006524712211062077021710 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include struct HRtr { PetscScalar *data; PetscInt m; PetscInt idx[2]; PetscInt n[2]; PetscScalar tau[2]; PetscReal alpha; PetscReal cs; PetscReal sn; PetscInt type; }; #undef __FUNCT__ #define __FUNCT__ "HRGen" /* Generates a hyperbolic rotation if x1*x1 - x2*x2 != 0 r = sqrt(|x1*x1 - x2*x2|) c = x1/r s = x2/r | c -s||x1| |d*r| |-s c||x2| = | 0 | where d = 1 for type==1 and -1 for type==2 Returns the condition number of the reduction */ static PetscErrorCode HRGen(PetscReal x1,PetscReal x2,PetscInt *type,PetscReal *c,PetscReal *s,PetscReal *r,PetscReal *cond) { PetscReal t,n2,xa,xb; PetscInt type_; PetscFunctionBegin; if (x2==0.0) { *r = PetscAbsReal(x1); *c = (x1>=0)?1.0:-1.0; *s = 0.0; if (type) *type = 1; PetscFunctionReturn(0); } if (PetscAbsReal(x1) == PetscAbsReal(x2)) { /* hyperbolic rotation doesn't exist */ *c = 0.0; *s = 0.0; *r = 0.0; if (type) *type = 0; *cond = PETSC_MAX_REAL; PetscFunctionReturn(0); } if (PetscAbsReal(x1)>PetscAbsReal(x2)) { xa = x1; xb = x2; type_ = 1; } else { xa = x2; xb = x1; type_ = 2; } t = xb/xa; n2 = PetscAbsReal(1 - t*t); *r = PetscSqrtReal(n2)*PetscAbsReal(xa); *c = x1/(*r); *s = x2/(*r); if (type_ == 2) *r *= -1; if (type) *type = type_; if (cond) *cond = (PetscAbsReal(*c) + PetscAbsReal(*s))/PetscAbsReal(PetscAbsReal(*c) - PetscAbsReal(*s)); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "HRApply" /* |c s| Applies an hyperbolic rotator |s c| |c s| [x1 x2]|s c| */ static PetscErrorCode HRApply(PetscInt n,PetscScalar *x1,PetscInt inc1,PetscScalar *x2,PetscInt inc2,PetscReal c,PetscReal s) { PetscInt i; PetscReal t; PetscScalar tmp; PetscFunctionBegin; if (PetscAbsReal(c)>PetscAbsReal(s)) { /* Type I */ t = s/c; for (i=0;i 1) { PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n0,A+ni-n0+j*lda,A+ni-n0+j*lda+1,&inc,&tau)); /* Apply reflector */ if (PetscAbsScalar(tau) != 0.0) { t=*(A+ni-n0+j*lda); *(A+ni-n0+j*lda)=1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&m,&n0,A+ni-n0+j*lda,&inc,&tau,A+j+1+(j+1)*lda,&lda_,work+nwu)); PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0,&m,A+ni-n0+j*lda,&inc,&tau,A+j+1+(j+1)*lda,&lda_,work+nwu)); /* Update Q */ PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n0,A+ni-n0+j*lda,&inc,&tau,Q+(j+1)*ldq,&ldq_,work+nwu)); *(A+ni-n0+j*lda) = t; for (i=1;i 1) { PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n1,A+n-n1+j*lda,A+n-n1+j*lda+1,&inc,&tau)); /* Apply reflector */ if (PetscAbsScalar(tau) != 0.0) { t=*(A+n-n1+j*lda); *(A+n-n1+j*lda)=1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&m,&n1,A+n-n1+j*lda,&inc,&tau,A+j+1+(n-n1)*lda,&lda_,work+nwu)); PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1,&m,A+n-n1+j*lda,&inc,&tau,A+n-n1+(j+1)*lda,&lda_,work+nwu)); /* Update Q */ PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n1,A+n-n1+j*lda,&inc,&tau,Q+(n-n1)*ldq,&ldq_,work+nwu)); *(A+n-n1+j*lda) = t; for (i=1;i 0 && n1 > 0) { ierr = HRGen(PetscRealPart(A[ni-n0+j*lda]),PetscRealPart(A[n-n1+j*lda]),&type,&cs,&sn,&r,&cond);CHKERRQ(ierr); /* Check condition number */ if (cond > 1.0/(10*PETSC_SQRT_MACHINE_EPSILON)) { breakdown = PETSC_TRUE; k++; if (k==n || flip) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Breakdown in construction of hyperbolic transformation"); break; } A[ni-n0+j*lda] = r; A[n-n1+j*lda] = 0.0; A[j+(ni-n0)*lda] = r; A[j+(n-n1)*lda] = 0.0; /* Apply to A */ ierr = HRApply(m,A+j+1+(ni-n0)*lda,1,A+j+1+(n-n1)*lda,1,cs,-sn);CHKERRQ(ierr); ierr = HRApply(m,A+ni-n0+(j+1)*lda,lda,A+n-n1+(j+1)*lda,lda,cs,-sn);CHKERRQ(ierr); /* Update Q */ ierr = HRApply(n,Q+(ni-n0)*ldq,1,Q+(n-n1)*ldq,1,cs,-sn);CHKERRQ(ierr); if (type==2) { ss[ni-n0] = -ss[ni-n0]; ss[n-n1] = -ss[n-n1]; n0++;ni++;n1--; } } if (n0>0) n0--; else n1--; } } /* flip matrices */ if (flip) { for (i=0;idata; tr1->n[0] = n0; tr1->n[1] = n1; tr1->idx[0] = idx0; tr1->idx[1] = idx1; ierr = PetscBLASIntCast(tr1->n[0],&n0_);CHKERRQ(ierr); ierr = PetscBLASIntCast(tr1->n[1],&n1_);CHKERRQ(ierr); if (tr1->n[0] > 1) { PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n0_,x+tr1->idx[0],x+tr1->idx[0]+1,&inc,tr1->tau)); } if (tr1->n[1]> 1) { PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n1_,x+tr1->idx[1],x+tr1->idx[1]+1,&inc,tr1->tau+1)); } if (tr1->idx[0]idx[1]) { ierr = HRGen(PetscRealPart(x[tr1->idx[0]]),PetscRealPart(x[tr1->idx[1]]),&(tr1->type),&(tr1->cs),&(tr1->sn),&(tr1->alpha),ncond);CHKERRQ(ierr); } else { tr1->alpha = PetscRealPart(x[tr1->idx[0]]); *ncond = 1.0; } if (sz==2) { y = tr2->data; /* Apply first transformation to second column */ if (tr1->n[0] > 1 && PetscAbsScalar(tr1->tau[0])!=0.0) { x[tr1->idx[0]] = 1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0_,&inc,x+tr1->idx[0],&inc,tr1->tau,y+tr1->idx[0],&n0_,work)); } if (tr1->n[1] > 1 && PetscAbsScalar(tr1->tau[1])!=0.0) { x[tr1->idx[1]] = 1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1_,&inc,x+tr1->idx[1],&inc,tr1->tau+1,y+tr1->idx[1],&n1_,work)); } if (tr1->idx[0]idx[1]) { ierr = HRApply(1,y+tr1->idx[0],1,y+tr1->idx[1],1,tr1->cs,-tr1->sn);CHKERRQ(ierr); } tr2->n[0] = tr1->n[0]; tr2->n[1] = tr1->n[1]; tr2->idx[0] = tr1->idx[0]; tr2->idx[1] = tr1->idx[1]; if (tr1->idx[0]idx[1] && tr1->type==2) { tr2->idx[1]++; tr2->n[1]--; tr2->n[0]++; } if (tr2->n[0]>0) { tr2->n[0]--; tr2->idx[0]++; if (tr2->n[1]==0) tr2->idx[1] = tr2->idx[0]; } else { tr2->n[1]--; tr2->idx[1]++; tr2->idx[0] = tr2->idx[1]; } /* Hyperbolic transformation to make zeros in y */ ierr = PetscBLASIntCast(tr2->n[0],&n0_);CHKERRQ(ierr); ierr = PetscBLASIntCast(tr2->n[1],&n1_);CHKERRQ(ierr); if (tr2->n[0] > 1) { PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n0_,y+tr2->idx[0],y+tr2->idx[0]+1,&inc,tr2->tau)); } if (tr2->n[1]> 1) { PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n1_,y+tr2->idx[1],y+tr2->idx[1]+1,&inc,tr2->tau+1)); } if (tr2->idx[0]idx[1]) { ierr = HRGen(PetscRealPart(y[tr2->idx[0]]),PetscRealPart(y[tr2->idx[1]]),&(tr2->type),&(tr2->cs),&(tr2->sn),&(tr2->alpha),&ncond2);CHKERRQ(ierr); } else { tr2->alpha = PetscRealPart(y[tr2->idx[0]]); ncond2 = 1.0; } if (ncond2>*ncond) *ncond = ncond2; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "TryHRIt" /* Auxiliary function to try perform one iteration of hr routine, checking condition number. If it is < tolD, apply the transformation to H and R, if not, ok=false and it do nothing tolE, tolerance to exchange complex pairs to improve conditioning */ static PetscErrorCode TryHRIt(PetscInt n,PetscInt j,PetscInt sz,PetscScalar *H,PetscInt ldh,PetscScalar *R,PetscInt ldr,PetscReal *s,PetscBool *exg,PetscBool *ok,PetscInt *n0,PetscInt *n1,PetscInt *idx0,PetscInt *idx1,PetscScalar *work,PetscInt nw) { PetscErrorCode ierr; struct HRtr *tr1,*tr2,tr1_t,tr2_t,tr1_te,tr2_te; PetscScalar *x,*y; PetscReal ncond,ncond_e; PetscInt nwu=0,nwall,i,d=100; PetscBLASInt n0_,n1_,inc=1,mh,mr,n_,ldr_,ldh_; PetscReal tolD = 1e+6; PetscFunctionBegin; ierr = PetscBLASIntCast(n,&n_);CHKERRQ(ierr); ierr = PetscBLASIntCast(ldr,&ldr_);CHKERRQ(ierr); ierr = PetscBLASIntCast(ldh,&ldh_);CHKERRQ(ierr); nwall = 5*n; if (!work || nwtolD) { *ok = PETSC_FALSE; } tr1 = &tr1_t; tr2 = &tr2_t; } else { y = work+nwu; nwu += n; ierr = PetscMemcpy(y,R+(j+1)*ldr,n*sizeof(PetscScalar));CHKERRQ(ierr); tr2_t.data = y; ierr = MadeHRtr(sz,n,*idx0,*n0,*idx1,*n1,&tr1_t,&tr2_t,&ncond,work+nwu,nwall-nwu);CHKERRQ(ierr); /* Computing hyperbolic transformations also for exchanged vectors */ tr1_te.data = work+nwu; nwu += n; ierr = PetscMemcpy(tr1_te.data,R+(j+1)*ldr,n*sizeof(PetscScalar));CHKERRQ(ierr); tr2_te.data = work+nwu; nwu += n; ierr = PetscMemcpy(tr2_te.data,R+j*ldr,n*sizeof(PetscScalar));CHKERRQ(ierr); ierr = MadeHRtr(sz,n,*idx0,*n0,*idx1,*n1,&tr1_te,&tr2_te,&ncond_e,work+nwu,nwall-nwu);CHKERRQ(ierr); if (ncond > d*ncond_e) { *exg = PETSC_TRUE; tr1 = &tr1_te; tr2 = &tr2_te; ncond = ncond_e; } else { tr1 = &tr1_t; tr2 = &tr2_t; } if (ncond>tolD) *ok = PETSC_FALSE; } if (*ok) { /* Everything is OK, apply transformations to R and H */ /* First column */ x = tr1->data; ierr = PetscBLASIntCast(tr1->n[0],&n0_);CHKERRQ(ierr); ierr = PetscBLASIntCast(tr1->n[1],&n1_);CHKERRQ(ierr); ierr = PetscBLASIntCast(n-j-sz,&mr);CHKERRQ(ierr); if (tr1->n[0] > 1 && PetscAbsScalar(tr1->tau[0])!=0.0) { x[tr1->idx[0]] = 1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0_,&mr,x+tr1->idx[0],&inc,tr1->tau,R+(j+sz)*ldr+tr1->idx[0],&ldr_,work+nwu)); PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n0_,x+tr1->idx[0],&inc,tr1->tau,H+(tr1->idx[0])*ldh,&ldh_,work+nwu)); } if (tr1->n[1] > 1 && PetscAbsScalar(tr1->tau[1])!=0.0) { x[tr1->idx[1]] = 1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1_,&mr,x+tr1->idx[1],&inc,tr1->tau+1,R+(j+sz)*ldr+tr1->idx[1],&ldr_,work+nwu)); PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n1_,x+tr1->idx[1],&inc,tr1->tau+1,H+(tr1->idx[1])*ldh,&ldh_,work+nwu)); } if (tr1->idx[0]idx[1]) { ierr = HRApply(mr,R+(j+sz)*ldr+tr1->idx[0],ldr,R+(j+sz)*ldr+tr1->idx[1],ldr,tr1->cs,-tr1->sn);CHKERRQ(ierr); if (tr1->type==1) { ierr = HRApply(n,H+(tr1->idx[0])*ldh,1,H+(tr1->idx[1])*ldh,1,tr1->cs,tr1->sn);CHKERRQ(ierr); } else { ierr = HRApply(n,H+(tr1->idx[0])*ldh,1,H+(tr1->idx[1])*ldh,1,-tr1->cs,-tr1->sn);CHKERRQ(ierr); s[tr1->idx[0]] = -s[tr1->idx[0]]; s[tr1->idx[1]] = -s[tr1->idx[1]]; } } for (i=tr1->idx[0]+1;iidx[0]) = tr1->alpha; if (sz==2) { y = tr2->data; /* Second column */ ierr = PetscBLASIntCast(tr2->n[0],&n0_);CHKERRQ(ierr); ierr = PetscBLASIntCast(tr2->n[1],&n1_);CHKERRQ(ierr); ierr = PetscBLASIntCast(n-j-sz,&mr);CHKERRQ(ierr); ierr = PetscBLASIntCast(n-tr2->idx[0],&mh);CHKERRQ(ierr); if (tr2->n[0] > 1 && PetscAbsScalar(tr2->tau[0])!=0.0) { y[tr2->idx[0]] = 1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0_,&mr,y+tr2->idx[0],&inc,tr2->tau,R+(j+2)*ldr+tr2->idx[0],&ldr_,work+nwu)); PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n0_,y+tr2->idx[0],&inc,tr2->tau,H+(tr2->idx[0])*ldh,&ldh_,work+nwu)); } if (tr2->n[1] > 1 && PetscAbsScalar(tr2->tau[1])!=0.0) { y[tr2->idx[1]] = 1.0; PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1_,&mr,y+tr2->idx[1],&inc,tr2->tau+1,R+(j+2)*ldr+tr2->idx[1],&ldr_,work+nwu)); PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n1_,y+tr2->idx[1],&inc,tr2->tau+1,H+(tr2->idx[1])*ldh,&ldh_,work+nwu)); } if (tr2->idx[0]idx[1]) { ierr = HRApply(mr,R+(j+2)*ldr+tr2->idx[0],ldr,R+(j+2)*ldr+tr2->idx[1],ldr,tr2->cs,-tr2->sn);CHKERRQ(ierr); if (tr2->type==1) { ierr = HRApply(n,H+(tr2->idx[0])*ldh,1,H+(tr2->idx[1])*ldh,1,tr2->cs,tr2->sn);CHKERRQ(ierr); } else { ierr = HRApply(n,H+(tr2->idx[0])*ldh,1,H+(tr2->idx[1])*ldh,1,-tr2->cs,-tr2->sn);CHKERRQ(ierr); s[tr2->idx[0]] = -s[tr2->idx[0]]; s[tr2->idx[1]] = -s[tr2->idx[1]]; } } *(R+(j+1)*ldr+tr2->idx[0]-1) = y[tr2->idx[0]-1]; for (i=tr2->idx[0]+1;iidx[0]) = tr2->alpha; *n0 = tr2->n[0]; *n1 = tr2->n[1]; *idx0 = tr2->idx[0]; *idx1 = tr2->idx[1]; if (tr2->idx[0]idx[1] && tr2->type==2) { (*idx1)++; (*n1)--; (*n0)++; } } else { *n0 = tr1->n[0]; *n1 = tr1->n[1]; *idx0 = tr1->idx[0]; *idx1 = tr1->idx[1]; if (tr1->idx[0]idx[1] && tr1->type==2) { (*idx1)++; (*n1)--; (*n0)++; } } if (*n0>0) { (*n0)--; (*idx0)++; if (*n1==0) *idx1 = *idx0; } else { (*n1)--; (*idx1)++; *idx0 = *idx1; } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "PseudoOrthog_HR" /* compute V = HR whit H s-orthogonal and R upper triangular */ static PetscErrorCode PseudoOrthog_HR(PetscInt *nv,PetscScalar *V,PetscInt ldv,PetscReal *s,PetscScalar *R,PetscInt ldr,PetscBLASInt *perm,PetscBLASInt *cmplxEig,PetscBool *breakdown,PetscScalar *work,PetscInt nw) { PetscErrorCode ierr; PetscInt i,j,n,n0,n1,np,idx0,idx1,sz=1,k=0,t1,t2,nwall,nwu=0; PetscScalar *col1,*col2; PetscBool exg=PETSC_FALSE,ok=PETSC_FALSE; PetscFunctionBegin; n = *nv; nwall = 7*n; if (!work || nw0) np++; if (s[0]>0) n1 = np; else n1 = n-np; n0 = 0; for (i=0;il; n = ds->n-l; ierr = PetscBLASIntCast(n,&n_);CHKERRQ(ierr); ld = ds->ld; ierr = PetscBLASIntCast(ld,&ld_);CHKERRQ(ierr); off = l*ld+l; s = ds->rmat[DS_MAT_D]; if (!ds->compact) { for (i=l;in;i++) s[i] = PetscRealPart(*(ds->mat[DS_MAT_B]+i*ld+i)); } lws = n*n+7*n; lwi = 2*n; ierr = DSAllocateWork_Private(ds,lws,0,lwi);CHKERRQ(ierr); R = ds->work+nwus; nwus += n*n; ldr = n; perm = ds->iwork + nwui; nwui += n; cmplxEig = ds->iwork+nwui; nwui += n; X = ds->mat[mat]; for (i=0;iwork+nwus,lws-nwus);CHKERRQ(ierr); /* Sort wr,wi perm */ ts = ds->work+nwus; nwus += n; ierr = PetscMemcpy(ts,wr+l,n*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;irmat[DS_MAT_T]; e = d+ld; for (i=0;imat[DS_MAT_W]; ierr = DSCopyMatrix_Private(ds,DS_MAT_W,DS_MAT_Q);CHKERRQ(ierr); PetscStackCall("BLASgemm",BLASgemm_("N","N",&n_,&nv_,&n_,&oneS,W+off,&ld_,X+off,&ld_,&zeroS,ds->mat[DS_MAT_Q]+off,&ld_)); } ds->t = nv+l; if (!ds->compact) { ierr = DSSwitchFormat_GHIEP(ds,PETSC_FALSE);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSIntermediate_GHIEP" /* Reduce to tridiagonal-diagonal pair by means of TridiagDiag_HHR. */ PetscErrorCode DSIntermediate_GHIEP(DS ds) { PetscErrorCode ierr; PetscInt i,ld,off; PetscInt nwall,nwallr,nwalli,nwu=0,nwur=0,nwui=0; PetscScalar *A,*B,*Q; PetscReal *d,*e,*s; PetscFunctionBegin; ld = ds->ld; A = ds->mat[DS_MAT_A]; B = ds->mat[DS_MAT_B]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T]+ld; s = ds->rmat[DS_MAT_D]; off = ds->l+ds->l*ld; ierr = PetscMemzero(Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); nwall = ld*ld+ld; nwallr = ld; nwalli = ld; ierr = DSAllocateWork_Private(ds,nwall,nwallr,nwalli);CHKERRQ(ierr); for (i=0;in;i++) Q[i+i*ld]=1.0; for (i=0;in-ds->l;i++) *(ds->perm+i)=i; if (ds->compact) { if (ds->state < DS_STATE_INTERMEDIATE) { ierr = DSSwitchFormat_GHIEP(ds,PETSC_FALSE);CHKERRQ(ierr); ierr = TridiagDiag_HHR(ds->k-ds->l+1,A+off,ld,s+ds->l,Q+off,ld,PETSC_TRUE,d+ds->l,e+ds->l,ds->perm,ds->work+nwu,nwall-nwu,ds->rwork+nwur,nwallr-nwur,ds->iwork+nwui,nwalli-nwui);CHKERRQ(ierr); ds->k = ds->l; ierr = PetscMemzero(d+2*ld+ds->l,(ds->n-ds->l)*sizeof(PetscReal));CHKERRQ(ierr); } } else { if (ds->state < DS_STATE_INTERMEDIATE) { for (i=0;in;i++) s[i] = PetscRealPart(B[i+i*ld]); ierr = TridiagDiag_HHR(ds->n-ds->l,A+off,ld,s+ds->l,Q+off,ld,PETSC_FALSE,d+ds->l,e+ds->l,ds->perm,ds->work+nwu,nwall-nwu,ds->rwork+nwur,nwallr-nwur,ds->iwork+nwui,nwalli-nwui);CHKERRQ(ierr); ierr = PetscMemzero(d+2*ld,(ds->n)*sizeof(PetscReal));CHKERRQ(ierr); ds->k = ds->l; ierr = DSSwitchFormat_GHIEP(ds,PETSC_FALSE);CHKERRQ(ierr); } else { ierr = DSSwitchFormat_GHIEP(ds,PETSC_TRUE);CHKERRQ(ierr); } } PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep.c.html0000644000175000017500000020016712211062077021610 0ustar gladkgladk

Actual source code: dsghiep.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

 17:    You  should have received a copy of the GNU Lesser General  Public  License
 18:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: */
 21: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 22: #include <slepcblaslapack.h>

 26: PetscErrorCode DSAllocate_GHIEP(DS ds,PetscInt ld)
 27: {

 31:   DSAllocateMat_Private(ds,DS_MAT_A);
 32:   DSAllocateMat_Private(ds,DS_MAT_B);
 33:   DSAllocateMat_Private(ds,DS_MAT_Q);
 34:   DSAllocateMatReal_Private(ds,DS_MAT_T);
 35:   DSAllocateMatReal_Private(ds,DS_MAT_D);
 36:   PetscFree(ds->perm);
 37:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 38:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 39:   return(0);
 40: }

 44: PetscErrorCode DSSwitchFormat_GHIEP(DS ds,PetscBool tocompact)
 45: {
 47:   PetscReal      *T,*S;
 48:   PetscScalar    *A,*B;
 49:   PetscInt       i,n,ld;

 52:   A = ds->mat[DS_MAT_A];
 53:   B = ds->mat[DS_MAT_B];
 54:   T = ds->rmat[DS_MAT_T];
 55:   S = ds->rmat[DS_MAT_D];
 56:   n = ds->n;
 57:   ld = ds->ld;
 58:   if (tocompact) { /* switch from dense (arrow) to compact storage */
 59:     PetscMemzero(T,3*ld*sizeof(PetscReal));
 60:     PetscMemzero(S,ld*sizeof(PetscReal));
 61:     for (i=0;i<n-1;i++) {
 62:       T[i] = PetscRealPart(A[i+i*ld]);
 63:       T[ld+i] = PetscRealPart(A[i+1+i*ld]);
 64:       S[i] = PetscRealPart(B[i+i*ld]);
 65:     }
 66:     T[n-1] = PetscRealPart(A[n-1+(n-1)*ld]);
 67:     S[n-1] = PetscRealPart(B[n-1+(n-1)*ld]);
 68:     for (i=ds->l;i< ds->k;i++) T[2*ld+i] = PetscRealPart(A[ds->k+i*ld]);
 69:   } else { /* switch from compact (arrow) to dense storage */
 70:     PetscMemzero(A,ld*ld*sizeof(PetscScalar));
 71:     PetscMemzero(B,ld*ld*sizeof(PetscScalar));
 72:     for (i=0;i<n-1;i++) {
 73:       A[i+i*ld] = T[i];
 74:       A[i+1+i*ld] = T[ld+i];
 75:       A[i+(i+1)*ld] = T[ld+i];
 76:       B[i+i*ld] = S[i];
 77:     }
 78:     A[n-1+(n-1)*ld] = T[n-1];
 79:     B[n-1+(n-1)*ld] = S[n-1];
 80:     for (i=ds->l;i<ds->k;i++) {
 81:       A[ds->k+i*ld] = T[2*ld+i];
 82:       A[i+ds->k*ld] = T[2*ld+i];
 83:     }
 84:   }
 85:   return(0);
 86: }

 90: PetscErrorCode DSView_GHIEP(DS ds,PetscViewer viewer)
 91: {
 92:   PetscErrorCode    ierr;
 93:   PetscViewerFormat format;
 94:   PetscInt          i,j;
 95:   PetscReal         value;
 96:   const char        *methodname[] = {
 97:                      "HR method",
 98:                      "QR + Inverse Iteration",
 99:                      "QR",
100:                      "DQDS + Inverse Iteration "
101:   };
102:   const int         nmeth=sizeof(methodname)/sizeof(methodname[0]);

105:   PetscViewerGetFormat(viewer,&format);
106:   if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
107:     if (ds->method>=nmeth) {
108:       PetscViewerASCIIPrintf(viewer,"solving the problem with: INVALID METHOD\n");
109:     } else {
110:       PetscViewerASCIIPrintf(viewer,"solving the problem with: %s\n",methodname[ds->method]);
111:     }
112:     return(0);
113:   }
114:   if (ds->compact) {
115:     PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);
116:     if (format == PETSC_VIEWER_ASCII_MATLAB) {
117:       PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",ds->n,ds->n);
118:       PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",3*ds->n);
119:       PetscViewerASCIIPrintf(viewer,"zzz = [\n");
120:       for (i=0;i<ds->n;i++) {
121:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_T]+i));
122:       }
123:       for (i=0;i<ds->n-1;i++) {
124:         if (*(ds->rmat[DS_MAT_T]+ds->ld+i) !=0 && i!=ds->k-1) {
125:           PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+2,i+1,*(ds->rmat[DS_MAT_T]+ds->ld+i));
126:           PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+1,i+2,*(ds->rmat[DS_MAT_T]+ds->ld+i));
127:         }
128:       }
129:       for (i = ds->l;i<ds->k;i++) {
130:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",ds->k+1,i+1,*(ds->rmat[DS_MAT_T]+2*ds->ld+i));
131:           PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+1,ds->k+1,*(ds->rmat[DS_MAT_T]+2*ds->ld+i));
132:       }
133:       PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(zzz);\n",DSMatName[DS_MAT_A]);

135:       PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",ds->n,ds->n);
136:       PetscViewerASCIIPrintf(viewer,"omega = zeros(%D,3);\n",3*ds->n);
137:       PetscViewerASCIIPrintf(viewer,"omega = [\n");
138:       for (i=0;i<ds->n;i++) {
139:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_D]+i));
140:       }
141:       PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(omega);\n",DSMatName[DS_MAT_B]);

143:     } else {
144:       PetscViewerASCIIPrintf(viewer,"T\n");
145:       for (i=0;i<ds->n;i++) {
146:         for (j=0;j<ds->n;j++) {
147:           if (i==j) value = *(ds->rmat[DS_MAT_T]+i);
148:           else if (i==j+1 || j==i+1) value = *(ds->rmat[DS_MAT_T]+ds->ld+PetscMin(i,j));
149:           else if ((i<ds->k && j==ds->k) || (i==ds->k && j<ds->k)) value = *(ds->rmat[DS_MAT_T]+2*ds->ld+PetscMin(i,j));
150:           else value = 0.0;
151:           PetscViewerASCIIPrintf(viewer," %18.16e ",value);
152:         }
153:         PetscViewerASCIIPrintf(viewer,"\n");
154:       }
155:       PetscViewerASCIIPrintf(viewer,"omega\n");
156:       for (i=0;i<ds->n;i++) {
157:         for (j=0;j<ds->n;j++) {
158:           if (i==j) value = *(ds->rmat[DS_MAT_D]+i);
159:           else value = 0.0;
160:           PetscViewerASCIIPrintf(viewer," %18.16e ",value);
161:         }
162:         PetscViewerASCIIPrintf(viewer,"\n");
163:       }
164:     }
165:     PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);
166:     PetscViewerFlush(viewer);
167:   } else {
168:     DSViewMat_Private(ds,viewer,DS_MAT_A);
169:     DSViewMat_Private(ds,viewer,DS_MAT_B);
170:   }
171:   if (ds->state>DS_STATE_INTERMEDIATE) {
172:     DSViewMat_Private(ds,viewer,DS_MAT_Q);
173:   }
174:   return(0);
175: }

179: PetscErrorCode DSVectors_GHIEP_Eigen_Some(DS ds,PetscInt *idx,PetscReal *rnorm)
180: {
182:   PetscReal      b[4],M[4],d1,d2,s1,s2,e;
183:   PetscReal      scal1,scal2,wr1,wr2,wi,ep,norm;
184:   PetscScalar    *Q,*X,Y[4],alpha,zeroS = 0.0;
185:   PetscInt       k;
186:   PetscBLASInt   two = 2,n_,ld,one=1;
187: #if !defined(PETSC_USE_COMPLEX)
188:   PetscBLASInt   four=4;
189: #endif

192:   X = ds->mat[DS_MAT_X];
193:   Q = ds->mat[DS_MAT_Q];
194:   k = *idx;
195:   PetscBLASIntCast(ds->n,&n_);
196:   PetscBLASIntCast(ds->ld,&ld);
197:   if (k < ds->n-1) {
198:     e = (ds->compact)?*(ds->rmat[DS_MAT_T]+ld+k):PetscRealPart(*(ds->mat[DS_MAT_A]+(k+1)+ld*k));
199:   } else e = 0.0;
200:   if (e == 0.0) {/* Real */
201:     if (ds->state>=DS_STATE_CONDENSED) {
202:       PetscMemcpy(X+k*ld,Q+k*ld,ld*sizeof(PetscScalar));
203:     } else {
204:       PetscMemzero(X+k*ds->ld,ds->ld*sizeof(PetscScalar));
205:       X[k+k*ds->ld] = 1.0;
206:     }
207:     if (rnorm) {
208:       *rnorm = PetscAbsScalar(X[ds->n-1+k*ld]);
209:     }
210:   } else { /* 2x2 block */
211:     if (ds->compact) {
212:       s1 = *(ds->rmat[DS_MAT_D]+k);
213:       d1 = *(ds->rmat[DS_MAT_T]+k);
214:       s2 = *(ds->rmat[DS_MAT_D]+k+1);
215:       d2 = *(ds->rmat[DS_MAT_T]+k+1);
216:     } else {
217:       s1 = PetscRealPart(*(ds->mat[DS_MAT_B]+k*ld+k));
218:       d1 = PetscRealPart(*(ds->mat[DS_MAT_A]+k+k*ld));
219:       s2 = PetscRealPart(*(ds->mat[DS_MAT_B]+(k+1)*ld+k+1));
220:       d2 = PetscRealPart(*(ds->mat[DS_MAT_A]+k+1+(k+1)*ld));
221:     }
222:     M[0] = d1; M[1] = e; M[2] = e; M[3]= d2;
223:     b[0] = s1; b[1] = 0.0; b[2] = 0.0; b[3] = s2;
224:     ep = LAPACKlamch_("S");
225:     /* Compute eigenvalues of the block */
226:     PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(M,&two,b,&two,&ep,&scal1,&scal2,&wr1,&wr2,&wi));
227:     if (wi==0.0)  /* Real eigenvalues */
228:       SETERRQ(PETSC_COMM_SELF,1,"Real block in DSVectors_GHIEP");
229:     else { /* Complex eigenvalues */
230:       if (scal1<ep) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FP,"Nearly infinite eigenvalue");
231:       wr1 /= scal1; wi /= scal1;
232: #if !defined(PETSC_USE_COMPLEX)
233:       if (SlepcAbs(s1*d1-wr1,wi)<SlepcAbs(s2*d2-wr1,wi)) {
234:         Y[0] = wr1-s2*d2; Y[1] = s2*e; Y[2] = wi; Y[3] = 0.0;
235:       } else {
236:         Y[0] = s1*e; Y[1] = wr1-s1*d1; Y[2] = 0.0; Y[3] = wi;
237:       }
238:       norm = BLASnrm2_(&four,Y,&one);
239:       norm = 1/norm;
240:       if (ds->state >= DS_STATE_CONDENSED) {
241:         alpha = norm;
242:         PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n_,&two,&two,&alpha,ds->mat[DS_MAT_Q]+k*ld,&ld,Y,&two,&zeroS,X+k*ld,&ld));
243:         if (rnorm) *rnorm = SlepcAbsEigenvalue(X[ds->n-1+k*ld],X[ds->n-1+(k+1)*ld]);
244:       } else {
245:         PetscMemzero(X+k*ld,2*ld*sizeof(PetscScalar));
246:         X[k*ld+k] = Y[0]*norm; X[k*ld+k+1] = Y[1]*norm;
247:         X[(k+1)*ld+k] = Y[2]*norm; X[(k+1)*ld+k+1] = Y[3]*norm;
248:       }
249: #else
250:       if (SlepcAbs(s1*d1-wr1,wi)<SlepcAbs(s2*d2-wr1,wi)) {
251:         Y[0] = wr1-s2*d2+PETSC_i*wi; Y[1] = s2*e;
252:       } else {
253:         Y[0] = s1*e; Y[1] = wr1-s1*d1+PETSC_i*wi;
254:       }
255:       norm = BLASnrm2_(&two,Y,&one);
256:       norm = 1/norm;
257:       if (ds->state >= DS_STATE_CONDENSED) {
258:         alpha = norm;
259:         PetscStackCallBLAS("BLASgemv",BLASgemv_("N",&n_,&two,&alpha,ds->mat[DS_MAT_Q]+k*ld,&ld,Y,&one,&zeroS,X+k*ld,&one));
260:         if (rnorm) *rnorm = PetscAbsScalar(X[ds->n-1+k*ld]);
261:       } else {
262:         PetscMemzero(X+k*ld,2*ld*sizeof(PetscScalar));
263:         X[k*ld+k] = Y[0]*norm; X[k*ld+k+1] = Y[1]*norm;
264:       }
265:       X[(k+1)*ld+k] = PetscConj(X[k*ld+k]); X[(k+1)*ld+k+1] = PetscConj(X[k*ld+k+1]);
266: #endif
267:       (*idx)++;
268:     }
269:   }
270:   return(0);
271: }

275: PetscErrorCode DSVectors_GHIEP(DS ds,DSMatType mat,PetscInt *k,PetscReal *rnorm)
276: {
277:   PetscInt       i;
278:   PetscReal      e;

282:   switch (mat) {
283:     case DS_MAT_X:
284:       if (k) {
285:         DSVectors_GHIEP_Eigen_Some(ds,k,rnorm);
286:       } else {
287:         for (i=0; i<ds->n; i++) {
288:           e = (ds->compact)?*(ds->rmat[DS_MAT_T]+ds->ld+i):PetscRealPart(*(ds->mat[DS_MAT_A]+(i+1)+ds->ld*i));
289:           if (e == 0.0) {/* real */
290:             if (ds->state >= DS_STATE_CONDENSED) {
291:               PetscMemcpy(ds->mat[mat]+i*ds->ld,ds->mat[DS_MAT_Q]+i*ds->ld,ds->ld*sizeof(PetscScalar));
292:             } else {
293:               PetscMemzero(ds->mat[mat]+i*ds->ld,ds->ld*sizeof(PetscScalar));
294:               *(ds->mat[mat]+i+i*ds->ld) = 1.0;
295:             }
296:           } else {
297:             DSVectors_GHIEP_Eigen_Some(ds,&i,rnorm);
298:           }
299:         }
300:       }
301:       break;
302:     case DS_MAT_Y:
303:     case DS_MAT_U:
304:     case DS_MAT_VT:
305:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
306:       break;
307:     default:
308:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
309:   }
310:   return(0);
311: }

315: /*
316:   Extract the eigenvalues contained in the block-diagonal of the indefinite problem.
317:   Only the index range n0..n1 is processed.
318: */
319: PetscErrorCode DSGHIEPComplexEigs(DS ds,PetscInt n0,PetscInt n1,PetscScalar *wr,PetscScalar *wi)
320: {
321:   PetscInt     k,ld;
322:   PetscBLASInt two=2;
323:   PetscScalar  *A,*B;
324:   PetscReal    *D,*T;
325:   PetscReal    b[4],M[4],d1,d2,s1,s2,e;
326:   PetscReal    scal1,scal2,ep,wr1,wr2,wi1;

329:   ld = ds->ld;
330:   A = ds->mat[DS_MAT_A];
331:   B = ds->mat[DS_MAT_B];
332:   D = ds->rmat[DS_MAT_D];
333:   T = ds->rmat[DS_MAT_T];
334:   for (k=n0;k<n1;k++) {
335:     if (k < n1-1) {
336:       e = (ds->compact)?T[ld+k]:PetscRealPart(A[(k+1)+ld*k]);
337:     } else {
338:       e = 0.0;
339:     }
340:     if (e==0.0) {
341:       /* real eigenvalue */
342:       wr[k] = (ds->compact)?T[k]/D[k]:A[k+k*ld]/B[k+k*ld];
343: #if !defined(PETSC_USE_COMPLEX)
344:       wi[k] = 0.0 ;
345: #endif
346:     } else {
347:       /* diagonal block */
348:       if (ds->compact) {
349:         s1 = D[k];
350:         d1 = T[k];
351:         s2 = D[k+1];
352:         d2 = T[k+1];
353:       } else {
354:         s1 = PetscRealPart(B[k*ld+k]);
355:         d1 = PetscRealPart(A[k+k*ld]);
356:         s2 = PetscRealPart(B[(k+1)*ld+k+1]);
357:         d2 = PetscRealPart(A[k+1+(k+1)*ld]);
358:       }
359:       M[0] = d1; M[1] = e; M[2] = e; M[3]= d2;
360:       b[0] = s1; b[1] = 0.0; b[2] = 0.0; b[3] = s2;
361:       ep = LAPACKlamch_("S");
362:       /* Compute eigenvalues of the block */
363:       PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(M,&two,b,&two,&ep,&scal1,&scal2,&wr1,&wr2,&wi1));
364:       if (scal1<ep) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FP,"Nearly infinite eigenvalue");
365:       wr[k] = wr1/scal1;
366:       if (wi1==0.0) { /* Real eigenvalues */
367:         if (scal2<ep) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FP,"Nearly infinite eigenvalue");
368:         wr[k+1] = wr2/scal2;
369: #if !defined(PETSC_USE_COMPLEX)
370:         wi[k] = 0.0;
371:         wi[k+1] = 0.0;
372: #endif
373:       } else { /* Complex eigenvalues */
374: #if !defined(PETSC_USE_COMPLEX)
375:         wr[k+1] = wr[k];
376:         wi[k] = wi1/scal1;
377:         wi[k+1] = -wi[k];
378: #else
379:         wr[k] += PETSC_i*wi1/scal1;
380:         wr[k+1] = PetscConj(wr[k]);
381: #endif
382:       }
383:       k++;
384:     }
385:   }
386: #if defined(PETSC_USE_COMPLEX)
387:   if (wi) {
388:     for (k=n0;k<n1;k++) wi[k] = 0.0;
389:   }
390: #endif
391:   return(0);
392: }

396: PetscErrorCode DSSort_GHIEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
397: {
399:   PetscInt       n,i,*perm;
400:   PetscReal      *d,*e,*s;

403: #if !defined(PETSC_USE_COMPLEX)
405: #endif
406:   n = ds->n;
407:   d = ds->rmat[DS_MAT_T];
408:   e = d + ds->ld;
409:   s = ds->rmat[DS_MAT_D];
410:   DSAllocateWork_Private(ds,ds->ld,ds->ld,0);
411:   perm = ds->perm;
412:   if (!rr) {
413:     rr = wr;
414:     ri = wi;
415:   }
416:   DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_TRUE);
417:   if (!ds->compact) { DSSwitchFormat_GHIEP(ds,PETSC_TRUE); }
418:   PetscMemcpy(ds->work,wr,n*sizeof(PetscScalar));
419:   for (i=ds->l;i<n;i++) {
420:     wr[i] = *(ds->work + perm[i]);
421:   }
422: #if !defined(PETSC_USE_COMPLEX)
423:   PetscMemcpy(ds->work,wi,n*sizeof(PetscScalar));
424:   for (i=ds->l;i<n;i++) {
425:     wi[i] = *(ds->work + perm[i]);
426:   }
427: #endif
428:   PetscMemcpy(ds->rwork,s,n*sizeof(PetscReal));
429:   for (i=ds->l;i<n;i++) {
430:     s[i] = *(ds->rwork+perm[i]);
431:   }
432:   PetscMemcpy(ds->rwork,d,n*sizeof(PetscReal));
433:   for (i=ds->l;i<n;i++) {
434:     d[i] = *(ds->rwork  + perm[i]);
435:   }
436:   PetscMemcpy(ds->rwork,e,(n-1)*sizeof(PetscReal));
437:   PetscMemzero(e+ds->l,(n-1-ds->l)*sizeof(PetscScalar));
438:   for (i=ds->l;i<n-1;i++) {
439:     if (perm[i]<n-1) e[i] = *(ds->rwork + perm[i]);
440:   }
441:   if (!ds->compact) { DSSwitchFormat_GHIEP(ds,PETSC_FALSE); }
442:   DSPermuteColumns_Private(ds,ds->l,n,DS_MAT_Q,perm);
443:   return(0);
444: }


449: /*
450:   Get eigenvectors with inverse iteration.
451:   The system matrix is in Hessenberg form.
452: */
453: PetscErrorCode DSGHIEPInverseIteration(DS ds,PetscScalar *wr,PetscScalar *wi)
454: {
455: #if defined(PETSC_MISSING_LAPACK_HSEIN)
457:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"HSEIN - Lapack routine is unavailable");
458: #else
460:   PetscInt       i,off;
461:   PetscBLASInt   *select,*infoC,ld,n1,mout,info;
462:   PetscScalar    *A,*B,*H,*X;
463:   PetscReal      *s,*d,*e;

466:   PetscBLASIntCast(ds->ld,&ld);
467:   PetscBLASIntCast(ds->n-ds->l,&n1);
468:   DSAllocateWork_Private(ds,ld*ld+2*ld,ld,2*ld);
469:   DSAllocateMat_Private(ds,DS_MAT_W);
470:   A = ds->mat[DS_MAT_A];
471:   B = ds->mat[DS_MAT_B];
472:   H = ds->mat[DS_MAT_W];
473:   s = ds->rmat[DS_MAT_D];
474:   d = ds->rmat[DS_MAT_T];
475:   e = d + ld;
476:   select = ds->iwork;
477:   infoC = ds->iwork + ld;
478:   off = ds->l+ds->l*ld;
479:   if (ds->compact) {
480:     H[off] = d[ds->l]*s[ds->l];
481:     H[off+ld] = e[ds->l]*s[ds->l];
482:     for (i=ds->l+1;i<ds->n-1;i++) {
483:       H[i+(i-1)*ld] = e[i-1]*s[i];
484:       H[i+i*ld] = d[i]*s[i];
485:       H[i+(i+1)*ld] = e[i]*s[i];
486:     }
487:     H[ds->n-1+(ds->n-2)*ld] = e[ds->n-2]*s[ds->n-1];
488:     H[ds->n-1+(ds->n-1)*ld] = d[ds->n-1]*s[ds->n-1];
489:   } else {
490:     s[ds->l] = PetscRealPart(B[off]);
491:     H[off] = A[off]*s[ds->l];
492:     H[off+ld] = A[off+ld]*s[ds->l];
493:     for (i=ds->l+1;i<ds->n-1;i++) {
494:       s[i] = PetscRealPart(B[i+i*ld]);
495:       H[i+(i-1)*ld] = A[i+(i-1)*ld]*s[i];
496:       H[i+i*ld]     = A[i+i*ld]*s[i];
497:       H[i+(i+1)*ld] = A[i+(i+1)*ld]*s[i];
498:     }
499:     s[ds->n-1] = PetscRealPart(B[ds->n-1+(ds->n-1)*ld]);
500:     H[ds->n-1+(ds->n-2)*ld] = A[ds->n-1+(ds->n-2)*ld]*s[ds->n-1];
501:     H[ds->n-1+(ds->n-1)*ld] = A[ds->n-1+(ds->n-1)*ld]*s[ds->n-1];
502:   }
503:   DSAllocateMat_Private(ds,DS_MAT_X);
504:   X = ds->mat[DS_MAT_X];
505:   for (i=0;i<n1;i++)select[i]=1;
506: #if !defined(PETSC_USE_COMPLEX)
507:   PetscStackCallBLAS("LAPACKhsein",LAPACKhsein_("R","N","N",select,&n1,H+off,&ld,wr+ds->l,wi+ds->l,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,NULL,infoC,&info));
508: #else
509:   PetscStackCallBLAS("LAPACKhsein",LAPACKhsein_("R","N","N",select,&n1,H+off,&ld,wr+ds->l,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,ds->rwork,NULL,infoC,&info));
510: #endif
511:   if (info<0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in hsein routine %d",-i);
512:   if (info>0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Convergence error in hsein routine %d",i);
513:   DSGHIEPOrthogEigenv(ds,DS_MAT_X,wr,wi,PETSC_TRUE);
514:   return(0);
515: #endif
516: }


521: /*
522:    Undo 2x2 blocks that have real eigenvalues.
523: */
524: PetscErrorCode DSGHIEPRealBlocks(DS ds)
525: {
527:   PetscInt       i;
528:   PetscReal      e,d1,d2,s1,s2,ss1,ss2,t,dd,ss;
529:   PetscReal      maxy,ep,scal1,scal2,snorm;
530:   PetscReal      *T,*D,b[4],M[4],wr1,wr2,wi;
531:   PetscScalar    *A,*B,Y[4],oneS = 1.0,zeroS = 0.0;
532:   PetscBLASInt   m,two=2,ld;
533:   PetscBool      isreal;

536:   PetscBLASIntCast(ds->ld,&ld);
537:   PetscBLASIntCast(ds->n-ds->l,&m);
538:   A = ds->mat[DS_MAT_A];
539:   B = ds->mat[DS_MAT_B];
540:   T = ds->rmat[DS_MAT_T];
541:   D = ds->rmat[DS_MAT_D];
542:   DSAllocateWork_Private(ds,2*m,0,0);
543:   for (i=ds->l;i<ds->n-1;i++) {
544:     e = (ds->compact)?T[ld+i]:PetscRealPart(A[(i+1)+ld*i]);
545:     if (e != 0.0) { /* 2x2 block */
546:       if (ds->compact) {
547:         s1 = D[i];
548:         d1 = T[i];
549:         s2 = D[i+1];
550:         d2 = T[i+1];
551:       } else {
552:         s1 = PetscRealPart(B[i*ld+i]);
553:         d1 = PetscRealPart(A[i*ld+i]);
554:         s2 = PetscRealPart(B[(i+1)*ld+i+1]);
555:         d2 = PetscRealPart(A[(i+1)*ld+i+1]);
556:       }
557:       isreal = PETSC_FALSE;
558:       if (s1==s2) { /* apply a Jacobi rotation to compute the eigendecomposition */
559:         dd = d1-d2;
560:         if (2*PetscAbsReal(e) <= dd) {
561:           t = 2*e/dd;
562:           t = t/(1 + PetscSqrtReal(1+t*t));
563:         } else {
564:           t = dd/(2*e);
565:           ss = (t>=0)?1.0:-1.0;
566:           t = ss/(PetscAbsReal(t)+PetscSqrtReal(1+t*t));
567:         }
568:         Y[0] = 1/PetscSqrtReal(1 + t*t); Y[3] = Y[0]; /* c */
569:         Y[1] = Y[0]*t; Y[2] = -Y[1]; /* s */
570:         wr1 = d1+t*e;
571:         wr2 = d2-t*e;
572:         ss1 = s1; ss2 = s2;
573:         isreal = PETSC_TRUE;
574:       } else {
575:         ss1 = 1.0; ss2 = 1.0,
576:         M[0] = d1; M[1] = e; M[2] = e; M[3]= d2;
577:         b[0] = s1; b[1] = 0.0; b[2] = 0.0; b[3] = s2;
578:         ep = LAPACKlamch_("S");
579:         /* Compute eigenvalues of the block */
580:         PetscStackCallBLAS("LAPACKlag2",LAPACKlag2_(M,&two,b,&two,&ep,&scal1,&scal2,&wr1,&wr2,&wi));
581:         if (wi==0.0) { /* Real eigenvalues */
582:           isreal = PETSC_TRUE;
583:           if (scal1<ep||scal2<ep) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FP,"Nearly infinite eigenvalue");
584:           wr1 /= scal1; wr2 /= scal2;
585:           if (PetscAbsReal(s1*d1-wr1)<PetscAbsReal(s2*d2-wr1)) {
586:             Y[0] = wr1-s2*d2;
587:             Y[1] = s2*e;
588:           } else {
589:             Y[0] = s1*e;
590:             Y[1] = wr1-s1*d1;
591:           }
592:           /* normalize with a signature*/
593:           maxy = PetscMax(PetscAbsScalar(Y[0]),PetscAbsScalar(Y[1]));
594:           scal1 = PetscRealPart(Y[0])/maxy; scal2 = PetscRealPart(Y[1])/maxy;
595:           snorm = scal1*scal1*s1 + scal2*scal2*s2;
596:           if (snorm<0) { ss1 = -1.0; snorm = -snorm; }
597:           snorm = maxy*PetscSqrtReal(snorm); Y[0] = Y[0]/snorm; Y[1] = Y[1]/snorm;
598:           if (PetscAbsReal(s1*d1-wr2)<PetscAbsReal(s2*d2-wr2)) {
599:             Y[2] = wr2-s2*d2;
600:             Y[3] = s2*e;
601:           } else {
602:             Y[2] = s1*e;
603:             Y[3] = wr2-s1*d1;
604:           }
605:           maxy = PetscMax(PetscAbsScalar(Y[2]),PetscAbsScalar(Y[3]));
606:           scal1 = PetscRealPart(Y[2])/maxy; scal2 = PetscRealPart(Y[3])/maxy;
607:           snorm = scal1*scal1*s1 + scal2*scal2*s2;
608:           if (snorm<0) { ss2 = -1.0; snorm = -snorm; }
609:           snorm = maxy*PetscSqrtReal(snorm);Y[2] = Y[2]/snorm; Y[3] = Y[3]/snorm;
610:         }
611:         wr1 *= ss1; wr2 *= ss2;
612:       }
613:       if (isreal) {
614:         if (ds->compact) {
615:           D[i] = ss1;;
616:           T[i] = wr1;
617:           D[i+1] = ss2;
618:           T[i+1] = wr2;
619:           T[ld+i] = 0.0;
620:         } else {
621:           B[i*ld+i] = ss1;
622:           A[i*ld+i] = wr1;
623:           B[(i+1)*ld+i+1] = ss2;
624:           A[(i+1)*ld+i+1] = wr2;
625:           A[(i+1)+ld*i] = 0.0;
626:           A[i+ld*(i+1)] = 0.0;
627:         }
628:         PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&m,&two,&two,&oneS,ds->mat[DS_MAT_Q]+ds->l+i*ld,&ld,Y,&two,&zeroS,ds->work,&m));
629:         PetscMemcpy(ds->mat[DS_MAT_Q]+ds->l+i*ld,ds->work,m*sizeof(PetscScalar));
630:         PetscMemcpy(ds->mat[DS_MAT_Q]+ds->l+(i+1)*ld,ds->work+m,m*sizeof(PetscScalar));
631:       }
632:       i++;
633:     }
634:   }
635:   return(0);
636: }

640: PetscErrorCode DSSolve_GHIEP_QR_II(DS ds,PetscScalar *wr,PetscScalar *wi)
641: {
642: #if defined(PETSC_MISSING_LAPACK_HSEQR)
644:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"HSEQR - Lapack routine is unavailable");
645: #else
647:   PetscInt       i,off;
648:   PetscBLASInt   n1,ld,one,info,lwork;
649:   PetscScalar    *H,*A,*B,*Q;
650:   PetscReal      *d,*e,*s;

653: #if !defined(PETSC_USE_COMPLEX)
655: #endif
656:   one = 1;
657:   PetscBLASIntCast(ds->n-ds->l,&n1);
658:   PetscBLASIntCast(ds->ld,&ld);
659:   off = ds->l + ds->l*ld;
660:   A = ds->mat[DS_MAT_A];
661:   B = ds->mat[DS_MAT_B];
662:   Q = ds->mat[DS_MAT_Q];
663:   d = ds->rmat[DS_MAT_T];
664:   e = ds->rmat[DS_MAT_T] + ld;
665:   s = ds->rmat[DS_MAT_D];
666:   DSAllocateWork_Private(ds,ld*ld,2*ld,ld*2);
667:   lwork = ld*ld;

669:   /* Quick return if possible */
670:   if (n1 == 1) {
671:     *(Q+off) = 1;
672:     if (!ds->compact) {
673:       d[ds->l] = PetscRealPart(A[off]);
674:       s[ds->l] = PetscRealPart(B[off]);
675:     }
676:     wr[ds->l] = d[ds->l]/s[ds->l];
677:     if (wi) wi[ds->l] = 0.0;
678:     return(0);
679:   }
680:   /* Reduce to pseudotriadiagonal form */
681:   DSIntermediate_GHIEP(ds);

683:   /* Compute Eigenvalues (QR)*/
684:   DSAllocateMat_Private(ds,DS_MAT_W);
685:   H = ds->mat[DS_MAT_W];
686:   if (ds->compact) {
687:     H[off] = d[ds->l]*s[ds->l];
688:     H[off+ld] = e[ds->l]*s[ds->l];
689:     for (i=ds->l+1;i<ds->n-1;i++) {
690:       H[i+(i-1)*ld] = e[i-1]*s[i];
691:       H[i+i*ld]     = d[i]*s[i];
692:       H[i+(i+1)*ld] = e[i]*s[i];
693:     }
694:     H[ds->n-1+(ds->n-2)*ld] = e[ds->n-2]*s[ds->n-1];
695:     H[ds->n-1+(ds->n-1)*ld] = d[ds->n-1]*s[ds->n-1];
696:   } else {
697:     s[ds->l] = PetscRealPart(B[off]);
698:     H[off] = A[off]*s[ds->l];
699:     H[off+ld] = A[off+ld]*s[ds->l];
700:     for (i=ds->l+1;i<ds->n-1;i++) {
701:       s[i] = PetscRealPart(B[i+i*ld]);
702:       H[i+(i-1)*ld] = A[i+(i-1)*ld]*s[i];
703:       H[i+i*ld]     = A[i+i*ld]*s[i];
704:       H[i+(i+1)*ld] = A[i+(i+1)*ld]*s[i];
705:     }
706:     s[ds->n-1] = PetscRealPart(B[ds->n-1+(ds->n-1)*ld]);
707:     H[ds->n-1+(ds->n-2)*ld] = A[ds->n-1+(ds->n-2)*ld]*s[ds->n-1];
708:     H[ds->n-1+(ds->n-1)*ld] = A[ds->n-1+(ds->n-1)*ld]*s[ds->n-1];
709:   }

711: #if !defined(PETSC_USE_COMPLEX)
712:   PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("E","N",&n1,&one,&n1,H+off,&ld,wr+ds->l,wi+ds->l,NULL,&ld,ds->work,&lwork,&info));
713: #else
714:   PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("E","N",&n1,&one,&n1,H+off,&ld,wr+ds->l,NULL,&ld,ds->work,&lwork,&info));
715: #endif
716:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xHSEQR %d",&info);

718:   /* Compute Eigenvectors with Inverse Iteration */
719:   DSGHIEPInverseIteration(ds,wr,wi);

721:   /* Recover eigenvalues from diagonal */
722:   DSGHIEPComplexEigs(ds,0,ds->l,wr,wi);
723: #if defined(PETSC_USE_COMPLEX)
724:   if (wi) {
725:     for (i=ds->l;i<ds->n;i++) wi[i] = 0.0;
726:   }
727: #endif
728:   return(0);
729: #endif
730: }

734: PetscErrorCode DSSolve_GHIEP_QR(DS ds,PetscScalar *wr,PetscScalar *wi)
735: {
736: #if defined(SLEPC_MISSING_LAPACK_GEHRD) || defined(SLEPC_MISSING_LAPACK_ORGHR) || defined(PETSC_MISSING_LAPACK_HSEQR)
738:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEHRD/ORGHR/HSEQR - Lapack routines are unavailable");
739: #else
741:   PetscInt       i,off;
742:   PetscBLASInt   n1,ld,one,info,lwork,mout;
743:   PetscScalar    *H,*A,*B,*Q,*X;
744:   PetscReal      *d,*e,*s;

747: #if !defined(PETSC_USE_COMPLEX)
749: #endif
750:   one = 1;
751:   PetscBLASIntCast(ds->n-ds->l,&n1);
752:   PetscBLASIntCast(ds->ld,&ld);
753:   off = ds->l + ds->l*ld;
754:   A = ds->mat[DS_MAT_A];
755:   B = ds->mat[DS_MAT_B];
756:   Q = ds->mat[DS_MAT_Q];
757:   d = ds->rmat[DS_MAT_T];
758:   e = ds->rmat[DS_MAT_T] + ld;
759:   s = ds->rmat[DS_MAT_D];
760:   DSAllocateWork_Private(ds,ld+ld*ld,2*ld,ld*2);
761:   lwork = ld*ld;

763:   /* Quick return if possible */
764:   if (n1 == 1) {
765:     *(Q+off) = 1;
766:     if (!ds->compact) {
767:       d[ds->l] = PetscRealPart(A[off]);
768:       s[ds->l] = PetscRealPart(B[off]);
769:     }
770:     wr[ds->l] = d[ds->l]/s[ds->l];
771:     if (wi) wi[ds->l] = 0.0;
772:     return(0);
773:   }
774:   /* Reduce to pseudotriadiagonal form */
775:   DSIntermediate_GHIEP(ds);

777:   /* form standard problem in H */
778:   DSAllocateMat_Private(ds,DS_MAT_W);
779:   H = ds->mat[DS_MAT_W];
780:   if (ds->compact) {
781:     H[off] = d[ds->l]*s[ds->l];
782:     H[off+ld] = e[ds->l]*s[ds->l];
783:     for (i=ds->l+1;i<ds->n-1;i++) {
784:       H[i+(i-1)*ld] = e[i-1]*s[i];
785:       H[i+i*ld]     = d[i]*s[i];
786:       H[i+(i+1)*ld] = e[i]*s[i];
787:     }
788:     H[ds->n-1+(ds->n-2)*ld] = e[ds->n-2]*s[ds->n-1];
789:     H[ds->n-1+(ds->n-1)*ld] = d[ds->n-1]*s[ds->n-1];
790:   } else {
791:     s[ds->l] = PetscRealPart(B[off]);
792:     H[off] = A[off]*s[ds->l];
793:     H[off+ld] = A[off+ld]*s[ds->l];
794:     for (i=ds->l+1;i<ds->n-1;i++) {
795:       s[i] = PetscRealPart(B[i+i*ld]);
796:       H[i+(i-1)*ld] = A[i+(i-1)*ld]*s[i];
797:       H[i+i*ld]     = A[i+i*ld]*s[i];
798:       H[i+(i+1)*ld] = A[i+(i+1)*ld]*s[i];
799:     }
800:     s[ds->n-1] = PetscRealPart(B[ds->n-1+(ds->n-1)*ld]);
801:     H[ds->n-1+(ds->n-2)*ld] = A[ds->n-1+(ds->n-2)*ld]*s[ds->n-1];
802:     H[ds->n-1+(ds->n-1)*ld] = A[ds->n-1+(ds->n-1)*ld]*s[ds->n-1];
803:   }
804:   /* Compute the real Schur form */
805:   DSAllocateMat_Private(ds,DS_MAT_X);
806:   X = ds->mat[DS_MAT_X];
807: #if !defined(PETSC_USE_COMPLEX)
808:   PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","I",&n1,&one,&n1,H+off,&ld,wr+ds->l,wi+ds->l,X+off,&ld,ds->work,&lwork,&info));
809: #else
810:   PetscStackCallBLAS("LAPACKhseqr",LAPACKhseqr_("S","I",&n1,&one,&n1,H+off,&ld,wr+ds->l,X+off,&ld,ds->work,&lwork,&info));
811: #endif
812:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xHSEQR %d",&info);

814:   /* Compute eigenvectors */
815: #if !defined(PETSC_USE_COMPLEX)
816:   PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_("R","B",NULL,&n1,H+off,&ld,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,&info));
817: #else
818:   PetscStackCallBLAS("LAPACKtrevc",LAPACKtrevc_("R","B",NULL,&n1,H+off,&ld,NULL,&ld,X+off,&ld,&n1,&mout,ds->work,ds->rwork,&info));
819: #endif
820:   if (info) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_LIB,"Error in Lapack xTREVC %i",&info);

822:   /* Compute real s-orthonormal basis */
823:   DSGHIEPOrthogEigenv(ds,DS_MAT_X,wr,wi,PETSC_TRUE);

825:   /* Recover eigenvalues from diagonal */
826:   DSGHIEPComplexEigs(ds,0,ds->l,wr,wi);
827: #if defined(PETSC_USE_COMPLEX)
828:   if (wi) {
829:     for (i=ds->l;i<ds->n;i++) wi[i] = 0.0;
830:   }
831: #endif
832:   return(0);
833: #endif
834: }

838: PetscErrorCode DSNormalize_GHIEP(DS ds,DSMatType mat,PetscInt col)
839: {
841:   PetscInt       i,i0,i1;
842:   PetscBLASInt   ld,n,one = 1;
843:   PetscScalar    *A = ds->mat[DS_MAT_A],norm,*x;
844: #if !defined(PETSC_USE_COMPLEX)
845:   PetscScalar    norm0;
846: #endif

849:   switch (mat) {
850:     case DS_MAT_X:
851:     case DS_MAT_Y:
852:     case DS_MAT_Q:
853:       /* Supported matrices */
854:       break;
855:     case DS_MAT_U:
856:     case DS_MAT_VT:
857:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
858:       break;
859:     default:
860:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
861:   }

863:   PetscBLASIntCast(ds->n,&n);
864:   PetscBLASIntCast(ds->ld,&ld);
865:   DSGetArray(ds,mat,&x);
866:   if (col < 0) {
867:     i0 = 0; i1 = ds->n;
868:   } else if (col>0 && A[ds->ld*(col-1)+col] != 0.0) {
869:     i0 = col-1; i1 = col+1;
870:   } else {
871:     i0 = col; i1 = col+1;
872:   }
873:   for (i=i0; i<i1; i++) {
874: #if !defined(PETSC_USE_COMPLEX)
875:     if (i<n-1 && A[ds->ld*i+i+1] != 0.0) {
876:       norm = BLASnrm2_(&n,&x[ld*i],&one);
877:       norm0 = BLASnrm2_(&n,&x[ld*(i+1)],&one);
878:       norm = 1.0/SlepcAbsEigenvalue(norm,norm0);
879:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
880:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*(i+1)],&one));
881:       i++;
882:     } else
883: #endif
884:     {
885:       norm = BLASnrm2_(&n,&x[ld*i],&one);
886:       norm = 1.0/norm;
887:       PetscStackCallBLAS("BLASscal",BLASscal_(&n,&norm,&x[ld*i],&one));
888:      }
889:   }
890:   return(0);
891: }

895: PETSC_EXTERN PetscErrorCode DSCreate_GHIEP(DS ds)
896: {
898:   ds->ops->allocate      = DSAllocate_GHIEP;
899:   ds->ops->view          = DSView_GHIEP;
900:   ds->ops->vectors       = DSVectors_GHIEP;
901:   ds->ops->solve[0]      = DSSolve_GHIEP_HZ;
902:   ds->ops->solve[1]      = DSSolve_GHIEP_QR_II;
903:   ds->ops->solve[2]      = DSSolve_GHIEP_QR;
904:   ds->ops->solve[3]      = DSSolve_GHIEP_DQDS_II;
905:   ds->ops->sort          = DSSort_GHIEP;
906:   ds->ops->normalize     = DSNormalize_GHIEP;
907:   return(0);
908: }

slepc-3.4.2.dfsg.orig/src/ds/impls/ghiep/dsghiep_ivit.c.html0000644000175000017500000016044312211062077022645 0ustar gladkgladk
Actual source code: dsghiep_ivit.c

  1: /*

  3:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  5:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  7:    This file is part of SLEPc.

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

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

 18:    You  should have received a copy of the GNU Lesser General  Public  License
 19:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 20:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 21: */
 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 25: struct HRtr
 26: {
 27:   PetscScalar *data;
 28:   PetscInt    m;
 29:   PetscInt    idx[2];
 30:   PetscInt    n[2];
 31:   PetscScalar tau[2];
 32:   PetscReal   alpha;
 33:   PetscReal   cs;
 34:   PetscReal   sn;
 35:   PetscInt    type;
 36: };

 40: /*
 41:   Generates a hyperbolic rotation
 42:     if x1*x1 - x2*x2 != 0
 43:       r = sqrt(|x1*x1 - x2*x2|)
 44:       c = x1/r  s = x2/r

 46:       | c -s||x1|   |d*r|
 47:       |-s  c||x2| = | 0 |
 48:       where d = 1 for type==1 and -1 for type==2
 49:   Returns the condition number of the reduction
 50: */
 51: static PetscErrorCode HRGen(PetscReal x1,PetscReal x2,PetscInt *type,PetscReal *c,PetscReal *s,PetscReal *r,PetscReal *cond)
 52: {
 53:   PetscReal t,n2,xa,xb;
 54:   PetscInt  type_;

 57:   if (x2==0.0) {
 58:     *r = PetscAbsReal(x1);
 59:     *c = (x1>=0)?1.0:-1.0;
 60:     *s = 0.0;
 61:     if (type) *type = 1;
 62:     return(0);
 63:   }
 64:   if (PetscAbsReal(x1) == PetscAbsReal(x2)) {
 65:     /* hyperbolic rotation doesn't exist */
 66:     *c = 0.0;
 67:     *s = 0.0;
 68:     *r = 0.0;
 69:     if (type) *type = 0;
 70:     *cond = PETSC_MAX_REAL;
 71:     return(0);
 72:   }

 74:   if (PetscAbsReal(x1)>PetscAbsReal(x2)) {
 75:     xa = x1; xb = x2; type_ = 1;
 76:   } else {
 77:     xa = x2; xb = x1; type_ = 2;
 78:   }
 79:   t = xb/xa;
 80:   n2 = PetscAbsReal(1 - t*t);
 81:   *r = PetscSqrtReal(n2)*PetscAbsReal(xa);
 82:   *c = x1/(*r);
 83:   *s = x2/(*r);
 84:   if (type_ == 2) *r *= -1;
 85:   if (type) *type = type_;
 86:   if (cond) *cond = (PetscAbsReal(*c) + PetscAbsReal(*s))/PetscAbsReal(PetscAbsReal(*c) - PetscAbsReal(*s));
 87:   return(0);
 88: }

 92: /*
 93:                                 |c  s|
 94:   Applies an hyperbolic rotator |s  c|
 95:            |c  s|
 96:     [x1 x2]|s  c|
 97: */
 98: static PetscErrorCode HRApply(PetscInt n,PetscScalar *x1,PetscInt inc1,PetscScalar *x2,PetscInt inc2,PetscReal c,PetscReal s)
 99: {
100:   PetscInt    i;
101:   PetscReal   t;
102:   PetscScalar tmp;

105:   if (PetscAbsReal(c)>PetscAbsReal(s)) { /* Type I */
106:     t = s/c;
107:     for (i=0;i<n;i++) {
108:       x1[i*inc1] = c*x1[i*inc1] + s*x2[i*inc2];
109:       x2[i*inc2] = t*x1[i*inc1] + x2[i*inc2]/c;
110:     }
111:   } else { /* Type II */
112:     t = c/s;
113:     for (i=0;i<n;i++) {
114:       tmp = x1[i*inc1];
115:       x1[i*inc1] = c*x1[i*inc1] + s*x2[i*inc2];
116:       x2[i*inc2] = t*x1[i*inc1] + tmp/s;
117:     }
118:   }
119:   return(0);
120: }

124: /*
125:   Reduction to tridiagonal-diagonal form (see F. Tisseur, SIMAX 26(1), 2004).

127:   Input:
128:     A symmetric (only lower triangular part is referred)
129:     s vector +1 and -1 (signature matrix)
130:   Output:
131:     d,e
132:     s
133:     Q s-orthogonal matrix with Q^T*A*Q = T (symmetric tridiagonal matrix)
134: */
135: static PetscErrorCode TridiagDiag_HHR(PetscInt n,PetscScalar *A,PetscInt lda,PetscReal *s,PetscScalar* Q,PetscInt ldq,PetscBool flip,PetscReal *d,PetscReal *e,PetscInt *perm_,PetscScalar *work,PetscInt nw,PetscReal *rwork,PetscInt nwr,PetscBLASInt *iwork,PetscInt nwi)
136: {
137: #if defined(PETSC_MISSING_LAPACK_LARFG) || defined(PETSC_MISSING_LAPACK_LARF)
139:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LARFG/LARF - Lapack routines are unavailable");
140: #else
142:   PetscInt       i,j,k,*ii,*jj,i0=0,ik=0,tmp,type;
143:   PetscInt       nwall,nwu=0,nwallr,nwur=0,nwalli,nwui=0;
144:   PetscReal      *ss,cond=1.0,cs,sn,r;
145:   PetscScalar    tau,t,*AA;
146:   PetscBLASInt   n0,n1,ni,inc=1,m,n_,lda_,ldq_,*perm;
147:   PetscBool      breakdown = PETSC_TRUE;

150:   if (n<3) {
151:     if (n==1) Q[0]=1;
152:     if (n==2) {
153:       Q[0] = Q[1+ldq] = 1;
154:       Q[1] = Q[ldq] = 0;
155:     }
156:     return(0);
157:   }
158:   PetscBLASIntCast(lda,&lda_);
159:   PetscBLASIntCast(n,&n_);
160:   PetscBLASIntCast(ldq,&ldq_);
161:   nwall = n*n+n;
162:   if (!work || nw<nwall) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",12);
163:   nwallr = n;
164:   if (!rwork || nwr<nwallr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",14);
165:   ss = rwork;
166:   nwur += n;
167:   nwalli = n;
168:   if (!iwork || nwi<nwalli) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",16);
169:   perm = iwork;
170:   nwui += n;
171:   AA = work;
172:   for (i=0;i<n;i++) {
173:     PetscMemcpy(AA+i*n,A+i*lda,n*sizeof(PetscScalar));
174:   }
175:   nwu += n*n;
176:   k=0;
177:   while (breakdown && k<n) {
178:     breakdown = PETSC_FALSE;
179:     /* Classify (and flip) A and s according to sign */
180:     if (flip) {
181:       for (i=0;i<n;i++) {
182:         perm[i] = n-1-perm_[i];
183:         if (perm[i]==0) i0 = i;
184:         if (perm[i]==k) ik = i;
185:       }
186:     } else {
187:       for (i=0;i<n;i++) {
188:         perm[i] = perm_[i];
189:         if (perm[i]==0) i0 = i;
190:         if (perm[i]==k) ik = i;
191:       }
192:     }
193:     perm[ik] = 0;
194:     perm[i0] = k;
195:     i=1;
196:     while (i<n-1 && s[perm[i-1]]==s[perm[0]]) {
197:       if (s[perm[i]]!=s[perm[0]]) {
198:         j=i+1;
199:         while (j<n-1 && s[perm[j]]!=s[perm[0]])j++;
200:         tmp = perm[i]; perm[i] = perm[j]; perm[j] = tmp;
201:       }
202:       i++;
203:     }
204:     for (i=0;i<n;i++) {
205:       ss[i] = s[perm[i]];
206:     }
207:     if (flip) {
208:       ii = &j;
209:       jj = &i;
210:     } else {
211:       ii = &i;
212:       jj = &j;
213:     }
214:     for (i=0;i<n;i++)
215:       for (j=0;j<n;j++)
216:         A[i+j*lda] = AA[perm[*ii]+perm[*jj]*n];
217:     /* Initialize Q */
218:     for (i=0;i<n;i++) {
219:       PetscMemzero(Q+i*ldq,n*sizeof(PetscScalar));
220:       Q[perm[i]+i*ldq] = 1.0;
221:     }
222:     for (ni=1;ni<n && ss[ni]==ss[0]; ni++);
223:     n0 = ni-1;
224:     n1 = n_-ni;
225:     for (j=0;j<n-2;j++) {
226:       PetscBLASIntCast(n-j-1,&m);
227:       /* Forming and applying reflectors */
228:       if (n0 > 1) {
229:         PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n0,A+ni-n0+j*lda,A+ni-n0+j*lda+1,&inc,&tau));
230:         /* Apply reflector */
231:         if (PetscAbsScalar(tau) != 0.0) {
232:           t=*(A+ni-n0+j*lda);  *(A+ni-n0+j*lda)=1.0;
233:           PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&m,&n0,A+ni-n0+j*lda,&inc,&tau,A+j+1+(j+1)*lda,&lda_,work+nwu));
234:           PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0,&m,A+ni-n0+j*lda,&inc,&tau,A+j+1+(j+1)*lda,&lda_,work+nwu));
235:           /* Update Q */
236:           PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n0,A+ni-n0+j*lda,&inc,&tau,Q+(j+1)*ldq,&ldq_,work+nwu));
237:           *(A+ni-n0+j*lda) = t;
238:           for (i=1;i<n0;i++) {
239:             *(A+ni-n0+j*lda+i) = 0.0;  *(A+j+(ni-n0+i)*lda) = 0.0;
240:           }
241:           *(A+j+(ni-n0)*lda) = *(A+ni-n0+j*lda);
242:         }
243:       }
244:       if (n1 > 1) {
245:         PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n1,A+n-n1+j*lda,A+n-n1+j*lda+1,&inc,&tau));
246:         /* Apply reflector */
247:         if (PetscAbsScalar(tau) != 0.0) {
248:           t=*(A+n-n1+j*lda);  *(A+n-n1+j*lda)=1.0;
249:           PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&m,&n1,A+n-n1+j*lda,&inc,&tau,A+j+1+(n-n1)*lda,&lda_,work+nwu));
250:           PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1,&m,A+n-n1+j*lda,&inc,&tau,A+n-n1+(j+1)*lda,&lda_,work+nwu));
251:           /* Update Q */
252:           PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n1,A+n-n1+j*lda,&inc,&tau,Q+(n-n1)*ldq,&ldq_,work+nwu));
253:           *(A+n-n1+j*lda) = t;
254:           for (i=1;i<n1;i++) {
255:             *(A+n-n1+i+j*lda) = 0.0;  *(A+j+(n-n1+i)*lda) = 0.0;
256:           }
257:           *(A+j+(n-n1)*lda) = *(A+n-n1+j*lda);
258:         }
259:       }
260:       /* Hyperbolic rotation */
261:       if (n0 > 0 && n1 > 0) {
262:         HRGen(PetscRealPart(A[ni-n0+j*lda]),PetscRealPart(A[n-n1+j*lda]),&type,&cs,&sn,&r,&cond);
263:         /* Check condition number */
264:         if (cond > 1.0/(10*PETSC_SQRT_MACHINE_EPSILON)) {
265:           breakdown = PETSC_TRUE;
266:           k++;
267:           if (k==n || flip)
268:             SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Breakdown in construction of hyperbolic transformation");
269:           break;
270:         }
271:         A[ni-n0+j*lda] = r; A[n-n1+j*lda] = 0.0;
272:         A[j+(ni-n0)*lda] = r; A[j+(n-n1)*lda] = 0.0;
273:         /* Apply to A */
274:         HRApply(m,A+j+1+(ni-n0)*lda,1,A+j+1+(n-n1)*lda,1,cs,-sn);
275:         HRApply(m,A+ni-n0+(j+1)*lda,lda,A+n-n1+(j+1)*lda,lda,cs,-sn);

277:         /* Update Q */
278:         HRApply(n,Q+(ni-n0)*ldq,1,Q+(n-n1)*ldq,1,cs,-sn);
279:         if (type==2) {
280:           ss[ni-n0] = -ss[ni-n0]; ss[n-n1] = -ss[n-n1];
281:           n0++;ni++;n1--;
282:         }
283:       }
284:       if (n0>0) n0--;
285:       else n1--;
286:     }
287:   }

289: /* flip matrices */
290:   if (flip) {
291:     for (i=0;i<n-1;i++) {
292:       d[i] = PetscRealPart(A[n-i-1+(n-i-1)*lda]);
293:       e[i] = PetscRealPart(A[n-i-1+(n-i-2)*lda]);
294:       s[i] = ss[n-i-1];
295:     }
296:     s[n-1] = ss[0];
297:     d[n-1] = PetscRealPart(A[0]);
298:     for (i=0;i<n;i++) {
299:       ierr=PetscMemcpy(work+i*n,Q+i*ldq,n*sizeof(PetscScalar));
300:     }
301:     for (i=0;i<n;i++)
302:       for (j=0;j<n;j++)
303:         Q[i+j*ldq] = work[i+(n-j-1)*n];
304:   } else {
305:     for (i=0;i<n-1;i++) {
306:       d[i] = PetscRealPart(A[i+i*lda]);
307:       e[i] = PetscRealPart(A[i+1+i*lda]);
308:       s[i] = ss[i];
309:     }
310:     s[n-1] = ss[n-1];
311:     d[n-1] = PetscRealPart(A[n-1 + (n-1)*lda]);
312:   }
313:   return(0);
314: #endif
315: }

319: static PetscErrorCode MadeHRtr(PetscInt sz,PetscInt n,PetscInt idx0,PetscInt n0,PetscInt idx1,PetscInt n1,struct HRtr *tr1,struct HRtr *tr2,PetscReal *ncond,PetscScalar *work,PetscInt lw)
320: {
322:   PetscScalar    *x,*y;
323:   PetscReal       ncond2;
324:   PetscBLASInt   n0_,n1_,inc=1;

327:   if (lw<n) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",11);
328:   /* Hyperbolic transformation to make zeros in x */
329:   x = tr1->data;
330:   tr1->n[0] = n0;
331:   tr1->n[1] = n1;
332:   tr1->idx[0] = idx0;
333:   tr1->idx[1] = idx1;
334:   PetscBLASIntCast(tr1->n[0],&n0_);
335:   PetscBLASIntCast(tr1->n[1],&n1_);
336:   if (tr1->n[0] > 1) {
337:     PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n0_,x+tr1->idx[0],x+tr1->idx[0]+1,&inc,tr1->tau));
338:   }
339:   if (tr1->n[1]> 1) {
340:     PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n1_,x+tr1->idx[1],x+tr1->idx[1]+1,&inc,tr1->tau+1));
341:   }
342:   if (tr1->idx[0]<tr1->idx[1]) {
343:     HRGen(PetscRealPart(x[tr1->idx[0]]),PetscRealPart(x[tr1->idx[1]]),&(tr1->type),&(tr1->cs),&(tr1->sn),&(tr1->alpha),ncond);
344:   } else {
345:     tr1->alpha = PetscRealPart(x[tr1->idx[0]]);
346:     *ncond = 1.0;
347:   }
348:   if (sz==2) {
349:     y = tr2->data;
350:     /* Apply first transformation to second column */
351:     if (tr1->n[0] > 1 && PetscAbsScalar(tr1->tau[0])!=0.0) {
352:       x[tr1->idx[0]] = 1.0;
353:       PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0_,&inc,x+tr1->idx[0],&inc,tr1->tau,y+tr1->idx[0],&n0_,work));
354:     }
355:     if (tr1->n[1] > 1 && PetscAbsScalar(tr1->tau[1])!=0.0) {
356:       x[tr1->idx[1]] = 1.0;
357:       PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1_,&inc,x+tr1->idx[1],&inc,tr1->tau+1,y+tr1->idx[1],&n1_,work));
358:     }
359:     if (tr1->idx[0]<tr1->idx[1]) {
360:       HRApply(1,y+tr1->idx[0],1,y+tr1->idx[1],1,tr1->cs,-tr1->sn);
361:     }
362:     tr2->n[0] = tr1->n[0];
363:     tr2->n[1] = tr1->n[1];
364:     tr2->idx[0] = tr1->idx[0];
365:     tr2->idx[1] = tr1->idx[1];
366:     if (tr1->idx[0]<tr1->idx[1] && tr1->type==2) {
367:       tr2->idx[1]++; tr2->n[1]--; tr2->n[0]++;
368:     }
369:     if (tr2->n[0]>0) {
370:       tr2->n[0]--; tr2->idx[0]++;
371:       if (tr2->n[1]==0) tr2->idx[1] = tr2->idx[0];
372:     } else {
373:       tr2->n[1]--; tr2->idx[1]++; tr2->idx[0] = tr2->idx[1];
374:     }
375:     /* Hyperbolic transformation to make zeros in y */
376:     PetscBLASIntCast(tr2->n[0],&n0_);
377:     PetscBLASIntCast(tr2->n[1],&n1_);
378:     if (tr2->n[0] > 1) {
379:       PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n0_,y+tr2->idx[0],y+tr2->idx[0]+1,&inc,tr2->tau));
380:     }
381:     if (tr2->n[1]> 1) {
382:       PetscStackCall("LAPACKlarfg",LAPACKlarfg_(&n1_,y+tr2->idx[1],y+tr2->idx[1]+1,&inc,tr2->tau+1));
383:     }
384:     if (tr2->idx[0]<tr2->idx[1]) {
385:       HRGen(PetscRealPart(y[tr2->idx[0]]),PetscRealPart(y[tr2->idx[1]]),&(tr2->type),&(tr2->cs),&(tr2->sn),&(tr2->alpha),&ncond2);
386:     } else {
387:     tr2->alpha = PetscRealPart(y[tr2->idx[0]]);
388:     ncond2 = 1.0;
389:     }
390:     if (ncond2>*ncond) *ncond = ncond2;
391:   }
392:   return(0);
393: }

397: /*
398:   Auxiliary function to try perform one iteration of hr routine,
399:   checking condition number. If it is < tolD, apply the
400:   transformation to H and R, if not, ok=false and it do nothing
401:   tolE, tolerance to exchange complex pairs to improve conditioning
402: */
403: static PetscErrorCode TryHRIt(PetscInt n,PetscInt j,PetscInt sz,PetscScalar *H,PetscInt ldh,PetscScalar *R,PetscInt ldr,PetscReal *s,PetscBool *exg,PetscBool *ok,PetscInt *n0,PetscInt *n1,PetscInt *idx0,PetscInt *idx1,PetscScalar *work,PetscInt nw)
404: {
406:   struct HRtr    *tr1,*tr2,tr1_t,tr2_t,tr1_te,tr2_te;
407:   PetscScalar    *x,*y;
408:   PetscReal      ncond,ncond_e;
409:   PetscInt       nwu=0,nwall,i,d=100;
410:   PetscBLASInt   n0_,n1_,inc=1,mh,mr,n_,ldr_,ldh_;
411:   PetscReal      tolD = 1e+6;

414:   PetscBLASIntCast(n,&n_);
415:   PetscBLASIntCast(ldr,&ldr_);
416:   PetscBLASIntCast(ldh,&ldh_);
417:   nwall = 5*n;
418:   if (!work || nw<nwall) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",16);
419:   x = work+nwu;
420:   nwu += n;
421:   PetscMemcpy(x,R+j*ldr,n*sizeof(PetscScalar));
422:   *exg = PETSC_FALSE;
423:   *ok = PETSC_TRUE;
424:   tr1_t.data = x;
425:   if (sz==1) {
426:     /* Hyperbolic transformation to make zeros in x */
427:     MadeHRtr(sz,n,*idx0,*n0,*idx1,*n1,&tr1_t,NULL,&ncond,work+nwu,nwall-nwu);
428:     /* Check condition number to single column*/
429:     if (ncond>tolD) {
430:       *ok = PETSC_FALSE;
431:     }
432:     tr1 = &tr1_t;
433:     tr2 = &tr2_t;
434:   } else {
435:     y = work+nwu;
436:     nwu += n;
437:     PetscMemcpy(y,R+(j+1)*ldr,n*sizeof(PetscScalar));
438:     tr2_t.data = y;
439:     MadeHRtr(sz,n,*idx0,*n0,*idx1,*n1,&tr1_t,&tr2_t,&ncond,work+nwu,nwall-nwu);
440:     /* Computing hyperbolic transformations also for exchanged vectors */
441:     tr1_te.data = work+nwu;
442:     nwu += n;
443:     PetscMemcpy(tr1_te.data,R+(j+1)*ldr,n*sizeof(PetscScalar));
444:     tr2_te.data = work+nwu;
445:     nwu += n;
446:     PetscMemcpy(tr2_te.data,R+j*ldr,n*sizeof(PetscScalar));
447:     MadeHRtr(sz,n,*idx0,*n0,*idx1,*n1,&tr1_te,&tr2_te,&ncond_e,work+nwu,nwall-nwu);
448:     if (ncond > d*ncond_e) {
449:       *exg = PETSC_TRUE;
450:       tr1 = &tr1_te;
451:       tr2 = &tr2_te;
452:       ncond = ncond_e;
453:     } else {
454:       tr1 = &tr1_t;
455:       tr2 = &tr2_t;
456:     }
457:     if (ncond>tolD) *ok = PETSC_FALSE;
458:   }
459:   if (*ok) {
460:     /* Everything is OK, apply transformations to R and H */
461:     /* First column */
462:     x = tr1->data;
463:     PetscBLASIntCast(tr1->n[0],&n0_);
464:     PetscBLASIntCast(tr1->n[1],&n1_);
465:     PetscBLASIntCast(n-j-sz,&mr);
466:     if (tr1->n[0] > 1 && PetscAbsScalar(tr1->tau[0])!=0.0) {
467:       x[tr1->idx[0]] = 1.0;
468:       PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0_,&mr,x+tr1->idx[0],&inc,tr1->tau,R+(j+sz)*ldr+tr1->idx[0],&ldr_,work+nwu));
469:       PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n0_,x+tr1->idx[0],&inc,tr1->tau,H+(tr1->idx[0])*ldh,&ldh_,work+nwu));
470:     }
471:     if (tr1->n[1] > 1 && PetscAbsScalar(tr1->tau[1])!=0.0) {
472:       x[tr1->idx[1]] = 1.0;
473:       PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1_,&mr,x+tr1->idx[1],&inc,tr1->tau+1,R+(j+sz)*ldr+tr1->idx[1],&ldr_,work+nwu));
474:       PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n1_,x+tr1->idx[1],&inc,tr1->tau+1,H+(tr1->idx[1])*ldh,&ldh_,work+nwu));
475:     }
476:     if (tr1->idx[0]<tr1->idx[1]) {
477:       HRApply(mr,R+(j+sz)*ldr+tr1->idx[0],ldr,R+(j+sz)*ldr+tr1->idx[1],ldr,tr1->cs,-tr1->sn);
478:       if (tr1->type==1) {
479:         HRApply(n,H+(tr1->idx[0])*ldh,1,H+(tr1->idx[1])*ldh,1,tr1->cs,tr1->sn);
480:       } else {
481:         HRApply(n,H+(tr1->idx[0])*ldh,1,H+(tr1->idx[1])*ldh,1,-tr1->cs,-tr1->sn);
482:         s[tr1->idx[0]] = -s[tr1->idx[0]];
483:         s[tr1->idx[1]] = -s[tr1->idx[1]];
484:       }
485:     }
486:     for (i=tr1->idx[0]+1;i<n;i++) *(R+j*ldr+i) = 0.0;
487:     *(R+j*ldr+tr1->idx[0]) = tr1->alpha;
488:     if (sz==2) {
489:       y = tr2->data;
490:       /* Second column */
491:       PetscBLASIntCast(tr2->n[0],&n0_);
492:       PetscBLASIntCast(tr2->n[1],&n1_);
493:       PetscBLASIntCast(n-j-sz,&mr);
494:       PetscBLASIntCast(n-tr2->idx[0],&mh);
495:       if (tr2->n[0] > 1 && PetscAbsScalar(tr2->tau[0])!=0.0) {
496:         y[tr2->idx[0]] = 1.0;
497:         PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n0_,&mr,y+tr2->idx[0],&inc,tr2->tau,R+(j+2)*ldr+tr2->idx[0],&ldr_,work+nwu));
498:         PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n0_,y+tr2->idx[0],&inc,tr2->tau,H+(tr2->idx[0])*ldh,&ldh_,work+nwu));
499:       }
500:       if (tr2->n[1] > 1 && PetscAbsScalar(tr2->tau[1])!=0.0) {
501:         y[tr2->idx[1]] = 1.0;
502:         PetscStackCall("LAPACKlarf",LAPACKlarf_("L",&n1_,&mr,y+tr2->idx[1],&inc,tr2->tau+1,R+(j+2)*ldr+tr2->idx[1],&ldr_,work+nwu));
503:         PetscStackCall("LAPACKlarf",LAPACKlarf_("R",&n_,&n1_,y+tr2->idx[1],&inc,tr2->tau+1,H+(tr2->idx[1])*ldh,&ldh_,work+nwu));
504:       }
505:       if (tr2->idx[0]<tr2->idx[1]) {
506:         HRApply(mr,R+(j+2)*ldr+tr2->idx[0],ldr,R+(j+2)*ldr+tr2->idx[1],ldr,tr2->cs,-tr2->sn);
507:         if (tr2->type==1) {
508:           HRApply(n,H+(tr2->idx[0])*ldh,1,H+(tr2->idx[1])*ldh,1,tr2->cs,tr2->sn);
509:         } else {
510:           HRApply(n,H+(tr2->idx[0])*ldh,1,H+(tr2->idx[1])*ldh,1,-tr2->cs,-tr2->sn);
511:           s[tr2->idx[0]] = -s[tr2->idx[0]];
512:           s[tr2->idx[1]] = -s[tr2->idx[1]];
513:         }
514:       }
515:       *(R+(j+1)*ldr+tr2->idx[0]-1) = y[tr2->idx[0]-1];
516:       for (i=tr2->idx[0]+1;i<n;i++) *(R+(j+1)*ldr+i) = 0.0;
517:       *(R+(j+1)*ldr+tr2->idx[0]) = tr2->alpha;
518:       *n0 = tr2->n[0];
519:       *n1 = tr2->n[1];
520:       *idx0 = tr2->idx[0];
521:       *idx1 = tr2->idx[1];
522:       if (tr2->idx[0]<tr2->idx[1] && tr2->type==2) {
523:         (*idx1)++; (*n1)--; (*n0)++;
524:       }
525:     } else {
526:       *n0 = tr1->n[0];
527:       *n1 = tr1->n[1];
528:       *idx0 = tr1->idx[0];
529:       *idx1 = tr1->idx[1];
530:       if (tr1->idx[0]<tr1->idx[1] && tr1->type==2) {
531:         (*idx1)++; (*n1)--; (*n0)++;
532:       }
533:     }
534:     if (*n0>0) {
535:       (*n0)--; (*idx0)++;
536:       if (*n1==0) *idx1 = *idx0;
537:     } else {
538:       (*n1)--; (*idx1)++; *idx0 = *idx1;
539:     }
540:   }
541:   return(0);
542: }

546: /*
547:   compute V = HR whit H s-orthogonal and R upper triangular  
548: */
549: static PetscErrorCode PseudoOrthog_HR(PetscInt *nv,PetscScalar *V,PetscInt ldv,PetscReal *s,PetscScalar *R,PetscInt ldr,PetscBLASInt *perm,PetscBLASInt *cmplxEig,PetscBool *breakdown,PetscScalar *work,PetscInt nw)
550: {
552:   PetscInt       i,j,n,n0,n1,np,idx0,idx1,sz=1,k=0,t1,t2,nwall,nwu=0;
553:   PetscScalar    *col1,*col2;
554:   PetscBool      exg=PETSC_FALSE,ok=PETSC_FALSE;

557:   n = *nv;
558:   nwall = 7*n;
559:   if (!work || nw<nwall) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid argument %d",11);
560:   col1 = work+nwu;
561:   nwu += n;
562:   col2 = work+nwu;
563:   nwu += n;
564:   /* Sort R and s according to sing(s) */
565:   np = 0;
566:   for (i=0;i<n;i++) if (s[i]>0) np++;
567:   if (s[0]>0) n1 = np;
568:   else n1 = n-np;
569:   n0 = 0;
570:   for (i=0;i<n;i++) {
571:     if (s[i]==s[0]) {
572:       s[n0] = s[0];
573:       perm[n0++] = i;
574:     } else {
575:       perm[n1++] = i;
576:     }
577:   }
578:   for (i=n0;i<n;i++) s[i] = -s[0];
579:   n1 -= n0;
580:   idx0 = 0;
581:   idx1 = n0;
582:   if (idx1==n) idx1=idx0;
583:   for (i=0;i<n;i++) {
584:     for (j=0;j<n;j++) R[j*ldr+i] = V[j*ldv+perm[i]];
585:   }
586:   /* Initialize H */
587:   for (i=0;i<n;i++) {
588:     PetscMemzero(V+i*ldv,n*sizeof(PetscScalar));
589:     V[perm[i]+i*ldv] = 1.0;
590:   }
591:   for (i=0;i<n;i++) perm[i] = i;
592:   j = 0;
593:   while (j<n-k) {
594:     if (cmplxEig) {
595:       if (cmplxEig[j]==0) sz=1;
596:       else sz=2;
597:     }
598:     TryHRIt(n,j,sz,V,ldv,R,ldr,s,&exg,&ok,&n0,&n1,&idx0,&idx1,work+nwu,nw-nwu);
599:     if (ok) {
600:       if (exg) {
601:         cmplxEig[j] = -cmplxEig[j];
602:       }
603:       j = j+sz;
604:     } else { /* to be discarded */
605:       k = k+1;
606:       if (cmplxEig[j]==0) {
607:         if (j<n) {
608:           t1 = perm[j];
609:           for (i=j;i<n-1;i++) perm[i] = perm[i+1];
610:           perm[n-1] = t1;
611:           t1 = cmplxEig[j];
612:           for (i=j;i<n-1;i++) cmplxEig[i] = cmplxEig[i+1];
613:           cmplxEig[n-1] = t1;
614:           PetscMemcpy(col1,R+j*ldr,n*sizeof(PetscScalar));
615:           for (i=j;i<n-1;i++) {
616:             PetscMemcpy(R+i*ldr,R+(i+1)*ldr,n*sizeof(PetscScalar));
617:           }
618:           PetscMemcpy(R+(n-1)*ldr,col1,n*sizeof(PetscScalar));
619:         }
620:       } else {
621:         k = k+1;
622:         if (j<n-1) {
623:           t1 = perm[j];
624:           t2 = perm[j+1];
625:           for (i=j;i<n-2;i++) perm[i] = perm[i+2];
626:           perm[n-2] = t1;
627:           perm[n-1] = t2;
628:           t1 = cmplxEig[j];
629:           t2 = cmplxEig[j+1];
630:           for (i=j;i<n-2;i++) cmplxEig[i] = cmplxEig[i+2];
631:           cmplxEig[n-2] = t1;
632:           cmplxEig[n-1] = t2;
633:           PetscMemcpy(col1,R+j*ldr,n*sizeof(PetscScalar));
634:           PetscMemcpy(col2,R+(j+1)*ldr,n*sizeof(PetscScalar));
635:           for (i=j;i<n-2;i++) {
636:             PetscMemcpy(R+i*ldr,R+(i+2)*ldr,n*sizeof(PetscScalar));
637:           }
638:           PetscMemcpy(R+(n-2)*ldr,col1,n*sizeof(PetscScalar));
639:           PetscMemcpy(R+(n-1)*ldr,col2,n*sizeof(PetscScalar));
640:         }
641:       }
642:     }
643:   }
644:   if (k!=0) {
645:     if (breakdown) *breakdown = PETSC_TRUE;
646:     *nv = n-k;
647:   }
648:   return(0);
649: }

653: PetscErrorCode DSGHIEPOrthogEigenv(DS ds,DSMatType mat,PetscScalar *wr,PetscScalar *wi,PetscBool accum)
654: {
656:   PetscInt       lws,nwus=0,nwui=0,lwi;
657:   PetscInt       off,n,nv,ld,i,ldr,l;
658:   PetscScalar    *W,*X,*R,*ts,zeroS=0.0,oneS=1.0;
659:   PetscReal      *s,vi,vr,tr,*d,*e;
660:   PetscBLASInt   ld_,n_,nv_,*perm,*cmplxEig;

663:   l = ds->l;
664:   n = ds->n-l;
665:   PetscBLASIntCast(n,&n_);
666:   ld = ds->ld;
667:   PetscBLASIntCast(ld,&ld_);
668:   off = l*ld+l;
669:   s = ds->rmat[DS_MAT_D];
670:   if (!ds->compact) {
671:     for (i=l;i<ds->n;i++) s[i] = PetscRealPart(*(ds->mat[DS_MAT_B]+i*ld+i));
672:   }
673:   lws = n*n+7*n;
674:   lwi = 2*n;
675:   DSAllocateWork_Private(ds,lws,0,lwi);
676:   R = ds->work+nwus;
677:   nwus += n*n;
678:   ldr = n;
679:   perm = ds->iwork + nwui;
680:   nwui += n;
681:   cmplxEig = ds->iwork+nwui;
682:   nwui += n;
683:   X = ds->mat[mat];
684:   for (i=0;i<n;i++) {
685: #if defined(PETSC_USE_COMPLEX)
686:   vi = PetscImaginaryPart(wr[l+i]);
687: #else
688:   vi = PetscRealPart(wi[l+i]);
689: #endif
690:     if (vi!=0) {
691:       cmplxEig[i] = 1;
692:       cmplxEig[i+1] = 2;
693:       i++;
694:     } else cmplxEig[i] = 0;
695:   }
696:   nv = n;
697: 
698:   /* Perform HR decomposition */
699:     /* Hyperbolic rotators */
700:     PseudoOrthog_HR(&nv,X+off,ld,s+l,R,ldr,perm,cmplxEig,NULL,ds->work+nwus,lws-nwus);
701:   /* Sort wr,wi perm */
702:   ts = ds->work+nwus;
703:   nwus += n;
704:   PetscMemcpy(ts,wr+l,n*sizeof(PetscScalar));
705:   for (i=0;i<n;i++) {
706:     wr[i+l] = ts[perm[i]];
707:   }
708: #if !defined(PETSC_USE_COMPLEX)
709:   PetscMemcpy(ts,wi+l,n*sizeof(PetscScalar));
710:   for (i=0;i<n;i++) {
711:     wi[i+l] = ts[perm[i]];
712:   }
713: #endif
714:   /* Projected Matrix */
715:   d = ds->rmat[DS_MAT_T];
716:   e = d+ld;
717:   for (i=0;i<nv;i++) {
718:     if (cmplxEig[i]==0) { /* Real */
719:       d[l+i] = PetscRealPart(wr[l+i]*s[l+i]);
720:       e[l+i] = 0.0;
721:     } else {
722:       vr = PetscRealPart(wr[l+i]);
723: #if defined(PETSC_USE_COMPLEX)
724:       vi = PetscImaginaryPart(wr[l+i]);
725: #else
726:       vi = PetscRealPart(wi[l+i]);
727: #endif
728:       if (cmplxEig[i]==-1) vi = -vi;
729:       tr = PetscRealPart((R[i+(i+1)*ldr]/R[i+i*ldr]))*vi;
730:       d[l+i] = (vr-tr)*s[l+i];
731:       d[l+i+1] = (vr+tr)*s[l+i+1];
732:       e[l+i] = PetscRealPart(s[l+i]*(R[(i+1)+(i+1)*ldr]/R[i+i*ldr])*vi);
733:       e[l+i+1] = 0.0;
734:       i++;
735:     }
736:   }
737:   /* accumulate previous Q */
738:   if (accum && mat!=DS_MAT_Q) {
739:     PetscBLASIntCast(nv,&nv_);
740:     DSAllocateMat_Private(ds,DS_MAT_W);
741:     W = ds->mat[DS_MAT_W];
742:     DSCopyMatrix_Private(ds,DS_MAT_W,DS_MAT_Q);
743:     PetscStackCall("BLASgemm",BLASgemm_("N","N",&n_,&nv_,&n_,&oneS,W+off,&ld_,X+off,&ld_,&zeroS,ds->mat[DS_MAT_Q]+off,&ld_));
744:   }
745:   ds->t = nv+l;
746:   if (!ds->compact) { DSSwitchFormat_GHIEP(ds,PETSC_FALSE); }
747:   return(0);
748: }

752: /*
753:    Reduce to tridiagonal-diagonal pair by means of TridiagDiag_HHR.
754: */
755: PetscErrorCode DSIntermediate_GHIEP(DS ds)
756: {
758:   PetscInt       i,ld,off;
759:   PetscInt       nwall,nwallr,nwalli,nwu=0,nwur=0,nwui=0;
760:   PetscScalar    *A,*B,*Q;
761:   PetscReal      *d,*e,*s;

764:   ld = ds->ld;
765:   A = ds->mat[DS_MAT_A];
766:   B = ds->mat[DS_MAT_B];
767:   Q = ds->mat[DS_MAT_Q];
768:   d = ds->rmat[DS_MAT_T];
769:   e = ds->rmat[DS_MAT_T]+ld;
770:   s = ds->rmat[DS_MAT_D];
771:   off = ds->l+ds->l*ld;
772:   PetscMemzero(Q,ld*ld*sizeof(PetscScalar));
773:   nwall = ld*ld+ld;
774:   nwallr = ld;
775:   nwalli = ld;
776:   DSAllocateWork_Private(ds,nwall,nwallr,nwalli);
777:   for (i=0;i<ds->n;i++) Q[i+i*ld]=1.0;
778:   for (i=0;i<ds->n-ds->l;i++) *(ds->perm+i)=i;
779:   if (ds->compact) {
780:     if (ds->state < DS_STATE_INTERMEDIATE) {
781:       DSSwitchFormat_GHIEP(ds,PETSC_FALSE);
782:       TridiagDiag_HHR(ds->k-ds->l+1,A+off,ld,s+ds->l,Q+off,ld,PETSC_TRUE,d+ds->l,e+ds->l,ds->perm,ds->work+nwu,nwall-nwu,ds->rwork+nwur,nwallr-nwur,ds->iwork+nwui,nwalli-nwui);
783:       ds->k = ds->l;
784:       PetscMemzero(d+2*ld+ds->l,(ds->n-ds->l)*sizeof(PetscReal));
785:     }
786:   } else {
787:     if (ds->state < DS_STATE_INTERMEDIATE) {
788:       for (i=0;i<ds->n;i++)
789:         s[i] = PetscRealPart(B[i+i*ld]);
790:       TridiagDiag_HHR(ds->n-ds->l,A+off,ld,s+ds->l,Q+off,ld,PETSC_FALSE,d+ds->l,e+ds->l,ds->perm,ds->work+nwu,nwall-nwu,ds->rwork+nwur,nwallr-nwur,ds->iwork+nwui,nwalli-nwui);
791:       PetscMemzero(d+2*ld,(ds->n)*sizeof(PetscReal));
792:       ds->k = ds->l;
793:       DSSwitchFormat_GHIEP(ds,PETSC_FALSE);
794:     } else { DSSwitchFormat_GHIEP(ds,PETSC_TRUE); }
795:   }
796:   return(0);
797: }

slepc-3.4.2.dfsg.orig/src/ds/impls/hep/0000755000175000017500000000000012214143515016530 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/impls/hep/dshep.c.html0000644000175000017500000016262412211062077020755 0ustar gladkgladk
Actual source code: dshep.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 23: #include <slepcblaslapack.h>

 27: PetscErrorCode DSAllocate_HEP(DS ds,PetscInt ld)
 28: {

 32:   DSAllocateMat_Private(ds,DS_MAT_A);
 33:   DSAllocateMat_Private(ds,DS_MAT_Q);
 34:   DSAllocateMatReal_Private(ds,DS_MAT_T);
 35:   PetscFree(ds->perm);
 36:   PetscMalloc(ld*sizeof(PetscInt),&ds->perm);
 37:   PetscLogObjectMemory(ds,ld*sizeof(PetscInt));
 38:   return(0);
 39: }

 41: /*   0       l           k                 n-1
 42:     -----------------------------------------
 43:     |*       ·           ·                  |
 44:     |  *     ·           ·                  |
 45:     |    *   ·           ·                  |
 46:     |      * ·           ·                  |
 47:     |· · · · o           o                  |
 48:     |          o         o                  |
 49:     |            o       o                  |
 50:     |              o     o                  |
 51:     |                o   o                  |
 52:     |                  o o                  |
 53:     |· · · · o o o o o o o x                |
 54:     |                    x x x              |
 55:     |                      x x x            |
 56:     |                        x x x          |
 57:     |                          x x x        |
 58:     |                            x x x      |
 59:     |                              x x x    |
 60:     |                                x x x  |
 61:     |                                  x x x|
 62:     |                                    x x|
 63:     -----------------------------------------
 64: */

 68: static PetscErrorCode DSSwitchFormat_HEP(DS ds,PetscBool tocompact)
 69: {
 71:   PetscReal      *T = ds->rmat[DS_MAT_T];
 72:   PetscScalar    *A = ds->mat[DS_MAT_A];
 73:   PetscInt       i,n=ds->n,k=ds->k,ld=ds->ld;

 76:   if (tocompact) { /* switch from dense (arrow) to compact storage */
 77:     PetscMemzero(T,3*ld*sizeof(PetscReal));
 78:     for (i=0;i<k;i++) {
 79:       T[i] = PetscRealPart(A[i+i*ld]);
 80:       T[i+ld] = PetscRealPart(A[k+i*ld]);
 81:     }
 82:     for (i=k;i<n-1;i++) {
 83:       T[i] = PetscRealPart(A[i+i*ld]);
 84:       T[i+ld] = PetscRealPart(A[i+1+i*ld]);
 85:     }
 86:     T[n-1] = PetscRealPart(A[n-1+(n-1)*ld]);
 87:     if (ds->extrarow) T[n-1+ld] = PetscRealPart(A[n+(n-1)*ld]);
 88:   } else { /* switch from compact (arrow) to dense storage */
 89:     PetscMemzero(A,ld*ld*sizeof(PetscScalar));
 90:     for (i=0;i<k;i++) {
 91:       A[i+i*ld] = T[i];
 92:       A[k+i*ld] = T[i+ld];
 93:       A[i+k*ld] = T[i+ld];
 94:     }
 95:     A[k+k*ld] = T[k];
 96:     for (i=k+1;i<n;i++) {
 97:       A[i+i*ld] = T[i];
 98:       A[i-1+i*ld] = T[i-1+ld];
 99:       A[i+(i-1)*ld] = T[i-1+ld];
100:     }
101:     if (ds->extrarow) A[n+(n-1)*ld] = T[n-1+ld];
102:   }
103:   return(0);
104: }

108: PetscErrorCode DSView_HEP(DS ds,PetscViewer viewer)
109: {
110:   PetscErrorCode    ierr;
111:   PetscViewerFormat format;
112:   PetscInt          i,j,r,c,rows;
113:   PetscReal         value;
114:   const char        *methodname[] = {
115:                      "Implicit QR method (_steqr)",
116:                      "Relatively Robust Representations (_stevr)",
117:                      "Divide and Conquer method (_stedc)"
118:   };
119:   const int         nmeth=sizeof(methodname)/sizeof(methodname[0]);

122:   PetscViewerGetFormat(viewer,&format);
123:   if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
124:     if (ds->method>=nmeth) {
125:       PetscViewerASCIIPrintf(viewer,"solving the problem with: INVALID METHOD\n");
126:     } else {
127:       PetscViewerASCIIPrintf(viewer,"solving the problem with: %s\n",methodname[ds->method]);
128:     }
129:     return(0);
130:   }
131:   if (ds->compact) {
132:     PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);
133:     rows = ds->extrarow? ds->n+1: ds->n;
134:     if (format == PETSC_VIEWER_ASCII_MATLAB) {
135:       PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",rows,ds->n);
136:       PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",3*ds->n);
137:       PetscViewerASCIIPrintf(viewer,"zzz = [\n");
138:       for (i=0;i<ds->n;i++) {
139:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_T]+i));
140:       }
141:       for (i=0;i<rows-1;i++) {
142:         r = PetscMax(i+2,ds->k+1);
143:         c = i+1;
144:         PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",r,c,*(ds->rmat[DS_MAT_T]+ds->ld+i));
145:         if (i<ds->n-1 && ds->k<ds->n) { /* do not print vertical arrow when k=n */
146:           PetscViewerASCIIPrintf(viewer,"%D %D  %18.16e\n",c,r,*(ds->rmat[DS_MAT_T]+ds->ld+i));
147:         }
148:       }
149:       PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(zzz);\n",DSMatName[DS_MAT_T]);
150:     } else {
151:       for (i=0;i<rows;i++) {
152:         for (j=0;j<ds->n;j++) {
153:           if (i==j) value = *(ds->rmat[DS_MAT_T]+i);
154:           else if ((i<ds->k && j==ds->k) || (i==ds->k && j<ds->k)) value = *(ds->rmat[DS_MAT_T]+ds->ld+PetscMin(i,j));
155:           else if (i==j+1 && i>ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+i-1);
156:           else if (i+1==j && j>ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+j-1);
157:           else value = 0.0;
158:           PetscViewerASCIIPrintf(viewer," %18.16e ",value);
159:         }
160:         PetscViewerASCIIPrintf(viewer,"\n");
161:       }
162:     }
163:     PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);
164:     PetscViewerFlush(viewer);
165:   } else {
166:     DSViewMat_Private(ds,viewer,DS_MAT_A);
167:   }
168:   if (ds->state>DS_STATE_INTERMEDIATE) {
169:     DSViewMat_Private(ds,viewer,DS_MAT_Q);
170:   }
171:   return(0);
172: }

176: PetscErrorCode DSVectors_HEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
177: {
178:   PetscScalar    *Q = ds->mat[DS_MAT_Q];
179:   PetscInt       ld = ds->ld,i;

183:   switch (mat) {
184:     case DS_MAT_X:
185:     case DS_MAT_Y:
186:       if (j) {
187:         if (ds->state>=DS_STATE_CONDENSED) {
188:           PetscMemcpy(ds->mat[mat]+(*j)*ld,Q+(*j)*ld,ld*sizeof(PetscScalar));
189:         } else {
190:           PetscMemzero(ds->mat[mat]+(*j)*ld,ld*sizeof(PetscScalar));
191:           *(ds->mat[mat]+(*j)+(*j)*ld) = 1.0;
192:         }
193:       } else {
194:         if (ds->state>=DS_STATE_CONDENSED) {
195:           PetscMemcpy(ds->mat[mat],Q,ld*ld*sizeof(PetscScalar));
196:         } else {
197:           PetscMemzero(ds->mat[mat],ld*ld*sizeof(PetscScalar));
198:           for (i=0;i<ds->n;i++) *(ds->mat[mat]+i+i*ld) = 1.0;
199:         }
200:       }
201:       if (rnorm) *rnorm = PetscAbsScalar(Q[ds->n-1+(*j)*ld]);
202:       break;
203:     case DS_MAT_U:
204:     case DS_MAT_VT:
205:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
206:       break;
207:     default:
208:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
209:   }
210:   return(0);
211: }

215: PetscErrorCode DSNormalize_HEP(DS ds,DSMatType mat,PetscInt col)
216: {
218:   switch (mat) {
219:     case DS_MAT_X:
220:     case DS_MAT_Y:
221:     case DS_MAT_Q:
222:       /* All the matrices resulting from DSVectors and DSSolve are already normalized */
223:       break;
224:     case DS_MAT_U:
225:     case DS_MAT_VT:
226:       SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet");
227:       break;
228:     default:
229:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter");
230:   }
231:   return(0);
232: }

236: /*
237:   ARROWTRIDIAG reduces a symmetric arrowhead matrix of the form

239:                 [ d 0 0 0 e ]
240:                 [ 0 d 0 0 e ]
241:             A = [ 0 0 d 0 e ]
242:                 [ 0 0 0 d e ]
243:                 [ e e e e d ]

245:   to tridiagonal form

247:                 [ d e 0 0 0 ]
248:                 [ e d e 0 0 ]
249:    T = Q'*A*Q = [ 0 e d e 0 ],
250:                 [ 0 0 e d e ]
251:                 [ 0 0 0 e d ]

253:   where Q is an orthogonal matrix. Rutishauser's algorithm is used to
254:   perform the reduction, which requires O(n**2) flops. The accumulation
255:   of the orthogonal factor Q, however, requires O(n**3) flops.

257:   Arguments
258:   =========

260:   N       (input) INTEGER
261:           The order of the matrix A.  N >= 0.

263:   D       (input/output) DOUBLE PRECISION array, dimension (N)
264:           On entry, the diagonal entries of the matrix A to be
265:           reduced.
266:           On exit, the diagonal entries of the reduced matrix T.

268:   E       (input/output) DOUBLE PRECISION array, dimension (N-1)
269:           On entry, the off-diagonal entries of the matrix A to be
270:           reduced.
271:           On exit, the subdiagonal entries of the reduced matrix T.

273:   Q       (input/output) DOUBLE PRECISION array, dimension (LDQ, N)
274:           On exit, the orthogonal matrix Q.

276:   LDQ     (input) INTEGER
277:           The leading dimension of the array Q.

279:   Note
280:   ====
281:   Based on Fortran code contributed by Daniel Kressner
282: */
283: static PetscErrorCode ArrowTridiag(PetscBLASInt n,PetscReal *d,PetscReal *e,PetscScalar *Q,PetscBLASInt ld)
284: {
285: #if defined(SLEPC_MISSING_LAPACK_LARTG)
287:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LARTG - Lapack routine is unavailable");
288: #else
289:   PetscBLASInt i,j,j2,one=1;
290:   PetscReal    c,s,p,off,temp;

293:   if (n<=2) return(0);

295:   for (j=0;j<n-2;j++) {

297:     /* Eliminate entry e(j) by a rotation in the planes (j,j+1) */
298:     temp = e[j+1];
299:     PetscStackCallBLAS("LAPACKlartg",LAPACKlartg_(&temp,&e[j],&c,&s,&e[j+1]));
300:     s = -s;

302:     /* Apply rotation to diagonal elements */
303:     temp   = d[j+1];
304:     e[j]   = c*s*(temp-d[j]);
305:     d[j+1] = s*s*d[j] + c*c*temp;
306:     d[j]   = c*c*d[j] + s*s*temp;

308:     /* Apply rotation to Q */
309:     j2 = j+2;
310:     PetscStackCallBLAS("BLASrot",BLASrot_(&j2,Q+j*ld,&one,Q+(j+1)*ld,&one,&c,&s));

312:     /* Chase newly introduced off-diagonal entry to the top left corner */
313:     for (i=j-1;i>=0;i--) {
314:       off  = -s*e[i];
315:       e[i] = c*e[i];
316:       temp = e[i+1];
317:       PetscStackCallBLAS("LAPACKlartg",LAPACKlartg_(&temp,&off,&c,&s,&e[i+1]));
318:       s = -s;
319:       temp = (d[i]-d[i+1])*s - 2.0*c*e[i];
320:       p = s*temp;
321:       d[i+1] += p;
322:       d[i] -= p;
323:       e[i] = -e[i] - c*temp;
324:       j2 = j+2;
325:       PetscStackCallBLAS("BLASrot",BLASrot_(&j2,Q+i*ld,&one,Q+(i+1)*ld,&one,&c,&s));
326:     }
327:   }
328:   return(0);
329: #endif
330: }

334: /*
335:    Reduce to tridiagonal form by means of ArrowTridiag.
336: */
337: static PetscErrorCode DSIntermediate_HEP(DS ds)
338: {
339: #if defined(SLEPC_MISSING_LAPACK_SYTRD) || defined(SLEPC_MISSING_LAPACK_ORGTR)
341:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SYTRD/ORGTR - Lapack routine is unavailable");
342: #else
344:   PetscInt       i;
345:   PetscBLASInt   n1,n2,n3,lwork,info,l,n,ld,off;
346:   PetscScalar    *A,*Q,*work,*tau;
347:   PetscReal      *d,*e;

350:   PetscBLASIntCast(ds->n,&n);
351:   PetscBLASIntCast(ds->l,&l);
352:   PetscBLASIntCast(ds->ld,&ld);
353:   PetscBLASIntCast(ds->k-l+1,&n1); /* size of leading block, excl. locked */
354:   PetscBLASIntCast(n-ds->k-1,&n2); /* size of trailing block */
355:   n3 = n1+n2;
356:   off = l+l*ld;
357:   A  = ds->mat[DS_MAT_A];
358:   Q  = ds->mat[DS_MAT_Q];
359:   d  = ds->rmat[DS_MAT_T];
360:   e  = ds->rmat[DS_MAT_T]+ld;
361:   PetscMemzero(Q,ld*ld*sizeof(PetscScalar));
362:   for (i=0;i<n;i++) Q[i+i*ld] = 1.0;

364:   if (ds->compact) {

366:     if (ds->state<DS_STATE_INTERMEDIATE) ArrowTridiag(n1,d+l,e+l,Q+off,ld);

368:   } else {

370:     for (i=0;i<l;i++) { d[i] = PetscRealPart(A[i+i*ld]); e[i] = 0.0; }

372:     if (ds->state<DS_STATE_INTERMEDIATE) {
373:       DSCopyMatrix_Private(ds,DS_MAT_Q,DS_MAT_A);
374:       DSAllocateWork_Private(ds,ld+ld*ld,0,0);
375:       tau  = ds->work;
376:       work = ds->work+ld;
377:       lwork = ld*ld;
378:       PetscStackCallBLAS("LAPACKsytrd",LAPACKsytrd_("L",&n3,Q+off,&ld,d+l,e+l,tau,work,&lwork,&info));
379:       if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xSYTRD %d",info);
380:       PetscStackCallBLAS("LAPACKorgtr",LAPACKorgtr_("L",&n3,Q+off,&ld,tau,work,&lwork,&info));
381:       if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xORGTR %d",info);
382:     } else {
383:       /* copy tridiagonal to d,e */
384:       for (i=l;i<n;i++) d[i] = PetscRealPart(A[i+i*ld]);
385:       for (i=l;i<n-1;i++) e[i] = PetscRealPart(A[(i+1)+i*ld]);
386:     }
387:   }
388:   return(0);
389: #endif
390: }

394: PetscErrorCode DSSort_HEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
395: {
397:   PetscInt       n,l,i,*perm,ld=ds->ld;
398:   PetscScalar    *A;
399:   PetscReal      *d;

402:   if (!ds->comparison) return(0);
403:   n = ds->n;
404:   l = ds->l;
405:   A  = ds->mat[DS_MAT_A];
406:   d = ds->rmat[DS_MAT_T];
407:   perm = ds->perm;
408:   if (!rr) {
409:     DSSortEigenvaluesReal_Private(ds,d,perm);
410:   } else {
411:     DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_FALSE);
412:   }
413:   for (i=l;i<n;i++) wr[i] = d[perm[i]];
414:   DSPermuteColumns_Private(ds,l,n,DS_MAT_Q,perm);
415:   for (i=l;i<n;i++) d[i] = PetscRealPart(wr[i]);
416:   if (!ds->compact) {
417:     for (i=l;i<n;i++) A[i+i*ld] = wr[i];
418:   }
419:   return(0);
420: }

424: PetscErrorCode DSUpdateExtraRow_HEP(DS ds)
425: {
427:   PetscInt       i;
428:   PetscBLASInt   n,ld,incx=1;
429:   PetscScalar    *A,*Q,*x,*y,one=1.0,zero=0.0;
430:   PetscReal      *e,beta;

433:   PetscBLASIntCast(ds->n,&n);
434:   PetscBLASIntCast(ds->ld,&ld);
435:   A  = ds->mat[DS_MAT_A];
436:   Q  = ds->mat[DS_MAT_Q];
437:   e  = ds->rmat[DS_MAT_T]+ld;

439:   if (ds->compact) {
440:     beta = e[n-1];
441:     for (i=0;i<n;i++) e[i] = PetscRealPart(beta*Q[n-1+i*ld]);
442:     ds->k = n;
443:   } else {
444:     DSAllocateWork_Private(ds,2*ld,0,0);
445:     x = ds->work;
446:     y = ds->work+ld;
447:     for (i=0;i<n;i++) x[i] = A[n+i*ld];
448:     PetscStackCallBLAS("BLASgemv",BLASgemv_("C",&n,&n,&one,Q,&ld,x,&incx,&zero,y,&incx));
449:     for (i=0;i<n;i++) A[n+i*ld] = y[i];
450:     ds->k = n;
451:   }
452:   return(0);
453: }

457: PetscErrorCode DSSolve_HEP_QR(DS ds,PetscScalar *wr,PetscScalar *wi)
458: {
459: #if defined(PETSC_MISSING_LAPACK_STEQR)
461:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"STEQR - Lapack routine is unavailable");
462: #else
464:   PetscInt       i;
465:   PetscBLASInt   n1,n2,n3,info,l,n,ld,off;
466:   PetscScalar    *Q,*A;
467:   PetscReal      *d,*e;

470:   PetscBLASIntCast(ds->n,&n);
471:   PetscBLASIntCast(ds->l,&l);
472:   PetscBLASIntCast(ds->ld,&ld);
473:   PetscBLASIntCast(ds->k-l+1,&n1); /* size of leading block, excl. locked */
474:   PetscBLASIntCast(n-ds->k-1,&n2); /* size of trailing block */
475:   n3 = n1+n2;
476:   off = l+l*ld;
477:   Q  = ds->mat[DS_MAT_Q];
478:   A  = ds->mat[DS_MAT_A];
479:   d  = ds->rmat[DS_MAT_T];
480:   e  = ds->rmat[DS_MAT_T]+ld;

482:   /* Reduce to tridiagonal form */
483:   DSIntermediate_HEP(ds);

485:   /* Solve the tridiagonal eigenproblem */
486:   for (i=0;i<l;i++) wr[i] = d[i];

488:   DSAllocateWork_Private(ds,0,2*ld,0);
489:   PetscStackCallBLAS("LAPACKsteqr",LAPACKsteqr_("V",&n3,d+l,e+l,Q+off,&ld,ds->rwork,&info));
490:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xSTEQR %d",info);
491:   for (i=l;i<n;i++) wr[i] = d[i];

493:   /* Create diagonal matrix as a result */
494:   if (ds->compact) {
495:     PetscMemzero(e,(n-1)*sizeof(PetscReal));
496:   } else {
497:     for (i=l;i<n;i++) {
498:       PetscMemzero(A+l+i*ld,(n-l)*sizeof(PetscScalar));
499:     }
500:     for (i=l;i<n;i++) A[i+i*ld] = d[i];
501:   }

503:   /* Set zero wi */
504:   if (wi) for (i=l;i<n;i++) wi[i] = 0.0;
505:   return(0);
506: #endif
507: }

511: PetscErrorCode DSSolve_HEP_MRRR(DS ds,PetscScalar *wr,PetscScalar *wi)
512: {
513: #if defined(SLEPC_MISSING_LAPACK_STEVR)
515:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"STEVR - Lapack routine is unavailable");
516: #else
518:   PetscInt       i;
519:   PetscBLASInt   n1,n2,n3,lwork,liwork,info,l,n,m,ld,off,il,iu,*isuppz;
520:   PetscScalar    *A,*Q,*W=NULL,one=1.0,zero=0.0;
521:   PetscReal      *d,*e,abstol=0.0,vl,vu;
522: #if defined(PETSC_USE_COMPLEX)
523:   PetscInt       j;
524:   PetscReal      *ritz;
525: #endif

528:   PetscBLASIntCast(ds->n,&n);
529:   PetscBLASIntCast(ds->l,&l);
530:   PetscBLASIntCast(ds->ld,&ld);
531:   PetscBLASIntCast(ds->k-l+1,&n1); /* size of leading block, excl. locked */
532:   PetscBLASIntCast(n-ds->k-1,&n2); /* size of trailing block */
533:   n3 = n1+n2;
534:   off = l+l*ld;
535:   A  = ds->mat[DS_MAT_A];
536:   Q  = ds->mat[DS_MAT_Q];
537:   d  = ds->rmat[DS_MAT_T];
538:   e  = ds->rmat[DS_MAT_T]+ld;

540:   /* Reduce to tridiagonal form */
541:   DSIntermediate_HEP(ds);

543:   /* Solve the tridiagonal eigenproblem */
544:   for (i=0;i<l;i++) wr[i] = d[i];

546:   if (ds->state<DS_STATE_INTERMEDIATE) {  /* Q contains useful info */
547:     DSAllocateMat_Private(ds,DS_MAT_W);
548:     DSCopyMatrix_Private(ds,DS_MAT_W,DS_MAT_Q);
549:     W = ds->mat[DS_MAT_W];
550:   }
551: #if defined(PETSC_USE_COMPLEX)
552:   DSAllocateMatReal_Private(ds,DS_MAT_Q);
553: #endif
554:   lwork = 20*ld;
555:   liwork = 10*ld;
556:   DSAllocateWork_Private(ds,0,lwork+ld,liwork+2*ld);
557:   isuppz = ds->iwork+liwork;
558: #if defined(PETSC_USE_COMPLEX)
559:   ritz = ds->rwork+lwork;
560:   PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_("V","A",&n3,d+l,e+l,&vl,&vu,&il,&iu,&abstol,&m,ritz+l,ds->rmat[DS_MAT_Q]+off,&ld,isuppz,ds->rwork,&lwork,ds->iwork,&liwork,&info));
561:   for (i=l;i<n;i++) wr[i] = ritz[i];
562: #else
563:   PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_("V","A",&n3,d+l,e+l,&vl,&vu,&il,&iu,&abstol,&m,wr+l,Q+off,&ld,isuppz,ds->rwork,&lwork,ds->iwork,&liwork,&info));
564: #endif
565:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DSTEVR %d",info);
566: #if defined(PETSC_USE_COMPLEX)
567:   for (i=l;i<n;i++)
568:     for (j=l;j<n;j++)
569:       Q[i+j*ld] = (ds->rmat[DS_MAT_Q])[i+j*ld];
570: #endif
571:   if (ds->state<DS_STATE_INTERMEDIATE) {  /* accumulate previous Q */
572:     PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n3,&n3,&n3,&one,W+off,&ld,Q+off,&ld,&zero,A+off,&ld));
573:     DSCopyMatrix_Private(ds,DS_MAT_Q,DS_MAT_A);
574:   }
575:   for (i=l;i<n;i++) d[i] = PetscRealPart(wr[i]);

577:   /* Create diagonal matrix as a result */
578:   if (ds->compact) {
579:     PetscMemzero(e,(n-1)*sizeof(PetscReal));
580:   } else {
581:     for (i=l;i<n;i++) {
582:       PetscMemzero(A+l+i*ld,(n-l)*sizeof(PetscScalar));
583:     }
584:     for (i=l;i<n;i++) A[i+i*ld] = d[i];
585:   }

587:   /* Set zero wi */
588:   if (wi) for (i=l;i<n;i++) wi[i] = 0.0;
589:   return(0);
590: #endif
591: }

595: PetscErrorCode DSSolve_HEP_DC(DS ds,PetscScalar *wr,PetscScalar *wi)
596: {
597: #if defined(SLEPC_MISSING_LAPACK_STEDC) || defined(SLEPC_MISSING_LAPACK_ORMTR)
599:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"STEDC/ORMTR - Lapack routine is unavailable");
600: #else
602:   PetscInt       i;
603:   PetscBLASInt   n1,info,l,ld,off,lrwork,liwork;
604:   PetscScalar    *Q,*A;
605:   PetscReal      *d,*e;
606: #if defined(PETSC_USE_COMPLEX)
607:   PetscBLASInt   lwork;
608:   PetscInt       j;
609: #endif

612:   PetscBLASIntCast(ds->l,&l);
613:   PetscBLASIntCast(ds->ld,&ld);
614:   PetscBLASIntCast(ds->n-ds->l,&n1);
615:   off = l+l*ld;
616:   Q  = ds->mat[DS_MAT_Q];
617:   A  = ds->mat[DS_MAT_A];
618:   d  = ds->rmat[DS_MAT_T];
619:   e  = ds->rmat[DS_MAT_T]+ld;

621:   /* Reduce to tridiagonal form */
622:   DSIntermediate_HEP(ds);

624:   /* Solve the tridiagonal eigenproblem */
625:   for (i=0;i<l;i++) wr[i] = d[i];

627:   lrwork = 5*n1*n1+3*n1+1;
628:   liwork = 5*n1*n1+6*n1+6;
629: #if !defined(PETSC_USE_COMPLEX)
630:   DSAllocateWork_Private(ds,0,lrwork,liwork);
631:   PetscStackCallBLAS("LAPACKstedc",LAPACKstedc_("V",&n1,d+l,e+l,Q+off,&ld,ds->rwork,&lrwork,ds->iwork,&liwork,&info));
632: #else
633:   lwork = ld*ld;
634:   DSAllocateWork_Private(ds,lwork,lrwork,liwork);
635:   PetscStackCallBLAS("LAPACKstedc",LAPACKstedc_("V",&n1,d+l,e+l,Q+off,&ld,ds->work,&lwork,ds->rwork,&lrwork,ds->iwork,&liwork,&info));
636:   /* Fixing Lapack bug*/
637:   for (j=ds->l;j<ds->n;j++)
638:     for (i=0;i<ds->l;i++) Q[i+j*ld] = 0.0;
639: #endif
640:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xSTEDC %d",info);
641:   for (i=l;i<ds->n;i++) wr[i] = d[i];

643:   /* Create diagonal matrix as a result */
644:   if (ds->compact) {
645:     PetscMemzero(e,(ds->n-1)*sizeof(PetscReal));
646:   } else {
647:     for (i=l;i<ds->n;i++) {
648:       PetscMemzero(A+l+i*ld,(ds->n-l)*sizeof(PetscScalar));
649:     }
650:     for (i=l;i<ds->n;i++) A[i+i*ld] = d[i];
651:   }

653:   /* Set zero wi */
654:   if (wi) for (i=l;i<ds->n;i++) wi[i] = 0.0;
655:   return(0);
656: #endif
657: }

661: PetscErrorCode DSTruncate_HEP(DS ds,PetscInt n)
662: {
663:   PetscInt       i,ld=ds->ld,l=ds->l;
664:   PetscScalar    *A;

667:   if (ds->state==DS_STATE_CONDENSED) ds->t = ds->n;
668:   A = ds->mat[DS_MAT_A];
669:   if (!ds->compact && ds->extrarow && ds->k==ds->n) {
670:     for (i=l;i<n;i++) A[n+i*ld] = A[ds->n+i*ld];
671:   }
672:   if (ds->extrarow) ds->k = n;
673:   else ds->k = 0;
674:   ds->n = n;
675:   return(0);
676: }

680: PetscErrorCode DSCond_HEP(DS ds,PetscReal *cond)
681: {
682: #if defined(PETSC_MISSING_LAPACK_GETRF) || defined(SLEPC_MISSING_LAPACK_GETRI) || defined(SLEPC_MISSING_LAPACK_LANGE) || defined(SLEPC_MISSING_LAPACK_LANHS)
684:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF/GETRI/LANGE/LANHS - Lapack routines are unavailable");
685: #else
687:   PetscScalar    *work;
688:   PetscReal      *rwork;
689:   PetscBLASInt   *ipiv;
690:   PetscBLASInt   lwork,info,n,ld;
691:   PetscReal      hn,hin;
692:   PetscScalar    *A;

695:   PetscBLASIntCast(ds->n,&n);
696:   PetscBLASIntCast(ds->ld,&ld);
697:   lwork = 8*ld;
698:   DSAllocateWork_Private(ds,lwork,ld,ld);
699:   work  = ds->work;
700:   rwork = ds->rwork;
701:   ipiv  = ds->iwork;
702:   DSSwitchFormat_HEP(ds,PETSC_FALSE);

704:   /* use workspace matrix W to avoid overwriting A */
705:   DSAllocateMat_Private(ds,DS_MAT_W);
706:   A = ds->mat[DS_MAT_W];
707:   PetscMemcpy(A,ds->mat[DS_MAT_A],sizeof(PetscScalar)*ds->ld*ds->ld);

709:   /* norm of A */
710:   hn = LAPACKlange_("I",&n,&n,A,&ld,rwork);

712:   /* norm of inv(A) */
713:   PetscStackCallBLAS("LAPACKgetrf",LAPACKgetrf_(&n,&n,A,&ld,ipiv,&info));
714:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGETRF %d",info);
715:   PetscStackCallBLAS("LAPACKgetri",LAPACKgetri_(&n,A,&ld,ipiv,work,&lwork,&info));
716:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGETRI %d",info);
717:   hin = LAPACKlange_("I",&n,&n,A,&ld,rwork);

719:   *cond = hn*hin;
720:   return(0);
721: #endif
722: }

726: PetscErrorCode DSTranslateRKS_HEP(DS ds,PetscScalar alpha)
727: {
728: #if defined(PETSC_MISSING_LAPACK_GEQRF) || defined(SLEPC_MISSING_LAPACK_ORGQR)
730:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEQRF/ORGQR - Lapack routines are unavailable");
731: #else
733:   PetscInt       i,j,k=ds->k;
734:   PetscScalar    *Q,*A,*R,*tau,*work;
735:   PetscBLASInt   ld,n1,n0,lwork,info;

738:   PetscBLASIntCast(ds->ld,&ld);
739:   DSAllocateWork_Private(ds,ld*ld,0,0);
740:   tau = ds->work;
741:   work = ds->work+ld;
742:   PetscBLASIntCast(ld*(ld-1),&lwork);
743:   DSAllocateMat_Private(ds,DS_MAT_W);
744:   A  = ds->mat[DS_MAT_A];
745:   Q  = ds->mat[DS_MAT_Q];
746:   R  = ds->mat[DS_MAT_W];
747:   /* Copy I+alpha*A */
748:   PetscMemzero(Q,ld*ld*sizeof(PetscScalar));
749:   PetscMemzero(R,ld*ld*sizeof(PetscScalar));
750:   for (i=0;i<k;i++) {
751:     Q[i+i*ld] = 1.0 + alpha*A[i+i*ld];
752:     Q[k+i*ld] = alpha*A[k+i*ld];
753:   }
754:   /* Compute qr */
755:   PetscBLASIntCast(k+1,&n1);
756:   PetscBLASIntCast(k,&n0);
757:   PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&n1,&n0,Q,&ld,tau,work,&lwork,&info));
758:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGEQRF %d",info);
759:   /* Copy R from Q */
760:   for (j=0;j<k;j++)
761:     for (i=0;i<=j;i++)
762:       R[i+j*ld] = Q[i+j*ld];
763:   /* Compute orthogonal matrix in Q */
764:   PetscStackCallBLAS("LAPACKorgqr",LAPACKorgqr_(&n1,&n1,&n0,Q,&ld,tau,work,&lwork,&info));
765:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xORGQR %d",info);
766:   /* Compute the updated matrix of projected problem */
767:   for (j=0;j<k;j++)
768:     for (i=0;i<k+1;i++)
769:       A[j*ld+i] = Q[i*ld+j];
770:   alpha = -1.0/alpha;
771:   PetscStackCallBLAS("BLAStrsm",BLAStrsm_("R","U","N","N",&n1,&n0,&alpha,R,&ld,A,&ld));
772:   for (i=0;i<k;i++)
773:     A[ld*i+i]-=alpha;
774:   return(0);
775: #endif
776: }

780: PetscErrorCode DSFunction_EXP_HEP_DIAG(DS ds)
781: {
783:   PetscScalar    *eig,one=1.0,zero=0.0;
784:   PetscInt       i,j;
785:   PetscBLASInt   n,ld;
786:   PetscScalar    *F,*Q,*W;

789:   PetscBLASIntCast(ds->n,&n);
790:   PetscBLASIntCast(ds->ld,&ld);
791:   PetscMalloc(n*sizeof(PetscScalar),&eig);
792:   DSSolve(ds,eig,NULL);
793:   if (!ds->mat[DS_MAT_W]) {
794:     DSAllocateMat_Private(ds,DS_MAT_W);
795:   }
796:   W  = ds->mat[DS_MAT_W];
797:   Q  = ds->mat[DS_MAT_Q];
798:   F  = ds->mat[DS_MAT_F];

800:   /* W = exp(Lambda)*Q' */
801:   for (i=0;i<n;i++) {
802:     for (j=0;j<n;j++) {
803:       W[i+j*ld] = Q[j+i*ld]*PetscExpScalar(eig[i]);
804:     }
805:   }
806:   /* F = Q*W */
807:   PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&n,&n,&n,&one,Q,&ld,W,&ld,&zero,F,&ld));
808:   PetscFree(eig);
809:   return(0);
810: }

814: PETSC_EXTERN PetscErrorCode DSCreate_HEP(DS ds)
815: {
817:   ds->ops->allocate      = DSAllocate_HEP;
818:   ds->ops->view          = DSView_HEP;
819:   ds->ops->vectors       = DSVectors_HEP;
820:   ds->ops->solve[0]      = DSSolve_HEP_QR;
821:   ds->ops->solve[1]      = DSSolve_HEP_MRRR;
822:   ds->ops->solve[2]      = DSSolve_HEP_DC;
823:   ds->ops->sort          = DSSort_HEP;
824:   ds->ops->truncate      = DSTruncate_HEP;
825:   ds->ops->update        = DSUpdateExtraRow_HEP;
826:   ds->ops->cond          = DSCond_HEP;
827:   ds->ops->transrks      = DSTranslateRKS_HEP;
828:   ds->ops->normalize     = DSNormalize_HEP;

830:   ds->ops->computefun[SLEPC_FUNCTION_EXP][0] = DSFunction_EXP_HEP_DIAG;
831:   return(0);
832: }

slepc-3.4.2.dfsg.orig/src/ds/impls/hep/makefile0000644000175000017500000000213112211062077020225 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dshep.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/impls/hep/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/impls/hep/makefile.html0000644000175000017500000000372212211062077021177 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dshep.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/impls/hep/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/impls/hep/index.html0000644000175000017500000000124412211062077020526 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dshep.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/impls/hep/dshep.c0000644000175000017500000006712012211062077020005 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocate_HEP" PetscErrorCode DSAllocate_HEP(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscFunctionBegin; ierr = DSAllocateMat_Private(ds,DS_MAT_A);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_Q);CHKERRQ(ierr); ierr = DSAllocateMatReal_Private(ds,DS_MAT_T);CHKERRQ(ierr); ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscMalloc(ld*sizeof(PetscInt),&ds->perm);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,ld*sizeof(PetscInt));CHKERRQ(ierr); PetscFunctionReturn(0); } /* 0 l k n-1 ----------------------------------------- |* · · | | * · · | | * · · | | * · · | |· · · · o o | | o o | | o o | | o o | | o o | | o o | |· · · · o o o o o o o x | | x x x | | x x x | | x x x | | x x x | | x x x | | x x x | | x x x | | x x x| | x x| ----------------------------------------- */ #undef __FUNCT__ #define __FUNCT__ "DSSwitchFormat_HEP" static PetscErrorCode DSSwitchFormat_HEP(DS ds,PetscBool tocompact) { PetscErrorCode ierr; PetscReal *T = ds->rmat[DS_MAT_T]; PetscScalar *A = ds->mat[DS_MAT_A]; PetscInt i,n=ds->n,k=ds->k,ld=ds->ld; PetscFunctionBegin; if (tocompact) { /* switch from dense (arrow) to compact storage */ ierr = PetscMemzero(T,3*ld*sizeof(PetscReal));CHKERRQ(ierr); for (i=0;iextrarow) T[n-1+ld] = PetscRealPart(A[n+(n-1)*ld]); } else { /* switch from compact (arrow) to dense storage */ ierr = PetscMemzero(A,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;iextrarow) A[n+(n-1)*ld] = T[n-1+ld]; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView_HEP" PetscErrorCode DSView_HEP(DS ds,PetscViewer viewer) { PetscErrorCode ierr; PetscViewerFormat format; PetscInt i,j,r,c,rows; PetscReal value; const char *methodname[] = { "Implicit QR method (_steqr)", "Relatively Robust Representations (_stevr)", "Divide and Conquer method (_stedc)" }; const int nmeth=sizeof(methodname)/sizeof(methodname[0]); PetscFunctionBegin; ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) { if (ds->method>=nmeth) { ierr = PetscViewerASCIIPrintf(viewer,"solving the problem with: INVALID METHOD\n");CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer,"solving the problem with: %s\n",methodname[ds->method]);CHKERRQ(ierr); } PetscFunctionReturn(0); } if (ds->compact) { ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr); rows = ds->extrarow? ds->n+1: ds->n; if (format == PETSC_VIEWER_ASCII_MATLAB) { ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",rows,ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",3*ds->n);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr); for (i=0;in;i++) { ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,i+1,*(ds->rmat[DS_MAT_T]+i));CHKERRQ(ierr); } for (i=0;ik+1); c = i+1; ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",r,c,*(ds->rmat[DS_MAT_T]+ds->ld+i));CHKERRQ(ierr); if (in-1 && ds->kn) { /* do not print vertical arrow when k=n */ ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",c,r,*(ds->rmat[DS_MAT_T]+ds->ld+i));CHKERRQ(ierr); } } ierr = PetscViewerASCIIPrintf(viewer,"];\n%s = spconvert(zzz);\n",DSMatName[DS_MAT_T]);CHKERRQ(ierr); } else { for (i=0;in;j++) { if (i==j) value = *(ds->rmat[DS_MAT_T]+i); else if ((ik && j==ds->k) || (i==ds->k && jk)) value = *(ds->rmat[DS_MAT_T]+ds->ld+PetscMin(i,j)); else if (i==j+1 && i>ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+i-1); else if (i+1==j && j>ds->k) value = *(ds->rmat[DS_MAT_T]+ds->ld+j-1); else value = 0.0; ierr = PetscViewerASCIIPrintf(viewer," %18.16e ",value);CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } } ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerFlush(viewer);CHKERRQ(ierr); } else { ierr = DSViewMat_Private(ds,viewer,DS_MAT_A);CHKERRQ(ierr); } if (ds->state>DS_STATE_INTERMEDIATE) { ierr = DSViewMat_Private(ds,viewer,DS_MAT_Q);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors_HEP" PetscErrorCode DSVectors_HEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm) { PetscScalar *Q = ds->mat[DS_MAT_Q]; PetscInt ld = ds->ld,i; PetscErrorCode ierr; PetscFunctionBegin; switch (mat) { case DS_MAT_X: case DS_MAT_Y: if (j) { if (ds->state>=DS_STATE_CONDENSED) { ierr = PetscMemcpy(ds->mat[mat]+(*j)*ld,Q+(*j)*ld,ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { ierr = PetscMemzero(ds->mat[mat]+(*j)*ld,ld*sizeof(PetscScalar));CHKERRQ(ierr); *(ds->mat[mat]+(*j)+(*j)*ld) = 1.0; } } else { if (ds->state>=DS_STATE_CONDENSED) { ierr = PetscMemcpy(ds->mat[mat],Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); } else { ierr = PetscMemzero(ds->mat[mat],ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;in;i++) *(ds->mat[mat]+i+i*ld) = 1.0; } } if (rnorm) *rnorm = PetscAbsScalar(Q[ds->n-1+(*j)*ld]); break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSNormalize_HEP" PetscErrorCode DSNormalize_HEP(DS ds,DSMatType mat,PetscInt col) { PetscFunctionBegin; switch (mat) { case DS_MAT_X: case DS_MAT_Y: case DS_MAT_Q: /* All the matrices resulting from DSVectors and DSSolve are already normalized */ break; case DS_MAT_U: case DS_MAT_VT: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented yet"); break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Invalid mat parameter"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "ArrowTridiag" /* ARROWTRIDIAG reduces a symmetric arrowhead matrix of the form [ d 0 0 0 e ] [ 0 d 0 0 e ] A = [ 0 0 d 0 e ] [ 0 0 0 d e ] [ e e e e d ] to tridiagonal form [ d e 0 0 0 ] [ e d e 0 0 ] T = Q'*A*Q = [ 0 e d e 0 ], [ 0 0 e d e ] [ 0 0 0 e d ] where Q is an orthogonal matrix. Rutishauser's algorithm is used to perform the reduction, which requires O(n**2) flops. The accumulation of the orthogonal factor Q, however, requires O(n**3) flops. Arguments ========= N (input) INTEGER The order of the matrix A. N >= 0. D (input/output) DOUBLE PRECISION array, dimension (N) On entry, the diagonal entries of the matrix A to be reduced. On exit, the diagonal entries of the reduced matrix T. E (input/output) DOUBLE PRECISION array, dimension (N-1) On entry, the off-diagonal entries of the matrix A to be reduced. On exit, the subdiagonal entries of the reduced matrix T. Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) On exit, the orthogonal matrix Q. LDQ (input) INTEGER The leading dimension of the array Q. Note ==== Based on Fortran code contributed by Daniel Kressner */ static PetscErrorCode ArrowTridiag(PetscBLASInt n,PetscReal *d,PetscReal *e,PetscScalar *Q,PetscBLASInt ld) { #if defined(SLEPC_MISSING_LAPACK_LARTG) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LARTG - Lapack routine is unavailable"); #else PetscBLASInt i,j,j2,one=1; PetscReal c,s,p,off,temp; PetscFunctionBegin; if (n<=2) PetscFunctionReturn(0); for (j=0;j=0;i--) { off = -s*e[i]; e[i] = c*e[i]; temp = e[i+1]; PetscStackCallBLAS("LAPACKlartg",LAPACKlartg_(&temp,&off,&c,&s,&e[i+1])); s = -s; temp = (d[i]-d[i+1])*s - 2.0*c*e[i]; p = s*temp; d[i+1] += p; d[i] -= p; e[i] = -e[i] - c*temp; j2 = j+2; PetscStackCallBLAS("BLASrot",BLASrot_(&j2,Q+i*ld,&one,Q+(i+1)*ld,&one,&c,&s)); } } PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSIntermediate_HEP" /* Reduce to tridiagonal form by means of ArrowTridiag. */ static PetscErrorCode DSIntermediate_HEP(DS ds) { #if defined(SLEPC_MISSING_LAPACK_SYTRD) || defined(SLEPC_MISSING_LAPACK_ORGTR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SYTRD/ORGTR - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; PetscBLASInt n1,n2,n3,lwork,info,l,n,ld,off; PetscScalar *A,*Q,*work,*tau; PetscReal *d,*e; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->l,&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->k-l+1,&n1);CHKERRQ(ierr); /* size of leading block, excl. locked */ ierr = PetscBLASIntCast(n-ds->k-1,&n2);CHKERRQ(ierr); /* size of trailing block */ n3 = n1+n2; off = l+l*ld; A = ds->mat[DS_MAT_A]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T]+ld; ierr = PetscMemzero(Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;icompact) { if (ds->statestatework; work = ds->work+ld; lwork = ld*ld; PetscStackCallBLAS("LAPACKsytrd",LAPACKsytrd_("L",&n3,Q+off,&ld,d+l,e+l,tau,work,&lwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xSYTRD %d",info); PetscStackCallBLAS("LAPACKorgtr",LAPACKorgtr_("L",&n3,Q+off,&ld,tau,work,&lwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xORGTR %d",info); } else { /* copy tridiagonal to d,e */ for (i=l;ild; PetscScalar *A; PetscReal *d; PetscFunctionBegin; if (!ds->comparison) PetscFunctionReturn(0); n = ds->n; l = ds->l; A = ds->mat[DS_MAT_A]; d = ds->rmat[DS_MAT_T]; perm = ds->perm; if (!rr) { ierr = DSSortEigenvaluesReal_Private(ds,d,perm);CHKERRQ(ierr); } else { ierr = DSSortEigenvalues_Private(ds,rr,ri,perm,PETSC_FALSE);CHKERRQ(ierr); } for (i=l;icompact) { for (i=l;in,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); A = ds->mat[DS_MAT_A]; Q = ds->mat[DS_MAT_Q]; e = ds->rmat[DS_MAT_T]+ld; if (ds->compact) { beta = e[n-1]; for (i=0;ik = n; } else { ierr = DSAllocateWork_Private(ds,2*ld,0,0);CHKERRQ(ierr); x = ds->work; y = ds->work+ld; for (i=0;ik = n; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSolve_HEP_QR" PetscErrorCode DSSolve_HEP_QR(DS ds,PetscScalar *wr,PetscScalar *wi) { #if defined(PETSC_MISSING_LAPACK_STEQR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"STEQR - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt i; PetscBLASInt n1,n2,n3,info,l,n,ld,off; PetscScalar *Q,*A; PetscReal *d,*e; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->l,&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->k-l+1,&n1);CHKERRQ(ierr); /* size of leading block, excl. locked */ ierr = PetscBLASIntCast(n-ds->k-1,&n2);CHKERRQ(ierr); /* size of trailing block */ n3 = n1+n2; off = l+l*ld; Q = ds->mat[DS_MAT_Q]; A = ds->mat[DS_MAT_A]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T]+ld; /* Reduce to tridiagonal form */ ierr = DSIntermediate_HEP(ds);CHKERRQ(ierr); /* Solve the tridiagonal eigenproblem */ for (i=0;irwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xSTEQR %d",info); for (i=l;icompact) { ierr = PetscMemzero(e,(n-1)*sizeof(PetscReal));CHKERRQ(ierr); } else { for (i=l;in,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->l,&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->k-l+1,&n1);CHKERRQ(ierr); /* size of leading block, excl. locked */ ierr = PetscBLASIntCast(n-ds->k-1,&n2);CHKERRQ(ierr); /* size of trailing block */ n3 = n1+n2; off = l+l*ld; A = ds->mat[DS_MAT_A]; Q = ds->mat[DS_MAT_Q]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T]+ld; /* Reduce to tridiagonal form */ ierr = DSIntermediate_HEP(ds);CHKERRQ(ierr); /* Solve the tridiagonal eigenproblem */ for (i=0;istatemat[DS_MAT_W]; } #if defined(PETSC_USE_COMPLEX) ierr = DSAllocateMatReal_Private(ds,DS_MAT_Q);CHKERRQ(ierr); #endif lwork = 20*ld; liwork = 10*ld; ierr = DSAllocateWork_Private(ds,0,lwork+ld,liwork+2*ld);CHKERRQ(ierr); isuppz = ds->iwork+liwork; #if defined(PETSC_USE_COMPLEX) ritz = ds->rwork+lwork; PetscStackCallBLAS("LAPACKstevr",LAPACKstevr_("V","A",&n3,d+l,e+l,&vl,&vu,&il,&iu,&abstol,&m,ritz+l,ds->rmat[DS_MAT_Q]+off,&ld,isuppz,ds->rwork,&lwork,ds->iwork,&liwork,&info)); for (i=l;irwork,&lwork,ds->iwork,&liwork,&info)); #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack DSTEVR %d",info); #if defined(PETSC_USE_COMPLEX) for (i=l;irmat[DS_MAT_Q])[i+j*ld]; #endif if (ds->statecompact) { ierr = PetscMemzero(e,(n-1)*sizeof(PetscReal));CHKERRQ(ierr); } else { for (i=l;il,&l);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->n-ds->l,&n1);CHKERRQ(ierr); off = l+l*ld; Q = ds->mat[DS_MAT_Q]; A = ds->mat[DS_MAT_A]; d = ds->rmat[DS_MAT_T]; e = ds->rmat[DS_MAT_T]+ld; /* Reduce to tridiagonal form */ ierr = DSIntermediate_HEP(ds);CHKERRQ(ierr); /* Solve the tridiagonal eigenproblem */ for (i=0;irwork,&lrwork,ds->iwork,&liwork,&info)); #else lwork = ld*ld; ierr = DSAllocateWork_Private(ds,lwork,lrwork,liwork);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKstedc",LAPACKstedc_("V",&n1,d+l,e+l,Q+off,&ld,ds->work,&lwork,ds->rwork,&lrwork,ds->iwork,&liwork,&info)); /* Fixing Lapack bug*/ for (j=ds->l;jn;j++) for (i=0;il;i++) Q[i+j*ld] = 0.0; #endif if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xSTEDC %d",info); for (i=l;in;i++) wr[i] = d[i]; /* Create diagonal matrix as a result */ if (ds->compact) { ierr = PetscMemzero(e,(ds->n-1)*sizeof(PetscReal));CHKERRQ(ierr); } else { for (i=l;in;i++) { ierr = PetscMemzero(A+l+i*ld,(ds->n-l)*sizeof(PetscScalar));CHKERRQ(ierr); } for (i=l;in;i++) A[i+i*ld] = d[i]; } /* Set zero wi */ if (wi) for (i=l;in;i++) wi[i] = 0.0; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSTruncate_HEP" PetscErrorCode DSTruncate_HEP(DS ds,PetscInt n) { PetscInt i,ld=ds->ld,l=ds->l; PetscScalar *A; PetscFunctionBegin; if (ds->state==DS_STATE_CONDENSED) ds->t = ds->n; A = ds->mat[DS_MAT_A]; if (!ds->compact && ds->extrarow && ds->k==ds->n) { for (i=l;in+i*ld]; } if (ds->extrarow) ds->k = n; else ds->k = 0; ds->n = n; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSCond_HEP" PetscErrorCode DSCond_HEP(DS ds,PetscReal *cond) { #if defined(PETSC_MISSING_LAPACK_GETRF) || defined(SLEPC_MISSING_LAPACK_GETRI) || defined(SLEPC_MISSING_LAPACK_LANGE) || defined(SLEPC_MISSING_LAPACK_LANHS) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GETRF/GETRI/LANGE/LANHS - Lapack routines are unavailable"); #else PetscErrorCode ierr; PetscScalar *work; PetscReal *rwork; PetscBLASInt *ipiv; PetscBLASInt lwork,info,n,ld; PetscReal hn,hin; PetscScalar *A; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->n,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); lwork = 8*ld; ierr = DSAllocateWork_Private(ds,lwork,ld,ld);CHKERRQ(ierr); work = ds->work; rwork = ds->rwork; ipiv = ds->iwork; ierr = DSSwitchFormat_HEP(ds,PETSC_FALSE);CHKERRQ(ierr); /* use workspace matrix W to avoid overwriting A */ ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); A = ds->mat[DS_MAT_W]; ierr = PetscMemcpy(A,ds->mat[DS_MAT_A],sizeof(PetscScalar)*ds->ld*ds->ld);CHKERRQ(ierr); /* norm of A */ hn = LAPACKlange_("I",&n,&n,A,&ld,rwork); /* norm of inv(A) */ PetscStackCallBLAS("LAPACKgetrf",LAPACKgetrf_(&n,&n,A,&ld,ipiv,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGETRF %d",info); PetscStackCallBLAS("LAPACKgetri",LAPACKgetri_(&n,A,&ld,ipiv,work,&lwork,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGETRI %d",info); hin = LAPACKlange_("I",&n,&n,A,&ld,rwork); *cond = hn*hin; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSTranslateRKS_HEP" PetscErrorCode DSTranslateRKS_HEP(DS ds,PetscScalar alpha) { #if defined(PETSC_MISSING_LAPACK_GEQRF) || defined(SLEPC_MISSING_LAPACK_ORGQR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEQRF/ORGQR - Lapack routines are unavailable"); #else PetscErrorCode ierr; PetscInt i,j,k=ds->k; PetscScalar *Q,*A,*R,*tau,*work; PetscBLASInt ld,n1,n0,lwork,info; PetscFunctionBegin; ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = DSAllocateWork_Private(ds,ld*ld,0,0);CHKERRQ(ierr); tau = ds->work; work = ds->work+ld; ierr = PetscBLASIntCast(ld*(ld-1),&lwork);CHKERRQ(ierr); ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); A = ds->mat[DS_MAT_A]; Q = ds->mat[DS_MAT_Q]; R = ds->mat[DS_MAT_W]; /* Copy I+alpha*A */ ierr = PetscMemzero(Q,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); ierr = PetscMemzero(R,ld*ld*sizeof(PetscScalar));CHKERRQ(ierr); for (i=0;in,&n);CHKERRQ(ierr); ierr = PetscBLASIntCast(ds->ld,&ld);CHKERRQ(ierr); ierr = PetscMalloc(n*sizeof(PetscScalar),&eig);CHKERRQ(ierr); ierr = DSSolve(ds,eig,NULL);CHKERRQ(ierr); if (!ds->mat[DS_MAT_W]) { ierr = DSAllocateMat_Private(ds,DS_MAT_W);CHKERRQ(ierr); } W = ds->mat[DS_MAT_W]; Q = ds->mat[DS_MAT_Q]; F = ds->mat[DS_MAT_F]; /* W = exp(Lambda)*Q' */ for (i=0;iops->allocate = DSAllocate_HEP; ds->ops->view = DSView_HEP; ds->ops->vectors = DSVectors_HEP; ds->ops->solve[0] = DSSolve_HEP_QR; ds->ops->solve[1] = DSSolve_HEP_MRRR; ds->ops->solve[2] = DSSolve_HEP_DC; ds->ops->sort = DSSort_HEP; ds->ops->truncate = DSTruncate_HEP; ds->ops->update = DSUpdateExtraRow_HEP; ds->ops->cond = DSCond_HEP; ds->ops->transrks = DSTranslateRKS_HEP; ds->ops->normalize = DSNormalize_HEP; ds->ops->computefun[SLEPC_FUNCTION_EXP][0] = DSFunction_EXP_HEP_DIAG; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/makefile0000644000175000017500000000213512211062077016331 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib SOURCEH = ../../include/slepc-private/dsimpl.h ../../include/slepcds.h DIRS = interface impls examples LOCDIR = src/ds/ MANSEC = DS include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/makefile.html0000644000175000017500000000372612211062077017303 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

SOURCEH  = ../../include/slepc-private/dsimpl.h ../../include/slepcds.h
DIRS     = interface impls examples
LOCDIR   = src/ds/
MANSEC   = DS

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/interface/0000755000175000017500000000000012214143515016570 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/interface/dspriv.c.html0000644000175000017500000011340212211062077021207 0ustar gladkgladk
Actual source code: dspriv.c

  1: /*
  2:    Private DS routines

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/
 25: #include <slepcblaslapack.h>

 29: PetscErrorCode DSAllocateMat_Private(DS ds,DSMatType m)
 30: {
 31:   PetscInt       sz;

 35:   if (m==DS_MAT_T) sz = 3*ds->ld*sizeof(PetscScalar);
 36:   else if (m==DS_MAT_D) sz = ds->ld*sizeof(PetscScalar);
 37:   else sz = ds->ld*ds->ld*sizeof(PetscScalar);
 38:   if (ds->mat[m]) {
 39:     PetscFree(ds->mat[m]);
 40:   } else {
 41:     PetscLogObjectMemory(ds,sz);
 42:   }
 43:   PetscMalloc(sz,&ds->mat[m]);
 44:   PetscMemzero(ds->mat[m],sz);
 45:   return(0);
 46: }

 50: PetscErrorCode DSAllocateMatReal_Private(DS ds,DSMatType m)
 51: {
 52:   PetscInt       sz;

 56:   if (m==DS_MAT_T) sz = 3*ds->ld*sizeof(PetscReal);
 57:   else if (m==DS_MAT_D) sz = ds->ld*sizeof(PetscReal);
 58:   else sz = ds->ld*ds->ld*sizeof(PetscReal);
 59:   if (!ds->rmat[m]) {
 60:     PetscLogObjectMemory(ds,sz);
 61:     PetscMalloc(sz,&ds->rmat[m]);
 62:   }
 63:   PetscMemzero(ds->rmat[m],sz);
 64:   return(0);
 65: }

 69: PetscErrorCode DSAllocateWork_Private(DS ds,PetscInt s,PetscInt r,PetscInt i)
 70: {

 74:   if (s>ds->lwork) {
 75:     PetscFree(ds->work);
 76:     PetscMalloc(s*sizeof(PetscScalar),&ds->work);
 77:     PetscLogObjectMemory(ds,(s-ds->lwork)*sizeof(PetscScalar));
 78:     ds->lwork = s;
 79:   }
 80:   if (r>ds->lrwork) {
 81:     PetscFree(ds->rwork);
 82:     PetscMalloc(r*sizeof(PetscReal),&ds->rwork);
 83:     PetscLogObjectMemory(ds,(r-ds->lrwork)*sizeof(PetscReal));
 84:     ds->lrwork = r;
 85:   }
 86:   if (i>ds->liwork) {
 87:     PetscFree(ds->iwork);
 88:     PetscMalloc(i*sizeof(PetscBLASInt),&ds->iwork);
 89:     PetscLogObjectMemory(ds,(i-ds->liwork)*sizeof(PetscBLASInt));
 90:     ds->liwork = i;
 91:   }
 92:   return(0);
 93: }

 97: PetscErrorCode DSViewMat_Private(DS ds,PetscViewer viewer,DSMatType m)
 98: {
 99:   PetscErrorCode    ierr;
100:   PetscInt          i,j,rows,cols;
101:   PetscScalar       *v;
102:   PetscViewerFormat format;
103: #if defined(PETSC_USE_COMPLEX)
104:   PetscBool         allreal = PETSC_TRUE;
105: #endif

108:   PetscViewerGetFormat(viewer,&format);
109:   if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) return(0);
110:   PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);
111:   if (ds->state==DS_STATE_TRUNCATED && m>=DS_MAT_Q) rows = ds->t;
112:   else rows = (m==DS_MAT_A && ds->extrarow)? ds->n+1: ds->n;
113:   cols = (ds->m!=0)? ds->m: ds->n;
114: #if defined(PETSC_USE_COMPLEX)
115:   /* determine if matrix has all real values */
116:   v = ds->mat[m];
117:   for (i=0;i<rows;i++)
118:     for (j=0;j<cols;j++)
119:       if (PetscImaginaryPart(v[i+j*ds->ld])) { allreal = PETSC_FALSE; break; }
120: #endif
121:   if (format == PETSC_VIEWER_ASCII_MATLAB) {
122:     PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",rows,cols);
123:     PetscViewerASCIIPrintf(viewer,"%s = [\n",DSMatName[m]);
124:   } else {
125:     PetscViewerASCIIPrintf(viewer,"Matrix %s =\n",DSMatName[m]);
126:   }

128:   for (i=0;i<rows;i++) {
129:     v = ds->mat[m]+i;
130:     for (j=0;j<cols;j++) {
131: #if defined(PETSC_USE_COMPLEX)
132:       if (allreal) {
133:         PetscViewerASCIIPrintf(viewer,"%18.16e ",PetscRealPart(*v));
134:       } else {
135:         PetscViewerASCIIPrintf(viewer,"%18.16e + %18.16ei ",PetscRealPart(*v),PetscImaginaryPart(*v));
136:       }
137: #else
138:       PetscViewerASCIIPrintf(viewer,"%18.16e ",*v);
139: #endif
140:       v += ds->ld;
141:     }
142:     PetscViewerASCIIPrintf(viewer,"\n");
143:   }

145:   if (format == PETSC_VIEWER_ASCII_MATLAB) {
146:     PetscViewerASCIIPrintf(viewer,"];\n");
147:   }
148:   PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);
149:   PetscViewerFlush(viewer);
150:   return(0);
151: }

155: PetscErrorCode DSSortEigenvalues_Private(DS ds,PetscScalar *wr,PetscScalar *wi,PetscInt *perm,PetscBool isghiep)
156: {
158:   PetscScalar    re,im,wi0;
159:   PetscInt       n,i,j,result,tmp1,tmp2=0,d=1;

162:   n = ds->t;   /* sort only first t pairs if truncated */
163:   for (i=0;i<ds->n;i++) perm[i] = i;
164:   /* insertion sort */
165:   i=ds->l+1;
166: #if !defined(PETSC_USE_COMPLEX)
167:   if (wi && wi[perm[i-1]]!=0.0) i++; /* initial value is complex */
168: #else
169:   if (isghiep && PetscImaginaryPart(wr[perm[i-1]])!=0.0) i++;
170: #endif
171:   for (;i<n;i+=d) {
172:     re = wr[perm[i]];
173:     if (wi) im = wi[perm[i]];
174:     else im = 0.0;
175:     tmp1 = perm[i];
176: #if !defined(PETSC_USE_COMPLEX)
177:     if (im!=0.0) { d = 2; tmp2 = perm[i+1]; }
178:     else d = 1;
179: #else
180:     if (isghiep && PetscImaginaryPart(re)!=0.0) { d = 2; tmp2 = perm[i+1]; }
181:     else d = 1;
182: #endif
183:     j = i-1;
184:     if (wi) wi0 = wi[perm[j]];
185:     else wi0 = 0.0;
186:     (*ds->comparison)(re,im,wr[perm[j]],wi0,&result,ds->comparisonctx);
187:     while (result<0 && j>=ds->l) {
188:       perm[j+d] = perm[j];
189:       j--;
190: #if !defined(PETSC_USE_COMPLEX)
191:       if (wi && wi[perm[j+1]]!=0)
192: #else
193:       if (isghiep && PetscImaginaryPart(wr[perm[j+1]])!=0)
194: #endif
195:         { perm[j+d] = perm[j]; j--; }

197:       if (j>=ds->l) {
198:         if (wi) wi0 = wi[perm[j]];
199:         else wi0 = 0.0;
200:         (*ds->comparison)(re,im,wr[perm[j]],wi0,&result,ds->comparisonctx);
201:       }
202:     }
203:     perm[j+1] = tmp1;
204:     if (d==2) perm[j+2] = tmp2;
205:   }
206:   return(0);
207: }

211: PetscErrorCode DSSortEigenvaluesReal_Private(DS ds,PetscReal *eig,PetscInt *perm)
212: {
214:   PetscScalar    re;
215:   PetscInt       i,j,result,tmp,l,n;

218:   n = ds->t;   /* sort only first t pairs if truncated */
219:   l = ds->l;
220:   for (i=0;i<n;i++) perm[i] = i;
221:   /* insertion sort */
222:   for (i=l+1;i<n;i++) {
223:     re = eig[perm[i]];
224:     j = i-1;
225:     (*ds->comparison)(re,0.0,eig[perm[j]],0.0,&result,ds->comparisonctx);
226:     while (result<0 && j>=l) {
227:       tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; j--;
228:       if (j>=l) {
229:         (*ds->comparison)(re,0.0,eig[perm[j]],0.0,&result,ds->comparisonctx);
230:       }
231:     }
232:   }
233:   return(0);
234: }

238: /*
239:   DSCopyMatrix_Private - Copies the trailing block of a matrix (from
240:   rows/columns l to n).
241: */
242: PetscErrorCode DSCopyMatrix_Private(DS ds,DSMatType dst,DSMatType src)
243: {
245:   PetscInt    j,m,off,ld;
246:   PetscScalar *S,*D;

249:   ld  = ds->ld;
250:   m   = ds->n-ds->l;
251:   off = ds->l+ds->l*ld;
252:   S   = ds->mat[src];
253:   D   = ds->mat[dst];
254:   for (j=0;j<m;j++) {
255:     PetscMemcpy(D+off+j*ld,S+off+j*ld,m*sizeof(PetscScalar));
256:   }
257:   return(0);
258: }

262: PetscErrorCode DSPermuteColumns_Private(DS ds,PetscInt l,PetscInt n,DSMatType mat,PetscInt *perm)
263: {
264:   PetscInt    i,j,k,p,ld;
265:   PetscScalar *Q,rtmp;

268:   ld = ds->ld;
269:   Q  = ds->mat[mat];
270:   for (i=l;i<n;i++) {
271:     p = perm[i];
272:     if (p != i) {
273:       j = i + 1;
274:       while (perm[j] != i) j++;
275:       perm[j] = p; perm[i] = i;
276:       /* swap columns i and j */
277:       for (k=0;k<n;k++) {
278:         rtmp = Q[k+p*ld]; Q[k+p*ld] = Q[k+i*ld]; Q[k+i*ld] = rtmp;
279:       }
280:     }
281:   }
282:   return(0);
283: }

287: PetscErrorCode DSPermuteRows_Private(DS ds,PetscInt l,PetscInt n,DSMatType mat,PetscInt *perm)
288: {
289:   PetscInt    i,j,m=ds->m,k,p,ld;
290:   PetscScalar *Q,rtmp;

293:   if (!m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set");
294:   ld = ds->ld;
295:   Q  = ds->mat[mat];
296:   for (i=l;i<n;i++) {
297:     p = perm[i];
298:     if (p != i) {
299:       j = i + 1;
300:       while (perm[j] != i) j++;
301:       perm[j] = p; perm[i] = i;
302:       /* swap rows i and j */
303:       for (k=0;k<m;k++) {
304:         rtmp = Q[p+k*ld]; Q[p+k*ld] = Q[i+k*ld]; Q[i+k*ld] = rtmp;
305:       }
306:     }
307:   }
308:   return(0);
309: }

313: PetscErrorCode DSPermuteBoth_Private(DS ds,PetscInt l,PetscInt n,DSMatType mat1,DSMatType mat2,PetscInt *perm)
314: {
315:   PetscInt    i,j,m=ds->m,k,p,ld;
316:   PetscScalar *U,*VT,rtmp;

319:   if (!m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set");
320:   ld = ds->ld;
321:   U  = ds->mat[mat1];
322:   VT = ds->mat[mat2];
323:   for (i=l;i<n;i++) {
324:     p = perm[i];
325:     if (p != i) {
326:       j = i + 1;
327:       while (perm[j] != i) j++;
328:       perm[j] = p; perm[i] = i;
329:       /* swap columns i and j of U */
330:       for (k=0;k<n;k++) {
331:         rtmp = U[k+p*ld]; U[k+p*ld] = U[k+i*ld]; U[k+i*ld] = rtmp;
332:       }
333:       /* swap rows i and j of VT */
334:       for (k=0;k<m;k++) {
335:         rtmp = VT[p+k*ld]; VT[p+k*ld] = VT[i+k*ld]; VT[i+k*ld] = rtmp;
336:       }
337:     }
338:   }
339:   return(0);
340: }

344: /*
345:    DSSetIdentity - Copy the identity (a diagonal matrix with ones) on the
346:    active part of a matrix.
347: */
348: PetscErrorCode DSSetIdentity(DS ds,DSMatType mat)
349: {
351:   PetscScalar    *x;
352:   PetscInt       i,ld,n,l;

355:   DSGetDimensions(ds,&n,NULL,&l,NULL,NULL);
356:   DSGetLeadingDimension(ds,&ld);
357:   PetscLogEventBegin(DS_Other,ds,0,0,0);
358:   DSGetArray(ds,mat,&x);
359:   PetscMemzero(&x[ld*l],ld*(n-l)*sizeof(PetscScalar));
360:   for (i=l;i<n;i++) {
361:     x[ld*i+i] = 1.0;
362:   }
363:   DSRestoreArray(ds,mat,&x);
364:   PetscLogEventEnd(DS_Other,ds,0,0,0);
365:   return(0);
366: }

370: /*
371:    DSComputeMatrix - Build the matrix associated to a nonlinear operator
372:    T(lambda) or its derivative T'(lambda), given the parameter lambda, where
373:    T(lambda) = sum_i E_i*f_i(lambda). The result is written in mat.
374: */
375: PetscErrorCode DSComputeMatrix(DS ds,PetscScalar lambda,PetscBool deriv,DSMatType mat)
376: {
378:   PetscScalar    *T,*E,alpha;
379:   PetscInt       i,ld,n;
380:   PetscBLASInt   k,inc=1;

383:   DSGetDimensions(ds,&n,NULL,NULL,NULL,NULL);
384:   DSGetLeadingDimension(ds,&ld);
385:   PetscBLASIntCast(ld*n,&k);
386:   PetscLogEventBegin(DS_Other,ds,0,0,0);
387:   DSGetArray(ds,mat,&T);
388:   PetscMemzero(T,k*sizeof(PetscScalar));
389:   for (i=0;i<ds->nf;i++) {
390:     if (deriv) {
391:       FNEvaluateDerivative(ds->f[i],lambda,&alpha);
392:     } else {
393:       FNEvaluateFunction(ds->f[i],lambda,&alpha);
394:     }
395:     E = ds->mat[DSMatExtra[i]];
396:     PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&k,&alpha,E,&inc,T,&inc));
397:   }
398:   DSRestoreArray(ds,mat,&T);
399:   PetscLogEventEnd(DS_Other,ds,0,0,0);
400:   return(0);
401: }

405: /*
406:    DSOrthogonalize - Orthogonalize the columns of a matrix.

408:    Input Parameters:
409: +  ds   - the direct solver context
410: .  mat  - a matrix
411: -  cols - number of columns to orthogonalize (starting from the column zero)

413:    Output Parameter:
414: .  lindcols - number of linearly independent columns of the matrix (can be NULL)
415: */
416: PetscErrorCode DSOrthogonalize(DS ds,DSMatType mat,PetscInt cols,PetscInt *lindcols)
417: {
418: #if defined(PETSC_MISSING_LAPACK_GEQRF) || defined(SLEPC_MISSING_LAPACK_ORGQR)
420:   SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEQRF/ORGQR - Lapack routine is unavailable");
421: #else
422:   PetscErrorCode  ierr;
423:   PetscInt        n,l,ld;
424:   PetscBLASInt    ld_,rA,cA,info,ltau,lw;
425:   PetscScalar     *A,*tau,*w,saux;

431:   DSGetDimensions(ds,&n,NULL,&l,NULL,NULL);
432:   DSGetLeadingDimension(ds,&ld);
433:   n = n - l;
434:   if (cols > n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid number of columns");
435:   if (n == 0 || cols == 0) return(0);
436:   DSGetArray(ds,mat,&A);
437:   PetscBLASIntCast(PetscMin(cols,n),&ltau);
438:   PetscBLASIntCast(ld,&ld_);
439:   PetscBLASIntCast(n,&rA);
440:   PetscBLASIntCast(cols,&cA);
441:   lw = -1;
442:   PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&rA,&cA,A,&ld_,NULL,&saux,&lw,&info));
443:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGEQRF %d",info);
444:   lw = (PetscBLASInt)PetscRealPart(saux);
445:   DSAllocateWork_Private(ds,lw+ltau,0,0);
446:   tau = ds->work;
447:   w = &tau[ltau];
448:   PetscLogEventBegin(DS_Other,ds,0,0,0);
449:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
450:   PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&rA,&cA,&A[ld*l+l],&ld_,tau,w,&lw,&info));
451:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGEQRF %d",info);
452:   PetscStackCallBLAS("LAPACKorgqr",LAPACKorgqr_(&rA,&ltau,&ltau,&A[ld*l+l],&ld_,tau,w,&lw,&info));
453:   if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xORGQR %d",info);
454:   PetscFPTrapPop();
455:   PetscLogEventEnd(DS_Other,ds,0,0,0);
456:   DSRestoreArray(ds,mat,&A);
457:   PetscObjectStateIncrease((PetscObject)ds);
458:   if (lindcols) *lindcols = ltau;
459:   return(0);
460: #endif
461: }

465: /*
466:    DSPseudoOrthogonalize - Orthogonalize the columns of a matrix with Modified
467:    Gram-Schmidt in an indefinite inner product space defined by a signature.

469:    Input Parameters:
470: +  ds   - the direct solver context
471: .  mat  - the matrix
472: .  cols - number of columns to orthogonalize (starting from the column zero)
473: -  s    - the signature that defines the inner product

475:    Output Parameter:
476: +  lindcols - linear independent columns of the matrix (can be NULL)
477: -  ns - the new norm of the vectors (can be NULL)
478: */
479: PetscErrorCode DSPseudoOrthogonalize(DS ds,DSMatType mat,PetscInt cols,PetscReal *s,PetscInt *lindcols,PetscReal *ns)
480: {
481:   PetscErrorCode  ierr;
482:   PetscInt        i,j,k,l,n,ld;
483:   PetscBLASInt    one=1,rA_;
484:   PetscScalar     alpha,*A,*A_,*m,*h,nr0;
485:   PetscReal       nr_o,nr,*ns_;

493:   DSGetDimensions(ds,&n,NULL,&l,NULL,NULL);
494:   DSGetLeadingDimension(ds,&ld);
495:   n = n - l;
496:   if (cols > n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid number of columns");
497:   if (n == 0 || cols == 0) return(0);
498:   PetscBLASIntCast(n,&rA_);
499:   DSGetArray(ds,mat,&A_);
500:   A = &A_[ld*l+l];
501:   DSAllocateWork_Private(ds,n+cols,ns?0:cols,0);
502:   m = ds->work;
503:   h = &m[n];
504:   ns_ = ns ? ns : ds->rwork;
505:   PetscLogEventBegin(DS_Other,ds,0,0,0);
506:   for (i=0; i<cols; i++) {
507:     /* m <- diag(s)*A[i] */
508:     for (k=0; k<n; k++) m[k] = s[k]*A[k+i*ld];
509:     /* nr_o <- mynorm(A[i]'*m), mynorm(x) = sign(x)*sqrt(|x|) */
510:     SlepcDenseMatProd(&nr0,1,0.0,1.0,&A[ld*i],ld,n,1,PETSC_TRUE,m,n,n,1,PETSC_FALSE);
511:     nr = nr_o = PetscSign(PetscRealPart(nr0))*PetscSqrtReal(PetscAbsScalar(nr0));
512:     for (j=0; j<3 && i>0; j++) {
513:       /* h <- A[0:i-1]'*m */
514:       SlepcDenseMatProd(h,i,0.0,1.0,A,ld,n,i,PETSC_TRUE,m,n,n,1,PETSC_FALSE);
515:       /* h <- diag(ns)*h */
516:       for (k=0; k<i; k++) h[k] *= ns_[k];
517:       /* A[i] <- A[i] - A[0:i-1]*h */
518:       SlepcDenseMatProd(&A[ld*i],ld,1.0,-1.0,A,ld,n,i,PETSC_FALSE,h,i,i,1,PETSC_FALSE);
519:       /* m <- diag(s)*A[i] */
520:       for (k=0; k<n; k++) m[k] = s[k]*A[k+i*ld];
521:       /* nr_o <- mynorm(A[i]'*m) */
522:       SlepcDenseMatProd(&nr0,1,0.0,1.0,&A[ld*i],ld,n,1,PETSC_TRUE,m,n,n,1,PETSC_FALSE);
523:       nr = PetscSign(PetscRealPart(nr0))*PetscSqrtReal(PetscAbsScalar(nr0));
524:       if (PetscAbs(nr) < PETSC_MACHINE_EPSILON) SETERRQ(PETSC_COMM_SELF,1,"Linear dependency detected");
525:       if (PetscAbs(nr) > 0.7*PetscAbs(nr_o)) break;
526:       nr_o = nr;
527:     }
528:     ns_[i] = PetscSign(nr);
529:     /* A[i] <- A[i]/|nr| */
530:     alpha = 1.0/PetscAbs(nr);
531:     PetscStackCallBLAS("BLASscal",BLASscal_(&rA_,&alpha,&A[i*ld],&one));
532:   }
533:   PetscLogEventEnd(DS_Other,ds,0,0,0);
534:   DSRestoreArray(ds,mat,&A_);
535:   PetscObjectStateIncrease((PetscObject)ds);
536:   if (lindcols) *lindcols = cols;
537:   return(0);
538: }
slepc-3.4.2.dfsg.orig/src/ds/interface/dsbasic.c.html0000644000175000017500000023005412211062077021313 0ustar gladkgladk
Actual source code: dsbasic.c

  1: /*
  2:    Basic DS routines

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/

 26: PetscFunctionList DSList = 0;
 27: PetscBool         DSRegisterAllCalled = PETSC_FALSE;
 28: PetscClassId      DS_CLASSID = 0;
 29: PetscLogEvent     DS_Solve = 0,DS_Function = 0,DS_Vectors = 0,DS_Other = 0;
 30: static PetscBool  DSPackageInitialized = PETSC_FALSE;
 31: const char        *DSMatName[DS_NUM_MAT] = {"A","B","C","T","D","F","Q","Z","X","Y","U","VT","W","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9"};
 32: DSMatType         DSMatExtra[DS_NUM_EXTRA] = {DS_MAT_E0,DS_MAT_E1,DS_MAT_E2,DS_MAT_E3,DS_MAT_E4,DS_MAT_E5,DS_MAT_E6,DS_MAT_E7,DS_MAT_E8,DS_MAT_E9};

 36: /*@C
 37:    DSFinalizePackage - This function destroys everything in the SLEPc interface
 38:    to the DS package. It is called from SlepcFinalize().

 40:    Level: developer

 42: .seealso: SlepcFinalize()
 43: @*/
 44: PetscErrorCode DSFinalizePackage(void)
 45: {

 49:   PetscFunctionListDestroy(&DSList);
 50:   DSPackageInitialized = PETSC_FALSE;
 51:   DSRegisterAllCalled  = PETSC_FALSE;
 52:   return(0);
 53: }

 57: /*@C
 58:   DSInitializePackage - This function initializes everything in the DS package.
 59:   It is called from PetscDLLibraryRegister() when using dynamic libraries, and
 60:   on the first call to DSCreate() when using static libraries.

 62:   Level: developer

 64: .seealso: SlepcInitialize()
 65: @*/
 66: PetscErrorCode DSInitializePackage()
 67: {
 68:   char             logList[256];
 69:   char             *className;
 70:   PetscBool        opt;
 71:   PetscErrorCode   ierr;

 74:   if (DSPackageInitialized) return(0);
 75:   DSPackageInitialized = PETSC_TRUE;
 76:   /* Register Classes */
 77:   PetscClassIdRegister("Direct solver",&DS_CLASSID);
 78:   /* Register Constructors */
 79:   DSRegisterAll();
 80:   /* Register Events */
 81:   PetscLogEventRegister("DSSolve",DS_CLASSID,&DS_Solve);
 82:   PetscLogEventRegister("DSFunction",DS_CLASSID,&DS_Function);
 83:   PetscLogEventRegister("DSVectors",DS_CLASSID,&DS_Vectors);
 84:   PetscLogEventRegister("DSOther",DS_CLASSID,&DS_Other);
 85:   /* Process info exclusions */
 86:   PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
 87:   if (opt) {
 88:     PetscStrstr(logList,"ds",&className);
 89:     if (className) {
 90:       PetscInfoDeactivateClass(DS_CLASSID);
 91:     }
 92:   }
 93:   /* Process summary exclusions */
 94:   PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
 95:   if (opt) {
 96:     PetscStrstr(logList,"ds",&className);
 97:     if (className) {
 98:       PetscLogEventDeactivateClass(DS_CLASSID);
 99:     }
100:   }
101:   PetscRegisterFinalize(DSFinalizePackage);
102:   return(0);
103: }

107: /*@C
108:    DSCreate - Creates a DS context.

110:    Collective on MPI_Comm

112:    Input Parameter:
113: .  comm - MPI communicator

115:    Output Parameter:
116: .  newds - location to put the DS context

118:    Level: beginner

120:    Note:
121:    DS objects are not intended for normal users but only for
122:    advanced user that for instance implement their own solvers.

124: .seealso: DSDestroy(), DS
125: @*/
126: PetscErrorCode DSCreate(MPI_Comm comm,DS *newds)
127: {
128:   DS             ds;
129:   PetscInt       i;

134:   *newds = 0;
135: #if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
136:   DSInitializePackage();
137: #endif

139:   SlepcHeaderCreate(ds,_p_DS,struct _DSOps,DS_CLASSID,"DS","Direct Solver (or Dense System)","DS",comm,DSDestroy,DSView);

141:   ds->state         = DS_STATE_RAW;
142:   ds->method        = 0;
143:   ds->funmethod     = 0;
144:   ds->compact       = PETSC_FALSE;
145:   ds->refined       = PETSC_FALSE;
146:   ds->extrarow      = PETSC_FALSE;
147:   ds->ld            = 0;
148:   ds->l             = 0;
149:   ds->n             = 0;
150:   ds->m             = 0;
151:   ds->k             = 0;
152:   ds->t             = 0;
153:   for (i=0;i<DS_NUM_MAT;i++) {
154:     ds->mat[i]      = NULL;
155:     ds->rmat[i]     = NULL;
156:   }
157:   ds->nf            = 0;
158:   for (i=0;i<DS_NUM_EXTRA;i++) ds->f[i] = NULL;
159:   ds->perm          = NULL;
160:   ds->work          = NULL;
161:   ds->rwork         = NULL;
162:   ds->iwork         = NULL;
163:   ds->lwork         = 0;
164:   ds->lrwork        = 0;
165:   ds->liwork        = 0;
166:   ds->comparison    = NULL;
167:   ds->comparisonctx = NULL;

169:   *newds = ds;
170:   return(0);
171: }

175: /*@C
176:    DSSetOptionsPrefix - Sets the prefix used for searching for all
177:    DS options in the database.

179:    Logically Collective on DS

181:    Input Parameters:
182: +  ds - the direct solver context
183: -  prefix - the prefix string to prepend to all DS option requests

185:    Notes:
186:    A hyphen (-) must NOT be given at the beginning of the prefix name.
187:    The first character of all runtime options is AUTOMATICALLY the
188:    hyphen.

190:    Level: advanced

192: .seealso: DSAppendOptionsPrefix()
193: @*/
194: PetscErrorCode DSSetOptionsPrefix(DS ds,const char *prefix)
195: {

200:   PetscObjectSetOptionsPrefix((PetscObject)ds,prefix);
201:   return(0);
202: }

206: /*@C
207:    DSAppendOptionsPrefix - Appends to the prefix used for searching for all
208:    DS options in the database.

210:    Logically Collective on DS

212:    Input Parameters:
213: +  ds - the direct solver context
214: -  prefix - the prefix string to prepend to all DS option requests

216:    Notes:
217:    A hyphen (-) must NOT be given at the beginning of the prefix name.
218:    The first character of all runtime options is AUTOMATICALLY the hyphen.

220:    Level: advanced

222: .seealso: DSSetOptionsPrefix()
223: @*/
224: PetscErrorCode DSAppendOptionsPrefix(DS ds,const char *prefix)
225: {

230:   PetscObjectAppendOptionsPrefix((PetscObject)ds,prefix);
231:   return(0);
232: }

236: /*@C
237:    DSGetOptionsPrefix - Gets the prefix used for searching for all
238:    DS options in the database.

240:    Not Collective

242:    Input Parameters:
243: .  ds - the direct solver context

245:    Output Parameters:
246: .  prefix - pointer to the prefix string used is returned

248:    Notes: On the fortran side, the user should pass in a string 'prefix' of
249:    sufficient length to hold the prefix.

251:    Level: advanced

253: .seealso: DSSetOptionsPrefix(), DSAppendOptionsPrefix()
254: @*/
255: PetscErrorCode DSGetOptionsPrefix(DS ds,const char *prefix[])
256: {

262:   PetscObjectGetOptionsPrefix((PetscObject)ds,prefix);
263:   return(0);
264: }

268: /*@C
269:    DSSetType - Selects the type for the DS object.

271:    Logically Collective on DS

273:    Input Parameter:
274: +  ds   - the direct solver context
275: -  type - a known type

277:    Level: intermediate

279: .seealso: DSGetType()
280: @*/
281: PetscErrorCode DSSetType(DS ds,DSType type)
282: {
283:   PetscErrorCode ierr,(*r)(DS);
284:   PetscBool      match;


290:   PetscObjectTypeCompare((PetscObject)ds,type,&match);
291:   if (match) return(0);

293:    PetscFunctionListFind(DSList,type,&r);
294:   if (!r) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested DS type %s",type);

296:   PetscMemzero(ds->ops,sizeof(struct _DSOps));

298:   PetscObjectChangeTypeName((PetscObject)ds,type);
299:   (*r)(ds);
300:   return(0);
301: }

305: /*@C
306:    DSGetType - Gets the DS type name (as a string) from the DS context.

308:    Not Collective

310:    Input Parameter:
311: .  ds - the direct solver context

313:    Output Parameter:
314: .  name - name of the direct solver

316:    Level: intermediate

318: .seealso: DSSetType()
319: @*/
320: PetscErrorCode DSGetType(DS ds,DSType *type)
321: {
325:   *type = ((PetscObject)ds)->type_name;
326:   return(0);
327: }

331: /*@
332:    DSSetMethod - Selects the method to be used to solve the problem.

334:    Logically Collective on DS

336:    Input Parameter:
337: +  ds   - the direct solver context
338: -  meth - an index indentifying the method

340:    Level: intermediate

342: .seealso: DSGetMethod()
343: @*/
344: PetscErrorCode DSSetMethod(DS ds,PetscInt meth)
345: {
349:   if (meth<0) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The method must be a non-negative integer");
350:   if (meth>DS_MAX_SOLVE) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Too large value for the method");
351:   ds->method = meth;
352:   return(0);
353: }

357: /*@
358:    DSGetMethod - Gets the method currently used in the DS.

360:    Not Collective

362:    Input Parameter:
363: .  ds - the direct solver context

365:    Output Parameter:
366: .  meth - identifier of the method

368:    Level: intermediate

370: .seealso: DSSetMethod()
371: @*/
372: PetscErrorCode DSGetMethod(DS ds,PetscInt *meth)
373: {
377:   *meth = ds->method;
378:   return(0);
379: }

383: /*@
384:    DSSetFunctionMethod - Selects the method to be used to compute a matrix function.

386:    Logically Collective on DS

388:    Input Parameter:
389: +  ds   - the direct solver context
390: -  meth - an index indentifying the function method

392:    Level: intermediate

394: .seealso: DSGetFunctionMethod()
395: @*/
396: PetscErrorCode DSSetFunctionMethod(DS ds,PetscInt meth)
397: {
401:   if (meth<0) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The method must be a non-negative integer");
402:   if (meth>DS_MAX_FUN) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Too large value for the method");
403:   ds->funmethod = meth;
404:   return(0);
405: }

409: /*@
410:    DSGetFunctionMethod - Gets the method currently used to compute a matrix function.

412:    Not Collective

414:    Input Parameter:
415: .  ds - the direct solver context

417:    Output Parameter:
418: .  meth - identifier of the function method

420:    Level: intermediate

422: .seealso: DSSetFunctionMethod()
423: @*/
424: PetscErrorCode DSGetFunctionMethod(DS ds,PetscInt *meth)
425: {
429:   *meth = ds->funmethod;
430:   return(0);
431: }

435: /*@
436:    DSSetCompact - Switch to compact storage of matrices.

438:    Logically Collective on DS

440:    Input Parameter:
441: +  ds   - the direct solver context
442: -  comp - a boolean flag

444:    Notes:
445:    Compact storage is used in some DS types such as DSHEP when the matrix
446:    is tridiagonal. This flag can be used to indicate whether the user
447:    provides the matrix entries via the compact form (the tridiagonal DS_MAT_T)
448:    or the non-compact one (DS_MAT_A).

450:    The default is PETSC_FALSE.

452:    Level: advanced

454: .seealso: DSGetCompact()
455: @*/
456: PetscErrorCode DSSetCompact(DS ds,PetscBool comp)
457: {
461:   ds->compact = comp;
462:   return(0);
463: }

467: /*@
468:    DSGetCompact - Gets the compact storage flag.

470:    Not Collective

472:    Input Parameter:
473: .  ds - the direct solver context

475:    Output Parameter:
476: .  comp - the flag

478:    Level: advanced

480: .seealso: DSSetCompact()
481: @*/
482: PetscErrorCode DSGetCompact(DS ds,PetscBool *comp)
483: {
487:   *comp = ds->compact;
488:   return(0);
489: }

493: /*@
494:    DSSetExtraRow - Sets a flag to indicate that the matrix has one extra
495:    row.

497:    Logically Collective on DS

499:    Input Parameter:
500: +  ds  - the direct solver context
501: -  ext - a boolean flag

503:    Notes:
504:    In Krylov methods it is useful that the matrix representing the direct solver
505:    has one extra row, i.e., has dimension (n+1) x n. If this flag is activated, all
506:    transformations applied to the right of the matrix also affect this additional
507:    row. In that case, (n+1) must be less or equal than the leading dimension.

509:    The default is PETSC_FALSE.

511:    Level: advanced

513: .seealso: DSSolve(), DSAllocate(), DSGetExtraRow()
514: @*/
515: PetscErrorCode DSSetExtraRow(DS ds,PetscBool ext)
516: {
520:   if (ds->n>0 && ds->n==ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Cannot set extra row after setting n=ld");
521:   ds->extrarow = ext;
522:   return(0);
523: }

527: /*@
528:    DSGetExtraRow - Gets the extra row flag.

530:    Not Collective

532:    Input Parameter:
533: .  ds - the direct solver context

535:    Output Parameter:
536: .  ext - the flag

538:    Level: advanced

540: .seealso: DSSetExtraRow()
541: @*/
542: PetscErrorCode DSGetExtraRow(DS ds,PetscBool *ext)
543: {
547:   *ext = ds->extrarow;
548:   return(0);
549: }

553: /*@
554:    DSSetRefined - Sets a flag to indicate that refined vectors must be
555:    computed.

557:    Logically Collective on DS

559:    Input Parameter:
560: +  ds  - the direct solver context
561: -  ref - a boolean flag

563:    Notes:
564:    Normally the vectors returned in DS_MAT_X are eigenvectors of the
565:    projected matrix. With this flag activated, DSVectors() will return
566:    the right singular vector of the smallest singular value of matrix
567:    \tilde{A}-theta*I, where \tilde{A} is the extended (n+1)xn matrix
568:    and theta is the Ritz value. This is used in the refined Ritz
569:    approximation.

571:    The default is PETSC_FALSE.

573:    Level: advanced

575: .seealso: DSVectors(), DSGetRefined()
576: @*/
577: PetscErrorCode DSSetRefined(DS ds,PetscBool ref)
578: {
582:   ds->refined = ref;
583:   return(0);
584: }

588: /*@
589:    DSGetRefined - Gets the refined vectors flag.

591:    Not Collective

593:    Input Parameter:
594: .  ds - the direct solver context

596:    Output Parameter:
597: .  ref - the flag

599:    Level: advanced

601: .seealso: DSSetRefined()
602: @*/
603: PetscErrorCode DSGetRefined(DS ds,PetscBool *ref)
604: {
608:   *ref = ds->refined;
609:   return(0);
610: }

614: /*@C
615:    DSSetEigenvalueComparison - Specifies the eigenvalue comparison function
616:    to be used for sorting.

618:    Logically Collective on DS

620:    Input Parameters:
621: +  ds  - the direct solver context
622: .  fun - a pointer to the comparison function
623: -  ctx - a context pointer (the last parameter to the comparison function)

625:    Calling Sequence of fun:
626: $  func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

628: +   ar     - real part of the 1st eigenvalue
629: .   ai     - imaginary part of the 1st eigenvalue
630: .   br     - real part of the 2nd eigenvalue
631: .   bi     - imaginary part of the 2nd eigenvalue
632: .   res    - result of comparison
633: -   ctx    - optional context, as set by DSSetEigenvalueComparison()

635:    Note:
636:    The returning parameter 'res' can be
637: +  negative - if the 1st eigenvalue is preferred to the 2st one
638: .  zero     - if both eigenvalues are equally preferred
639: -  positive - if the 2st eigenvalue is preferred to the 1st one

641:    Level: developer

643: .seealso: DSSort()
644: @*/
645: PetscErrorCode DSSetEigenvalueComparison(DS ds,PetscErrorCode (*fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)
646: {
649:   ds->comparison    = fun;
650:   ds->comparisonctx = ctx;
651:   return(0);
652: }

656: /*@C
657:    DSGetEigenvalueComparison - Gets the eigenvalue comparison function
658:    used for sorting.

660:    Not Collective

662:    Input Parameter:
663: .  ds  - the direct solver context

665:    Output Parameters:
666: +  fun - a pointer to the comparison function
667: -  ctx - a context pointer (the last parameter to the comparison function)

669:    Calling Sequence of fun:
670: $  func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

672: +   ar     - real part of the 1st eigenvalue
673: .   ai     - imaginary part of the 1st eigenvalue
674: .   br     - real part of the 2nd eigenvalue
675: .   bi     - imaginary part of the 2nd eigenvalue
676: .   res    - result of comparison
677: -   ctx    - optional context, as set by DSSetEigenvalueComparison()

679:    Note:
680:    The returning parameter 'res' can be
681: +  negative - if the 1st eigenvalue is preferred to the 2st one
682: .  zero     - if both eigenvalues are equally preferred
683: -  positive - if the 2st eigenvalue is preferred to the 1st one

685:    Level: developer

687: .seealso: DSSort(), DSSetEigenvalueComparison()
688: @*/
689: PetscErrorCode DSGetEigenvalueComparison(DS ds,PetscErrorCode (**fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void** ctx)
690: {
693:   if (fun) *fun = ds->comparison;
694:   if (ctx) *ctx = ds->comparisonctx;
695:   return(0);
696: }

700: /*@
701:    DSSetFN - Sets a number of functions to be used internally by DS.

703:    Collective on DS and FN

705:    Input Parameters:
706: +  ds - the direct solver context
707: .  n  - number of functions
708: -  f  - array of functions

710:    Notes:
711:    In the basic usage, only one function is used, for instance to
712:    evaluate a function of the projected matrix. In the context of nonlinear
713:    eigensolvers, there are as many functions as terms in the split
714:    nonlinear operator T(lambda) = sum_i A_i*f_i(lambda).

716:    This function must be called before DSAllocate(). Then DSAllocate()
717:    will allocate an extra matrix per each function.

719:    Level: developer

721: .seealso: DSGetFN(), DSGetFN(), DSAllocate()
722:  @*/
723: PetscErrorCode DSSetFN(DS ds,PetscInt n,FN f[])
724: {
725:   PetscInt       i;

731:   if (n<=0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Must have one or more functions, you have %D",n);
732:   if (n>DS_NUM_EXTRA) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Too many functions, you specified %D but the limit is",n,DS_NUM_EXTRA);
733:   if (ds->ld) { PetscInfo(ds,"DSSetFN() called after DSAllocate()\n"); }
736:   for (i=0;i<ds->nf;i++) {
737:     FNDestroy(&ds->f[i]);
738:   }
739:   for (i=0;i<n;i++) {
741:     PetscObjectReference((PetscObject)f[i]);
742:     ds->f[i] = f[i];
743:   }
744:   ds->nf = n;
745:   return(0);
746: }

750: /*@
751:    DSGetFN - Gets the functions associated with this DS.

753:    Not collective, though parallel FNs are returned if the DS is parallel

755:    Input Parameter:
756: +  ds - the direct olver context
757: -  k  - the index of the requested function (starting in 0)

759:    Output Parameter:
760: .  f - the function

762:    Level: developer

764: .seealso: DSSetFN()
765: @*/
766: PetscErrorCode DSGetFN(DS ds,PetscInt k,FN *f)
767: {
770:   if (k<0 || k>=ds->nf) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",ds->nf-1);
772:   *f = ds->f[k];
773:   return(0);
774: }

778: /*@
779:    DSGetNumFN - Returns the number of functions stored internally by
780:    the DS.

782:    Not collective

784:    Input Parameter:
785: .  ds - the direct solver context

787:    Output Parameters:
788: .  n - the number of functions passed in DSSetFN()

790:    Level: developer

792: .seealso: DSSetFN()
793: @*/
794: PetscErrorCode DSGetNumFN(DS ds,PetscInt *n)
795: {
799:   *n = ds->nf;
800:   return(0);
801: }

805: /*@
806:    DSSetFromOptions - Sets DS options from the options database.

808:    Collective on DS

810:    Input Parameters:
811: .  ds - the direct solver context

813:    Notes:
814:    To see all options, run your program with the -help option.

816:    Level: beginner
817: @*/
818: PetscErrorCode DSSetFromOptions(DS ds)
819: {
821:   PetscInt       meth;
822:   PetscBool      flag;

826:   if (!DSRegisterAllCalled) { DSRegisterAll(); }
827:   /* Set default type (we do not allow changing it with -ds_type) */
828:   if (!((PetscObject)ds)->type_name) {
829:     DSSetType(ds,DSNHEP);
830:   }
831:   PetscObjectOptionsBegin((PetscObject)ds);
832:     PetscOptionsInt("-ds_method","Method to be used for the dense system","DSSetMethod",ds->method,&meth,&flag);
833:     if (flag) { DSSetMethod(ds,meth); }
834:     PetscOptionsInt("-ds_function_method","Method to be used to compute a matrix function","DSSetFunctionMethod",ds->funmethod,&meth,&flag);
835:     if (flag) { DSSetFunctionMethod(ds,meth); }
836:     PetscObjectProcessOptionsHandlers((PetscObject)ds);
837:   PetscOptionsEnd();
838:   return(0);
839: }

843: /*@C
844:    DSView - Prints the DS data structure.

846:    Collective on DS

848:    Input Parameters:
849: +  ds - the direct solver context
850: -  viewer - optional visualization context

852:    Note:
853:    The available visualization contexts include
854: +     PETSC_VIEWER_STDOUT_SELF - standard output (default)
855: -     PETSC_VIEWER_STDOUT_WORLD - synchronized standard
856:          output where only the first processor opens
857:          the file.  All other processors send their
858:          data to the first processor to print.

860:    The user can open an alternative visualization context with
861:    PetscViewerASCIIOpen() - output to a specified file.

863:    Level: beginner

865: .seealso: PetscViewerASCIIOpen()
866: @*/
867: PetscErrorCode DSView(DS ds,PetscViewer viewer)
868: {
869:   PetscBool         isascii,issvd;
870:   const char        *state;
871:   PetscViewerFormat format;
872:   PetscErrorCode    ierr;

876:   if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ds));
879:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
880:   if (isascii) {
881:     PetscViewerGetFormat(viewer,&format);
882:     PetscObjectPrintClassNamePrefixType((PetscObject)ds,viewer,"DS Object");
883:     if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
884:       switch (ds->state) {
885:         case DS_STATE_RAW:          state = "raw"; break;
886:         case DS_STATE_INTERMEDIATE: state = "intermediate"; break;
887:         case DS_STATE_CONDENSED:    state = "condensed"; break;
888:         case DS_STATE_TRUNCATED:    state = "truncated"; break;
889:         default: SETERRQ(PetscObjectComm((PetscObject)ds),1,"Wrong value of ds->state");
890:       }
891:       PetscViewerASCIIPrintf(viewer,"  current state: %s\n",state);
892:       PetscObjectTypeCompare((PetscObject)ds,DSSVD,&issvd);
893:       if (issvd) {
894:         PetscViewerASCIIPrintf(viewer,"  dimensions: ld=%d, n=%d, m=%d, l=%d, k=%d",ds->ld,ds->n,ds->m,ds->l,ds->k);
895:       } else {
896:         PetscViewerASCIIPrintf(viewer,"  dimensions: ld=%d, n=%d, l=%d, k=%d",ds->ld,ds->n,ds->l,ds->k);
897:       }
898:       if (ds->state==DS_STATE_TRUNCATED) {
899:         PetscViewerASCIIPrintf(viewer,", t=%d\n",ds->t);
900:       } else {
901:         PetscViewerASCIIPrintf(viewer,"\n");
902:       }
903:       PetscViewerASCIIPrintf(viewer,"  flags:%s%s%s\n",ds->compact?" compact":"",ds->extrarow?" extrarow":"",ds->refined?" refined":"");
904:       if (ds->nf) {
905:         PetscViewerASCIIPrintf(viewer,"  number of functions: %d\n",ds->nf);
906:       }
907:     }
908:     if (ds->ops->view) {
909:       PetscViewerASCIIPushTab(viewer);
910:       (*ds->ops->view)(ds,viewer);
911:       PetscViewerASCIIPopTab(viewer);
912:     }
913:   }
914:   return(0);
915: }

919: /*@
920:    DSAllocate - Allocates memory for internal storage or matrices in DS.

922:    Logically Collective on DS

924:    Input Parameters:
925: +  ds - the direct solver context
926: -  ld - leading dimension (maximum allowed dimension for the matrices, including
927:         the extra row if present)

929:    Level: intermediate

931: .seealso: DSGetLeadingDimension(), DSSetDimensions(), DSSetExtraRow()
932: @*/
933: PetscErrorCode DSAllocate(DS ds,PetscInt ld)
934: {
936:   PetscInt       i;

941:   if (ld<1) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Leading dimension should be at least one");
942:   ds->ld = ld;
943:   (*ds->ops->allocate)(ds,ld);
944:   for (i=0;i<ds->nf;i++) {
945:     DSAllocateMat_Private(ds,DSMatExtra[i]);
946:   }
947:   return(0);
948: }

952: /*@
953:    DSReset - Resets the DS context to the initial state.

955:    Collective on DS

957:    Input Parameter:
958: .  ds - the direct solver context

960:    Level: advanced

962: .seealso: DSDestroy()
963: @*/
964: PetscErrorCode DSReset(DS ds)
965: {
966:   PetscInt       i;

971:   ds->state    = DS_STATE_RAW;
972:   ds->compact  = PETSC_FALSE;
973:   ds->refined  = PETSC_FALSE;
974:   ds->extrarow = PETSC_FALSE;
975:   ds->ld       = 0;
976:   ds->l        = 0;
977:   ds->n        = 0;
978:   ds->m        = 0;
979:   ds->k        = 0;
980:   for (i=0;i<DS_NUM_MAT;i++) {
981:     PetscFree(ds->mat[i]);
982:     PetscFree(ds->rmat[i]);
983:   }
984:   for (i=0;i<ds->nf;i++) {
985:     FNDestroy(&ds->f[i]);
986:   }
987:   ds->nf            = 0;
988:   PetscFree(ds->perm);
989:   PetscFree(ds->work);
990:   PetscFree(ds->rwork);
991:   PetscFree(ds->iwork);
992:   ds->lwork         = 0;
993:   ds->lrwork        = 0;
994:   ds->liwork        = 0;
995:   ds->comparison    = NULL;
996:   ds->comparisonctx = NULL;
997:   return(0);
998: }

1002: /*@C
1003:    DSDestroy - Destroys DS context that was created with DSCreate().

1005:    Collective on DS

1007:    Input Parameter:
1008: .  ds - the direct solver context

1010:    Level: beginner

1012: .seealso: DSCreate()
1013: @*/
1014: PetscErrorCode DSDestroy(DS *ds)
1015: {

1019:   if (!*ds) return(0);
1021:   if (--((PetscObject)(*ds))->refct > 0) { *ds = 0; return(0); }
1022:   DSReset(*ds);
1023:   PetscHeaderDestroy(ds);
1024:   return(0);
1025: }

1029: /*@C
1030:    DSRegister - Adds a direct solver to the DS package.

1032:    Not collective

1034:    Input Parameters:
1035: +  name - name of a new user-defined DS
1036: -  routine_create - routine to create context

1038:    Notes:
1039:    DSRegister() may be called multiple times to add several user-defined
1040:    direct solvers.

1042:    Level: advanced

1044: .seealso: DSRegisterAll()
1045: @*/
1046: PetscErrorCode DSRegister(const char *name,PetscErrorCode (*function)(DS))
1047: {

1051:   PetscFunctionListAdd(&DSList,name,function);
1052:   return(0);
1053: }

1055: PETSC_EXTERN PetscErrorCode DSCreate_HEP(DS);
1056: PETSC_EXTERN PetscErrorCode DSCreate_NHEP(DS);
1057: PETSC_EXTERN PetscErrorCode DSCreate_GHEP(DS);
1058: PETSC_EXTERN PetscErrorCode DSCreate_GHIEP(DS);
1059: PETSC_EXTERN PetscErrorCode DSCreate_GNHEP(DS);
1060: PETSC_EXTERN PetscErrorCode DSCreate_SVD(DS);
1061: PETSC_EXTERN PetscErrorCode DSCreate_NEP(DS);

1065: /*@C
1066:    DSRegisterAll - Registers all of the direct solvers in the DS package.

1068:    Not Collective

1070:    Level: advanced
1071: @*/
1072: PetscErrorCode DSRegisterAll(void)
1073: {

1077:   DSRegisterAllCalled = PETSC_TRUE;
1078:   DSRegister(DSHEP,DSCreate_HEP);
1079:   DSRegister(DSNHEP,DSCreate_NHEP);
1080:   DSRegister(DSGHEP,DSCreate_GHEP);
1081:   DSRegister(DSGHIEP,DSCreate_GHIEP);
1082:   DSRegister(DSGNHEP,DSCreate_GNHEP);
1083:   DSRegister(DSSVD,DSCreate_SVD);
1084:   DSRegister(DSNEP,DSCreate_NEP);
1085:   return(0);
1086: }

slepc-3.4.2.dfsg.orig/src/ds/interface/dsops.c.html0000644000175000017500000016536412211062077021046 0ustar gladkgladk
Actual source code: dsops.c

  1: /*
  2:    DS operations: DSSolve(), DSVectors(), etc

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 24: #include <slepc-private/dsimpl.h>      /*I "slepcds.h" I*/

 28: /*@
 29:    DSGetLeadingDimension - Returns the leading dimension of the allocated
 30:    matrices.

 32:    Not Collective

 34:    Input Parameter:
 35: .  ds - the direct solver context

 37:    Output Parameter:
 38: .  ld - leading dimension (maximum allowed dimension for the matrices)

 40:    Level: advanced

 42: .seealso: DSAllocate(), DSSetDimensions()
 43: @*/
 44: PetscErrorCode DSGetLeadingDimension(DS ds,PetscInt *ld)
 45: {
 48:   if (ld) *ld = ds->ld;
 49:   return(0);
 50: }

 54: /*@
 55:    DSSetState - Change the state of the DS object.

 57:    Logically Collective on DS

 59:    Input Parameters:
 60: +  ds    - the direct solver context
 61: -  state - the new state

 63:    Notes:
 64:    The state indicates that the dense system is in an initial state (raw),
 65:    in an intermediate state (such as tridiagonal, Hessenberg or
 66:    Hessenberg-triangular), in a condensed state (such as diagonal, Schur or
 67:    generalized Schur), or in a truncated state.

 69:    This function is normally used to return to the raw state when the
 70:    condensed structure is destroyed.

 72:    Level: advanced

 74: .seealso: DSGetState()
 75: @*/
 76: PetscErrorCode DSSetState(DS ds,DSStateType state)
 77: {

 83:   switch (state) {
 84:     case DS_STATE_RAW:
 85:     case DS_STATE_INTERMEDIATE:
 86:     case DS_STATE_CONDENSED:
 87:     case DS_STATE_TRUNCATED:
 88:       if (ds->state<state) { PetscInfo(ds,"DS state has been increased\n"); }
 89:       ds->state = state;
 90:       break;
 91:     default:
 92:       SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Wrong state");
 93:   }
 94:   return(0);
 95: }

 99: /*@
100:    DSGetState - Returns the current state.

102:    Not Collective

104:    Input Parameter:
105: .  ds - the direct solver context

107:    Output Parameter:
108: .  state - current state

110:    Level: advanced

112: .seealso: DSSetState()
113: @*/
114: PetscErrorCode DSGetState(DS ds,DSStateType *state)
115: {
118:   if (state) *state = ds->state;
119:   return(0);
120: }

124: /*@
125:    DSSetDimensions - Resize the matrices in the DS object.

127:    Logically Collective on DS

129:    Input Parameters:
130: +  ds - the direct solver context
131: .  n  - the new size
132: .  m  - the new column size (only for DSSVD)
133: .  l  - number of locked (inactive) leading columns
134: -  k  - intermediate dimension (e.g., position of arrow)

136:    Notes:
137:    The internal arrays are not reallocated.

139:    The value m is not used except in the case of DSSVD, pass 0 otherwise.

141:    Level: intermediate

143: .seealso: DSGetDimensions(), DSAllocate()
144: @*/
145: PetscErrorCode DSSetDimensions(DS ds,PetscInt n,PetscInt m,PetscInt l,PetscInt k)
146: {
153:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
154:   if (n) {
155:     if (n==PETSC_DECIDE || n==PETSC_DEFAULT) {
156:       ds->n = ds->ld;
157:     } else {
158:       if (n<1 || n>ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of n. Must be between 1 and ld");
159:       if (ds->extrarow && n+1>ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"A value of n equal to ld leaves no room for extra row");
160:       ds->n = n;
161:     }
162:     ds->t = ds->n;   /* truncated length equal to the new dimension */
163:   }
164:   if (m) {
165:     if (m==PETSC_DECIDE || m==PETSC_DEFAULT) {
166:       ds->m = ds->ld;
167:     } else {
168:       if (m<1 || m>ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of m. Must be between 1 and ld");
169:       ds->m = m;
170:     }
171:   }
172:   if (l==PETSC_DECIDE || l==PETSC_DEFAULT) {
173:     ds->l = 0;
174:   } else {
175:     if (l<0 || l>ds->n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of l. Must be between 0 and n");
176:     ds->l = l;
177:   }
178:   if (k==PETSC_DECIDE || k==PETSC_DEFAULT) {
179:     ds->k = ds->n/2;
180:   } else {
181:     if (k<0 || k>ds->n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of k. Must be between 0 and n");
182:     ds->k = k;
183:   }
184:   return(0);
185: }

189: /*@
190:    DSGetDimensions - Returns the current dimensions.

192:    Not Collective

194:    Input Parameter:
195: .  ds - the direct solver context

197:    Output Parameter:
198: +  n  - the current size
199: .  m  - the current column size (only for DSSVD)
200: .  l  - number of locked (inactive) leading columns
201: .  k  - intermediate dimension (e.g., position of arrow)
202: -  t  - truncated length

204:    Level: intermediate

206:    Note:
207:    The t parameter makes sense only if DSTruncate() has been called.
208:    Otherwise its value equals n.

210: .seealso: DSSetDimensions(), DSTruncate()
211: @*/
212: PetscErrorCode DSGetDimensions(DS ds,PetscInt *n,PetscInt *m,PetscInt *l,PetscInt *k,PetscInt *t)
213: {
216:   if (n) *n = ds->n;
217:   if (m) *m = ds->m;
218:   if (l) *l = ds->l;
219:   if (k) *k = ds->k;
220:   if (t) *t = ds->t;
221:   return(0);
222: }

226: /*@
227:    DSTruncate - Truncates the system represented in the DS object.

229:    Logically Collective on DS

231:    Input Parameters:
232: +  ds - the direct solver context
233: -  n  - the new size

235:    Note:
236:    The new size is set to n. In cases where the extra row is meaningful,
237:    the first n elements are kept as the extra row for the new system.

239:    Level: advanced

241: .seealso: DSSetDimensions(), DSSetExtraRow(), DSStateType
242: @*/
243: PetscErrorCode DSTruncate(DS ds,PetscInt n)
244: {

250:   if (!ds->ops->truncate) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
251:   if (ds->state<DS_STATE_CONDENSED) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSSolve() first");
252:   if (n<ds->l || n>ds->n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of n. Must be between l and n");
253:   PetscLogEventBegin(DS_Other,ds,0,0,0);
254:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
255:   (*ds->ops->truncate)(ds,n);
256:   PetscFPTrapPop();
257:   PetscLogEventEnd(DS_Other,ds,0,0,0);
258:   ds->state = DS_STATE_TRUNCATED;
259:   PetscObjectStateIncrease((PetscObject)ds);
260:   return(0);
261: }

265: /*@C
266:    DSGetArray - Returns a pointer to one of the internal arrays used to
267:    represent matrices. You MUST call DSRestoreArray() when you no longer
268:    need to access the array.

270:    Not Collective

272:    Input Parameters:
273: +  ds - the direct solver context
274: -  m - the requested matrix

276:    Output Parameter:
277: .  a - pointer to the values

279:    Level: advanced

281: .seealso: DSRestoreArray(), DSGetArrayReal()
282: @*/
283: PetscErrorCode DSGetArray(DS ds,DSMatType m,PetscScalar *a[])
284: {
288:   if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix");
289:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
290:   if (!ds->mat[m]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONGSTATE,"Requested matrix was not created in this DS");
291:   *a = ds->mat[m];
292:   CHKMEMQ;
293:   return(0);
294: }

298: /*@C
299:    DSRestoreArray - Restores the matrix after DSGetArray() was called.

301:    Not Collective

303:    Input Parameters:
304: +  ds - the direct solver context
305: .  m - the requested matrix
306: -  a - pointer to the values

308:    Level: advanced

310: .seealso: DSGetArray(), DSGetArrayReal()
311: @*/
312: PetscErrorCode DSRestoreArray(DS ds,DSMatType m,PetscScalar *a[])
313: {

319:   if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix");
320:   CHKMEMQ;
321:   *a = 0;
322:   PetscObjectStateIncrease((PetscObject)ds);
323:   return(0);
324: }

328: /*@C
329:    DSGetArrayReal - Returns a pointer to one of the internal arrays used to
330:    represent real matrices. You MUST call DSRestoreArray() when you no longer
331:    need to access the array.

333:    Not Collective

335:    Input Parameters:
336: +  ds - the direct solver context
337: -  m - the requested matrix

339:    Output Parameter:
340: .  a - pointer to the values

342:    Level: advanced

344: .seealso: DSRestoreArrayReal(), DSGetArray()
345: @*/
346: PetscErrorCode DSGetArrayReal(DS ds,DSMatType m,PetscReal *a[])
347: {
351:   if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix");
352:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
353:   if (!ds->rmat[m]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONGSTATE,"Requested matrix was not created in this DS");
354:   *a = ds->rmat[m];
355:   CHKMEMQ;
356:   return(0);
357: }

361: /*@C
362:    DSRestoreArrayReal - Restores the matrix after DSGetArrayReal() was called.

364:    Not Collective

366:    Input Parameters:
367: +  ds - the direct solver context
368: .  m - the requested matrix
369: -  a - pointer to the values

371:    Level: advanced

373: .seealso: DSGetArrayReal(), DSGetArray()
374: @*/
375: PetscErrorCode DSRestoreArrayReal(DS ds,DSMatType m,PetscReal *a[])
376: {

382:   if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix");
383:   CHKMEMQ;
384:   *a = 0;
385:   PetscObjectStateIncrease((PetscObject)ds);
386:   return(0);
387: }

391: /*@
392:    DSSolve - Solves the problem.

394:    Logically Collective on DS

396:    Input Parameters:
397: +  ds   - the direct solver context
398: .  eigr - array to store the computed eigenvalues (real part)
399: -  eigi - array to store the computed eigenvalues (imaginary part)

401:    Note:
402:    This call brings the dense system to condensed form. No ordering
403:    of the eigenvalues is enforced (for this, call DSSort() afterwards).

405:    Level: intermediate

407: .seealso: DSSort(), DSStateType
408: @*/
409: PetscErrorCode DSSolve(DS ds,PetscScalar *eigr,PetscScalar *eigi)
410: {

416:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
417:   if (ds->state>=DS_STATE_CONDENSED) return(0);
418:   if (!ds->ops->solve[ds->method]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The specified method number does not exist for this DS");
419:   PetscLogEventBegin(DS_Solve,ds,0,0,0);
420:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
421:   (*ds->ops->solve[ds->method])(ds,eigr,eigi);
422:   PetscFPTrapPop();
423:   PetscLogEventEnd(DS_Solve,ds,0,0,0);
424:   ds->state = DS_STATE_CONDENSED;
425:   PetscObjectStateIncrease((PetscObject)ds);
426:   return(0);
427: }

431: /*@
432:    DSComputeFunction - Computes a matrix function.

434:    Logically Collective on DS

436:    Input Parameters:
437: +  ds - the direct solver context
438: -  f  - the function to evaluate

440:    Note:
441:    This function evaluates F = f(A), where the input and the result matrices
442:    are stored in DS_MAT_A and DS_MAT_F, respectively.

444:    Level: intermediate

446: .seealso: DSSetFunctionMethod(), DSMatType, SlepcFunction
447: @*/
448: PetscErrorCode DSComputeFunction(DS ds,SlepcFunction f)
449: {

455:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
456:   if (!ds->ops->computefun[f][ds->funmethod]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The specified function method number does not exist for this DS");
457:   if (!ds->mat[DS_MAT_F]) { DSAllocateMat_Private(ds,DS_MAT_F); }
458:   PetscLogEventBegin(DS_Function,ds,0,0,0);
459:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
460:   (*ds->ops->computefun[f][ds->funmethod])(ds);
461:   PetscFPTrapPop();
462:   PetscLogEventEnd(DS_Function,ds,0,0,0);
463:   PetscObjectStateIncrease((PetscObject)ds);
464:   return(0);
465: }

469: /*@
470:    DSSort - Sorts the result of DSSolve() according to a given sorting
471:    criterion.

473:    Logically Collective on DS

475:    Input Parameters:
476: +  ds   - the direct solver context
477: .  eigr - array containing the computed eigenvalues (real part)
478: .  eigi - array containing the computed eigenvalues (imaginary part)
479: .  rr   - (optional) array containing auxiliary values (real part)
480: -  ri   - (optional) array containing auxiliary values (imaginary part)

482:    Input/Output Parameter:
483: .  k    - (optional) number of elements in the leading group

485:    Notes:
486:    This routine sorts the arrays provided in eigr and eigi, and also
487:    sorts the dense system stored inside ds (assumed to be in condensed form).
488:    The sorting criterion is specified with DSSetEigenvalueComparison().

490:    If arrays rr and ri are provided, then a (partial) reordering based on these
491:    values rather than on the eigenvalues is performed. In symmetric problems
492:    a total order is obtained (parameter k is ignored), but otherwise the result
493:    is sorted only partially. In this latter case, it is only guaranteed that
494:    all the first k elements satisfy the comparison with any of the last n-k
495:    elements. The output value of parameter k is the final number of elements in
496:    the first set.

498:    Level: intermediate

500: .seealso: DSSolve(), DSSetEigenvalueComparison()
501: @*/
502: PetscErrorCode DSSort(DS ds,PetscScalar *eigr,PetscScalar *eigi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
503: {

510:   if (ds->state<DS_STATE_CONDENSED) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSSolve() first");
511:   if (ds->state==DS_STATE_TRUNCATED) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Cannot sort a truncated DS");
512:   if (!ds->ops->sort) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
513:   if (!ds->comparison) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must provide a sorting criterion with DSSetEigenvalueComparison() first");
514:   if (k && !rr) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Argument k can only be used together with rr");
515:   PetscLogEventBegin(DS_Other,ds,0,0,0);
516:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
517:   (*ds->ops->sort)(ds,eigr,eigi,rr,ri,k);
518:   PetscFPTrapPop();
519:   PetscLogEventEnd(DS_Other,ds,0,0,0);
520:   PetscObjectStateIncrease((PetscObject)ds);
521:   return(0);
522: }

526: /*@
527:    DSVectors - Compute vectors associated to the dense system such
528:    as eigenvectors.

530:    Logically Collective on DS

532:    Input Parameters:
533: +  ds  - the direct solver context
534: -  mat - the matrix, used to indicate which vectors are required

536:    Input/Output Parameter:
537: -  j   - (optional) index of vector to be computed

539:    Output Parameter:
540: .  rnorm - (optional) computed residual norm

542:    Notes:
543:    Allowed values for mat are DS_MAT_X, DS_MAT_Y, DS_MAT_U and DS_MAT_VT, to
544:    compute right or left eigenvectors, or left or right singular vectors,
545:    respectively.

547:    If NULL is passed in argument j then all vectors are computed,
548:    otherwise j indicates which vector must be computed. In real non-symmetric
549:    problems, on exit the index j will be incremented when a complex conjugate
550:    pair is found.

552:    This function can be invoked after the dense problem has been solved,
553:    to get the residual norm estimate of the associated Ritz pair. In that
554:    case, the relevant information is returned in rnorm.

556:    For computing eigenvectors, LAPACK's _trevc is used so the matrix must
557:    be in (quasi-)triangular form, or call DSSolve() first.

559:    Level: intermediate

561: .seealso: DSSolve()
562: @*/
563: PetscErrorCode DSVectors(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
564: {

570:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
571:   if (!ds->ops->vectors) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
572:   if (rnorm && !j) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must give a value of j");
573:   if (!ds->mat[mat]) { DSAllocateMat_Private(ds,mat); }
574:   PetscLogEventBegin(DS_Vectors,ds,0,0,0);
575:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
576:   (*ds->ops->vectors)(ds,mat,j,rnorm);
577:   PetscFPTrapPop();
578:   PetscLogEventEnd(DS_Vectors,ds,0,0,0);
579:   PetscObjectStateIncrease((PetscObject)ds);
580:   return(0);
581: }

585: /*@
586:    DSNormalize - Normalize a column or all the columns of a matrix. Considers
587:    the case when the columns represent the real and the imaginary part of a vector.

589:    Logically Collective on DS

591:    Input Parameter:
592: +  ds  - the direct solver context
593: .  mat - the matrix to be modified
594: -  col - the column to normalize or -1 to normalize all of them

596:    Notes:
597:    The columns are normalized with respect to the 2-norm.

599:    If col and col+1 (or col-1 and col) represent the real and the imaginary
600:    part of a vector, both columns are scaled.

602:    Level: advanced

604: .seealso: DSMatType
605: @*/
606: PetscErrorCode DSNormalize(DS ds,DSMatType mat,PetscInt col)
607: {

614:   if (ds->state<DS_STATE_CONDENSED) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSSolve() first");
615:   if (!ds->ops->normalize) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
616:   if (col<-1) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"col should be at least minus one");
617:   PetscLogEventBegin(DS_Other,ds,0,0,0);
618:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
619:   (*ds->ops->normalize)(ds,mat,col);
620:   PetscFPTrapPop();
621:   PetscLogEventEnd(DS_Other,ds,0,0,0);
622:   return(0);
623: }

627: /*@C
628:    DSUpdateExtraRow - Performs all necessary operations so that the extra
629:    row gets up-to-date after a call to DSSolve().

631:    Not Collective

633:    Input Parameters:
634: .  ds - the direct solver context

636:    Level: advanced

638: .seealso: DSSolve(), DSSetExtraRow()
639: @*/
640: PetscErrorCode DSUpdateExtraRow(DS ds)
641: {

646:   if (!ds->ops->update) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
647:   if (!ds->extrarow) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONGSTATE,"Should have called DSSetExtraRow");
648:   if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first");
649:   PetscLogEventBegin(DS_Other,ds,0,0,0);
650:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
651:   (*ds->ops->update)(ds);
652:   PetscFPTrapPop();
653:   PetscLogEventEnd(DS_Other,ds,0,0,0);
654:   return(0);
655: }

659: /*@C
660:    DSCond - Compute the inf-norm condition number of the first matrix
661:    as cond(A) = norm(A)*norm(inv(A)).

663:    Not Collective

665:    Input Parameters:
666: +  ds - the direct solver context
667: -  cond - the computed condition number

669:    Level: advanced

671: .seealso: DSSolve()
672: @*/
673: PetscErrorCode DSCond(DS ds,PetscReal *cond)
674: {

680:   if (!ds->ops->cond) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
681:   PetscLogEventBegin(DS_Other,ds,0,0,0);
682:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
683:   (*ds->ops->cond)(ds,cond);
684:   PetscFPTrapPop();
685:   PetscLogEventEnd(DS_Other,ds,0,0,0);
686:   return(0);
687: }

691: /*@C
692:    DSTranslateHarmonic - Computes a translation of the dense system.

694:    Logically Collective on DS

696:    Input Parameters:
697: +  ds      - the direct solver context
698: .  tau     - the translation amount
699: .  beta    - last component of vector b
700: -  recover - boolean flag to indicate whether to recover or not

702:    Output Parameters:
703: +  g       - the computed vector (optional)
704: -  gamma   - scale factor (optional)

706:    Notes:
707:    This function is intended for use in the context of Krylov methods only.
708:    It computes a translation of a Krylov decomposition in order to extract
709:    eigenpair approximations by harmonic Rayleigh-Ritz.
710:    The matrix is updated as A + g*b' where g = (A-tau*eye(n))'\b and
711:    vector b is assumed to be beta*e_n^T.

713:    The gamma factor is defined as sqrt(1+g'*g) and can be interpreted as
714:    the factor by which the residual of the Krylov decomposition is scaled.

716:    If the recover flag is activated, the computed translation undoes the
717:    translation done previously. In that case, parameter tau is ignored.

719:    Level: developer
720: @*/
721: PetscErrorCode DSTranslateHarmonic(DS ds,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *g,PetscReal *gamma)
722: {

727:   if (!ds->ops->transharm) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
728:   PetscLogEventBegin(DS_Other,ds,0,0,0);
729:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
730:   (*ds->ops->transharm)(ds,tau,beta,recover,g,gamma);
731:   PetscFPTrapPop();
732:   PetscLogEventEnd(DS_Other,ds,0,0,0);
733:   ds->state = DS_STATE_RAW;
734:   PetscObjectStateIncrease((PetscObject)ds);
735:   return(0);
736: }

740: /*@C
741:    DSTranslateRKS - Computes a modification of the dense system corresponding
742:    to an update of the shift in a rational Krylov method.

744:    Logically Collective on DS

746:    Input Parameters:
747: +  ds    - the direct solver context
748: -  alpha - the translation amount

750:    Notes:
751:    This function is intended for use in the context of Krylov methods only.
752:    It takes the leading (k+1,k) submatrix of A, containing the truncated
753:    Rayleigh quotient of a Krylov-Schur relation computed from a shift
754:    sigma1 and transforms it to obtain a Krylov relation as if computed
755:    from a different shift sigma2. The new matrix is computed as
756:    1.0/alpha*(eye(k)-Q*inv(R)), where [Q,R]=qr(eye(k)-alpha*A) and
757:    alpha = sigma1-sigma2.

759:    Matrix Q is placed in DS_MAT_Q so that it can be used to update the
760:    Krylov basis.

762:    Level: developer
763: @*/
764: PetscErrorCode DSTranslateRKS(DS ds,PetscScalar alpha)
765: {

770:   if (!ds->ops->transrks) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name);
771:   PetscLogEventBegin(DS_Other,ds,0,0,0);
772:   PetscFPTrapPush(PETSC_FP_TRAP_OFF);
773:   (*ds->ops->transrks)(ds,alpha);
774:   PetscFPTrapPop();
775:   PetscLogEventEnd(DS_Other,ds,0,0,0);
776:   ds->state   = DS_STATE_RAW;
777:   ds->compact = PETSC_FALSE;
778:   PetscObjectStateIncrease((PetscObject)ds);
779:   return(0);
780: }

slepc-3.4.2.dfsg.orig/src/ds/interface/dsops.c0000644000175000017500000006314012211062077020070 0ustar gladkgladk/* DS operations: DSSolve(), DSVectors(), etc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #undef __FUNCT__ #define __FUNCT__ "DSGetLeadingDimension" /*@ DSGetLeadingDimension - Returns the leading dimension of the allocated matrices. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . ld - leading dimension (maximum allowed dimension for the matrices) Level: advanced .seealso: DSAllocate(), DSSetDimensions() @*/ PetscErrorCode DSGetLeadingDimension(DS ds,PetscInt *ld) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (ld) *ld = ds->ld; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetState" /*@ DSSetState - Change the state of the DS object. Logically Collective on DS Input Parameters: + ds - the direct solver context - state - the new state Notes: The state indicates that the dense system is in an initial state (raw), in an intermediate state (such as tridiagonal, Hessenberg or Hessenberg-triangular), in a condensed state (such as diagonal, Schur or generalized Schur), or in a truncated state. This function is normally used to return to the raw state when the condensed structure is destroyed. Level: advanced .seealso: DSGetState() @*/ PetscErrorCode DSSetState(DS ds,DSStateType state) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveEnum(ds,state,2); switch (state) { case DS_STATE_RAW: case DS_STATE_INTERMEDIATE: case DS_STATE_CONDENSED: case DS_STATE_TRUNCATED: if (ds->statestate = state; break; default: SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Wrong state"); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetState" /*@ DSGetState - Returns the current state. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . state - current state Level: advanced .seealso: DSSetState() @*/ PetscErrorCode DSGetState(DS ds,DSStateType *state) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (state) *state = ds->state; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetDimensions" /*@ DSSetDimensions - Resize the matrices in the DS object. Logically Collective on DS Input Parameters: + ds - the direct solver context . n - the new size . m - the new column size (only for DSSVD) . l - number of locked (inactive) leading columns - k - intermediate dimension (e.g., position of arrow) Notes: The internal arrays are not reallocated. The value m is not used except in the case of DSSVD, pass 0 otherwise. Level: intermediate .seealso: DSGetDimensions(), DSAllocate() @*/ PetscErrorCode DSSetDimensions(DS ds,PetscInt n,PetscInt m,PetscInt l,PetscInt k) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,n,2); PetscValidLogicalCollectiveInt(ds,m,3); PetscValidLogicalCollectiveInt(ds,l,4); PetscValidLogicalCollectiveInt(ds,k,5); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); if (n) { if (n==PETSC_DECIDE || n==PETSC_DEFAULT) { ds->n = ds->ld; } else { if (n<1 || n>ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of n. Must be between 1 and ld"); if (ds->extrarow && n+1>ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"A value of n equal to ld leaves no room for extra row"); ds->n = n; } ds->t = ds->n; /* truncated length equal to the new dimension */ } if (m) { if (m==PETSC_DECIDE || m==PETSC_DEFAULT) { ds->m = ds->ld; } else { if (m<1 || m>ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of m. Must be between 1 and ld"); ds->m = m; } } if (l==PETSC_DECIDE || l==PETSC_DEFAULT) { ds->l = 0; } else { if (l<0 || l>ds->n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of l. Must be between 0 and n"); ds->l = l; } if (k==PETSC_DECIDE || k==PETSC_DEFAULT) { ds->k = ds->n/2; } else { if (k<0 || k>ds->n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of k. Must be between 0 and n"); ds->k = k; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetDimensions" /*@ DSGetDimensions - Returns the current dimensions. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: + n - the current size . m - the current column size (only for DSSVD) . l - number of locked (inactive) leading columns . k - intermediate dimension (e.g., position of arrow) - t - truncated length Level: intermediate Note: The t parameter makes sense only if DSTruncate() has been called. Otherwise its value equals n. .seealso: DSSetDimensions(), DSTruncate() @*/ PetscErrorCode DSGetDimensions(DS ds,PetscInt *n,PetscInt *m,PetscInt *l,PetscInt *k,PetscInt *t) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (n) *n = ds->n; if (m) *m = ds->m; if (l) *l = ds->l; if (k) *k = ds->k; if (t) *t = ds->t; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSTruncate" /*@ DSTruncate - Truncates the system represented in the DS object. Logically Collective on DS Input Parameters: + ds - the direct solver context - n - the new size Note: The new size is set to n. In cases where the extra row is meaningful, the first n elements are kept as the extra row for the new system. Level: advanced .seealso: DSSetDimensions(), DSSetExtraRow(), DSStateType @*/ PetscErrorCode DSTruncate(DS ds,PetscInt n) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,n,2); if (!ds->ops->truncate) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); if (ds->statel || n>ds->n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of n. Must be between l and n"); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->truncate)(ds,n);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); ds->state = DS_STATE_TRUNCATED; ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetArray" /*@C DSGetArray - Returns a pointer to one of the internal arrays used to represent matrices. You MUST call DSRestoreArray() when you no longer need to access the array. Not Collective Input Parameters: + ds - the direct solver context - m - the requested matrix Output Parameter: . a - pointer to the values Level: advanced .seealso: DSRestoreArray(), DSGetArrayReal() @*/ PetscErrorCode DSGetArray(DS ds,DSMatType m,PetscScalar *a[]) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(a,2); if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix"); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); if (!ds->mat[m]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONGSTATE,"Requested matrix was not created in this DS"); *a = ds->mat[m]; CHKMEMQ; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSRestoreArray" /*@C DSRestoreArray - Restores the matrix after DSGetArray() was called. Not Collective Input Parameters: + ds - the direct solver context . m - the requested matrix - a - pointer to the values Level: advanced .seealso: DSGetArray(), DSGetArrayReal() @*/ PetscErrorCode DSRestoreArray(DS ds,DSMatType m,PetscScalar *a[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(a,2); if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix"); CHKMEMQ; *a = 0; ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetArrayReal" /*@C DSGetArrayReal - Returns a pointer to one of the internal arrays used to represent real matrices. You MUST call DSRestoreArray() when you no longer need to access the array. Not Collective Input Parameters: + ds - the direct solver context - m - the requested matrix Output Parameter: . a - pointer to the values Level: advanced .seealso: DSRestoreArrayReal(), DSGetArray() @*/ PetscErrorCode DSGetArrayReal(DS ds,DSMatType m,PetscReal *a[]) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(a,2); if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix"); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); if (!ds->rmat[m]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONGSTATE,"Requested matrix was not created in this DS"); *a = ds->rmat[m]; CHKMEMQ; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSRestoreArrayReal" /*@C DSRestoreArrayReal - Restores the matrix after DSGetArrayReal() was called. Not Collective Input Parameters: + ds - the direct solver context . m - the requested matrix - a - pointer to the values Level: advanced .seealso: DSGetArrayReal(), DSGetArray() @*/ PetscErrorCode DSRestoreArrayReal(DS ds,DSMatType m,PetscReal *a[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(a,2); if (m<0 || m>=DS_NUM_MAT) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid matrix"); CHKMEMQ; *a = 0; ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSolve" /*@ DSSolve - Solves the problem. Logically Collective on DS Input Parameters: + ds - the direct solver context . eigr - array to store the computed eigenvalues (real part) - eigi - array to store the computed eigenvalues (imaginary part) Note: This call brings the dense system to condensed form. No ordering of the eigenvalues is enforced (for this, call DSSort() afterwards). Level: intermediate .seealso: DSSort(), DSStateType @*/ PetscErrorCode DSSolve(DS ds,PetscScalar *eigr,PetscScalar *eigi) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(eigr,2); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); if (ds->state>=DS_STATE_CONDENSED) PetscFunctionReturn(0); if (!ds->ops->solve[ds->method]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The specified method number does not exist for this DS"); ierr = PetscLogEventBegin(DS_Solve,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->solve[ds->method])(ds,eigr,eigi);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Solve,ds,0,0,0);CHKERRQ(ierr); ds->state = DS_STATE_CONDENSED; ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSComputeFunction" /*@ DSComputeFunction - Computes a matrix function. Logically Collective on DS Input Parameters: + ds - the direct solver context - f - the function to evaluate Note: This function evaluates F = f(A), where the input and the result matrices are stored in DS_MAT_A and DS_MAT_F, respectively. Level: intermediate .seealso: DSSetFunctionMethod(), DSMatType, SlepcFunction @*/ PetscErrorCode DSComputeFunction(DS ds,SlepcFunction f) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveEnum(ds,f,2); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); if (!ds->ops->computefun[f][ds->funmethod]) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The specified function method number does not exist for this DS"); if (!ds->mat[DS_MAT_F]) { ierr = DSAllocateMat_Private(ds,DS_MAT_F);CHKERRQ(ierr); } ierr = PetscLogEventBegin(DS_Function,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->computefun[f][ds->funmethod])(ds);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Function,ds,0,0,0);CHKERRQ(ierr); ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSort" /*@ DSSort - Sorts the result of DSSolve() according to a given sorting criterion. Logically Collective on DS Input Parameters: + ds - the direct solver context . eigr - array containing the computed eigenvalues (real part) . eigi - array containing the computed eigenvalues (imaginary part) . rr - (optional) array containing auxiliary values (real part) - ri - (optional) array containing auxiliary values (imaginary part) Input/Output Parameter: . k - (optional) number of elements in the leading group Notes: This routine sorts the arrays provided in eigr and eigi, and also sorts the dense system stored inside ds (assumed to be in condensed form). The sorting criterion is specified with DSSetEigenvalueComparison(). If arrays rr and ri are provided, then a (partial) reordering based on these values rather than on the eigenvalues is performed. In symmetric problems a total order is obtained (parameter k is ignored), but otherwise the result is sorted only partially. In this latter case, it is only guaranteed that all the first k elements satisfy the comparison with any of the last n-k elements. The output value of parameter k is the final number of elements in the first set. Level: intermediate .seealso: DSSolve(), DSSetEigenvalueComparison() @*/ PetscErrorCode DSSort(DS ds,PetscScalar *eigr,PetscScalar *eigi,PetscScalar *rr,PetscScalar *ri,PetscInt *k) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(eigr,2); if (rr) PetscValidPointer(rr,4); if (ds->statestate==DS_STATE_TRUNCATED) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Cannot sort a truncated DS"); if (!ds->ops->sort) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); if (!ds->comparison) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must provide a sorting criterion with DSSetEigenvalueComparison() first"); if (k && !rr) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Argument k can only be used together with rr"); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->sort)(ds,eigr,eigi,rr,ri,k);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSVectors" /*@ DSVectors - Compute vectors associated to the dense system such as eigenvectors. Logically Collective on DS Input Parameters: + ds - the direct solver context - mat - the matrix, used to indicate which vectors are required Input/Output Parameter: - j - (optional) index of vector to be computed Output Parameter: . rnorm - (optional) computed residual norm Notes: Allowed values for mat are DS_MAT_X, DS_MAT_Y, DS_MAT_U and DS_MAT_VT, to compute right or left eigenvectors, or left or right singular vectors, respectively. If NULL is passed in argument j then all vectors are computed, otherwise j indicates which vector must be computed. In real non-symmetric problems, on exit the index j will be incremented when a complex conjugate pair is found. This function can be invoked after the dense problem has been solved, to get the residual norm estimate of the associated Ritz pair. In that case, the relevant information is returned in rnorm. For computing eigenvectors, LAPACK's _trevc is used so the matrix must be in (quasi-)triangular form, or call DSSolve() first. Level: intermediate .seealso: DSSolve() @*/ PetscErrorCode DSVectors(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveEnum(ds,mat,2); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); if (!ds->ops->vectors) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); if (rnorm && !j) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must give a value of j"); if (!ds->mat[mat]) { ierr = DSAllocateMat_Private(ds,mat);CHKERRQ(ierr); } ierr = PetscLogEventBegin(DS_Vectors,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->vectors)(ds,mat,j,rnorm);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Vectors,ds,0,0,0);CHKERRQ(ierr); ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSNormalize" /*@ DSNormalize - Normalize a column or all the columns of a matrix. Considers the case when the columns represent the real and the imaginary part of a vector. Logically Collective on DS Input Parameter: + ds - the direct solver context . mat - the matrix to be modified - col - the column to normalize or -1 to normalize all of them Notes: The columns are normalized with respect to the 2-norm. If col and col+1 (or col-1 and col) represent the real and the imaginary part of a vector, both columns are scaled. Level: advanced .seealso: DSMatType @*/ PetscErrorCode DSNormalize(DS ds,DSMatType mat,PetscInt col) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,mat,2); PetscValidLogicalCollectiveInt(ds,col,3); if (ds->stateops->normalize) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); if (col<-1) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"col should be at least minus one"); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->normalize)(ds,mat,col);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSUpdateExtraRow" /*@C DSUpdateExtraRow - Performs all necessary operations so that the extra row gets up-to-date after a call to DSSolve(). Not Collective Input Parameters: . ds - the direct solver context Level: advanced .seealso: DSSolve(), DSSetExtraRow() @*/ PetscErrorCode DSUpdateExtraRow(DS ds) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (!ds->ops->update) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); if (!ds->extrarow) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONGSTATE,"Should have called DSSetExtraRow"); if (!ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Must call DSAllocate() first"); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->update)(ds);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSCond" /*@C DSCond - Compute the inf-norm condition number of the first matrix as cond(A) = norm(A)*norm(inv(A)). Not Collective Input Parameters: + ds - the direct solver context - cond - the computed condition number Level: advanced .seealso: DSSolve() @*/ PetscErrorCode DSCond(DS ds,PetscReal *cond) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(cond,2); if (!ds->ops->cond) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->cond)(ds,cond);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSTranslateHarmonic" /*@C DSTranslateHarmonic - Computes a translation of the dense system. Logically Collective on DS Input Parameters: + ds - the direct solver context . tau - the translation amount . beta - last component of vector b - recover - boolean flag to indicate whether to recover or not Output Parameters: + g - the computed vector (optional) - gamma - scale factor (optional) Notes: This function is intended for use in the context of Krylov methods only. It computes a translation of a Krylov decomposition in order to extract eigenpair approximations by harmonic Rayleigh-Ritz. The matrix is updated as A + g*b' where g = (A-tau*eye(n))'\b and vector b is assumed to be beta*e_n^T. The gamma factor is defined as sqrt(1+g'*g) and can be interpreted as the factor by which the residual of the Krylov decomposition is scaled. If the recover flag is activated, the computed translation undoes the translation done previously. In that case, parameter tau is ignored. Level: developer @*/ PetscErrorCode DSTranslateHarmonic(DS ds,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *g,PetscReal *gamma) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (!ds->ops->transharm) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->transharm)(ds,tau,beta,recover,g,gamma);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); ds->state = DS_STATE_RAW; ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSTranslateRKS" /*@C DSTranslateRKS - Computes a modification of the dense system corresponding to an update of the shift in a rational Krylov method. Logically Collective on DS Input Parameters: + ds - the direct solver context - alpha - the translation amount Notes: This function is intended for use in the context of Krylov methods only. It takes the leading (k+1,k) submatrix of A, containing the truncated Rayleigh quotient of a Krylov-Schur relation computed from a shift sigma1 and transforms it to obtain a Krylov relation as if computed from a different shift sigma2. The new matrix is computed as 1.0/alpha*(eye(k)-Q*inv(R)), where [Q,R]=qr(eye(k)-alpha*A) and alpha = sigma1-sigma2. Matrix Q is placed in DS_MAT_Q so that it can be used to update the Krylov basis. Level: developer @*/ PetscErrorCode DSTranslateRKS(DS ds,PetscScalar alpha) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (!ds->ops->transrks) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_SUP,"DS type %s",((PetscObject)ds)->type_name); ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); ierr = (*ds->ops->transrks)(ds,alpha);CHKERRQ(ierr); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); ds->state = DS_STATE_RAW; ds->compact = PETSC_FALSE; ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/interface/dspriv.c0000644000175000017500000004356512211062077020260 0ustar gladkgladk/* Private DS routines - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ #include #undef __FUNCT__ #define __FUNCT__ "DSAllocateMat_Private" PetscErrorCode DSAllocateMat_Private(DS ds,DSMatType m) { PetscInt sz; PetscErrorCode ierr; PetscFunctionBegin; if (m==DS_MAT_T) sz = 3*ds->ld*sizeof(PetscScalar); else if (m==DS_MAT_D) sz = ds->ld*sizeof(PetscScalar); else sz = ds->ld*ds->ld*sizeof(PetscScalar); if (ds->mat[m]) { ierr = PetscFree(ds->mat[m]);CHKERRQ(ierr); } else { ierr = PetscLogObjectMemory(ds,sz);CHKERRQ(ierr); } ierr = PetscMalloc(sz,&ds->mat[m]);CHKERRQ(ierr); ierr = PetscMemzero(ds->mat[m],sz);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSAllocateMatReal_Private" PetscErrorCode DSAllocateMatReal_Private(DS ds,DSMatType m) { PetscInt sz; PetscErrorCode ierr; PetscFunctionBegin; if (m==DS_MAT_T) sz = 3*ds->ld*sizeof(PetscReal); else if (m==DS_MAT_D) sz = ds->ld*sizeof(PetscReal); else sz = ds->ld*ds->ld*sizeof(PetscReal); if (!ds->rmat[m]) { ierr = PetscLogObjectMemory(ds,sz);CHKERRQ(ierr); ierr = PetscMalloc(sz,&ds->rmat[m]);CHKERRQ(ierr); } ierr = PetscMemzero(ds->rmat[m],sz);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSAllocateWork_Private" PetscErrorCode DSAllocateWork_Private(DS ds,PetscInt s,PetscInt r,PetscInt i) { PetscErrorCode ierr; PetscFunctionBegin; if (s>ds->lwork) { ierr = PetscFree(ds->work);CHKERRQ(ierr); ierr = PetscMalloc(s*sizeof(PetscScalar),&ds->work);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,(s-ds->lwork)*sizeof(PetscScalar));CHKERRQ(ierr); ds->lwork = s; } if (r>ds->lrwork) { ierr = PetscFree(ds->rwork);CHKERRQ(ierr); ierr = PetscMalloc(r*sizeof(PetscReal),&ds->rwork);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,(r-ds->lrwork)*sizeof(PetscReal));CHKERRQ(ierr); ds->lrwork = r; } if (i>ds->liwork) { ierr = PetscFree(ds->iwork);CHKERRQ(ierr); ierr = PetscMalloc(i*sizeof(PetscBLASInt),&ds->iwork);CHKERRQ(ierr); ierr = PetscLogObjectMemory(ds,(i-ds->liwork)*sizeof(PetscBLASInt));CHKERRQ(ierr); ds->liwork = i; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSViewMat_Private" PetscErrorCode DSViewMat_Private(DS ds,PetscViewer viewer,DSMatType m) { PetscErrorCode ierr; PetscInt i,j,rows,cols; PetscScalar *v; PetscViewerFormat format; #if defined(PETSC_USE_COMPLEX) PetscBool allreal = PETSC_TRUE; #endif PetscFunctionBegin; ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) PetscFunctionReturn(0); ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr); if (ds->state==DS_STATE_TRUNCATED && m>=DS_MAT_Q) rows = ds->t; else rows = (m==DS_MAT_A && ds->extrarow)? ds->n+1: ds->n; cols = (ds->m!=0)? ds->m: ds->n; #if defined(PETSC_USE_COMPLEX) /* determine if matrix has all real values */ v = ds->mat[m]; for (i=0;ild])) { allreal = PETSC_FALSE; break; } #endif if (format == PETSC_VIEWER_ASCII_MATLAB) { ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D\n",rows,cols);CHKERRQ(ierr); ierr = PetscViewerASCIIPrintf(viewer,"%s = [\n",DSMatName[m]);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer,"Matrix %s =\n",DSMatName[m]);CHKERRQ(ierr); } for (i=0;imat[m]+i; for (j=0;jld; } ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } if (format == PETSC_VIEWER_ASCII_MATLAB) { ierr = PetscViewerASCIIPrintf(viewer,"];\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr); ierr = PetscViewerFlush(viewer);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSortEigenvalues_Private" PetscErrorCode DSSortEigenvalues_Private(DS ds,PetscScalar *wr,PetscScalar *wi,PetscInt *perm,PetscBool isghiep) { PetscErrorCode ierr; PetscScalar re,im,wi0; PetscInt n,i,j,result,tmp1,tmp2=0,d=1; PetscFunctionBegin; n = ds->t; /* sort only first t pairs if truncated */ for (i=0;in;i++) perm[i] = i; /* insertion sort */ i=ds->l+1; #if !defined(PETSC_USE_COMPLEX) if (wi && wi[perm[i-1]]!=0.0) i++; /* initial value is complex */ #else if (isghiep && PetscImaginaryPart(wr[perm[i-1]])!=0.0) i++; #endif for (;icomparison)(re,im,wr[perm[j]],wi0,&result,ds->comparisonctx);CHKERRQ(ierr); while (result<0 && j>=ds->l) { perm[j+d] = perm[j]; j--; #if !defined(PETSC_USE_COMPLEX) if (wi && wi[perm[j+1]]!=0) #else if (isghiep && PetscImaginaryPart(wr[perm[j+1]])!=0) #endif { perm[j+d] = perm[j]; j--; } if (j>=ds->l) { if (wi) wi0 = wi[perm[j]]; else wi0 = 0.0; ierr = (*ds->comparison)(re,im,wr[perm[j]],wi0,&result,ds->comparisonctx);CHKERRQ(ierr); } } perm[j+1] = tmp1; if (d==2) perm[j+2] = tmp2; } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSortEigenvaluesReal_Private" PetscErrorCode DSSortEigenvaluesReal_Private(DS ds,PetscReal *eig,PetscInt *perm) { PetscErrorCode ierr; PetscScalar re; PetscInt i,j,result,tmp,l,n; PetscFunctionBegin; n = ds->t; /* sort only first t pairs if truncated */ l = ds->l; for (i=0;icomparison)(re,0.0,eig[perm[j]],0.0,&result,ds->comparisonctx);CHKERRQ(ierr); while (result<0 && j>=l) { tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; j--; if (j>=l) { ierr = (*ds->comparison)(re,0.0,eig[perm[j]],0.0,&result,ds->comparisonctx);CHKERRQ(ierr); } } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSCopyMatrix_Private" /* DSCopyMatrix_Private - Copies the trailing block of a matrix (from rows/columns l to n). */ PetscErrorCode DSCopyMatrix_Private(DS ds,DSMatType dst,DSMatType src) { PetscErrorCode ierr; PetscInt j,m,off,ld; PetscScalar *S,*D; PetscFunctionBegin; ld = ds->ld; m = ds->n-ds->l; off = ds->l+ds->l*ld; S = ds->mat[src]; D = ds->mat[dst]; for (j=0;jld; Q = ds->mat[mat]; for (i=l;im,k,p,ld; PetscScalar *Q,rtmp; PetscFunctionBegin; if (!m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set"); ld = ds->ld; Q = ds->mat[mat]; for (i=l;im,k,p,ld; PetscScalar *U,*VT,rtmp; PetscFunctionBegin; if (!m) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"m was not set"); ld = ds->ld; U = ds->mat[mat1]; VT = ds->mat[mat2]; for (i=l;inf;i++) { if (deriv) { ierr = FNEvaluateDerivative(ds->f[i],lambda,&alpha);CHKERRQ(ierr); } else { ierr = FNEvaluateFunction(ds->f[i],lambda,&alpha);CHKERRQ(ierr); } E = ds->mat[DSMatExtra[i]]; PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&k,&alpha,E,&inc,T,&inc)); } ierr = DSRestoreArray(ds,mat,&T);CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSOrthogonalize" /* DSOrthogonalize - Orthogonalize the columns of a matrix. Input Parameters: + ds - the direct solver context . mat - a matrix - cols - number of columns to orthogonalize (starting from the column zero) Output Parameter: . lindcols - number of linearly independent columns of the matrix (can be NULL) */ PetscErrorCode DSOrthogonalize(DS ds,DSMatType mat,PetscInt cols,PetscInt *lindcols) { #if defined(PETSC_MISSING_LAPACK_GEQRF) || defined(SLEPC_MISSING_LAPACK_ORGQR) PetscFunctionBegin; SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"GEQRF/ORGQR - Lapack routine is unavailable"); #else PetscErrorCode ierr; PetscInt n,l,ld; PetscBLASInt ld_,rA,cA,info,ltau,lw; PetscScalar *A,*tau,*w,saux; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveEnum(ds,mat,2); PetscValidLogicalCollectiveInt(ds,cols,3); ierr = DSGetDimensions(ds,&n,NULL,&l,NULL,NULL);CHKERRQ(ierr); ierr = DSGetLeadingDimension(ds,&ld);CHKERRQ(ierr); n = n - l; if (cols > n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid number of columns"); if (n == 0 || cols == 0) PetscFunctionReturn(0); ierr = DSGetArray(ds,mat,&A);CHKERRQ(ierr); ierr = PetscBLASIntCast(PetscMin(cols,n),<au);CHKERRQ(ierr); ierr = PetscBLASIntCast(ld,&ld_);CHKERRQ(ierr); ierr = PetscBLASIntCast(n,&rA);CHKERRQ(ierr); ierr = PetscBLASIntCast(cols,&cA);CHKERRQ(ierr); lw = -1; PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&rA,&cA,A,&ld_,NULL,&saux,&lw,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGEQRF %d",info); lw = (PetscBLASInt)PetscRealPart(saux); ierr = DSAllocateWork_Private(ds,lw+ltau,0,0);CHKERRQ(ierr); tau = ds->work; w = &tau[ltau]; ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr); PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&rA,&cA,&A[ld*l+l],&ld_,tau,w,&lw,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xGEQRF %d",info); PetscStackCallBLAS("LAPACKorgqr",LAPACKorgqr_(&rA,<au,<au,&A[ld*l+l],&ld_,tau,w,&lw,&info)); if (info) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in Lapack xORGQR %d",info); ierr = PetscFPTrapPop();CHKERRQ(ierr); ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = DSRestoreArray(ds,mat,&A);CHKERRQ(ierr); ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); if (lindcols) *lindcols = ltau; PetscFunctionReturn(0); #endif } #undef __FUNCT__ #define __FUNCT__ "DSPseudoOrthogonalize" /* DSPseudoOrthogonalize - Orthogonalize the columns of a matrix with Modified Gram-Schmidt in an indefinite inner product space defined by a signature. Input Parameters: + ds - the direct solver context . mat - the matrix . cols - number of columns to orthogonalize (starting from the column zero) - s - the signature that defines the inner product Output Parameter: + lindcols - linear independent columns of the matrix (can be NULL) - ns - the new norm of the vectors (can be NULL) */ PetscErrorCode DSPseudoOrthogonalize(DS ds,DSMatType mat,PetscInt cols,PetscReal *s,PetscInt *lindcols,PetscReal *ns) { PetscErrorCode ierr; PetscInt i,j,k,l,n,ld; PetscBLASInt one=1,rA_; PetscScalar alpha,*A,*A_,*m,*h,nr0; PetscReal nr_o,nr,*ns_; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveEnum(ds,mat,2); PetscValidLogicalCollectiveInt(ds,cols,3); PetscValidScalarPointer(s,4); if (ns) PetscValidPointer(ns,6); ierr = DSGetDimensions(ds,&n,NULL,&l,NULL,NULL);CHKERRQ(ierr); ierr = DSGetLeadingDimension(ds,&ld);CHKERRQ(ierr); n = n - l; if (cols > n) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_WRONG,"Invalid number of columns"); if (n == 0 || cols == 0) PetscFunctionReturn(0); ierr = PetscBLASIntCast(n,&rA_);CHKERRQ(ierr); ierr = DSGetArray(ds,mat,&A_);CHKERRQ(ierr); A = &A_[ld*l+l]; ierr = DSAllocateWork_Private(ds,n+cols,ns?0:cols,0);CHKERRQ(ierr); m = ds->work; h = &m[n]; ns_ = ns ? ns : ds->rwork; ierr = PetscLogEventBegin(DS_Other,ds,0,0,0);CHKERRQ(ierr); for (i=0; i0; j++) { /* h <- A[0:i-1]'*m */ ierr = SlepcDenseMatProd(h,i,0.0,1.0,A,ld,n,i,PETSC_TRUE,m,n,n,1,PETSC_FALSE);CHKERRQ(ierr); /* h <- diag(ns)*h */ for (k=0; k 0.7*PetscAbs(nr_o)) break; nr_o = nr; } ns_[i] = PetscSign(nr); /* A[i] <- A[i]/|nr| */ alpha = 1.0/PetscAbs(nr); PetscStackCallBLAS("BLASscal",BLASscal_(&rA_,&alpha,&A[i*ld],&one)); } ierr = PetscLogEventEnd(DS_Other,ds,0,0,0);CHKERRQ(ierr); ierr = DSRestoreArray(ds,mat,&A_);CHKERRQ(ierr); ierr = PetscObjectStateIncrease((PetscObject)ds);CHKERRQ(ierr); if (lindcols) *lindcols = cols; PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/interface/makefile0000644000175000017500000000215412211062077020272 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: lib CFLAGS = FFLAGS = SOURCEC = dsbasic.c dsops.c dspriv.c SOURCEF = SOURCEH = LIBBASE = libslepc DIRS = MANSEC = DS LOCDIR = src/ds/interface/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/interface/makefile.html0000644000175000017500000000374512211062077021244 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

ALL: lib

CFLAGS   =
FFLAGS   =
SOURCEC  = dsbasic.c dsops.c dspriv.c
SOURCEF  =
SOURCEH  =
LIBBASE  = libslepc
DIRS     =
MANSEC   = DS
LOCDIR   = src/ds/interface/

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/src/ds/interface/index.html0000644000175000017500000000137012211062077020566 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

dsbasic.c
dsops.c
dspriv.c
makefile
slepc-3.4.2.dfsg.orig/src/ds/interface/ftn-custom/0000755000175000017500000000000012214143515020667 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/interface/ftn-custom/makefile0000644000175000017500000000217212211062077022371 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = zpsf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/ds/interface/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/interface/ftn-custom/zpsf.c0000644000175000017500000000540412211062077022020 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include #include #if defined(PETSC_HAVE_FORTRAN_CAPS) #define dscreate_ DSCREATE #define dsdestroy_ DSDESTROY #define dssetoptionsprefix_ DSSETOPTIONSPREFIX #define dsappendoptionsprefix_ DSAPPENDOPTIONSPREFIX #define dsgetoptionsprefix_ DSGETOPTIONSPREFIX #define dsview_ DSVIEW #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define dscreate_ dscreate #define dsdestroy_ dsdestroy #define dssetoptionsprefix_ dssetoptionsprefix #define dsappendoptionsprefix_ dsappendoptionsprefix #define dsgetoptionsprefix_ dsgetoptionsprefix #define dsview_ dsview #endif PETSC_EXTERN void PETSC_STDCALL dscreate_(MPI_Fint *comm,DS *newds,PetscErrorCode *ierr) { *ierr = DSCreate(MPI_Comm_f2c(*(comm)),newds); } PETSC_EXTERN void PETSC_STDCALL dsdestroy_(DS *ds,PetscErrorCode *ierr) { *ierr = DSDestroy(ds); } PETSC_EXTERN void PETSC_STDCALL dssetoptionsprefix_(DS *ds,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = DSSetOptionsPrefix(*ds,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL dsappendoptionsprefix_(DS *ds,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { char *t; FIXCHAR(prefix,len,t); *ierr = DSAppendOptionsPrefix(*ds,t); FREECHAR(prefix,t); } PETSC_EXTERN void PETSC_STDCALL dsgetoptionsprefix_(DS *ds,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len)) { const char *tname; *ierr = DSGetOptionsPrefix(*ds,&tname); if (*ierr) return; *ierr = PetscStrncpy(prefix,tname,len); } PETSC_EXTERN void PETSC_STDCALL dsview_(DS *ds,PetscViewer *viewer,PetscErrorCode *ierr) { PetscViewer v; PetscPatchDefaultViewers_Fortran(viewer,v); *ierr = DSView(*ds,v); } slepc-3.4.2.dfsg.orig/src/ds/interface/ftn-auto/0000755000175000017500000000000012214143515020325 5ustar gladkgladkslepc-3.4.2.dfsg.orig/src/ds/interface/ftn-auto/dsbasicf.c0000644000175000017500000001257712211062077022263 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* dsbasic.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcds.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetmethod_ DSSETMETHOD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetmethod_ dssetmethod #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetmethod_ DSGETMETHOD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetmethod_ dsgetmethod #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetfunctionmethod_ DSSETFUNCTIONMETHOD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetfunctionmethod_ dssetfunctionmethod #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetfunctionmethod_ DSGETFUNCTIONMETHOD #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetfunctionmethod_ dsgetfunctionmethod #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetcompact_ DSSETCOMPACT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetcompact_ dssetcompact #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetcompact_ DSGETCOMPACT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetcompact_ dsgetcompact #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetextrarow_ DSSETEXTRAROW #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetextrarow_ dssetextrarow #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetextrarow_ DSGETEXTRAROW #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetextrarow_ dsgetextrarow #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetrefined_ DSSETREFINED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetrefined_ dssetrefined #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetrefined_ DSGETREFINED #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetrefined_ dsgetrefined #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetfn_ DSSETFN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetfn_ dssetfn #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetfn_ DSGETFN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetfn_ dsgetfn #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetnumfn_ DSGETNUMFN #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetnumfn_ dsgetnumfn #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetfromoptions_ DSSETFROMOPTIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetfromoptions_ dssetfromoptions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsallocate_ DSALLOCATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsallocate_ dsallocate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsreset_ DSRESET #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsreset_ dsreset #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL dssetmethod_(DS *ds,PetscInt *meth, int *__ierr ){ *__ierr = DSSetMethod(*ds,*meth); } void PETSC_STDCALL dsgetmethod_(DS *ds,PetscInt *meth, int *__ierr ){ *__ierr = DSGetMethod(*ds,meth); } void PETSC_STDCALL dssetfunctionmethod_(DS *ds,PetscInt *meth, int *__ierr ){ *__ierr = DSSetFunctionMethod(*ds,*meth); } void PETSC_STDCALL dsgetfunctionmethod_(DS *ds,PetscInt *meth, int *__ierr ){ *__ierr = DSGetFunctionMethod(*ds,meth); } void PETSC_STDCALL dssetcompact_(DS *ds,PetscBool *comp, int *__ierr ){ *__ierr = DSSetCompact(*ds,*comp); } void PETSC_STDCALL dsgetcompact_(DS *ds,PetscBool *comp, int *__ierr ){ *__ierr = DSGetCompact(*ds,comp); } void PETSC_STDCALL dssetextrarow_(DS *ds,PetscBool *ext, int *__ierr ){ *__ierr = DSSetExtraRow(*ds,*ext); } void PETSC_STDCALL dsgetextrarow_(DS *ds,PetscBool *ext, int *__ierr ){ *__ierr = DSGetExtraRow(*ds,ext); } void PETSC_STDCALL dssetrefined_(DS *ds,PetscBool *ref, int *__ierr ){ *__ierr = DSSetRefined(*ds,*ref); } void PETSC_STDCALL dsgetrefined_(DS *ds,PetscBool *ref, int *__ierr ){ *__ierr = DSGetRefined(*ds,ref); } void PETSC_STDCALL dssetfn_(DS *ds,PetscInt *n,FN f[], int *__ierr ){ *__ierr = DSSetFN(*ds,*n, (FN* )PetscToPointer((f) )); } void PETSC_STDCALL dsgetfn_(DS *ds,PetscInt *k,FN *f, int *__ierr ){ *__ierr = DSGetFN(*ds,*k, (FN* )PetscToPointer((f) )); } void PETSC_STDCALL dsgetnumfn_(DS *ds,PetscInt *n, int *__ierr ){ *__ierr = DSGetNumFN(*ds,n); } void PETSC_STDCALL dssetfromoptions_(DS *ds, int *__ierr ){ *__ierr = DSSetFromOptions(*ds); } void PETSC_STDCALL dsallocate_(DS *ds,PetscInt *ld, int *__ierr ){ *__ierr = DSAllocate(*ds,*ld); } void PETSC_STDCALL dsreset_(DS *ds, int *__ierr ){ *__ierr = DSReset(*ds); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ds/interface/ftn-auto/makefile0000644000175000017500000000035212211062077022025 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = dsbasicf.c dsopsf.c SOURCEF = SOURCEH = DIRS = LIBBASE = libslepc LOCDIR = src/ds/interface/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/src/ds/interface/ftn-auto/dsopsf.c0000644000175000017500000001026712211062077021775 0ustar gladkgladk#include "petscsys.h" #include "petscfix.h" #include "petsc-private/fortranimpl.h" /* dsops.c */ /* Fortran interface file */ /* * This file was generated automatically by bfort from the C source * file. */ #ifdef PETSC_USE_POINTER_CONVERSION #if defined(__cplusplus) extern "C" { #endif extern void *PetscToPointer(void*); extern int PetscFromPointer(void *); extern void PetscRmPointer(void*); #if defined(__cplusplus) } #endif #else #define PetscToPointer(a) (*(long *)(a)) #define PetscFromPointer(a) (long)(a) #define PetscRmPointer(a) #endif #include "slepcds.h" #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetleadingdimension_ DSGETLEADINGDIMENSION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetleadingdimension_ dsgetleadingdimension #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetstate_ DSSETSTATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetstate_ dssetstate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetstate_ DSGETSTATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetstate_ dsgetstate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssetdimensions_ DSSETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssetdimensions_ dssetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsgetdimensions_ DSGETDIMENSIONS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsgetdimensions_ dsgetdimensions #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dstruncate_ DSTRUNCATE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dstruncate_ dstruncate #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssolve_ DSSOLVE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssolve_ dssolve #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dscomputefunction_ DSCOMPUTEFUNCTION #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dscomputefunction_ dscomputefunction #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dssort_ DSSORT #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dssort_ dssort #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsvectors_ DSVECTORS #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsvectors_ dsvectors #endif #ifdef PETSC_HAVE_FORTRAN_CAPS #define dsnormalize_ DSNORMALIZE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) && !defined(FORTRANDOUBLEUNDERSCORE) #define dsnormalize_ dsnormalize #endif /* Definitions of Fortran Wrapper routines */ #if defined(__cplusplus) extern "C" { #endif void PETSC_STDCALL dsgetleadingdimension_(DS *ds,PetscInt *ld, int *__ierr ){ *__ierr = DSGetLeadingDimension(*ds,ld); } void PETSC_STDCALL dssetstate_(DS *ds,DSStateType *state, int *__ierr ){ *__ierr = DSSetState(*ds,*state); } void PETSC_STDCALL dsgetstate_(DS *ds,DSStateType *state, int *__ierr ){ *__ierr = DSGetState(*ds, (DSStateType* )PetscToPointer((state) )); } void PETSC_STDCALL dssetdimensions_(DS *ds,PetscInt *n,PetscInt *m,PetscInt *l,PetscInt *k, int *__ierr ){ *__ierr = DSSetDimensions(*ds,*n,*m,*l,*k); } void PETSC_STDCALL dsgetdimensions_(DS *ds,PetscInt *n,PetscInt *m,PetscInt *l,PetscInt *k,PetscInt *t, int *__ierr ){ *__ierr = DSGetDimensions(*ds,n,m,l,k,t); } void PETSC_STDCALL dstruncate_(DS *ds,PetscInt *n, int *__ierr ){ *__ierr = DSTruncate(*ds,*n); } void PETSC_STDCALL dssolve_(DS *ds,PetscScalar *eigr,PetscScalar *eigi, int *__ierr ){ *__ierr = DSSolve(*ds,eigr,eigi); } void PETSC_STDCALL dscomputefunction_(DS *ds,SlepcFunction *f, int *__ierr ){ *__ierr = DSComputeFunction(*ds,*f); } void PETSC_STDCALL dssort_(DS *ds,PetscScalar *eigr,PetscScalar *eigi,PetscScalar *rr,PetscScalar *ri,PetscInt *k, int *__ierr ){ *__ierr = DSSort(*ds,eigr,eigi,rr,ri,k); } void PETSC_STDCALL dsvectors_(DS *ds,DSMatType *mat,PetscInt *j,PetscReal *rnorm, int *__ierr ){ *__ierr = DSVectors(*ds,*mat,j,rnorm); } void PETSC_STDCALL dsnormalize_(DS *ds,DSMatType *mat,PetscInt *col, int *__ierr ){ *__ierr = DSNormalize(*ds,*mat,*col); } #if defined(__cplusplus) } #endif slepc-3.4.2.dfsg.orig/src/ds/interface/dsbasic.c0000644000175000017500000007350412211062077020355 0ustar gladkgladk/* Basic DS routines - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include /*I "slepcds.h" I*/ PetscFunctionList DSList = 0; PetscBool DSRegisterAllCalled = PETSC_FALSE; PetscClassId DS_CLASSID = 0; PetscLogEvent DS_Solve = 0,DS_Function = 0,DS_Vectors = 0,DS_Other = 0; static PetscBool DSPackageInitialized = PETSC_FALSE; const char *DSMatName[DS_NUM_MAT] = {"A","B","C","T","D","F","Q","Z","X","Y","U","VT","W","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9"}; DSMatType DSMatExtra[DS_NUM_EXTRA] = {DS_MAT_E0,DS_MAT_E1,DS_MAT_E2,DS_MAT_E3,DS_MAT_E4,DS_MAT_E5,DS_MAT_E6,DS_MAT_E7,DS_MAT_E8,DS_MAT_E9}; #undef __FUNCT__ #define __FUNCT__ "DSFinalizePackage" /*@C DSFinalizePackage - This function destroys everything in the SLEPc interface to the DS package. It is called from SlepcFinalize(). Level: developer .seealso: SlepcFinalize() @*/ PetscErrorCode DSFinalizePackage(void) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListDestroy(&DSList);CHKERRQ(ierr); DSPackageInitialized = PETSC_FALSE; DSRegisterAllCalled = PETSC_FALSE; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSInitializePackage" /*@C DSInitializePackage - This function initializes everything in the DS package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to DSCreate() when using static libraries. Level: developer .seealso: SlepcInitialize() @*/ PetscErrorCode DSInitializePackage() { char logList[256]; char *className; PetscBool opt; PetscErrorCode ierr; PetscFunctionBegin; if (DSPackageInitialized) PetscFunctionReturn(0); DSPackageInitialized = PETSC_TRUE; /* Register Classes */ ierr = PetscClassIdRegister("Direct solver",&DS_CLASSID);CHKERRQ(ierr); /* Register Constructors */ ierr = DSRegisterAll();CHKERRQ(ierr); /* Register Events */ ierr = PetscLogEventRegister("DSSolve",DS_CLASSID,&DS_Solve);CHKERRQ(ierr); ierr = PetscLogEventRegister("DSFunction",DS_CLASSID,&DS_Function);CHKERRQ(ierr); ierr = PetscLogEventRegister("DSVectors",DS_CLASSID,&DS_Vectors);CHKERRQ(ierr); ierr = PetscLogEventRegister("DSOther",DS_CLASSID,&DS_Other);CHKERRQ(ierr); /* Process info exclusions */ ierr = PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"ds",&className);CHKERRQ(ierr); if (className) { ierr = PetscInfoDeactivateClass(DS_CLASSID);CHKERRQ(ierr); } } /* Process summary exclusions */ ierr = PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr); if (opt) { ierr = PetscStrstr(logList,"ds",&className);CHKERRQ(ierr); if (className) { ierr = PetscLogEventDeactivateClass(DS_CLASSID);CHKERRQ(ierr); } } ierr = PetscRegisterFinalize(DSFinalizePackage);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSCreate" /*@C DSCreate - Creates a DS context. Collective on MPI_Comm Input Parameter: . comm - MPI communicator Output Parameter: . newds - location to put the DS context Level: beginner Note: DS objects are not intended for normal users but only for advanced user that for instance implement their own solvers. .seealso: DSDestroy(), DS @*/ PetscErrorCode DSCreate(MPI_Comm comm,DS *newds) { DS ds; PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; PetscValidPointer(newds,2); *newds = 0; #if !defined(PETSC_USE_DYNAMIC_LIBRARIES) ierr = DSInitializePackage();CHKERRQ(ierr); #endif ierr = SlepcHeaderCreate(ds,_p_DS,struct _DSOps,DS_CLASSID,"DS","Direct Solver (or Dense System)","DS",comm,DSDestroy,DSView);CHKERRQ(ierr); ds->state = DS_STATE_RAW; ds->method = 0; ds->funmethod = 0; ds->compact = PETSC_FALSE; ds->refined = PETSC_FALSE; ds->extrarow = PETSC_FALSE; ds->ld = 0; ds->l = 0; ds->n = 0; ds->m = 0; ds->k = 0; ds->t = 0; for (i=0;imat[i] = NULL; ds->rmat[i] = NULL; } ds->nf = 0; for (i=0;if[i] = NULL; ds->perm = NULL; ds->work = NULL; ds->rwork = NULL; ds->iwork = NULL; ds->lwork = 0; ds->lrwork = 0; ds->liwork = 0; ds->comparison = NULL; ds->comparisonctx = NULL; *newds = ds; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetOptionsPrefix" /*@C DSSetOptionsPrefix - Sets the prefix used for searching for all DS options in the database. Logically Collective on DS Input Parameters: + ds - the direct solver context - prefix - the prefix string to prepend to all DS option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: DSAppendOptionsPrefix() @*/ PetscErrorCode DSSetOptionsPrefix(DS ds,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); ierr = PetscObjectSetOptionsPrefix((PetscObject)ds,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSAppendOptionsPrefix" /*@C DSAppendOptionsPrefix - Appends to the prefix used for searching for all DS options in the database. Logically Collective on DS Input Parameters: + ds - the direct solver context - prefix - the prefix string to prepend to all DS option requests Notes: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. Level: advanced .seealso: DSSetOptionsPrefix() @*/ PetscErrorCode DSAppendOptionsPrefix(DS ds,const char *prefix) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); ierr = PetscObjectAppendOptionsPrefix((PetscObject)ds,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetOptionsPrefix" /*@C DSGetOptionsPrefix - Gets the prefix used for searching for all DS options in the database. Not Collective Input Parameters: . ds - the direct solver context Output Parameters: . prefix - pointer to the prefix string used is returned Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix. Level: advanced .seealso: DSSetOptionsPrefix(), DSAppendOptionsPrefix() @*/ PetscErrorCode DSGetOptionsPrefix(DS ds,const char *prefix[]) { PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(prefix,2); ierr = PetscObjectGetOptionsPrefix((PetscObject)ds,prefix);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetType" /*@C DSSetType - Selects the type for the DS object. Logically Collective on DS Input Parameter: + ds - the direct solver context - type - a known type Level: intermediate .seealso: DSGetType() @*/ PetscErrorCode DSSetType(DS ds,DSType type) { PetscErrorCode ierr,(*r)(DS); PetscBool match; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidCharPointer(type,2); ierr = PetscObjectTypeCompare((PetscObject)ds,type,&match);CHKERRQ(ierr); if (match) PetscFunctionReturn(0); ierr = PetscFunctionListFind(DSList,type,&r);CHKERRQ(ierr); if (!r) SETERRQ1(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_UNKNOWN_TYPE,"Unable to find requested DS type %s",type); ierr = PetscMemzero(ds->ops,sizeof(struct _DSOps));CHKERRQ(ierr); ierr = PetscObjectChangeTypeName((PetscObject)ds,type);CHKERRQ(ierr); ierr = (*r)(ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetType" /*@C DSGetType - Gets the DS type name (as a string) from the DS context. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . name - name of the direct solver Level: intermediate .seealso: DSSetType() @*/ PetscErrorCode DSGetType(DS ds,DSType *type) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(type,2); *type = ((PetscObject)ds)->type_name; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetMethod" /*@ DSSetMethod - Selects the method to be used to solve the problem. Logically Collective on DS Input Parameter: + ds - the direct solver context - meth - an index indentifying the method Level: intermediate .seealso: DSGetMethod() @*/ PetscErrorCode DSSetMethod(DS ds,PetscInt meth) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,meth,2); if (meth<0) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The method must be a non-negative integer"); if (meth>DS_MAX_SOLVE) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Too large value for the method"); ds->method = meth; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetMethod" /*@ DSGetMethod - Gets the method currently used in the DS. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . meth - identifier of the method Level: intermediate .seealso: DSSetMethod() @*/ PetscErrorCode DSGetMethod(DS ds,PetscInt *meth) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(meth,2); *meth = ds->method; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetFunctionMethod" /*@ DSSetFunctionMethod - Selects the method to be used to compute a matrix function. Logically Collective on DS Input Parameter: + ds - the direct solver context - meth - an index indentifying the function method Level: intermediate .seealso: DSGetFunctionMethod() @*/ PetscErrorCode DSSetFunctionMethod(DS ds,PetscInt meth) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,meth,2); if (meth<0) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"The method must be a non-negative integer"); if (meth>DS_MAX_FUN) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Too large value for the method"); ds->funmethod = meth; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetFunctionMethod" /*@ DSGetFunctionMethod - Gets the method currently used to compute a matrix function. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . meth - identifier of the function method Level: intermediate .seealso: DSSetFunctionMethod() @*/ PetscErrorCode DSGetFunctionMethod(DS ds,PetscInt *meth) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(meth,2); *meth = ds->funmethod; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetCompact" /*@ DSSetCompact - Switch to compact storage of matrices. Logically Collective on DS Input Parameter: + ds - the direct solver context - comp - a boolean flag Notes: Compact storage is used in some DS types such as DSHEP when the matrix is tridiagonal. This flag can be used to indicate whether the user provides the matrix entries via the compact form (the tridiagonal DS_MAT_T) or the non-compact one (DS_MAT_A). The default is PETSC_FALSE. Level: advanced .seealso: DSGetCompact() @*/ PetscErrorCode DSSetCompact(DS ds,PetscBool comp) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveBool(ds,comp,2); ds->compact = comp; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetCompact" /*@ DSGetCompact - Gets the compact storage flag. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . comp - the flag Level: advanced .seealso: DSSetCompact() @*/ PetscErrorCode DSGetCompact(DS ds,PetscBool *comp) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(comp,2); *comp = ds->compact; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetExtraRow" /*@ DSSetExtraRow - Sets a flag to indicate that the matrix has one extra row. Logically Collective on DS Input Parameter: + ds - the direct solver context - ext - a boolean flag Notes: In Krylov methods it is useful that the matrix representing the direct solver has one extra row, i.e., has dimension (n+1) x n. If this flag is activated, all transformations applied to the right of the matrix also affect this additional row. In that case, (n+1) must be less or equal than the leading dimension. The default is PETSC_FALSE. Level: advanced .seealso: DSSolve(), DSAllocate(), DSGetExtraRow() @*/ PetscErrorCode DSSetExtraRow(DS ds,PetscBool ext) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveBool(ds,ext,2); if (ds->n>0 && ds->n==ds->ld) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ORDER,"Cannot set extra row after setting n=ld"); ds->extrarow = ext; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetExtraRow" /*@ DSGetExtraRow - Gets the extra row flag. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . ext - the flag Level: advanced .seealso: DSSetExtraRow() @*/ PetscErrorCode DSGetExtraRow(DS ds,PetscBool *ext) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(ext,2); *ext = ds->extrarow; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetRefined" /*@ DSSetRefined - Sets a flag to indicate that refined vectors must be computed. Logically Collective on DS Input Parameter: + ds - the direct solver context - ref - a boolean flag Notes: Normally the vectors returned in DS_MAT_X are eigenvectors of the projected matrix. With this flag activated, DSVectors() will return the right singular vector of the smallest singular value of matrix \tilde{A}-theta*I, where \tilde{A} is the extended (n+1)xn matrix and theta is the Ritz value. This is used in the refined Ritz approximation. The default is PETSC_FALSE. Level: advanced .seealso: DSVectors(), DSGetRefined() @*/ PetscErrorCode DSSetRefined(DS ds,PetscBool ref) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveBool(ds,ref,2); ds->refined = ref; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetRefined" /*@ DSGetRefined - Gets the refined vectors flag. Not Collective Input Parameter: . ds - the direct solver context Output Parameter: . ref - the flag Level: advanced .seealso: DSSetRefined() @*/ PetscErrorCode DSGetRefined(DS ds,PetscBool *ref) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(ref,2); *ref = ds->refined; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetEigenvalueComparison" /*@C DSSetEigenvalueComparison - Specifies the eigenvalue comparison function to be used for sorting. Logically Collective on DS Input Parameters: + ds - the direct solver context . fun - a pointer to the comparison function - ctx - a context pointer (the last parameter to the comparison function) Calling Sequence of fun: $ func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx) + ar - real part of the 1st eigenvalue . ai - imaginary part of the 1st eigenvalue . br - real part of the 2nd eigenvalue . bi - imaginary part of the 2nd eigenvalue . res - result of comparison - ctx - optional context, as set by DSSetEigenvalueComparison() Note: The returning parameter 'res' can be + negative - if the 1st eigenvalue is preferred to the 2st one . zero - if both eigenvalues are equally preferred - positive - if the 2st eigenvalue is preferred to the 1st one Level: developer .seealso: DSSort() @*/ PetscErrorCode DSSetEigenvalueComparison(DS ds,PetscErrorCode (*fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); ds->comparison = fun; ds->comparisonctx = ctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetEigenvalueComparison" /*@C DSGetEigenvalueComparison - Gets the eigenvalue comparison function used for sorting. Not Collective Input Parameter: . ds - the direct solver context Output Parameters: + fun - a pointer to the comparison function - ctx - a context pointer (the last parameter to the comparison function) Calling Sequence of fun: $ func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx) + ar - real part of the 1st eigenvalue . ai - imaginary part of the 1st eigenvalue . br - real part of the 2nd eigenvalue . bi - imaginary part of the 2nd eigenvalue . res - result of comparison - ctx - optional context, as set by DSSetEigenvalueComparison() Note: The returning parameter 'res' can be + negative - if the 1st eigenvalue is preferred to the 2st one . zero - if both eigenvalues are equally preferred - positive - if the 2st eigenvalue is preferred to the 1st one Level: developer .seealso: DSSort(), DSSetEigenvalueComparison() @*/ PetscErrorCode DSGetEigenvalueComparison(DS ds,PetscErrorCode (**fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void** ctx) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (fun) *fun = ds->comparison; if (ctx) *ctx = ds->comparisonctx; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetFN" /*@ DSSetFN - Sets a number of functions to be used internally by DS. Collective on DS and FN Input Parameters: + ds - the direct solver context . n - number of functions - f - array of functions Notes: In the basic usage, only one function is used, for instance to evaluate a function of the projected matrix. In the context of nonlinear eigensolvers, there are as many functions as terms in the split nonlinear operator T(lambda) = sum_i A_i*f_i(lambda). This function must be called before DSAllocate(). Then DSAllocate() will allocate an extra matrix per each function. Level: developer .seealso: DSGetFN(), DSGetFN(), DSAllocate() @*/ PetscErrorCode DSSetFN(DS ds,PetscInt n,FN f[]) { PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,n,2); if (n<=0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Must have one or more functions, you have %D",n); if (n>DS_NUM_EXTRA) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Too many functions, you specified %D but the limit is",n,DS_NUM_EXTRA); if (ds->ld) { ierr = PetscInfo(ds,"DSSetFN() called after DSAllocate()\n");CHKERRQ(ierr); } PetscValidPointer(f,3); PetscCheckSameComm(ds,1,*f,3); for (i=0;inf;i++) { ierr = FNDestroy(&ds->f[i]);CHKERRQ(ierr); } for (i=0;if[i] = f[i]; } ds->nf = n; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetFN" /*@ DSGetFN - Gets the functions associated with this DS. Not collective, though parallel FNs are returned if the DS is parallel Input Parameter: + ds - the direct olver context - k - the index of the requested function (starting in 0) Output Parameter: . f - the function Level: developer .seealso: DSSetFN() @*/ PetscErrorCode DSGetFN(DS ds,PetscInt k,FN *f) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (k<0 || k>=ds->nf) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"k must be between 0 and %d",ds->nf-1); PetscValidPointer(f,3); *f = ds->f[k]; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSGetNumFN" /*@ DSGetNumFN - Returns the number of functions stored internally by the DS. Not collective Input Parameter: . ds - the direct solver context Output Parameters: . n - the number of functions passed in DSSetFN() Level: developer .seealso: DSSetFN() @*/ PetscErrorCode DSGetNumFN(DS ds,PetscInt *n) { PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidPointer(n,2); *n = ds->nf; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSSetFromOptions" /*@ DSSetFromOptions - Sets DS options from the options database. Collective on DS Input Parameters: . ds - the direct solver context Notes: To see all options, run your program with the -help option. Level: beginner @*/ PetscErrorCode DSSetFromOptions(DS ds) { PetscErrorCode ierr; PetscInt meth; PetscBool flag; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (!DSRegisterAllCalled) { ierr = DSRegisterAll();CHKERRQ(ierr); } /* Set default type (we do not allow changing it with -ds_type) */ if (!((PetscObject)ds)->type_name) { ierr = DSSetType(ds,DSNHEP);CHKERRQ(ierr); } ierr = PetscObjectOptionsBegin((PetscObject)ds);CHKERRQ(ierr); ierr = PetscOptionsInt("-ds_method","Method to be used for the dense system","DSSetMethod",ds->method,&meth,&flag);CHKERRQ(ierr); if (flag) { ierr = DSSetMethod(ds,meth);CHKERRQ(ierr); } ierr = PetscOptionsInt("-ds_function_method","Method to be used to compute a matrix function","DSSetFunctionMethod",ds->funmethod,&meth,&flag);CHKERRQ(ierr); if (flag) { ierr = DSSetFunctionMethod(ds,meth);CHKERRQ(ierr); } ierr = PetscObjectProcessOptionsHandlers((PetscObject)ds);CHKERRQ(ierr); ierr = PetscOptionsEnd();CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSView" /*@C DSView - Prints the DS data structure. Collective on DS Input Parameters: + ds - the direct solver context - viewer - optional visualization context Note: The available visualization contexts include + PETSC_VIEWER_STDOUT_SELF - standard output (default) - PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print. The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file. Level: beginner .seealso: PetscViewerASCIIOpen() @*/ PetscErrorCode DSView(DS ds,PetscViewer viewer) { PetscBool isascii,issvd; const char *state; PetscViewerFormat format; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); if (!viewer) viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)ds)); PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2); PetscCheckSameComm(ds,1,viewer,2); ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr); if (isascii) { ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr); ierr = PetscObjectPrintClassNamePrefixType((PetscObject)ds,viewer,"DS Object");CHKERRQ(ierr); if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) { switch (ds->state) { case DS_STATE_RAW: state = "raw"; break; case DS_STATE_INTERMEDIATE: state = "intermediate"; break; case DS_STATE_CONDENSED: state = "condensed"; break; case DS_STATE_TRUNCATED: state = "truncated"; break; default: SETERRQ(PetscObjectComm((PetscObject)ds),1,"Wrong value of ds->state"); } ierr = PetscViewerASCIIPrintf(viewer," current state: %s\n",state);CHKERRQ(ierr); ierr = PetscObjectTypeCompare((PetscObject)ds,DSSVD,&issvd);CHKERRQ(ierr); if (issvd) { ierr = PetscViewerASCIIPrintf(viewer," dimensions: ld=%d, n=%d, m=%d, l=%d, k=%d",ds->ld,ds->n,ds->m,ds->l,ds->k);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer," dimensions: ld=%d, n=%d, l=%d, k=%d",ds->ld,ds->n,ds->l,ds->k);CHKERRQ(ierr); } if (ds->state==DS_STATE_TRUNCATED) { ierr = PetscViewerASCIIPrintf(viewer,", t=%d\n",ds->t);CHKERRQ(ierr); } else { ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr); } ierr = PetscViewerASCIIPrintf(viewer," flags:%s%s%s\n",ds->compact?" compact":"",ds->extrarow?" extrarow":"",ds->refined?" refined":"");CHKERRQ(ierr); if (ds->nf) { ierr = PetscViewerASCIIPrintf(viewer," number of functions: %d\n",ds->nf);CHKERRQ(ierr); } } if (ds->ops->view) { ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); ierr = (*ds->ops->view)(ds,viewer);CHKERRQ(ierr); ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); } } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSAllocate" /*@ DSAllocate - Allocates memory for internal storage or matrices in DS. Logically Collective on DS Input Parameters: + ds - the direct solver context - ld - leading dimension (maximum allowed dimension for the matrices, including the extra row if present) Level: intermediate .seealso: DSGetLeadingDimension(), DSSetDimensions(), DSSetExtraRow() @*/ PetscErrorCode DSAllocate(DS ds,PetscInt ld) { PetscErrorCode ierr; PetscInt i; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); PetscValidLogicalCollectiveInt(ds,ld,2); if (ld<1) SETERRQ(PetscObjectComm((PetscObject)ds),PETSC_ERR_ARG_OUTOFRANGE,"Leading dimension should be at least one"); ds->ld = ld; ierr = (*ds->ops->allocate)(ds,ld);CHKERRQ(ierr); for (i=0;inf;i++) { ierr = DSAllocateMat_Private(ds,DSMatExtra[i]);CHKERRQ(ierr); } PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSReset" /*@ DSReset - Resets the DS context to the initial state. Collective on DS Input Parameter: . ds - the direct solver context Level: advanced .seealso: DSDestroy() @*/ PetscErrorCode DSReset(DS ds) { PetscInt i; PetscErrorCode ierr; PetscFunctionBegin; PetscValidHeaderSpecific(ds,DS_CLASSID,1); ds->state = DS_STATE_RAW; ds->compact = PETSC_FALSE; ds->refined = PETSC_FALSE; ds->extrarow = PETSC_FALSE; ds->ld = 0; ds->l = 0; ds->n = 0; ds->m = 0; ds->k = 0; for (i=0;imat[i]);CHKERRQ(ierr); ierr = PetscFree(ds->rmat[i]);CHKERRQ(ierr); } for (i=0;inf;i++) { ierr = FNDestroy(&ds->f[i]);CHKERRQ(ierr); } ds->nf = 0; ierr = PetscFree(ds->perm);CHKERRQ(ierr); ierr = PetscFree(ds->work);CHKERRQ(ierr); ierr = PetscFree(ds->rwork);CHKERRQ(ierr); ierr = PetscFree(ds->iwork);CHKERRQ(ierr); ds->lwork = 0; ds->lrwork = 0; ds->liwork = 0; ds->comparison = NULL; ds->comparisonctx = NULL; PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSDestroy" /*@C DSDestroy - Destroys DS context that was created with DSCreate(). Collective on DS Input Parameter: . ds - the direct solver context Level: beginner .seealso: DSCreate() @*/ PetscErrorCode DSDestroy(DS *ds) { PetscErrorCode ierr; PetscFunctionBegin; if (!*ds) PetscFunctionReturn(0); PetscValidHeaderSpecific(*ds,DS_CLASSID,1); if (--((PetscObject)(*ds))->refct > 0) { *ds = 0; PetscFunctionReturn(0); } ierr = DSReset(*ds);CHKERRQ(ierr); ierr = PetscHeaderDestroy(ds);CHKERRQ(ierr); PetscFunctionReturn(0); } #undef __FUNCT__ #define __FUNCT__ "DSRegister" /*@C DSRegister - Adds a direct solver to the DS package. Not collective Input Parameters: + name - name of a new user-defined DS - routine_create - routine to create context Notes: DSRegister() may be called multiple times to add several user-defined direct solvers. Level: advanced .seealso: DSRegisterAll() @*/ PetscErrorCode DSRegister(const char *name,PetscErrorCode (*function)(DS)) { PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscFunctionListAdd(&DSList,name,function);CHKERRQ(ierr); PetscFunctionReturn(0); } PETSC_EXTERN PetscErrorCode DSCreate_HEP(DS); PETSC_EXTERN PetscErrorCode DSCreate_NHEP(DS); PETSC_EXTERN PetscErrorCode DSCreate_GHEP(DS); PETSC_EXTERN PetscErrorCode DSCreate_GHIEP(DS); PETSC_EXTERN PetscErrorCode DSCreate_GNHEP(DS); PETSC_EXTERN PetscErrorCode DSCreate_SVD(DS); PETSC_EXTERN PetscErrorCode DSCreate_NEP(DS); #undef __FUNCT__ #define __FUNCT__ "DSRegisterAll" /*@C DSRegisterAll - Registers all of the direct solvers in the DS package. Not Collective Level: advanced @*/ PetscErrorCode DSRegisterAll(void) { PetscErrorCode ierr; PetscFunctionBegin; DSRegisterAllCalled = PETSC_TRUE; ierr = DSRegister(DSHEP,DSCreate_HEP);CHKERRQ(ierr); ierr = DSRegister(DSNHEP,DSCreate_NHEP);CHKERRQ(ierr); ierr = DSRegister(DSGHEP,DSCreate_GHEP);CHKERRQ(ierr); ierr = DSRegister(DSGHIEP,DSCreate_GHIEP);CHKERRQ(ierr); ierr = DSRegister(DSGNHEP,DSCreate_GNHEP);CHKERRQ(ierr); ierr = DSRegister(DSSVD,DSCreate_SVD);CHKERRQ(ierr); ierr = DSRegister(DSNEP,DSCreate_NEP);CHKERRQ(ierr); PetscFunctionReturn(0); } slepc-3.4.2.dfsg.orig/src/ds/index.html0000644000175000017500000000162312211062077016627 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

interface/
impls/
examples/
../../include/slepc-private/dsimpl.h
../../include/slepcds.h
makefile
slepc-3.4.2.dfsg.orig/setup.py0000644000175000017500000002220612211062077015147 0ustar gladkgladk#!/usr/bin/env python """ SLEPc: Scalable Library for Eigenvalue Problem Computations =========================================================== SLEPc is a software library for the solution of large scale sparse eigenvalue problems on parallel computers. It is an extension of PETSc and can be used for either standard or generalized eigenproblems, with real or complex arithmetic. It can also be used for computing a partial SVD of a large, sparse, rectangular matrix, and to solve quadratic eigenvalue problems .. tip:: You can also install `slepc-dev`_ with:: $ pip install petsc==dev slepc==dev .. _slepc-dev: https://bitbucket.org/slepc/ slepc/get/master.tar.gz#egg=slepc-dev """ import sys, os from distutils.core import setup from distutils.util import get_platform from distutils.spawn import find_executable from distutils.command.build import build as _build if 'setuptools' in sys.modules: from setuptools.command.install import install as _install else: from distutils.command.install import install as _install from distutils.command.sdist import sdist as _sdist from distutils import log init_py = """\ # Author: SLEPc Team # Contact: slepc-maint@grycap.upv.es def get_slepc_dir(): import os return os.path.dirname(__file__) def get_config(): conf = {} conf['SLEPC_DIR'] = get_slepc_dir() return conf """ metadata = { 'provides' : ['slepc'], 'requires' : [], } def bootstrap(): from os.path import join, isdir, abspath # Set SLEPC_DIR SLEPC_DIR = abspath(os.getcwd()) os.environ['SLEPC_DIR'] = SLEPC_DIR # Check PETSC_DIR/PETSC_ARCH PETSC_DIR = os.environ.get('PETSC_DIR', "") PETSC_ARCH = os.environ.get('PETSC_ARCH', "") if not (PETSC_DIR and isdir(PETSC_DIR)): PETSC_DIR = None try: del os.environ['PETSC_DIR'] except KeyError: pass PETSC_ARCH = None try: del os.environ['PETSC_ARCH'] except KeyError: pass elif not isdir(join(PETSC_DIR, PETSC_ARCH)): PETSC_ARCH = None try: del os.environ['PETSC_ARCH'] except KeyError: pass # Generate package __init__.py file from distutils.dir_util import mkpath pkgdir = os.path.join(SLEPC_DIR, 'pypi') pkgfile = os.path.join(pkgdir, '__init__.py') if not os.path.exists(pkgdir): mkpath(pkgdir) fh = open(pkgfile, 'wt') fh.write(init_py) fh.close() if ('setuptools' in sys.modules): metadata['zip_safe'] = False if not PETSC_DIR: metadata['install_requires']= ['petsc>=3.4,<3.5'] def get_petsc_dir(): PETSC_DIR = os.environ.get('PETSC_DIR') if PETSC_DIR: return PETSC_DIR try: import petsc PETSC_DIR = petsc.get_petsc_dir() except ImportError: log.warn("PETSC_DIR not specified") PETSC_DIR = os.path.join(os.path.sep, 'usr', 'local', 'petsc') return PETSC_DIR def get_petsc_arch(): PETSC_ARCH = os.environ.get('PETSC_ARCH') or 'arch-installed-petsc' return PETSC_ARCH def config(dry_run=False): log.info('SLEPc: configure') if dry_run: return # PETSc # Run SLEPc configure os.environ['PETSC_DIR'] = get_petsc_dir() status = os.system(" ".join(( find_executable('python'), os.path.join('config', 'configure.py'), ))) if status != 0: raise RuntimeError(status) def build(dry_run=False): log.info('SLEPc: build') if dry_run: return # Run SLEPc build status = os.system(" ".join(( find_executable('make'), 'PETSC_DIR='+get_petsc_dir(), 'PETSC_ARCH='+get_petsc_arch(), 'all', ))) if status != 0: raise RuntimeError def install(dest_dir, prefix=None, dry_run=False): log.info('SLEPc: install') if dry_run: return if prefix is None: prefix = dest_dir PETSC_ARCH = get_petsc_arch() # Run SLEPc install status = os.system(" ".join(( find_executable('make'), 'PETSC_DIR='+get_petsc_dir(), 'PETSC_ARCH='+get_petsc_arch(), 'SLEPC_DESTDIR='+dest_dir, 'install', ))) if status != 0: raise RuntimeError slepcvariables = os.path.join(dest_dir, 'conf', 'slepcvariables') fh = open(slepcvariables, 'a') fh.write('SLEPC_DESTDIR=%s\n' % prefix) fh.close() class context: def __init__(self): self.sys_argv = sys.argv[:] self.wdir = os.getcwd() def enter(self): del sys.argv[1:] pdir = os.environ['SLEPC_DIR'] os.chdir(pdir) return self def exit(self): sys.argv[:] = self.sys_argv os.chdir(self.wdir) class cmd_build(_build): def initialize_options(self): _build.initialize_options(self) PETSC_ARCH = os.environ.get('PETSC_ARCH', 'arch-installed-petsc') self.build_base = os.path.join(PETSC_ARCH, 'build-python') def run(self): _build.run(self) ctx = context().enter() try: config(self.dry_run) build(self.dry_run) finally: ctx.exit() class cmd_install(_install): def initialize_options(self): _install.initialize_options(self) self.optimize = 1 def run(self): root_dir = self.install_platlib dest_dir = os.path.join(root_dir, 'slepc') bdist_base = self.get_finalized_command('bdist').bdist_base if dest_dir.startswith(bdist_base): prefix = dest_dir[len(bdist_base)+1:] prefix = prefix[prefix.index(os.path.sep):] else: prefix = dest_dir dest_dir = os.path.abspath(dest_dir) prefix = os.path.abspath(prefix) # _install.run(self) ctx = context().enter() try: install(dest_dir, prefix, self.dry_run) finally: ctx.exit() manifest_in = """\ include makefile recursive-include config *.py recursive-include bin/matlab * recursive-include conf * recursive-include include * recursive-include src * exclude conf/slepcvariables recursive-exclude src *.html recursive-exclude src/docs * recursive-exclude src/*/examples/* *.* recursive-exclude pypi * """ class cmd_sdist(_sdist): def initialize_options(self): _sdist.initialize_options(self) self.force_manifest = 1 self.template = os.path.join('pypi', 'manifest.in') # Generate manifest.in file SLEPC_DIR = os.environ['SLEPC_DIR'] from distutils.dir_util import mkpath pkgdir = os.path.join(SLEPC_DIR, 'pypi') if not os.path.exists(pkgdir): mkpath(pkgdir) template = self.template fh = open(template, 'wt') fh.write(manifest_in) fh.close() def version(): import re version_re = { 'major' : re.compile(r"#define\s+SLEPC_VERSION_MAJOR\s+(\d+)"), 'minor' : re.compile(r"#define\s+SLEPC_VERSION_MINOR\s+(\d+)"), 'micro' : re.compile(r"#define\s+SLEPC_VERSION_SUBMINOR\s+(\d+)"), 'patch' : re.compile(r"#define\s+SLEPC_VERSION_PATCH\s+(\d+)"), 'release': re.compile(r"#define\s+SLEPC_VERSION_RELEASE\s+(\d+)"), } slepcversion_h = os.path.join('include','slepcversion.h') data = open(slepcversion_h, 'rt').read() major = int(version_re['major'].search(data).groups()[0]) minor = int(version_re['minor'].search(data).groups()[0]) micro = int(version_re['micro'].search(data).groups()[0]) patch = int(version_re['patch'].search(data).groups()[0]) release = int(version_re['release'].search(data).groups()[0]) if release: v = "%d.%d" % (major, minor) if micro > 0: v += ".%d" % micro if patch > 0: v += ".%d" % patch else: v = "%d.%d.dev%d" % (major, minor+1, 0) return v def tarball(): VERSION = version() if '.dev' in VERSION: return None bits = VERSION.split('.') if len(bits) == 2: bits.append('0') SLEPC_VERSION = '.'.join(bits[:3]) return ('http://www.grycap.upv.es/slepc/download/distrib/' 'slepc-%s.tar.gz#egg=slepc-%s' % (SLEPC_VERSION, VERSION)) description = __doc__.split('\n')[1:-1]; del description[1:3] classifiers = """ License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Operating System :: POSIX Intended Audience :: Developers Intended Audience :: Science/Research Programming Language :: C Programming Language :: C++ Programming Language :: Fortran Programming Language :: Python Topic :: Scientific/Engineering Topic :: Software Development :: Libraries """ bootstrap() setup(name='slepc', version=version(), description=description.pop(0), long_description='\n'.join(description), classifiers= classifiers.split('\n')[1:-1], keywords = ['SLEPc','PETSc', 'MPI'], platforms=['POSIX'], license='LGPL', url='http://www.grycap.upv.es/slepc/', download_url=tarball(), author='SLEPc Team', author_email='slepc-maint@grycap.upv.es', maintainer='Lisandro Dalcin', maintainer_email='dalcinl@gmail.com', packages = ['slepc'], package_dir = {'slepc': 'pypi'}, cmdclass={ 'build': cmd_build, 'install': cmd_install, 'sdist': cmd_sdist, }, **metadata) slepc-3.4.2.dfsg.orig/COPYING.LESSER0000644000175000017500000001672712211062077015477 0ustar gladkgladk GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. slepc-3.4.2.dfsg.orig/bin/0000755000175000017500000000000012214143515014203 5ustar gladkgladkslepc-3.4.2.dfsg.orig/bin/matlab/0000755000175000017500000000000012211062077015443 5ustar gladkgladkslepc-3.4.2.dfsg.orig/bin/matlab/classes/0000755000175000017500000000000012211062077017100 5ustar gladkgladkslepc-3.4.2.dfsg.orig/bin/matlab/classes/SlepcInitialize.m0000644000175000017500000000564512211062077022360 0ustar gladkgladkfunction err = SlepcInitialize(args,argfile,arghelp) % SlepcInitialize: start to use SLEPc classes in MATLAB. % In order to use the SLEPc MATLAB classes, PETSc must have been configured with % specific options. See: help PetscInitialize. % % Add ${PETSC_DIR}/bin/matlab/classes to your MATLAB path, as well as % ${SLEPC_DIR}/bin/matlab/classes % % In MATLAB use help Slepc to get started using SLEPc from MATLAB % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if exist('PetscInitialize')~=2 error('Must add ${PETSC_DIR}/bin/matlab/classes to your MATLAB path') end if ~libisloaded('libslepc') SLEPC_DIR = getenv('SLEPC_DIR'); PETSC_ARCH = getenv('PETSC_ARCH'); if isempty(SLEPC_DIR) disp('Must have environmental variable SLEPC_DIR set') end if isempty(PETSC_ARCH) disp('Must have environmental variable PETSC_ARCH set') end loadlibrary([SLEPC_DIR '/' PETSC_ARCH '/lib/' 'libslepc'], [SLEPC_DIR '/bin/matlab/classes/slepcmatlabheader.h']); end if ~libisloaded('libpetsc') PETSC_DIR = getenv('PETSC_DIR'); PETSC_ARCH = getenv('PETSC_ARCH'); if isempty(PETSC_DIR) disp('Must have environmental variable PETSC_DIR set') end if isempty(PETSC_ARCH) disp('Must have environmental variable PETSC_ARCH set') end loadlibrary([PETSC_DIR '/' PETSC_ARCH '/lib/' 'libpetsc'], [PETSC_DIR '/bin/matlab/classes/matlabheader.h']); end if (nargin == 0) args = ''; end if (nargin < 2) argfile = ''; end if (nargin < 3) arghelp = ''; end if (ischar(args)) args = {args}; end % append any options in the options variable global options if (length(options) > 0) args = [args,options]; disp('Using additional options') disp(options) end % first argument should be program name, use matlab for this arg = ['matlab',args]; % % If the user forgot to SlepcFinalize() we do it for them, before restarting SLEPc % init = 0; err = calllib('libslepc', 'SlepcInitialized',init); if (init) err = calllib('libslepc', 'SlepcFinalize');PetscCHKERRQ(err); end err = calllib('libslepc', 'SlepcInitializeNoPointers', length(arg), arg,argfile,arghelp);PetscCHKERRQ(err); slepc-3.4.2.dfsg.orig/bin/matlab/classes/examples/0000755000175000017500000000000012214143515020716 5ustar gladkgladkslepc-3.4.2.dfsg.orig/bin/matlab/classes/examples/tutorials/0000755000175000017500000000000012211062077022744 5ustar gladkgladkslepc-3.4.2.dfsg.orig/bin/matlab/classes/examples/tutorials/exQEP.m0000644000175000017500000000565212211062077024114 0ustar gladkgladk%% % % Solves a quadratic eigenvalue problem with SLEPc % User creates directly the three PETSc Mat % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %% % Set the Matlab path and initialize SLEPc % path(path,'../../') if ~exist('PetscInitialize','file') PETSC_DIR = getenv('PETSC_DIR'); if isempty(PETSC_DIR) error('Must set environment variable PETSC_DIR or add the appropriate dir to Matlab path') end path(path,[PETSC_DIR '/bin/matlab/classes']) end SlepcInitialize({'-malloc','-malloc_debug','-malloc_dump'}); %% % Create a tridiagonal matrix (1-D Laplacian) % n = 10; N = n*n; K = PetscMat(); K.SetType('seqaij'); K.SetSizes(N,N,N,N); K.SetUp(); for II=0:N-1 i = floor(II/n); j = II-i*n; if i>0, K.SetValues(II+1,II+1-n,-1.0); end if i0, K.SetValues(II+1,II+1-1,-1.0); end if j0 fprintf(' k ||Ax-kx||/||kx||\n') fprintf(' ----------------- ------------------\n') for i=1:nconv [lambda,x] = qep.GetEigenpair(i); relerr = qep.ComputeRelativeError(i); if isreal(lambda) fprintf(' %14.2f %12g\n',lambda,relerr) else fprintf(' %9f%+9f %12g\n',real(lambda),imag(lambda),relerr) end end end %% % Free objects and shutdown SLEPc % K.Destroy(); C.Destroy(); M.Destroy(); qep.Destroy(); SlepcFinalize(); slepc-3.4.2.dfsg.orig/bin/matlab/classes/examples/tutorials/exSVD.m0000644000175000017500000000432612211062077024120 0ustar gladkgladk%% % % Computes a partial SVD of a matrix with SLEPc % User creates directly a PETSc Mat % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %% % Set the Matlab path and initialize SLEPc % path(path,'../../') if ~exist('PetscInitialize','file') PETSC_DIR = getenv('PETSC_DIR'); if isempty(PETSC_DIR) error('Must set environment variable PETSC_DIR or add the appropriate dir to Matlab path') end path(path,[PETSC_DIR '/bin/matlab/classes']) end SlepcInitialize({'-malloc','-malloc_debug','-malloc_dump'}); %% % Create the Lauchli matrix % n = 100; mu = 1e-7; mat = PetscMat(); mat.SetType('seqaij'); mat.SetSizes(n+1,n,n+1,n); mat.SetUp(); for i=1:n mat.SetValues(1,i,1.0); end for i=2:n+1 mat.SetValues(i,i-1,mu); end mat.AssemblyBegin(PetscMat.FINAL_ASSEMBLY); mat.AssemblyEnd(PetscMat.FINAL_ASSEMBLY); %% % Create the solver, pass the matrix and solve the problem % svd = SlepcSVD(); svd.SetOperator(mat); svd.SetType('trlanczos'); svd.SetFromOptions(); svd.Solve(); nconv = svd.GetConverged(); if nconv>0 fprintf(' sigma residual norm\n') fprintf(' ----------------- ------------------\n') for i=1:nconv [sigma,u,v] = svd.GetSingularTriplet(i); relerr = svd.ComputeRelativeError(i); fprintf(' %12f %12g\n',sigma,relerr) end end %% % Free objects and shutdown SLEPc % mat.Destroy(); svd.Destroy(); SlepcFinalize(); slepc-3.4.2.dfsg.orig/bin/matlab/classes/examples/tutorials/exST.m0000644000175000017500000000512412211062077024007 0ustar gladkgladk%% % % Solves a generalized eigenvalue problem with SLEPc with shift-and-invert % with the matrices loaded from file % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %% % Set the Matlab path and initialize SLEPc % path(path,'../../') if ~exist('PetscInitialize','file') PETSC_DIR = getenv('PETSC_DIR'); if isempty(PETSC_DIR) error('Must set environment variable PETSC_DIR or add the appropriate dir to Matlab path') end path(path,[PETSC_DIR '/bin/matlab/classes']) end SlepcInitialize({'-malloc','-malloc_debug','-malloc_dump'}); %% % Load matrices from file % SLEPC_DIR = getenv('SLEPC_DIR'); viewer = PetscViewer([SLEPC_DIR '/share/slepc/datafiles/matrices/bfw62a.petsc'],Petsc.FILE_MODE_READ); A = PetscMat(); A.Load(viewer); viewer.Destroy; viewer = PetscViewer([SLEPC_DIR '/share/slepc/datafiles/matrices/bfw62b.petsc'],Petsc.FILE_MODE_READ); B = PetscMat(); B.Load(viewer); viewer.Destroy; %% % Create the eigensolver, pass the matrices and solve the problem % eps = SlepcEPS(); eps.SetType('krylovschur'); eps.SetOperators(A,B); eps.SetProblemType(SlepcEPS.GNHEP); eps.SetDimensions(6); eps.SetTolerances(1e-13); st = eps.GetST(); st.SetType('sinvert'); eps.SetWhichEigenpairs(SlepcEPS.TARGET_MAGNITUDE); eps.SetTarget(0.0); eps.SetFromOptions(); eps.Solve(); nconv = eps.GetConverged(); fprintf(' k ||Ax-kx||/||kx||\n') fprintf(' ----------------- ------------------\n') for i=1:nconv lambda = eps.GetEigenpair(i); relerr = eps.ComputeRelativeError(i); if isreal(lambda) fprintf(' %14.2f %12g\n',lambda,relerr) else fprintf(' %.2f%+.2f %12g\n',real(lambda),imag(lambda),relerr) end end %% % Free objects and shutdown SLEPc % A.Destroy(); B.Destroy(); eps.Destroy(); SlepcFinalize(); slepc-3.4.2.dfsg.orig/bin/matlab/classes/examples/tutorials/exEPS.m0000644000175000017500000000475312211062077024117 0ustar gladkgladk%% % % Solves a standard eigenvalue problem with SLEPc % User creates directly a PETSc Mat % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %% % Set the Matlab path and initialize SLEPc % path(path,'../../') if ~exist('PetscInitialize','file') PETSC_DIR = getenv('PETSC_DIR'); if isempty(PETSC_DIR) error('Must set environment variable PETSC_DIR or add the appropriate dir to Matlab path') end path(path,[PETSC_DIR '/bin/matlab/classes']) end SlepcInitialize({'-eps_monitor','-malloc','-malloc_debug','-malloc_dump'}); %% % Create a tridiagonal matrix (1-D Laplacian) % n = 130; mat = PetscMat(); mat.SetType('seqaij'); mat.SetSizes(n,n,n,n); mat.SetUp(); for i=1:n mat.SetValues(i,i,2.0); end for i=1:n-1 mat.SetValues(i+1,i,-1.0); mat.SetValues(i,i+1,-1.0); end mat.AssemblyBegin(PetscMat.FINAL_ASSEMBLY); mat.AssemblyEnd(PetscMat.FINAL_ASSEMBLY); %% % Create the eigensolver, pass the matrix and solve the problem % eps = SlepcEPS(); eps.SetType('krylovschur'); eps.SetOperators(mat); eps.SetProblemType(SlepcEPS.HEP); eps.SetWhichEigenpairs(SlepcEPS.SMALLEST_MAGNITUDE); eps.SetFromOptions(); eps.Solve(); nconv = eps.GetConverged(); if nconv>0 fprintf(' k ||Ax-kx||/||kx||\n') fprintf(' ----------------- ------------------\n') for i=1:nconv [lambda,x] = eps.GetEigenpair(i); figure,plot(x) relerr = eps.ComputeRelativeError(i); if isreal(lambda) fprintf(' %12f %12g\n',lambda,relerr) else fprintf(' %6f%+6fj %12g\n',real(lambda),imag(lambda),relerr) end end end %% % Free objects and shutdown SLEPc % mat.Destroy(); eps.Destroy(); SlepcFinalize(); slepc-3.4.2.dfsg.orig/bin/matlab/classes/SlepcST.m0000644000175000017500000000450612211062077020600 0ustar gladkgladkclassdef SlepcST < PetscObject % % SlepcST - a SLEPc spectral transformation object % % Creation from an EPS: % st = eps.GetST(); % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - properties (Constant) HEP=1; GHEP=2; NHEP=3; GNHEP=4; PGNHEP=5; GHIEP=6; end methods function obj = SlepcST(pid,flag) if (nargin > 1) % SelpcST(pid,'pobj') uses an already existing SLEPc ST object obj.pobj = pid; return end comm = PETSC_COMM_SELF(); [err,obj.pobj] = calllib('libslepc', 'STCreate', comm,0);PetscCHKERRQ(err); end function err = SetType(obj,name) err = calllib('libslepc', 'STSetType', obj.pobj,name);PetscCHKERRQ(err); end function err = SetFromOptions(obj) err = calllib('libslepc', 'STSetFromOptions', obj.pobj);PetscCHKERRQ(err); end function err = SetUp(obj) err = calllib('libslepc', 'STSetUp', obj.pobj);PetscCHKERRQ(err); end function err = View(obj,viewer) if (nargin == 1) err = calllib('libslepc', 'STView', obj.pobj,0);PetscCHKERRQ(err); else err = calllib('libslepc', 'STView', obj.pobj,viewer.pobj);PetscCHKERRQ(err); end end function [ksp,err] = GetKSP(obj) [err,pid] = calllib('libslepc', 'STGetKSP', obj.pobj,0);PetscCHKERRQ(err); ksp = PetscKSP(pid,'pobj'); end function err = Destroy(obj) err = calllib('libslepc', 'STDestroy', obj.pobj);PetscCHKERRQ(err); end end end slepc-3.4.2.dfsg.orig/bin/matlab/classes/SlepcQEP.m0000644000175000017500000001211712211062077020674 0ustar gladkgladkclassdef SlepcQEP < PetscObject % % SlepcQEP - a SLEPc quadratic eigenvalue solver object % % Creation: % eps = SlepcQEP(); % QEP.SetType('linear'); % QEP.SetOperators(M,C,K); % (optional) QEP.SetProblemType(...); % QEP.SetFromOptions(); % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - properties (Constant) GENERAL=1; HERMITIAN=2; GYROSCOPIC=3; LARGEST_MAGNITUDE=1; SMALLEST_MAGNITUDE=2; LARGEST_REAL=3; SMALLEST_REAL=4; LARGEST_IMAGINARY=5; SMALLEST_IMAGINARY=6; end methods function obj = SlepcQEP(pid,flag) if (nargin > 1) % SelpcQEP(pid,'pobj') uses an already existing SLEPc QEP object obj.pobj = pid; return end comm = PETSC_COMM_SELF(); [err,obj.pobj] = calllib('libslepc', 'QEPCreate', comm,0);PetscCHKERRQ(err); end function err = SetType(obj,name) err = calllib('libslepc', 'QEPSetType', obj.pobj,name);PetscCHKERRQ(err); end function err = SetFromOptions(obj) err = calllib('libslepc', 'QEPSetFromOptions', obj.pobj);PetscCHKERRQ(err); end function err = SetUp(obj) err = calllib('libslepc', 'QEPSetUp', obj.pobj);PetscCHKERRQ(err); end function err = Solve(obj) err = calllib('libslepc', 'QEPSolve', obj.pobj);PetscCHKERRQ(err); end function err = SetOperators(obj,M,C,K) err = calllib('libslepc', 'QEPSetOperators', obj.pobj,M.pobj,C.pobj,K.pobj);PetscCHKERRQ(err); end function err = SetProblemType(obj,t) err = calllib('libslepc', 'QEPSetProblemType', obj.pobj,t);PetscCHKERRQ(err); end function err = SetWhichEigenpairs(obj,t) err = calllib('libslepc', 'QEPSetWhichEigenpairs', obj.pobj,t);PetscCHKERRQ(err); end function err = SetTolerances(obj,t,mx) if (nargin == 2) mx = 0; end err = calllib('libslepc', 'QEPSetTolerances', obj.pobj,t,mx);PetscCHKERRQ(err); end function err = SetDimensions(obj,nev,ncv,mpd) if (nargin < 3) ncv = 0; end if (nargin < 4) mpd = 0; end err = calllib('libslepc', 'QEPSetDimensions', obj.pobj,nev,ncv,mpd);PetscCHKERRQ(err); end function err = SetScaleFactor(obj,t) err = calllib('libslepc', 'QEPSetScaleFactor', obj.pobj,t);PetscCHKERRQ(err); end function [nconv,err] = GetConverged(obj) nconv = 0; [err,nconv] = calllib('libslepc', 'QEPGetConverged', obj.pobj,nconv);PetscCHKERRQ(err); end function [lambda,v,err] = GetEigenpair(obj,i,xr,xi) lambda = 0.0; img = 0.0; if (nargin < 3) x = 0; else x = xr.pobj; end if (nargin < 4) y = 0; else y = xi.pobj; end if (nargout > 1 && (x==0 || y==0)) [err,pid] = calllib('libslepc', 'QEPGetOperators', obj.pobj,0,0,0);PetscCHKERRQ(err); A = PetscMat(pid,'pobj'); n = A.GetSize(); end freexr = 0; freexi = 0; if (nargout > 1 && x==0) xr = PetscVec(); freexr = 1; xr.SetType('seq'); xr.SetSizes(n,n); x = xr.pobj; end if (nargout > 1 && y==0) xi = PetscVec(); freexi = 1; xi.SetType('seq'); xi.SetSizes(n,n); y = xi.pobj; end [err,lambda,img] = calllib('libslepc', 'QEPGetEigenpair', obj.pobj,i-1,lambda,img,x,y);PetscCHKERRQ(err); if img~=0.0, lambda = lambda+j*img; end if (nargout > 1) if (x ~= 0) vr = xr(:); else vr = 0; end if (y ~= 0) vi = xi(:); else vi = 0; end v = vr+j*vi; if (freexr) xr.Destroy(); end if (freexi) xi.Destroy(); end end end function [relerr,err] = ComputeRelativeError(obj,i) relerr = 0.0; [err,relerr] = calllib('libslepc', 'QEPComputeRelativeError', obj.pobj,i-1,relerr);PetscCHKERRQ(err); end function err = View(obj,viewer) if (nargin == 1) err = calllib('libslepc', 'QEPView', obj.pobj,0);PetscCHKERRQ(err); else err = calllib('libslepc', 'QEPView', obj.pobj,viewer.pobj);PetscCHKERRQ(err); end end function err = Destroy(obj) err = calllib('libslepc', 'QEPDestroy', obj.pobj);PetscCHKERRQ(err); end end end slepc-3.4.2.dfsg.orig/bin/matlab/classes/Slepc.m0000644000175000017500000000252712211062077020332 0ustar gladkgladkclassdef Slepc < handle % % SLEPc MATLAB Interface Help % % SlepcInitialize({'-option1','value1','-option2'}); % SlepcFinalize; % % See also: help Petsc % % Each of the following have their own help % SlepcEPS - Eigenvalue solver class % SlepcST - Spectral transformation class % SlepcSVD - Singular value solver class % SlepcQEP - Quadratic eigenvalue solver class % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - properties (Constant) end end slepc-3.4.2.dfsg.orig/bin/matlab/classes/slepcmatlabheader.h0000644000175000017500000000712112211062077022712 0ustar gladkgladk /* This is used by bin/matlab/classes/SlepcInitialize() to define to Matlab all the functions available in the SLEPc shared library. We cannot simply use the regular SLEPc include files because they are too complicated for Matlab to parse. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ int SlepcInitializeNoPointers(int,char **,const char*,const char*); int SlepcInitialized(int*); typedef int MPI_Comm; int SlepcFinalize(void); typedef int PetscBool; typedef long int PetscPointer; typedef PetscPointer Vec; typedef PetscPointer Mat; typedef PetscPointer KSP; typedef PetscPointer PetscViewer; typedef PetscPointer ST; int STCreate(MPI_Comm,ST *); int STSetType(ST,const char*); int STSetFromOptions(ST); int STSetUp(ST); int STView(ST,PetscViewer); int STGetKSP(ST,KSP*); int STDestroy(ST*); typedef PetscPointer EPS; typedef int EPSProblemType; typedef int EPSWhich; typedef int EPSExtraction; int EPSCreate(MPI_Comm,EPS*); int EPSSetType(EPS,const char*); int EPSSetFromOptions(EPS); int EPSSetOperators(EPS,Mat,Mat); int EPSSetProblemType(EPS,EPSProblemType); int EPSSetWhichEigenpairs(EPS,EPSWhich); int EPSSetTarget(EPS,double); int EPSSetExtraction(EPS,EPSExtraction); int EPSSetTolerances(EPS,double,int); int EPSSetDimensions(EPS,int,int,int); int EPSSolve(EPS); int EPSSetUp(EPS); int EPSGetConverged(EPS,int*); int EPSGetEigenvalue(EPS,int,double*,double*); int EPSGetEigenvector(EPS,int,Vec,Vec); int EPSGetOperators(EPS,Mat*,Mat*); int EPSComputeRelativeError(EPS,int,double*); int EPSView(EPS,PetscViewer); int EPSGetST(EPS,ST*); int EPSDestroy(EPS*); typedef PetscPointer SVD; typedef int SVDWhich; int SVDCreate(MPI_Comm,SVD*); int SVDSetType(SVD,const char*); int SVDSetFromOptions(SVD); int SVDSetOperator(SVD,Mat); int SVDSetWhichSingularTriplets(SVD,SVDWhich); int SVDSetTolerances(SVD,double,int); int SVDSetDimensions(SVD,int,int,int); int SVDSolve(SVD); int SVDSetUp(SVD); int SVDGetConverged(SVD,int*); int SVDGetSingularTriplet(SVD,int,double*,Vec,Vec); int SVDGetOperator(SVD,Mat*); int SVDComputeRelativeError(SVD,int,double*); int SVDView(SVD,PetscViewer); int SVDDestroy(SVD*); typedef PetscPointer QEP; typedef int QEPProblemType; typedef int QEPWhich; int QEPCreate(MPI_Comm,QEP*); int QEPSetType(QEP,const char*); int QEPSetFromOptions(QEP); int QEPSetOperators(QEP,Mat,Mat,Mat); int QEPSetProblemType(QEP,QEPProblemType); int QEPSetWhichEigenpairs(QEP,QEPWhich); int QEPSetScaleFactor(QEP,double); int QEPSetTolerances(QEP,double,int); int QEPSetDimensions(QEP,int,int,int); int QEPSolve(QEP); int QEPSetUp(QEP); int QEPGetConverged(QEP,int*); int QEPGetEigenpair(QEP,int,double*,double*,Vec,Vec); int QEPGetOperators(QEP,Mat*,Mat*,Mat*); int QEPComputeRelativeError(QEP,int,double*); int QEPView(QEP,PetscViewer); int QEPDestroy(QEP*); slepc-3.4.2.dfsg.orig/bin/matlab/classes/SlepcSVD.m0000644000175000017500000001134412211062077020704 0ustar gladkgladkclassdef SlepcSVD < PetscObject % % SlepcSVD - a SLEPc singular value solver object % % Creation: % svd = SlepcSVD; % svd.SetType('cross'); % svd.SetOperator(A); % svd.SetFromOptions; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - properties (Constant) SVD_TRANSPOSE_EXPLICIT=0; SVD_TRANSPOSE_IMPLICIT=1; LARGEST=0; SMALLEST=1; end methods function obj = SlepcSVD(pid,flag) if (nargin > 1) % SelpcSVD(pid,'pobj') uses an already existing SLEPc SVD object obj.pobj = pid; return end comm = PETSC_COMM_SELF(); [err,obj.pobj] = calllib('libslepc', 'SVDCreate', comm,0);PetscCHKERRQ(err); end function err = SetType(obj,name) err = calllib('libslepc', 'SVDSetType', obj.pobj,name);PetscCHKERRQ(err); end function err = SetFromOptions(obj) err = calllib('libslepc', 'SVDSetFromOptions', obj.pobj);PetscCHKERRQ(err); end function err = SetUp(obj) err = calllib('libslepc', 'SVDSetUp', obj.pobj);PetscCHKERRQ(err); end function err = Solve(obj) err = calllib('libslepc', 'SVDSolve', obj.pobj);PetscCHKERRQ(err); end function err = SetOperator(obj,A) err = calllib('libslepc', 'SVDSetOperator', obj.pobj,A.pobj);PetscCHKERRQ(err); end function err = SetTransposeMode(obj,t) err = calllib('libslepc', 'SVDSetTransposeMode', obj.pobj,t);PetscCHKERRQ(err); end function err = SetWhichSingularTriplets(obj,t) err = calllib('libslepc', 'SVDSetWhichSingularTriplets', obj.pobj,t);PetscCHKERRQ(err); end function err = SetTolerances(obj,t,mx) if (nargin == 2) mx = 0; end err = calllib('libslepc', 'SVDSetTolerances', obj.pobj,t,mx);PetscCHKERRQ(err); end function err = SetDimensions(obj,nev,ncv,mpd) if (nargin < 3) ncv = 0; end if (nargin < 4) mpd = 0; end err = calllib('libslepc', 'SVDSetDimensions', obj.pobj,nev,ncv,mpd);PetscCHKERRQ(err); end function [nconv,err] = GetConverged(obj) nconv = 0; [err,nconv] = calllib('libslepc', 'SVDGetConverged', obj.pobj,nconv);PetscCHKERRQ(err); end function [sigma,u,v,err] = GetSingularTriplet(obj,i,uu,vv) sigma = 0.0; if (nargin < 3) x = 0; else x = uu.pobj; end if (nargin < 4) y = 0; else y = vv.pobj; end if (nargout > 1 && (x==0 || y==0)) [err,pid] = calllib('libslepc', 'SVDGetOperator', obj.pobj,0);PetscCHKERRQ(err); A = PetscMat(pid,'pobj'); [m,n] = A.GetSize(); end freexr = 0; freexi = 0; if (nargout > 1 && x==0) uu = PetscVec(); freexr = 1; uu.SetType('seq'); uu.SetSizes(m,m); x = uu.pobj; end if (nargout > 2 && y==0) vv = PetscVec(); freexi = 1; vv.SetType('seq'); vv.SetSizes(n,n); y = vv.pobj; end [err,sigma] = calllib('libslepc', 'SVDGetSingularTriplet', obj.pobj,i-1,sigma,x,y);PetscCHKERRQ(err); if (nargout > 1) if (x ~= 0) u = uu(:); else u = 0; end end if (nargout > 2) if (y ~= 0) v = vv(:); else v = 0; end end if (freexr) uu.Destroy(); end if (freexi) vv.Destroy(); end end function [relerr,err] = ComputeRelativeError(obj,i) relerr = 0.0; [err,relerr] = calllib('libslepc', 'SVDComputeRelativeError', obj.pobj,i-1,relerr);PetscCHKERRQ(err); end function err = View(obj,viewer) if (nargin == 1) err = calllib('libslepc', 'SVDView', obj.pobj,0);PetscCHKERRQ(err); else err = calllib('libslepc', 'SVDView', obj.pobj,viewer.pobj);PetscCHKERRQ(err); end end function err = Destroy(obj) err = calllib('libslepc', 'SVDDestroy', obj.pobj);PetscCHKERRQ(err); end end end slepc-3.4.2.dfsg.orig/bin/matlab/classes/SlepcEPS.m0000644000175000017500000001407212211062077020700 0ustar gladkgladkclassdef SlepcEPS < PetscObject % % SlepcEPS - a SLEPc eigenvalue solver object % % Creation: % eps = SlepcEPS; % eps.SetType('krylovschur'); % eps.SetOperators(A,B); % (optional) eps.SetProblemType(...); % eps.SetFromOptions; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - properties (Constant) HEP=1; GHEP=2; NHEP=3; GNHEP=4; PGNHEP=5; GHIEP=6; RITZ=1; HARMONIC=2; HARMONIC_RELATIVE=3; HARMONIC_RIGHT=4; HARMONIC_LARGEST=5; REFINED=6; REFINED_HARMONIC=7; LARGEST_MAGNITUDE=1; SMALLEST_MAGNITUDE=2; LARGEST_REAL=3; SMALLEST_REAL=4; LARGEST_IMAGINARY=5; SMALLEST_IMAGINARY=6; TARGET_MAGNITUDE=7; TARGET_REAL=8; TARGET_IMAGINARY=9; ALL=10; WHICH_USER=11; end methods function obj = SlepcEPS(pid,flag) if (nargin > 1) % SelpcEPS(pid,'pobj') uses an already existing SLEPc EPS object obj.pobj = pid; return end comm = PETSC_COMM_SELF(); [err,obj.pobj] = calllib('libslepc', 'EPSCreate', comm,0);PetscCHKERRQ(err); end function err = SetType(obj,name) err = calllib('libslepc', 'EPSSetType', obj.pobj,name);PetscCHKERRQ(err); end function err = SetFromOptions(obj) err = calllib('libslepc', 'EPSSetFromOptions', obj.pobj);PetscCHKERRQ(err); end function err = SetUp(obj) err = calllib('libslepc', 'EPSSetUp', obj.pobj);PetscCHKERRQ(err); end function err = Solve(obj) err = calllib('libslepc', 'EPSSolve', obj.pobj);PetscCHKERRQ(err); end function err = SetOperators(obj,A,B) if (nargin == 2) err = calllib('libslepc', 'EPSSetOperators', obj.pobj,A.pobj,0);PetscCHKERRQ(err); else err = calllib('libslepc', 'EPSSetOperators', obj.pobj,A.pobj,B.pobj);PetscCHKERRQ(err); end end function err = SetProblemType(obj,t) err = calllib('libslepc', 'EPSSetProblemType', obj.pobj,t);PetscCHKERRQ(err); end function err = SetWhichEigenpairs(obj,t) err = calllib('libslepc', 'EPSSetWhichEigenpairs', obj.pobj,t);PetscCHKERRQ(err); end function err = SetExtraction(obj,t) err = calllib('libslepc', 'EPSSetExtraction', obj.pobj,t);PetscCHKERRQ(err); end function err = SetTolerances(obj,t,mx) if (nargin == 2) mx = 0; end err = calllib('libslepc', 'EPSSetTolerances', obj.pobj,t,mx);PetscCHKERRQ(err); end function err = SetDimensions(obj,nev,ncv,mpd) if (nargin < 3) ncv = 0; end if (nargin < 4) mpd = 0; end err = calllib('libslepc', 'EPSSetDimensions', obj.pobj,nev,ncv,mpd);PetscCHKERRQ(err); end function err = SetTarget(obj,t) err = calllib('libslepc', 'EPSSetTarget', obj.pobj,t);PetscCHKERRQ(err); end function [nconv,err] = GetConverged(obj) nconv = 0; [err,nconv] = calllib('libslepc', 'EPSGetConverged', obj.pobj,nconv);PetscCHKERRQ(err); end function [lambda,err] = GetEigenvalue(obj,i) lambda = 0.0; img = 0.0; [err,lambda,img] = calllib('libslepc', 'EPSGetEigenvalue', obj.pobj,i-1,lambda,img);PetscCHKERRQ(err); if img~=0.0, lambda = lambda+j*img; end end function [v,err] = GetEigenvector(obj,i,xr,xi) if (nargin < 3) x = 0; else x = xr.pobj; end if (nargin < 4) y = 0; else y = xi.pobj; end if (nargout > 0 && (x==0 || y==0)) [err,pid] = calllib('libslepc', 'EPSGetOperators', obj.pobj,0,0);PetscCHKERRQ(err); A = PetscMat(pid,'pobj'); n = A.GetSize(); end freexr = 0; freexi = 0; if (nargout > 0 && x==0) xr = PetscVec(); freexr = 1; xr.SetType('seq'); xr.SetSizes(n,n); x = xr.pobj; end if (nargout > 0 && y==0) xi = PetscVec(); freexi = 1; xi.SetType('seq'); xi.SetSizes(n,n); y = xi.pobj; end err = calllib('libslepc', 'EPSGetEigenvector', obj.pobj,i-1,x,y);PetscCHKERRQ(err); if (nargout > 0) if (x ~= 0) vr = xr(:); else vr = 0; end if (y ~= 0) vi = xi(:); else vi = 0; end v = vr+j*vi; if (freexr) xr.Destroy(); end if (freexi) xi.Destroy(); end end end function [lambda,v,err] = GetEigenpair(obj,i,varargin) [lambda,err] = GetEigenvalue(obj,i); if (nargout > 1 || nargin > 2) [v,err] = GetEigenvector(obj,i,varargin{:}); end end function [relerr,err] = ComputeRelativeError(obj,i) relerr = 0.0; [err,relerr] = calllib('libslepc', 'EPSComputeRelativeError', obj.pobj,i-1,relerr);PetscCHKERRQ(err); end function err = View(obj,viewer) if (nargin == 1) err = calllib('libslepc', 'EPSView', obj.pobj,0);PetscCHKERRQ(err); else err = calllib('libslepc', 'EPSView', obj.pobj,viewer.pobj);PetscCHKERRQ(err); end end function [st,err] = GetST(obj) [err,pid] = calllib('libslepc', 'EPSGetST', obj.pobj,0);PetscCHKERRQ(err); st = SlepcST(pid,'pobj'); end function err = Destroy(obj) err = calllib('libslepc', 'EPSDestroy', obj.pobj);PetscCHKERRQ(err); end end end slepc-3.4.2.dfsg.orig/bin/matlab/classes/SlepcFinalize.m0000644000175000017500000000205512211062077022010 0ustar gladkgladkfunction err = SlepcFinalize() % SlepcFinalize: clean up SLEPc classes in MATLAB. % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % SLEPc - Scalable Library for Eigenvalue Problem Computations % Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain % % This file is part of SLEPc. % % SLEPc is free software: you can redistribute it and/or modify it under the % terms of version 3 of the GNU Lesser General Public License as published by % the Free Software Foundation. % % SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for % more details. % % You should have received a copy of the GNU Lesser General Public License % along with SLEPc. If not, see . % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - err = calllib('libslepc', 'SlepcFinalize');PetscCHKERRQ(err); slepc-3.4.2.dfsg.orig/TAGS_PYTHON0000644000175000017500000000344412211062077015222 0ustar gladkgladk config/arpack.py,18 def Check(29,990 config/blopex.py,21 def Install(30,1022 config/blzpack.py,18 def Check(29,990 config/check.py,124 def LinkWithOutput(29,993 def Link(58,1897 def FortranLink(63,2048 def GenerateGuesses(92,2920 def FortranLib(111,3395 config/cmakeboot.py,256 def noCheck(20,712 def quoteIfNeeded(23,767 class StdoutLogger(31,1030 def write(32,1058 class PETScMaker(35,1097 def __init__(36,1130 def __str__(47,1510 def setupModules(50,1544 def setup(72,3166 def cmakeboot(78,3306 def main(154,7059 config/cmakegen.py,620 class defaultdict(24,754 def __init__(25,783 def __getitem__(31,1110 def __missing__(36,1288 def __reduce__(41,1485 def copy(47,1716 def __copy__(49,1775 def __deepcopy__(51,1861 def __repr__(55,2034 class StdoutLogger(62,2245 def write(63,2273 def cmakeconditional(66,2312 def unexpected(67,2343 def pkgsources(91,3108 def compareDirLists(99,3579 def compareSourceLists(112,4227 def stripsplit(138,5598 def relpath(142,5815 def writeRoot(151,6213 def writePackage(189,7756 def body(192,7859 def main(201,8228 config/feast.py,18 def Check(29,990 config/generatefortranstubs.py,167 def FixFile(8,123 def FindSource(32,1294 def FixDir(46,1743 def PrepFtnDir(126,4544 def processDir(140,5004 def processf90interfaces(180,6636 def main(198,7594 config/lapack.py,18 def Check(29,990 config/log.py,94 def Open(26,956 def Println(31,1022 def Print(36,1093 def write(40,1151 def Exit(44,1205 config/petscconf.py,17 def Load(25,948 config/petscversion.py,17 def Load(25,948 config/primme.py,18 def Check(29,990 config/slepcversion.py,17 def Load(25,948 config/trlan.py,18 def Check(29,990 config/configure.py,0 slepc-3.4.2.dfsg.orig/include/0000755000175000017500000000000012214143515015056 5ustar gladkgladkslepc-3.4.2.dfsg.orig/include/slepcsvd.h.html0000644000175000017500000006113212211062077020020 0ustar gladkgladk

Actual source code: slepcsvd.h

  1: /*
  2:    User interface for SLEPc's singular value solvers.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepceps.h>

 28: PETSC_EXTERN PetscErrorCode SVDInitializePackage(void);

 30: /*S
 31:      SVD - Abstract SLEPc object that manages all the singular value
 32:      problem solvers.

 34:    Level: beginner

 36: .seealso:  SVDCreate()
 37: S*/
 38: typedef struct _p_SVD* SVD;

 40: /*J
 41:     SVDType - String with the name of a SLEPc singular value solver

 43:    Level: beginner

 45: .seealso: SVDSetType(), SVD
 46: J*/
 47: typedef const char* SVDType;
 48: #define SVDCROSS       "cross"
 49: #define SVDCYCLIC      "cyclic"
 50: #define SVDLAPACK      "lapack"
 51: #define SVDLANCZOS     "lanczos"
 52: #define SVDTRLANCZOS   "trlanczos"

 54: /* Logging support */
 55: PETSC_EXTERN PetscClassId SVD_CLASSID;

 57: /*E
 58:     SVDTransposeMode - Determines how to handle the transpose of the matrix

 60:     Level: advanced

 62: .seealso: SVDSetTransposeMode(), SVDGetTransposeMode()
 63: E*/
 64: typedef enum { SVD_TRANSPOSE_EXPLICIT,
 65:                SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;

 67: /*E
 68:     SVDWhich - Determines whether largest or smallest singular triplets
 69:     are to be computed

 71:     Level: intermediate

 73: .seealso: SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets()
 74: E*/
 75: typedef enum { SVD_LARGEST,
 76:                SVD_SMALLEST } SVDWhich;

 78: /*E
 79:     SVDConvergedReason - Reason a singular value solver was said to
 80:          have converged or diverged

 82:    Level: beginner

 84: .seealso: SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances()
 85: E*/
 86: typedef enum {/* converged */
 87:               SVD_CONVERGED_TOL                =  2,
 88:               /* diverged */
 89:               SVD_DIVERGED_ITS                 = -3,
 90:               SVD_DIVERGED_BREAKDOWN           = -4,
 91:               SVD_CONVERGED_ITERATING          =  0 } SVDConvergedReason;

 93: PETSC_EXTERN PetscErrorCode SVDCreate(MPI_Comm,SVD*);
 94: PETSC_EXTERN PetscErrorCode SVDSetIP(SVD,IP);
 95: PETSC_EXTERN PetscErrorCode SVDGetIP(SVD,IP*);
 96: PETSC_EXTERN PetscErrorCode SVDSetDS(SVD,DS);
 97: PETSC_EXTERN PetscErrorCode SVDGetDS(SVD,DS*);
 98: PETSC_EXTERN PetscErrorCode SVDSetType(SVD,SVDType);
 99: PETSC_EXTERN PetscErrorCode SVDGetType(SVD,SVDType*);
100: PETSC_EXTERN PetscErrorCode SVDSetOperator(SVD,Mat);
101: PETSC_EXTERN PetscErrorCode SVDGetOperator(SVD,Mat*);
102: PETSC_EXTERN PetscErrorCode SVDSetInitialSpace(SVD,PetscInt,Vec*);
103: PETSC_EXTERN PetscErrorCode SVDSetInitialSpaceLeft(SVD,PetscInt,Vec*);
104: PETSC_EXTERN PetscErrorCode SVDSetTransposeMode(SVD,SVDTransposeMode);
105: PETSC_EXTERN PetscErrorCode SVDGetTransposeMode(SVD,SVDTransposeMode*);
106: PETSC_EXTERN PetscErrorCode SVDSetDimensions(SVD,PetscInt,PetscInt,PetscInt);
107: PETSC_EXTERN PetscErrorCode SVDGetDimensions(SVD,PetscInt*,PetscInt*,PetscInt*);
108: PETSC_EXTERN PetscErrorCode SVDSetTolerances(SVD,PetscReal,PetscInt);
109: PETSC_EXTERN PetscErrorCode SVDGetTolerances(SVD,PetscReal*,PetscInt*);
110: PETSC_EXTERN PetscErrorCode SVDSetWhichSingularTriplets(SVD,SVDWhich);
111: PETSC_EXTERN PetscErrorCode SVDGetWhichSingularTriplets(SVD,SVDWhich*);
112: PETSC_EXTERN PetscErrorCode SVDSetFromOptions(SVD);
113: PETSC_EXTERN PetscErrorCode SVDSetOptionsPrefix(SVD,const char*);
114: PETSC_EXTERN PetscErrorCode SVDAppendOptionsPrefix(SVD,const char*);
115: PETSC_EXTERN PetscErrorCode SVDGetOptionsPrefix(SVD,const char*[]);
116: PETSC_EXTERN PetscErrorCode SVDSetUp(SVD);
117: PETSC_EXTERN PetscErrorCode SVDSolve(SVD);
118: PETSC_EXTERN PetscErrorCode SVDGetIterationNumber(SVD,PetscInt*);
119: PETSC_EXTERN PetscErrorCode SVDGetConvergedReason(SVD,SVDConvergedReason*);
120: PETSC_EXTERN PetscErrorCode SVDGetConverged(SVD,PetscInt*);
121: PETSC_EXTERN PetscErrorCode SVDGetSingularTriplet(SVD,PetscInt,PetscReal*,Vec,Vec);
122: PETSC_EXTERN PetscErrorCode SVDComputeResidualNorms(SVD,PetscInt,PetscReal*,PetscReal*);
123: PETSC_EXTERN PetscErrorCode SVDComputeRelativeError(SVD,PetscInt,PetscReal*);
124: PETSC_EXTERN PetscErrorCode SVDGetOperationCounters(SVD,PetscInt*,PetscInt*);
125: PETSC_EXTERN PetscErrorCode SVDView(SVD,PetscViewer);
126: PETSC_EXTERN PetscErrorCode SVDPrintSolution(SVD,PetscViewer);
127: PETSC_EXTERN PetscErrorCode SVDDestroy(SVD*);
128: PETSC_EXTERN PetscErrorCode SVDReset(SVD);

130: PETSC_EXTERN PetscErrorCode SVDMonitor(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt);
131: PETSC_EXTERN PetscErrorCode SVDMonitorSet(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
132: PETSC_EXTERN PetscErrorCode SVDMonitorCancel(SVD);
133: PETSC_EXTERN PetscErrorCode SVDGetMonitorContext(SVD,void **);
134: PETSC_EXTERN PetscErrorCode SVDMonitorAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
135: PETSC_EXTERN PetscErrorCode SVDMonitorFirst(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
136: PETSC_EXTERN PetscErrorCode SVDMonitorConverged(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
137: PETSC_EXTERN PetscErrorCode SVDMonitorLG(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
138: PETSC_EXTERN PetscErrorCode SVDMonitorLGAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);

140: PETSC_EXTERN PetscErrorCode SVDSetTrackAll(SVD,PetscBool);
141: PETSC_EXTERN PetscErrorCode SVDGetTrackAll(SVD,PetscBool*);

143: PETSC_EXTERN PetscErrorCode SVDCrossSetEPS(SVD,EPS);
144: PETSC_EXTERN PetscErrorCode SVDCrossGetEPS(SVD,EPS*);

146: PETSC_EXTERN PetscErrorCode SVDCyclicSetExplicitMatrix(SVD,PetscBool);
147: PETSC_EXTERN PetscErrorCode SVDCyclicGetExplicitMatrix(SVD,PetscBool*);
148: PETSC_EXTERN PetscErrorCode SVDCyclicSetEPS(SVD,EPS);
149: PETSC_EXTERN PetscErrorCode SVDCyclicGetEPS(SVD,EPS*);

151: PETSC_EXTERN PetscErrorCode SVDLanczosSetOneSide(SVD,PetscBool);
152: PETSC_EXTERN PetscErrorCode SVDLanczosGetOneSide(SVD,PetscBool*);

154: PETSC_EXTERN PetscErrorCode SVDTRLanczosSetOneSide(SVD,PetscBool);
155: PETSC_EXTERN PetscErrorCode SVDTRLanczosGetOneSide(SVD,PetscBool*);

157: PETSC_EXTERN PetscFunctionList SVDList;
158: PETSC_EXTERN PetscBool         SVDRegisterAllCalled;
159: PETSC_EXTERN PetscErrorCode SVDRegisterAll(void);
160: PETSC_EXTERN PetscErrorCode SVDRegister(const char[],PetscErrorCode(*)(SVD));

162: #endif
slepc-3.4.2.dfsg.orig/include/slepcqep.h0000644000175000017500000002022312211062077017042 0ustar gladkgladk/* User interface for SLEPc's quadratic eigenvalue solvers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCQEP_H) #define __SLEPCQEP_H #include PETSC_EXTERN PetscErrorCode QEPInitializePackage(void); /*S QEP - Abstract SLEPc object that manages all the quadratic eigenvalue problem solvers. Level: beginner .seealso: QEPCreate() S*/ typedef struct _p_QEP* QEP; /*J QEPType - String with the name of a quadratic eigensolver Level: beginner .seealso: QEPSetType(), QEP J*/ typedef const char* QEPType; #define QEPLINEAR "linear" #define QEPQARNOLDI "qarnoldi" #define QEPQLANCZOS "qlanczos" /* Logging support */ PETSC_EXTERN PetscClassId QEP_CLASSID; /*E QEPProblemType - Determines the type of the quadratic eigenproblem Level: intermediate .seealso: QEPSetProblemType(), QEPGetProblemType() E*/ typedef enum { QEP_GENERAL=1, QEP_HERMITIAN, /* M, C, K Hermitian */ QEP_GYROSCOPIC /* M, K Hermitian, M>0, C skew-Hermitian */ } QEPProblemType; /*E QEPWhich - Determines which part of the spectrum is requested Level: intermediate .seealso: QEPSetWhichEigenpairs(), QEPGetWhichEigenpairs() E*/ typedef enum { QEP_LARGEST_MAGNITUDE=1, QEP_SMALLEST_MAGNITUDE, QEP_LARGEST_REAL, QEP_SMALLEST_REAL, QEP_LARGEST_IMAGINARY, QEP_SMALLEST_IMAGINARY, QEP_TARGET_MAGNITUDE, QEP_TARGET_REAL, QEP_TARGET_IMAGINARY} QEPWhich; PETSC_EXTERN PetscErrorCode QEPCreate(MPI_Comm,QEP*); PETSC_EXTERN PetscErrorCode QEPDestroy(QEP*); PETSC_EXTERN PetscErrorCode QEPReset(QEP); PETSC_EXTERN PetscErrorCode QEPSetType(QEP,QEPType); PETSC_EXTERN PetscErrorCode QEPGetType(QEP,QEPType*); PETSC_EXTERN PetscErrorCode QEPSetProblemType(QEP,QEPProblemType); PETSC_EXTERN PetscErrorCode QEPGetProblemType(QEP,QEPProblemType*); PETSC_EXTERN PetscErrorCode QEPSetOperators(QEP,Mat,Mat,Mat); PETSC_EXTERN PetscErrorCode QEPGetOperators(QEP,Mat*,Mat*,Mat*); PETSC_EXTERN PetscErrorCode QEPSetTarget(QEP,PetscScalar); PETSC_EXTERN PetscErrorCode QEPGetTarget(QEP,PetscScalar*); PETSC_EXTERN PetscErrorCode QEPSetST(QEP,ST); PETSC_EXTERN PetscErrorCode QEPGetST(QEP,ST*); PETSC_EXTERN PetscErrorCode QEPSetFromOptions(QEP); PETSC_EXTERN PetscErrorCode QEPSetUp(QEP); PETSC_EXTERN PetscErrorCode QEPSolve(QEP); PETSC_EXTERN PetscErrorCode QEPView(QEP,PetscViewer); PETSC_EXTERN PetscErrorCode QEPPrintSolution(QEP,PetscViewer); PETSC_EXTERN PetscErrorCode QEPSetIP(QEP,IP); PETSC_EXTERN PetscErrorCode QEPGetIP(QEP,IP*); PETSC_EXTERN PetscErrorCode QEPSetDS(QEP,DS); PETSC_EXTERN PetscErrorCode QEPGetDS(QEP,DS*); PETSC_EXTERN PetscErrorCode QEPSetTolerances(QEP,PetscReal,PetscInt); PETSC_EXTERN PetscErrorCode QEPGetTolerances(QEP,PetscReal*,PetscInt*); PETSC_EXTERN PetscErrorCode QEPSetConvergenceTest(QEP,PetscErrorCode (*)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*); PETSC_EXTERN PetscErrorCode QEPConvergedDefault(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); PETSC_EXTERN PetscErrorCode QEPConvergedAbsolute(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); PETSC_EXTERN PetscErrorCode QEPSetDimensions(QEP,PetscInt,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode QEPGetDimensions(QEP,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode QEPSetScaleFactor(QEP,PetscReal); PETSC_EXTERN PetscErrorCode QEPGetScaleFactor(QEP,PetscReal*); PETSC_EXTERN PetscErrorCode QEPGetConverged(QEP,PetscInt*); PETSC_EXTERN PetscErrorCode QEPGetEigenpair(QEP,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec); PETSC_EXTERN PetscErrorCode QEPComputeRelativeError(QEP,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode QEPComputeResidualNorm(QEP,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode QEPGetErrorEstimate(QEP,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode QEPMonitor(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt); PETSC_EXTERN PetscErrorCode QEPMonitorSet(QEP,PetscErrorCode (*)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**)); PETSC_EXTERN PetscErrorCode QEPMonitorCancel(QEP); PETSC_EXTERN PetscErrorCode QEPGetMonitorContext(QEP,void **); PETSC_EXTERN PetscErrorCode QEPGetIterationNumber(QEP,PetscInt*); PETSC_EXTERN PetscErrorCode QEPGetOperationCounters(QEP,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode QEPSetInitialSpace(QEP,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode QEPSetInitialSpaceLeft(QEP,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode QEPSetWhichEigenpairs(QEP,QEPWhich); PETSC_EXTERN PetscErrorCode QEPGetWhichEigenpairs(QEP,QEPWhich*); PETSC_EXTERN PetscErrorCode QEPSetLeftVectorsWanted(QEP,PetscBool); PETSC_EXTERN PetscErrorCode QEPGetLeftVectorsWanted(QEP,PetscBool*); PETSC_EXTERN PetscErrorCode QEPSetEigenvalueComparison(QEP,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*); PETSC_EXTERN PetscErrorCode QEPMonitorAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode QEPMonitorFirst(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode QEPMonitorConverged(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode QEPMonitorLG(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode QEPMonitorLGAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode QEPSetTrackAll(QEP,PetscBool); PETSC_EXTERN PetscErrorCode QEPGetTrackAll(QEP,PetscBool*); PETSC_EXTERN PetscErrorCode QEPSetOptionsPrefix(QEP,const char*); PETSC_EXTERN PetscErrorCode QEPAppendOptionsPrefix(QEP,const char*); PETSC_EXTERN PetscErrorCode QEPGetOptionsPrefix(QEP,const char*[]); /*E QEPConvergedReason - Reason an eigensolver was said to have converged or diverged Level: beginner .seealso: QEPSolve(), QEPGetConvergedReason(), QEPSetTolerances() E*/ typedef enum {/* converged */ QEP_CONVERGED_TOL = 2, /* diverged */ QEP_DIVERGED_ITS = -3, QEP_DIVERGED_BREAKDOWN = -4, QEP_CONVERGED_ITERATING = 0} QEPConvergedReason; PETSC_EXTERN PetscErrorCode QEPGetConvergedReason(QEP,QEPConvergedReason *); PETSC_EXTERN PetscErrorCode QEPSortEigenvalues(QEP,PetscInt,PetscScalar*,PetscScalar*,PetscInt*); PETSC_EXTERN PetscErrorCode QEPCompareEigenvalues(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*); PETSC_EXTERN PetscFunctionList QEPList; PETSC_EXTERN PetscBool QEPRegisterAllCalled; PETSC_EXTERN PetscErrorCode QEPRegisterAll(void); PETSC_EXTERN PetscErrorCode QEPRegister(const char[],PetscErrorCode(*)(QEP)); PETSC_EXTERN PetscErrorCode QEPSetWorkVecs(QEP,PetscInt); /* --------- options specific to particular eigensolvers -------- */ PETSC_EXTERN PetscErrorCode QEPLinearSetCompanionForm(QEP,PetscInt); PETSC_EXTERN PetscErrorCode QEPLinearGetCompanionForm(QEP,PetscInt*); PETSC_EXTERN PetscErrorCode QEPLinearSetExplicitMatrix(QEP,PetscBool); PETSC_EXTERN PetscErrorCode QEPLinearGetExplicitMatrix(QEP,PetscBool*); PETSC_EXTERN PetscErrorCode QEPLinearSetEPS(QEP,EPS); PETSC_EXTERN PetscErrorCode QEPLinearGetEPS(QEP,EPS*); #endif slepc-3.4.2.dfsg.orig/include/slepceps.h0000644000175000017500000004256412211062077017060 0ustar gladkgladk/* User interface for the SLEPC eigenproblem solvers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCEPS_H) #define __SLEPCEPS_H #include #include #include PETSC_EXTERN PetscErrorCode EPSInitializePackage(void); /*S EPS - Abstract SLEPc object that manages all the eigenvalue problem solvers. Level: beginner .seealso: EPSCreate(), ST S*/ typedef struct _p_EPS* EPS; /*J EPSType - String with the name of a SLEPc eigensolver Level: beginner .seealso: EPSSetType(), EPS J*/ typedef const char* EPSType; #define EPSPOWER "power" #define EPSSUBSPACE "subspace" #define EPSARNOLDI "arnoldi" #define EPSLANCZOS "lanczos" #define EPSKRYLOVSCHUR "krylovschur" #define EPSGD "gd" #define EPSJD "jd" #define EPSRQCG "rqcg" #define EPSCISS "ciss" #define EPSLAPACK "lapack" #define EPSARPACK "arpack" #define EPSBLZPACK "blzpack" #define EPSTRLAN "trlan" #define EPSBLOPEX "blopex" #define EPSPRIMME "primme" #define EPSFEAST "feast" /* Logging support */ PETSC_EXTERN PetscClassId EPS_CLASSID; /*E EPSProblemType - Determines the type of eigenvalue problem Level: beginner .seealso: EPSSetProblemType(), EPSGetProblemType() E*/ typedef enum { EPS_HEP=1, EPS_GHEP, EPS_NHEP, EPS_GNHEP, EPS_PGNHEP, EPS_GHIEP } EPSProblemType; /*E EPSExtraction - Determines the type of extraction technique employed by the eigensolver Level: beginner .seealso: EPSSetExtraction(), EPSGetExtraction() E*/ typedef enum { EPS_RITZ=1, EPS_HARMONIC, EPS_HARMONIC_RELATIVE, EPS_HARMONIC_RIGHT, EPS_HARMONIC_LARGEST, EPS_REFINED, EPS_REFINED_HARMONIC } EPSExtraction; /*E EPSWhich - Determines which part of the spectrum is requested Level: intermediate .seealso: EPSSetWhichEigenpairs(), EPSGetWhichEigenpairs() E*/ typedef enum { EPS_LARGEST_MAGNITUDE=1, EPS_SMALLEST_MAGNITUDE, EPS_LARGEST_REAL, EPS_SMALLEST_REAL, EPS_LARGEST_IMAGINARY, EPS_SMALLEST_IMAGINARY, EPS_TARGET_MAGNITUDE, EPS_TARGET_REAL, EPS_TARGET_IMAGINARY, EPS_ALL, EPS_WHICH_USER } EPSWhich; /*E EPSBalance - The type of balancing used for non-Hermitian problems Level: intermediate .seealso: EPSSetBalance() E*/ typedef enum { EPS_BALANCE_NONE=1, EPS_BALANCE_ONESIDE, EPS_BALANCE_TWOSIDE, EPS_BALANCE_USER } EPSBalance; /*E EPSConv - Determines the convergence test Level: intermediate .seealso: EPSSetConvergenceTest(), EPSSetConvergenceTestFunction() E*/ typedef enum { EPS_CONV_ABS=1, EPS_CONV_EIG, EPS_CONV_NORM, EPS_CONV_USER } EPSConv; PETSC_EXTERN PetscErrorCode EPSCreate(MPI_Comm,EPS *); PETSC_EXTERN PetscErrorCode EPSDestroy(EPS*); PETSC_EXTERN PetscErrorCode EPSReset(EPS); PETSC_EXTERN PetscErrorCode EPSSetType(EPS,EPSType); PETSC_EXTERN PetscErrorCode EPSGetType(EPS,EPSType*); PETSC_EXTERN PetscErrorCode EPSSetProblemType(EPS,EPSProblemType); PETSC_EXTERN PetscErrorCode EPSGetProblemType(EPS,EPSProblemType*); PETSC_EXTERN PetscErrorCode EPSSetExtraction(EPS,EPSExtraction); PETSC_EXTERN PetscErrorCode EPSGetExtraction(EPS,EPSExtraction*); PETSC_EXTERN PetscErrorCode EPSSetBalance(EPS,EPSBalance,PetscInt,PetscReal); PETSC_EXTERN PetscErrorCode EPSGetBalance(EPS,EPSBalance*,PetscInt*,PetscReal*); PETSC_EXTERN PetscErrorCode EPSSetOperators(EPS,Mat,Mat); PETSC_EXTERN PetscErrorCode EPSGetOperators(EPS,Mat*,Mat*); PETSC_EXTERN PetscErrorCode EPSSetFromOptions(EPS); PETSC_EXTERN PetscErrorCode EPSSetUp(EPS); PETSC_EXTERN PetscErrorCode EPSSolve(EPS); PETSC_EXTERN PetscErrorCode EPSView(EPS,PetscViewer); PETSC_EXTERN PetscErrorCode EPSPrintSolution(EPS,PetscViewer); PETSC_EXTERN PetscErrorCode EPSSetTarget(EPS,PetscScalar); PETSC_EXTERN PetscErrorCode EPSGetTarget(EPS,PetscScalar*); PETSC_EXTERN PetscErrorCode EPSSetInterval(EPS,PetscReal,PetscReal); PETSC_EXTERN PetscErrorCode EPSGetInterval(EPS,PetscReal*,PetscReal*); PETSC_EXTERN PetscErrorCode EPSSetST(EPS,ST); PETSC_EXTERN PetscErrorCode EPSGetST(EPS,ST*); PETSC_EXTERN PetscErrorCode EPSSetIP(EPS,IP); PETSC_EXTERN PetscErrorCode EPSGetIP(EPS,IP*); PETSC_EXTERN PetscErrorCode EPSSetDS(EPS,DS); PETSC_EXTERN PetscErrorCode EPSGetDS(EPS,DS*); PETSC_EXTERN PetscErrorCode EPSSetTolerances(EPS,PetscReal,PetscInt); PETSC_EXTERN PetscErrorCode EPSGetTolerances(EPS,PetscReal*,PetscInt*); PETSC_EXTERN PetscErrorCode EPSSetConvergenceTestFunction(EPS,PetscErrorCode (*)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*); PETSC_EXTERN PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv); PETSC_EXTERN PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv); PETSC_EXTERN PetscErrorCode EPSConvergedEigRelative(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); PETSC_EXTERN PetscErrorCode EPSConvergedAbsolute(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); PETSC_EXTERN PetscErrorCode EPSConvergedNormRelative(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); PETSC_EXTERN PetscErrorCode EPSSetDimensions(EPS,PetscInt,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode EPSGetDimensions(EPS,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode EPSGetConverged(EPS,PetscInt*); PETSC_EXTERN PetscErrorCode EPSGetEigenpair(EPS,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec); PETSC_EXTERN PetscErrorCode EPSGetEigenvalue(EPS,PetscInt,PetscScalar*,PetscScalar*); PETSC_EXTERN PetscErrorCode EPSGetEigenvector(EPS,PetscInt,Vec,Vec); PETSC_EXTERN PetscErrorCode EPSGetEigenvectorLeft(EPS,PetscInt,Vec,Vec); PETSC_EXTERN PetscErrorCode EPSComputeRelativeError(EPS,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode EPSComputeRelativeErrorLeft(EPS,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode EPSComputeResidualNorm(EPS,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode EPSComputeResidualNormLeft(EPS,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode EPSGetInvariantSubspace(EPS,Vec*); PETSC_EXTERN PetscErrorCode EPSGetInvariantSubspaceLeft(EPS,Vec*); PETSC_EXTERN PetscErrorCode EPSGetErrorEstimate(EPS,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode EPSGetErrorEstimateLeft(EPS,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode EPSMonitor(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt); PETSC_EXTERN PetscErrorCode EPSMonitorSet(EPS,PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**)); PETSC_EXTERN PetscErrorCode EPSMonitorCancel(EPS); PETSC_EXTERN PetscErrorCode EPSGetMonitorContext(EPS,void **); PETSC_EXTERN PetscErrorCode EPSGetIterationNumber(EPS,PetscInt*); PETSC_EXTERN PetscErrorCode EPSGetOperationCounters(EPS,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode EPSSetWhichEigenpairs(EPS,EPSWhich); PETSC_EXTERN PetscErrorCode EPSGetWhichEigenpairs(EPS,EPSWhich*); PETSC_EXTERN PetscErrorCode EPSSetLeftVectorsWanted(EPS,PetscBool); PETSC_EXTERN PetscErrorCode EPSGetLeftVectorsWanted(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSSetMatrixNorms(EPS,PetscReal,PetscReal,PetscBool); PETSC_EXTERN PetscErrorCode EPSGetMatrixNorms(EPS,PetscReal*,PetscReal*,PetscBool*); PETSC_EXTERN PetscErrorCode EPSSetTrueResidual(EPS,PetscBool); PETSC_EXTERN PetscErrorCode EPSGetTrueResidual(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSSetEigenvalueComparison(EPS,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*); PETSC_EXTERN PetscErrorCode EPSSetArbitrarySelection(EPS,PetscErrorCode (*func)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*),void*); PETSC_EXTERN PetscErrorCode EPSIsGeneralized(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSIsHermitian(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSIsPositive(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSMonitorFirst(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode EPSMonitorAll(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode EPSMonitorConverged(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode EPSMonitorLG(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode EPSMonitorLGAll(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode EPSSetTrackAll(EPS,PetscBool); PETSC_EXTERN PetscErrorCode EPSGetTrackAll(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSSetDeflationSpace(EPS,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode EPSRemoveDeflationSpace(EPS); PETSC_EXTERN PetscErrorCode EPSSetInitialSpace(EPS,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode EPSSetInitialSpaceLeft(EPS,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode EPSSetOptionsPrefix(EPS,const char*); PETSC_EXTERN PetscErrorCode EPSAppendOptionsPrefix(EPS,const char*); PETSC_EXTERN PetscErrorCode EPSGetOptionsPrefix(EPS,const char*[]); /*E EPSConvergedReason - Reason an eigensolver was said to have converged or diverged Level: beginner .seealso: EPSSolve(), EPSGetConvergedReason(), EPSSetTolerances() E*/ typedef enum {/* converged */ EPS_CONVERGED_TOL = 2, /* diverged */ EPS_DIVERGED_ITS = -3, EPS_DIVERGED_BREAKDOWN = -4, EPS_CONVERGED_ITERATING = 0} EPSConvergedReason; PETSC_EXTERN PetscErrorCode EPSGetConvergedReason(EPS,EPSConvergedReason *); PETSC_EXTERN PetscErrorCode EPSSortEigenvalues(EPS,PetscInt,PetscScalar*,PetscScalar*,PetscInt*); PETSC_EXTERN PetscErrorCode EPSCompareEigenvalues(EPS,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*); PETSC_EXTERN PetscErrorCode EPSGetStartVector(EPS,PetscInt,Vec,PetscBool*); PETSC_EXTERN PetscErrorCode EPSGetStartVectorLeft(EPS,PetscInt,Vec,PetscBool*); PETSC_EXTERN PetscFunctionList EPSList; PETSC_EXTERN PetscBool EPSRegisterAllCalled; PETSC_EXTERN PetscErrorCode EPSRegisterAll(void); PETSC_EXTERN PetscErrorCode EPSRegister(const char[],PetscErrorCode(*)(EPS)); PETSC_EXTERN PetscErrorCode EPSSetWorkVecs(EPS,PetscInt); /* --------- options specific to particular eigensolvers -------- */ /*E EPSPowerShiftType - determines the type of shift used in the Power iteration Level: advanced .seealso: EPSPowerSetShiftType(), EPSPowerGetShiftType() E*/ typedef enum { EPS_POWER_SHIFT_CONSTANT, EPS_POWER_SHIFT_RAYLEIGH, EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType; PETSC_EXTERN const char *EPSPowerShiftTypes[]; PETSC_EXTERN PetscErrorCode EPSPowerSetShiftType(EPS,EPSPowerShiftType); PETSC_EXTERN PetscErrorCode EPSPowerGetShiftType(EPS,EPSPowerShiftType*); PETSC_EXTERN PetscErrorCode EPSArnoldiSetDelayed(EPS,PetscBool); PETSC_EXTERN PetscErrorCode EPSArnoldiGetDelayed(EPS,PetscBool*); PETSC_EXTERN PetscErrorCode EPSKrylovSchurSetRestart(EPS,PetscReal); PETSC_EXTERN PetscErrorCode EPSKrylovSchurGetRestart(EPS,PetscReal*); /*E EPSLanczosReorthogType - determines the type of reorthogonalization used in the Lanczos method Level: advanced .seealso: EPSLanczosSetReorthog(), EPSLanczosGetReorthog() E*/ typedef enum { EPS_LANCZOS_REORTHOG_LOCAL, EPS_LANCZOS_REORTHOG_FULL, EPS_LANCZOS_REORTHOG_SELECTIVE, EPS_LANCZOS_REORTHOG_PERIODIC, EPS_LANCZOS_REORTHOG_PARTIAL, EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType; PETSC_EXTERN const char *EPSLanczosReorthogTypes[]; PETSC_EXTERN PetscErrorCode EPSLanczosSetReorthog(EPS,EPSLanczosReorthogType); PETSC_EXTERN PetscErrorCode EPSLanczosGetReorthog(EPS,EPSLanczosReorthogType*); PETSC_EXTERN PetscErrorCode EPSBlzpackSetBlockSize(EPS,PetscInt); PETSC_EXTERN PetscErrorCode EPSBlzpackSetNSteps(EPS,PetscInt); /*E EPSPRIMMEMethod - determines the method selected in the PRIMME library Level: advanced .seealso: EPSPRIMMESetMethod(), EPSPRIMMEGetMethod() E*/ typedef enum { EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME, EPS_PRIMME_DEFAULT_MIN_MATVECS, EPS_PRIMME_ARNOLDI, EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION, EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod; PETSC_EXTERN const char *EPSPRIMMEMethods[]; PETSC_EXTERN PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs); PETSC_EXTERN PetscErrorCode EPSPRIMMESetMethod(EPS eps, EPSPRIMMEMethod method); PETSC_EXTERN PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs); PETSC_EXTERN PetscErrorCode EPSPRIMMEGetMethod(EPS eps, EPSPRIMMEMethod *method); /*E EPSOrthType - determines the orthogonalization used in the search subspace Level: advanced .seealso: EPSGDSetBOrth(), EPSJDSetBOrth() E*/ typedef enum { EPS_ORTH_I=1, EPS_ORTH_B, EPS_ORTH_BOPT } EPSOrthType; PETSC_EXTERN PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart); PETSC_EXTERN PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart); PETSC_EXTERN PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize); PETSC_EXTERN PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize); PETSC_EXTERN PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk); PETSC_EXTERN PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk); PETSC_EXTERN PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize); PETSC_EXTERN PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize); PETSC_EXTERN PetscErrorCode EPSGDSetBOrth(EPS eps,EPSOrthType borth); PETSC_EXTERN PetscErrorCode EPSGDGetBOrth(EPS eps,EPSOrthType *borth); PETSC_EXTERN PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow); PETSC_EXTERN PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow); PETSC_EXTERN PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool use_gd2); PETSC_EXTERN PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *flg); PETSC_EXTERN PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart); PETSC_EXTERN PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscBool *krylovstart); PETSC_EXTERN PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize); PETSC_EXTERN PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize); PETSC_EXTERN PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk); PETSC_EXTERN PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk); PETSC_EXTERN PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize); PETSC_EXTERN PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize); PETSC_EXTERN PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix); PETSC_EXTERN PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix); PETSC_EXTERN PetscErrorCode EPSJDSetConstCorrectionTol(EPS eps,PetscBool dynamic); PETSC_EXTERN PetscErrorCode EPSJDGetConstCorrectionTol(EPS eps,PetscBool *dynamic); PETSC_EXTERN PetscErrorCode EPSJDSetBOrth(EPS eps,EPSOrthType borth); PETSC_EXTERN PetscErrorCode EPSJDGetBOrth(EPS eps,EPSOrthType *borth); PETSC_EXTERN PetscErrorCode EPSJDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow); PETSC_EXTERN PetscErrorCode EPSJDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow); PETSC_EXTERN PetscErrorCode EPSRQCGSetReset(EPS,PetscInt); PETSC_EXTERN PetscErrorCode EPSRQCGGetReset(EPS,PetscInt*); PETSC_EXTERN PetscErrorCode EPSCISSSetRegion(EPS,PetscScalar,PetscReal,PetscReal); PETSC_EXTERN PetscErrorCode EPSCISSGetRegion(EPS,PetscScalar*,PetscReal*,PetscReal*); PETSC_EXTERN PetscErrorCode EPSCISSSetSizes(EPS,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscBool); PETSC_EXTERN PetscErrorCode EPSCISSGetSizes(EPS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscBool*); PETSC_EXTERN PetscErrorCode EPSCISSSetThreshold(EPS,PetscReal,PetscReal); PETSC_EXTERN PetscErrorCode EPSCISSGetThreshold(EPS,PetscReal*,PetscReal*); PETSC_EXTERN PetscErrorCode EPSCISSSetRefinement(EPS,PetscInt,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode EPSCISSGetRefinement(EPS,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode EPSFEASTSetNumPoints(EPS,PetscInt); PETSC_EXTERN PetscErrorCode EPSFEASTGetNumPoints(EPS,PetscInt*); #endif slepc-3.4.2.dfsg.orig/include/slepcblaslapack.h.html0000644000175000017500000020163012211062077021320 0ustar gladkgladk
Actual source code: slepcblaslapack.h

  1: /*
  2:    Necessary routines in BLAS and LAPACK not included in petscblaslapack.f

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <petscblaslapack.h>

 28: /* Macros for building LAPACK names */
 29: #if defined(PETSC_BLASLAPACK_UNDERSCORE)
 30: #if defined(PETSC_USE_REAL_SINGLE)
 31: #define SLEPC_BLASLAPACKREAL(lcase,ucase) s##lcase##_
 32: #if defined(PETSC_USE_COMPLEX)
 33: #define SLEPC_BLASLAPACK(lcase,ucase) c##lcase##_
 34: #else
 35: #define SLEPC_BLASLAPACK(lcase,ucase) s##lcase##_
 36: #endif
 37: #elif defined(PETSC_USE_REAL___FLOAT128)
 38: #define SLEPC_BLASLAPACKREAL(lcase,ucase) q##lcase##_
 39: #if defined(PETSC_USE_COMPLEX)
 40: #define SLEPC_BLASLAPACK(lcase,ucase) w##lcase##_
 41: #else
 42: #define SLEPC_BLASLAPACK(lcase,ucase) q##lcase##_
 43: #endif
 44: #else
 45: #define SLEPC_BLASLAPACKREAL(lcase,ucase) d##lcase##_
 46: #if defined(PETSC_USE_COMPLEX)
 47: #define SLEPC_BLASLAPACK(lcase,ucase) z##lcase##_
 48: #else
 49: #define SLEPC_BLASLAPACK(lcase,ucase) d##lcase##_
 50: #endif
 51: #endif

 53: #elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)
 54: #if defined(PETSC_USE_REAL_SINGLE)
 55: #define SLEPC_BLASLAPACKREAL(lcase,ucase) S##ucase
 56: #if defined(PETSC_USE_COMPLEX)
 57: #define SLEPC_BLASLAPACK(lcase,ucase) C##ucase
 58: #else
 59: #define SLEPC_BLASLAPACK(lcase,ucase) S##ucase
 60: #endif
 61: #elif defined(PETSC_USE_REAL___FLOAT128)
 62: #define SLEPC_BLASLAPACKREAL(lcase,ucase) Q##ucase
 63: #if defined(PETSC_USE_COMPLEX)
 64: #define SLEPC_BLASLAPACK(lcase,ucase) W##ucase
 65: #else
 66: #define SLEPC_BLASLAPACK(lcase,ucase) Q##ucase
 67: #endif
 68: #else
 69: #define SLEPC_BLASLAPACKREAL(lcase,ucase) D##ucase
 70: #if defined(PETSC_USE_COMPLEX)
 71: #define SLEPC_BLASLAPACK(lcase,ucase) Z##ucase
 72: #else
 73: #define SLEPC_BLASLAPACK(lcase,ucase) D##ucase
 74: #endif
 75: #endif

 77: #else
 78: #if defined(PETSC_USE_REAL_SINGLE)
 79: #define SLEPC_BLASLAPACKREAL(lcase,ucase) s##lcase
 80: #if defined(PETSC_USE_COMPLEX)
 81: #define SLEPC_BLASLAPACK(lcase,ucase) c##lcase
 82: #else
 83: #define SLEPC_BLASLAPACK(lcase,ucase) s##lcase
 84: #endif
 85: #elif defined(PETSC_USE_REAL___FLOAT128)
 86: #define SLEPC_BLASLAPACKREAL(lcase,ucase) q##lcase
 87: #if defined(PETSC_USE_COMPLEX)
 88: #define SLEPC_BLASLAPACK(lcase,ucase) w##lcase
 89: #else
 90: #define SLEPC_BLASLAPACK(lcase,ucase) q##lcase
 91: #endif
 92: #else
 93: #define SLEPC_BLASLAPACKREAL(lcase,ucase) d##lcase
 94: #if defined(PETSC_USE_COMPLEX)
 95: #define SLEPC_BLASLAPACK(lcase,ucase) z##lcase
 96: #else
 97: #define SLEPC_BLASLAPACK(lcase,ucase) d##lcase
 98: #endif
 99: #endif

101: #endif

103: /* LAPACK functions without string parameters */
104: #define LAPACKlaev2_ SLEPC_BLASLAPACK(laev2,LAEV2)
105: #define LAPACKgehrd_ SLEPC_BLASLAPACK(gehrd,GEHRD)
106: #define LAPACKgetri_ SLEPC_BLASLAPACK(getri,GETRI)
107: #define LAPACKgelqf_ SLEPC_BLASLAPACK(gelqf,GELQF)
108: #define LAPACKtgexc_ SLEPC_BLASLAPACK(tgexc,TGEXC)
109: #define LAPACKlarfg_ SLEPC_BLASLAPACK(larfg,LARFG)
110: #define LAPACKlag2_  SLEPC_BLASLAPACKREAL(lag2,LAG2)
111: #define LAPACKlasv2_ SLEPC_BLASLAPACKREAL(lasv2,LASV2)
112: #define LAPACKlartg_ SLEPC_BLASLAPACKREAL(lartg,LARTG)
113: #define LAPACKlaln2_ SLEPC_BLASLAPACKREAL(laln2,LALN2)
114: #if !defined(PETSC_USE_COMPLEX)
115: #define LAPACKorghr_ SLEPC_BLASLAPACK(orghr,ORGHR)
116: #define LAPACKorgqr_ SLEPC_BLASLAPACK(orgqr,ORGQR)
117: #else
118: #define LAPACKorghr_ SLEPC_BLASLAPACK(unghr,UNGHR)
119: #define LAPACKorgqr_ SLEPC_BLASLAPACK(ungqr,UNGQR)
120: #endif
121: /* the next one needs a special treatment due to the special names:
122:    srot, drot, csrot, zdrot */
123: #if !defined(PETSC_USE_COMPLEX)
124: #define BLASrot_     SLEPC_BLASLAPACK(rot,ROT)
125: #else
126: #if defined(PETSC_USE_REAL_SINGLE)
127: #define BLASrot_     SLEPC_BLASLAPACK(srot,SROT)
128: #elif defined(PETSC_USE_REAL___FLOAT128)
129: #define BLASrot_     SLEPC_BLASLAPACK(qrot,QROT)
130: #else
131: #define BLASrot_     SLEPC_BLASLAPACK(drot,DROT)
132: #endif
133: #endif

135: /* LAPACK functions with string parameters */
136: #if !defined(PETSC_BLASLAPACK_STDCALL)

138: /* same name for real and complex */
139: #define LAPACKlanhs_(a,b,c,d,e) SLEPC_BLASLAPACK(lanhs,LANHS) ((a),(b),(c),(d),(e),1)
140: #define LAPACKlange_(a,b,c,d,e,f) SLEPC_BLASLAPACK(lange,LANGE) ((a),(b),(c),(d),(e),(f),1)
141: #define LAPACKggevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac) SLEPC_BLASLAPACK(ggevx,GGEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),(z),(aa),(ab),(ac),1,1,1,1)
142: #define LAPACKggev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(ggev,GGEV) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,1)
143: #define LAPACKpbtrf_(a,b,c,d,e,f) SLEPC_BLASLAPACK(pbtrf,PBTRF) ((a),(b),(c),(d),(e),(f),1)
144: #define LAPACKlarf_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(larf,LARF) ((a),(b),(c),(d),(e),(f),(g),(h),(i),1)
145: /* subroutines in which we use only the real version, do not care whether they have different name */
146: #define LAPACKstevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) SLEPC_BLASLAPACKREAL(stevr,STEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),1,1)
147: #define LAPACKbdsdc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
148: #define LAPACKlamch_(a) SLEPC_BLASLAPACKREAL(lamch,LAMCH) ((a),1)

150: #if !defined(PETSC_USE_COMPLEX)
151: /* different name or signature, real */
152: #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1)
153: #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(syevr,SYEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),1,1,1)
154: #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(syevd,SYEVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),1,1)
155: #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n)  SLEPC_BLASLAPACK(sygvd,SYGVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
156: #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(ormlq,ORMLQ) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1)
157: #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(orgtr,ORGTR) ((a),(b),(c),(d),(e),(f),(g),(h),1)
158: #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(sytrd,SYTRD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1)
159: #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(trevc,TREVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
160: #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,1,1)
161: #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(trexc,TREXC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1)
162: #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1)
163: #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,1)
164: #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),1,1,1)
165: #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(stedc,STEDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),1)
166: #else
167: /* different name or signature, complex */
168: #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(hemm,HEMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1)
169: #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(heevr,HEEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,1)
170: #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(heevd,HEEVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1)
171: #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(hegvd,HEGVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,1)
172: #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(unmlq,UNMLQ) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1)
173: #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(ungtr,UNGTR) ((a),(b),(c),(d),(e),(f),(g),(h),1)
174: #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(hetrd,HETRD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1)
175: #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(trevc,TREVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),1,1)
176: #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),1,1,1,1)
177: #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(trexc,TREXC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),1)
178: #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),1)
179: #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,1)
180: #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),1,1,1)
181: #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(stedc,STEDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1)
182: #endif

184: #else /* PETSC_BLASLAPACK_STDCALL */

186: /* same name for real and complex */
187: #define LAPACKlanhs_(a,b,c,d,e) SLEPC_BLASLAPACK(lanhs,LANHS) ((a),1,(b),(c),(d),(e))
188: #define LAPACKlange_(a,b,c,d,e,f) SLEPC_BLASLAPACK(lange,LANGE) ((a),1,(b),(c),(d),(e),(f))
189: #define LAPACKggevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac) SLEPC_BLASLAPACK(ggevx,GGEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),(z),(aa),(ab),(ac))
190: #define LAPACKggev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(ggev,GGEV) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q))
191: #define LAPACKpbtrf_(a,b,c,d,e,f) SLEPC_BLASLAPACK(pbtrf,PBTRF) ((a),1,(b),(c),(d),(e),(f))
192: #define LAPACKlarf_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(larf,LARF) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i))
193: /* subroutines in which we use only the real version, do not care whether they have different name */
194: #define LAPACKstevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) SLEPC_BLASLAPACKREAL(stevr,STEVR) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t))
195: #define LAPACKbdsdc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
196: #define LAPACKlamch_(a) SLEPC_BLASLAPACKREAL(lamch,LAMCH) ((a),1)

198: #if !defined(PETSC_USE_COMPLEX)
199: /* different name or signature, real */
200: #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l))
201: #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(syevr,SYEVR) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u))
202: #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(syevd,SYEVD) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k))
203: #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n)  SLEPC_BLASLAPACK(sygvd,SYGVD) ((a),(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
204: #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(ormlq,ORMLQ) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
205: #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(orgtr,ORGTR) ((a),1,(b),(c),(d),(e),(f),(g),(h))
206: #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(sytrd,SYTRD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j))
207: #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(trevc,TREVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
208: #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w))
209: #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(trexc,TREXC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j))
210: #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
211: #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p))
212: #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s))
213: #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(stedc,STEDC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k))
214: #else
215: /* different name or signature, complex */
216: #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(hemm,HEMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l))
217: #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(heevr,HEEVR) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w))
218: #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(heevd,HEEVD) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
219: #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(hegvd,HEGVD) ((a),(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p))
220: #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(unmlq,UNMLQ) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
221: #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(ungtr,UNGTR) ((a),1,(b),(c),(d),(e),(f),(g),(h))
222: #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(hetrd,HETRD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j))
223: #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(trevc,TREVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o))
224: #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v))
225: #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(trexc,TREXC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i))
226: #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o))
227: #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q))
228: #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s))
229: #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(stedc,STEDC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
230: #endif

232: #endif

234: #if !defined(PETSC_BLASLAPACK_STDCALL)

236: /* LAPACK functions without string parameters */
237: PETSC_EXTERN void      SLEPC_BLASLAPACK(laev2,LAEV2) (PetscScalar*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*);
238: PETSC_EXTERN void      SLEPC_BLASLAPACK(gehrd,GEHRD) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
239: PETSC_EXTERN void      SLEPC_BLASLAPACK(getri,GETRI) (PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
240: PETSC_EXTERN void      SLEPC_BLASLAPACK(gelqf,GELQF) (PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
241: PETSC_EXTERN void      SLEPC_BLASLAPACK(larfg,LARFG) (PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*);
242: PETSC_EXTERN void      SLEPC_BLASLAPACKREAL(lag2,LAG2) (PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
243: PETSC_EXTERN void      SLEPC_BLASLAPACKREAL(lasv2,LASV2) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
244: PETSC_EXTERN void      SLEPC_BLASLAPACKREAL(lartg,LARTG) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
245: PETSC_EXTERN void      SLEPC_BLASLAPACKREAL(laln2,LALN2) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*);
246: PETSC_EXTERN void      BLASrot_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*);
247: #if !defined(PETSC_USE_COMPLEX)
248: PETSC_EXTERN void      SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
249: PETSC_EXTERN void      SLEPC_BLASLAPACK(orghr,ORGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
250: PETSC_EXTERN void      SLEPC_BLASLAPACK(orgqr,ORGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
251: #else
252: PETSC_EXTERN void      SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
253: PETSC_EXTERN void      SLEPC_BLASLAPACK(unghr,UNGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
254: PETSC_EXTERN void      SLEPC_BLASLAPACK(ungqr,UNGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
255: #endif

257: /* LAPACK functions with string parameters */
258: PETSC_EXTERN PetscReal SLEPC_BLASLAPACK(lanhs,LANHS) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt);
259: PETSC_EXTERN PetscReal SLEPC_BLASLAPACK(lange,LANGE) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt);
260: PETSC_EXTERN PetscReal SLEPC_BLASLAPACK(pbtrf,PBTRF) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
261: PETSC_EXTERN void      SLEPC_BLASLAPACK(larf,LARF) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt);

263: PETSC_EXTERN void      SLEPC_BLASLAPACKREAL(stevr,STEVR) (const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
264: PETSC_EXTERN void      SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) (const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
265: PETSC_EXTERN PetscReal SLEPC_BLASLAPACKREAL(lamch,LAMCH) (const char*,PetscBLASInt);

267: #if !defined(PETSC_USE_COMPLEX)
268: PETSC_EXTERN void      SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
269: PETSC_EXTERN void      SLEPC_BLASLAPACK(ggev,GGEV) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
270: PETSC_EXTERN void      SLEPC_BLASLAPACK(symm,SYMM)   (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
271: PETSC_EXTERN void      SLEPC_BLASLAPACK(syevr,SYEVR) (const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
272: PETSC_EXTERN void      SLEPC_BLASLAPACK(syevd,SYEVD) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
273: PETSC_EXTERN void      SLEPC_BLASLAPACK(sygvd,SYGVD) (PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
274: PETSC_EXTERN void      SLEPC_BLASLAPACK(ormlq,ORMLQ) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
275: PETSC_EXTERN void      SLEPC_BLASLAPACK(orgtr,ORGTR) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
276: PETSC_EXTERN void      SLEPC_BLASLAPACK(sytrd,SYTRD) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
277: PETSC_EXTERN void      SLEPC_BLASLAPACK(trevc,TREVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
278: PETSC_EXTERN void      SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
279: PETSC_EXTERN void      SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt);
280: PETSC_EXTERN void      SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
281: PETSC_EXTERN void      SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
282: PETSC_EXTERN void      SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
283: PETSC_EXTERN void      SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
284: #else
285: PETSC_EXTERN void      SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*, PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
286: PETSC_EXTERN void      SLEPC_BLASLAPACK(ggev,GGEV) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
287: PETSC_EXTERN void      SLEPC_BLASLAPACK(hemm,HEMM)   (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
288: PETSC_EXTERN void      SLEPC_BLASLAPACK(heevr,HEEVR) (const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
289: PETSC_EXTERN void      SLEPC_BLASLAPACK(heevd,HEEVD) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
290: PETSC_EXTERN void      SLEPC_BLASLAPACK(hegvd,HEGVD) (PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
291: PETSC_EXTERN void      SLEPC_BLASLAPACK(unmlq,UNMLQ) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
292: PETSC_EXTERN void      SLEPC_BLASLAPACK(ungtr,UNGTR) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
293: PETSC_EXTERN void      SLEPC_BLASLAPACK(hetrd,HETRD) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
294: PETSC_EXTERN void      SLEPC_BLASLAPACK(trevc,TREVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
295: PETSC_EXTERN void      SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
296: PETSC_EXTERN void      SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
297: PETSC_EXTERN void      SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
298: PETSC_EXTERN void      SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
299: PETSC_EXTERN void      SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
300: PETSC_EXTERN void      SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
301: #endif

303: #else /* PETSC_BLASLAPACK_STDCALL */

305: /* LAPACK functions without string parameters */
306: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(laev2,LAEV2) (PetscScalar*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*);
307: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gehrd,GEHRD) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
308: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(getri,GETRI) (PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
309: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gelqf,GELQF) (PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
310: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(larfg,LARFG) (PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*);
311: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lag2,LAG2) (PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
312: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lasv2,LASV2) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
313: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lartg,LARTG) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
314: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(laln2,LALN2) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*);
315: PETSC_EXTERN void PETSC_STDCALL BLASrot_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*);
316: #if !defined(PETSC_USE_COMPLEX)
317: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
318: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orghr,ORGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
319: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orgqr,ORGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
320: #else
321: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
322: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(unghr,UNGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
323: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ungqr,UNGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
324: #endif

326: /* LAPACK functions with string parameters */
327: PETSC_EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(lanhs,LANHS) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*);
328: PETSC_EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(lange,LANGE) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*);
329: PETSC_EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(pbtrf,PBTRF) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
330: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(larf,LARF) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*);

332: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(stevr,STEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
333: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
334: PETSC_EXTERN PetscReal SLEPC_BLASLAPACKREAL(lamch,LAMCH) (const char*,PetscBLASInt);

336: #if !defined(PETSC_USE_COMPLEX)
337: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
338: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggev,GGEV) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
339: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(symm,SYMM)   (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
340: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(syevr,SYEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
341: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(syevd,SYEVD) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
342: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(sygvd,SYGVD) (PetscBLASInt*,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
343: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ormlq,ORMLQ) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
344: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orgtr,ORGTR) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
345: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(sytrd,SYTRD) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
346: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trevc,TREVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
347: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
348: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
349: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
350: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
351: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
352: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
353: #else
354: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*, PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
355: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggev,GGEV) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
356: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hemm,HEMM)   (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
357: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(heevr,HEEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
358: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(heevd,HEEVD) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
359: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hegvd,HEGVD) (PetscBLASInt*,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
360: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(unmlq,UNMLQ) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
361: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ungtr,UNGTR) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
362: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hetrd,HETRD) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
363: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trevc,TREVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*);
364: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
365: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
366: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
367: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*);
368: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
369: PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
370: #endif

372: #endif

374: #endif
slepc-3.4.2.dfsg.orig/include/slepcnep.h0000644000175000017500000002067712211062077017054 0ustar gladkgladk/* User interface for SLEPc's nonlinear eigenvalue solvers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCNEP_H) #define __SLEPCNEP_H #include #include PETSC_EXTERN PetscErrorCode NEPInitializePackage(void); /*S NEP - Abstract SLEPc object that manages all solvers for nonlinear eigenvalue problems. Level: beginner .seealso: NEPCreate() S*/ typedef struct _p_NEP* NEP; /*J NEPType - String with the name of a nonlinear eigensolver Level: beginner .seealso: NEPSetType(), NEP J*/ typedef const char* NEPType; #define NEPRII "rii" #define NEPSLP "slp" #define NEPNARNOLDI "narnoldi" /* Logging support */ PETSC_EXTERN PetscClassId NEP_CLASSID; /*E NEPWhich - Determines which part of the spectrum is requested Level: intermediate .seealso: NEPSetWhichEigenpairs(), NEPGetWhichEigenpairs() E*/ typedef enum { NEP_LARGEST_MAGNITUDE=1, NEP_SMALLEST_MAGNITUDE, NEP_LARGEST_REAL, NEP_SMALLEST_REAL, NEP_LARGEST_IMAGINARY, NEP_SMALLEST_IMAGINARY, NEP_TARGET_MAGNITUDE, NEP_TARGET_REAL, NEP_TARGET_IMAGINARY} NEPWhich; /*E NEPConvergedReason - Reason a nonlinear eigensolver was said to have converged or diverged Level: beginner .seealso: NEPSolve(), NEPGetConvergedReason(), NEPSetTolerances() E*/ typedef enum {/* converged */ NEP_CONVERGED_FNORM_ABS = 2, NEP_CONVERGED_FNORM_RELATIVE = 3, NEP_CONVERGED_SNORM_RELATIVE = 4, /* diverged */ NEP_DIVERGED_LINEAR_SOLVE = -1, NEP_DIVERGED_FUNCTION_COUNT = -2, NEP_DIVERGED_MAX_IT = -3, NEP_DIVERGED_BREAKDOWN = -4, NEP_DIVERGED_FNORM_NAN = -5, NEP_CONVERGED_ITERATING = 0} NEPConvergedReason; PETSC_EXTERN PetscErrorCode NEPCreate(MPI_Comm,NEP*); PETSC_EXTERN PetscErrorCode NEPDestroy(NEP*); PETSC_EXTERN PetscErrorCode NEPReset(NEP); PETSC_EXTERN PetscErrorCode NEPSetType(NEP,NEPType); PETSC_EXTERN PetscErrorCode NEPGetType(NEP,NEPType*); PETSC_EXTERN PetscErrorCode NEPSetTarget(NEP,PetscScalar); PETSC_EXTERN PetscErrorCode NEPGetTarget(NEP,PetscScalar*); PETSC_EXTERN PetscErrorCode NEPSetKSP(NEP,KSP); PETSC_EXTERN PetscErrorCode NEPGetKSP(NEP,KSP*); PETSC_EXTERN PetscErrorCode NEPSetFromOptions(NEP); PETSC_EXTERN PetscErrorCode NEPSetUp(NEP); PETSC_EXTERN PetscErrorCode NEPSolve(NEP); PETSC_EXTERN PetscErrorCode NEPView(NEP,PetscViewer); PETSC_EXTERN PetscErrorCode NEPSetFunction(NEP,Mat,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void*); PETSC_EXTERN PetscErrorCode NEPGetFunction(NEP,Mat*,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void**); PETSC_EXTERN PetscErrorCode NEPSetJacobian(NEP,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat*,MatStructure*,void*),void*); PETSC_EXTERN PetscErrorCode NEPGetJacobian(NEP,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat*,MatStructure*,void*),void**); PETSC_EXTERN PetscErrorCode NEPSetSplitOperator(NEP,PetscInt,Mat*,FN*,MatStructure); PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorTerm(NEP,PetscInt,Mat*,FN*); PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorInfo(NEP,PetscInt*,MatStructure*); PETSC_EXTERN PetscErrorCode NEPSetIP(NEP,IP); PETSC_EXTERN PetscErrorCode NEPGetIP(NEP,IP*); PETSC_EXTERN PetscErrorCode NEPSetDS(NEP,DS); PETSC_EXTERN PetscErrorCode NEPGetDS(NEP,DS*); PETSC_EXTERN PetscErrorCode NEPSetTolerances(NEP,PetscReal,PetscReal,PetscReal,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode NEPGetTolerances(NEP,PetscReal*,PetscReal*,PetscReal*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode NEPSetConvergenceTest(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void*,PetscErrorCode (*)(void*)); PETSC_EXTERN PetscErrorCode NEPConvergedDefault(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*); PETSC_EXTERN PetscErrorCode NEPSetDimensions(NEP,PetscInt,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode NEPGetDimensions(NEP,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode NEPSetLagPreconditioner(NEP,PetscInt); PETSC_EXTERN PetscErrorCode NEPGetLagPreconditioner(NEP,PetscInt*); PETSC_EXTERN PetscErrorCode NEPSetConstCorrectionTol(NEP,PetscBool); PETSC_EXTERN PetscErrorCode NEPGetConstCorrectionTol(NEP,PetscBool*); PETSC_EXTERN PetscErrorCode NEPGetConverged(NEP,PetscInt*); PETSC_EXTERN PetscErrorCode NEPGetEigenpair(NEP,PetscInt,PetscScalar*,Vec); PETSC_EXTERN PetscErrorCode NEPComputeRelativeError(NEP,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode NEPComputeResidualNorm(NEP,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode NEPGetErrorEstimate(NEP,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode NEPComputeFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*); PETSC_EXTERN PetscErrorCode NEPComputeJacobian(NEP,PetscScalar,Mat*,MatStructure*); PETSC_EXTERN PetscErrorCode NEPApplyFunction(NEP,PetscScalar,Vec,Vec,Vec,Mat*,Mat*,MatStructure*); PETSC_EXTERN PetscErrorCode NEPApplyJacobian(NEP,PetscScalar,Vec,Vec,Vec,Mat*,MatStructure*); PETSC_EXTERN PetscErrorCode NEPProjectOperator(NEP,PetscInt,PetscInt,Vec); PETSC_EXTERN PetscErrorCode NEPMonitor(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt); PETSC_EXTERN PetscErrorCode NEPMonitorSet(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**)); PETSC_EXTERN PetscErrorCode NEPMonitorCancel(NEP); PETSC_EXTERN PetscErrorCode NEPGetMonitorContext(NEP,void **); PETSC_EXTERN PetscErrorCode NEPGetIterationNumber(NEP,PetscInt*); PETSC_EXTERN PetscErrorCode NEPGetOperationCounters(NEP,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode NEPSetInitialSpace(NEP,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode NEPSetWhichEigenpairs(NEP,NEPWhich); PETSC_EXTERN PetscErrorCode NEPGetWhichEigenpairs(NEP,NEPWhich*); PETSC_EXTERN PetscErrorCode NEPSetEigenvalueComparison(NEP,PetscErrorCode (*func)(NEP,PetscScalar,PetscScalar,PetscInt*,void*),void*); PETSC_EXTERN PetscErrorCode NEPMonitorAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode NEPMonitorFirst(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode NEPMonitorConverged(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode NEPMonitorLG(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode NEPMonitorLGAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode NEPSetTrackAll(NEP,PetscBool); PETSC_EXTERN PetscErrorCode NEPGetTrackAll(NEP,PetscBool*); PETSC_EXTERN PetscErrorCode NEPSetOptionsPrefix(NEP,const char*); PETSC_EXTERN PetscErrorCode NEPAppendOptionsPrefix(NEP,const char*); PETSC_EXTERN PetscErrorCode NEPGetOptionsPrefix(NEP,const char*[]); PETSC_EXTERN PetscErrorCode NEPGetConvergedReason(NEP,NEPConvergedReason *); PETSC_EXTERN PetscErrorCode NEPSortEigenvalues(NEP,PetscInt,PetscScalar*,PetscInt*); PETSC_EXTERN PetscErrorCode NEPCompareEigenvalues(NEP,PetscScalar,PetscScalar,PetscInt*); PETSC_EXTERN PetscFunctionList NEPList; PETSC_EXTERN PetscBool NEPRegisterAllCalled; PETSC_EXTERN PetscErrorCode NEPRegisterAll(void); PETSC_EXTERN PetscErrorCode NEPRegister(const char[],PetscErrorCode(*)(NEP)); PETSC_EXTERN PetscErrorCode NEPSetWorkVecs(NEP,PetscInt); /* --------- options specific to particular eigensolvers -------- */ PETSC_EXTERN PetscErrorCode NEPSLPSetEPS(NEP,EPS); PETSC_EXTERN PetscErrorCode NEPSLPGetEPS(NEP,EPS*); #endif slepc-3.4.2.dfsg.orig/include/slepcnep.h.html0000644000175000017500000007071312211062077020013 0ustar gladkgladk
Actual source code: slepcnep.h

  1: /*
  2:    User interface for SLEPc's nonlinear eigenvalue solvers.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepceps.h>
 27: #include <slepcfn.h>

 29: PETSC_EXTERN PetscErrorCode NEPInitializePackage(void);

 31: /*S
 32:      NEP - Abstract SLEPc object that manages all solvers for
 33:      nonlinear eigenvalue problems.

 35:    Level: beginner

 37: .seealso:  NEPCreate()
 38: S*/
 39: typedef struct _p_NEP* NEP;

 41: /*J
 42:     NEPType - String with the name of a nonlinear eigensolver

 44:    Level: beginner

 46: .seealso: NEPSetType(), NEP
 47: J*/
 48: typedef const char* NEPType;
 49: #define NEPRII       "rii"
 50: #define NEPSLP       "slp"
 51: #define NEPNARNOLDI  "narnoldi"

 53: /* Logging support */
 54: PETSC_EXTERN PetscClassId NEP_CLASSID;

 56: /*E
 57:     NEPWhich - Determines which part of the spectrum is requested

 59:     Level: intermediate

 61: .seealso: NEPSetWhichEigenpairs(), NEPGetWhichEigenpairs()
 62: E*/
 63: typedef enum { NEP_LARGEST_MAGNITUDE=1,
 64:                NEP_SMALLEST_MAGNITUDE,
 65:                NEP_LARGEST_REAL,
 66:                NEP_SMALLEST_REAL,
 67:                NEP_LARGEST_IMAGINARY,
 68:                NEP_SMALLEST_IMAGINARY,
 69:                NEP_TARGET_MAGNITUDE,
 70:                NEP_TARGET_REAL,
 71:                NEP_TARGET_IMAGINARY} NEPWhich;

 73: /*E
 74:     NEPConvergedReason - Reason a nonlinear eigensolver was said to
 75:          have converged or diverged

 77:     Level: beginner

 79: .seealso: NEPSolve(), NEPGetConvergedReason(), NEPSetTolerances()
 80: E*/
 81: typedef enum {/* converged */
 82:               NEP_CONVERGED_FNORM_ABS          =  2,
 83:               NEP_CONVERGED_FNORM_RELATIVE     =  3,
 84:               NEP_CONVERGED_SNORM_RELATIVE     =  4,
 85:               /* diverged */
 86:               NEP_DIVERGED_LINEAR_SOLVE        = -1,
 87:               NEP_DIVERGED_FUNCTION_COUNT      = -2,
 88:               NEP_DIVERGED_MAX_IT              = -3,
 89:               NEP_DIVERGED_BREAKDOWN           = -4,
 90:               NEP_DIVERGED_FNORM_NAN           = -5,
 91:               NEP_CONVERGED_ITERATING          =  0} NEPConvergedReason;

 93: PETSC_EXTERN PetscErrorCode NEPCreate(MPI_Comm,NEP*);
 94: PETSC_EXTERN PetscErrorCode NEPDestroy(NEP*);
 95: PETSC_EXTERN PetscErrorCode NEPReset(NEP);
 96: PETSC_EXTERN PetscErrorCode NEPSetType(NEP,NEPType);
 97: PETSC_EXTERN PetscErrorCode NEPGetType(NEP,NEPType*);
 98: PETSC_EXTERN PetscErrorCode NEPSetTarget(NEP,PetscScalar);
 99: PETSC_EXTERN PetscErrorCode NEPGetTarget(NEP,PetscScalar*);
100: PETSC_EXTERN PetscErrorCode NEPSetKSP(NEP,KSP);
101: PETSC_EXTERN PetscErrorCode NEPGetKSP(NEP,KSP*);
102: PETSC_EXTERN PetscErrorCode NEPSetFromOptions(NEP);
103: PETSC_EXTERN PetscErrorCode NEPSetUp(NEP);
104: PETSC_EXTERN PetscErrorCode NEPSolve(NEP);
105: PETSC_EXTERN PetscErrorCode NEPView(NEP,PetscViewer);

107: PETSC_EXTERN PetscErrorCode NEPSetFunction(NEP,Mat,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void*);
108: PETSC_EXTERN PetscErrorCode NEPGetFunction(NEP,Mat*,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void**);
109: PETSC_EXTERN PetscErrorCode NEPSetJacobian(NEP,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat*,MatStructure*,void*),void*);
110: PETSC_EXTERN PetscErrorCode NEPGetJacobian(NEP,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat*,MatStructure*,void*),void**);
111: PETSC_EXTERN PetscErrorCode NEPSetSplitOperator(NEP,PetscInt,Mat*,FN*,MatStructure);
112: PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorTerm(NEP,PetscInt,Mat*,FN*);
113: PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorInfo(NEP,PetscInt*,MatStructure*);

115: PETSC_EXTERN PetscErrorCode NEPSetIP(NEP,IP);
116: PETSC_EXTERN PetscErrorCode NEPGetIP(NEP,IP*);
117: PETSC_EXTERN PetscErrorCode NEPSetDS(NEP,DS);
118: PETSC_EXTERN PetscErrorCode NEPGetDS(NEP,DS*);
119: PETSC_EXTERN PetscErrorCode NEPSetTolerances(NEP,PetscReal,PetscReal,PetscReal,PetscInt,PetscInt);
120: PETSC_EXTERN PetscErrorCode NEPGetTolerances(NEP,PetscReal*,PetscReal*,PetscReal*,PetscInt*,PetscInt*);
121: PETSC_EXTERN PetscErrorCode NEPSetConvergenceTest(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void*,PetscErrorCode (*)(void*));
122: PETSC_EXTERN PetscErrorCode NEPConvergedDefault(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*);
123: PETSC_EXTERN PetscErrorCode NEPSetDimensions(NEP,PetscInt,PetscInt,PetscInt);
124: PETSC_EXTERN PetscErrorCode NEPGetDimensions(NEP,PetscInt*,PetscInt*,PetscInt*);
125: PETSC_EXTERN PetscErrorCode NEPSetLagPreconditioner(NEP,PetscInt);
126: PETSC_EXTERN PetscErrorCode NEPGetLagPreconditioner(NEP,PetscInt*);
127: PETSC_EXTERN PetscErrorCode NEPSetConstCorrectionTol(NEP,PetscBool);
128: PETSC_EXTERN PetscErrorCode NEPGetConstCorrectionTol(NEP,PetscBool*);

130: PETSC_EXTERN PetscErrorCode NEPGetConverged(NEP,PetscInt*);
131: PETSC_EXTERN PetscErrorCode NEPGetEigenpair(NEP,PetscInt,PetscScalar*,Vec);

133: PETSC_EXTERN PetscErrorCode NEPComputeRelativeError(NEP,PetscInt,PetscReal*);
134: PETSC_EXTERN PetscErrorCode NEPComputeResidualNorm(NEP,PetscInt,PetscReal*);
135: PETSC_EXTERN PetscErrorCode NEPGetErrorEstimate(NEP,PetscInt,PetscReal*);

137: PETSC_EXTERN PetscErrorCode NEPComputeFunction(NEP,PetscScalar,Mat*,Mat*,MatStructure*);
138: PETSC_EXTERN PetscErrorCode NEPComputeJacobian(NEP,PetscScalar,Mat*,MatStructure*);
139: PETSC_EXTERN PetscErrorCode NEPApplyFunction(NEP,PetscScalar,Vec,Vec,Vec,Mat*,Mat*,MatStructure*);
140: PETSC_EXTERN PetscErrorCode NEPApplyJacobian(NEP,PetscScalar,Vec,Vec,Vec,Mat*,MatStructure*);
141: PETSC_EXTERN PetscErrorCode NEPProjectOperator(NEP,PetscInt,PetscInt,Vec);

143: PETSC_EXTERN PetscErrorCode NEPMonitor(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt);
144: PETSC_EXTERN PetscErrorCode NEPMonitorSet(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
145: PETSC_EXTERN PetscErrorCode NEPMonitorCancel(NEP);
146: PETSC_EXTERN PetscErrorCode NEPGetMonitorContext(NEP,void **);
147: PETSC_EXTERN PetscErrorCode NEPGetIterationNumber(NEP,PetscInt*);
148: PETSC_EXTERN PetscErrorCode NEPGetOperationCounters(NEP,PetscInt*,PetscInt*,PetscInt*);

150: PETSC_EXTERN PetscErrorCode NEPSetInitialSpace(NEP,PetscInt,Vec*);
151: PETSC_EXTERN PetscErrorCode NEPSetWhichEigenpairs(NEP,NEPWhich);
152: PETSC_EXTERN PetscErrorCode NEPGetWhichEigenpairs(NEP,NEPWhich*);
153: PETSC_EXTERN PetscErrorCode NEPSetEigenvalueComparison(NEP,PetscErrorCode (*func)(NEP,PetscScalar,PetscScalar,PetscInt*,void*),void*);

155: PETSC_EXTERN PetscErrorCode NEPMonitorAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
156: PETSC_EXTERN PetscErrorCode NEPMonitorFirst(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
157: PETSC_EXTERN PetscErrorCode NEPMonitorConverged(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
158: PETSC_EXTERN PetscErrorCode NEPMonitorLG(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
159: PETSC_EXTERN PetscErrorCode NEPMonitorLGAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);

161: PETSC_EXTERN PetscErrorCode NEPSetTrackAll(NEP,PetscBool);
162: PETSC_EXTERN PetscErrorCode NEPGetTrackAll(NEP,PetscBool*);

164: PETSC_EXTERN PetscErrorCode NEPSetOptionsPrefix(NEP,const char*);
165: PETSC_EXTERN PetscErrorCode NEPAppendOptionsPrefix(NEP,const char*);
166: PETSC_EXTERN PetscErrorCode NEPGetOptionsPrefix(NEP,const char*[]);

168: PETSC_EXTERN PetscErrorCode NEPGetConvergedReason(NEP,NEPConvergedReason *);

170: PETSC_EXTERN PetscErrorCode NEPSortEigenvalues(NEP,PetscInt,PetscScalar*,PetscInt*);
171: PETSC_EXTERN PetscErrorCode NEPCompareEigenvalues(NEP,PetscScalar,PetscScalar,PetscInt*);

173: PETSC_EXTERN PetscFunctionList NEPList;
174: PETSC_EXTERN PetscBool         NEPRegisterAllCalled;
175: PETSC_EXTERN PetscErrorCode NEPRegisterAll(void);
176: PETSC_EXTERN PetscErrorCode NEPRegister(const char[],PetscErrorCode(*)(NEP));

178: PETSC_EXTERN PetscErrorCode NEPSetWorkVecs(NEP,PetscInt);

180: /* --------- options specific to particular eigensolvers -------- */

182: PETSC_EXTERN PetscErrorCode NEPSLPSetEPS(NEP,EPS);
183: PETSC_EXTERN PetscErrorCode NEPSLPGetEPS(NEP,EPS*);

185: #endif

slepc-3.4.2.dfsg.orig/include/slepc.h0000644000175000017500000000231512211062077016336 0ustar gladkgladk/* This is the main SLEPc include file (for C and C++). It is included by all other SLEPc include files, so it almost never has to be specifically included. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Include all top-level SLEPc functionality */ #include #include #include #include slepc-3.4.2.dfsg.orig/include/finclude/0000755000175000017500000000000012214143515016647 5ustar gladkgladkslepc-3.4.2.dfsg.orig/include/finclude/slepcsvd.h.html0000644000175000017500000000774512211062077021623 0ustar gladkgladk
Actual source code: slepcsvd.h

  1: !
  2: !  Include file for Fortran use of the SVD object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcsvddef.h

 26: !  Convergence flags.
 27: !  They sould match the flags in $SLEPC_DIR/include/slepcsvd.h

 29:       PetscEnum SVD_CONVERGED_TOL
 30:       PetscEnum SVD_DIVERGED_ITS
 31:       PetscEnum SVD_DIVERGED_BREAKDOWN
 32:       PetscEnum SVD_CONVERGED_ITERATING

 34:       parameter (SVD_CONVERGED_TOL          =  2)
 35:       parameter (SVD_DIVERGED_ITS           = -3)
 36:       parameter (SVD_DIVERGED_BREAKDOWN     = -4)
 37:       parameter (SVD_CONVERGED_ITERATING    =  0)

 39:       PetscEnum SVD_TRANSPOSE_EXPLICIT
 40:       PetscEnum SVD_TRANSPOSE_IMPLICIT

 42:       parameter (SVD_TRANSPOSE_EXPLICIT     =  0)
 43:       parameter (SVD_TRANSPOSE_IMPLICIT     =  1)

 45:       integer SVD_LARGEST
 46:       integer SVD_SMALLEST

 48:       parameter (SVD_LARGEST                =  0)
 49:       parameter (SVD_SMALLEST               =  1)

 51: !
 52: !   Possible arguments to SVDMonitorSet()
 53: !
 54:       external SVDMONITORALL
 55:       external SVDMONITORLG
 56:       external SVDMONITORLGALL
 57:       external SVDMONITORCONVERGED
 58:       external SVDMONITORFIRST

 60: !
 61: !  End of Fortran include file for the SVD package in SLEPc
 62: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcqep.h0000644000175000017500000000526712211062077020646 0ustar gladkgladk! ! Include file for Fortran use of the QEP object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcqepdef.h" ! Convergence flags. ! They should match the flags in $SLEPC_DIR/include/slepcqep.h PetscEnum QEP_CONVERGED_TOL PetscEnum QEP_DIVERGED_ITS PetscEnum QEP_DIVERGED_BREAKDOWN PetscEnum QEP_CONVERGED_ITERATING parameter (QEP_CONVERGED_TOL = 2) parameter (QEP_DIVERGED_ITS = -3) parameter (QEP_DIVERGED_BREAKDOWN = -4) parameter (QEP_CONVERGED_ITERATING = 0) PetscEnum QEP_GENERAL PetscEnum QEP_HERMITIAN PetscEnum QEP_GYROSCOPIC parameter (QEP_GENERAL = 1) parameter (QEP_HERMITIAN = 2) parameter (QEP_GYROSCOPIC = 3) PetscEnum QEP_LARGEST_MAGNITUDE PetscEnum QEP_SMALLEST_MAGNITUDE PetscEnum QEP_LARGEST_REAL PetscEnum QEP_SMALLEST_REAL PetscEnum QEP_LARGEST_IMAGINARY PetscEnum QEP_SMALLEST_IMAGINARY PetscEnum QEP_TARGET_MAGNITUDE PetscEnum QEP_TARGET_REAL PetscEnum QEP_TARGET_IMAGINARY parameter (QEP_LARGEST_MAGNITUDE = 1) parameter (QEP_SMALLEST_MAGNITUDE = 2) parameter (QEP_LARGEST_REAL = 3) parameter (QEP_SMALLEST_REAL = 4) parameter (QEP_LARGEST_IMAGINARY = 5) parameter (QEP_SMALLEST_IMAGINARY = 6) parameter (QEP_TARGET_MAGNITUDE = 7) parameter (QEP_TARGET_REAL = 8) parameter (QEP_TARGET_IMAGINARY = 9) ! ! Possible arguments to QEPMonitorSet() ! external QEPMONITORALL external QEPMONITORLG external QEPMONITORLGALL external QEPMONITORCONVERGED external QEPMONITORFIRST ! ! End of Fortran include file for the QEP package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcipdef.h.html0000644000175000017500000000623112211062077022103 0ustar gladkgladk
Actual source code: slepcipdef.h

  1: !
  2: !  Include file for Fortran use of the IP object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 27: #define IP PetscFortranAddr
 28: #endif

 30: #define IPType             character*(80)
 31: #define IPOrthogType       PetscEnum
 32: #define IPOrthogRefineType PetscEnum

 34: #define IPBILINEAR     'bilinear'
 35: #define IPSESQUILINEAR 'sesquilinear'
 36: #define IPINDEFINITE   'indefinite'

 38: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcqep.h90.html0000644000175000017500000000506112211062077021752 0ustar gladkgladk
Actual source code: slepcqep.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional QEP include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcqep.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcqep.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcstdef.h0000644000175000017500000000256212211062077021161 0ustar gladkgladk! ! Include file for Fortran use of the ST object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCST_H) #define __SLEPCST_H #include "finclude/petsckspdef.h" #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define ST PetscFortranAddr #endif #define STType character*(80) #define STMatMode PetscEnum #define STSHELL 'shell' #define STSHIFT 'shift' #define STSINVERT 'sinvert' #define STCAYLEY 'cayley' #define STFOLD 'fold' #define STPRECOND 'precond' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepceps.h0000644000175000017500000001530412211062077020641 0ustar gladkgladk! ! Include file for Fortran use of the EPS object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcepsdef.h" ! Convergence flags. ! They sould match the flags in $SLEPC_DIR/include/slepceps.h PetscEnum EPS_CONVERGED_TOL PetscEnum EPS_DIVERGED_ITS PetscEnum EPS_DIVERGED_BREAKDOWN PetscEnum EPS_CONVERGED_ITERATING parameter (EPS_CONVERGED_TOL = 2) parameter (EPS_DIVERGED_ITS = -3) parameter (EPS_DIVERGED_BREAKDOWN = -4) parameter (EPS_CONVERGED_ITERATING = 0) PetscEnum EPS_HEP PetscEnum EPS_GHEP PetscEnum EPS_NHEP PetscEnum EPS_GNHEP PetscEnum EPS_PGNHEP PetscEnum EPS_GHIEP parameter (EPS_HEP = 1) parameter (EPS_GHEP = 2) parameter (EPS_NHEP = 3) parameter (EPS_GNHEP = 4) parameter (EPS_PGNHEP = 5) parameter (EPS_GHIEP = 6) PetscEnum EPS_LARGEST_MAGNITUDE PetscEnum EPS_SMALLEST_MAGNITUDE PetscEnum EPS_LARGEST_REAL PetscEnum EPS_SMALLEST_REAL PetscEnum EPS_LARGEST_IMAGINARY PetscEnum EPS_SMALLEST_IMAGINARY PetscEnum EPS_TARGET_MAGNITUDE PetscEnum EPS_TARGET_REAL PetscEnum EPS_TARGET_IMAGINARY PetscEnum EPS_ALL PetscEnum EPS_WHICH_USER parameter (EPS_LARGEST_MAGNITUDE = 1) parameter (EPS_SMALLEST_MAGNITUDE = 2) parameter (EPS_LARGEST_REAL = 3) parameter (EPS_SMALLEST_REAL = 4) parameter (EPS_LARGEST_IMAGINARY = 5) parameter (EPS_SMALLEST_IMAGINARY = 6) parameter (EPS_TARGET_MAGNITUDE = 7) parameter (EPS_TARGET_REAL = 8) parameter (EPS_TARGET_IMAGINARY = 9) parameter (EPS_ALL = 10) parameter (EPS_WHICH_USER = 11) PetscEnum EPS_BALANCE_NONE PetscEnum EPS_BALANCE_ONESIDE PetscEnum EPS_BALANCE_TWOSIDE PetscEnum EPS_BALANCE_USER parameter (EPS_BALANCE_NONE = 1) parameter (EPS_BALANCE_ONESIDE = 2) parameter (EPS_BALANCE_TWOSIDE = 3) parameter (EPS_BALANCE_USER = 4) PetscEnum EPS_POWER_SHIFT_CONSTANT PetscEnum EPS_POWER_SHIFT_RAYLEIGH PetscEnum EPS_POWER_SHIFT_WILKINSON parameter (EPS_POWER_SHIFT_CONSTANT = 0) parameter (EPS_POWER_SHIFT_RAYLEIGH = 1) parameter (EPS_POWER_SHIFT_WILKINSON = 2) PetscEnum EPS_RITZ PetscEnum EPS_HARMONIC PetscEnum EPS_HARMONIC_RELATIVE PetscEnum EPS_HARMONIC_RIGHT PetscEnum EPS_HARMONIC_LARGEST PetscEnum EPS_REFINED PetscEnum EPS_REFINED_HARMONIC parameter (EPS_RITZ = 1) parameter (EPS_HARMONIC = 2) parameter (EPS_HARMONIC_RELATIVE = 3) parameter (EPS_HARMONIC_RIGHT = 4) parameter (EPS_HARMONIC_LARGEST = 5) parameter (EPS_REFINED = 6) parameter (EPS_REFINED_HARMONIC = 7) PetscEnum EPS_CONV_ABS PetscEnum EPS_CONV_EIG PetscEnum EPS_CONV_NORM PetscEnum EPS_CONV_USER parameter (EPS_CONV_ABS = 1) parameter (EPS_CONV_EIG = 2) parameter (EPS_CONV_NORM = 3) parameter (EPS_CONV_USER = 4) PetscEnum EPS_LANCZOS_REORTHOG_LOCAL PetscEnum EPS_LANCZOS_REORTHOG_FULL PetscEnum EPS_LANCZOS_REORTHOG_SELECTIVE PetscEnum EPS_LANCZOS_REORTHOG_PERIODIC PetscEnum EPS_LANCZOS_REORTHOG_PARTIAL PetscEnum EPS_LANCZOS_REORTHOG_DELAYED parameter (EPS_LANCZOS_REORTHOG_LOCAL = 0) parameter (EPS_LANCZOS_REORTHOG_FULL = 1) parameter (EPS_LANCZOS_REORTHOG_SELECTIVE = 2) parameter (EPS_LANCZOS_REORTHOG_PERIODIC = 3) parameter (EPS_LANCZOS_REORTHOG_PARTIAL = 4) parameter (EPS_LANCZOS_REORTHOG_DELAYED = 5) PetscEnum EPS_PRIMME_DYNAMIC PetscEnum EPS_PRIMME_DEFAULT_MIN_TIME PetscEnum EPS_PRIMME_DEFAULT_MIN_MATVECS PetscEnum EPS_PRIMME_ARNOLDI PetscEnum EPS_PRIMME_GD PetscEnum EPS_PRIMME_GD_PLUSK PetscEnum EPS_PRIMME_GD_OLSEN_PLUSK PetscEnum EPS_PRIMME_JD_OLSEN_PLUSK PetscEnum EPS_PRIMME_RQI PetscEnum EPS_PRIMME_JDQR PetscEnum EPS_PRIMME_JDQMR PetscEnum EPS_PRIMME_JDQMR_ETOL PetscEnum EPS_PRIMME_SUBSPACE_ITERATION PetscEnum EPS_PRIMME_LOBPCG_ORTHOBASIS PetscEnum EPS_PRIMME_LOBPCG_ORTHOBASISW parameter (EPS_PRIMME_DYNAMIC = 0) parameter (EPS_PRIMME_DEFAULT_MIN_TIME = 1) parameter (EPS_PRIMME_DEFAULT_MIN_MATVECS = 2) parameter (EPS_PRIMME_ARNOLDI = 3) parameter (EPS_PRIMME_GD = 4) parameter (EPS_PRIMME_GD_PLUSK = 5) parameter (EPS_PRIMME_GD_OLSEN_PLUSK = 7) parameter (EPS_PRIMME_JD_OLSEN_PLUSK = 8) parameter (EPS_PRIMME_RQI = 9) parameter (EPS_PRIMME_JDQR = 10) parameter (EPS_PRIMME_JDQMR = 11) parameter (EPS_PRIMME_JDQMR_ETOL = 12) parameter (EPS_PRIMME_SUBSPACE_ITERATION = 13) parameter (EPS_PRIMME_LOBPCG_ORTHOBASIS = 14) parameter (EPS_PRIMME_LOBPCG_ORTHOBASISW = 15) PetscEnum EPS_ORTH_I PetscEnum EPS_ORTH_B PetscEnum EPS_ORTH_BOPT parameter (EPS_ORTH_I = 1) parameter (EPS_ORTH_B = 2) parameter (EPS_ORTH_BOPT = 3) ! ! Possible arguments to EPSMonitorSet() ! external EPSMONITORALL external EPSMONITORLG external EPSMONITORLGALL external EPSMONITORCONVERGED external EPSMONITORFIRST ! ! End of Fortran include file for the EPS package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcqepdef.h0000644000175000017500000000275712211062077021326 0ustar gladkgladk! ! Include file for Fortran use of the QEP object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCQEP_H) #define __SLEPCQEP_H #include "finclude/slepcipdef.h" #include "finclude/slepcstdef.h" #include "finclude/slepcdsdef.h" #include "finclude/slepcepsdef.h" #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define QEP PetscFortranAddr #endif #define QEPType character*(80) #define QEPProblemType PetscEnum #define QEPWhich PetscEnum #define QEPConvergedReason PetscEnum #define QEPLINEAR 'linear' #define QEPQARNOLDI 'qarnoldi' #define QEPQLANCZOS 'qlanczos' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcnep.h0000644000175000017500000000566212211062077020642 0ustar gladkgladk! ! Include file for Fortran use of the NEP object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcnepdef.h" ! Convergence flags. ! They should match the flags in $SLEPC_DIR/include/slepcnep.h PetscEnum NEP_CONVERGED_FNORM_ABS PetscEnum NEP_CONVERGED_FNORM_RELATIVE PetscEnum NEP_CONVERGED_SNORM_RELATIVE PetscEnum NEP_DIVERGED_LINEAR_SOLVE PetscEnum NEP_DIVERGED_FUNCTION_COUNT PetscEnum NEP_DIVERGED_MAX_IT PetscEnum NEP_DIVERGED_BREAKDOWN PetscEnum NEP_DIVERGED_FNORM_NAN PetscEnum NEP_CONVERGED_ITERATING parameter (NEP_CONVERGED_FNORM_ABS = 2) parameter (NEP_CONVERGED_FNORM_RELATIVE = 3) parameter (NEP_CONVERGED_SNORM_RELATIVE = 4) parameter (NEP_DIVERGED_LINEAR_SOLVE = -1) parameter (NEP_DIVERGED_FUNCTION_COUNT = -2) parameter (NEP_DIVERGED_MAX_IT = -3) parameter (NEP_DIVERGED_BREAKDOWN = -4) parameter (NEP_DIVERGED_FNORM_NAN = -5) parameter (NEP_CONVERGED_ITERATING = 0) PetscEnum NEP_LARGEST_MAGNITUDE PetscEnum NEP_SMALLEST_MAGNITUDE PetscEnum NEP_LARGEST_REAL PetscEnum NEP_SMALLEST_REAL PetscEnum NEP_LARGEST_IMAGINARY PetscEnum NEP_SMALLEST_IMAGINARY PetscEnum NEP_TARGET_MAGNITUDE PetscEnum NEP_TARGET_REAL PetscEnum NEP_TARGET_IMAGINARY parameter (NEP_LARGEST_MAGNITUDE = 1) parameter (NEP_SMALLEST_MAGNITUDE = 2) parameter (NEP_LARGEST_REAL = 3) parameter (NEP_SMALLEST_REAL = 4) parameter (NEP_LARGEST_IMAGINARY = 5) parameter (NEP_SMALLEST_IMAGINARY = 6) parameter (NEP_TARGET_MAGNITUDE = 7) parameter (NEP_TARGET_REAL = 8) parameter (NEP_TARGET_IMAGINARY = 9) ! ! Possible arguments to NEPMonitorSet() ! external NEPMONITORALL external NEPMONITORLG external NEPMONITORLGALL external NEPMONITORCONVERGED external NEPMONITORFIRST ! ! End of Fortran include file for the NEP package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcnep.h.html0000644000175000017500000001262612211062077021603 0ustar gladkgladk
Actual source code: slepcnep.h

  1: !
  2: !  Include file for Fortran use of the NEP object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcnepdef.h

 26: !  Convergence flags.
 27: !  They should match the flags in $SLEPC_DIR/include/slepcnep.h

 29:       PetscEnum NEP_CONVERGED_FNORM_ABS
 30:       PetscEnum NEP_CONVERGED_FNORM_RELATIVE
 31:       PetscEnum NEP_CONVERGED_SNORM_RELATIVE
 32:       PetscEnum NEP_DIVERGED_LINEAR_SOLVE
 33:       PetscEnum NEP_DIVERGED_FUNCTION_COUNT
 34:       PetscEnum NEP_DIVERGED_MAX_IT
 35:       PetscEnum NEP_DIVERGED_BREAKDOWN
 36:       PetscEnum NEP_DIVERGED_FNORM_NAN
 37:       PetscEnum NEP_CONVERGED_ITERATING

 39:       parameter (NEP_CONVERGED_FNORM_ABS      =  2)
 40:       parameter (NEP_CONVERGED_FNORM_RELATIVE =  3)
 41:       parameter (NEP_CONVERGED_SNORM_RELATIVE =  4)
 42:       parameter (NEP_DIVERGED_LINEAR_SOLVE    = -1)
 43:       parameter (NEP_DIVERGED_FUNCTION_COUNT  = -2)
 44:       parameter (NEP_DIVERGED_MAX_IT          = -3)
 45:       parameter (NEP_DIVERGED_BREAKDOWN       = -4)
 46:       parameter (NEP_DIVERGED_FNORM_NAN       = -5)
 47:       parameter (NEP_CONVERGED_ITERATING      =  0)

 49:       PetscEnum NEP_LARGEST_MAGNITUDE
 50:       PetscEnum NEP_SMALLEST_MAGNITUDE
 51:       PetscEnum NEP_LARGEST_REAL
 52:       PetscEnum NEP_SMALLEST_REAL
 53:       PetscEnum NEP_LARGEST_IMAGINARY
 54:       PetscEnum NEP_SMALLEST_IMAGINARY
 55:       PetscEnum NEP_TARGET_MAGNITUDE
 56:       PetscEnum NEP_TARGET_REAL
 57:       PetscEnum NEP_TARGET_IMAGINARY

 59:       parameter (NEP_LARGEST_MAGNITUDE      =  1)
 60:       parameter (NEP_SMALLEST_MAGNITUDE     =  2)
 61:       parameter (NEP_LARGEST_REAL           =  3)
 62:       parameter (NEP_SMALLEST_REAL          =  4)
 63:       parameter (NEP_LARGEST_IMAGINARY      =  5)
 64:       parameter (NEP_SMALLEST_IMAGINARY     =  6)
 65:       parameter (NEP_TARGET_MAGNITUDE       =  7)
 66:       parameter (NEP_TARGET_REAL            =  8)
 67:       parameter (NEP_TARGET_IMAGINARY       =  9)

 69: !
 70: !   Possible arguments to NEPMonitorSet()
 71: !
 72:       external NEPMONITORALL
 73:       external NEPMONITORLG
 74:       external NEPMONITORLGALL
 75:       external NEPMONITORCONVERGED
 76:       external NEPMONITORFIRST

 78: !
 79: !  End of Fortran include file for the NEP package in SLEPc
 80: !
slepc-3.4.2.dfsg.orig/include/finclude/slepc.h0000644000175000017500000000220612211062077020126 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Single Fortran include file for all of SLEPc ! #include "finclude/slepcsys.h" #include "finclude/slepceps.h" #include "finclude/slepcip.h" #include "finclude/slepcst.h" #include "finclude/slepcsvd.h" #include "finclude/slepcqep.h" slepc-3.4.2.dfsg.orig/include/finclude/slepcstdef.h.html0000644000175000017500000000666112211062077022130 0ustar gladkgladk
Actual source code: slepcstdef.h

  1: !
  2: !  Include file for Fortran use of the ST object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26: #include "finclude/petsckspdef.h"

 28: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 29: #define ST        PetscFortranAddr
 30: #endif

 32: #define STType    character*(80)
 33: #define STMatMode PetscEnum

 35: #define STSHELL     'shell'
 36: #define STSHIFT     'shift'
 37: #define STSINVERT   'sinvert'
 38: #define STCAYLEY    'cayley'
 39: #define STFOLD      'fold'
 40: #define STPRECOND   'precond'

 42: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcip.h90.html0000644000175000017500000000505112211062077021574 0ustar gladkgladk
Actual source code: slepcip.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional IP include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcip.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcip.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcnepdef.h.html0000644000175000017500000000714012211062077022255 0ustar gladkgladk
Actual source code: slepcnepdef.h

  1: !
  2: !  Include file for Fortran use of the NEP object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26:  #include finclude/slepcipdef.h
 27:  #include finclude/slepcdsdef.h
 28:  #include finclude/slepcfndef.h
 29:  #include finclude/slepcepsdef.h

 31: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 32: #define NEP                PetscFortranAddr
 33: #endif

 35: #define NEPType            character*(80)
 36: #define NEPWhich           PetscEnum
 37: #define NEPConvergedReason PetscEnum

 39: #define NEPRII       'rii'
 40: #define NEPSLP       'slp'
 41: #define NEPNARNOLDI  'narnoldi'

 43: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepc.h900000644000175000017500000000220212211062077020273 0ustar gladkgladk! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! Single Fortran 90 include file ! #include "finclude/slepcsys.h" #include "finclude/slepceps.h90" #include "finclude/slepcip.h90" #include "finclude/slepcst.h90" #include "finclude/slepcsvd.h90" #include "finclude/slepcqep.h90" slepc-3.4.2.dfsg.orig/include/finclude/slepcds.h90.html0000644000175000017500000000505112211062077021572 0ustar gladkgladk
Actual source code: slepcds.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional DS include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcds.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcds.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcnep.h900000644000175000017500000000222312211062077021001 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional NEP include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcnep.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcnep.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcipdef.h0000644000175000017500000000247712211062077021150 0ustar gladkgladk! ! Include file for Fortran use of the IP object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCIP_H) #define __SLEPCIP_H #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define IP PetscFortranAddr #endif #define IPType character*(80) #define IPOrthogType PetscEnum #define IPOrthogRefineType PetscEnum #define IPBILINEAR 'bilinear' #define IPSESQUILINEAR 'sesquilinear' #define IPINDEFINITE 'indefinite' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcfndef.h0000644000175000017500000000236212211062077021134 0ustar gladkgladk! ! Include file for Fortran use of the FN object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCFN_H) #define __SLEPCFN_H #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define FN PetscFortranAddr #endif #define FNType character*(80) #define FNRATIONAL 'rational' #define FNEXP 'exp' #define FNLOG 'log' #define FNPHI 'phi' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcmfndef.h.html0000644000175000017500000000602612211062077022255 0ustar gladkgladk
Actual source code: slepcmfndef.h

  1: !
  2: !  Include file for Fortran use of the MFN object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26:  #include finclude/slepcdsdef.h
 27:  #include finclude/slepcipdef.h

 29: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 30: #define MFN                    PetscFortranAddr
 31: #endif

 33: #define MFNType                character*(80)
 34: #define MFNConvergedReason     PetscEnum


 37: #define MFNKRYLOV      'krylov'

 39: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcsys.h0000644000175000017500000000344112211062077020667 0ustar gladkgladk! ! Basic include file for Fortran use of the SLEPc package ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "petscconf.h" #include "finclude/petscdef.h" #include "slepcversion.h" #include "finclude/slepcsysdef.h" ! Default tolerance for the different solvers, depending on the precision PetscReal SLEPC_DEFAULT_TOL #if defined(PETSC_USE_REAL_SINGLE) parameter(SLEPC_DEFAULT_TOL = 1e-6) #elif defined(PETSC_USE_REAL_DOUBLE) parameter(SLEPC_DEFAULT_TOL = 1e-8) #elif defined(PETSC_USE_REAL___FLOAT128) parameter(SLEPC_DEFAULT_TOL = 1e-16) #else parameter(SLEPC_DEFAULT_TOL = 1e-7) #endif ! SlepcFunction - Used to specify a mathematical function PetscEnum SLEPC_FUNCTION_NONE PetscEnum SLEPC_FUNCTION_EXP PetscEnum SLEPC_FUNCTION_LAST parameter (SLEPC_FUNCTION_NONE = 0) parameter (SLEPC_FUNCTION_EXP = 1) parameter (SLEPC_FUNCTION_LAST = 2) slepc-3.4.2.dfsg.orig/include/finclude/slepcip.h900000644000175000017500000000222012211062077020624 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional IP include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcip.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcip.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcfn.h.html0000644000175000017500000000444112211062077021420 0ustar gladkgladk
Actual source code: slepcfn.h

  1: !
  2: !  Include file for Fortran use of the FN object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcfndef.h

 26: !
 27: !  End of Fortran include file for the FN package in SLEPc
 28: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcst.h0000644000175000017500000000246012211062077020477 0ustar gladkgladk! ! Include file for Fortran use of the ST object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcstdef.h" PetscEnum ST_MATMODE_COPY PetscEnum ST_MATMODE_INPLACE PetscEnum ST_MATMODE_SHELL parameter (ST_MATMODE_COPY = 0) parameter (ST_MATMODE_INPLACE = 1) parameter (ST_MATMODE_SHELL = 2) ! ! End of Fortran include file for the ST package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/makefile0000644000175000017500000000302112211062077020343 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #requiresdefine 'PETSC_USING_F90' CFLAGS = FFLAGS = SOURCEC = SOURCEF = SOURCEH = slepc.h slepceps.h slepcst.h slepcsvd.h slepcqep.h slepcnep.h slepcmfn.h slepcip.h slepcds.h slepcfn.h \ slepc.h90 slepceps.h90 slepcst.h90 slepcsvd.h90 slepcqep.h90 slepcnep.h90 slepcmfn.h90 slepcip.h90 slepcds.h90 slepcfn.h90 \ slepcdef.h slepcepsdef.h slepcstdef.h slepcsvddef.h slepcqepdef.h slepcnepdef.h slepcmfndef.h slepcipdef.h slepcdsdef.h slepcfndef.h LIBBASE = libslepc DIRS = MANSEC = LOCDIR = include/finclude/ include ${SLEPC_DIR}/conf/slepc_common runexamples: slepc-3.4.2.dfsg.orig/include/finclude/slepcst.h.html0000644000175000017500000000522712211062077021446 0ustar gladkgladk
Actual source code: slepcst.h

  1: !
  2: !  Include file for Fortran use of the ST object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !
 23:  #include finclude/slepcstdef.h

 25:       PetscEnum ST_MATMODE_COPY
 26:       PetscEnum ST_MATMODE_INPLACE
 27:       PetscEnum ST_MATMODE_SHELL

 29:       parameter (ST_MATMODE_COPY          =  0)
 30:       parameter (ST_MATMODE_INPLACE       =  1)
 31:       parameter (ST_MATMODE_SHELL         =  2)

 33: !
 34: !  End of Fortran include file for the ST package in SLEPc
 35: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcip.h.html0000644000175000017500000000573512211062077021434 0ustar gladkgladk
Actual source code: slepcip.h

  1: !
  2: !  Include file for Fortran use of the IP object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcipdef.h

 26:       PetscEnum IP_ORTHOG_MGS
 27:       PetscEnum IP_ORTHOG_CGS

 29:       parameter (IP_ORTHOG_MGS               =  0)
 30:       parameter (IP_ORTHOG_CGS               =  1)

 32:       PetscEnum IP_ORTHOG_REFINE_NEVER
 33:       PetscEnum IP_ORTHOG_REFINE_IFNEEDED
 34:       PetscEnum IP_ORTHOG_REFINE_ALWAYS

 36:       parameter (IP_ORTHOG_REFINE_NEVER      =  0)
 37:       parameter (IP_ORTHOG_REFINE_IFNEEDED   =  1)
 38:       parameter (IP_ORTHOG_REFINE_ALWAYS     =  2)

 40: !
 41: !  End of Fortran include file for the IP package in SLEPc
 42: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcsvddef.h0000644000175000017500000000301112211062077021315 0ustar gladkgladk! ! Include file for Fortran use of the SVD object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCSVD_H) #define __SLEPCSVD_H #include "finclude/slepcipdef.h" #include "finclude/slepcdsdef.h" #include "finclude/slepcepsdef.h" #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define SVD PetscFortranAddr #endif #define SVDType character*(80) #define SVDTransposeMode PetscEnum #define SVDWhich PetscEnum #define SVDConvergedReason PetscEnum #define SVDCROSS 'cross' #define SVDCYCLIC 'cyclic' #define SVDLAPACK 'lapack' #define SVDLANCZOS 'lanczos' #define SVDTRLANCZOS 'trlanczos' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepceps.h90.html0000644000175000017500000000506112211062077021754 0ustar gladkgladk
Actual source code: slepceps.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional EPS include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepceps.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepceps.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcds.h900000644000175000017500000000222012211062077020622 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional DS include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcds.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcds.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcnep.h90.html0000644000175000017500000000506112211062077021747 0ustar gladkgladk
Actual source code: slepcnep.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional NEP include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcnep.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcnep.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/makefile.html0000644000175000017500000000456512211062077021324 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#     
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

#requiresdefine   'PETSC_USING_F90'

CFLAGS    =
FFLAGS    =
SOURCEC   =
SOURCEF   =
SOURCEH   = slepc.h slepceps.h slepcst.h slepcsvd.h slepcqep.h slepcnep.h slepcmfn.h slepcip.h slepcds.h slepcfn.h \
            slepc.h90 slepceps.h90 slepcst.h90 slepcsvd.h90 slepcqep.h90 slepcnep.h90 slepcmfn.h90 slepcip.h90 slepcds.h90 slepcfn.h90 \
            slepcdef.h slepcepsdef.h slepcstdef.h slepcsvddef.h slepcqepdef.h slepcnepdef.h slepcmfndef.h slepcipdef.h slepcdsdef.h slepcfndef.h
LIBBASE   = libslepc
DIRS      = 
MANSEC    = 
LOCDIR    = include/finclude/

include ${SLEPC_DIR}/conf/slepc_common

runexamples:




slepc-3.4.2.dfsg.orig/include/finclude/slepcst.h900000644000175000017500000000222012211062077020642 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional ST include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcst.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcst.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepc.h.html0000644000175000017500000000474412211062077021102 0ustar gladkgladk
Actual source code: slepc.h

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Single Fortran include file for all of SLEPc
 21: !

 23:  #include finclude/slepcsys.h
 24:  #include finclude/slepceps.h
 25:  #include finclude/slepcip.h
 26:  #include finclude/slepcst.h
 27:  #include finclude/slepcsvd.h
 28:  #include finclude/slepcqep.h
slepc-3.4.2.dfsg.orig/include/finclude/index.html0000644000175000017500000000307012211062077020644 0ustar gladkgladk Generic SLEPc Manual Pages

slepc.h
slepceps.h
slepcst.h
slepcsvd.h
slepcqep.h
slepcnep.h
slepcmfn.h
slepcip.h
slepcds.h
slepcfn.h
slepc.h90
slepceps.h90
slepcst.h90
slepcsvd.h90
slepcqep.h90
slepcnep.h90
slepcmfn.h90
slepcip.h90
slepcds.h90
slepcfn.h90
slepcdef.h
slepcepsdef.h
slepcstdef.h
slepcsvddef.h
slepcqepdef.h
slepcnepdef.h
slepcmfndef.h
slepcipdef.h
slepcdsdef.h
slepcfndef.h
makefile
slepc-3.4.2.dfsg.orig/include/finclude/slepcmfn.h.html0000644000175000017500000000663312211062077021602 0ustar gladkgladk

Actual source code: slepcmfn.h

  1: !
  2: !  Include file for Fortran use of the MFN object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcmfndef.h

 26: !  Convergence flags.
 27: !  They sould match the flags in $SLEPC_DIR/include/slepcmfn.h

 29:       PetscEnum MFN_CONVERGED_TOL
 30:       PetscEnum MFN_DIVERGED_ITS
 31:       PetscEnum MFN_DIVERGED_BREAKDOWN
 32:       PetscEnum MFN_CONVERGED_ITERATING

 34:       parameter (MFN_CONVERGED_TOL          =  2)
 35:       parameter (MFN_DIVERGED_ITS           = -3)
 36:       parameter (MFN_DIVERGED_BREAKDOWN     = -4)
 37:       parameter (MFN_CONVERGED_ITERATING    =  0)

 39:       PetscEnum MFN_EXP

 41:       parameter (MFN_EXP                    =  1)

 43: !
 44: !   Possible arguments to MFNMonitorSet()
 45: !
 46:       external MFNMONITORDEFAULT
 47:       external MFNMONITORLG

 49: !
 50: !  End of Fortran include file for the MFN package in SLEPc
 51: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcqepdef.h.html0000644000175000017500000000744112211062077022264 0ustar gladkgladk
Actual source code: slepcqepdef.h

  1: !
  2: !  Include file for Fortran use of the QEP object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26:  #include finclude/slepcipdef.h
 27:  #include finclude/slepcstdef.h
 28:  #include finclude/slepcdsdef.h
 29:  #include finclude/slepcepsdef.h

 31: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 32: #define QEP                PetscFortranAddr
 33: #endif

 35: #define QEPType            character*(80)
 36: #define QEPProblemType     PetscEnum
 37: #define QEPWhich           PetscEnum
 38: #define QEPConvergedReason PetscEnum

 40: #define QEPLINEAR    'linear'
 41: #define QEPQARNOLDI  'qarnoldi'
 42: #define QEPQLANCZOS  'qlanczos'

 44: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcsvd.h900000644000175000017500000000222312211062077021013 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional SVD include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcsvd.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcsvd.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcfn.h0000644000175000017500000000207412211062077020455 0ustar gladkgladk! ! Include file for Fortran use of the FN object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcfndef.h" ! ! End of Fortran include file for the FN package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcsvd.h90.html0000644000175000017500000000506112211062077021761 0ustar gladkgladk
Actual source code: slepcsvd.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional SVD include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcsvd.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcsvd.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcmfn.h90.html0000644000175000017500000000506112211062077021745 0ustar gladkgladk
Actual source code: slepcmfn.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional MFN include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcmfn.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcmfn.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcfndef.h.html0000644000175000017500000000555212211062077022103 0ustar gladkgladk
Actual source code: slepcfndef.h

  1: !
  2: !  Include file for Fortran use of the FN object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 27: #define FN PetscFortranAddr
 28: #endif

 30: #define FNType             character*(80)

 32: #define FNRATIONAL 'rational'
 33: #define FNEXP      'exp'
 34: #define FNLOG      'log'
 35: #define FNPHI      'phi'

 37: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcfn.h90.html0000644000175000017500000000505112211062077021567 0ustar gladkgladk
Actual source code: slepcfn.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional FN include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcfn.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcfn.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/slepcip.h0000644000175000017500000000276412211062077020470 0ustar gladkgladk! ! Include file for Fortran use of the IP object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcipdef.h" PetscEnum IP_ORTHOG_MGS PetscEnum IP_ORTHOG_CGS parameter (IP_ORTHOG_MGS = 0) parameter (IP_ORTHOG_CGS = 1) PetscEnum IP_ORTHOG_REFINE_NEVER PetscEnum IP_ORTHOG_REFINE_IFNEEDED PetscEnum IP_ORTHOG_REFINE_ALWAYS parameter (IP_ORTHOG_REFINE_NEVER = 0) parameter (IP_ORTHOG_REFINE_IFNEEDED = 1) parameter (IP_ORTHOG_REFINE_ALWAYS = 2) ! ! End of Fortran include file for the IP package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcds.h.html0000644000175000017500000001273212211062077021425 0ustar gladkgladk
Actual source code: slepcds.h

  1: !
  2: !  Include file for Fortran use of the DS object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcdsdef.h

 26:       PetscEnum DS_STATE_RAW
 27:       PetscEnum DS_STATE_INTERMEDIATE
 28:       PetscEnum DS_STATE_CONDENSED
 29:       PetscEnum DS_STATE_TRUNCATED

 31:       parameter (DS_STATE_RAW                =  0)
 32:       parameter (DS_STATE_INTERMEDIATE       =  1)
 33:       parameter (DS_STATE_CONDENSED          =  2)
 34:       parameter (DS_STATE_TRUNCATED          =  3)

 36:       PetscEnum DS_MAT_A
 37:       PetscEnum DS_MAT_B
 38:       PetscEnum DS_MAT_C
 39:       PetscEnum DS_MAT_T
 40:       PetscEnum DS_MAT_D
 41:       PetscEnum DS_MAT_Q
 42:       PetscEnum DS_MAT_Z
 43:       PetscEnum DS_MAT_X
 44:       PetscEnum DS_MAT_Y
 45:       PetscEnum DS_MAT_U
 46:       PetscEnum DS_MAT_VT
 47:       PetscEnum DS_MAT_W
 48:       PetscEnum DS_MAT_E0
 49:       PetscEnum DS_MAT_E1
 50:       PetscEnum DS_MAT_E2
 51:       PetscEnum DS_MAT_E3
 52:       PetscEnum DS_MAT_E4
 53:       PetscEnum DS_MAT_E5
 54:       PetscEnum DS_MAT_E6
 55:       PetscEnum DS_MAT_E7
 56:       PetscEnum DS_MAT_E8
 57:       PetscEnum DS_MAT_E9
 58:       PetscEnum DS_NUM_MAT

 60:       parameter (DS_MAT_A         =  0)
 61:       parameter (DS_MAT_B         =  1)
 62:       parameter (DS_MAT_C         =  2)
 63:       parameter (DS_MAT_T         =  3)
 64:       parameter (DS_MAT_D         =  4)
 65:       parameter (DS_MAT_Q         =  5)
 66:       parameter (DS_MAT_Z         =  6)
 67:       parameter (DS_MAT_X         =  7)
 68:       parameter (DS_MAT_Y         =  8)
 69:       parameter (DS_MAT_U         =  9)
 70:       parameter (DS_MAT_VT        = 10)
 71:       parameter (DS_MAT_W         = 11)
 72:       parameter (DS_MAT_E0        = 12)
 73:       parameter (DS_MAT_E1        = 13)
 74:       parameter (DS_MAT_E2        = 14)
 75:       parameter (DS_MAT_E3        = 15)
 76:       parameter (DS_MAT_E4        = 16)
 77:       parameter (DS_MAT_E5        = 17)
 78:       parameter (DS_MAT_E6        = 18)
 79:       parameter (DS_MAT_E7        = 19)
 80:       parameter (DS_MAT_E8        = 20)
 81:       parameter (DS_MAT_E9        = 21)
 82:       parameter (DS_NUM_MAT       = 22)

 84: !
 85: !  End of Fortran include file for the DS package in SLEPc
 86: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcfn.h900000644000175000017500000000222012211062077020617 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional FN include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcfn.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcfn.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcmfndef.h0000644000175000017500000000246112211062077021311 0ustar gladkgladk! ! Include file for Fortran use of the MFN object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCMFN_H) #define __SLEPCMFN_H #include "finclude/slepcdsdef.h" #include "finclude/slepcipdef.h" #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define MFN PetscFortranAddr #endif #define MFNType character*(80) #define MFNConvergedReason PetscEnum #define MFNKRYLOV 'krylov' #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/0000755000175000017500000000000012214143515020746 5ustar gladkgladkslepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcsvddef.h900000644000175000017500000000212012211062077023565 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCSVDDEF_H90) #define __SLEPCSVDDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type SVD PetscFortranAddr:: v end type SVD #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcfndef.h900000644000175000017500000000211412211062077023377 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCFNDEF_H90) #define __SLEPCFNDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type FN PetscFortranAddr:: v end type FN #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcstdef.h900000644000175000017500000000211412211062077023422 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCSTDEF_H90) #define __SLEPCSTDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type ST PetscFortranAddr:: v end type ST #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcnep.h900000644000175000017500000000221412211062077023100 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcnepdef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(NEP_HIDE) #define NEP_HIDE type(NEP) #elif !defined(NEP_HIDE) #define NEP_HIDE NEP #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcip.h900000644000175000017500000000220512211062077022726 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcipdef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(IP_HIDE) #define IP_HIDE type(IP) #elif !defined(IP_HIDE) #define IP_HIDE IP #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/makefile0000644000175000017500000000176612211062077022460 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # LOCDIR = include/finclude/ftn-custom/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcepsdef.h900000644000175000017500000000212012211062077023560 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCEPSDEF_H90) #define __SLEPCEPSDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type EPS PetscFortranAddr:: v end type EPS #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcipdef.h900000644000175000017500000000211412211062077023404 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCIPDEF_H90) #define __SLEPCIPDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type IP PetscFortranAddr:: v end type IP #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcds.h900000644000175000017500000000220512211062077022724 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcdsdef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(DS_HIDE) #define DS_HIDE type(DS) #elif !defined(DS_HIDE) #define DS_HIDE DS #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcqepdef.h900000644000175000017500000000212012211062077023556 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCQEPDEF_H90) #define __SLEPCQEPDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type QEP PetscFortranAddr:: v end type QEP #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcst.h900000644000175000017500000000220512211062077022744 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcstdef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(ST_HIDE) #define ST_HIDE type(ST) #elif !defined(ST_HIDE) #define ST_HIDE ST #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcsvd.h900000644000175000017500000000221412211062077023112 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcsvddef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(SVD_HIDE) #define SVD_HIDE type(SVD) #elif !defined(SVD_HIDE) #define SVD_HIDE SVD #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcmfndef.h900000644000175000017500000000212012211062077023551 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCMFNDEF_H90) #define __SLEPCMFNDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type MFN PetscFortranAddr:: v end type MFN #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcfn.h900000644000175000017500000000220512211062077022721 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcfndef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(FN_HIDE) #define FN_HIDE type(FN) #elif !defined(FN_HIDE) #define FN_HIDE FN #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcqep.h900000644000175000017500000000221412211062077023103 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcqepdef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(QEP_HIDE) #define QEP_HIDE type(QEP) #elif !defined(QEP_HIDE) #define QEP_HIDE QEP #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcdsdef.h900000644000175000017500000000211412211062077023402 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCDSDEF_H90) #define __SLEPCDSDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type DS PetscFortranAddr:: v end type DS #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcnepdef.h900000644000175000017500000000212012211062077023553 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCNEPDEF_H90) #define __SLEPCNEPDEF_H90 #if defined(PETSC_USE_FORTRAN_DATATYPES) type NEP PetscFortranAddr:: v end type NEP #endif #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepcmfn.h900000644000175000017500000000221412211062077023076 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcmfndef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(MFN_HIDE) #define MFN_HIDE type(MFN) #elif !defined(MFN_HIDE) #define MFN_HIDE MFN #endif slepc-3.4.2.dfsg.orig/include/finclude/ftn-custom/slepceps.h900000644000175000017500000000221412211062077023105 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(PETSC_USE_FORTRAN_MODULES) #include "finclude/ftn-custom/slepcepsdef.h90" #endif #if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(EPS_HIDE) #define EPS_HIDE type(EPS) #elif !defined(EPS_HIDE) #define EPS_HIDE EPS #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcqep.h900000644000175000017500000000222312211062077021004 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional QEP include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcqep.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcqep.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcepsdef.h0000644000175000017500000000430712211062077021321 0ustar gladkgladk! ! Include file for Fortran use of the EPS object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCEPS_H) #define __SLEPCEPS_H #include "finclude/slepcstdef.h" #include "finclude/slepcipdef.h" #include "finclude/slepcdsdef.h" #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define EPS PetscFortranAddr #endif #define EPSType character*(80) #define EPSConvergedReason PetscEnum #define EPSProblemType PetscEnum #define EPSWhich PetscEnum #define EPSExtraction PetscEnum #define EPSBalance PetscEnum #define EPSConv PetscEnum #define EPSOrthType PetscEnum #define EPSPowerShiftType PetscEnum #define EPSLanczosReorthogType PetscEnum #define EPSPRIMMEMethod PetscEnum #define EPSPRIMMEPrecond PetscEnum #define EPSPOWER 'power' #define EPSSUBSPACE 'subspace' #define EPSARNOLDI 'arnoldi' #define EPSLANCZOS 'lanczos' #define EPSKRYLOVSCHUR 'krylovschur' #define EPSGD 'gd' #define EPSJD 'jd' #define EPSRQCG 'rqcg' #define EPSCISS 'ciss' #define EPSLAPACK 'lapack' #define EPSARPACK 'arpack' #define EPSBLZPACK 'blzpack' #define EPSTRLAN 'trlan' #define EPSBLOPEX 'blopex' #define EPSPRIMME 'primme' #define EPSFEAST 'feast' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepceps.h.html0000644000175000017500000002703012211062077021603 0ustar gladkgladk
Actual source code: slepceps.h

  1: !
  2: !  Include file for Fortran use of the EPS object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcepsdef.h

 26: !  Convergence flags.
 27: !  They sould match the flags in $SLEPC_DIR/include/slepceps.h

 29:       PetscEnum EPS_CONVERGED_TOL
 30:       PetscEnum EPS_DIVERGED_ITS
 31:       PetscEnum EPS_DIVERGED_BREAKDOWN
 32:       PetscEnum EPS_CONVERGED_ITERATING

 34:       parameter (EPS_CONVERGED_TOL          =  2)
 35:       parameter (EPS_DIVERGED_ITS           = -3)
 36:       parameter (EPS_DIVERGED_BREAKDOWN     = -4)
 37:       parameter (EPS_CONVERGED_ITERATING    =  0)

 39:       PetscEnum EPS_HEP
 40:       PetscEnum EPS_GHEP
 41:       PetscEnum EPS_NHEP
 42:       PetscEnum EPS_GNHEP
 43:       PetscEnum EPS_PGNHEP
 44:       PetscEnum EPS_GHIEP

 46:       parameter (EPS_HEP                    =  1)
 47:       parameter (EPS_GHEP                   =  2)
 48:       parameter (EPS_NHEP                   =  3)
 49:       parameter (EPS_GNHEP                  =  4)
 50:       parameter (EPS_PGNHEP                 =  5)
 51:       parameter (EPS_GHIEP                  =  6)

 53:       PetscEnum EPS_LARGEST_MAGNITUDE
 54:       PetscEnum EPS_SMALLEST_MAGNITUDE
 55:       PetscEnum EPS_LARGEST_REAL
 56:       PetscEnum EPS_SMALLEST_REAL
 57:       PetscEnum EPS_LARGEST_IMAGINARY
 58:       PetscEnum EPS_SMALLEST_IMAGINARY
 59:       PetscEnum EPS_TARGET_MAGNITUDE
 60:       PetscEnum EPS_TARGET_REAL
 61:       PetscEnum EPS_TARGET_IMAGINARY
 62:       PetscEnum EPS_ALL
 63:       PetscEnum EPS_WHICH_USER

 65:       parameter (EPS_LARGEST_MAGNITUDE      =  1)
 66:       parameter (EPS_SMALLEST_MAGNITUDE     =  2)
 67:       parameter (EPS_LARGEST_REAL           =  3)
 68:       parameter (EPS_SMALLEST_REAL          =  4)
 69:       parameter (EPS_LARGEST_IMAGINARY      =  5)
 70:       parameter (EPS_SMALLEST_IMAGINARY     =  6)
 71:       parameter (EPS_TARGET_MAGNITUDE       =  7)
 72:       parameter (EPS_TARGET_REAL            =  8)
 73:       parameter (EPS_TARGET_IMAGINARY       =  9)
 74:       parameter (EPS_ALL                    = 10)
 75:       parameter (EPS_WHICH_USER             = 11)

 77:       PetscEnum EPS_BALANCE_NONE
 78:       PetscEnum EPS_BALANCE_ONESIDE
 79:       PetscEnum EPS_BALANCE_TWOSIDE
 80:       PetscEnum EPS_BALANCE_USER

 82:       parameter (EPS_BALANCE_NONE           =  1)
 83:       parameter (EPS_BALANCE_ONESIDE        =  2)
 84:       parameter (EPS_BALANCE_TWOSIDE        =  3)
 85:       parameter (EPS_BALANCE_USER           =  4)

 87:       PetscEnum EPS_POWER_SHIFT_CONSTANT
 88:       PetscEnum EPS_POWER_SHIFT_RAYLEIGH
 89:       PetscEnum EPS_POWER_SHIFT_WILKINSON

 91:       parameter (EPS_POWER_SHIFT_CONSTANT   =  0)
 92:       parameter (EPS_POWER_SHIFT_RAYLEIGH   =  1)
 93:       parameter (EPS_POWER_SHIFT_WILKINSON  =  2)

 95:       PetscEnum EPS_RITZ
 96:       PetscEnum EPS_HARMONIC
 97:       PetscEnum EPS_HARMONIC_RELATIVE
 98:       PetscEnum EPS_HARMONIC_RIGHT
 99:       PetscEnum EPS_HARMONIC_LARGEST
100:       PetscEnum EPS_REFINED
101:       PetscEnum EPS_REFINED_HARMONIC

103:       parameter (EPS_RITZ                   =  1)
104:       parameter (EPS_HARMONIC               =  2)
105:       parameter (EPS_HARMONIC_RELATIVE      =  3)
106:       parameter (EPS_HARMONIC_RIGHT         =  4)
107:       parameter (EPS_HARMONIC_LARGEST       =  5)
108:       parameter (EPS_REFINED                =  6)
109:       parameter (EPS_REFINED_HARMONIC       =  7)

111:       PetscEnum EPS_CONV_ABS
112:       PetscEnum EPS_CONV_EIG
113:       PetscEnum EPS_CONV_NORM
114:       PetscEnum EPS_CONV_USER

116:       parameter (EPS_CONV_ABS               =  1)
117:       parameter (EPS_CONV_EIG               =  2)
118:       parameter (EPS_CONV_NORM              =  3)
119:       parameter (EPS_CONV_USER              =  4)

121:       PetscEnum EPS_LANCZOS_REORTHOG_LOCAL
122:       PetscEnum EPS_LANCZOS_REORTHOG_FULL
123:       PetscEnum EPS_LANCZOS_REORTHOG_SELECTIVE
124:       PetscEnum EPS_LANCZOS_REORTHOG_PERIODIC
125:       PetscEnum EPS_LANCZOS_REORTHOG_PARTIAL
126:       PetscEnum EPS_LANCZOS_REORTHOG_DELAYED

128:       parameter (EPS_LANCZOS_REORTHOG_LOCAL     =  0)
129:       parameter (EPS_LANCZOS_REORTHOG_FULL      =  1)
130:       parameter (EPS_LANCZOS_REORTHOG_SELECTIVE =  2)
131:       parameter (EPS_LANCZOS_REORTHOG_PERIODIC  =  3)
132:       parameter (EPS_LANCZOS_REORTHOG_PARTIAL   =  4)
133:       parameter (EPS_LANCZOS_REORTHOG_DELAYED   =  5)

135:       PetscEnum EPS_PRIMME_DYNAMIC
136:       PetscEnum EPS_PRIMME_DEFAULT_MIN_TIME
137:       PetscEnum EPS_PRIMME_DEFAULT_MIN_MATVECS
138:       PetscEnum EPS_PRIMME_ARNOLDI
139:       PetscEnum EPS_PRIMME_GD
140:       PetscEnum EPS_PRIMME_GD_PLUSK
141:       PetscEnum EPS_PRIMME_GD_OLSEN_PLUSK
142:       PetscEnum EPS_PRIMME_JD_OLSEN_PLUSK
143:       PetscEnum EPS_PRIMME_RQI
144:       PetscEnum EPS_PRIMME_JDQR
145:       PetscEnum EPS_PRIMME_JDQMR
146:       PetscEnum EPS_PRIMME_JDQMR_ETOL
147:       PetscEnum EPS_PRIMME_SUBSPACE_ITERATION
148:       PetscEnum EPS_PRIMME_LOBPCG_ORTHOBASIS
149:       PetscEnum EPS_PRIMME_LOBPCG_ORTHOBASISW

151:       parameter (EPS_PRIMME_DYNAMIC             =  0)
152:       parameter (EPS_PRIMME_DEFAULT_MIN_TIME    =  1)
153:       parameter (EPS_PRIMME_DEFAULT_MIN_MATVECS =  2)
154:       parameter (EPS_PRIMME_ARNOLDI             =  3)
155:       parameter (EPS_PRIMME_GD                  =  4)
156:       parameter (EPS_PRIMME_GD_PLUSK            =  5)
157:       parameter (EPS_PRIMME_GD_OLSEN_PLUSK      =  7)
158:       parameter (EPS_PRIMME_JD_OLSEN_PLUSK      =  8)
159:       parameter (EPS_PRIMME_RQI                 =  9)
160:       parameter (EPS_PRIMME_JDQR                = 10)
161:       parameter (EPS_PRIMME_JDQMR               = 11)
162:       parameter (EPS_PRIMME_JDQMR_ETOL          = 12)
163:       parameter (EPS_PRIMME_SUBSPACE_ITERATION  = 13)
164:       parameter (EPS_PRIMME_LOBPCG_ORTHOBASIS   = 14)
165:       parameter (EPS_PRIMME_LOBPCG_ORTHOBASISW  = 15)

167:       PetscEnum EPS_ORTH_I
168:       PetscEnum EPS_ORTH_B
169:       PetscEnum EPS_ORTH_BOPT

171:       parameter (EPS_ORTH_I                 =  1)
172:       parameter (EPS_ORTH_B                 =  2)
173:       parameter (EPS_ORTH_BOPT              =  3)

175: !
176: !   Possible arguments to EPSMonitorSet()
177: !
178:       external EPSMONITORALL
179:       external EPSMONITORLG
180:       external EPSMONITORLGALL
181:       external EPSMONITORCONVERGED
182:       external EPSMONITORFIRST

184: !
185: !  End of Fortran include file for the EPS package in SLEPc
186: !
slepc-3.4.2.dfsg.orig/include/finclude/slepc.h90.html0000644000175000017500000000517012211062077021245 0ustar gladkgladk
Actual source code: slepc.h90

  1: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  3: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  4: !
  5: !  This file is part of SLEPc.
  6: !
  7: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  8: !  terms of version 3 of the GNU Lesser General Public License as published by
  9: !  the Free Software Foundation.
 10: !
 11: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 12: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 13: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 14: !  more details.
 15: !
 16: !  You  should have received a copy of the GNU Lesser General  Public  License
 17: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 18: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 19: !
 20: !  Single Fortran 90 include file
 21: !

 23:  #include finclude/slepcsys.h
 24: #include "finclude/slepceps.h90"
 25: #include "finclude/slepcip.h90"
 26: #include "finclude/slepcst.h90"
 27: #include "finclude/slepcsvd.h90"
 28: #include "finclude/slepcqep.h90"
slepc-3.4.2.dfsg.orig/include/finclude/slepcqep.h.html0000644000175000017500000001206312211062077021601 0ustar gladkgladk
Actual source code: slepcqep.h

  1: !
  2: !  Include file for Fortran use of the QEP object in SLEPc
  3: !
  4: !
  5: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  7: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  8: !
  9: !  This file is part of SLEPc.
 10: !
 11: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 12: !  terms of version 3 of the GNU Lesser General Public License as published by
 13: !  the Free Software Foundation.
 14: !
 15: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 16: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 17: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 18: !  more details.
 19: !
 20: !  You  should have received a copy of the GNU Lesser General  Public  License
 21: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 22: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 23: !
 24:  #include finclude/slepcqepdef.h

 26: !  Convergence flags.
 27: !  They should match the flags in $SLEPC_DIR/include/slepcqep.h

 29:       PetscEnum QEP_CONVERGED_TOL
 30:       PetscEnum QEP_DIVERGED_ITS
 31:       PetscEnum QEP_DIVERGED_BREAKDOWN
 32:       PetscEnum QEP_CONVERGED_ITERATING

 34:       parameter (QEP_CONVERGED_TOL          =  2)
 35:       parameter (QEP_DIVERGED_ITS           = -3)
 36:       parameter (QEP_DIVERGED_BREAKDOWN     = -4)
 37:       parameter (QEP_CONVERGED_ITERATING    =  0)

 39:       PetscEnum QEP_GENERAL
 40:       PetscEnum QEP_HERMITIAN
 41:       PetscEnum QEP_GYROSCOPIC

 43:       parameter (QEP_GENERAL                =  1)
 44:       parameter (QEP_HERMITIAN              =  2)
 45:       parameter (QEP_GYROSCOPIC             =  3)

 47:       PetscEnum QEP_LARGEST_MAGNITUDE
 48:       PetscEnum QEP_SMALLEST_MAGNITUDE
 49:       PetscEnum QEP_LARGEST_REAL
 50:       PetscEnum QEP_SMALLEST_REAL
 51:       PetscEnum QEP_LARGEST_IMAGINARY
 52:       PetscEnum QEP_SMALLEST_IMAGINARY
 53:       PetscEnum QEP_TARGET_MAGNITUDE
 54:       PetscEnum QEP_TARGET_REAL
 55:       PetscEnum QEP_TARGET_IMAGINARY

 57:       parameter (QEP_LARGEST_MAGNITUDE      =  1)
 58:       parameter (QEP_SMALLEST_MAGNITUDE     =  2)
 59:       parameter (QEP_LARGEST_REAL           =  3)
 60:       parameter (QEP_SMALLEST_REAL          =  4)
 61:       parameter (QEP_LARGEST_IMAGINARY      =  5)
 62:       parameter (QEP_SMALLEST_IMAGINARY     =  6)
 63:       parameter (QEP_TARGET_MAGNITUDE       =  7)
 64:       parameter (QEP_TARGET_REAL            =  8)
 65:       parameter (QEP_TARGET_IMAGINARY       =  9)

 67: !
 68: !   Possible arguments to QEPMonitorSet()
 69: !
 70:       external QEPMONITORALL
 71:       external QEPMONITORLG
 72:       external QEPMONITORLGALL
 73:       external QEPMONITORCONVERGED
 74:       external QEPMONITORFIRST

 76: !
 77: !  End of Fortran include file for the QEP package in SLEPc
 78: !
slepc-3.4.2.dfsg.orig/include/finclude/slepcsvddef.h.html0000644000175000017500000000757712211062077022305 0ustar gladkgladk
Actual source code: slepcsvddef.h

  1: !
  2: !  Include file for Fortran use of the SVD object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26:  #include finclude/slepcipdef.h
 27:  #include finclude/slepcdsdef.h
 28:  #include finclude/slepcepsdef.h

 30: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 31: #define SVD                PetscFortranAddr
 32: #endif

 34: #define SVDType            character*(80)
 35: #define SVDTransposeMode   PetscEnum
 36: #define SVDWhich           PetscEnum
 37: #define SVDConvergedReason PetscEnum

 39: #define SVDCROSS     'cross'
 40: #define SVDCYCLIC    'cyclic'
 41: #define SVDLAPACK    'lapack'
 42: #define SVDLANCZOS   'lanczos'
 43: #define SVDTRLANCZOS 'trlanczos'

 45: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcmfn.h900000644000175000017500000000222312211062077020777 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional MFN include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepcmfn.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepcmfn.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcsysdef.h0000644000175000017500000000206512211062077021347 0ustar gladkgladk! ! Basic include file for Fortran use of the SLEPc package ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCSYS_H) #define __SLEPCSYS_H #define SlepcFunction PetscEnum #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcnepdef.h0000644000175000017500000000270212211062077021311 0ustar gladkgladk! ! Include file for Fortran use of the NEP object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCNEP_H) #define __SLEPCNEP_H #include "finclude/slepcipdef.h" #include "finclude/slepcdsdef.h" #include "finclude/slepcfndef.h" #include "finclude/slepcepsdef.h" #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define NEP PetscFortranAddr #endif #define NEPType character*(80) #define NEPWhich PetscEnum #define NEPConvergedReason PetscEnum #define NEPRII 'rii' #define NEPSLP 'slp' #define NEPNARNOLDI 'narnoldi' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcdsdef.h0000644000175000017500000000262412211062077021140 0ustar gladkgladk! ! Include file for Fortran use of the DS object in SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #if !defined(__SLEPCDS_H) #define __SLEPCDS_H #if !defined(PETSC_USE_FORTRAN_DATATYPES) #define DS PetscFortranAddr #endif #define DSType character*(80) #define DSStateType PetscEnum #define DSMatType PetscEnum #define DSHEP 'hep' #define DSNHEP 'nhep' #define DSGHEP 'ghep' #define DSGHIEP 'ghiep' #define DSGNHEP 'gnhep' #define DSSVD 'svd' #define DSQEP 'qep' #define DSNEP 'nep' #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcdef.h.html0000644000175000017500000000541712211062077021557 0ustar gladkgladk
Actual source code: slepcdef.h

  1: !
  2: !  Single Fortran include file for all of SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !
 23:  #include finclude/slepcsysdef.h
 24:  #include finclude/slepcepsdef.h
 25:  #include finclude/slepcipdef.h
 26:  #include finclude/slepcstdef.h
 27:  #include finclude/slepcsvddef.h
 28:  #include finclude/slepcqepdef.h
 29:  #include finclude/slepcnepdef.h
 30:  #include finclude/slepcmfndef.h
slepc-3.4.2.dfsg.orig/include/finclude/slepcst.h90.html0000644000175000017500000000505112211062077021612 0ustar gladkgladk
Actual source code: slepcst.h90

  1: !
  2: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  4: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  5: !
  6: !  This file is part of SLEPc.
  7: !
  8: !  SLEPc is free software: you can redistribute it and/or modify it under  the
  9: !  terms of version 3 of the GNU Lesser General Public License as published by
 10: !  the Free Software Foundation.
 11: !
 12: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 13: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 14: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 15: !  more details.
 16: !
 17: !  You  should have received a copy of the GNU Lesser General  Public  License
 18: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 19: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20: !
 21: !
 22: !
 23: !  Additional ST include file for use of SLEPc with Fortran 90/HPF
 24: !
 25: #include "finclude/ftn-custom/slepcst.h90"
 26: #if defined(PETSC_USE_FORTRAN_INTERFACES)
 27:       interface
 28: #include "finclude/ftn-auto/slepcst.h90"
 29:       end interface
 30: #endif

slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/0000755000175000017500000000000012214143515020404 5ustar gladkgladkslepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcsys.h900000644000175000017500000000447412211062077022604 0ustar gladkgladk subroutine SlepcFinalize(ierr) integer ierr end subroutine subroutine SlepcInitialized(isInitialized ,ierr) PetscBool isInitialized ! PetscBool integer ierr end subroutine subroutine SlepcMatTile(a, aupper, b, bupper, c, cupper, d, & &dupper, G ,ierr) PetscScalar a ! PetscScalar Mat aupper ! Mat PetscScalar b ! PetscScalar Mat bupper ! Mat PetscScalar c ! PetscScalar Mat cupper ! Mat PetscScalar d ! PetscScalar Mat dupper ! Mat Mat G ! Mat integer ierr end subroutine subroutine SlepcCheckOrthogonality(V, nv, W, nw, B, viewer, lev & &,ierr) Vec V ! Vec PetscInt nv ! PetscInt Vec W ! Vec PetscInt nw ! PetscInt Mat B ! Mat PetscViewer viewer ! PetscViewer PetscReal lev ! PetscReal integer ierr end subroutine subroutine SlepcVecSetTemplate(v ,ierr) Vec v ! Vec integer ierr end subroutine subroutine SlepcMatGetVecsTemplate(mat, right, left ,ierr) Mat mat ! Mat Vec right ! Vec Vec left ! Vec integer ierr end subroutine subroutine SlepcUpdateVectors(n, V, s, e, Q, ldq, qtrans ,ierr) PetscInt n ! PetscInt Vec V ! Vec PetscInt s ! PetscInt PetscInt e ! PetscInt PetscScalar Q ! PetscScalar PetscInt ldq ! PetscInt PetscBool qtrans ! PetscBool integer ierr end subroutine subroutine SlepcUpdateStrideVectors(n_, V, s, d, e, Q, ldq_, & &qtrans ,ierr) PetscInt n_ ! PetscInt Vec V ! Vec PetscInt s ! PetscInt PetscInt d ! PetscInt PetscInt e ! PetscInt PetscScalar Q ! PetscScalar PetscInt ldq_ ! PetscInt PetscBool qtrans ! PetscBool integer ierr end subroutine subroutine SlepcVecMAXPBY(y, beta, alpha, nv, a, x ,ierr) Vec y ! Vec PetscScalar beta ! PetscScalar PetscScalar alpha ! PetscScalar PetscInt nv ! PetscInt PetscScalar a (*) ! PetscScalar Vec x (*) ! Vec integer ierr end subroutine subroutine SlepcVecSetRandom(x, rctx ,ierr) Vec x ! Vec PetscRandom rctx ! PetscRandom integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcnep.h900000644000175000017500000001672012211062077022545 0ustar gladkgladk subroutine NEPSLPSetEPS(nep, eps ,ierr) NEP nep ! NEP EPS eps ! EPS integer ierr end subroutine subroutine NEPSLPGetEPS(nep, eps ,ierr) NEP nep ! NEP EPS eps ! EPS integer ierr end subroutine subroutine NEPReset(nep ,ierr) NEP nep ! NEP integer ierr end subroutine subroutine NEPSetIP(nep, ip ,ierr) NEP nep ! NEP IP ip ! IP integer ierr end subroutine subroutine NEPSetDS(nep, ds ,ierr) NEP nep ! NEP DS ds ! DS integer ierr end subroutine subroutine NEPSetKSP(nep, ksp ,ierr) NEP nep ! NEP KSP ksp ! KSP integer ierr end subroutine subroutine NEPSetTarget(nep, target ,ierr) NEP nep ! NEP PetscScalar target ! PetscScalar integer ierr end subroutine subroutine NEPGetTarget(nep, target ,ierr) NEP nep ! NEP PetscScalar target ! PetscScalar integer ierr end subroutine subroutine NEPSetSplitOperator(nep, n, A, f, str ,ierr) NEP nep ! NEP PetscInt n ! PetscInt Mat A (*) ! Mat FN f (*) ! FN MatStructure str ! MatStructure integer ierr end subroutine subroutine NEPGetSplitOperatorTerm(nep, k, A, f ,ierr) NEP nep ! NEP PetscInt k ! PetscInt Mat A ! Mat FN f ! FN integer ierr end subroutine subroutine NEPGetSplitOperatorInfo(nep, n, str ,ierr) NEP nep ! NEP PetscInt n ! PetscInt MatStructure str ! MatStructure integer ierr end subroutine subroutine NEPSetWorkVecs(nep, nw ,ierr) NEP nep ! NEP PetscInt nw ! PetscInt integer ierr end subroutine subroutine NEPMonitorCancel(nep ,ierr) NEP nep ! NEP integer ierr end subroutine subroutine NEPSetFromOptions(nep ,ierr) NEP nep ! NEP integer ierr end subroutine subroutine NEPGetTolerances(nep, abstol, rtol, stol, maxit, maxf& & ,ierr) NEP nep ! NEP PetscReal abstol ! PetscReal PetscReal rtol ! PetscReal PetscReal stol ! PetscReal PetscInt maxit ! PetscInt PetscInt maxf ! PetscInt integer ierr end subroutine subroutine NEPSetTolerances(nep, abstol, rtol, stol, maxit, maxf& & ,ierr) NEP nep ! NEP PetscReal abstol ! PetscReal PetscReal rtol ! PetscReal PetscReal stol ! PetscReal PetscInt maxit ! PetscInt PetscInt maxf ! PetscInt integer ierr end subroutine subroutine NEPGetDimensions(nep, nev, ncv, mpd ,ierr) NEP nep ! NEP PetscInt nev ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine NEPSetDimensions(nep, nev, ncv, mpd ,ierr) NEP nep ! NEP PetscInt nev ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine NEPSetWhichEigenpairs(nep, which ,ierr) NEP nep ! NEP NEPWhich which ! NEPWhich integer ierr end subroutine subroutine NEPSetLagPreconditioner(nep, lag ,ierr) NEP nep ! NEP PetscInt lag ! PetscInt integer ierr end subroutine subroutine NEPGetLagPreconditioner(nep, lag ,ierr) NEP nep ! NEP PetscInt lag ! PetscInt integer ierr end subroutine subroutine NEPSetConstCorrectionTol(nep, cct ,ierr) NEP nep ! NEP PetscBool cct ! PetscBool integer ierr end subroutine subroutine NEPGetConstCorrectionTol(nep, cct ,ierr) NEP nep ! NEP PetscBool cct ! PetscBool integer ierr end subroutine subroutine NEPSetTrackAll(nep, trackall ,ierr) NEP nep ! NEP PetscBool trackall ! PetscBool integer ierr end subroutine subroutine NEPGetTrackAll(nep, trackall ,ierr) NEP nep ! NEP PetscBool trackall ! PetscBool integer ierr end subroutine subroutine NEPSetUp(nep ,ierr) NEP nep ! NEP integer ierr end subroutine subroutine NEPSetInitialSpace(nep, n, is ,ierr) NEP nep ! NEP PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine NEPSolve(nep ,ierr) NEP nep ! NEP integer ierr end subroutine subroutine NEPProjectOperator(nep, j0, j1, f ,ierr) NEP nep ! NEP PetscInt j0 ! PetscInt PetscInt j1 ! PetscInt Vec f ! Vec integer ierr end subroutine subroutine NEPApplyFunction(nep, lambda, x, v, y, A, B, flg , & &ierr) NEP nep ! NEP PetscScalar lambda ! PetscScalar Vec x ! Vec Vec v ! Vec Vec y ! Vec Mat A ! Mat Mat B ! Mat MatStructure flg ! MatStructure integer ierr end subroutine subroutine NEPApplyJacobian(nep, lambda, x, v, y, A, flg ,ierr) NEP nep ! NEP PetscScalar lambda ! PetscScalar Vec x ! Vec Vec v ! Vec Vec y ! Vec Mat A ! Mat MatStructure flg ! MatStructure integer ierr end subroutine subroutine NEPGetIterationNumber(nep, its ,ierr) NEP nep ! NEP PetscInt its ! PetscInt integer ierr end subroutine subroutine NEPGetConverged(nep, nconv ,ierr) NEP nep ! NEP PetscInt nconv ! PetscInt integer ierr end subroutine subroutine NEPGetEigenpair(nep, i, eig, V ,ierr) NEP nep ! NEP PetscInt i ! PetscInt PetscScalar eig ! PetscScalar Vec V ! Vec integer ierr end subroutine subroutine NEPGetErrorEstimate(nep, i, errest ,ierr) NEP nep ! NEP PetscInt i ! PetscInt PetscReal errest ! PetscReal integer ierr end subroutine subroutine NEPComputeResidualNorm(nep, i, norm ,ierr) NEP nep ! NEP PetscInt i ! PetscInt PetscReal norm ! PetscReal integer ierr end subroutine subroutine NEPComputeRelativeError(nep, i, error ,ierr) NEP nep ! NEP PetscInt i ! PetscInt PetscReal error ! PetscReal integer ierr end subroutine subroutine NEPSortEigenvalues(nep, n, eig, perm ,ierr) NEP nep ! NEP PetscInt n ! PetscInt PetscScalar eig ! PetscScalar PetscInt perm ! PetscInt integer ierr end subroutine subroutine NEPCompareEigenvalues(nep, a, b, result ,ierr) NEP nep ! NEP PetscScalar a ! PetscScalar PetscScalar b ! PetscScalar PetscInt result ! PetscInt integer ierr end subroutine subroutine NEPGetOperationCounters(nep, nfuncs, dots, lits ,ierr& &) NEP nep ! NEP PetscInt nfuncs ! PetscInt PetscInt dots ! PetscInt PetscInt lits ! PetscInt integer ierr end subroutine subroutine NEPComputeFunction(nep, lambda, A, B, flg ,ierr) NEP nep ! NEP PetscScalar lambda ! PetscScalar Mat A ! Mat Mat B ! Mat MatStructure flg ! MatStructure integer ierr end subroutine subroutine NEPComputeJacobian(nep, lambda, A, flg ,ierr) NEP nep ! NEP PetscScalar lambda ! PetscScalar Mat A ! Mat MatStructure flg ! MatStructure integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcip.h900000644000175000017500000001112412211062077022364 0ustar gladkgladk subroutine IPSetFromOptions(ip ,ierr) IP ip ! IP integer ierr end subroutine subroutine IPSetOrthogonalization(ip, type, refine, eta ,ierr) IP ip ! IP IPOrthogType type ! IPOrthogType IPOrthogRefineType refine ! IPOrthogRefineType PetscReal eta ! PetscReal integer ierr end subroutine subroutine IPReset(ip ,ierr) IP ip ! IP integer ierr end subroutine subroutine IPGetOperationCounters(ip, dots ,ierr) IP ip ! IP PetscInt dots ! PetscInt integer ierr end subroutine subroutine IPResetOperationCounters(ip ,ierr) IP ip ! IP integer ierr end subroutine subroutine IPBiOrthogonalize(ip, n, vupper, W, v, H, norm ,ierr) IP ip ! IP PetscInt n ! PetscInt Vec vupper ! Vec Vec W ! Vec Vec v ! Vec PetscScalar H ! PetscScalar PetscReal norm ! PetscReal integer ierr end subroutine subroutine IPPseudoOrthogonalize(ip, n, vupper, omega, v, H, & &norm, lindep ,ierr) IP ip ! IP PetscInt n ! PetscInt Vec vupper ! Vec PetscReal omega ! PetscReal Vec v ! Vec PetscScalar H ! PetscScalar PetscReal norm ! PetscReal PetscBool lindep ! PetscBool integer ierr end subroutine subroutine IPBOrthogonalize(ip, nds, defl, BDS, BDSnorms, n, & &which, vupper, bvupper, BVnorms, v, Bv, H, norm, lindep ,ierr) IP ip ! IP PetscInt nds ! PetscInt Vec defl ! Vec Vec BDS ! Vec PetscReal BDSnorms ! PetscReal PetscInt n ! PetscInt PetscBool which ! PetscBool Vec vupper ! Vec Vec bvupper ! Vec PetscReal BVnorms ! PetscReal Vec v ! Vec Vec Bv ! Vec PetscScalar H ! PetscScalar PetscReal norm ! PetscReal PetscBool lindep ! PetscBool integer ierr end subroutine subroutine IPNorm(ip, x, norm ,ierr) IP ip ! IP Vec x ! Vec PetscReal norm ! PetscReal integer ierr end subroutine subroutine IPNormBegin(ip, x, norm ,ierr) IP ip ! IP Vec x ! Vec PetscReal norm ! PetscReal integer ierr end subroutine subroutine IPNormEnd(ip, x, norm ,ierr) IP ip ! IP Vec x ! Vec PetscReal norm ! PetscReal integer ierr end subroutine subroutine IPInnerProduct(ip, x, y, p ,ierr) IP ip ! IP Vec x ! Vec Vec y ! Vec PetscScalar p ! PetscScalar integer ierr end subroutine subroutine IPInnerProductBegin(ip, x, y, p ,ierr) IP ip ! IP Vec x ! Vec Vec y ! Vec PetscScalar p ! PetscScalar integer ierr end subroutine subroutine IPInnerProductEnd(ip, x, y, p ,ierr) IP ip ! IP Vec x ! Vec Vec y ! Vec PetscScalar p ! PetscScalar integer ierr end subroutine subroutine IPMInnerProduct(ip, x, n, y, p ,ierr) IP ip ! IP Vec x ! Vec PetscInt n ! PetscInt Vec y (*) ! Vec PetscScalar p ! PetscScalar integer ierr end subroutine subroutine IPMInnerProductBegin(ip, x, n, y, p ,ierr) IP ip ! IP Vec x ! Vec PetscInt n ! PetscInt Vec y (*) ! Vec PetscScalar p ! PetscScalar integer ierr end subroutine subroutine IPMInnerProductEnd(ip, x, n, y, p ,ierr) IP ip ! IP Vec x ! Vec PetscInt n ! PetscInt Vec y (*) ! Vec PetscScalar p ! PetscScalar integer ierr end subroutine subroutine IPSetMatrix(ip, mat ,ierr) IP ip ! IP Mat mat ! Mat integer ierr end subroutine subroutine IPApplyMatrix(ip, x, y ,ierr) IP ip ! IP Vec x ! Vec Vec y ! Vec integer ierr end subroutine subroutine IPOrthogonalize(ip, nds, defl, n, which, vupper, v, H& &, norm, lindep ,ierr) IP ip ! IP PetscInt nds ! PetscInt Vec defl ! Vec PetscInt n ! PetscInt PetscBool which ! PetscBool Vec vupper ! Vec Vec v ! Vec PetscScalar H ! PetscScalar PetscReal norm ! PetscReal PetscBool lindep ! PetscBool integer ierr end subroutine subroutine IPQRDecomposition(ip, V, m, n, R, ldr ,ierr) IP ip ! IP Vec V ! Vec PetscInt m ! PetscInt PetscInt n ! PetscInt PetscScalar R ! PetscScalar PetscInt ldr ! PetscInt integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/makefile0000644000175000017500000000052612211062077022107 0ustar gladkgladk #requiresdefine 'PETSC_HAVE_FORTRAN' ALL: lib CFLAGS = FFLAGS = SOURCEC = SOURCEF = SOURCEH = slepcds.h90 slepceps.h90 slepcfn.h90 slepcip.h90 slepcmfn.h90 slepcnep.h90 slepcqep.h90 slepcst.h90 slepcsvd.h90 slepcsys.h90 DIRS = LIBBASE = libslepc LOCDIR = include/finclude/ftn-auto/ include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcds.h900000644000175000017500000001026012211062077022362 0ustar gladkgladk subroutine DSSetMethod(ds, meth ,ierr) DS ds ! DS PetscInt meth ! PetscInt integer ierr end subroutine subroutine DSGetMethod(ds, meth ,ierr) DS ds ! DS PetscInt meth ! PetscInt integer ierr end subroutine subroutine DSSetFunctionMethod(ds, meth ,ierr) DS ds ! DS PetscInt meth ! PetscInt integer ierr end subroutine subroutine DSGetFunctionMethod(ds, meth ,ierr) DS ds ! DS PetscInt meth ! PetscInt integer ierr end subroutine subroutine DSSetCompact(ds, comp ,ierr) DS ds ! DS PetscBool comp ! PetscBool integer ierr end subroutine subroutine DSGetCompact(ds, comp ,ierr) DS ds ! DS PetscBool comp ! PetscBool integer ierr end subroutine subroutine DSSetExtraRow(ds, ext ,ierr) DS ds ! DS PetscBool ext ! PetscBool integer ierr end subroutine subroutine DSGetExtraRow(ds, ext ,ierr) DS ds ! DS PetscBool ext ! PetscBool integer ierr end subroutine subroutine DSSetRefined(ds, ref ,ierr) DS ds ! DS PetscBool ref ! PetscBool integer ierr end subroutine subroutine DSGetRefined(ds, ref ,ierr) DS ds ! DS PetscBool ref ! PetscBool integer ierr end subroutine subroutine DSSetFN(ds, n, f ,ierr) DS ds ! DS PetscInt n ! PetscInt FN f (*) ! FN integer ierr end subroutine subroutine DSGetFN(ds, k, f ,ierr) DS ds ! DS PetscInt k ! PetscInt FN f ! FN integer ierr end subroutine subroutine DSGetNumFN(ds, n ,ierr) DS ds ! DS PetscInt n ! PetscInt integer ierr end subroutine subroutine DSSetFromOptions(ds ,ierr) DS ds ! DS integer ierr end subroutine subroutine DSAllocate(ds, ld ,ierr) DS ds ! DS PetscInt ld ! PetscInt integer ierr end subroutine subroutine DSReset(ds ,ierr) DS ds ! DS integer ierr end subroutine subroutine DSGetLeadingDimension(ds, ld ,ierr) DS ds ! DS PetscInt ld ! PetscInt integer ierr end subroutine subroutine DSSetState(ds, state ,ierr) DS ds ! DS DSStateType state ! DSStateType integer ierr end subroutine subroutine DSGetState(ds, state ,ierr) DS ds ! DS DSStateType state ! DSStateType integer ierr end subroutine subroutine DSSetDimensions(ds, n, m, l, k ,ierr) DS ds ! DS PetscInt n ! PetscInt PetscInt m ! PetscInt PetscInt l ! PetscInt PetscInt k ! PetscInt integer ierr end subroutine subroutine DSGetDimensions(ds, n, m, l, k, t ,ierr) DS ds ! DS PetscInt n ! PetscInt PetscInt m ! PetscInt PetscInt l ! PetscInt PetscInt k ! PetscInt PetscInt t ! PetscInt integer ierr end subroutine subroutine DSTruncate(ds, n ,ierr) DS ds ! DS PetscInt n ! PetscInt integer ierr end subroutine subroutine DSSolve(ds, eigr, eigi ,ierr) DS ds ! DS PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar integer ierr end subroutine subroutine DSComputeFunction(ds, f ,ierr) DS ds ! DS SlepcFunction f ! SlepcFunction integer ierr end subroutine subroutine DSSort(ds, eigr, eigi, rr, ri, k ,ierr) DS ds ! DS PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar PetscScalar rr ! PetscScalar PetscScalar ri ! PetscScalar PetscInt k ! PetscInt integer ierr end subroutine subroutine DSVectors(ds, mat, j, rnorm ,ierr) DS ds ! DS DSMatType mat ! DSMatType PetscInt j ! PetscInt PetscReal rnorm ! PetscReal integer ierr end subroutine subroutine DSNormalize(ds, mat, col ,ierr) DS ds ! DS DSMatType mat ! DSMatType PetscInt col ! PetscInt integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcst.h900000644000175000017500000001221612211062077022405 0ustar gladkgladk subroutine STCayleySetAntishift(st, nu ,ierr) ST st ! ST PetscScalar nu ! PetscScalar integer ierr end subroutine subroutine STCayleyGetAntishift(st, nu ,ierr) ST st ! ST PetscScalar nu ! PetscScalar integer ierr end subroutine subroutine STPrecondGetMatForPC(st, mat ,ierr) ST st ! ST Mat mat ! Mat integer ierr end subroutine subroutine STPrecondSetMatForPC(st, mat ,ierr) ST st ! ST Mat mat ! Mat integer ierr end subroutine subroutine STPrecondSetKSPHasMat(st, setmat ,ierr) ST st ! ST PetscBool setmat ! PetscBool integer ierr end subroutine subroutine STPrecondGetKSPHasMat(st, setmat ,ierr) ST st ! ST PetscBool setmat ! PetscBool integer ierr end subroutine subroutine STShellSetContext(st, ctx ,ierr) ST st ! ST PetscVoid ctx ! void integer ierr end subroutine subroutine STReset(st ,ierr) ST st ! ST integer ierr end subroutine subroutine STSetOperators(st, n, A ,ierr) ST st ! ST PetscInt n ! PetscInt Mat A (*) ! Mat integer ierr end subroutine subroutine STGetOperators(st, k, A ,ierr) ST st ! ST PetscInt k ! PetscInt Mat A ! Mat integer ierr end subroutine subroutine STGetNumMatrices(st, n ,ierr) ST st ! ST PetscInt n ! PetscInt integer ierr end subroutine subroutine STSetShift(st, shift ,ierr) ST st ! ST PetscScalar shift ! PetscScalar integer ierr end subroutine subroutine STGetShift(st, shift ,ierr) ST st ! ST PetscScalar shift ! PetscScalar integer ierr end subroutine subroutine STSetDefaultShift(st, defaultshift ,ierr) ST st ! ST PetscScalar defaultshift ! PetscScalar integer ierr end subroutine subroutine STSetBalanceMatrix(st, D ,ierr) ST st ! ST Vec D ! Vec integer ierr end subroutine subroutine STGetBalanceMatrix(st, D ,ierr) ST st ! ST Vec D ! Vec integer ierr end subroutine subroutine STSetFromOptions(st ,ierr) ST st ! ST integer ierr end subroutine subroutine STSetMatStructure(st, str ,ierr) ST st ! ST MatStructure str ! MatStructure integer ierr end subroutine subroutine STGetMatStructure(st, str ,ierr) ST st ! ST MatStructure str ! MatStructure integer ierr end subroutine subroutine STSetMatMode(st, mode ,ierr) ST st ! ST STMatMode mode ! STMatMode integer ierr end subroutine subroutine STMatMult(st, k, x, y ,ierr) ST st ! ST PetscInt k ! PetscInt Vec x ! Vec Vec y ! Vec integer ierr end subroutine subroutine STMatMultTranspose(st, k, x, y ,ierr) ST st ! ST PetscInt k ! PetscInt Vec x ! Vec Vec y ! Vec integer ierr end subroutine subroutine STMatSolve(st, k, b, x ,ierr) ST st ! ST PetscInt k ! PetscInt Vec b ! Vec Vec x ! Vec integer ierr end subroutine subroutine STMatSolveTranspose(st, k, b, x ,ierr) ST st ! ST PetscInt k ! PetscInt Vec b ! Vec Vec x ! Vec integer ierr end subroutine subroutine STSetKSP(st, ksp ,ierr) ST st ! ST KSP ksp ! KSP integer ierr end subroutine subroutine STGetKSP(st, ksp ,ierr) ST st ! ST KSP ksp ! KSP integer ierr end subroutine subroutine STGetOperationCounters(st, ops, lits ,ierr) ST st ! ST PetscInt ops ! PetscInt PetscInt lits ! PetscInt integer ierr end subroutine subroutine STResetOperationCounters(st ,ierr) ST st ! ST integer ierr end subroutine subroutine STCheckNullSpace(st, n, V ,ierr) ST st ! ST PetscInt n ! PetscInt Vec V (*) ! Vec integer ierr end subroutine subroutine STApply(st, x, y ,ierr) ST st ! ST Vec x ! Vec Vec y ! Vec integer ierr end subroutine subroutine STGetBilinearForm(st, B ,ierr) ST st ! ST Mat B ! Mat integer ierr end subroutine subroutine STApplyTranspose(st, x, y ,ierr) ST st ! ST Vec x ! Vec Vec y ! Vec integer ierr end subroutine subroutine STComputeExplicitOperator(st, mat ,ierr) ST st ! ST Mat mat ! Mat integer ierr end subroutine subroutine STSetUp(st ,ierr) ST st ! ST integer ierr end subroutine subroutine STPostSolve(st ,ierr) ST st ! ST integer ierr end subroutine subroutine STBackTransform(st, n, eigr, eigi ,ierr) ST st ! ST PetscInt n ! PetscInt PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcsvd.h900000644000175000017500000001307312211062077022555 0ustar gladkgladk subroutine SVDCrossSetEPS(svd, eps ,ierr) SVD svd ! SVD EPS eps ! EPS integer ierr end subroutine subroutine SVDCrossGetEPS(svd, eps ,ierr) SVD svd ! SVD EPS eps ! EPS integer ierr end subroutine subroutine SVDCyclicSetExplicitMatrix(svd, explicitmatrix ,ierr) SVD svd ! SVD PetscBool explicitmatrix ! PetscBool integer ierr end subroutine subroutine SVDCyclicGetExplicitMatrix(svd, explicitmatrix ,ierr) SVD svd ! SVD PetscBool explicitmatrix ! PetscBool integer ierr end subroutine subroutine SVDCyclicSetEPS(svd, eps ,ierr) SVD svd ! SVD EPS eps ! EPS integer ierr end subroutine subroutine SVDCyclicGetEPS(svd, eps ,ierr) SVD svd ! SVD EPS eps ! EPS integer ierr end subroutine subroutine SVDLanczosSetOneSide(svd, oneside ,ierr) SVD svd ! SVD PetscBool oneside ! PetscBool integer ierr end subroutine subroutine SVDLanczosGetOneSide(svd, oneside ,ierr) SVD svd ! SVD PetscBool oneside ! PetscBool integer ierr end subroutine subroutine SVDTRLanczosSetOneSide(svd, oneside ,ierr) SVD svd ! SVD PetscBool oneside ! PetscBool integer ierr end subroutine subroutine SVDTRLanczosGetOneSide(svd, oneside ,ierr) SVD svd ! SVD PetscBool oneside ! PetscBool integer ierr end subroutine subroutine SVDPrintSolution(svd, viewer ,ierr) SVD svd ! SVD PetscViewer viewer ! PetscViewer integer ierr end subroutine subroutine SVDReset(svd ,ierr) SVD svd ! SVD integer ierr end subroutine subroutine SVDSetIP(svd, ip ,ierr) SVD svd ! SVD IP ip ! IP integer ierr end subroutine subroutine SVDSetDS(svd, ds ,ierr) SVD svd ! SVD DS ds ! DS integer ierr end subroutine subroutine SVDMonitorCancel(svd ,ierr) SVD svd ! SVD integer ierr end subroutine subroutine SVDSetTransposeMode(svd, mode ,ierr) SVD svd ! SVD SVDTransposeMode mode ! SVDTransposeMode integer ierr end subroutine subroutine SVDSetTolerances(svd, tol, maxits ,ierr) SVD svd ! SVD PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine SVDGetTolerances(svd, tol, maxits ,ierr) SVD svd ! SVD PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine SVDSetDimensions(svd, nsv, ncv, mpd ,ierr) SVD svd ! SVD PetscInt nsv ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine SVDGetDimensions(svd, nsv, ncv, mpd ,ierr) SVD svd ! SVD PetscInt nsv ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine SVDSetWhichSingularTriplets(svd, which ,ierr) SVD svd ! SVD SVDWhich which ! SVDWhich integer ierr end subroutine subroutine SVDSetFromOptions(svd ,ierr) SVD svd ! SVD integer ierr end subroutine subroutine SVDSetTrackAll(svd, trackall ,ierr) SVD svd ! SVD PetscBool trackall ! PetscBool integer ierr end subroutine subroutine SVDGetTrackAll(svd, trackall ,ierr) SVD svd ! SVD PetscBool trackall ! PetscBool integer ierr end subroutine subroutine SVDSetOperator(svd, mat ,ierr) SVD svd ! SVD Mat mat ! Mat integer ierr end subroutine subroutine SVDGetOperator(svd, A ,ierr) SVD svd ! SVD Mat A ! Mat integer ierr end subroutine subroutine SVDSetUp(svd ,ierr) SVD svd ! SVD integer ierr end subroutine subroutine SVDSetInitialSpace(svd, n, is ,ierr) SVD svd ! SVD PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine SVDSetInitialSpaceLeft(svd, n, is ,ierr) SVD svd ! SVD PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine SVDSolve(svd ,ierr) SVD svd ! SVD integer ierr end subroutine subroutine SVDGetIterationNumber(svd, its ,ierr) SVD svd ! SVD PetscInt its ! PetscInt integer ierr end subroutine subroutine SVDGetConverged(svd, nconv ,ierr) SVD svd ! SVD PetscInt nconv ! PetscInt integer ierr end subroutine subroutine SVDGetSingularTriplet(svd, i, sigma, u, v ,ierr) SVD svd ! SVD PetscInt i ! PetscInt PetscReal sigma ! PetscReal Vec u ! Vec Vec v ! Vec integer ierr end subroutine subroutine SVDComputeResidualNorms(svd, i, norm1, norm2 ,ierr) SVD svd ! SVD PetscInt i ! PetscInt PetscReal norm1 ! PetscReal PetscReal norm2 ! PetscReal integer ierr end subroutine subroutine SVDComputeRelativeError(svd, i, error ,ierr) SVD svd ! SVD PetscInt i ! PetscInt PetscReal error ! PetscReal integer ierr end subroutine subroutine SVDGetOperationCounters(svd, matvecs, dots ,ierr) SVD svd ! SVD PetscInt matvecs ! PetscInt PetscInt dots ! PetscInt integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcfn.h900000644000175000017500000000176212211062077022366 0ustar gladkgladk subroutine FNSetParameters(fn, na, alpha, nb, beta ,ierr) FN fn ! FN PetscInt na ! PetscInt PetscScalar alpha ! PetscScalar PetscInt nb ! PetscInt PetscScalar beta ! PetscScalar integer ierr end subroutine subroutine FNGetParameters(fn, na, alpha, nb, beta ,ierr) FN fn ! FN PetscInt na ! PetscInt PetscScalar alpha (*) ! PetscScalar PetscInt nb ! PetscInt PetscScalar beta (*) ! PetscScalar integer ierr end subroutine subroutine FNEvaluateFunction(fn, x, y ,ierr) FN fn ! FN PetscScalar x ! PetscScalar PetscScalar y ! PetscScalar integer ierr end subroutine subroutine FNEvaluateDerivative(fn, x, y ,ierr) FN fn ! FN PetscScalar x ! PetscScalar PetscScalar y ! PetscScalar integer ierr end subroutine subroutine FNSetFromOptions(fn ,ierr) FN fn ! FN integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcqep.h900000644000175000017500000001561212211062077022547 0ustar gladkgladk subroutine QEPLinearSetCompanionForm(qep, cform ,ierr) QEP qep ! QEP PetscInt cform ! PetscInt integer ierr end subroutine subroutine QEPLinearGetCompanionForm(qep, cform ,ierr) QEP qep ! QEP PetscInt cform ! PetscInt integer ierr end subroutine subroutine QEPLinearSetExplicitMatrix(qep, explicitmatrix ,ierr) QEP qep ! QEP PetscBool explicitmatrix ! PetscBool integer ierr end subroutine subroutine QEPLinearGetExplicitMatrix(qep, explicitmatrix ,ierr) QEP qep ! QEP PetscBool explicitmatrix ! PetscBool integer ierr end subroutine subroutine QEPLinearSetEPS(qep, eps ,ierr) QEP qep ! QEP EPS eps ! EPS integer ierr end subroutine subroutine QEPLinearGetEPS(qep, eps ,ierr) QEP qep ! QEP EPS eps ! EPS integer ierr end subroutine subroutine QEPPrintSolution(qep, viewer ,ierr) QEP qep ! QEP PetscViewer viewer ! PetscViewer integer ierr end subroutine subroutine QEPReset(qep ,ierr) QEP qep ! QEP integer ierr end subroutine subroutine QEPSetIP(qep, ip ,ierr) QEP qep ! QEP IP ip ! IP integer ierr end subroutine subroutine QEPSetDS(qep, ds ,ierr) QEP qep ! QEP DS ds ! DS integer ierr end subroutine subroutine QEPSetST(qep, st ,ierr) QEP qep ! QEP ST st ! ST integer ierr end subroutine subroutine QEPSetTarget(qep, target ,ierr) QEP qep ! QEP PetscScalar target ! PetscScalar integer ierr end subroutine subroutine QEPGetTarget(qep, target ,ierr) QEP qep ! QEP PetscScalar target ! PetscScalar integer ierr end subroutine subroutine QEPSetWorkVecs(qep, nw ,ierr) QEP qep ! QEP PetscInt nw ! PetscInt integer ierr end subroutine subroutine QEPMonitorCancel(qep ,ierr) QEP qep ! QEP integer ierr end subroutine subroutine QEPSetFromOptions(qep ,ierr) QEP qep ! QEP integer ierr end subroutine subroutine QEPGetTolerances(qep, tol, maxits ,ierr) QEP qep ! QEP PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine QEPSetTolerances(qep, tol, maxits ,ierr) QEP qep ! QEP PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine QEPGetDimensions(qep, nev, ncv, mpd ,ierr) QEP qep ! QEP PetscInt nev ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine QEPSetDimensions(qep, nev, ncv, mpd ,ierr) QEP qep ! QEP PetscInt nev ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine QEPSetWhichEigenpairs(qep, which ,ierr) QEP qep ! QEP QEPWhich which ! QEPWhich integer ierr end subroutine subroutine QEPSetLeftVectorsWanted(qep, leftvecs ,ierr) QEP qep ! QEP PetscBool leftvecs ! PetscBool integer ierr end subroutine subroutine QEPGetScaleFactor(qep, alpha ,ierr) QEP qep ! QEP PetscReal alpha ! PetscReal integer ierr end subroutine subroutine QEPSetScaleFactor(qep, alpha ,ierr) QEP qep ! QEP PetscReal alpha ! PetscReal integer ierr end subroutine subroutine QEPSetProblemType(qep, type ,ierr) QEP qep ! QEP QEPProblemType type ! QEPProblemType integer ierr end subroutine subroutine QEPSetTrackAll(qep, trackall ,ierr) QEP qep ! QEP PetscBool trackall ! PetscBool integer ierr end subroutine subroutine QEPGetTrackAll(qep, trackall ,ierr) QEP qep ! QEP PetscBool trackall ! PetscBool integer ierr end subroutine subroutine QEPSetUp(qep ,ierr) QEP qep ! QEP integer ierr end subroutine subroutine QEPSetOperators(qep, M, C, K ,ierr) QEP qep ! QEP Mat M ! Mat Mat C ! Mat Mat K ! Mat integer ierr end subroutine subroutine QEPGetOperators(qep, M, C, K ,ierr) QEP qep ! QEP Mat M ! Mat Mat C ! Mat Mat K ! Mat integer ierr end subroutine subroutine QEPSetInitialSpace(qep, n, is ,ierr) QEP qep ! QEP PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine QEPSetInitialSpaceLeft(qep, n, is ,ierr) QEP qep ! QEP PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine QEPSolve(qep ,ierr) QEP qep ! QEP integer ierr end subroutine subroutine QEPGetIterationNumber(qep, its ,ierr) QEP qep ! QEP PetscInt its ! PetscInt integer ierr end subroutine subroutine QEPGetConverged(qep, nconv ,ierr) QEP qep ! QEP PetscInt nconv ! PetscInt integer ierr end subroutine subroutine QEPGetEigenpair(qep, i, eigr, eigi, Vr, Vi ,ierr) QEP qep ! QEP PetscInt i ! PetscInt PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar Vec Vr ! Vec Vec Vi ! Vec integer ierr end subroutine subroutine QEPGetErrorEstimate(qep, i, errest ,ierr) QEP qep ! QEP PetscInt i ! PetscInt PetscReal errest ! PetscReal integer ierr end subroutine subroutine QEPComputeResidualNorm(qep, i, norm ,ierr) QEP qep ! QEP PetscInt i ! PetscInt PetscReal norm ! PetscReal integer ierr end subroutine subroutine QEPComputeRelativeError(qep, i, error ,ierr) QEP qep ! QEP PetscInt i ! PetscInt PetscReal error ! PetscReal integer ierr end subroutine subroutine QEPSortEigenvalues(qep, n, eigr, eigi, perm ,ierr) QEP qep ! QEP PetscInt n ! PetscInt PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar PetscInt perm ! PetscInt integer ierr end subroutine subroutine QEPCompareEigenvalues(qep, ar, ai, br, bi, result , & &ierr) QEP qep ! QEP PetscScalar ar ! PetscScalar PetscScalar ai ! PetscScalar PetscScalar br ! PetscScalar PetscScalar bi ! PetscScalar PetscInt result ! PetscInt integer ierr end subroutine subroutine QEPGetOperationCounters(qep, matvecs, dots, lits , & &ierr) QEP qep ! QEP PetscInt matvecs ! PetscInt PetscInt dots ! PetscInt PetscInt lits ! PetscInt integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepcmfn.h900000644000175000017500000000517612211062077022546 0ustar gladkgladk subroutine MFNReset(mfn ,ierr) MFN mfn ! MFN integer ierr end subroutine subroutine MFNSetIP(mfn, ip ,ierr) MFN mfn ! MFN IP ip ! IP integer ierr end subroutine subroutine MFNSetDS(mfn, ds ,ierr) MFN mfn ! MFN DS ds ! DS integer ierr end subroutine subroutine MFNMonitorCancel(mfn ,ierr) MFN mfn ! MFN integer ierr end subroutine subroutine MFNSetFromOptions(mfn ,ierr) MFN mfn ! MFN integer ierr end subroutine subroutine MFNGetTolerances(mfn, tol, maxits ,ierr) MFN mfn ! MFN PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine MFNSetTolerances(mfn, tol, maxits ,ierr) MFN mfn ! MFN PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine MFNGetDimensions(mfn, ncv ,ierr) MFN mfn ! MFN PetscInt ncv ! PetscInt integer ierr end subroutine subroutine MFNSetDimensions(mfn, ncv ,ierr) MFN mfn ! MFN PetscInt ncv ! PetscInt integer ierr end subroutine subroutine MFNSetFunction(mfn, fun ,ierr) MFN mfn ! MFN SlepcFunction fun ! SlepcFunction integer ierr end subroutine subroutine MFNSetScaleFactor(mfn, alpha ,ierr) MFN mfn ! MFN PetscScalar alpha ! PetscScalar integer ierr end subroutine subroutine MFNGetScaleFactor(mfn, alpha ,ierr) MFN mfn ! MFN PetscScalar alpha ! PetscScalar integer ierr end subroutine subroutine MFNSetErrorIfNotConverged(mfn, flg ,ierr) MFN mfn ! MFN PetscBool flg ! PetscBool integer ierr end subroutine subroutine MFNGetErrorIfNotConverged(mfn, flag ,ierr) MFN mfn ! MFN PetscBool flag ! PetscBool integer ierr end subroutine subroutine MFNSetUp(mfn ,ierr) MFN mfn ! MFN integer ierr end subroutine subroutine MFNSetOperator(mfn, A ,ierr) MFN mfn ! MFN Mat A ! Mat integer ierr end subroutine subroutine MFNGetOperator(mfn, A ,ierr) MFN mfn ! MFN Mat A ! Mat integer ierr end subroutine subroutine MFNSolve(mfn, b, x ,ierr) MFN mfn ! MFN Vec b ! Vec Vec x ! Vec integer ierr end subroutine subroutine MFNGetIterationNumber(mfn, its ,ierr) MFN mfn ! MFN PetscInt its ! PetscInt integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/ftn-auto/slepceps.h900000644000175000017500000004626712211062077022563 0ustar gladkgladk subroutine EPSRQCGSetReset(eps, nrest ,ierr) EPS eps ! EPS PetscInt nrest ! PetscInt integer ierr end subroutine subroutine EPSRQCGGetReset(eps, nrest ,ierr) EPS eps ! EPS PetscInt nrest ! PetscInt integer ierr end subroutine subroutine EPSCISSSetRegion(eps, center, radius, vscale ,ierr) EPS eps ! EPS PetscScalar center ! PetscScalar PetscReal radius ! PetscReal PetscReal vscale ! PetscReal integer ierr end subroutine subroutine EPSCISSGetRegion(eps, center, radius, vscale ,ierr) EPS eps ! EPS PetscScalar center ! PetscScalar PetscReal radius ! PetscReal PetscReal vscale ! PetscReal integer ierr end subroutine subroutine EPSCISSSetSizes(eps, ip, bs, ms, npart, bsmax, isreal& & ,ierr) EPS eps ! EPS PetscInt ip ! PetscInt PetscInt bs ! PetscInt PetscInt ms ! PetscInt PetscInt npart ! PetscInt PetscInt bsmax ! PetscInt PetscBool isreal ! PetscBool integer ierr end subroutine subroutine EPSCISSGetSizes(eps, ip, bs, ms, npart, bsmax, isreal& & ,ierr) EPS eps ! EPS PetscInt ip ! PetscInt PetscInt bs ! PetscInt PetscInt ms ! PetscInt PetscInt npart ! PetscInt PetscInt bsmax ! PetscInt PetscBool isreal ! PetscBool integer ierr end subroutine subroutine EPSCISSSetThreshold(eps, delta, spur ,ierr) EPS eps ! EPS PetscReal delta ! PetscReal PetscReal spur ! PetscReal integer ierr end subroutine subroutine EPSCISSGetThreshold(eps, delta, spur ,ierr) EPS eps ! EPS PetscReal delta ! PetscReal PetscReal spur ! PetscReal integer ierr end subroutine subroutine EPSCISSSetRefinement(eps, inner, outer, blsize ,ierr) EPS eps ! EPS PetscInt inner ! PetscInt PetscInt outer ! PetscInt PetscInt blsize ! PetscInt integer ierr end subroutine subroutine EPSCISSGetRefinement(eps, inner, outer, blsize ,ierr) EPS eps ! EPS PetscInt inner ! PetscInt PetscInt outer ! PetscInt PetscInt blsize ! PetscInt integer ierr end subroutine subroutine EPSGDSetKrylovStart(eps, krylovstart ,ierr) EPS eps ! EPS PetscBool krylovstart ! PetscBool integer ierr end subroutine subroutine EPSGDGetKrylovStart(eps, krylovstart ,ierr) EPS eps ! EPS PetscBool krylovstart ! PetscBool integer ierr end subroutine subroutine EPSGDSetBlockSize(eps, blocksize ,ierr) EPS eps ! EPS PetscInt blocksize ! PetscInt integer ierr end subroutine subroutine EPSGDGetBlockSize(eps, blocksize ,ierr) EPS eps ! EPS PetscInt blocksize ! PetscInt integer ierr end subroutine subroutine EPSGDGetRestart(eps, minv, plusk ,ierr) EPS eps ! EPS PetscInt minv ! PetscInt PetscInt plusk ! PetscInt integer ierr end subroutine subroutine EPSGDSetRestart(eps, minv, plusk ,ierr) EPS eps ! EPS PetscInt minv ! PetscInt PetscInt plusk ! PetscInt integer ierr end subroutine subroutine EPSGDGetInitialSize(eps, initialsize ,ierr) EPS eps ! EPS PetscInt initialsize ! PetscInt integer ierr end subroutine subroutine EPSGDSetInitialSize(eps, initialsize ,ierr) EPS eps ! EPS PetscInt initialsize ! PetscInt integer ierr end subroutine subroutine EPSGDSetBOrth(eps, borth ,ierr) EPS eps ! EPS EPSOrthType borth ! EPSOrthType integer ierr end subroutine subroutine EPSGDGetBOrth(eps, borth ,ierr) EPS eps ! EPS EPSOrthType borth ! EPSOrthType integer ierr end subroutine subroutine EPSGDGetWindowSizes(eps, pwindow, qwindow ,ierr) EPS eps ! EPS PetscInt pwindow ! PetscInt PetscInt qwindow ! PetscInt integer ierr end subroutine subroutine EPSGDSetWindowSizes(eps, pwindow, qwindow ,ierr) EPS eps ! EPS PetscInt pwindow ! PetscInt PetscInt qwindow ! PetscInt integer ierr end subroutine subroutine EPSGDGetDoubleExpansion(eps, flg ,ierr) EPS eps ! EPS PetscBool flg ! PetscBool integer ierr end subroutine subroutine EPSGDSetDoubleExpansion(eps, use_gd2 ,ierr) EPS eps ! EPS PetscBool use_gd2 ! PetscBool integer ierr end subroutine subroutine EPSJDSetKrylovStart(eps, krylovstart ,ierr) EPS eps ! EPS PetscBool krylovstart ! PetscBool integer ierr end subroutine subroutine EPSJDGetKrylovStart(eps, krylovstart ,ierr) EPS eps ! EPS PetscBool krylovstart ! PetscBool integer ierr end subroutine subroutine EPSJDSetBlockSize(eps, blocksize ,ierr) EPS eps ! EPS PetscInt blocksize ! PetscInt integer ierr end subroutine subroutine EPSJDGetBlockSize(eps, blocksize ,ierr) EPS eps ! EPS PetscInt blocksize ! PetscInt integer ierr end subroutine subroutine EPSJDGetRestart(eps, minv, plusk ,ierr) EPS eps ! EPS PetscInt minv ! PetscInt PetscInt plusk ! PetscInt integer ierr end subroutine subroutine EPSJDSetRestart(eps, minv, plusk ,ierr) EPS eps ! EPS PetscInt minv ! PetscInt PetscInt plusk ! PetscInt integer ierr end subroutine subroutine EPSJDGetInitialSize(eps, initialsize ,ierr) EPS eps ! EPS PetscInt initialsize ! PetscInt integer ierr end subroutine subroutine EPSJDSetInitialSize(eps, initialsize ,ierr) EPS eps ! EPS PetscInt initialsize ! PetscInt integer ierr end subroutine subroutine EPSJDGetFix(eps, fix ,ierr) EPS eps ! EPS PetscReal fix ! PetscReal integer ierr end subroutine subroutine EPSJDSetFix(eps, fix ,ierr) EPS eps ! EPS PetscReal fix ! PetscReal integer ierr end subroutine subroutine EPSJDSetConstCorrectionTol(eps, constant ,ierr) EPS eps ! EPS PetscBool constant ! PetscBool integer ierr end subroutine subroutine EPSJDGetConstCorrectionTol(eps, constant ,ierr) EPS eps ! EPS PetscBool constant ! PetscBool integer ierr end subroutine subroutine EPSJDGetWindowSizes(eps, pwindow, qwindow ,ierr) EPS eps ! EPS PetscInt pwindow ! PetscInt PetscInt qwindow ! PetscInt integer ierr end subroutine subroutine EPSJDSetWindowSizes(eps, pwindow, qwindow ,ierr) EPS eps ! EPS PetscInt pwindow ! PetscInt PetscInt qwindow ! PetscInt integer ierr end subroutine subroutine EPSJDSetBOrth(eps, borth ,ierr) EPS eps ! EPS EPSOrthType borth ! EPSOrthType integer ierr end subroutine subroutine EPSJDGetBOrth(eps, borth ,ierr) EPS eps ! EPS EPSOrthType borth ! EPSOrthType integer ierr end subroutine subroutine EPSBlzpackSetBlockSize(eps, bs ,ierr) EPS eps ! EPS PetscInt bs ! PetscInt integer ierr end subroutine subroutine EPSBlzpackSetNSteps(eps, nsteps ,ierr) EPS eps ! EPS PetscInt nsteps ! PetscInt integer ierr end subroutine subroutine EPSFEASTSetNumPoints(eps, npoints ,ierr) EPS eps ! EPS PetscInt npoints ! PetscInt integer ierr end subroutine subroutine EPSFEASTGetNumPoints(eps, npoints ,ierr) EPS eps ! EPS PetscInt npoints ! PetscInt integer ierr end subroutine subroutine EPSPRIMMESetBlockSize(eps, bs ,ierr) EPS eps ! EPS PetscInt bs ! PetscInt integer ierr end subroutine subroutine EPSPRIMMEGetBlockSize(eps, bs ,ierr) EPS eps ! EPS PetscInt bs ! PetscInt integer ierr end subroutine subroutine EPSPRIMMESetMethod(eps, method ,ierr) EPS eps ! EPS EPSPRIMMEMethod method ! EPSPRIMMEMethod integer ierr end subroutine subroutine EPSArnoldiSetDelayed(eps, delayed ,ierr) EPS eps ! EPS PetscBool delayed ! PetscBool integer ierr end subroutine subroutine EPSKrylovSchurSetRestart(eps, keep ,ierr) EPS eps ! EPS PetscReal keep ! PetscReal integer ierr end subroutine subroutine EPSKrylovSchurGetRestart(eps, keep ,ierr) EPS eps ! EPS PetscReal keep ! PetscReal integer ierr end subroutine subroutine EPSLanczosSetReorthog(eps, reorthog ,ierr) EPS eps ! EPS EPSLanczosReorthogType reorthog ! EPSLanczosReorthogType integer ierr end subroutine subroutine EPSPowerSetShiftType(eps, shift ,ierr) EPS eps ! EPS EPSPowerShiftType shift ! EPSPowerShiftType integer ierr end subroutine subroutine EPSPrintSolution(eps, viewer ,ierr) EPS eps ! EPS PetscViewer viewer ! PetscViewer integer ierr end subroutine subroutine EPSReset(eps ,ierr) EPS eps ! EPS integer ierr end subroutine subroutine EPSSetTarget(eps, target ,ierr) EPS eps ! EPS PetscScalar target ! PetscScalar integer ierr end subroutine subroutine EPSGetTarget(eps, target ,ierr) EPS eps ! EPS PetscScalar target ! PetscScalar integer ierr end subroutine subroutine EPSSetInterval(eps, inta, intb ,ierr) EPS eps ! EPS PetscReal inta ! PetscReal PetscReal intb ! PetscReal integer ierr end subroutine subroutine EPSGetInterval(eps, inta, intb ,ierr) EPS eps ! EPS PetscReal inta ! PetscReal PetscReal intb ! PetscReal integer ierr end subroutine subroutine EPSSetST(eps, st ,ierr) EPS eps ! EPS ST st ! ST integer ierr end subroutine subroutine EPSSetIP(eps, ip ,ierr) EPS eps ! EPS IP ip ! IP integer ierr end subroutine subroutine EPSSetDS(eps, ds ,ierr) EPS eps ! EPS DS ds ! DS integer ierr end subroutine subroutine EPSIsGeneralized(eps, is ,ierr) EPS eps ! EPS PetscBool is ! PetscBool integer ierr end subroutine subroutine EPSIsHermitian(eps, is ,ierr) EPS eps ! EPS PetscBool is ! PetscBool integer ierr end subroutine subroutine EPSIsPositive(eps, is ,ierr) EPS eps ! EPS PetscBool is ! PetscBool integer ierr end subroutine subroutine EPSSetWorkVecs(eps, nw ,ierr) EPS eps ! EPS PetscInt nw ! PetscInt integer ierr end subroutine subroutine EPSMonitorCancel(eps ,ierr) EPS eps ! EPS integer ierr end subroutine subroutine EPSSetFromOptions(eps ,ierr) EPS eps ! EPS integer ierr end subroutine subroutine EPSGetTolerances(eps, tol, maxits ,ierr) EPS eps ! EPS PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine EPSSetTolerances(eps, tol, maxits ,ierr) EPS eps ! EPS PetscReal tol ! PetscReal PetscInt maxits ! PetscInt integer ierr end subroutine subroutine EPSGetDimensions(eps, nev, ncv, mpd ,ierr) EPS eps ! EPS PetscInt nev ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine EPSSetDimensions(eps, nev, ncv, mpd ,ierr) EPS eps ! EPS PetscInt nev ! PetscInt PetscInt ncv ! PetscInt PetscInt mpd ! PetscInt integer ierr end subroutine subroutine EPSSetWhichEigenpairs(eps, which ,ierr) EPS eps ! EPS EPSWhich which ! EPSWhich integer ierr end subroutine subroutine EPSSetLeftVectorsWanted(eps, leftvecs ,ierr) EPS eps ! EPS PetscBool leftvecs ! PetscBool integer ierr end subroutine subroutine EPSGetLeftVectorsWanted(eps, leftvecs ,ierr) EPS eps ! EPS PetscBool leftvecs ! PetscBool integer ierr end subroutine subroutine EPSSetMatrixNorms(eps, nrma, nrmb, adaptive ,ierr) EPS eps ! EPS PetscReal nrma ! PetscReal PetscReal nrmb ! PetscReal PetscBool adaptive ! PetscBool integer ierr end subroutine subroutine EPSGetMatrixNorms(eps, nrma, nrmb, adaptive ,ierr) EPS eps ! EPS PetscReal nrma ! PetscReal PetscReal nrmb ! PetscReal PetscBool adaptive ! PetscBool integer ierr end subroutine subroutine EPSSetConvergenceTest(eps, conv ,ierr) EPS eps ! EPS EPSConv conv ! EPSConv integer ierr end subroutine subroutine EPSGetConvergenceTest(eps, conv ,ierr) EPS eps ! EPS EPSConv conv ! EPSConv integer ierr end subroutine subroutine EPSSetProblemType(eps, type ,ierr) EPS eps ! EPS EPSProblemType type ! EPSProblemType integer ierr end subroutine subroutine EPSSetExtraction(eps, extr ,ierr) EPS eps ! EPS EPSExtraction extr ! EPSExtraction integer ierr end subroutine subroutine EPSSetBalance(eps, bal, its, cutoff ,ierr) EPS eps ! EPS EPSBalance bal ! EPSBalance PetscInt its ! PetscInt PetscReal cutoff ! PetscReal integer ierr end subroutine subroutine EPSGetBalance(eps, bal, its, cutoff ,ierr) EPS eps ! EPS EPSBalance bal ! EPSBalance PetscInt its ! PetscInt PetscReal cutoff ! PetscReal integer ierr end subroutine subroutine EPSSetTrueResidual(eps, trueres ,ierr) EPS eps ! EPS PetscBool trueres ! PetscBool integer ierr end subroutine subroutine EPSSetTrackAll(eps, trackall ,ierr) EPS eps ! EPS PetscBool trackall ! PetscBool integer ierr end subroutine subroutine EPSGetTrackAll(eps, trackall ,ierr) EPS eps ! EPS PetscBool trackall ! PetscBool integer ierr end subroutine subroutine EPSSetUp(eps ,ierr) EPS eps ! EPS integer ierr end subroutine subroutine EPSSetOperators(eps, A, B ,ierr) EPS eps ! EPS Mat A ! Mat Mat B ! Mat integer ierr end subroutine subroutine EPSSetDeflationSpace(eps, n, v ,ierr) EPS eps ! EPS PetscInt n ! PetscInt Vec v ! Vec integer ierr end subroutine subroutine EPSRemoveDeflationSpace(eps ,ierr) EPS eps ! EPS integer ierr end subroutine subroutine EPSSetInitialSpace(eps, n, is ,ierr) EPS eps ! EPS PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine EPSSetInitialSpaceLeft(eps, n, is ,ierr) EPS eps ! EPS PetscInt n ! PetscInt Vec is ! Vec integer ierr end subroutine subroutine EPSSolve(eps ,ierr) EPS eps ! EPS integer ierr end subroutine subroutine EPSGetIterationNumber(eps, its ,ierr) EPS eps ! EPS PetscInt its ! PetscInt integer ierr end subroutine subroutine EPSGetOperationCounters(eps, ops, dots, lits ,ierr) EPS eps ! EPS PetscInt ops ! PetscInt PetscInt dots ! PetscInt PetscInt lits ! PetscInt integer ierr end subroutine subroutine EPSGetConverged(eps, nconv ,ierr) EPS eps ! EPS PetscInt nconv ! PetscInt integer ierr end subroutine subroutine EPSGetInvariantSubspace(eps, v ,ierr) EPS eps ! EPS Vec v ! Vec integer ierr end subroutine subroutine EPSGetInvariantSubspaceLeft(eps, v ,ierr) EPS eps ! EPS Vec v ! Vec integer ierr end subroutine subroutine EPSGetEigenpair(eps, i, eigr, eigi, Vr, Vi ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar Vec Vr ! Vec Vec Vi ! Vec integer ierr end subroutine subroutine EPSGetEigenvalue(eps, i, eigr, eigi ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar integer ierr end subroutine subroutine EPSGetEigenvector(eps, i, Vr, Vi ,ierr) EPS eps ! EPS PetscInt i ! PetscInt Vec Vr ! Vec Vec Vi ! Vec integer ierr end subroutine subroutine EPSGetEigenvectorLeft(eps, i, Wr, Wi ,ierr) EPS eps ! EPS PetscInt i ! PetscInt Vec Wr ! Vec Vec Wi ! Vec integer ierr end subroutine subroutine EPSGetErrorEstimate(eps, i, errest ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscReal errest ! PetscReal integer ierr end subroutine subroutine EPSGetErrorEstimateLeft(eps, i, errest ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscReal errest ! PetscReal integer ierr end subroutine subroutine EPSComputeResidualNorm(eps, i, norm ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscReal norm ! PetscReal integer ierr end subroutine subroutine EPSComputeResidualNormLeft(eps, i, norm ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscReal norm ! PetscReal integer ierr end subroutine subroutine EPSComputeRelativeError(eps, i, error ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscReal error ! PetscReal integer ierr end subroutine subroutine EPSComputeRelativeErrorLeft(eps, i, error ,ierr) EPS eps ! EPS PetscInt i ! PetscInt PetscReal error ! PetscReal integer ierr end subroutine subroutine EPSSortEigenvalues(eps, n, eigr, eigi, perm ,ierr) EPS eps ! EPS PetscInt n ! PetscInt PetscScalar eigr ! PetscScalar PetscScalar eigi ! PetscScalar PetscInt perm ! PetscInt integer ierr end subroutine subroutine EPSCompareEigenvalues(eps, ar, ai, br, bi, result , & &ierr) EPS eps ! EPS PetscScalar ar ! PetscScalar PetscScalar ai ! PetscScalar PetscScalar br ! PetscScalar PetscScalar bi ! PetscScalar PetscInt result ! PetscInt integer ierr end subroutine subroutine EPSGetStartVector(eps, i, vec, breakdown ,ierr) EPS eps ! EPS PetscInt i ! PetscInt Vec vec ! Vec PetscBool breakdown ! PetscBool integer ierr end subroutine subroutine EPSGetStartVectorLeft(eps, i, vec, breakdown ,ierr) EPS eps ! EPS PetscInt i ! PetscInt Vec vec ! Vec PetscBool breakdown ! PetscBool integer ierr end subroutine slepc-3.4.2.dfsg.orig/include/finclude/slepcepsdef.h.html0000644000175000017500000001463612211062077022272 0ustar gladkgladk
Actual source code: slepcepsdef.h

  1: !
  2: !  Include file for Fortran use of the EPS object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26:  #include finclude/slepcstdef.h
 27:  #include finclude/slepcipdef.h
 28:  #include finclude/slepcdsdef.h

 30: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 31: #define EPS                    PetscFortranAddr
 32: #endif

 34: #define EPSType                character*(80)
 35: #define EPSConvergedReason     PetscEnum
 36: #define EPSProblemType         PetscEnum
 37: #define EPSWhich               PetscEnum
 38: #define EPSExtraction          PetscEnum
 39: #define EPSBalance             PetscEnum
 40: #define EPSConv                PetscEnum
 41: #define EPSOrthType            PetscEnum
 42: #define EPSPowerShiftType      PetscEnum
 43: #define EPSLanczosReorthogType PetscEnum
 44: #define EPSPRIMMEMethod        PetscEnum
 45: #define EPSPRIMMEPrecond       PetscEnum


 48: #define EPSPOWER       'power'
 49: #define EPSSUBSPACE    'subspace'
 50: #define EPSARNOLDI     'arnoldi'
 51: #define EPSLANCZOS     'lanczos'
 52: #define EPSKRYLOVSCHUR 'krylovschur'
 53: #define EPSGD          'gd'
 54: #define EPSJD          'jd'
 55: #define EPSRQCG        'rqcg'
 56: #define EPSCISS        'ciss'
 57: #define EPSLAPACK      'lapack'
 58: #define EPSARPACK      'arpack'
 59: #define EPSBLZPACK     'blzpack'
 60: #define EPSTRLAN       'trlan'
 61: #define EPSBLOPEX      'blopex'
 62: #define EPSPRIMME      'primme'
 63: #define EPSFEAST       'feast'

 65: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcdsdef.h.html0000644000175000017500000000710212211062077022077 0ustar gladkgladk
Actual source code: slepcdsdef.h

  1: !
  2: !  Include file for Fortran use of the DS object in SLEPc
  3: !
  4: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5: !  SLEPc - Scalable Library for Eigenvalue Problem Computations
  6: !  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
  7: !
  8: !  This file is part of SLEPc.
  9: !
 10: !  SLEPc is free software: you can redistribute it and/or modify it under  the
 11: !  terms of version 3 of the GNU Lesser General Public License as published by
 12: !  the Free Software Foundation.
 13: !
 14: !  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15: !  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16: !  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17: !  more details.
 18: !
 19: !  You  should have received a copy of the GNU Lesser General  Public  License
 20: !  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21: !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: !

 26: #if !defined(PETSC_USE_FORTRAN_DATATYPES)
 27: #define DS PetscFortranAddr
 28: #endif

 30: #define DSType      character*(80)
 31: #define DSStateType PetscEnum
 32: #define DSMatType   PetscEnum

 34: #define DSHEP       'hep'
 35: #define DSNHEP      'nhep'
 36: #define DSGHEP      'ghep'
 37: #define DSGHIEP     'ghiep'
 38: #define DSGNHEP     'gnhep'
 39: #define DSSVD       'svd'
 40: #define DSQEP       'qep'
 41: #define DSNEP       'nep'

 43: #endif
slepc-3.4.2.dfsg.orig/include/finclude/slepcds.h0000644000175000017500000000557112211062077020465 0ustar gladkgladk! ! Include file for Fortran use of the DS object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcdsdef.h" PetscEnum DS_STATE_RAW PetscEnum DS_STATE_INTERMEDIATE PetscEnum DS_STATE_CONDENSED PetscEnum DS_STATE_TRUNCATED parameter (DS_STATE_RAW = 0) parameter (DS_STATE_INTERMEDIATE = 1) parameter (DS_STATE_CONDENSED = 2) parameter (DS_STATE_TRUNCATED = 3) PetscEnum DS_MAT_A PetscEnum DS_MAT_B PetscEnum DS_MAT_C PetscEnum DS_MAT_T PetscEnum DS_MAT_D PetscEnum DS_MAT_Q PetscEnum DS_MAT_Z PetscEnum DS_MAT_X PetscEnum DS_MAT_Y PetscEnum DS_MAT_U PetscEnum DS_MAT_VT PetscEnum DS_MAT_W PetscEnum DS_MAT_E0 PetscEnum DS_MAT_E1 PetscEnum DS_MAT_E2 PetscEnum DS_MAT_E3 PetscEnum DS_MAT_E4 PetscEnum DS_MAT_E5 PetscEnum DS_MAT_E6 PetscEnum DS_MAT_E7 PetscEnum DS_MAT_E8 PetscEnum DS_MAT_E9 PetscEnum DS_NUM_MAT parameter (DS_MAT_A = 0) parameter (DS_MAT_B = 1) parameter (DS_MAT_C = 2) parameter (DS_MAT_T = 3) parameter (DS_MAT_D = 4) parameter (DS_MAT_Q = 5) parameter (DS_MAT_Z = 6) parameter (DS_MAT_X = 7) parameter (DS_MAT_Y = 8) parameter (DS_MAT_U = 9) parameter (DS_MAT_VT = 10) parameter (DS_MAT_W = 11) parameter (DS_MAT_E0 = 12) parameter (DS_MAT_E1 = 13) parameter (DS_MAT_E2 = 14) parameter (DS_MAT_E3 = 15) parameter (DS_MAT_E4 = 16) parameter (DS_MAT_E5 = 17) parameter (DS_MAT_E6 = 18) parameter (DS_MAT_E7 = 19) parameter (DS_MAT_E8 = 20) parameter (DS_MAT_E9 = 21) parameter (DS_NUM_MAT = 22) ! ! End of Fortran include file for the DS package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcmfn.h0000644000175000017500000000325112211062077020630 0ustar gladkgladk! ! Include file for Fortran use of the MFN object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcmfndef.h" ! Convergence flags. ! They sould match the flags in $SLEPC_DIR/include/slepcmfn.h PetscEnum MFN_CONVERGED_TOL PetscEnum MFN_DIVERGED_ITS PetscEnum MFN_DIVERGED_BREAKDOWN PetscEnum MFN_CONVERGED_ITERATING parameter (MFN_CONVERGED_TOL = 2) parameter (MFN_DIVERGED_ITS = -3) parameter (MFN_DIVERGED_BREAKDOWN = -4) parameter (MFN_CONVERGED_ITERATING = 0) PetscEnum MFN_EXP parameter (MFN_EXP = 1) ! ! Possible arguments to MFNMonitorSet() ! external MFNMONITORDEFAULT external MFNMONITORLG ! ! End of Fortran include file for the MFN package in SLEPc ! slepc-3.4.2.dfsg.orig/include/finclude/slepcdef.h0000644000175000017500000000233512211062077020610 0ustar gladkgladk! ! Single Fortran include file for all of SLEPc ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcsysdef.h" #include "finclude/slepcepsdef.h" #include "finclude/slepcipdef.h" #include "finclude/slepcstdef.h" #include "finclude/slepcsvddef.h" #include "finclude/slepcqepdef.h" #include "finclude/slepcnepdef.h" #include "finclude/slepcmfndef.h" slepc-3.4.2.dfsg.orig/include/finclude/slepceps.h900000644000175000017500000000222312211062077021006 0ustar gladkgladk! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! ! ! ! Additional EPS include file for use of SLEPc with Fortran 90/HPF ! #include "finclude/ftn-custom/slepceps.h90" #if defined(PETSC_USE_FORTRAN_INTERFACES) interface #include "finclude/ftn-auto/slepceps.h90" end interface #endif slepc-3.4.2.dfsg.orig/include/finclude/slepcsvd.h0000644000175000017500000000401112211062077020637 0ustar gladkgladk! ! Include file for Fortran use of the SVD object in SLEPc ! ! ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! SLEPc - Scalable Library for Eigenvalue Problem Computations ! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain ! ! This file is part of SLEPc. ! ! SLEPc is free software: you can redistribute it and/or modify it under the ! terms of version 3 of the GNU Lesser General Public License as published by ! the Free Software Foundation. ! ! SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for ! more details. ! ! You should have received a copy of the GNU Lesser General Public License ! along with SLEPc. If not, see . ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! #include "finclude/slepcsvddef.h" ! Convergence flags. ! They sould match the flags in $SLEPC_DIR/include/slepcsvd.h PetscEnum SVD_CONVERGED_TOL PetscEnum SVD_DIVERGED_ITS PetscEnum SVD_DIVERGED_BREAKDOWN PetscEnum SVD_CONVERGED_ITERATING parameter (SVD_CONVERGED_TOL = 2) parameter (SVD_DIVERGED_ITS = -3) parameter (SVD_DIVERGED_BREAKDOWN = -4) parameter (SVD_CONVERGED_ITERATING = 0) PetscEnum SVD_TRANSPOSE_EXPLICIT PetscEnum SVD_TRANSPOSE_IMPLICIT parameter (SVD_TRANSPOSE_EXPLICIT = 0) parameter (SVD_TRANSPOSE_IMPLICIT = 1) integer SVD_LARGEST integer SVD_SMALLEST parameter (SVD_LARGEST = 0) parameter (SVD_SMALLEST = 1) ! ! Possible arguments to SVDMonitorSet() ! external SVDMONITORALL external SVDMONITORLG external SVDMONITORLGALL external SVDMONITORCONVERGED external SVDMONITORFIRST ! ! End of Fortran include file for the SVD package in SLEPc ! slepc-3.4.2.dfsg.orig/include/slepcsys.h0000644000175000017500000000522612211062077017101 0ustar gladkgladk/* This include file contains definitions of system functions. It is included by all other SLEPc include files. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCSYS_H) #define __SLEPCSYS_H /* ========================================================================== */ /* slepcconf.h is created by the configure script and placed in ${PETSC_ARCH}/include. It contains macro definitions set at configure time. */ #include /* slepcversion.h contains version info */ #include #define SLEPC_AUTHOR_INFO " The SLEPc Team\n slepc-maint@grycap.upv.es\n http://www.grycap.upv.es/slepc\n" /* ========================================================================== */ /* The PETSc include files. */ #include /* slepcmath.h contains definition of basic math functions */ #include /* Initialization of SLEPc and other system routines */ PETSC_EXTERN PetscErrorCode SlepcInitialize(int*,char***,const char[],const char[]); PETSC_EXTERN PetscErrorCode SlepcInitializeNoPointers(int,char**,const char[],const char[]); PETSC_EXTERN PetscErrorCode SlepcInitializeNoArguments(void); PETSC_EXTERN PetscErrorCode SlepcFinalize(void); PETSC_EXTERN PetscErrorCode SlepcInitializeFortran(void); PETSC_EXTERN PetscErrorCode SlepcInitialized(PetscBool*); PETSC_EXTERN PetscErrorCode SlepcGetVersion(char[],size_t); PETSC_EXTERN PetscErrorCode SlepcMatConvertSeqDense(Mat,Mat*); PETSC_EXTERN PetscErrorCode SlepcMatTile(PetscScalar,Mat,PetscScalar,Mat,PetscScalar,Mat,PetscScalar,Mat,Mat*); PETSC_EXTERN PetscErrorCode SlepcCheckOrthogonality(Vec*,PetscInt,Vec*,PetscInt,Mat,PetscViewer,PetscReal*); PETSC_EXTERN PetscErrorCode SlepcSNPrintfScalar(char*,size_t,PetscScalar,PetscBool); PETSC_EXTERN PetscBool SlepcInitializeCalled; #endif slepc-3.4.2.dfsg.orig/include/slepcfn.h.html0000644000175000017500000002062112211062077017625 0ustar gladkgladk
Actual source code: slepcfn.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 24: #include <slepcsys.h>

 26: PETSC_EXTERN PetscErrorCode FNInitializePackage(void);
 27: /*S
 28:    FN - Abstraction of a mathematical function.

 30:    Level: beginner

 32: .seealso: FNCreate()
 33: S*/
 34: typedef struct _p_FN* FN;

 36: /*J
 37:    FNType - String with the name of the mathematical function.

 39:    Level: beginner

 41: .seealso: FNSetType(), FN
 42: J*/
 43: typedef const char* FNType;
 44: #define FNRATIONAL "rational"
 45: #define FNEXP      "exp"
 46: #define FNLOG      "log"
 47: #define FNPHI      "phi"

 49: /* Logging support */
 50: PETSC_EXTERN PetscClassId FN_CLASSID;

 52: PETSC_EXTERN PetscErrorCode FNCreate(MPI_Comm,FN*);
 53: PETSC_EXTERN PetscErrorCode FNSetType(FN,FNType);
 54: PETSC_EXTERN PetscErrorCode FNGetType(FN,FNType*);
 55: PETSC_EXTERN PetscErrorCode FNSetOptionsPrefix(FN,const char *);
 56: PETSC_EXTERN PetscErrorCode FNAppendOptionsPrefix(FN,const char *);
 57: PETSC_EXTERN PetscErrorCode FNGetOptionsPrefix(FN,const char *[]);
 58: PETSC_EXTERN PetscErrorCode FNSetFromOptions(FN);
 59: PETSC_EXTERN PetscErrorCode FNView(FN,PetscViewer);
 60: PETSC_EXTERN PetscErrorCode FNDestroy(FN*);

 62: PETSC_EXTERN PetscErrorCode FNSetParameters(FN,PetscInt,PetscScalar*,PetscInt,PetscScalar*);
 63: PETSC_EXTERN PetscErrorCode FNGetParameters(FN,PetscInt*,PetscScalar**,PetscInt*,PetscScalar**);

 65: PETSC_EXTERN PetscErrorCode FNEvaluateFunction(FN,PetscScalar,PetscScalar*);
 66: PETSC_EXTERN PetscErrorCode FNEvaluateDerivative(FN,PetscScalar,PetscScalar*);

 68: PETSC_EXTERN PetscFunctionList FNList;
 69: PETSC_EXTERN PetscBool         FNRegisterAllCalled;
 70: PETSC_EXTERN PetscErrorCode FNRegisterAll(void);
 71: PETSC_EXTERN PetscErrorCode FNRegister(const char[],PetscErrorCode(*)(FN));

 73: #endif
slepc-3.4.2.dfsg.orig/include/slepcst.h0000644000175000017500000001244212211062077016707 0ustar gladkgladk/* Spectral transformation module for eigenvalue problems. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCST_H) #define __SLEPCST_H #include #include PETSC_EXTERN PetscErrorCode STInitializePackage(void); /*S ST - Abstract SLEPc object that manages spectral transformations. This object is accessed only in advanced applications. Level: beginner .seealso: STCreate(), EPS S*/ typedef struct _p_ST* ST; /*J STType - String with the name of a SLEPc spectral transformation Level: beginner .seealso: STSetType(), ST J*/ typedef const char* STType; #define STSHELL "shell" #define STSHIFT "shift" #define STSINVERT "sinvert" #define STCAYLEY "cayley" #define STFOLD "fold" #define STPRECOND "precond" /* Logging support */ PETSC_EXTERN PetscClassId ST_CLASSID; PETSC_EXTERN PetscErrorCode STCreate(MPI_Comm,ST*); PETSC_EXTERN PetscErrorCode STDestroy(ST*); PETSC_EXTERN PetscErrorCode STReset(ST); PETSC_EXTERN PetscErrorCode STSetType(ST,STType); PETSC_EXTERN PetscErrorCode STGetType(ST,STType*); PETSC_EXTERN PetscErrorCode STSetOperators(ST,PetscInt,Mat*); PETSC_EXTERN PetscErrorCode STGetOperators(ST,PetscInt,Mat*); PETSC_EXTERN PetscErrorCode STGetNumMatrices(ST,PetscInt*); PETSC_EXTERN PetscErrorCode STSetUp(ST); PETSC_EXTERN PetscErrorCode STSetFromOptions(ST); PETSC_EXTERN PetscErrorCode STView(ST,PetscViewer); PETSC_EXTERN PetscErrorCode STApply(ST,Vec,Vec); PETSC_EXTERN PetscErrorCode STMatMult(ST,PetscInt,Vec,Vec); PETSC_EXTERN PetscErrorCode STMatMultTranspose(ST,PetscInt,Vec,Vec); PETSC_EXTERN PetscErrorCode STMatSolve(ST,PetscInt,Vec,Vec); PETSC_EXTERN PetscErrorCode STMatSolveTranspose(ST,PetscInt,Vec,Vec); PETSC_EXTERN PetscErrorCode STGetBilinearForm(ST,Mat*); PETSC_EXTERN PetscErrorCode STApplyTranspose(ST,Vec,Vec); PETSC_EXTERN PetscErrorCode STComputeExplicitOperator(ST,Mat*); PETSC_EXTERN PetscErrorCode STPostSolve(ST); PETSC_EXTERN PetscErrorCode STSetKSP(ST,KSP); PETSC_EXTERN PetscErrorCode STGetKSP(ST,KSP*); PETSC_EXTERN PetscErrorCode STSetShift(ST,PetscScalar); PETSC_EXTERN PetscErrorCode STGetShift(ST,PetscScalar*); PETSC_EXTERN PetscErrorCode STSetDefaultShift(ST,PetscScalar); PETSC_EXTERN PetscErrorCode STSetBalanceMatrix(ST,Vec); PETSC_EXTERN PetscErrorCode STGetBalanceMatrix(ST,Vec*); PETSC_EXTERN PetscErrorCode STSetOptionsPrefix(ST,const char*); PETSC_EXTERN PetscErrorCode STAppendOptionsPrefix(ST,const char*); PETSC_EXTERN PetscErrorCode STGetOptionsPrefix(ST,const char*[]); PETSC_EXTERN PetscErrorCode STBackTransform(ST,PetscInt,PetscScalar*,PetscScalar*); PETSC_EXTERN PetscErrorCode STCheckNullSpace(ST,PetscInt,const Vec[]); PETSC_EXTERN PetscErrorCode STGetOperationCounters(ST,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode STResetOperationCounters(ST); /*E STMatMode - Determines how to handle the coefficient matrix associated to the spectral transformation Level: intermediate .seealso: STSetMatMode(), STGetMatMode() E*/ typedef enum { ST_MATMODE_COPY, ST_MATMODE_INPLACE, ST_MATMODE_SHELL } STMatMode; PETSC_EXTERN PetscErrorCode STSetMatMode(ST,STMatMode); PETSC_EXTERN PetscErrorCode STGetMatMode(ST,STMatMode*); PETSC_EXTERN PetscErrorCode STSetMatStructure(ST,MatStructure); PETSC_EXTERN PetscErrorCode STGetMatStructure(ST,MatStructure*); PETSC_EXTERN PetscFunctionList STList; PETSC_EXTERN PetscBool STRegisterAllCalled; PETSC_EXTERN PetscErrorCode STRegisterAll(void); PETSC_EXTERN PetscErrorCode STRegister(const char[],PetscErrorCode(*)(ST)); /* --------- options specific to particular spectral transformations-------- */ PETSC_EXTERN PetscErrorCode STShellGetContext(ST st,void **ctx); PETSC_EXTERN PetscErrorCode STShellSetContext(ST st,void *ctx); PETSC_EXTERN PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec)); PETSC_EXTERN PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec)); PETSC_EXTERN PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*)); PETSC_EXTERN PetscErrorCode STCayleyGetAntishift(ST,PetscScalar*); PETSC_EXTERN PetscErrorCode STCayleySetAntishift(ST,PetscScalar); PETSC_EXTERN PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat); PETSC_EXTERN PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat); PETSC_EXTERN PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat); PETSC_EXTERN PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat); #endif slepc-3.4.2.dfsg.orig/include/slepcsys.h.html0000644000175000017500000001551612211062077020047 0ustar gladkgladk
Actual source code: slepcsys.h

  1: /*
  2:    This include file contains definitions of system functions. It is included
  3:    by all other SLEPc include files.

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

  9:    This file is part of SLEPc.

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

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

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


 28: /* ========================================================================== */
 29: /*
 30:    slepcconf.h is created by the configure script and placed in ${PETSC_ARCH}/include.
 31:    It contains macro definitions set at configure time.
 32: */
 33: #include <slepcconf.h>
 34: /*
 35:     slepcversion.h contains version info
 36: */
 37: #include <slepcversion.h>
 38: #define SLEPC_AUTHOR_INFO "       The SLEPc Team\n    slepc-maint@grycap.upv.es\n http://www.grycap.upv.es/slepc\n"

 40: /* ========================================================================== */
 41: /*
 42:    The PETSc include files.
 43: */
 44: #include <petscmat.h>
 45: /*
 46:     slepcmath.h contains definition of basic math functions
 47: */
 48: #include <slepcmath.h>

 50: /*
 51:     Initialization of SLEPc and other system routines
 52: */
 53: PETSC_EXTERN PetscErrorCode SlepcInitialize(int*,char***,const char[],const char[]);
 54: PETSC_EXTERN PetscErrorCode SlepcInitializeNoPointers(int,char**,const char[],const char[]);
 55: PETSC_EXTERN PetscErrorCode SlepcInitializeNoArguments(void);
 56: PETSC_EXTERN PetscErrorCode SlepcFinalize(void);
 57: PETSC_EXTERN PetscErrorCode SlepcInitializeFortran(void);
 58: PETSC_EXTERN PetscErrorCode SlepcInitialized(PetscBool*);
 59: PETSC_EXTERN PetscErrorCode SlepcGetVersion(char[],size_t);

 61: PETSC_EXTERN PetscErrorCode SlepcMatConvertSeqDense(Mat,Mat*);
 62: PETSC_EXTERN PetscErrorCode SlepcMatTile(PetscScalar,Mat,PetscScalar,Mat,PetscScalar,Mat,PetscScalar,Mat,Mat*);
 63: PETSC_EXTERN PetscErrorCode SlepcCheckOrthogonality(Vec*,PetscInt,Vec*,PetscInt,Mat,PetscViewer,PetscReal*);
 64: PETSC_EXTERN PetscErrorCode SlepcSNPrintfScalar(char*,size_t,PetscScalar,PetscBool);

 66: PETSC_EXTERN PetscBool SlepcInitializeCalled;

 68: #endif

slepc-3.4.2.dfsg.orig/include/slepcversion.h0000644000175000017500000000274012211062077017746 0ustar gladkgladk#if !defined(__SLEPCVERSION_H) #define __SLEPCVERSION_H #define SLEPC_VERSION_RELEASE 1 #define SLEPC_VERSION_MAJOR 3 #define SLEPC_VERSION_MINOR 4 #define SLEPC_VERSION_SUBMINOR 2 #define SLEPC_VERSION_PATCH 0 #define SLEPC_RELEASE_DATE "July 5, 2013" #define SLEPC_VERSION_DATE "sep 02, 2013" #if !defined (SLEPC_VERSION_GIT) #define SLEPC_VERSION_GIT "b0629a1b2458eee7363982bb73290c27a5c787d3" #endif #if !defined(SLEPC_VERSION_DATE_GIT) #define SLEPC_VERSION_DATE_GIT "2013-09-02 11:52:34 +0200" #endif #define SLEPC_VERSION_(MAJOR,MINOR,SUBMINOR) \ ((SLEPC_VERSION_MAJOR == (MAJOR)) && \ (SLEPC_VERSION_MINOR == (MINOR)) && \ (SLEPC_VERSION_SUBMINOR == (SUBMINOR)) && \ (SLEPC_VERSION_RELEASE == 1)) #define SLEPC_VERSION_LT(MAJOR,MINOR,SUBMINOR) \ (SLEPC_VERSION_RELEASE == 1 && \ (SLEPC_VERSION_MAJOR < (MAJOR) || \ (SLEPC_VERSION_MAJOR == (MAJOR) && \ (SLEPC_VERSION_MINOR < (MINOR) || \ (SLEPC_VERSION_MINOR == (MINOR) && \ (SLEPC_VERSION_SUBMINOR < (SUBMINOR))))))) #define SLEPC_VERSION_LE(MAJOR,MINOR,SUBMINOR) \ (SLEPC_VERSION_LT(MAJOR,MINOR,SUBMINOR) || \ SLEPC_VERSION_(MAJOR,MINOR,SUBMINOR)) #define SLEPC_VERSION_GT(MAJOR,MINOR,SUBMINOR) \ (!SLEPC_VERSION_LE(MAJOR,MINOR,SUBMINOR)) #define SLEPC_VERSION_GE(MAJOR,MINOR,SUBMINOR) \ (!SLEPC_VERSION_LT(MAJOR,MINOR,SUBMINOR)) #endif slepc-3.4.2.dfsg.orig/include/slepcvec.h.html0000644000175000017500000001305012211062077017775 0ustar gladkgladk
Actual source code: slepcvec.h

  1: /*
  2:    User interface for various vector operations added in SLEPc.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepcsys.h>
 27: #include <petscmat.h>

 29: /* VecComp: Vec composed of several smaller Vecs */
 30: #define VECCOMP  "comp"

 32: PETSC_EXTERN PetscErrorCode VecCreateComp(MPI_Comm,PetscInt*,PetscInt,VecType,Vec,Vec*);
 33: PETSC_EXTERN PetscErrorCode VecCreateCompWithVecs(Vec*,PetscInt,Vec,Vec*);
 34: PETSC_EXTERN PetscErrorCode VecCompGetSubVecs(Vec,PetscInt*,const Vec**);
 35: PETSC_EXTERN PetscErrorCode VecCompSetSubVecs(Vec,PetscInt,Vec*);

 37: /* Vecs with contiguous array storage */
 38: PETSC_EXTERN PetscErrorCode SlepcVecSetTemplate(Vec);
 39: PETSC_EXTERN PetscErrorCode SlepcMatGetVecsTemplate(Mat,Vec*,Vec*);

 41: /* Vec-related operations that have two versions, for contiguous and regular Vecs */
 42: PETSC_EXTERN PetscErrorCode SlepcUpdateVectors(PetscInt,Vec*,PetscInt,PetscInt,const PetscScalar*,PetscInt,PetscBool);
 43: PETSC_EXTERN PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans);
 44: PETSC_EXTERN PetscErrorCode SlepcVecMAXPBY(Vec,PetscScalar,PetscScalar,PetscInt,PetscScalar*,Vec*);

 46: /* Miscellaneous functions related to Vec */
 47: PETSC_EXTERN PetscErrorCode SlepcVecSetRandom(Vec,PetscRandom);
 48: PETSC_EXTERN PetscErrorCode SlepcVecNormalize(Vec,Vec,PetscBool,PetscReal*);

 50: #endif

slepc-3.4.2.dfsg.orig/include/makefile0000644000175000017500000000243712211062077016564 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = SOURCEC = SOURCEF = SOURCEH = slepc.h slepcsys.h slepcmath.h slepcversion.h slepcblaslapack.h \ slepceps.h slepcqep.h slepcnep.h slepcmfn.h slepcsvd.h \ slepcst.h slepcip.h slepcds.h slepcfn.h slepcvec.h LIBBASE = libslepc DIRS = finclude slepc-private LOCDIR = include/ MANSEC = include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/include/slepcst.h.html0000644000175000017500000004735412211062077017664 0ustar gladkgladk
Actual source code: slepcst.h

  1: /*
  2:    Spectral transformation module for eigenvalue problems.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepcsys.h>
 27: #include <petscksp.h>

 29: PETSC_EXTERN PetscErrorCode STInitializePackage(void);

 31: /*S
 32:     ST - Abstract SLEPc object that manages spectral transformations.
 33:     This object is accessed only in advanced applications.

 35:     Level: beginner

 37: .seealso:  STCreate(), EPS
 38: S*/
 39: typedef struct _p_ST* ST;

 41: /*J
 42:     STType - String with the name of a SLEPc spectral transformation

 44:     Level: beginner

 46: .seealso: STSetType(), ST
 47: J*/
 48: typedef const char* STType;
 49: #define STSHELL     "shell"
 50: #define STSHIFT     "shift"
 51: #define STSINVERT   "sinvert"
 52: #define STCAYLEY    "cayley"
 53: #define STFOLD      "fold"
 54: #define STPRECOND   "precond"

 56: /* Logging support */
 57: PETSC_EXTERN PetscClassId ST_CLASSID;

 59: PETSC_EXTERN PetscErrorCode STCreate(MPI_Comm,ST*);
 60: PETSC_EXTERN PetscErrorCode STDestroy(ST*);
 61: PETSC_EXTERN PetscErrorCode STReset(ST);
 62: PETSC_EXTERN PetscErrorCode STSetType(ST,STType);
 63: PETSC_EXTERN PetscErrorCode STGetType(ST,STType*);
 64: PETSC_EXTERN PetscErrorCode STSetOperators(ST,PetscInt,Mat*);
 65: PETSC_EXTERN PetscErrorCode STGetOperators(ST,PetscInt,Mat*);
 66: PETSC_EXTERN PetscErrorCode STGetNumMatrices(ST,PetscInt*);
 67: PETSC_EXTERN PetscErrorCode STSetUp(ST);
 68: PETSC_EXTERN PetscErrorCode STSetFromOptions(ST);
 69: PETSC_EXTERN PetscErrorCode STView(ST,PetscViewer);

 71: PETSC_EXTERN PetscErrorCode STApply(ST,Vec,Vec);
 72: PETSC_EXTERN PetscErrorCode STMatMult(ST,PetscInt,Vec,Vec);
 73: PETSC_EXTERN PetscErrorCode STMatMultTranspose(ST,PetscInt,Vec,Vec);
 74: PETSC_EXTERN PetscErrorCode STMatSolve(ST,PetscInt,Vec,Vec);
 75: PETSC_EXTERN PetscErrorCode STMatSolveTranspose(ST,PetscInt,Vec,Vec);
 76: PETSC_EXTERN PetscErrorCode STGetBilinearForm(ST,Mat*);
 77: PETSC_EXTERN PetscErrorCode STApplyTranspose(ST,Vec,Vec);
 78: PETSC_EXTERN PetscErrorCode STComputeExplicitOperator(ST,Mat*);
 79: PETSC_EXTERN PetscErrorCode STPostSolve(ST);

 81: PETSC_EXTERN PetscErrorCode STSetKSP(ST,KSP);
 82: PETSC_EXTERN PetscErrorCode STGetKSP(ST,KSP*);
 83: PETSC_EXTERN PetscErrorCode STSetShift(ST,PetscScalar);
 84: PETSC_EXTERN PetscErrorCode STGetShift(ST,PetscScalar*);
 85: PETSC_EXTERN PetscErrorCode STSetDefaultShift(ST,PetscScalar);
 86: PETSC_EXTERN PetscErrorCode STSetBalanceMatrix(ST,Vec);
 87: PETSC_EXTERN PetscErrorCode STGetBalanceMatrix(ST,Vec*);

 89: PETSC_EXTERN PetscErrorCode STSetOptionsPrefix(ST,const char*);
 90: PETSC_EXTERN PetscErrorCode STAppendOptionsPrefix(ST,const char*);
 91: PETSC_EXTERN PetscErrorCode STGetOptionsPrefix(ST,const char*[]);

 93: PETSC_EXTERN PetscErrorCode STBackTransform(ST,PetscInt,PetscScalar*,PetscScalar*);

 95: PETSC_EXTERN PetscErrorCode STCheckNullSpace(ST,PetscInt,const Vec[]);

 97: PETSC_EXTERN PetscErrorCode STGetOperationCounters(ST,PetscInt*,PetscInt*);
 98: PETSC_EXTERN PetscErrorCode STResetOperationCounters(ST);

100: /*E
101:     STMatMode - Determines how to handle the coefficient matrix associated
102:     to the spectral transformation

104:     Level: intermediate

106: .seealso: STSetMatMode(), STGetMatMode()
107: E*/
108: typedef enum { ST_MATMODE_COPY,
109:                ST_MATMODE_INPLACE,
110:                ST_MATMODE_SHELL } STMatMode;
111: PETSC_EXTERN PetscErrorCode STSetMatMode(ST,STMatMode);
112: PETSC_EXTERN PetscErrorCode STGetMatMode(ST,STMatMode*);
113: PETSC_EXTERN PetscErrorCode STSetMatStructure(ST,MatStructure);
114: PETSC_EXTERN PetscErrorCode STGetMatStructure(ST,MatStructure*);

116: PETSC_EXTERN PetscFunctionList STList;
117: PETSC_EXTERN PetscBool         STRegisterAllCalled;
118: PETSC_EXTERN PetscErrorCode STRegisterAll(void);
119: PETSC_EXTERN PetscErrorCode STRegister(const char[],PetscErrorCode(*)(ST));

121: /* --------- options specific to particular spectral transformations-------- */

123: PETSC_EXTERN PetscErrorCode STShellGetContext(ST st,void **ctx);
124: PETSC_EXTERN PetscErrorCode STShellSetContext(ST st,void *ctx);
125: PETSC_EXTERN PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec));
126: PETSC_EXTERN PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec));
127: PETSC_EXTERN PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*));

129: PETSC_EXTERN PetscErrorCode STCayleyGetAntishift(ST,PetscScalar*);
130: PETSC_EXTERN PetscErrorCode STCayleySetAntishift(ST,PetscScalar);

132: PETSC_EXTERN PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat);
133: PETSC_EXTERN PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat);
134: PETSC_EXTERN PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat);
135: PETSC_EXTERN PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat);

137: #endif

slepc-3.4.2.dfsg.orig/include/slepcip.h.html0000644000175000017500000004067412211062077017644 0ustar gladkgladk
Actual source code: slepcip.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 24: #include <slepcvec.h>

 26: PETSC_EXTERN PetscErrorCode IPInitializePackage(void);
 27: /*S
 28:     IP - Abstraction of a vector inner product, that can be defined
 29:     in different ways. Using this object is not required for application
 30:     programmers.

 32:     Level: beginner

 34: .seealso: IPCreate()
 35: S*/
 36: typedef struct _p_IP* IP;

 38: /*J
 39:     IPType - String with the name of the inner product. For complex scalars,
 40:     it is possible to choose between a sesquilinear form (x,y)=x^H*M*y (the default)
 41:     or a bilinear form (x,y)=x^T*M*y (without complex conjugation). In the case
 42:     of real scalars, only the bilinear form (x,y)=x^T*M*y is available.
 43:     Apart form these, there is also an indefinite inner product, defined by
 44:     and indefinite matrix M.

 46:     Level: advanced

 48: .seealso: IPSetType(), IP
 49: J*/
 50: typedef const char* IPType;
 51: #define IPBILINEAR     "bilinear"
 52: #define IPSESQUILINEAR "sesquilinear"
 53: #define IPINDEFINITE   "indefinite"

 55: /* Logging support */
 56: PETSC_EXTERN PetscClassId IP_CLASSID;

 58: /*E
 59:     IPOrthogType - Determines what type of orthogonalization to use

 61:     Level: advanced

 63: .seealso: IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize()
 64: E*/
 65: typedef enum { IP_ORTHOG_MGS,
 66:                IP_ORTHOG_CGS } IPOrthogType;

 68: /*E
 69:     IPOrthogRefineType - Determines what type of refinement
 70:     to use during orthogonalization

 72:     Level: advanced

 74: .seealso: IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize()
 75: E*/
 76: typedef enum { IP_ORTHOG_REFINE_NEVER,
 77:                IP_ORTHOG_REFINE_IFNEEDED,
 78:                IP_ORTHOG_REFINE_ALWAYS } IPOrthogRefineType;

 80: PETSC_EXTERN PetscErrorCode IPCreate(MPI_Comm,IP*);
 81: PETSC_EXTERN PetscErrorCode IPSetType(IP,IPType);
 82: PETSC_EXTERN PetscErrorCode IPGetType(IP,IPType*);
 83: PETSC_EXTERN PetscErrorCode IPSetOptionsPrefix(IP,const char *);
 84: PETSC_EXTERN PetscErrorCode IPAppendOptionsPrefix(IP,const char *);
 85: PETSC_EXTERN PetscErrorCode IPGetOptionsPrefix(IP,const char *[]);
 86: PETSC_EXTERN PetscErrorCode IPSetFromOptions(IP);
 87: PETSC_EXTERN PetscErrorCode IPSetOrthogonalization(IP,IPOrthogType,IPOrthogRefineType,PetscReal);
 88: PETSC_EXTERN PetscErrorCode IPGetOrthogonalization(IP,IPOrthogType*,IPOrthogRefineType*,PetscReal*);
 89: PETSC_EXTERN PetscErrorCode IPView(IP,PetscViewer);
 90: PETSC_EXTERN PetscErrorCode IPDestroy(IP*);
 91: PETSC_EXTERN PetscErrorCode IPReset(IP);

 93: PETSC_EXTERN PetscErrorCode IPOrthogonalize(IP,PetscInt,Vec*,PetscInt,PetscBool*,Vec*,Vec,PetscScalar*,PetscReal*,PetscBool*);
 94: PETSC_EXTERN PetscErrorCode IPBOrthogonalize(IP,PetscInt,Vec*,Vec*,PetscReal*,PetscInt,PetscBool*,Vec*,Vec*,PetscReal*,Vec,Vec,PetscScalar*,PetscReal*,PetscBool*);
 95: PETSC_EXTERN PetscErrorCode IPBiOrthogonalize(IP,PetscInt,Vec*,Vec*,Vec,PetscScalar*,PetscReal*);
 96: PETSC_EXTERN PetscErrorCode IPPseudoOrthogonalize(IP,PetscInt,Vec*,PetscReal*,Vec,PetscScalar*,PetscReal*,PetscBool*);
 97: PETSC_EXTERN PetscErrorCode IPQRDecomposition(IP,Vec*,PetscInt,PetscInt,PetscScalar*,PetscInt);

 99: PETSC_EXTERN PetscErrorCode IPSetMatrix(IP,Mat);
100: PETSC_EXTERN PetscErrorCode IPGetMatrix(IP,Mat*);
101: PETSC_EXTERN PetscErrorCode IPApplyMatrix(IP,Vec,Vec);

103: PETSC_EXTERN PetscErrorCode IPInnerProduct(IP,Vec,Vec,PetscScalar*);
104: PETSC_EXTERN PetscErrorCode IPInnerProductBegin(IP,Vec,Vec,PetscScalar*);
105: PETSC_EXTERN PetscErrorCode IPInnerProductEnd(IP,Vec,Vec,PetscScalar*);
106: PETSC_EXTERN PetscErrorCode IPMInnerProduct(IP,Vec,PetscInt,const Vec[],PetscScalar*);
107: PETSC_EXTERN PetscErrorCode IPMInnerProductBegin(IP,Vec,PetscInt,const Vec[],PetscScalar*);
108: PETSC_EXTERN PetscErrorCode IPMInnerProductEnd(IP,Vec,PetscInt,const Vec[],PetscScalar*);
109: PETSC_EXTERN PetscErrorCode IPNorm(IP,Vec,PetscReal*);
110: PETSC_EXTERN PetscErrorCode IPNormBegin(IP,Vec,PetscReal*);
111: PETSC_EXTERN PetscErrorCode IPNormEnd(IP,Vec,PetscReal*);

113: PETSC_EXTERN PetscFunctionList IPList;
114: PETSC_EXTERN PetscBool         IPRegisterAllCalled;
115: PETSC_EXTERN PetscErrorCode IPRegisterAll(void);
116: PETSC_EXTERN PetscErrorCode IPRegister(const char[],PetscErrorCode(*)(IP));

118: PETSC_EXTERN PetscErrorCode IPGetOperationCounters(IP,PetscInt*);
119: PETSC_EXTERN PetscErrorCode IPResetOperationCounters(IP);

121: #endif
slepc-3.4.2.dfsg.orig/include/slepcvec.h0000644000175000017500000000435712211062077017044 0ustar gladkgladk/* User interface for various vector operations added in SLEPc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCVEC_H) #define __SLEPCVEC_H #include #include /* VecComp: Vec composed of several smaller Vecs */ #define VECCOMP "comp" PETSC_EXTERN PetscErrorCode VecCreateComp(MPI_Comm,PetscInt*,PetscInt,VecType,Vec,Vec*); PETSC_EXTERN PetscErrorCode VecCreateCompWithVecs(Vec*,PetscInt,Vec,Vec*); PETSC_EXTERN PetscErrorCode VecCompGetSubVecs(Vec,PetscInt*,const Vec**); PETSC_EXTERN PetscErrorCode VecCompSetSubVecs(Vec,PetscInt,Vec*); /* Vecs with contiguous array storage */ PETSC_EXTERN PetscErrorCode SlepcVecSetTemplate(Vec); PETSC_EXTERN PetscErrorCode SlepcMatGetVecsTemplate(Mat,Vec*,Vec*); /* Vec-related operations that have two versions, for contiguous and regular Vecs */ PETSC_EXTERN PetscErrorCode SlepcUpdateVectors(PetscInt,Vec*,PetscInt,PetscInt,const PetscScalar*,PetscInt,PetscBool); PETSC_EXTERN PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans); PETSC_EXTERN PetscErrorCode SlepcVecMAXPBY(Vec,PetscScalar,PetscScalar,PetscInt,PetscScalar*,Vec*); /* Miscellaneous functions related to Vec */ PETSC_EXTERN PetscErrorCode SlepcVecSetRandom(Vec,PetscRandom); PETSC_EXTERN PetscErrorCode SlepcVecNormalize(Vec,Vec,PetscBool,PetscReal*); #endif slepc-3.4.2.dfsg.orig/include/slepcmath.h.html0000644000175000017500000001677612211062077020173 0ustar gladkgladk
Actual source code: slepcmath.h

  1: /*
  2:    SLEPc mathematics include file. Defines basic operations and functions.
  3:    This file is included by slepcsys.h and should not be used directly.

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

  9:    This file is part of SLEPc.

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

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

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


 28: /*
 29:     Default tolerance for the different solvers, depending on the precision
 30: */
 31: #if defined(PETSC_USE_REAL_SINGLE)
 32: #  define SLEPC_DEFAULT_TOL   1e-6
 33: #elif defined(PETSC_USE_REAL_DOUBLE)
 34: #  define SLEPC_DEFAULT_TOL   1e-8
 35: #elif defined(PETSC_USE_REAL___FLOAT128)
 36: #  define SLEPC_DEFAULT_TOL   1e-16
 37: #else
 38: #  define SLEPC_DEFAULT_TOL   1e-7
 39: #endif

 41: /*E
 42:     SlepcFunction - Used to specify a mathematical function

 44:     Note:
 45:     Currently available functions:
 46: .   SLEPC_FUNCTION_EXP - exponential

 48:     Level: beginner
 49: E*/
 50: typedef enum { SLEPC_FUNCTION_NONE=0,
 51:                SLEPC_FUNCTION_EXP,
 52:                SLEPC_FUNCTION_LAST } SlepcFunction;

 54: /*@C
 55:    SlepcAbs - Returns sqrt(x**2+y**2), taking care not to cause unnecessary
 56:    overflow. It is based on LAPACK's DLAPY2.

 58:    Not Collective

 60:    Input parameters:
 61: .  x,y - the real numbers

 63:    Output parameter:
 64: .  return - the result

 66:    Note:
 67:    This function is not available from Fortran.

 69:    Level: developer
 70: @*/
 71: PETSC_STATIC_INLINE PetscReal SlepcAbs(PetscReal x,PetscReal y)
 72: {
 73:   PetscReal w,z,t,xabs=PetscAbs(x),yabs=PetscAbs(y);

 75:   w = PetscMax(xabs,yabs);
 76:   z = PetscMin(xabs,yabs);
 77:   if (z == 0.0) return w;
 78:   t = z/w;
 79:   return w*PetscSqrtReal(1.0+t*t);
 80: }

 82: /*MC
 83:    SlepcAbsEigenvalue - Returns the absolute value of a complex number given
 84:    its real and imaginary parts.

 86:    Synopsis:
 87:    PetscReal SlepcAbsEigenvalue(PetscScalar x,PetscScalar y)

 89:    Not Collective

 91:    Input parameters:
 92: +  x  - the real part of the complex number
 93: -  y  - the imaginary part of the complex number

 95:    Notes:
 96:    This function computes sqrt(x**2+y**2), taking care not to cause unnecessary
 97:    overflow. It is based on LAPACK's DLAPY2.

 99:    This function is not available from Fortran.

101:    Level: developer
102: M*/
103: #if !defined(PETSC_USE_COMPLEX)
104: #define SlepcAbsEigenvalue(x,y) SlepcAbs(x,y)
105: #else
106: #define SlepcAbsEigenvalue(x,y) PetscAbsScalar(x)
107: #endif

109: #endif

slepc-3.4.2.dfsg.orig/include/makefile.html0000644000175000017500000000407012211062077017522 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#     
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS   =
FFLAGS   =
SOURCEC  =
SOURCEF  =
SOURCEH  = slepc.h slepcsys.h slepcmath.h slepcversion.h slepcblaslapack.h \
           slepceps.h slepcqep.h slepcnep.h slepcmfn.h slepcsvd.h \
           slepcst.h slepcip.h slepcds.h slepcfn.h slepcvec.h
LIBBASE  = libslepc
DIRS     = finclude slepc-private
LOCDIR   = include/
MANSEC   = 

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/include/slepc.h.html0000644000175000017500000000562012211062077017303 0ustar gladkgladk
Actual source code: slepc.h

  1: /*
  2:    This is the main SLEPc include file (for C and C++).  It is included
  3:    by all other SLEPc include files, so it almost never has to be
  4:    specifically included.

  6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  8:    Copyright (c) 2002-2013, 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: /*
 27:    Include all top-level SLEPc functionality
 28: */
 29: #include <slepcsvd.h>
 30: #include <slepcqep.h>
 31: #include <slepcnep.h>
 32: #include <slepcmfn.h>

slepc-3.4.2.dfsg.orig/include/index.html0000644000175000017500000000167312211062077017062 0ustar gladkgladk Generic SLEPc Manual Pages

finclude/
slepc-private/
slepc.h
slepcsys.h
slepcmath.h
slepcversion.h
slepcblaslapack.h
slepceps.h
slepcqep.h
slepcnep.h
slepcmfn.h
slepcsvd.h
slepcst.h
slepcip.h
slepcds.h
slepcfn.h
slepcvec.h
makefile
slepc-3.4.2.dfsg.orig/include/slepcmath.h0000644000175000017500000000572112211062077017214 0ustar gladkgladk/* SLEPc mathematics include file. Defines basic operations and functions. This file is included by slepcsys.h and should not be used directly. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCMATH_H) #define __SLEPCMATH_H /* Default tolerance for the different solvers, depending on the precision */ #if defined(PETSC_USE_REAL_SINGLE) # define SLEPC_DEFAULT_TOL 1e-6 #elif defined(PETSC_USE_REAL_DOUBLE) # define SLEPC_DEFAULT_TOL 1e-8 #elif defined(PETSC_USE_REAL___FLOAT128) # define SLEPC_DEFAULT_TOL 1e-16 #else # define SLEPC_DEFAULT_TOL 1e-7 #endif /*E SlepcFunction - Used to specify a mathematical function Note: Currently available functions: . SLEPC_FUNCTION_EXP - exponential Level: beginner E*/ typedef enum { SLEPC_FUNCTION_NONE=0, SLEPC_FUNCTION_EXP, SLEPC_FUNCTION_LAST } SlepcFunction; /*@C SlepcAbs - Returns sqrt(x**2+y**2), taking care not to cause unnecessary overflow. It is based on LAPACK's DLAPY2. Not Collective Input parameters: . x,y - the real numbers Output parameter: . return - the result Note: This function is not available from Fortran. Level: developer @*/ PETSC_STATIC_INLINE PetscReal SlepcAbs(PetscReal x,PetscReal y) { PetscReal w,z,t,xabs=PetscAbs(x),yabs=PetscAbs(y); w = PetscMax(xabs,yabs); z = PetscMin(xabs,yabs); if (z == 0.0) return w; t = z/w; return w*PetscSqrtReal(1.0+t*t); } /*MC SlepcAbsEigenvalue - Returns the absolute value of a complex number given its real and imaginary parts. Synopsis: PetscReal SlepcAbsEigenvalue(PetscScalar x,PetscScalar y) Not Collective Input parameters: + x - the real part of the complex number - y - the imaginary part of the complex number Notes: This function computes sqrt(x**2+y**2), taking care not to cause unnecessary overflow. It is based on LAPACK's DLAPY2. This function is not available from Fortran. Level: developer M*/ #if !defined(PETSC_USE_COMPLEX) #define SlepcAbsEigenvalue(x,y) SlepcAbs(x,y) #else #define SlepcAbsEigenvalue(x,y) PetscAbsScalar(x) #endif #endif slepc-3.4.2.dfsg.orig/include/slepcmfn.h.html0000644000175000017500000003732712211062077020015 0ustar gladkgladk

Actual source code: slepcmfn.h

  1: /*
  2:    User interface for the SLEPC matrix function object.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepcip.h>
 27: #include <slepcds.h>

 29: PETSC_EXTERN PetscErrorCode MFNInitializePackage(void);

 31: /*S
 32:     MFN - SLEPc object that encapsulates functionality for matrix functions.

 34:     Level: beginner

 36: .seealso:  MFNCreate()
 37: S*/
 38: typedef struct _p_MFN* MFN;

 40: /*J
 41:     MFNType - String with the name of a method for computing matrix functions.

 43:     Level: beginner

 45: .seealso: MFNSetType(), MFN
 46: J*/
 47: typedef const char* MFNType;
 48: #define MFNKRYLOV   "krylov"

 50: /* Logging support */
 51: PETSC_EXTERN PetscClassId MFN_CLASSID;

 53: PETSC_EXTERN PetscErrorCode MFNCreate(MPI_Comm,MFN *);
 54: PETSC_EXTERN PetscErrorCode MFNDestroy(MFN*);
 55: PETSC_EXTERN PetscErrorCode MFNReset(MFN);
 56: PETSC_EXTERN PetscErrorCode MFNSetType(MFN,MFNType);
 57: PETSC_EXTERN PetscErrorCode MFNGetType(MFN,MFNType*);
 58: PETSC_EXTERN PetscErrorCode MFNSetFunction(MFN,SlepcFunction);
 59: PETSC_EXTERN PetscErrorCode MFNGetFunction(MFN,SlepcFunction*);
 60: PETSC_EXTERN PetscErrorCode MFNSetOperator(MFN,Mat);
 61: PETSC_EXTERN PetscErrorCode MFNGetOperator(MFN,Mat*);
 62: PETSC_EXTERN PetscErrorCode MFNSetFromOptions(MFN);
 63: PETSC_EXTERN PetscErrorCode MFNSetUp(MFN);
 64: PETSC_EXTERN PetscErrorCode MFNSolve(MFN,Vec,Vec);
 65: PETSC_EXTERN PetscErrorCode MFNView(MFN,PetscViewer);

 67: PETSC_EXTERN PetscErrorCode MFNSetIP(MFN,IP);
 68: PETSC_EXTERN PetscErrorCode MFNGetIP(MFN,IP*);
 69: PETSC_EXTERN PetscErrorCode MFNSetDS(MFN,DS);
 70: PETSC_EXTERN PetscErrorCode MFNGetDS(MFN,DS*);
 71: PETSC_EXTERN PetscErrorCode MFNSetTolerances(MFN,PetscReal,PetscInt);
 72: PETSC_EXTERN PetscErrorCode MFNGetTolerances(MFN,PetscReal*,PetscInt*);
 73: PETSC_EXTERN PetscErrorCode MFNSetDimensions(MFN,PetscInt);
 74: PETSC_EXTERN PetscErrorCode MFNGetDimensions(MFN,PetscInt*);
 75: PETSC_EXTERN PetscErrorCode MFNSetScaleFactor(MFN,PetscScalar);
 76: PETSC_EXTERN PetscErrorCode MFNGetScaleFactor(MFN,PetscScalar*);

 78: PETSC_EXTERN PetscErrorCode MFNMonitor(MFN,PetscInt,PetscReal);
 79: PETSC_EXTERN PetscErrorCode MFNMonitorSet(MFN,PetscErrorCode (*)(MFN,PetscInt,PetscReal,void*),void*,PetscErrorCode (*)(void**));
 80: PETSC_EXTERN PetscErrorCode MFNMonitorCancel(MFN);
 81: PETSC_EXTERN PetscErrorCode MFNGetMonitorContext(MFN,void **);
 82: PETSC_EXTERN PetscErrorCode MFNGetIterationNumber(MFN,PetscInt*);

 84: PETSC_EXTERN PetscErrorCode MFNSetErrorIfNotConverged(MFN,PetscBool);
 85: PETSC_EXTERN PetscErrorCode MFNGetErrorIfNotConverged(MFN,PetscBool*);

 87: PETSC_EXTERN PetscErrorCode MFNMonitorDefault(MFN,PetscInt,PetscReal,void*);
 88: PETSC_EXTERN PetscErrorCode MFNMonitorLG(MFN,PetscInt,PetscReal,void*);

 90: PETSC_EXTERN PetscErrorCode MFNSetOptionsPrefix(MFN,const char*);
 91: PETSC_EXTERN PetscErrorCode MFNAppendOptionsPrefix(MFN,const char*);
 92: PETSC_EXTERN PetscErrorCode MFNGetOptionsPrefix(MFN,const char*[]);

 94: /*E
 95:     MFNConvergedReason - reason a matrix function iteration was said to
 96:          have converged or diverged

 98:     Level: beginner

100: .seealso: MFNSolve(), MFNGetConvergedReason(), MFNSetTolerances()
101: E*/
102: typedef enum {/* converged */
103:               MFN_CONVERGED_TOL                =  2,
104:               /* diverged */
105:               MFN_DIVERGED_ITS                 = -3,
106:               MFN_DIVERGED_BREAKDOWN           = -4,
107:               MFN_CONVERGED_ITERATING          =  0} MFNConvergedReason;

109: PETSC_EXTERN PetscErrorCode MFNGetConvergedReason(MFN,MFNConvergedReason *);

111: PETSC_EXTERN PetscFunctionList MFNList;
112: PETSC_EXTERN PetscBool         MFNRegisterAllCalled;
113: PETSC_EXTERN PetscErrorCode MFNRegisterAll(void);
114: PETSC_EXTERN PetscErrorCode MFNRegister(const char[],PetscErrorCode(*)(MFN));

116: #endif

slepc-3.4.2.dfsg.orig/include/slepcfn.h0000644000175000017500000000477612211062077016677 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCFN_H) #define __SLEPCFN_H #include PETSC_EXTERN PetscErrorCode FNInitializePackage(void); /*S FN - Abstraction of a mathematical function. Level: beginner .seealso: FNCreate() S*/ typedef struct _p_FN* FN; /*J FNType - String with the name of the mathematical function. Level: beginner .seealso: FNSetType(), FN J*/ typedef const char* FNType; #define FNRATIONAL "rational" #define FNEXP "exp" #define FNLOG "log" #define FNPHI "phi" /* Logging support */ PETSC_EXTERN PetscClassId FN_CLASSID; PETSC_EXTERN PetscErrorCode FNCreate(MPI_Comm,FN*); PETSC_EXTERN PetscErrorCode FNSetType(FN,FNType); PETSC_EXTERN PetscErrorCode FNGetType(FN,FNType*); PETSC_EXTERN PetscErrorCode FNSetOptionsPrefix(FN,const char *); PETSC_EXTERN PetscErrorCode FNAppendOptionsPrefix(FN,const char *); PETSC_EXTERN PetscErrorCode FNGetOptionsPrefix(FN,const char *[]); PETSC_EXTERN PetscErrorCode FNSetFromOptions(FN); PETSC_EXTERN PetscErrorCode FNView(FN,PetscViewer); PETSC_EXTERN PetscErrorCode FNDestroy(FN*); PETSC_EXTERN PetscErrorCode FNSetParameters(FN,PetscInt,PetscScalar*,PetscInt,PetscScalar*); PETSC_EXTERN PetscErrorCode FNGetParameters(FN,PetscInt*,PetscScalar**,PetscInt*,PetscScalar**); PETSC_EXTERN PetscErrorCode FNEvaluateFunction(FN,PetscScalar,PetscScalar*); PETSC_EXTERN PetscErrorCode FNEvaluateDerivative(FN,PetscScalar,PetscScalar*); PETSC_EXTERN PetscFunctionList FNList; PETSC_EXTERN PetscBool FNRegisterAllCalled; PETSC_EXTERN PetscErrorCode FNRegisterAll(void); PETSC_EXTERN PetscErrorCode FNRegister(const char[],PetscErrorCode(*)(FN)); #endif slepc-3.4.2.dfsg.orig/include/slepcversion.h.html0000644000175000017500000001022212211062077020703 0ustar gladkgladk
Actual source code: slepcversion.h

4: #define SLEPC_VERSION_RELEASE 1 5: #define SLEPC_VERSION_MAJOR 3 6: #define SLEPC_VERSION_MINOR 4 7: #define SLEPC_VERSION_SUBMINOR 2 8: #define SLEPC_VERSION_PATCH 0 9: #define SLEPC_RELEASE_DATE "July 5, 2013" 10: #define SLEPC_VERSION_DATE "unknown" 12: #if !defined (SLEPC_VERSION_GIT) 13: #define SLEPC_VERSION_GIT "unknown" 14: #endif 16: #if !defined(SLEPC_VERSION_DATE_GIT) 17: #define SLEPC_VERSION_DATE_GIT "unknown" 18: #endif 20: #define SLEPC_VERSION_(MAJOR,MINOR,SUBMINOR) \ 21: ((SLEPC_VERSION_MAJOR == (MAJOR)) && \ 22: (SLEPC_VERSION_MINOR == (MINOR)) && \ 23: (SLEPC_VERSION_SUBMINOR == (SUBMINOR)) && \ 24: (SLEPC_VERSION_RELEASE == 1)) 26: #define SLEPC_VERSION_LT(MAJOR,MINOR,SUBMINOR) \ 27: (SLEPC_VERSION_RELEASE == 1 && \ 28: (SLEPC_VERSION_MAJOR < (MAJOR) || \ 29: (SLEPC_VERSION_MAJOR == (MAJOR) && \ 30: (SLEPC_VERSION_MINOR < (MINOR) || \ 31: (SLEPC_VERSION_MINOR == (MINOR) && \ 32: (SLEPC_VERSION_SUBMINOR < (SUBMINOR))))))) 34: #define SLEPC_VERSION_LE(MAJOR,MINOR,SUBMINOR) \ 35: (SLEPC_VERSION_LT(MAJOR,MINOR,SUBMINOR) || \ 36: SLEPC_VERSION_(MAJOR,MINOR,SUBMINOR)) 38: #define SLEPC_VERSION_GT(MAJOR,MINOR,SUBMINOR) \ 39: (!SLEPC_VERSION_LE(MAJOR,MINOR,SUBMINOR)) 41: #define SLEPC_VERSION_GE(MAJOR,MINOR,SUBMINOR) \ 42: (!SLEPC_VERSION_LT(MAJOR,MINOR,SUBMINOR)) 44: #endif slepc-3.4.2.dfsg.orig/include/slepcip.h0000644000175000017500000001171312211062077016671 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCIP_H) #define __SLEPCIP_H #include PETSC_EXTERN PetscErrorCode IPInitializePackage(void); /*S IP - Abstraction of a vector inner product, that can be defined in different ways. Using this object is not required for application programmers. Level: beginner .seealso: IPCreate() S*/ typedef struct _p_IP* IP; /*J IPType - String with the name of the inner product. For complex scalars, it is possible to choose between a sesquilinear form (x,y)=x^H*M*y (the default) or a bilinear form (x,y)=x^T*M*y (without complex conjugation). In the case of real scalars, only the bilinear form (x,y)=x^T*M*y is available. Apart form these, there is also an indefinite inner product, defined by and indefinite matrix M. Level: advanced .seealso: IPSetType(), IP J*/ typedef const char* IPType; #define IPBILINEAR "bilinear" #define IPSESQUILINEAR "sesquilinear" #define IPINDEFINITE "indefinite" /* Logging support */ PETSC_EXTERN PetscClassId IP_CLASSID; /*E IPOrthogType - Determines what type of orthogonalization to use Level: advanced .seealso: IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize() E*/ typedef enum { IP_ORTHOG_MGS, IP_ORTHOG_CGS } IPOrthogType; /*E IPOrthogRefineType - Determines what type of refinement to use during orthogonalization Level: advanced .seealso: IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize() E*/ typedef enum { IP_ORTHOG_REFINE_NEVER, IP_ORTHOG_REFINE_IFNEEDED, IP_ORTHOG_REFINE_ALWAYS } IPOrthogRefineType; PETSC_EXTERN PetscErrorCode IPCreate(MPI_Comm,IP*); PETSC_EXTERN PetscErrorCode IPSetType(IP,IPType); PETSC_EXTERN PetscErrorCode IPGetType(IP,IPType*); PETSC_EXTERN PetscErrorCode IPSetOptionsPrefix(IP,const char *); PETSC_EXTERN PetscErrorCode IPAppendOptionsPrefix(IP,const char *); PETSC_EXTERN PetscErrorCode IPGetOptionsPrefix(IP,const char *[]); PETSC_EXTERN PetscErrorCode IPSetFromOptions(IP); PETSC_EXTERN PetscErrorCode IPSetOrthogonalization(IP,IPOrthogType,IPOrthogRefineType,PetscReal); PETSC_EXTERN PetscErrorCode IPGetOrthogonalization(IP,IPOrthogType*,IPOrthogRefineType*,PetscReal*); PETSC_EXTERN PetscErrorCode IPView(IP,PetscViewer); PETSC_EXTERN PetscErrorCode IPDestroy(IP*); PETSC_EXTERN PetscErrorCode IPReset(IP); PETSC_EXTERN PetscErrorCode IPOrthogonalize(IP,PetscInt,Vec*,PetscInt,PetscBool*,Vec*,Vec,PetscScalar*,PetscReal*,PetscBool*); PETSC_EXTERN PetscErrorCode IPBOrthogonalize(IP,PetscInt,Vec*,Vec*,PetscReal*,PetscInt,PetscBool*,Vec*,Vec*,PetscReal*,Vec,Vec,PetscScalar*,PetscReal*,PetscBool*); PETSC_EXTERN PetscErrorCode IPBiOrthogonalize(IP,PetscInt,Vec*,Vec*,Vec,PetscScalar*,PetscReal*); PETSC_EXTERN PetscErrorCode IPPseudoOrthogonalize(IP,PetscInt,Vec*,PetscReal*,Vec,PetscScalar*,PetscReal*,PetscBool*); PETSC_EXTERN PetscErrorCode IPQRDecomposition(IP,Vec*,PetscInt,PetscInt,PetscScalar*,PetscInt); PETSC_EXTERN PetscErrorCode IPSetMatrix(IP,Mat); PETSC_EXTERN PetscErrorCode IPGetMatrix(IP,Mat*); PETSC_EXTERN PetscErrorCode IPApplyMatrix(IP,Vec,Vec); PETSC_EXTERN PetscErrorCode IPInnerProduct(IP,Vec,Vec,PetscScalar*); PETSC_EXTERN PetscErrorCode IPInnerProductBegin(IP,Vec,Vec,PetscScalar*); PETSC_EXTERN PetscErrorCode IPInnerProductEnd(IP,Vec,Vec,PetscScalar*); PETSC_EXTERN PetscErrorCode IPMInnerProduct(IP,Vec,PetscInt,const Vec[],PetscScalar*); PETSC_EXTERN PetscErrorCode IPMInnerProductBegin(IP,Vec,PetscInt,const Vec[],PetscScalar*); PETSC_EXTERN PetscErrorCode IPMInnerProductEnd(IP,Vec,PetscInt,const Vec[],PetscScalar*); PETSC_EXTERN PetscErrorCode IPNorm(IP,Vec,PetscReal*); PETSC_EXTERN PetscErrorCode IPNormBegin(IP,Vec,PetscReal*); PETSC_EXTERN PetscErrorCode IPNormEnd(IP,Vec,PetscReal*); PETSC_EXTERN PetscFunctionList IPList; PETSC_EXTERN PetscBool IPRegisterAllCalled; PETSC_EXTERN PetscErrorCode IPRegisterAll(void); PETSC_EXTERN PetscErrorCode IPRegister(const char[],PetscErrorCode(*)(IP)); PETSC_EXTERN PetscErrorCode IPGetOperationCounters(IP,PetscInt*); PETSC_EXTERN PetscErrorCode IPResetOperationCounters(IP); #endif slepc-3.4.2.dfsg.orig/include/slepcds.h.html0000644000175000017500000005703012211062077017634 0ustar gladkgladk
Actual source code: slepcds.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 24: #include <slepcfn.h>

 26: #define DS_MAX_SOLVE 6
 27: #define DS_MAX_FUN   6

 29: PETSC_EXTERN PetscErrorCode DSInitializePackage(void);
 30: /*S
 31:     DS - Direct solver (or dense system), to represent low-dimensional
 32:     eigenproblems that must be solved within iterative solvers. This is an
 33:     auxiliary object and is not normally needed by application programmers.

 35:     Level: beginner

 37: .seealso:  DSCreate()
 38: S*/
 39: typedef struct _p_DS* DS;

 41: /*J
 42:     DSType - String with the name of the type of direct solver. Roughly,
 43:     there are as many types as problem types are available within SLEPc.

 45:     Level: advanced

 47: .seealso: DSSetType(), DS
 48: J*/
 49: typedef const char* DSType;
 50: #define DSHEP             "hep"
 51: #define DSNHEP            "nhep"
 52: #define DSGHEP            "ghep"
 53: #define DSGHIEP           "ghiep"
 54: #define DSGNHEP           "gnhep"
 55: #define DSSVD             "svd"
 56: #define DSQEP             "qep"
 57: #define DSNEP             "nep"

 59: /* Logging support */
 60: PETSC_EXTERN PetscClassId DS_CLASSID;

 62: /*E
 63:     DSStateType - Indicates in which state the direct solver is

 65:     Level: advanced

 67: .seealso: DSSetState()
 68: E*/
 69: typedef enum { DS_STATE_RAW,
 70:                DS_STATE_INTERMEDIATE,
 71:                DS_STATE_CONDENSED,
 72:                DS_STATE_TRUNCATED } DSStateType;

 74: /*E
 75:     DSMatType - Used to refer to one of the matrices stored internally in DS

 77:     Notes:
 78:     The matrices preferently refer to
 79: +   DS_MAT_A  - first matrix of eigenproblem/singular value problem
 80: .   DS_MAT_B  - second matrix of a generalized eigenproblem
 81: .   DS_MAT_C  - third matrix of a quadratic eigenproblem
 82: .   DS_MAT_T  - tridiagonal matrix
 83: .   DS_MAT_D  - diagonal matrix
 84: .   DS_MAT_F  - result of matrix function
 85: .   DS_MAT_Q  - orthogonal matrix of (right) Schur vectors
 86: .   DS_MAT_Z  - orthogonal matrix of left Schur vectors
 87: .   DS_MAT_X  - right eigenvectors
 88: .   DS_MAT_Y  - left eigenvectors
 89: .   DS_MAT_U  - left singular vectors
 90: .   DS_MAT_VT - right singular vectors
 91: .   DS_MAT_W  - workspace matrix
 92: -   DS_MAT_Ex - extra matrices (x=0,..,9)

 94:     All matrices can have space to hold ld x ld elements, except for
 95:     DS_MAT_T that has space for 3 x ld elements (ld = leading dimension)
 96:     and DS_MAT_D that has space for just ld elements.

 98:     Level: advanced

100: .seealso: DSAllocate(), DSGetArray(), DSGetArrayReal(), DSVectors()
101: E*/
102: typedef enum { DS_MAT_A,
103:                DS_MAT_B,
104:                DS_MAT_C,
105:                DS_MAT_T,
106:                DS_MAT_D,
107:                DS_MAT_F,
108:                DS_MAT_Q,
109:                DS_MAT_Z,
110:                DS_MAT_X,
111:                DS_MAT_Y,
112:                DS_MAT_U,
113:                DS_MAT_VT,
114:                DS_MAT_W,
115:                DS_MAT_E0,
116:                DS_MAT_E1,
117:                DS_MAT_E2,
118:                DS_MAT_E3,
119:                DS_MAT_E4,
120:                DS_MAT_E5,
121:                DS_MAT_E6,
122:                DS_MAT_E7,
123:                DS_MAT_E8,
124:                DS_MAT_E9,
125:                DS_NUM_MAT } DSMatType;

127: /* Convenience for indexing extra matrices */
128: PETSC_EXTERN DSMatType DSMatExtra[];
129: #define DS_NUM_EXTRA  10

131: PETSC_EXTERN PetscErrorCode DSCreate(MPI_Comm,DS*);
132: PETSC_EXTERN PetscErrorCode DSSetType(DS,DSType);
133: PETSC_EXTERN PetscErrorCode DSGetType(DS,DSType*);
134: PETSC_EXTERN PetscErrorCode DSSetOptionsPrefix(DS,const char *);
135: PETSC_EXTERN PetscErrorCode DSAppendOptionsPrefix(DS,const char *);
136: PETSC_EXTERN PetscErrorCode DSGetOptionsPrefix(DS,const char *[]);
137: PETSC_EXTERN PetscErrorCode DSSetFromOptions(DS);
138: PETSC_EXTERN PetscErrorCode DSView(DS,PetscViewer);
139: PETSC_EXTERN PetscErrorCode DSDestroy(DS*);
140: PETSC_EXTERN PetscErrorCode DSReset(DS);

142: PETSC_EXTERN PetscErrorCode DSAllocate(DS,PetscInt);
143: PETSC_EXTERN PetscErrorCode DSGetLeadingDimension(DS,PetscInt*);
144: PETSC_EXTERN PetscErrorCode DSSetState(DS,DSStateType);
145: PETSC_EXTERN PetscErrorCode DSGetState(DS,DSStateType*);
146: PETSC_EXTERN PetscErrorCode DSSetDimensions(DS,PetscInt,PetscInt,PetscInt,PetscInt);
147: PETSC_EXTERN PetscErrorCode DSGetDimensions(DS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
148: PETSC_EXTERN PetscErrorCode DSTruncate(DS,PetscInt);
149: PETSC_EXTERN PetscErrorCode DSSetMethod(DS,PetscInt);
150: PETSC_EXTERN PetscErrorCode DSGetMethod(DS,PetscInt*);
151: PETSC_EXTERN PetscErrorCode DSSetFunctionMethod(DS,PetscInt);
152: PETSC_EXTERN PetscErrorCode DSGetFunctionMethod(DS,PetscInt*);
153: PETSC_EXTERN PetscErrorCode DSSetCompact(DS,PetscBool);
154: PETSC_EXTERN PetscErrorCode DSGetCompact(DS,PetscBool*);
155: PETSC_EXTERN PetscErrorCode DSSetExtraRow(DS,PetscBool);
156: PETSC_EXTERN PetscErrorCode DSGetExtraRow(DS,PetscBool*);
157: PETSC_EXTERN PetscErrorCode DSSetRefined(DS,PetscBool);
158: PETSC_EXTERN PetscErrorCode DSGetRefined(DS,PetscBool*);
159: PETSC_EXTERN PetscErrorCode DSGetArray(DS,DSMatType,PetscScalar *a[]);
160: PETSC_EXTERN PetscErrorCode DSRestoreArray(DS,DSMatType,PetscScalar *a[]);
161: PETSC_EXTERN PetscErrorCode DSGetArrayReal(DS,DSMatType,PetscReal *a[]);
162: PETSC_EXTERN PetscErrorCode DSRestoreArrayReal(DS,DSMatType,PetscReal *a[]);
163: PETSC_EXTERN PetscErrorCode DSVectors(DS,DSMatType,PetscInt*,PetscReal*);
164: PETSC_EXTERN PetscErrorCode DSSolve(DS,PetscScalar*,PetscScalar*);
165: PETSC_EXTERN PetscErrorCode DSSort(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*);
166: PETSC_EXTERN PetscErrorCode DSComputeFunction(DS,SlepcFunction);
167: PETSC_EXTERN PetscErrorCode DSSetEigenvalueComparison(DS,PetscErrorCode (*)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);
168: PETSC_EXTERN PetscErrorCode DSGetEigenvalueComparison(DS,PetscErrorCode (**)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void**);
169: PETSC_EXTERN PetscErrorCode DSUpdateExtraRow(DS);
170: PETSC_EXTERN PetscErrorCode DSCond(DS,PetscReal*);
171: PETSC_EXTERN PetscErrorCode DSTranslateHarmonic(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*);
172: PETSC_EXTERN PetscErrorCode DSTranslateRKS(DS,PetscScalar);
173: PETSC_EXTERN PetscErrorCode DSNormalize(DS,DSMatType,PetscInt);

175: PETSC_EXTERN PetscErrorCode DSSetFN(DS,PetscInt,FN*);
176: PETSC_EXTERN PetscErrorCode DSGetFN(DS,PetscInt,FN*);
177: PETSC_EXTERN PetscErrorCode DSGetNumFN(DS,PetscInt*);

179: PETSC_EXTERN PetscFunctionList DSList;
180: PETSC_EXTERN PetscBool         DSRegisterAllCalled;
181: PETSC_EXTERN PetscErrorCode DSRegisterAll(void);
182: PETSC_EXTERN PetscErrorCode DSRegister(const char[],PetscErrorCode(*)(DS));

184: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/0000755000175000017500000000000012214143515017634 5ustar gladkgladkslepc-3.4.2.dfsg.orig/include/slepc-private/fnimpl.h.html0000644000175000017500000000710112211062077022234 0ustar gladkgladk
Actual source code: fnimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_FNIMPL)
 23: #define _FNIMPL

 25: #include <slepcfn.h>
 26: #include <slepc-private/slepcimpl.h>

 28: typedef struct _FNOps *FNOps;

 30: struct _FNOps {
 31:   PetscErrorCode (*evaluatefunction)(FN,PetscScalar,PetscScalar*);
 32:   PetscErrorCode (*evaluatederivative)(FN,PetscScalar,PetscScalar*);
 33:   PetscErrorCode (*view)(FN,PetscViewer);
 34: };

 36: struct _p_FN {
 37:   PETSCHEADER(struct _FNOps);
 38:   PetscInt    na;
 39:   PetscScalar *alpha;   /* first group of parameters */
 40:   PetscInt    nb;
 41:   PetscScalar *beta;    /* second group of parameters */
 42: };

 44: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/svdimpl.h.html0000644000175000017500000002253312211062077022433 0ustar gladkgladk
Actual source code: svdimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_SVDIMPL)
 23: #define _SVDIMPL

 25: #include <slepcsvd.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent SVD_SetUp,SVD_Solve;

 30: typedef struct _SVDOps *SVDOps;

 32: struct _SVDOps {
 33:   PetscErrorCode (*solve)(SVD);
 34:   PetscErrorCode (*setup)(SVD);
 35:   PetscErrorCode (*setfromoptions)(SVD);
 36:   PetscErrorCode (*publishoptions)(SVD);
 37:   PetscErrorCode (*destroy)(SVD);
 38:   PetscErrorCode (*reset)(SVD);
 39:   PetscErrorCode (*view)(SVD,PetscViewer);
 40: };

 42: /*
 43:      Maximum number of monitors you can run with a single SVD
 44: */
 45: #define MAXSVDMONITORS 5

 47: /*
 48:    Defines the SVD data structure.
 49: */
 50: struct _p_SVD {
 51:   PETSCHEADER(struct _SVDOps);
 52:   Mat              OP;          /* problem matrix */
 53:   Mat              A;           /* problem matrix (m>n) */
 54:   Mat              AT;          /* transposed matrix */
 55:   SVDTransposeMode transmode;   /* transpose mode */
 56:   PetscReal        *sigma;      /* singular values */
 57:   PetscInt         *perm;       /* permutation for singular value ordering */
 58:   Vec              *U,*V;       /* left and right singular vectors */
 59:   Vec              *IS,*ISL;    /* placeholder for references to user-provided initial space */
 60:   PetscInt         n;           /* maximun size of descomposition */
 61:   SVDWhich         which;       /* which singular values are computed */
 62:   PetscInt         nconv;       /* number of converged values */
 63:   PetscInt         nsv;         /* number of requested values */
 64:   PetscInt         ncv;         /* basis size */
 65:   PetscInt         mpd;         /* maximum dimension of projected problem */
 66:   PetscInt         nini,ninil;  /* number of initial vectors (negative means not copied yet) */
 67:   PetscInt         its;         /* iteration counter */
 68:   PetscInt         max_it;      /* max iterations */
 69:   PetscReal        tol;         /* tolerance */
 70:   PetscReal        *errest;     /* error estimates */
 71:   PetscRandom      rand;        /* random number generator */
 72:   Vec              tl,tr;       /* template vectors */
 73:   void             *data;       /* placeholder for misc stuff associated
 74:                                    with a particular solver */
 75:   PetscInt         setupcalled;
 76:   SVDConvergedReason reason;
 77:   IP               ip;          /* innerproduct object */
 78:   DS               ds;          /* direct solver object */
 79:   PetscBool        trackall;
 80:   PetscInt         matvecs;

 82:   PetscErrorCode   (*monitor[MAXSVDMONITORS])(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
 83:   PetscErrorCode   (*monitordestroy[MAXSVDMONITORS])(void**);
 84:   void             *monitorcontext[MAXSVDMONITORS];
 85:   PetscInt         numbermonitors;
 86: };

 88: PETSC_INTERN PetscErrorCode SVDMatMult(SVD,PetscBool,Vec,Vec);
 89: PETSC_INTERN PetscErrorCode SVDMatGetVecs(SVD,Vec*,Vec*);
 90: PETSC_INTERN PetscErrorCode SVDMatGetSize(SVD,PetscInt*,PetscInt*);
 91: PETSC_INTERN PetscErrorCode SVDMatGetLocalSize(SVD,PetscInt*,PetscInt*);
 92: PETSC_INTERN PetscErrorCode SVDTwoSideLanczos(SVD,PetscReal*,PetscReal*,Vec*,Vec,Vec*,PetscInt,PetscInt,PetscScalar*);

 94: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/qepimpl.h0000644000175000017500000001245012211062077021456 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_QEPIMPL) #define _QEPIMPL #include #include PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense; typedef struct _QEPOps *QEPOps; struct _QEPOps { PetscErrorCode (*solve)(QEP); PetscErrorCode (*setup)(QEP); PetscErrorCode (*setfromoptions)(QEP); PetscErrorCode (*publishoptions)(QEP); PetscErrorCode (*destroy)(QEP); PetscErrorCode (*reset)(QEP); PetscErrorCode (*view)(QEP,PetscViewer); }; /* Maximum number of monitors you can run with a single QEP */ #define MAXQEPMONITORS 5 /* Defines the QEP data structure. */ struct _p_QEP { PETSCHEADER(struct _QEPOps); /*------------------------- User parameters --------------------------*/ PetscInt max_it; /* maximum number of iterations */ PetscInt nev; /* number of eigenvalues to compute */ PetscInt ncv; /* number of basis vectors */ PetscInt mpd; /* maximum dimension of projected problem */ PetscInt nini,ninil; /* number of initial vectors (negative means not copied yet) */ PetscScalar target; /* target value */ PetscReal tol; /* tolerance */ PetscReal sfactor; /* scaling factor of the quadratic problem */ PetscBool sfactor_set; /* flag to indicate the user gave sfactor */ QEPWhich which; /* which part of the spectrum to be sought */ PetscBool leftvecs; /* if left eigenvectors are requested */ QEPProblemType problem_type; /* which kind of problem to be solved */ PetscBool trackall; /* whether all the residuals must be computed */ /*-------------- User-provided functions and contexts -----------------*/ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PetscErrorCode (*converged)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); void *comparisonctx; void *convergedctx; /*------------------------- Working data --------------------------*/ Mat M,C,K; /* problem matrices */ Vec *V; /* set of basis vectors and computed eigenvectors */ Vec *W; /* set of left basis vectors and computed left eigenvectors */ Vec *IS,*ISL; /* placeholder for references to user-provided initial space */ PetscScalar *eigr,*eigi; /* real and imaginary parts of eigenvalues */ PetscReal *errest; /* error estimates */ IP ip; /* innerproduct object */ DS ds; /* direct solver object */ ST st; /* spectral transformation object */ void *data; /* placeholder for misc stuff associated with a particular solver */ PetscInt allocated_ncv; /* number of basis vectors allocated */ PetscInt nconv; /* number of converged eigenvalues */ PetscInt its; /* number of iterations so far computed */ PetscInt *perm; /* permutation for eigenvalue ordering */ PetscInt matvecs,linits; /* operation counters */ PetscInt n,nloc; /* problem dimensions (global, local) */ PetscRandom rand; /* random number generator */ Vec t; /* template vector */ /* ---------------- Default work-area and status vars -------------------- */ PetscInt nwork; Vec *work; PetscInt setupcalled; QEPConvergedReason reason; PetscErrorCode (*monitor[MAXQEPMONITORS])(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PetscErrorCode (*monitordestroy[MAXQEPMONITORS])(void**); void *monitorcontext[MAXQEPMONITORS]; PetscInt numbermonitors; }; PETSC_INTERN PetscErrorCode QEPReset_Default(QEP); PETSC_INTERN PetscErrorCode QEPAllocateSolution(QEP); PETSC_INTERN PetscErrorCode QEPFreeSolution(QEP); PETSC_INTERN PetscErrorCode QEPComputeVectors_Schur(QEP); PETSC_INTERN PetscErrorCode QEPComputeResidualNorm_Private(QEP,PetscScalar,PetscScalar,Vec,Vec,PetscReal*); PETSC_INTERN PetscErrorCode QEPComputeRelativeError_Private(QEP,PetscScalar,PetscScalar,Vec,Vec,PetscReal*); PETSC_INTERN PetscErrorCode QEPKrylovConvergence(QEP,PetscBool,PetscInt,PetscInt,PetscInt,PetscReal,PetscInt*); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/fnimpl.h0000644000175000017500000000266012211062077021276 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_FNIMPL) #define _FNIMPL #include #include typedef struct _FNOps *FNOps; struct _FNOps { PetscErrorCode (*evaluatefunction)(FN,PetscScalar,PetscScalar*); PetscErrorCode (*evaluatederivative)(FN,PetscScalar,PetscScalar*); PetscErrorCode (*view)(FN,PetscViewer); }; struct _p_FN { PETSCHEADER(struct _FNOps); PetscInt na; PetscScalar *alpha; /* first group of parameters */ PetscInt nb; PetscScalar *beta; /* second group of parameters */ }; #endif slepc-3.4.2.dfsg.orig/include/slepc-private/slepcimpl.h0000644000175000017500000001047612211062077022005 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_SLEPCIMPL) #define _SLEPCIMPL #include #include PETSC_INTERN PetscBool SlepcBeganPetsc; PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult; /*@C SlepcHeaderCreate - Creates a SLEPc object Input Parameters: + tp - the data structure type of the object . pops - the data structure type of the objects operations (for example VecOps) . classid - the classid associated with this object . class_name - string name of class; should be static . com - the MPI Communicator . des - the destroy routine for this object - vie - the view routine for this object Output Parameter: . h - the newly created object Note: This is equivalent to PetscHeaderCreate but makes sure that SlepcInitialize has been called. Level: developer @*/ #define SlepcHeaderCreate(h,tp,pops,classid,class_name,descr,mansec,com,des,vie) \ ((!SlepcInitializeCalled && \ PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,__SDIR__,1,PETSC_ERROR_INITIAL, \ "Must call SlepcInitialize instead of PetscInitialize to use SLEPc classes")) || \ PetscHeaderCreate(h,tp,pops,classid,class_name,descr,mansec,com,des,vie)) /* context for monitors of type XXXMonitorConverged */ struct _n_SlepcConvMonitor { PetscViewer viewer; PetscInt oldnconv; }; typedef struct _n_SlepcConvMonitor* SlepcConvMonitor; /* Private functions that are shared by several classes */ PETSC_INTERN PetscErrorCode SlepcConvMonitorDestroy(SlepcConvMonitor *ctx); PETSC_INTERN PetscErrorCode SlepcCompareLargestMagnitude(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareSmallestMagnitude(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareLargestReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareSmallestReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareLargestImaginary(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareSmallestImaginary(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareTargetMagnitude(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareTargetReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareTargetImaginary(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcCompareSmallestPosReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PETSC_INTERN PetscErrorCode SlepcBasisReference_Private(PetscInt,Vec*,PetscInt*,Vec**); PETSC_INTERN PetscErrorCode SlepcBasisDestroy_Private(PetscInt*,Vec**); PETSC_INTERN PetscErrorCode SlepcInitialize_DynamicLibraries(void); PETSC_INTERN PetscErrorCode SlepcInitialize_Packages(void); PETSC_INTERN PetscErrorCode SlepcInitialize_LogEvents(void); PETSC_INTERN PetscErrorCode SlepcDenseMatProd(PetscScalar *C,PetscInt _ldC,PetscScalar b,PetscScalar a,const PetscScalar *A,PetscInt _ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,PetscInt _ldB,PetscInt rB,PetscInt cB,PetscBool Bt); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/epsimpl.h.html0000644000175000017500000004126012211062077022424 0ustar gladkgladk
Actual source code: epsimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_EPSIMPL)
 23: #define _EPSIMPL

 25: #include <slepceps.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent EPS_SetUp,EPS_Solve;

 30: typedef struct _EPSOps *EPSOps;

 32: struct _EPSOps {
 33:   PetscErrorCode  (*solve)(EPS);
 34:   PetscErrorCode  (*setup)(EPS);
 35:   PetscErrorCode  (*setfromoptions)(EPS);
 36:   PetscErrorCode  (*publishoptions)(EPS);
 37:   PetscErrorCode  (*destroy)(EPS);
 38:   PetscErrorCode  (*reset)(EPS);
 39:   PetscErrorCode  (*view)(EPS,PetscViewer);
 40:   PetscErrorCode  (*backtransform)(EPS);
 41:   PetscErrorCode  (*computevectors)(EPS);
 42: };

 44: /*
 45:      Maximum number of monitors you can run with a single EPS
 46: */
 47: #define MAXEPSMONITORS 5

 49: /*
 50:    Defines the EPS data structure.
 51: */
 52: struct _p_EPS {
 53:   PETSCHEADER(struct _EPSOps);
 54:   /*------------------------- User parameters --------------------------*/
 55:   PetscInt       max_it;           /* maximum number of iterations */
 56:   PetscInt       nev;              /* number of eigenvalues to compute */
 57:   PetscInt       ncv;              /* number of basis vectors */
 58:   PetscInt       mpd;              /* maximum dimension of projected problem */
 59:   PetscInt       nini,ninil;       /* number of initial vectors (negative means not copied yet) */
 60:   PetscInt       nds;              /* number of basis vectors of deflation space */
 61:   PetscScalar    target;           /* target value */
 62:   PetscReal      tol;              /* tolerance */
 63:   EPSConv        conv;             /* convergence test */
 64:   EPSWhich       which;            /* which part of the spectrum to be sought */
 65:   PetscBool      leftvecs;         /* if left eigenvectors are requested */
 66:   PetscReal      inta,intb;        /* interval [a,b] for spectrum slicing */
 67:   EPSProblemType problem_type;     /* which kind of problem to be solved */
 68:   EPSExtraction  extraction;       /* which kind of extraction to be applied */
 69:   EPSBalance     balance;          /* the balancing method */
 70:   PetscInt       balance_its;      /* number of iterations of the balancing method */
 71:   PetscReal      balance_cutoff;   /* cutoff value for balancing */
 72:   PetscReal      nrma,nrmb;        /* matrix norms */
 73:   PetscBool      adaptive;         /* whether matrix norms are adaptively improved */
 74:   PetscBool      trueres;          /* whether the true residual norm must be computed */
 75:   PetscBool      trackall;         /* whether all the residuals must be computed */

 77:   /*-------------- User-provided functions and contexts -----------------*/
 78:   PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 79:   PetscErrorCode (*converged)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
 80:   PetscErrorCode (*arbitrary)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*);
 81:   void           *comparisonctx;
 82:   void           *convergedctx;
 83:   void           *arbitraryctx;

 85:   /*------------------------- Working data --------------------------*/
 86:   Vec            D;                /* diagonal matrix for balancing */
 87:   Vec            *V;               /* set of basis vectors and computed eigenvectors */
 88:   Vec            *W;               /* set of left basis vectors and computed left eigenvectors */
 89:   Vec            *IS,*ISL;         /* placeholder for references to user-provided initial space */
 90:   Vec            *defl;            /* deflation space */
 91:   PetscScalar    *eigr,*eigi;      /* real and imaginary parts of eigenvalues */
 92:   PetscReal      *errest;          /* error estimates */
 93:   PetscReal      *errest_left;     /* left error estimates */
 94:   PetscScalar    *rr,*ri;          /* values computed by user's arbitrary selection function */
 95:   ST             st;               /* spectral transformation object */
 96:   IP             ip;               /* innerproduct object */
 97:   DS             ds;               /* direct solver object */
 98:   void           *data;            /* placeholder for misc stuff associated
 99:                                       with a particular solver */
100:   PetscInt       nconv;            /* number of converged eigenvalues */
101:   PetscInt       its;              /* number of iterations so far computed */
102:   PetscInt       *perm;            /* permutation for eigenvalue ordering */
103:   PetscInt       nv;               /* size of current Schur decomposition */
104:   PetscInt       n,nloc;           /* problem dimensions (global, local) */
105:   PetscInt       allocated_ncv;    /* number of basis vectors allocated */
106:   PetscBool      evecsavailable;   /* computed eigenvectors */
107:   PetscRandom    rand;             /* random number generator */
108:   Vec            t;                /* template vector */

110:   /* ---------------- Default work-area and status vars -------------------- */
111:   PetscInt       nwork;
112:   Vec            *work;

114:   PetscBool      ds_ortho;         /* if defl vectors have been stored & orthonormalized */
115:   PetscInt       setupcalled;
116:   PetscBool      isgeneralized;
117:   PetscBool      ispositive;
118:   PetscBool      ishermitian;
119:   EPSConvergedReason reason;

121:   PetscErrorCode (*monitor[MAXEPSMONITORS])(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
122:   PetscErrorCode (*monitordestroy[MAXEPSMONITORS])(void**);
123:   void           *monitorcontext[MAXEPSMONITORS];
124:   PetscInt       numbermonitors;
125: };

127: PETSC_INTERN PetscErrorCode EPSReset_Default(EPS);
128: PETSC_INTERN PetscErrorCode EPSSetWhichEigenpairs_Default(EPS);
129: PETSC_INTERN PetscErrorCode EPSAllocateSolution(EPS);
130: PETSC_INTERN PetscErrorCode EPSFreeSolution(EPS);
131: PETSC_INTERN PetscErrorCode EPSBackTransform_Default(EPS);
132: PETSC_INTERN PetscErrorCode EPSComputeVectors_Default(EPS);
133: PETSC_INTERN PetscErrorCode EPSComputeVectors_Hermitian(EPS);
134: PETSC_INTERN PetscErrorCode EPSComputeVectors_Schur(EPS);
135: PETSC_INTERN PetscErrorCode EPSComputeResidualNorm_Private(EPS,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
136: PETSC_INTERN PetscErrorCode EPSComputeRelativeError_Private(EPS,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
137: PETSC_INTERN PetscErrorCode EPSComputeRitzVector(EPS,PetscScalar*,PetscScalar*,Vec*,PetscInt,Vec,Vec);

139: /* Private functions of the solver implementations */

141: PETSC_INTERN PetscErrorCode EPSBasicArnoldi(EPS,PetscBool,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscBool*);
142: PETSC_INTERN PetscErrorCode EPSDelayedArnoldi(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscBool*);
143: PETSC_INTERN PetscErrorCode EPSDelayedArnoldi1(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscBool*);
144: PETSC_INTERN PetscErrorCode EPSKrylovConvergence(EPS,PetscBool,PetscInt,PetscInt,Vec*,PetscInt,PetscReal,PetscReal,PetscInt*);
145: PETSC_INTERN PetscErrorCode EPSFullLanczos(EPS,PetscReal*,PetscReal*,Vec*,PetscInt,PetscInt*,Vec,PetscBool*);
146: PETSC_INTERN PetscErrorCode EPSBuildBalance_Krylov(EPS);

148: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/ipimpl.h.html0000644000175000017500000001324512211062077022247 0ustar gladkgladk
Actual source code: ipimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_IPIMPL)
 23: #define _IPIMPL

 25: #include <slepcip.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix;

 30: typedef struct _IPOps *IPOps;

 32: struct _IPOps {
 33:   PetscErrorCode (*normbegin)(IP,Vec,PetscReal*);
 34:   PetscErrorCode (*normend)(IP,Vec,PetscReal*);
 35:   PetscErrorCode (*innerproductbegin)(IP,Vec,Vec,PetscScalar*);
 36:   PetscErrorCode (*innerproductend)(IP,Vec,Vec,PetscScalar*);
 37:   PetscErrorCode (*minnerproductbegin)(IP,Vec,PetscInt,const Vec[],PetscScalar*);
 38:   PetscErrorCode (*minnerproductend)(IP,Vec,PetscInt,const Vec[],PetscScalar*);
 39: };

 41: struct _p_IP {
 42:   PETSCHEADER(struct _IPOps);
 43:   IPOrthogType       orthog_type;    /* which orthogonalization to use */
 44:   IPOrthogRefineType orthog_ref;     /* refinement method */
 45:   PetscReal          orthog_eta;     /* refinement threshold */
 46:   Mat                matrix;
 47:   PetscInt           innerproducts;
 48:   PetscScalar        *work;
 49:   PetscInt           lwork;

 51:   /*------------------------- Cache Bx product -------------------*/
 52:   PetscInt           xid;
 53:   PetscInt           xstate;
 54:   Vec                Bx;
 55: };

 57: PETSC_INTERN PetscErrorCode IPSetType_Default(IP);
 58: PETSC_INTERN PetscErrorCode IPApplyMatrix_Private(IP,Vec);
 59: PETSC_INTERN PetscErrorCode IPOrthogonalizeCGS1(IP,PetscInt,Vec*,PetscInt,PetscBool*,Vec*,Vec,PetscScalar*,PetscReal*,PetscReal*);

 61: PETSC_INTERN PetscErrorCode IPOrthonormalizeBasis_Private(IP,PetscInt*,Vec**,Vec*);

 63: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/svdimpl.h0000644000175000017500000000752712211062077021476 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_SVDIMPL) #define _SVDIMPL #include #include PETSC_EXTERN PetscLogEvent SVD_SetUp,SVD_Solve; typedef struct _SVDOps *SVDOps; struct _SVDOps { PetscErrorCode (*solve)(SVD); PetscErrorCode (*setup)(SVD); PetscErrorCode (*setfromoptions)(SVD); PetscErrorCode (*publishoptions)(SVD); PetscErrorCode (*destroy)(SVD); PetscErrorCode (*reset)(SVD); PetscErrorCode (*view)(SVD,PetscViewer); }; /* Maximum number of monitors you can run with a single SVD */ #define MAXSVDMONITORS 5 /* Defines the SVD data structure. */ struct _p_SVD { PETSCHEADER(struct _SVDOps); Mat OP; /* problem matrix */ Mat A; /* problem matrix (m>n) */ Mat AT; /* transposed matrix */ SVDTransposeMode transmode; /* transpose mode */ PetscReal *sigma; /* singular values */ PetscInt *perm; /* permutation for singular value ordering */ Vec *U,*V; /* left and right singular vectors */ Vec *IS,*ISL; /* placeholder for references to user-provided initial space */ PetscInt n; /* maximun size of descomposition */ SVDWhich which; /* which singular values are computed */ PetscInt nconv; /* number of converged values */ PetscInt nsv; /* number of requested values */ PetscInt ncv; /* basis size */ PetscInt mpd; /* maximum dimension of projected problem */ PetscInt nini,ninil; /* number of initial vectors (negative means not copied yet) */ PetscInt its; /* iteration counter */ PetscInt max_it; /* max iterations */ PetscReal tol; /* tolerance */ PetscReal *errest; /* error estimates */ PetscRandom rand; /* random number generator */ Vec tl,tr; /* template vectors */ void *data; /* placeholder for misc stuff associated with a particular solver */ PetscInt setupcalled; SVDConvergedReason reason; IP ip; /* innerproduct object */ DS ds; /* direct solver object */ PetscBool trackall; PetscInt matvecs; PetscErrorCode (*monitor[MAXSVDMONITORS])(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*); PetscErrorCode (*monitordestroy[MAXSVDMONITORS])(void**); void *monitorcontext[MAXSVDMONITORS]; PetscInt numbermonitors; }; PETSC_INTERN PetscErrorCode SVDMatMult(SVD,PetscBool,Vec,Vec); PETSC_INTERN PetscErrorCode SVDMatGetVecs(SVD,Vec*,Vec*); PETSC_INTERN PetscErrorCode SVDMatGetSize(SVD,PetscInt*,PetscInt*); PETSC_INTERN PetscErrorCode SVDMatGetLocalSize(SVD,PetscInt*,PetscInt*); PETSC_INTERN PetscErrorCode SVDTwoSideLanczos(SVD,PetscReal*,PetscReal*,Vec*,Vec,Vec*,PetscInt,PetscInt,PetscScalar*); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/qepimpl.h.html0000644000175000017500000002757412211062077022436 0ustar gladkgladk
Actual source code: qepimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_QEPIMPL)
 23: #define _QEPIMPL

 25: #include <slepcqep.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense;

 30: typedef struct _QEPOps *QEPOps;

 32: struct _QEPOps {
 33:   PetscErrorCode  (*solve)(QEP);
 34:   PetscErrorCode  (*setup)(QEP);
 35:   PetscErrorCode  (*setfromoptions)(QEP);
 36:   PetscErrorCode  (*publishoptions)(QEP);
 37:   PetscErrorCode  (*destroy)(QEP);
 38:   PetscErrorCode  (*reset)(QEP);
 39:   PetscErrorCode  (*view)(QEP,PetscViewer);
 40: };

 42: /*
 43:      Maximum number of monitors you can run with a single QEP
 44: */
 45: #define MAXQEPMONITORS 5

 47: /*
 48:    Defines the QEP data structure.
 49: */
 50: struct _p_QEP {
 51:   PETSCHEADER(struct _QEPOps);
 52:   /*------------------------- User parameters --------------------------*/
 53:   PetscInt       max_it;           /* maximum number of iterations */
 54:   PetscInt       nev;              /* number of eigenvalues to compute */
 55:   PetscInt       ncv;              /* number of basis vectors */
 56:   PetscInt       mpd;              /* maximum dimension of projected problem */
 57:   PetscInt       nini,ninil;       /* number of initial vectors (negative means not copied yet) */
 58:   PetscScalar    target;           /* target value */
 59:   PetscReal      tol;              /* tolerance */
 60:   PetscReal      sfactor;          /* scaling factor of the quadratic problem */
 61:   PetscBool      sfactor_set;      /* flag to indicate the user gave sfactor */
 62:   QEPWhich       which;            /* which part of the spectrum to be sought */
 63:   PetscBool      leftvecs;         /* if left eigenvectors are requested */
 64:   QEPProblemType problem_type;     /* which kind of problem to be solved */
 65:   PetscBool      trackall;         /* whether all the residuals must be computed */

 67:   /*-------------- User-provided functions and contexts -----------------*/
 68:   PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 69:   PetscErrorCode (*converged)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
 70:   void           *comparisonctx;
 71:   void           *convergedctx;

 73:   /*------------------------- Working data --------------------------*/
 74:   Mat            M,C,K;            /* problem matrices */
 75:   Vec            *V;               /* set of basis vectors and computed eigenvectors */
 76:   Vec            *W;               /* set of left basis vectors and computed left eigenvectors */
 77:   Vec            *IS,*ISL;         /* placeholder for references to user-provided initial space */
 78:   PetscScalar    *eigr,*eigi;      /* real and imaginary parts of eigenvalues */
 79:   PetscReal      *errest;          /* error estimates */
 80:   IP             ip;               /* innerproduct object */
 81:   DS             ds;               /* direct solver object */
 82:   ST             st;               /* spectral transformation object */
 83:   void           *data;            /* placeholder for misc stuff associated
 84:                                       with a particular solver */
 85:   PetscInt       allocated_ncv;    /* number of basis vectors allocated */
 86:   PetscInt       nconv;            /* number of converged eigenvalues */
 87:   PetscInt       its;              /* number of iterations so far computed */
 88:   PetscInt       *perm;            /* permutation for eigenvalue ordering */
 89:   PetscInt       matvecs,linits;   /* operation counters */
 90:   PetscInt       n,nloc;           /* problem dimensions (global, local) */
 91:   PetscRandom    rand;             /* random number generator */
 92:   Vec            t;                /* template vector */

 94:   /* ---------------- Default work-area and status vars -------------------- */
 95:   PetscInt       nwork;
 96:   Vec            *work;

 98:   PetscInt       setupcalled;
 99:   QEPConvergedReason reason;

101:   PetscErrorCode (*monitor[MAXQEPMONITORS])(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
102:   PetscErrorCode (*monitordestroy[MAXQEPMONITORS])(void**);
103:   void           *monitorcontext[MAXQEPMONITORS];
104:   PetscInt        numbermonitors;
105: };

107: PETSC_INTERN PetscErrorCode QEPReset_Default(QEP);
108: PETSC_INTERN PetscErrorCode QEPAllocateSolution(QEP);
109: PETSC_INTERN PetscErrorCode QEPFreeSolution(QEP);
110: PETSC_INTERN PetscErrorCode QEPComputeVectors_Schur(QEP);
111: PETSC_INTERN PetscErrorCode QEPComputeResidualNorm_Private(QEP,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
112: PETSC_INTERN PetscErrorCode QEPComputeRelativeError_Private(QEP,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
113: PETSC_INTERN PetscErrorCode QEPKrylovConvergence(QEP,PetscBool,PetscInt,PetscInt,PetscInt,PetscReal,PetscInt*);

115: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/makefile0000644000175000017500000000230212211062077021331 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = SOURCEC = SOURCEF = SOURCEH = epsimpl.h stimpl.h svdimpl.h ipimpl.h qepimpl.h nepimpl.h \ mfnimpl.h dsimpl.h fnimpl.h slepcimpl.h LIBBASE = libslepc DIRS = LOCDIR = include/slepc-private/ MANSEC = include ${SLEPC_DIR}/conf/slepc_common slepc-3.4.2.dfsg.orig/include/slepc-private/dsimpl.h.html0000644000175000017500000003245712211062077022253 0ustar gladkgladk
Actual source code: dsimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_DSIMPL)
 23: #define _DSIMPL

 25: #include <slepcds.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other;
 29: PETSC_INTERN const char *DSMatName[];

 31: typedef struct _DSOps *DSOps;

 33: struct _DSOps {
 34:   PetscErrorCode (*allocate)(DS,PetscInt);
 35:   PetscErrorCode (*view)(DS,PetscViewer);
 36:   PetscErrorCode (*vectors)(DS,DSMatType,PetscInt*,PetscReal*);
 37:   PetscErrorCode (*solve[DS_MAX_SOLVE])(DS,PetscScalar*,PetscScalar*);
 38:   PetscErrorCode (*computefun[SLEPC_FUNCTION_LAST][DS_MAX_FUN])(DS);
 39:   PetscErrorCode (*sort)(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*);
 40:   PetscErrorCode (*truncate)(DS,PetscInt);
 41:   PetscErrorCode (*update)(DS);
 42:   PetscErrorCode (*cond)(DS,PetscReal*);
 43:   PetscErrorCode (*transharm)(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*);
 44:   PetscErrorCode (*transrks)(DS,PetscScalar);
 45:   PetscErrorCode (*normalize)(DS,DSMatType,PetscInt);
 46: };

 48: struct _p_DS {
 49:   PETSCHEADER(struct _DSOps);
 50:   PetscInt       method;             /* identifies the variant to be used */
 51:   PetscInt       funmethod;          /* to choose among methods for function evaluation */
 52:   PetscBool      compact;            /* whether the matrices are stored in compact form */
 53:   PetscBool      refined;            /* get refined vectors instead of regular vectors */
 54:   PetscBool      extrarow;           /* assume the matrix dimension is (n+1) x n */
 55:   PetscInt       ld;                 /* leading dimension */
 56:   PetscInt       l;                  /* number of locked (inactive) leading columns */
 57:   PetscInt       n;                  /* current dimension */
 58:   PetscInt       m;                  /* current column dimension (for SVD only) */
 59:   PetscInt       k;                  /* intermediate dimension (e.g. position of arrow) */
 60:   PetscInt       t;                  /* length of decomposition when it was truncated */
 61:   DSStateType    state;              /* the current state */
 62:   PetscScalar    *mat[DS_NUM_MAT];   /* the matrices */
 63:   PetscReal      *rmat[DS_NUM_MAT];  /* the matrices (real) */
 64:   PetscInt       *perm;              /* permutation */
 65:   PetscInt       nf;                 /* number of functions in f[] */
 66:   FN             f[DS_NUM_EXTRA];    /* functions provided via DSSetFN() */
 67:   PetscScalar    *work;
 68:   PetscReal      *rwork;
 69:   PetscBLASInt   *iwork;
 70:   PetscInt       lwork,lrwork,liwork;
 71:   /*-------------- User-provided functions and contexts -----------------*/
 72:   PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 73:   void           *comparisonctx;
 74: };

 76: PETSC_INTERN PetscErrorCode DSAllocateMat_Private(DS,DSMatType);
 77: PETSC_INTERN PetscErrorCode DSAllocateMatReal_Private(DS,DSMatType);
 78: PETSC_INTERN PetscErrorCode DSAllocateWork_Private(DS,PetscInt,PetscInt,PetscInt);
 79: PETSC_INTERN PetscErrorCode DSViewMat_Private(DS,PetscViewer,DSMatType);
 80: PETSC_INTERN PetscErrorCode DSSortEigenvalues_Private(DS,PetscScalar*,PetscScalar*,PetscInt*,PetscBool);
 81: PETSC_INTERN PetscErrorCode DSSortEigenvaluesReal_Private(DS,PetscReal*,PetscInt*);
 82: PETSC_INTERN PetscErrorCode DSPermuteColumns_Private(DS,PetscInt,PetscInt,DSMatType,PetscInt*);
 83: PETSC_INTERN PetscErrorCode DSPermuteRows_Private(DS,PetscInt,PetscInt,DSMatType,PetscInt*);
 84: PETSC_INTERN PetscErrorCode DSPermuteBoth_Private(DS,PetscInt,PetscInt,DSMatType,DSMatType,PetscInt*);
 85: PETSC_INTERN PetscErrorCode DSCopyMatrix_Private(DS,DSMatType,DSMatType);
 86: PETSC_INTERN PetscErrorCode DSSetIdentity(DS,DSMatType);
 87: PETSC_INTERN PetscErrorCode DSComputeMatrix(DS,PetscScalar,PetscBool,DSMatType);
 88: PETSC_INTERN PetscErrorCode DSOrthogonalize(DS,DSMatType,PetscInt,PetscInt*);
 89: PETSC_INTERN PetscErrorCode DSPseudoOrthogonalize(DS,DSMatType,PetscInt,PetscReal*,PetscInt*,PetscReal*);

 91: PETSC_INTERN PetscErrorCode DSGHIEPOrthogEigenv(DS,DSMatType,PetscScalar*,PetscScalar*,PetscBool);
 92: PETSC_INTERN PetscErrorCode DSGHIEPComplexEigs(DS,PetscInt,PetscInt,PetscScalar*,PetscScalar*);
 93: PETSC_INTERN PetscErrorCode DSGHIEPInverseIteration(DS,PetscScalar*,PetscScalar*);
 94: PETSC_INTERN PetscErrorCode DSIntermediate_GHIEP(DS);
 95: PETSC_INTERN PetscErrorCode DSSwitchFormat_GHIEP(DS,PetscBool);
 96: PETSC_INTERN PetscErrorCode DSGHIEPRealBlocks(DS);

 98: PETSC_INTERN PetscErrorCode DSSolve_GHIEP_HZ(DS,PetscScalar*,PetscScalar*);
 99: PETSC_INTERN PetscErrorCode DSSolve_GHIEP_DQDS_II(DS,PetscScalar*,PetscScalar*);

101: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/stimpl.h.html0000644000175000017500000001717412211062077022272 0ustar gladkgladk
Actual source code: stimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) , Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_STIMPL)
 23: #define _STIMPL

 25: #include <slepcst.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose;

 30: typedef struct _STOps *STOps;

 32: struct _STOps {
 33:   PetscErrorCode (*setup)(ST);
 34:   PetscErrorCode (*apply)(ST,Vec,Vec);
 35:   PetscErrorCode (*getbilinearform)(ST,Mat*);
 36:   PetscErrorCode (*applytrans)(ST,Vec,Vec);
 37:   PetscErrorCode (*setshift)(ST,PetscScalar);
 38:   PetscErrorCode (*setfromoptions)(ST);
 39:   PetscErrorCode (*postsolve)(ST);
 40:   PetscErrorCode (*backtransform)(ST,PetscInt,PetscScalar*,PetscScalar*);
 41:   PetscErrorCode (*destroy)(ST);
 42:   PetscErrorCode (*reset)(ST);
 43:   PetscErrorCode (*view)(ST,PetscViewer);
 44:   PetscErrorCode (*checknullspace)(ST,PetscInt,const Vec[]);
 45: };

 47: struct _p_ST {
 48:   PETSCHEADER(struct _STOps);
 49:   /*------------------------- User parameters --------------------------*/
 50:   Mat          *A;               /* Matrices which define the eigensystem */
 51:   PetscInt     *Astate;          /* State (to identify the original matrices) */
 52:   Mat          *T;               /* Matrices resulting from transformation */
 53:   PetscInt     nmat;             /* Number of matrices */
 54:   PetscScalar  sigma;            /* Value of the shift */
 55:   PetscBool    sigma_set;        /* whether the user provided the shift or not */
 56:   PetscScalar  defsigma;         /* Default value of the shift */
 57:   STMatMode    shift_matrix;
 58:   MatStructure str;              /* whether matrices have the same pattern or not */

 60:   /*------------------------- Misc data --------------------------*/
 61:   KSP          ksp;
 62:   PetscInt     kspidx;           /* which T matrix is associated to ksp */
 63:   Vec          w;
 64:   Vec          D;                /* diagonal matrix for balancing */
 65:   Vec          wb;               /* balancing requires an extra work vector */
 66:   void         *data;
 67:   PetscInt     setupcalled;
 68:   PetscInt     lineariterations;
 69:   PetscInt     applys;
 70: };

 72: PETSC_INTERN PetscErrorCode STGetBilinearForm_Default(ST,Mat*);
 73: PETSC_INTERN PetscErrorCode STCheckNullSpace_Default(ST,PetscInt,const Vec[]);
 74: PETSC_INTERN PetscErrorCode STMatShellCreate(ST,PetscScalar,PetscInt,PetscInt*,Mat*);
 75: PETSC_INTERN PetscErrorCode STMatShellShift(Mat,PetscScalar);
 76: PETSC_INTERN PetscErrorCode STMatSetHermitian(ST,Mat);
 77: PETSC_INTERN PetscErrorCode STMatGAXPY_Private(ST,PetscScalar,PetscScalar,PetscInt,PetscInt,PetscBool);

 79: #endif

slepc-3.4.2.dfsg.orig/include/slepc-private/slepcimpl.h.html0000644000175000017500000002150012211062077022736 0ustar gladkgladk
Actual source code: slepcimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_SLEPCIMPL)
 23: #define _SLEPCIMPL

 25: #include <slepcsys.h>
 26: #include <petsc-private/petscimpl.h>

 28: PETSC_INTERN PetscBool SlepcBeganPetsc;
 29: PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;

 31: /*@C
 32:     SlepcHeaderCreate - Creates a SLEPc object

 34:     Input Parameters:
 35: +   tp - the data structure type of the object
 36: .   pops - the data structure type of the objects operations (for example VecOps)
 37: .   classid - the classid associated with this object
 38: .   class_name - string name of class; should be static
 39: .   com - the MPI Communicator
 40: .   des - the destroy routine for this object
 41: -   vie - the view routine for this object

 43:     Output Parameter:
 44: .   h - the newly created object

 46:     Note:
 47:     This is equivalent to PetscHeaderCreate but makes sure that SlepcInitialize
 48:     has been called.

 50:     Level: developer
 51: @*/
 52: #define SlepcHeaderCreate(h,tp,pops,classid,class_name,descr,mansec,com,des,vie) \
 53:     ((!SlepcInitializeCalled && \
 54:     PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,__SDIR__,1,PETSC_ERROR_INITIAL, \
 55:     "Must call SlepcInitialize instead of PetscInitialize to use SLEPc classes")) ||  \
 56:     PetscHeaderCreate(h,tp,pops,classid,class_name,descr,mansec,com,des,vie))

 58: /* context for monitors of type XXXMonitorConverged */
 59: struct _n_SlepcConvMonitor {
 60:   PetscViewer viewer;
 61:   PetscInt    oldnconv;
 62: };
 63: typedef struct _n_SlepcConvMonitor* SlepcConvMonitor;

 65: /* Private functions that are shared by several classes */
 66: PETSC_INTERN PetscErrorCode SlepcConvMonitorDestroy(SlepcConvMonitor *ctx);

 68: PETSC_INTERN PetscErrorCode SlepcCompareLargestMagnitude(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 69: PETSC_INTERN PetscErrorCode SlepcCompareSmallestMagnitude(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 70: PETSC_INTERN PetscErrorCode SlepcCompareLargestReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 71: PETSC_INTERN PetscErrorCode SlepcCompareSmallestReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 72: PETSC_INTERN PetscErrorCode SlepcCompareLargestImaginary(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 73: PETSC_INTERN PetscErrorCode SlepcCompareSmallestImaginary(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 74: PETSC_INTERN PetscErrorCode SlepcCompareTargetMagnitude(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 75: PETSC_INTERN PetscErrorCode SlepcCompareTargetReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 76: PETSC_INTERN PetscErrorCode SlepcCompareTargetImaginary(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 77: PETSC_INTERN PetscErrorCode SlepcCompareSmallestPosReal(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);

 79: PETSC_INTERN PetscErrorCode SlepcBasisReference_Private(PetscInt,Vec*,PetscInt*,Vec**);
 80: PETSC_INTERN PetscErrorCode SlepcBasisDestroy_Private(PetscInt*,Vec**);

 82: PETSC_INTERN PetscErrorCode SlepcInitialize_DynamicLibraries(void);
 83: PETSC_INTERN PetscErrorCode SlepcInitialize_Packages(void);
 84: PETSC_INTERN PetscErrorCode SlepcInitialize_LogEvents(void);

 86: PETSC_INTERN PetscErrorCode SlepcDenseMatProd(PetscScalar *C,PetscInt _ldC,PetscScalar b,PetscScalar a,const PetscScalar *A,PetscInt _ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,PetscInt _ldB,PetscInt rB,PetscInt cB,PetscBool Bt);

 88: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/makefile.html0000644000175000017500000000373312211062077022305 0ustar gladkgladk
#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#     
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS   =
FFLAGS   =
SOURCEC  =
SOURCEF  =
SOURCEH  = epsimpl.h stimpl.h svdimpl.h ipimpl.h qepimpl.h nepimpl.h \
           mfnimpl.h dsimpl.h fnimpl.h slepcimpl.h
LIBBASE  = libslepc
DIRS     = 
LOCDIR   = include/slepc-private/
MANSEC   = 

include ${SLEPC_DIR}/conf/slepc_common
slepc-3.4.2.dfsg.orig/include/slepc-private/index.html0000644000175000017500000000114212211062077021627 0ustar gladkgladk Generic SLEPc Manual Pages

epsimpl.h
stimpl.h
svdimpl.h
ipimpl.h
qepimpl.h
nepimpl.h
mfnimpl.h
dsimpl.h
fnimpl.h
slepcimpl.h
makefile
slepc-3.4.2.dfsg.orig/include/slepc-private/stimpl.h0000644000175000017500000000632512211062077021323 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) , Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_STIMPL) #define _STIMPL #include #include PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose; typedef struct _STOps *STOps; struct _STOps { PetscErrorCode (*setup)(ST); PetscErrorCode (*apply)(ST,Vec,Vec); PetscErrorCode (*getbilinearform)(ST,Mat*); PetscErrorCode (*applytrans)(ST,Vec,Vec); PetscErrorCode (*setshift)(ST,PetscScalar); PetscErrorCode (*setfromoptions)(ST); PetscErrorCode (*postsolve)(ST); PetscErrorCode (*backtransform)(ST,PetscInt,PetscScalar*,PetscScalar*); PetscErrorCode (*destroy)(ST); PetscErrorCode (*reset)(ST); PetscErrorCode (*view)(ST,PetscViewer); PetscErrorCode (*checknullspace)(ST,PetscInt,const Vec[]); }; struct _p_ST { PETSCHEADER(struct _STOps); /*------------------------- User parameters --------------------------*/ Mat *A; /* Matrices which define the eigensystem */ PetscInt *Astate; /* State (to identify the original matrices) */ Mat *T; /* Matrices resulting from transformation */ PetscInt nmat; /* Number of matrices */ PetscScalar sigma; /* Value of the shift */ PetscBool sigma_set; /* whether the user provided the shift or not */ PetscScalar defsigma; /* Default value of the shift */ STMatMode shift_matrix; MatStructure str; /* whether matrices have the same pattern or not */ /*------------------------- Misc data --------------------------*/ KSP ksp; PetscInt kspidx; /* which T matrix is associated to ksp */ Vec w; Vec D; /* diagonal matrix for balancing */ Vec wb; /* balancing requires an extra work vector */ void *data; PetscInt setupcalled; PetscInt lineariterations; PetscInt applys; }; PETSC_INTERN PetscErrorCode STGetBilinearForm_Default(ST,Mat*); PETSC_INTERN PetscErrorCode STCheckNullSpace_Default(ST,PetscInt,const Vec[]); PETSC_INTERN PetscErrorCode STMatShellCreate(ST,PetscScalar,PetscInt,PetscInt*,Mat*); PETSC_INTERN PetscErrorCode STMatShellShift(Mat,PetscScalar); PETSC_INTERN PetscErrorCode STMatSetHermitian(ST,Mat); PETSC_INTERN PetscErrorCode STMatGAXPY_Private(ST,PetscScalar,PetscScalar,PetscInt,PetscInt,PetscBool); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/nepimpl.h.html0000644000175000017500000003207612211062077022424 0ustar gladkgladk

Actual source code: nepimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_NEPIMPL)
 23: #define _NEPIMPL

 25: #include <slepcnep.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;

 30: typedef struct _NEPOps *NEPOps;

 32: struct _NEPOps {
 33:   PetscErrorCode (*solve)(NEP);
 34:   PetscErrorCode (*setup)(NEP);
 35:   PetscErrorCode (*setfromoptions)(NEP);
 36:   PetscErrorCode (*publishoptions)(NEP);
 37:   PetscErrorCode (*destroy)(NEP);
 38:   PetscErrorCode (*reset)(NEP);
 39:   PetscErrorCode (*view)(NEP,PetscViewer);
 40: };

 42: /*
 43:      Maximum number of monitors you can run with a single NEP
 44: */
 45: #define MAXNEPMONITORS 5

 47: /*
 48:    Defines the NEP data structure.
 49: */
 50: struct _p_NEP {
 51:   PETSCHEADER(struct _NEPOps);
 52:   /*------------------------- User parameters --------------------------*/
 53:   PetscInt       max_it;           /* maximum number of iterations */
 54:   PetscInt       max_funcs;        /* maximum number of function evaluations */
 55:   PetscInt       nev;              /* number of eigenvalues to compute */
 56:   PetscInt       ncv;              /* number of basis vectors */
 57:   PetscInt       mpd;              /* maximum dimension of projected problem */
 58:   PetscInt       lag;              /* interval to rebuild preconditioner */
 59:   PetscInt       nini;             /* number of initial vectors (negative means not copied yet) */
 60:   PetscScalar    target;           /* target value */
 61:   PetscReal      abstol,rtol,stol; /* user tolerances */
 62:   PetscReal      ktol;             /* tolerance for linear solver */
 63:   PetscBool      cctol;            /* constant correction tolerance */
 64:   PetscReal      ttol;             /* tolerance used in the convergence criterion */
 65:   PetscBool      trackall;         /* whether all the residuals must be computed */
 66:   NEPWhich       which;            /* which part of the spectrum to be sought */
 67:   PetscBool      split;            /* the nonlinear operator has been set in
 68:                                       split form, otherwise user callbacks are used */

 70:   /*-------------- User-provided functions and contexts -----------------*/
 71:   PetscErrorCode (*computefunction)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*);
 72:   PetscErrorCode (*computejacobian)(NEP,PetscScalar,Mat*,MatStructure*,void*);
 73:   PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
 74:   PetscErrorCode (*converged)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*);
 75:   PetscErrorCode (*convergeddestroy)(void*);
 76:   void           *comparisonctx;
 77:   void           *convergedctx;
 78:   Mat            function,function_pre;
 79:   void           *functionctx;
 80:   Mat            jacobian;
 81:   void           *jacobianctx;
 82:   PetscInt       nt;               /* number of terms in split form */
 83:   MatStructure   mstr;             /* pattern of split matrices */
 84:   Mat            *A;               /* matrix coefficients of split form */
 85:   FN             *f;               /* matrix functions of split form */

 87:   /*------------------------- Working data --------------------------*/
 88:   Vec            *V;               /* set of basis vectors and computed eigenvectors */
 89:   Vec            *IS;              /* placeholder for references to user-provided initial space */
 90:   PetscScalar    *eig;             /* computed eigenvalues */
 91:   PetscReal      *errest;          /* error estimates */
 92:   IP             ip;               /* innerproduct object */
 93:   DS             ds;               /* direct solver object */
 94:   KSP            ksp;              /* linear solver object */
 95:   void           *data;            /* placeholder for misc stuff associated
 96:                                       with a particular solver */
 97:   PetscInt       nconv;            /* number of converged eigenvalues */
 98:   PetscInt       its;              /* number of iterations so far computed */
 99:   PetscInt       *perm;            /* permutation for eigenvalue ordering */
100:   PetscInt       nfuncs,linits;    /* operation counters */
101:   PetscInt       n,nloc;           /* problem dimensions (global, local) */
102:   PetscRandom    rand;             /* random number generator */
103:   Vec            t;                /* template vector */
104:   PetscInt       allocated_ncv;    /* number of basis vectors allocated */

106:   /* ---------------- Default work-area and status vars -------------------- */
107:   PetscInt       nwork;
108:   Vec            *work;

110:   PetscInt       setupcalled;
111:   NEPConvergedReason reason;

113:   PetscErrorCode (*monitor[MAXNEPMONITORS])(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
114:   PetscErrorCode (*monitordestroy[MAXNEPMONITORS])(void**);
115:   void           *monitorcontext[MAXNEPMONITORS];
116:   PetscInt       numbermonitors;
117: };

119: PETSC_INTERN PetscErrorCode NEPReset_Default(NEP);
120: PETSC_INTERN PetscErrorCode NEPGetDefaultShift(NEP,PetscScalar*);
121: PETSC_INTERN PetscErrorCode NEPAllocateSolution(NEP);
122: PETSC_INTERN PetscErrorCode NEPFreeSolution(NEP);
123: PETSC_INTERN PetscErrorCode NEP_KSPSolve(NEP,Vec,Vec);
124: PETSC_INTERN PetscErrorCode NEPComputeResidualNorm_Private(NEP,PetscScalar,Vec,PetscReal*);
125: PETSC_INTERN PetscErrorCode NEPComputeRelativeError_Private(NEP,PetscScalar,Vec,PetscReal*);

127: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/mfnimpl.h.html0000644000175000017500000002152312211062077022415 0ustar gladkgladk
Actual source code: mfnimpl.h

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.

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

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

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

 22: #if !defined(_MFNIMPL)
 23: #define _MFNIMPL

 25: #include <slepcmfn.h>
 26: #include <slepc-private/slepcimpl.h>

 28: PETSC_EXTERN PetscLogEvent MFN_SetUp, MFN_Solve;

 30: typedef struct _MFNOps *MFNOps;

 32: struct _MFNOps {
 33:   PetscErrorCode (*solve)(MFN,Vec,Vec);
 34:   PetscErrorCode (*setup)(MFN);
 35:   PetscErrorCode (*setfromoptions)(MFN);
 36:   PetscErrorCode (*publishoptions)(MFN);
 37:   PetscErrorCode (*destroy)(MFN);
 38:   PetscErrorCode (*reset)(MFN);
 39:   PetscErrorCode (*view)(MFN,PetscViewer);
 40: };

 42: /*
 43:      Maximum number of monitors you can run with a single MFN
 44: */
 45: #define MAXMFNMONITORS 5

 47: /*
 48:    Defines the MFN data structure.
 49: */
 50: struct _p_MFN {
 51:   PETSCHEADER(struct _MFNOps);
 52:   /*------------------------- User parameters --------------------------*/
 53:   PetscInt        max_it;         /* maximum number of iterations */
 54:   PetscInt        ncv;            /* number of basis vectors */
 55:   PetscReal       tol;            /* tolerance */
 56:   SlepcFunction   function;       /* which function to compute */
 57:   PetscScalar     sfactor;        /* scaling factor */
 58:   PetscBool       errorifnotconverged;    /* error out if MFNSolve() does not converge */

 60:   /*------------------------- Working data --------------------------*/
 61:   Mat             A;              /* the problem matrix */
 62:   Vec             *V;             /* set of basis vectors */
 63:   PetscReal       errest;         /* error estimate */
 64:   IP              ip;             /* innerproduct object */
 65:   DS              ds;             /* direct solver object */
 66:   void            *data;          /* placeholder for misc stuff associated
 67:                                      with a particular solver */
 68:   PetscInt        its;            /* number of iterations so far computed */
 69:   PetscInt        nv;             /* size of current Schur decomposition */
 70:   PetscInt        n,nloc;         /* problem dimensions (global, local) */
 71:   PetscInt        allocated_ncv;  /* number of basis vectors allocated */
 72:   PetscRandom     rand;           /* random number generator */
 73:   Vec             t;              /* template vector */

 75:   /* ---------------- Default work-area and status vars -------------------- */
 76:   PetscInt       nwork;
 77:   Vec            *work;

 79:   PetscInt       setupcalled;
 80:   MFNConvergedReason reason;

 82:   PetscErrorCode (*monitor[MAXMFNMONITORS])(MFN,PetscInt,PetscReal,void*);
 83:   PetscErrorCode (*monitordestroy[MAXMFNMONITORS])(void**);
 84:   void           *monitorcontext[MAXMFNMONITORS];
 85:   PetscInt       numbermonitors;
 86: };

 88: PETSC_INTERN PetscErrorCode MFNReset_Default(MFN);
 89: PETSC_INTERN PetscErrorCode MFNDefaultGetWork(MFN,PetscInt);
 90: PETSC_INTERN PetscErrorCode MFNDefaultFreeWork(MFN);
 91: PETSC_INTERN PetscErrorCode MFNAllocateSolution(MFN);
 92: PETSC_INTERN PetscErrorCode MFNFreeSolution(MFN);

 94: #endif
slepc-3.4.2.dfsg.orig/include/slepc-private/epsimpl.h0000644000175000017500000001674712211062077021475 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_EPSIMPL) #define _EPSIMPL #include #include PETSC_EXTERN PetscLogEvent EPS_SetUp,EPS_Solve; typedef struct _EPSOps *EPSOps; struct _EPSOps { PetscErrorCode (*solve)(EPS); PetscErrorCode (*setup)(EPS); PetscErrorCode (*setfromoptions)(EPS); PetscErrorCode (*publishoptions)(EPS); PetscErrorCode (*destroy)(EPS); PetscErrorCode (*reset)(EPS); PetscErrorCode (*view)(EPS,PetscViewer); PetscErrorCode (*backtransform)(EPS); PetscErrorCode (*computevectors)(EPS); }; /* Maximum number of monitors you can run with a single EPS */ #define MAXEPSMONITORS 5 /* Defines the EPS data structure. */ struct _p_EPS { PETSCHEADER(struct _EPSOps); /*------------------------- User parameters --------------------------*/ PetscInt max_it; /* maximum number of iterations */ PetscInt nev; /* number of eigenvalues to compute */ PetscInt ncv; /* number of basis vectors */ PetscInt mpd; /* maximum dimension of projected problem */ PetscInt nini,ninil; /* number of initial vectors (negative means not copied yet) */ PetscInt nds; /* number of basis vectors of deflation space */ PetscScalar target; /* target value */ PetscReal tol; /* tolerance */ EPSConv conv; /* convergence test */ EPSWhich which; /* which part of the spectrum to be sought */ PetscBool leftvecs; /* if left eigenvectors are requested */ PetscReal inta,intb; /* interval [a,b] for spectrum slicing */ EPSProblemType problem_type; /* which kind of problem to be solved */ EPSExtraction extraction; /* which kind of extraction to be applied */ EPSBalance balance; /* the balancing method */ PetscInt balance_its; /* number of iterations of the balancing method */ PetscReal balance_cutoff; /* cutoff value for balancing */ PetscReal nrma,nrmb; /* matrix norms */ PetscBool adaptive; /* whether matrix norms are adaptively improved */ PetscBool trueres; /* whether the true residual norm must be computed */ PetscBool trackall; /* whether all the residuals must be computed */ /*-------------- User-provided functions and contexts -----------------*/ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PetscErrorCode (*converged)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*); PetscErrorCode (*arbitrary)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*); void *comparisonctx; void *convergedctx; void *arbitraryctx; /*------------------------- Working data --------------------------*/ Vec D; /* diagonal matrix for balancing */ Vec *V; /* set of basis vectors and computed eigenvectors */ Vec *W; /* set of left basis vectors and computed left eigenvectors */ Vec *IS,*ISL; /* placeholder for references to user-provided initial space */ Vec *defl; /* deflation space */ PetscScalar *eigr,*eigi; /* real and imaginary parts of eigenvalues */ PetscReal *errest; /* error estimates */ PetscReal *errest_left; /* left error estimates */ PetscScalar *rr,*ri; /* values computed by user's arbitrary selection function */ ST st; /* spectral transformation object */ IP ip; /* innerproduct object */ DS ds; /* direct solver object */ void *data; /* placeholder for misc stuff associated with a particular solver */ PetscInt nconv; /* number of converged eigenvalues */ PetscInt its; /* number of iterations so far computed */ PetscInt *perm; /* permutation for eigenvalue ordering */ PetscInt nv; /* size of current Schur decomposition */ PetscInt n,nloc; /* problem dimensions (global, local) */ PetscInt allocated_ncv; /* number of basis vectors allocated */ PetscBool evecsavailable; /* computed eigenvectors */ PetscRandom rand; /* random number generator */ Vec t; /* template vector */ /* ---------------- Default work-area and status vars -------------------- */ PetscInt nwork; Vec *work; PetscBool ds_ortho; /* if defl vectors have been stored & orthonormalized */ PetscInt setupcalled; PetscBool isgeneralized; PetscBool ispositive; PetscBool ishermitian; EPSConvergedReason reason; PetscErrorCode (*monitor[MAXEPSMONITORS])(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*); PetscErrorCode (*monitordestroy[MAXEPSMONITORS])(void**); void *monitorcontext[MAXEPSMONITORS]; PetscInt numbermonitors; }; PETSC_INTERN PetscErrorCode EPSReset_Default(EPS); PETSC_INTERN PetscErrorCode EPSSetWhichEigenpairs_Default(EPS); PETSC_INTERN PetscErrorCode EPSAllocateSolution(EPS); PETSC_INTERN PetscErrorCode EPSFreeSolution(EPS); PETSC_INTERN PetscErrorCode EPSBackTransform_Default(EPS); PETSC_INTERN PetscErrorCode EPSComputeVectors_Default(EPS); PETSC_INTERN PetscErrorCode EPSComputeVectors_Hermitian(EPS); PETSC_INTERN PetscErrorCode EPSComputeVectors_Schur(EPS); PETSC_INTERN PetscErrorCode EPSComputeResidualNorm_Private(EPS,PetscScalar,PetscScalar,Vec,Vec,PetscReal*); PETSC_INTERN PetscErrorCode EPSComputeRelativeError_Private(EPS,PetscScalar,PetscScalar,Vec,Vec,PetscReal*); PETSC_INTERN PetscErrorCode EPSComputeRitzVector(EPS,PetscScalar*,PetscScalar*,Vec*,PetscInt,Vec,Vec); /* Private functions of the solver implementations */ PETSC_INTERN PetscErrorCode EPSBasicArnoldi(EPS,PetscBool,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscBool*); PETSC_INTERN PetscErrorCode EPSDelayedArnoldi(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscBool*); PETSC_INTERN PetscErrorCode EPSDelayedArnoldi1(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscBool*); PETSC_INTERN PetscErrorCode EPSKrylovConvergence(EPS,PetscBool,PetscInt,PetscInt,Vec*,PetscInt,PetscReal,PetscReal,PetscInt*); PETSC_INTERN PetscErrorCode EPSFullLanczos(EPS,PetscReal*,PetscReal*,Vec*,PetscInt,PetscInt*,Vec,PetscBool*); PETSC_INTERN PetscErrorCode EPSBuildBalance_Krylov(EPS); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/mfnimpl.h0000644000175000017500000000711712211062077021455 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_MFNIMPL) #define _MFNIMPL #include #include PETSC_EXTERN PetscLogEvent MFN_SetUp, MFN_Solve; typedef struct _MFNOps *MFNOps; struct _MFNOps { PetscErrorCode (*solve)(MFN,Vec,Vec); PetscErrorCode (*setup)(MFN); PetscErrorCode (*setfromoptions)(MFN); PetscErrorCode (*publishoptions)(MFN); PetscErrorCode (*destroy)(MFN); PetscErrorCode (*reset)(MFN); PetscErrorCode (*view)(MFN,PetscViewer); }; /* Maximum number of monitors you can run with a single MFN */ #define MAXMFNMONITORS 5 /* Defines the MFN data structure. */ struct _p_MFN { PETSCHEADER(struct _MFNOps); /*------------------------- User parameters --------------------------*/ PetscInt max_it; /* maximum number of iterations */ PetscInt ncv; /* number of basis vectors */ PetscReal tol; /* tolerance */ SlepcFunction function; /* which function to compute */ PetscScalar sfactor; /* scaling factor */ PetscBool errorifnotconverged; /* error out if MFNSolve() does not converge */ /*------------------------- Working data --------------------------*/ Mat A; /* the problem matrix */ Vec *V; /* set of basis vectors */ PetscReal errest; /* error estimate */ IP ip; /* innerproduct object */ DS ds; /* direct solver object */ void *data; /* placeholder for misc stuff associated with a particular solver */ PetscInt its; /* number of iterations so far computed */ PetscInt nv; /* size of current Schur decomposition */ PetscInt n,nloc; /* problem dimensions (global, local) */ PetscInt allocated_ncv; /* number of basis vectors allocated */ PetscRandom rand; /* random number generator */ Vec t; /* template vector */ /* ---------------- Default work-area and status vars -------------------- */ PetscInt nwork; Vec *work; PetscInt setupcalled; MFNConvergedReason reason; PetscErrorCode (*monitor[MAXMFNMONITORS])(MFN,PetscInt,PetscReal,void*); PetscErrorCode (*monitordestroy[MAXMFNMONITORS])(void**); void *monitorcontext[MAXMFNMONITORS]; PetscInt numbermonitors; }; PETSC_INTERN PetscErrorCode MFNReset_Default(MFN); PETSC_INTERN PetscErrorCode MFNDefaultGetWork(MFN,PetscInt); PETSC_INTERN PetscErrorCode MFNDefaultFreeWork(MFN); PETSC_INTERN PetscErrorCode MFNAllocateSolution(MFN); PETSC_INTERN PetscErrorCode MFNFreeSolution(MFN); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/vecimplslepc.h0000644000175000017500000001160212211062077022473 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #ifndef _VECIMPLSLEPC #define _VECIMPLSLEPC #include #include PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY; /* context for the storage of contiguous Vecs */ typedef struct { PetscScalar *array; /* pointer to common storage */ PetscInt nvecs; /* number of vectors that share this array */ } Vecs_Contiguous; #if !defined(PETSC_USE_DEBUG) #define SlepcValidVecsContiguous(V,m,arg) do {} while (0) #define SlepcValidVecComp(y) do {} while (0) #else #define SlepcValidVecsContiguous(V,m,arg) \ do { \ PetscErrorCode __ierr; \ PetscInt __i; \ PetscContainer __container; \ for (__i=0;__i<(m);__i++) { \ PetscValidHeaderSpecific((V)[__i],VEC_CLASSID,(arg)); \ __ierr = PetscObjectQuery((PetscObject)((V)[__i]),"contiguous",(PetscObject*)&__container);CHKERRQ(__ierr); \ if (!__container && (m)>1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Contiguous check failed in argument # %d",(arg)); \ } \ } while (0) #define SlepcValidVecComp(y) \ do { \ if (((Vec_Comp*)(y)->data)->nx < ((Vec_Comp*)(y)->data)->n->n) \ SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid number of subvectors required!"); \ } while (0) #endif /* Contexts for VecComp */ typedef struct { PetscInt n; /* number of active subvectors */ PetscInt N; /* virtual global size */ PetscInt lN; /* virtual local size */ PetscInt friends; /* number of vectors sharing this structure */ } Vec_Comp_N; typedef struct { Vec *x; /* the vectors */ PetscInt nx; /* number of available subvectors */ Vec_Comp_N *n; /* structure shared by friend vectors */ } Vec_Comp; /* Operations implemented in VecComp */ PETSC_INTERN PetscErrorCode VecDuplicateVecs_Comp(Vec,PetscInt,Vec*[]); PETSC_INTERN PetscErrorCode VecDestroyVecs_Comp(PetscInt,Vec[]); PETSC_INTERN PetscErrorCode VecDuplicate_Comp(Vec,Vec*); PETSC_INTERN PetscErrorCode VecDestroy_Comp(Vec); PETSC_INTERN PetscErrorCode VecSet_Comp(Vec,PetscScalar); PETSC_INTERN PetscErrorCode VecView_Comp(Vec,PetscViewer); PETSC_INTERN PetscErrorCode VecScale_Comp(Vec,PetscScalar); PETSC_INTERN PetscErrorCode VecCopy_Comp(Vec,Vec); PETSC_INTERN PetscErrorCode VecSwap_Comp(Vec,Vec); PETSC_INTERN PetscErrorCode VecAXPY_Comp(Vec,PetscScalar,Vec); PETSC_INTERN PetscErrorCode VecAYPX_Comp(Vec,PetscScalar,Vec); PETSC_INTERN PetscErrorCode VecAXPBY_Comp(Vec,PetscScalar,PetscScalar,Vec); PETSC_INTERN PetscErrorCode VecMAXPY_Comp(Vec,PetscInt,const PetscScalar*,Vec*); PETSC_INTERN PetscErrorCode VecWAXPY_Comp(Vec,PetscScalar,Vec,Vec); PETSC_INTERN PetscErrorCode VecAXPBYPCZ_Comp(Vec,PetscScalar,PetscScalar,PetscScalar,Vec,Vec); PETSC_INTERN PetscErrorCode VecPointwiseMult_Comp(Vec,Vec,Vec); PETSC_INTERN PetscErrorCode VecPointwiseDivide_Comp(Vec,Vec,Vec); PETSC_INTERN PetscErrorCode VecGetSize_Comp(Vec,PetscInt*); PETSC_INTERN PetscErrorCode VecGetLocalSize_Comp(Vec,PetscInt*); PETSC_INTERN PetscErrorCode VecMax_Comp(Vec,PetscInt*,PetscReal*); PETSC_INTERN PetscErrorCode VecMin_Comp(Vec,PetscInt*,PetscReal*); PETSC_INTERN PetscErrorCode VecSetRandom_Comp(Vec,PetscRandom); PETSC_INTERN PetscErrorCode VecConjugate_Comp(Vec); PETSC_INTERN PetscErrorCode VecReciprocal_Comp(Vec); PETSC_INTERN PetscErrorCode VecMaxPointwiseDivide_Comp(Vec,Vec,PetscReal*); PETSC_INTERN PetscErrorCode VecPointwiseMax_Comp(Vec,Vec,Vec); PETSC_INTERN PetscErrorCode VecPointwiseMaxAbs_Comp(Vec,Vec,Vec); PETSC_INTERN PetscErrorCode VecPointwiseMin_Comp(Vec,Vec,Vec); PETSC_INTERN PetscErrorCode VecDotNorm2_Comp_Seq(Vec,Vec,PetscScalar*,PetscScalar*); PETSC_INTERN PetscErrorCode VecDotNorm2_Comp_MPI(Vec,Vec,PetscScalar*,PetscScalar*); PETSC_INTERN PetscErrorCode VecSqrtAbs_Comp(Vec); PETSC_INTERN PetscErrorCode VecAbs_Comp(Vec); PETSC_INTERN PetscErrorCode VecExp_Comp(Vec); PETSC_INTERN PetscErrorCode VecLog_Comp(Vec); PETSC_INTERN PetscErrorCode VecShift_Comp(Vec,PetscScalar); PETSC_EXTERN PetscErrorCode VecCreate_Comp(Vec); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/ipimpl.h0000644000175000017500000000452512211062077021305 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_IPIMPL) #define _IPIMPL #include #include PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix; typedef struct _IPOps *IPOps; struct _IPOps { PetscErrorCode (*normbegin)(IP,Vec,PetscReal*); PetscErrorCode (*normend)(IP,Vec,PetscReal*); PetscErrorCode (*innerproductbegin)(IP,Vec,Vec,PetscScalar*); PetscErrorCode (*innerproductend)(IP,Vec,Vec,PetscScalar*); PetscErrorCode (*minnerproductbegin)(IP,Vec,PetscInt,const Vec[],PetscScalar*); PetscErrorCode (*minnerproductend)(IP,Vec,PetscInt,const Vec[],PetscScalar*); }; struct _p_IP { PETSCHEADER(struct _IPOps); IPOrthogType orthog_type; /* which orthogonalization to use */ IPOrthogRefineType orthog_ref; /* refinement method */ PetscReal orthog_eta; /* refinement threshold */ Mat matrix; PetscInt innerproducts; PetscScalar *work; PetscInt lwork; /*------------------------- Cache Bx product -------------------*/ PetscInt xid; PetscInt xstate; Vec Bx; }; PETSC_INTERN PetscErrorCode IPSetType_Default(IP); PETSC_INTERN PetscErrorCode IPApplyMatrix_Private(IP,Vec); PETSC_INTERN PetscErrorCode IPOrthogonalizeCGS1(IP,PetscInt,Vec*,PetscInt,PetscBool*,Vec*,Vec,PetscScalar*,PetscReal*,PetscReal*); PETSC_INTERN PetscErrorCode IPOrthonormalizeBasis_Private(IP,PetscInt*,Vec**,Vec*); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/dsimpl.h0000644000175000017500000001226712211062077021305 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_DSIMPL) #define _DSIMPL #include #include PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other; PETSC_INTERN const char *DSMatName[]; typedef struct _DSOps *DSOps; struct _DSOps { PetscErrorCode (*allocate)(DS,PetscInt); PetscErrorCode (*view)(DS,PetscViewer); PetscErrorCode (*vectors)(DS,DSMatType,PetscInt*,PetscReal*); PetscErrorCode (*solve[DS_MAX_SOLVE])(DS,PetscScalar*,PetscScalar*); PetscErrorCode (*computefun[SLEPC_FUNCTION_LAST][DS_MAX_FUN])(DS); PetscErrorCode (*sort)(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*); PetscErrorCode (*truncate)(DS,PetscInt); PetscErrorCode (*update)(DS); PetscErrorCode (*cond)(DS,PetscReal*); PetscErrorCode (*transharm)(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*); PetscErrorCode (*transrks)(DS,PetscScalar); PetscErrorCode (*normalize)(DS,DSMatType,PetscInt); }; struct _p_DS { PETSCHEADER(struct _DSOps); PetscInt method; /* identifies the variant to be used */ PetscInt funmethod; /* to choose among methods for function evaluation */ PetscBool compact; /* whether the matrices are stored in compact form */ PetscBool refined; /* get refined vectors instead of regular vectors */ PetscBool extrarow; /* assume the matrix dimension is (n+1) x n */ PetscInt ld; /* leading dimension */ PetscInt l; /* number of locked (inactive) leading columns */ PetscInt n; /* current dimension */ PetscInt m; /* current column dimension (for SVD only) */ PetscInt k; /* intermediate dimension (e.g. position of arrow) */ PetscInt t; /* length of decomposition when it was truncated */ DSStateType state; /* the current state */ PetscScalar *mat[DS_NUM_MAT]; /* the matrices */ PetscReal *rmat[DS_NUM_MAT]; /* the matrices (real) */ PetscInt *perm; /* permutation */ PetscInt nf; /* number of functions in f[] */ FN f[DS_NUM_EXTRA]; /* functions provided via DSSetFN() */ PetscScalar *work; PetscReal *rwork; PetscBLASInt *iwork; PetscInt lwork,lrwork,liwork; /*-------------- User-provided functions and contexts -----------------*/ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); void *comparisonctx; }; PETSC_INTERN PetscErrorCode DSAllocateMat_Private(DS,DSMatType); PETSC_INTERN PetscErrorCode DSAllocateMatReal_Private(DS,DSMatType); PETSC_INTERN PetscErrorCode DSAllocateWork_Private(DS,PetscInt,PetscInt,PetscInt); PETSC_INTERN PetscErrorCode DSViewMat_Private(DS,PetscViewer,DSMatType); PETSC_INTERN PetscErrorCode DSSortEigenvalues_Private(DS,PetscScalar*,PetscScalar*,PetscInt*,PetscBool); PETSC_INTERN PetscErrorCode DSSortEigenvaluesReal_Private(DS,PetscReal*,PetscInt*); PETSC_INTERN PetscErrorCode DSPermuteColumns_Private(DS,PetscInt,PetscInt,DSMatType,PetscInt*); PETSC_INTERN PetscErrorCode DSPermuteRows_Private(DS,PetscInt,PetscInt,DSMatType,PetscInt*); PETSC_INTERN PetscErrorCode DSPermuteBoth_Private(DS,PetscInt,PetscInt,DSMatType,DSMatType,PetscInt*); PETSC_INTERN PetscErrorCode DSCopyMatrix_Private(DS,DSMatType,DSMatType); PETSC_INTERN PetscErrorCode DSSetIdentity(DS,DSMatType); PETSC_INTERN PetscErrorCode DSComputeMatrix(DS,PetscScalar,PetscBool,DSMatType); PETSC_INTERN PetscErrorCode DSOrthogonalize(DS,DSMatType,PetscInt,PetscInt*); PETSC_INTERN PetscErrorCode DSPseudoOrthogonalize(DS,DSMatType,PetscInt,PetscReal*,PetscInt*,PetscReal*); PETSC_INTERN PetscErrorCode DSGHIEPOrthogEigenv(DS,DSMatType,PetscScalar*,PetscScalar*,PetscBool); PETSC_INTERN PetscErrorCode DSGHIEPComplexEigs(DS,PetscInt,PetscInt,PetscScalar*,PetscScalar*); PETSC_INTERN PetscErrorCode DSGHIEPInverseIteration(DS,PetscScalar*,PetscScalar*); PETSC_INTERN PetscErrorCode DSIntermediate_GHIEP(DS); PETSC_INTERN PetscErrorCode DSSwitchFormat_GHIEP(DS,PetscBool); PETSC_INTERN PetscErrorCode DSGHIEPRealBlocks(DS); PETSC_INTERN PetscErrorCode DSSolve_GHIEP_HZ(DS,PetscScalar*,PetscScalar*); PETSC_INTERN PetscErrorCode DSSolve_GHIEP_DQDS_II(DS,PetscScalar*,PetscScalar*); #endif slepc-3.4.2.dfsg.orig/include/slepc-private/nepimpl.h0000644000175000017500000001362312211062077021456 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(_NEPIMPL) #define _NEPIMPL #include #include PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval; typedef struct _NEPOps *NEPOps; struct _NEPOps { PetscErrorCode (*solve)(NEP); PetscErrorCode (*setup)(NEP); PetscErrorCode (*setfromoptions)(NEP); PetscErrorCode (*publishoptions)(NEP); PetscErrorCode (*destroy)(NEP); PetscErrorCode (*reset)(NEP); PetscErrorCode (*view)(NEP,PetscViewer); }; /* Maximum number of monitors you can run with a single NEP */ #define MAXNEPMONITORS 5 /* Defines the NEP data structure. */ struct _p_NEP { PETSCHEADER(struct _NEPOps); /*------------------------- User parameters --------------------------*/ PetscInt max_it; /* maximum number of iterations */ PetscInt max_funcs; /* maximum number of function evaluations */ PetscInt nev; /* number of eigenvalues to compute */ PetscInt ncv; /* number of basis vectors */ PetscInt mpd; /* maximum dimension of projected problem */ PetscInt lag; /* interval to rebuild preconditioner */ PetscInt nini; /* number of initial vectors (negative means not copied yet) */ PetscScalar target; /* target value */ PetscReal abstol,rtol,stol; /* user tolerances */ PetscReal ktol; /* tolerance for linear solver */ PetscBool cctol; /* constant correction tolerance */ PetscReal ttol; /* tolerance used in the convergence criterion */ PetscBool trackall; /* whether all the residuals must be computed */ NEPWhich which; /* which part of the spectrum to be sought */ PetscBool split; /* the nonlinear operator has been set in split form, otherwise user callbacks are used */ /*-------------- User-provided functions and contexts -----------------*/ PetscErrorCode (*computefunction)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*); PetscErrorCode (*computejacobian)(NEP,PetscScalar,Mat*,MatStructure*,void*); PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*); PetscErrorCode (*converged)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*); PetscErrorCode (*convergeddestroy)(void*); void *comparisonctx; void *convergedctx; Mat function,function_pre; void *functionctx; Mat jacobian; void *jacobianctx; PetscInt nt; /* number of terms in split form */ MatStructure mstr; /* pattern of split matrices */ Mat *A; /* matrix coefficients of split form */ FN *f; /* matrix functions of split form */ /*------------------------- Working data --------------------------*/ Vec *V; /* set of basis vectors and computed eigenvectors */ Vec *IS; /* placeholder for references to user-provided initial space */ PetscScalar *eig; /* computed eigenvalues */ PetscReal *errest; /* error estimates */ IP ip; /* innerproduct object */ DS ds; /* direct solver object */ KSP ksp; /* linear solver object */ void *data; /* placeholder for misc stuff associated with a particular solver */ PetscInt nconv; /* number of converged eigenvalues */ PetscInt its; /* number of iterations so far computed */ PetscInt *perm; /* permutation for eigenvalue ordering */ PetscInt nfuncs,linits; /* operation counters */ PetscInt n,nloc; /* problem dimensions (global, local) */ PetscRandom rand; /* random number generator */ Vec t; /* template vector */ PetscInt allocated_ncv; /* number of basis vectors allocated */ /* ---------------- Default work-area and status vars -------------------- */ PetscInt nwork; Vec *work; PetscInt setupcalled; NEPConvergedReason reason; PetscErrorCode (*monitor[MAXNEPMONITORS])(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*); PetscErrorCode (*monitordestroy[MAXNEPMONITORS])(void**); void *monitorcontext[MAXNEPMONITORS]; PetscInt numbermonitors; }; PETSC_INTERN PetscErrorCode NEPReset_Default(NEP); PETSC_INTERN PetscErrorCode NEPGetDefaultShift(NEP,PetscScalar*); PETSC_INTERN PetscErrorCode NEPAllocateSolution(NEP); PETSC_INTERN PetscErrorCode NEPFreeSolution(NEP); PETSC_INTERN PetscErrorCode NEP_KSPSolve(NEP,Vec,Vec); PETSC_INTERN PetscErrorCode NEPComputeResidualNorm_Private(NEP,PetscScalar,Vec,PetscReal*); PETSC_INTERN PetscErrorCode NEPComputeRelativeError_Private(NEP,PetscScalar,Vec,PetscReal*); #endif slepc-3.4.2.dfsg.orig/include/slepceps.h.html0000644000175000017500000017271412211062077020024 0ustar gladkgladk
Actual source code: slepceps.h

  1: /*
  2:    User interface for the SLEPC eigenproblem solvers.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepcst.h>
 27: #include <slepcip.h>
 28: #include <slepcds.h>

 30: PETSC_EXTERN PetscErrorCode EPSInitializePackage(void);

 32: /*S
 33:     EPS - Abstract SLEPc object that manages all the eigenvalue
 34:     problem solvers.

 36:     Level: beginner

 38: .seealso:  EPSCreate(), ST
 39: S*/
 40: typedef struct _p_EPS* EPS;

 42: /*J
 43:     EPSType - String with the name of a SLEPc eigensolver

 45:     Level: beginner

 47: .seealso: EPSSetType(), EPS
 48: J*/
 49: typedef const char* EPSType;
 50: #define EPSPOWER       "power"
 51: #define EPSSUBSPACE    "subspace"
 52: #define EPSARNOLDI     "arnoldi"
 53: #define EPSLANCZOS     "lanczos"
 54: #define EPSKRYLOVSCHUR "krylovschur"
 55: #define EPSGD          "gd"
 56: #define EPSJD          "jd"
 57: #define EPSRQCG        "rqcg"
 58: #define EPSCISS        "ciss"
 59: #define EPSLAPACK      "lapack"
 60: #define EPSARPACK      "arpack"
 61: #define EPSBLZPACK     "blzpack"
 62: #define EPSTRLAN       "trlan"
 63: #define EPSBLOPEX      "blopex"
 64: #define EPSPRIMME      "primme"
 65: #define EPSFEAST       "feast"

 67: /* Logging support */
 68: PETSC_EXTERN PetscClassId EPS_CLASSID;

 70: /*E
 71:     EPSProblemType - Determines the type of eigenvalue problem

 73:     Level: beginner

 75: .seealso: EPSSetProblemType(), EPSGetProblemType()
 76: E*/
 77: typedef enum { EPS_HEP=1,
 78:                EPS_GHEP,
 79:                EPS_NHEP,
 80:                EPS_GNHEP,
 81:                EPS_PGNHEP,
 82:                EPS_GHIEP } EPSProblemType;

 84: /*E
 85:     EPSExtraction - Determines the type of extraction technique employed
 86:     by the eigensolver

 88:     Level: beginner

 90: .seealso: EPSSetExtraction(), EPSGetExtraction()
 91: E*/
 92: typedef enum { EPS_RITZ=1,
 93:                EPS_HARMONIC,
 94:                EPS_HARMONIC_RELATIVE,
 95:                EPS_HARMONIC_RIGHT,
 96:                EPS_HARMONIC_LARGEST,
 97:                EPS_REFINED,
 98:                EPS_REFINED_HARMONIC } EPSExtraction;

100: /*E
101:     EPSWhich - Determines which part of the spectrum is requested

103:     Level: intermediate

105: .seealso: EPSSetWhichEigenpairs(), EPSGetWhichEigenpairs()
106: E*/
107: typedef enum { EPS_LARGEST_MAGNITUDE=1,
108:                EPS_SMALLEST_MAGNITUDE,
109:                EPS_LARGEST_REAL,
110:                EPS_SMALLEST_REAL,
111:                EPS_LARGEST_IMAGINARY,
112:                EPS_SMALLEST_IMAGINARY,
113:                EPS_TARGET_MAGNITUDE,
114:                EPS_TARGET_REAL,
115:                EPS_TARGET_IMAGINARY,
116:                EPS_ALL,
117:                EPS_WHICH_USER } EPSWhich;

119: /*E
120:     EPSBalance - The type of balancing used for non-Hermitian problems

122:     Level: intermediate

124: .seealso: EPSSetBalance()
125: E*/
126: typedef enum { EPS_BALANCE_NONE=1,
127:                EPS_BALANCE_ONESIDE,
128:                EPS_BALANCE_TWOSIDE,
129:                EPS_BALANCE_USER } EPSBalance;

131: /*E
132:     EPSConv - Determines the convergence test

134:     Level: intermediate

136: .seealso: EPSSetConvergenceTest(), EPSSetConvergenceTestFunction()
137: E*/
138: typedef enum { EPS_CONV_ABS=1,
139:                EPS_CONV_EIG,
140:                EPS_CONV_NORM,
141:                EPS_CONV_USER } EPSConv;

143: PETSC_EXTERN PetscErrorCode EPSCreate(MPI_Comm,EPS *);
144: PETSC_EXTERN PetscErrorCode EPSDestroy(EPS*);
145: PETSC_EXTERN PetscErrorCode EPSReset(EPS);
146: PETSC_EXTERN PetscErrorCode EPSSetType(EPS,EPSType);
147: PETSC_EXTERN PetscErrorCode EPSGetType(EPS,EPSType*);
148: PETSC_EXTERN PetscErrorCode EPSSetProblemType(EPS,EPSProblemType);
149: PETSC_EXTERN PetscErrorCode EPSGetProblemType(EPS,EPSProblemType*);
150: PETSC_EXTERN PetscErrorCode EPSSetExtraction(EPS,EPSExtraction);
151: PETSC_EXTERN PetscErrorCode EPSGetExtraction(EPS,EPSExtraction*);
152: PETSC_EXTERN PetscErrorCode EPSSetBalance(EPS,EPSBalance,PetscInt,PetscReal);
153: PETSC_EXTERN PetscErrorCode EPSGetBalance(EPS,EPSBalance*,PetscInt*,PetscReal*);
154: PETSC_EXTERN PetscErrorCode EPSSetOperators(EPS,Mat,Mat);
155: PETSC_EXTERN PetscErrorCode EPSGetOperators(EPS,Mat*,Mat*);
156: PETSC_EXTERN PetscErrorCode EPSSetFromOptions(EPS);
157: PETSC_EXTERN PetscErrorCode EPSSetUp(EPS);
158: PETSC_EXTERN PetscErrorCode EPSSolve(EPS);
159: PETSC_EXTERN PetscErrorCode EPSView(EPS,PetscViewer);
160: PETSC_EXTERN PetscErrorCode EPSPrintSolution(EPS,PetscViewer);

162: PETSC_EXTERN PetscErrorCode EPSSetTarget(EPS,PetscScalar);
163: PETSC_EXTERN PetscErrorCode EPSGetTarget(EPS,PetscScalar*);
164: PETSC_EXTERN PetscErrorCode EPSSetInterval(EPS,PetscReal,PetscReal);
165: PETSC_EXTERN PetscErrorCode EPSGetInterval(EPS,PetscReal*,PetscReal*);
166: PETSC_EXTERN PetscErrorCode EPSSetST(EPS,ST);
167: PETSC_EXTERN PetscErrorCode EPSGetST(EPS,ST*);
168: PETSC_EXTERN PetscErrorCode EPSSetIP(EPS,IP);
169: PETSC_EXTERN PetscErrorCode EPSGetIP(EPS,IP*);
170: PETSC_EXTERN PetscErrorCode EPSSetDS(EPS,DS);
171: PETSC_EXTERN PetscErrorCode EPSGetDS(EPS,DS*);
172: PETSC_EXTERN PetscErrorCode EPSSetTolerances(EPS,PetscReal,PetscInt);
173: PETSC_EXTERN PetscErrorCode EPSGetTolerances(EPS,PetscReal*,PetscInt*);
174: PETSC_EXTERN PetscErrorCode EPSSetConvergenceTestFunction(EPS,PetscErrorCode (*)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*);
175: PETSC_EXTERN PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv);
176: PETSC_EXTERN PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv);
177: PETSC_EXTERN PetscErrorCode EPSConvergedEigRelative(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
178: PETSC_EXTERN PetscErrorCode EPSConvergedAbsolute(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
179: PETSC_EXTERN PetscErrorCode EPSConvergedNormRelative(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
180: PETSC_EXTERN PetscErrorCode EPSSetDimensions(EPS,PetscInt,PetscInt,PetscInt);
181: PETSC_EXTERN PetscErrorCode EPSGetDimensions(EPS,PetscInt*,PetscInt*,PetscInt*);

183: PETSC_EXTERN PetscErrorCode EPSGetConverged(EPS,PetscInt*);
184: PETSC_EXTERN PetscErrorCode EPSGetEigenpair(EPS,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);
185: PETSC_EXTERN PetscErrorCode EPSGetEigenvalue(EPS,PetscInt,PetscScalar*,PetscScalar*);
186: PETSC_EXTERN PetscErrorCode EPSGetEigenvector(EPS,PetscInt,Vec,Vec);
187: PETSC_EXTERN PetscErrorCode EPSGetEigenvectorLeft(EPS,PetscInt,Vec,Vec);
188: PETSC_EXTERN PetscErrorCode EPSComputeRelativeError(EPS,PetscInt,PetscReal*);
189: PETSC_EXTERN PetscErrorCode EPSComputeRelativeErrorLeft(EPS,PetscInt,PetscReal*);
190: PETSC_EXTERN PetscErrorCode EPSComputeResidualNorm(EPS,PetscInt,PetscReal*);
191: PETSC_EXTERN PetscErrorCode EPSComputeResidualNormLeft(EPS,PetscInt,PetscReal*);
192: PETSC_EXTERN PetscErrorCode EPSGetInvariantSubspace(EPS,Vec*);
193: PETSC_EXTERN PetscErrorCode EPSGetInvariantSubspaceLeft(EPS,Vec*);
194: PETSC_EXTERN PetscErrorCode EPSGetErrorEstimate(EPS,PetscInt,PetscReal*);
195: PETSC_EXTERN PetscErrorCode EPSGetErrorEstimateLeft(EPS,PetscInt,PetscReal*);

197: PETSC_EXTERN PetscErrorCode EPSMonitor(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt);
198: PETSC_EXTERN PetscErrorCode EPSMonitorSet(EPS,PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
199: PETSC_EXTERN PetscErrorCode EPSMonitorCancel(EPS);
200: PETSC_EXTERN PetscErrorCode EPSGetMonitorContext(EPS,void **);
201: PETSC_EXTERN PetscErrorCode EPSGetIterationNumber(EPS,PetscInt*);
202: PETSC_EXTERN PetscErrorCode EPSGetOperationCounters(EPS,PetscInt*,PetscInt*,PetscInt*);

204: PETSC_EXTERN PetscErrorCode EPSSetWhichEigenpairs(EPS,EPSWhich);
205: PETSC_EXTERN PetscErrorCode EPSGetWhichEigenpairs(EPS,EPSWhich*);
206: PETSC_EXTERN PetscErrorCode EPSSetLeftVectorsWanted(EPS,PetscBool);
207: PETSC_EXTERN PetscErrorCode EPSGetLeftVectorsWanted(EPS,PetscBool*);
208: PETSC_EXTERN PetscErrorCode EPSSetMatrixNorms(EPS,PetscReal,PetscReal,PetscBool);
209: PETSC_EXTERN PetscErrorCode EPSGetMatrixNorms(EPS,PetscReal*,PetscReal*,PetscBool*);
210: PETSC_EXTERN PetscErrorCode EPSSetTrueResidual(EPS,PetscBool);
211: PETSC_EXTERN PetscErrorCode EPSGetTrueResidual(EPS,PetscBool*);
212: PETSC_EXTERN PetscErrorCode EPSSetEigenvalueComparison(EPS,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);
213: PETSC_EXTERN PetscErrorCode EPSSetArbitrarySelection(EPS,PetscErrorCode (*func)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*),void*);
214: PETSC_EXTERN PetscErrorCode EPSIsGeneralized(EPS,PetscBool*);
215: PETSC_EXTERN PetscErrorCode EPSIsHermitian(EPS,PetscBool*);
216: PETSC_EXTERN PetscErrorCode EPSIsPositive(EPS,PetscBool*);

218: PETSC_EXTERN PetscErrorCode EPSMonitorFirst(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
219: PETSC_EXTERN PetscErrorCode EPSMonitorAll(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
220: PETSC_EXTERN PetscErrorCode EPSMonitorConverged(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
221: PETSC_EXTERN PetscErrorCode EPSMonitorLG(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
222: PETSC_EXTERN PetscErrorCode EPSMonitorLGAll(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);

224: PETSC_EXTERN PetscErrorCode EPSSetTrackAll(EPS,PetscBool);
225: PETSC_EXTERN PetscErrorCode EPSGetTrackAll(EPS,PetscBool*);

227: PETSC_EXTERN PetscErrorCode EPSSetDeflationSpace(EPS,PetscInt,Vec*);
228: PETSC_EXTERN PetscErrorCode EPSRemoveDeflationSpace(EPS);
229: PETSC_EXTERN PetscErrorCode EPSSetInitialSpace(EPS,PetscInt,Vec*);
230: PETSC_EXTERN PetscErrorCode EPSSetInitialSpaceLeft(EPS,PetscInt,Vec*);

232: PETSC_EXTERN PetscErrorCode EPSSetOptionsPrefix(EPS,const char*);
233: PETSC_EXTERN PetscErrorCode EPSAppendOptionsPrefix(EPS,const char*);
234: PETSC_EXTERN PetscErrorCode EPSGetOptionsPrefix(EPS,const char*[]);

236: /*E
237:     EPSConvergedReason - Reason an eigensolver was said to
238:          have converged or diverged

240:     Level: beginner

242: .seealso: EPSSolve(), EPSGetConvergedReason(), EPSSetTolerances()
243: E*/
244: typedef enum {/* converged */
245:               EPS_CONVERGED_TOL                =  2,
246:               /* diverged */
247:               EPS_DIVERGED_ITS                 = -3,
248:               EPS_DIVERGED_BREAKDOWN           = -4,
249:               EPS_CONVERGED_ITERATING          =  0} EPSConvergedReason;

251: PETSC_EXTERN PetscErrorCode EPSGetConvergedReason(EPS,EPSConvergedReason *);

253: PETSC_EXTERN PetscErrorCode EPSSortEigenvalues(EPS,PetscInt,PetscScalar*,PetscScalar*,PetscInt*);
254: PETSC_EXTERN PetscErrorCode EPSCompareEigenvalues(EPS,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*);

256: PETSC_EXTERN PetscErrorCode EPSGetStartVector(EPS,PetscInt,Vec,PetscBool*);
257: PETSC_EXTERN PetscErrorCode EPSGetStartVectorLeft(EPS,PetscInt,Vec,PetscBool*);

259: PETSC_EXTERN PetscFunctionList EPSList;
260: PETSC_EXTERN PetscBool         EPSRegisterAllCalled;
261: PETSC_EXTERN PetscErrorCode EPSRegisterAll(void);
262: PETSC_EXTERN PetscErrorCode EPSRegister(const char[],PetscErrorCode(*)(EPS));

264: PETSC_EXTERN PetscErrorCode EPSSetWorkVecs(EPS,PetscInt);

266: /* --------- options specific to particular eigensolvers -------- */

268: /*E
269:     EPSPowerShiftType - determines the type of shift used in the Power iteration

271:     Level: advanced

273: .seealso: EPSPowerSetShiftType(), EPSPowerGetShiftType()
274: E*/
275: typedef enum { EPS_POWER_SHIFT_CONSTANT,
276:                EPS_POWER_SHIFT_RAYLEIGH,
277:                EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType;
278: PETSC_EXTERN const char *EPSPowerShiftTypes[];

280: PETSC_EXTERN PetscErrorCode EPSPowerSetShiftType(EPS,EPSPowerShiftType);
281: PETSC_EXTERN PetscErrorCode EPSPowerGetShiftType(EPS,EPSPowerShiftType*);

283: PETSC_EXTERN PetscErrorCode EPSArnoldiSetDelayed(EPS,PetscBool);
284: PETSC_EXTERN PetscErrorCode EPSArnoldiGetDelayed(EPS,PetscBool*);

286: PETSC_EXTERN PetscErrorCode EPSKrylovSchurSetRestart(EPS,PetscReal);
287: PETSC_EXTERN PetscErrorCode EPSKrylovSchurGetRestart(EPS,PetscReal*);

289: /*E
290:     EPSLanczosReorthogType - determines the type of reorthogonalization
291:     used in the Lanczos method

293:     Level: advanced

295: .seealso: EPSLanczosSetReorthog(), EPSLanczosGetReorthog()
296: E*/
297: typedef enum { EPS_LANCZOS_REORTHOG_LOCAL,
298:                EPS_LANCZOS_REORTHOG_FULL,
299:                EPS_LANCZOS_REORTHOG_SELECTIVE,
300:                EPS_LANCZOS_REORTHOG_PERIODIC,
301:                EPS_LANCZOS_REORTHOG_PARTIAL,
302:                EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType;
303: PETSC_EXTERN const char *EPSLanczosReorthogTypes[];

305: PETSC_EXTERN PetscErrorCode EPSLanczosSetReorthog(EPS,EPSLanczosReorthogType);
306: PETSC_EXTERN PetscErrorCode EPSLanczosGetReorthog(EPS,EPSLanczosReorthogType*);

308: PETSC_EXTERN PetscErrorCode EPSBlzpackSetBlockSize(EPS,PetscInt);
309: PETSC_EXTERN PetscErrorCode EPSBlzpackSetNSteps(EPS,PetscInt);

311: /*E
312:     EPSPRIMMEMethod - determines the method selected in the PRIMME library

314:     Level: advanced

316: .seealso: EPSPRIMMESetMethod(), EPSPRIMMEGetMethod()
317: E*/
318: typedef enum { EPS_PRIMME_DYNAMIC,
319:                EPS_PRIMME_DEFAULT_MIN_TIME,
320:                EPS_PRIMME_DEFAULT_MIN_MATVECS,
321:                EPS_PRIMME_ARNOLDI,
322:                EPS_PRIMME_GD,
323:                EPS_PRIMME_GD_PLUSK,
324:                EPS_PRIMME_GD_OLSEN_PLUSK,
325:                EPS_PRIMME_JD_OLSEN_PLUSK,
326:                EPS_PRIMME_RQI,
327:                EPS_PRIMME_JDQR,
328:                EPS_PRIMME_JDQMR,
329:                EPS_PRIMME_JDQMR_ETOL,
330:                EPS_PRIMME_SUBSPACE_ITERATION,
331:                EPS_PRIMME_LOBPCG_ORTHOBASIS,
332:                EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod;
333: PETSC_EXTERN const char *EPSPRIMMEMethods[];

335: PETSC_EXTERN PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs);
336: PETSC_EXTERN PetscErrorCode EPSPRIMMESetMethod(EPS eps, EPSPRIMMEMethod method);
337: PETSC_EXTERN PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs);
338: PETSC_EXTERN PetscErrorCode EPSPRIMMEGetMethod(EPS eps, EPSPRIMMEMethod *method);

340: /*E
341:     EPSOrthType - determines the orthogonalization used in the search subspace

343:     Level: advanced

345: .seealso: EPSGDSetBOrth(), EPSJDSetBOrth()
346: E*/
347: typedef enum { EPS_ORTH_I=1,
348:                EPS_ORTH_B,
349:                EPS_ORTH_BOPT } EPSOrthType;

351: PETSC_EXTERN PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart);
352: PETSC_EXTERN PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart);
353: PETSC_EXTERN PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize);
354: PETSC_EXTERN PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize);
355: PETSC_EXTERN PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk);
356: PETSC_EXTERN PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk);
357: PETSC_EXTERN PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize);
358: PETSC_EXTERN PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize);
359: PETSC_EXTERN PetscErrorCode EPSGDSetBOrth(EPS eps,EPSOrthType borth);
360: PETSC_EXTERN PetscErrorCode EPSGDGetBOrth(EPS eps,EPSOrthType *borth);
361: PETSC_EXTERN PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow);
362: PETSC_EXTERN PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow);
363: PETSC_EXTERN PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool use_gd2);
364: PETSC_EXTERN PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *flg);

366: PETSC_EXTERN PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart);
367: PETSC_EXTERN PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscBool *krylovstart);
368: PETSC_EXTERN PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize);
369: PETSC_EXTERN PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize);
370: PETSC_EXTERN PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk);
371: PETSC_EXTERN PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk);
372: PETSC_EXTERN PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize);
373: PETSC_EXTERN PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize);
374: PETSC_EXTERN PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix);
375: PETSC_EXTERN PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix);
376: PETSC_EXTERN PetscErrorCode EPSJDSetConstCorrectionTol(EPS eps,PetscBool dynamic);
377: PETSC_EXTERN PetscErrorCode EPSJDGetConstCorrectionTol(EPS eps,PetscBool *dynamic);
378: PETSC_EXTERN PetscErrorCode EPSJDSetBOrth(EPS eps,EPSOrthType borth);
379: PETSC_EXTERN PetscErrorCode EPSJDGetBOrth(EPS eps,EPSOrthType *borth);
380: PETSC_EXTERN PetscErrorCode EPSJDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow);
381: PETSC_EXTERN PetscErrorCode EPSJDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow);

383: PETSC_EXTERN PetscErrorCode EPSRQCGSetReset(EPS,PetscInt);
384: PETSC_EXTERN PetscErrorCode EPSRQCGGetReset(EPS,PetscInt*);

386: PETSC_EXTERN PetscErrorCode EPSCISSSetRegion(EPS,PetscScalar,PetscReal,PetscReal);
387: PETSC_EXTERN PetscErrorCode EPSCISSGetRegion(EPS,PetscScalar*,PetscReal*,PetscReal*);
388: PETSC_EXTERN PetscErrorCode EPSCISSSetSizes(EPS,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscBool);
389: PETSC_EXTERN PetscErrorCode EPSCISSGetSizes(EPS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscBool*);
390: PETSC_EXTERN PetscErrorCode EPSCISSSetThreshold(EPS,PetscReal,PetscReal);
391: PETSC_EXTERN PetscErrorCode EPSCISSGetThreshold(EPS,PetscReal*,PetscReal*);
392: PETSC_EXTERN PetscErrorCode EPSCISSSetRefinement(EPS,PetscInt,PetscInt,PetscInt);
393: PETSC_EXTERN PetscErrorCode EPSCISSGetRefinement(EPS,PetscInt*,PetscInt*,PetscInt*);

395: PETSC_EXTERN PetscErrorCode EPSFEASTSetNumPoints(EPS,PetscInt);
396: PETSC_EXTERN PetscErrorCode EPSFEASTGetNumPoints(EPS,PetscInt*);

398: #endif

slepc-3.4.2.dfsg.orig/include/slepcqep.h.html0000644000175000017500000007042512211062077020016 0ustar gladkgladk
Actual source code: slepcqep.h

  1: /*
  2:    User interface for SLEPc's quadratic eigenvalue solvers.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

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

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

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

 26: #include <slepceps.h>

 28: PETSC_EXTERN PetscErrorCode QEPInitializePackage(void);

 30: /*S
 31:      QEP - Abstract SLEPc object that manages all the quadratic eigenvalue
 32:      problem solvers.

 34:    Level: beginner

 36: .seealso:  QEPCreate()
 37: S*/
 38: typedef struct _p_QEP* QEP;

 40: /*J
 41:     QEPType - String with the name of a quadratic eigensolver

 43:    Level: beginner

 45: .seealso: QEPSetType(), QEP
 46: J*/
 47: typedef const char* QEPType;
 48: #define QEPLINEAR    "linear"
 49: #define QEPQARNOLDI  "qarnoldi"
 50: #define QEPQLANCZOS  "qlanczos"

 52: /* Logging support */
 53: PETSC_EXTERN PetscClassId QEP_CLASSID;

 55: /*E
 56:     QEPProblemType - Determines the type of the quadratic eigenproblem

 58:     Level: intermediate

 60: .seealso: QEPSetProblemType(), QEPGetProblemType()
 61: E*/
 62: typedef enum { QEP_GENERAL=1,
 63:                QEP_HERMITIAN,   /* M, C, K  Hermitian */
 64:                QEP_GYROSCOPIC   /* M, K  Hermitian, M>0, C skew-Hermitian */
 65:              } QEPProblemType;

 67: /*E
 68:     QEPWhich - Determines which part of the spectrum is requested

 70:     Level: intermediate

 72: .seealso: QEPSetWhichEigenpairs(), QEPGetWhichEigenpairs()
 73: E*/
 74: typedef enum { QEP_LARGEST_MAGNITUDE=1,
 75:                QEP_SMALLEST_MAGNITUDE,
 76:                QEP_LARGEST_REAL,
 77:                QEP_SMALLEST_REAL,
 78:                QEP_LARGEST_IMAGINARY,
 79:                QEP_SMALLEST_IMAGINARY,
 80:                QEP_TARGET_MAGNITUDE,
 81:                QEP_TARGET_REAL,
 82:                QEP_TARGET_IMAGINARY} QEPWhich;

 84: PETSC_EXTERN PetscErrorCode QEPCreate(MPI_Comm,QEP*);
 85: PETSC_EXTERN PetscErrorCode QEPDestroy(QEP*);
 86: PETSC_EXTERN PetscErrorCode QEPReset(QEP);
 87: PETSC_EXTERN PetscErrorCode QEPSetType(QEP,QEPType);
 88: PETSC_EXTERN PetscErrorCode QEPGetType(QEP,QEPType*);
 89: PETSC_EXTERN PetscErrorCode QEPSetProblemType(QEP,QEPProblemType);
 90: PETSC_EXTERN PetscErrorCode QEPGetProblemType(QEP,QEPProblemType*);
 91: PETSC_EXTERN PetscErrorCode QEPSetOperators(QEP,Mat,Mat,Mat);
 92: PETSC_EXTERN PetscErrorCode QEPGetOperators(QEP,Mat*,Mat*,Mat*);
 93: PETSC_EXTERN PetscErrorCode QEPSetTarget(QEP,PetscScalar);
 94: PETSC_EXTERN PetscErrorCode QEPGetTarget(QEP,PetscScalar*);
 95: PETSC_EXTERN PetscErrorCode QEPSetST(QEP,ST);
 96: PETSC_EXTERN PetscErrorCode QEPGetST(QEP,ST*);
 97: PETSC_EXTERN PetscErrorCode QEPSetFromOptions(QEP);
 98: PETSC_EXTERN PetscErrorCode QEPSetUp(QEP);
 99: PETSC_EXTERN PetscErrorCode QEPSolve(QEP);
100: PETSC_EXTERN PetscErrorCode QEPView(QEP,PetscViewer);
101: PETSC_EXTERN PetscErrorCode QEPPrintSolution(QEP,PetscViewer);

103: PETSC_EXTERN PetscErrorCode QEPSetIP(QEP,IP);
104: PETSC_EXTERN PetscErrorCode QEPGetIP(QEP,IP*);
105: PETSC_EXTERN PetscErrorCode QEPSetDS(QEP,DS);
106: PETSC_EXTERN PetscErrorCode QEPGetDS(QEP,DS*);
107: PETSC_EXTERN PetscErrorCode QEPSetTolerances(QEP,PetscReal,PetscInt);
108: PETSC_EXTERN PetscErrorCode QEPGetTolerances(QEP,PetscReal*,PetscInt*);
109: PETSC_EXTERN PetscErrorCode QEPSetConvergenceTest(QEP,PetscErrorCode (*)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*);
110: PETSC_EXTERN PetscErrorCode QEPConvergedDefault(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
111: PETSC_EXTERN PetscErrorCode QEPConvergedAbsolute(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
112: PETSC_EXTERN PetscErrorCode QEPSetDimensions(QEP,PetscInt,PetscInt,PetscInt);
113: PETSC_EXTERN PetscErrorCode QEPGetDimensions(QEP,PetscInt*,PetscInt*,PetscInt*);
114: PETSC_EXTERN PetscErrorCode QEPSetScaleFactor(QEP,PetscReal);
115: PETSC_EXTERN PetscErrorCode QEPGetScaleFactor(QEP,PetscReal*);

117: PETSC_EXTERN PetscErrorCode QEPGetConverged(QEP,PetscInt*);
118: PETSC_EXTERN PetscErrorCode QEPGetEigenpair(QEP,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);
119: PETSC_EXTERN PetscErrorCode QEPComputeRelativeError(QEP,PetscInt,PetscReal*);
120: PETSC_EXTERN PetscErrorCode QEPComputeResidualNorm(QEP,PetscInt,PetscReal*);
121: PETSC_EXTERN PetscErrorCode QEPGetErrorEstimate(QEP,PetscInt,PetscReal*);

123: PETSC_EXTERN PetscErrorCode QEPMonitor(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt);
124: PETSC_EXTERN PetscErrorCode QEPMonitorSet(QEP,PetscErrorCode (*)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
125: PETSC_EXTERN PetscErrorCode QEPMonitorCancel(QEP);
126: PETSC_EXTERN PetscErrorCode QEPGetMonitorContext(QEP,void **);
127: PETSC_EXTERN PetscErrorCode QEPGetIterationNumber(QEP,PetscInt*);
128: PETSC_EXTERN PetscErrorCode QEPGetOperationCounters(QEP,PetscInt*,PetscInt*,PetscInt*);

130: PETSC_EXTERN PetscErrorCode QEPSetInitialSpace(QEP,PetscInt,Vec*);
131: PETSC_EXTERN PetscErrorCode QEPSetInitialSpaceLeft(QEP,PetscInt,Vec*);
132: PETSC_EXTERN PetscErrorCode QEPSetWhichEigenpairs(QEP,QEPWhich);
133: PETSC_EXTERN PetscErrorCode QEPGetWhichEigenpairs(QEP,QEPWhich*);
134: PETSC_EXTERN PetscErrorCode QEPSetLeftVectorsWanted(QEP,PetscBool);
135: PETSC_EXTERN PetscErrorCode QEPGetLeftVectorsWanted(QEP,PetscBool*);
136: PETSC_EXTERN PetscErrorCode QEPSetEigenvalueComparison(QEP,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);

138: PETSC_EXTERN PetscErrorCode QEPMonitorAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
139: PETSC_EXTERN PetscErrorCode QEPMonitorFirst(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
140: PETSC_EXTERN PetscErrorCode QEPMonitorConverged(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
141: PETSC_EXTERN PetscErrorCode QEPMonitorLG(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
142: PETSC_EXTERN PetscErrorCode QEPMonitorLGAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);

144: PETSC_EXTERN PetscErrorCode QEPSetTrackAll(QEP,PetscBool);
145: PETSC_EXTERN PetscErrorCode QEPGetTrackAll(QEP,PetscBool*);

147: PETSC_EXTERN PetscErrorCode QEPSetOptionsPrefix(QEP,const char*);
148: PETSC_EXTERN PetscErrorCode QEPAppendOptionsPrefix(QEP,const char*);
149: PETSC_EXTERN PetscErrorCode QEPGetOptionsPrefix(QEP,const char*[]);

151: /*E
152:     QEPConvergedReason - Reason an eigensolver was said to
153:          have converged or diverged

155:     Level: beginner

157: .seealso: QEPSolve(), QEPGetConvergedReason(), QEPSetTolerances()
158: E*/
159: typedef enum {/* converged */
160:               QEP_CONVERGED_TOL                =  2,
161:               /* diverged */
162:               QEP_DIVERGED_ITS                 = -3,
163:               QEP_DIVERGED_BREAKDOWN           = -4,
164:               QEP_CONVERGED_ITERATING          =  0} QEPConvergedReason;

166: PETSC_EXTERN PetscErrorCode QEPGetConvergedReason(QEP,QEPConvergedReason *);

168: PETSC_EXTERN PetscErrorCode QEPSortEigenvalues(QEP,PetscInt,PetscScalar*,PetscScalar*,PetscInt*);
169: PETSC_EXTERN PetscErrorCode QEPCompareEigenvalues(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*);

171: PETSC_EXTERN PetscFunctionList QEPList;
172: PETSC_EXTERN PetscBool         QEPRegisterAllCalled;
173: PETSC_EXTERN PetscErrorCode QEPRegisterAll(void);
174: PETSC_EXTERN PetscErrorCode QEPRegister(const char[],PetscErrorCode(*)(QEP));

176: PETSC_EXTERN PetscErrorCode QEPSetWorkVecs(QEP,PetscInt);

178: /* --------- options specific to particular eigensolvers -------- */

180: PETSC_EXTERN PetscErrorCode QEPLinearSetCompanionForm(QEP,PetscInt);
181: PETSC_EXTERN PetscErrorCode QEPLinearGetCompanionForm(QEP,PetscInt*);
182: PETSC_EXTERN PetscErrorCode QEPLinearSetExplicitMatrix(QEP,PetscBool);
183: PETSC_EXTERN PetscErrorCode QEPLinearGetExplicitMatrix(QEP,PetscBool*);
184: PETSC_EXTERN PetscErrorCode QEPLinearSetEPS(QEP,EPS);
185: PETSC_EXTERN PetscErrorCode QEPLinearGetEPS(QEP,EPS*);

187: #endif

slepc-3.4.2.dfsg.orig/include/slepcblaslapack.h0000644000175000017500000012420512211062077020357 0ustar gladkgladk/* Necessary routines in BLAS and LAPACK not included in petscblaslapack.f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCBLASLAPACK_H) #define __SLEPCBLASLAPACK_H #include /* Macros for building LAPACK names */ #if defined(PETSC_BLASLAPACK_UNDERSCORE) #if defined(PETSC_USE_REAL_SINGLE) #define SLEPC_BLASLAPACKREAL(lcase,ucase) s##lcase##_ #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) c##lcase##_ #else #define SLEPC_BLASLAPACK(lcase,ucase) s##lcase##_ #endif #elif defined(PETSC_USE_REAL___FLOAT128) #define SLEPC_BLASLAPACKREAL(lcase,ucase) q##lcase##_ #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) w##lcase##_ #else #define SLEPC_BLASLAPACK(lcase,ucase) q##lcase##_ #endif #else #define SLEPC_BLASLAPACKREAL(lcase,ucase) d##lcase##_ #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) z##lcase##_ #else #define SLEPC_BLASLAPACK(lcase,ucase) d##lcase##_ #endif #endif #elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL) #if defined(PETSC_USE_REAL_SINGLE) #define SLEPC_BLASLAPACKREAL(lcase,ucase) S##ucase #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) C##ucase #else #define SLEPC_BLASLAPACK(lcase,ucase) S##ucase #endif #elif defined(PETSC_USE_REAL___FLOAT128) #define SLEPC_BLASLAPACKREAL(lcase,ucase) Q##ucase #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) W##ucase #else #define SLEPC_BLASLAPACK(lcase,ucase) Q##ucase #endif #else #define SLEPC_BLASLAPACKREAL(lcase,ucase) D##ucase #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) Z##ucase #else #define SLEPC_BLASLAPACK(lcase,ucase) D##ucase #endif #endif #else #if defined(PETSC_USE_REAL_SINGLE) #define SLEPC_BLASLAPACKREAL(lcase,ucase) s##lcase #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) c##lcase #else #define SLEPC_BLASLAPACK(lcase,ucase) s##lcase #endif #elif defined(PETSC_USE_REAL___FLOAT128) #define SLEPC_BLASLAPACKREAL(lcase,ucase) q##lcase #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) w##lcase #else #define SLEPC_BLASLAPACK(lcase,ucase) q##lcase #endif #else #define SLEPC_BLASLAPACKREAL(lcase,ucase) d##lcase #if defined(PETSC_USE_COMPLEX) #define SLEPC_BLASLAPACK(lcase,ucase) z##lcase #else #define SLEPC_BLASLAPACK(lcase,ucase) d##lcase #endif #endif #endif /* LAPACK functions without string parameters */ #define LAPACKlaev2_ SLEPC_BLASLAPACK(laev2,LAEV2) #define LAPACKgehrd_ SLEPC_BLASLAPACK(gehrd,GEHRD) #define LAPACKgetri_ SLEPC_BLASLAPACK(getri,GETRI) #define LAPACKgelqf_ SLEPC_BLASLAPACK(gelqf,GELQF) #define LAPACKtgexc_ SLEPC_BLASLAPACK(tgexc,TGEXC) #define LAPACKlarfg_ SLEPC_BLASLAPACK(larfg,LARFG) #define LAPACKlag2_ SLEPC_BLASLAPACKREAL(lag2,LAG2) #define LAPACKlasv2_ SLEPC_BLASLAPACKREAL(lasv2,LASV2) #define LAPACKlartg_ SLEPC_BLASLAPACKREAL(lartg,LARTG) #define LAPACKlaln2_ SLEPC_BLASLAPACKREAL(laln2,LALN2) #if !defined(PETSC_USE_COMPLEX) #define LAPACKorghr_ SLEPC_BLASLAPACK(orghr,ORGHR) #define LAPACKorgqr_ SLEPC_BLASLAPACK(orgqr,ORGQR) #else #define LAPACKorghr_ SLEPC_BLASLAPACK(unghr,UNGHR) #define LAPACKorgqr_ SLEPC_BLASLAPACK(ungqr,UNGQR) #endif /* the next one needs a special treatment due to the special names: srot, drot, csrot, zdrot */ #if !defined(PETSC_USE_COMPLEX) #define BLASrot_ SLEPC_BLASLAPACK(rot,ROT) #else #if defined(PETSC_USE_REAL_SINGLE) #define BLASrot_ SLEPC_BLASLAPACK(srot,SROT) #elif defined(PETSC_USE_REAL___FLOAT128) #define BLASrot_ SLEPC_BLASLAPACK(qrot,QROT) #else #define BLASrot_ SLEPC_BLASLAPACK(drot,DROT) #endif #endif /* LAPACK functions with string parameters */ #if !defined(PETSC_BLASLAPACK_STDCALL) /* same name for real and complex */ #define LAPACKlanhs_(a,b,c,d,e) SLEPC_BLASLAPACK(lanhs,LANHS) ((a),(b),(c),(d),(e),1) #define LAPACKlange_(a,b,c,d,e,f) SLEPC_BLASLAPACK(lange,LANGE) ((a),(b),(c),(d),(e),(f),1) #define LAPACKggevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac) SLEPC_BLASLAPACK(ggevx,GGEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),(z),(aa),(ab),(ac),1,1,1,1) #define LAPACKggev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(ggev,GGEV) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,1) #define LAPACKpbtrf_(a,b,c,d,e,f) SLEPC_BLASLAPACK(pbtrf,PBTRF) ((a),(b),(c),(d),(e),(f),1) #define LAPACKlarf_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(larf,LARF) ((a),(b),(c),(d),(e),(f),(g),(h),(i),1) /* subroutines in which we use only the real version, do not care whether they have different name */ #define LAPACKstevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) SLEPC_BLASLAPACKREAL(stevr,STEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),1,1) #define LAPACKbdsdc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1) #define LAPACKlamch_(a) SLEPC_BLASLAPACKREAL(lamch,LAMCH) ((a),1) #if !defined(PETSC_USE_COMPLEX) /* different name or signature, real */ #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1) #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(syevr,SYEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),1,1,1) #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(syevd,SYEVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),1,1) #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(sygvd,SYGVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1) #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(ormlq,ORMLQ) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1) #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(orgtr,ORGTR) ((a),(b),(c),(d),(e),(f),(g),(h),1) #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(sytrd,SYTRD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1) #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(trevc,TREVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1) #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,1,1) #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(trexc,TREXC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1) #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1) #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,1) #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),1,1,1) #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(stedc,STEDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),1) #else /* different name or signature, complex */ #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(hemm,HEMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1) #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(heevr,HEEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,1) #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(heevd,HEEVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1) #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(hegvd,HEGVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,1) #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(unmlq,UNMLQ) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1) #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(ungtr,UNGTR) ((a),(b),(c),(d),(e),(f),(g),(h),1) #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(hetrd,HETRD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1) #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(trevc,TREVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),1,1) #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),1,1,1,1) #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(trexc,TREXC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),1) #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),1) #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,1) #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),1,1,1) #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(stedc,STEDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1) #endif #else /* PETSC_BLASLAPACK_STDCALL */ /* same name for real and complex */ #define LAPACKlanhs_(a,b,c,d,e) SLEPC_BLASLAPACK(lanhs,LANHS) ((a),1,(b),(c),(d),(e)) #define LAPACKlange_(a,b,c,d,e,f) SLEPC_BLASLAPACK(lange,LANGE) ((a),1,(b),(c),(d),(e),(f)) #define LAPACKggevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac) SLEPC_BLASLAPACK(ggevx,GGEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),(z),(aa),(ab),(ac)) #define LAPACKggev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(ggev,GGEV) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q)) #define LAPACKpbtrf_(a,b,c,d,e,f) SLEPC_BLASLAPACK(pbtrf,PBTRF) ((a),1,(b),(c),(d),(e),(f)) #define LAPACKlarf_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(larf,LARF) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i)) /* subroutines in which we use only the real version, do not care whether they have different name */ #define LAPACKstevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) SLEPC_BLASLAPACKREAL(stevr,STEVR) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t)) #define LAPACKbdsdc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n)) #define LAPACKlamch_(a) SLEPC_BLASLAPACKREAL(lamch,LAMCH) ((a),1) #if !defined(PETSC_USE_COMPLEX) /* different name or signature, real */ #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l)) #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(syevr,SYEVR) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u)) #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(syevd,SYEVD) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k)) #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(sygvd,SYGVD) ((a),(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n)) #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(ormlq,ORMLQ) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m)) #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(orgtr,ORGTR) ((a),1,(b),(c),(d),(e),(f),(g),(h)) #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(sytrd,SYTRD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j)) #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(trevc,TREVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n)) #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w)) #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(trexc,TREXC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j)) #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n)) #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p)) #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s)) #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(stedc,STEDC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k)) #else /* different name or signature, complex */ #define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(hemm,HEMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l)) #define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(heevr,HEEVR) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w)) #define LAPACKsyevd_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(heevd,HEEVD) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m)) #define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(hegvd,HEGVD) ((a),(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p)) #define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(unmlq,UNMLQ) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m)) #define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACK(ungtr,UNGTR) ((a),1,(b),(c),(d),(e),(f),(g),(h)) #define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(hetrd,HETRD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j)) #define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(trevc,TREVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o)) #define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v)) #define LAPACKtrexc_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(trexc,TREXC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i)) #define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o)) #define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q)) #define LAPACKhsein_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) SLEPC_BLASLAPACK(hsein,HSEIN) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s)) #define LAPACKstedc_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(stedc,STEDC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m)) #endif #endif #if !defined(PETSC_BLASLAPACK_STDCALL) /* LAPACK functions without string parameters */ PETSC_EXTERN void SLEPC_BLASLAPACK(laev2,LAEV2) (PetscScalar*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*); PETSC_EXTERN void SLEPC_BLASLAPACK(gehrd,GEHRD) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(getri,GETRI) (PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(gelqf,GELQF) (PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(larfg,LARFG) (PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*); PETSC_EXTERN void SLEPC_BLASLAPACKREAL(lag2,LAG2) (PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*); PETSC_EXTERN void SLEPC_BLASLAPACKREAL(lasv2,LASV2) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*); PETSC_EXTERN void SLEPC_BLASLAPACKREAL(lartg,LARTG) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*); PETSC_EXTERN void SLEPC_BLASLAPACKREAL(laln2,LALN2) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*); PETSC_EXTERN void BLASrot_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*); #if !defined(PETSC_USE_COMPLEX) PETSC_EXTERN void SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(orghr,ORGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(orgqr,ORGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); #else PETSC_EXTERN void SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(unghr,UNGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void SLEPC_BLASLAPACK(ungqr,UNGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); #endif /* LAPACK functions with string parameters */ PETSC_EXTERN PetscReal SLEPC_BLASLAPACK(lanhs,LANHS) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt); PETSC_EXTERN PetscReal SLEPC_BLASLAPACK(lange,LANGE) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt); PETSC_EXTERN PetscReal SLEPC_BLASLAPACK(pbtrf,PBTRF) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(larf,LARF) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACKREAL(stevr,STEVR) (const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) (const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN PetscReal SLEPC_BLASLAPACKREAL(lamch,LAMCH) (const char*,PetscBLASInt); #if !defined(PETSC_USE_COMPLEX) PETSC_EXTERN void SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(ggev,GGEV) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(symm,SYMM) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(syevr,SYEVR) (const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(syevd,SYEVD) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(sygvd,SYGVD) (PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(ormlq,ORMLQ) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(orgtr,ORGTR) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(sytrd,SYTRD) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(trevc,TREVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); #else PETSC_EXTERN void SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*, PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(ggev,GGEV) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(hemm,HEMM) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(heevr,HEEVR) (const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(heevd,HEEVD) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(hegvd,HEGVD) (PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(unmlq,UNMLQ) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(ungtr,UNGTR) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(hetrd,HETRD) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(trevc,TREVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt); PETSC_EXTERN void SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt); #endif #else /* PETSC_BLASLAPACK_STDCALL */ /* LAPACK functions without string parameters */ PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(laev2,LAEV2) (PetscScalar*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gehrd,GEHRD) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(getri,GETRI) (PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gelqf,GELQF) (PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(larfg,LARFG) (PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lag2,LAG2) (PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lasv2,LASV2) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lartg,LARTG) (PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(laln2,LALN2) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL BLASrot_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*); #if !defined(PETSC_USE_COMPLEX) PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orghr,ORGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orgqr,ORGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); #else PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(unghr,UNGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ungqr,UNGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); #endif /* LAPACK functions with string parameters */ PETSC_EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(lanhs,LANHS) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*); PETSC_EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(lange,LANGE) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*); PETSC_EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(pbtrf,PBTRF) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(larf,LARF) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(stevr,STEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN PetscReal SLEPC_BLASLAPACKREAL(lamch,LAMCH) (const char*,PetscBLASInt); #if !defined(PETSC_USE_COMPLEX) PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggev,GGEV) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(symm,SYMM) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(syevr,SYEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(syevd,SYEVD) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(sygvd,SYGVD) (PetscBLASInt*,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ormlq,ORMLQ) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orgtr,ORGTR) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(sytrd,SYTRD) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trevc,TREVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); #else PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*, PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggev,GGEV) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hemm,HEMM) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(heevr,HEEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(heevd,HEEVD) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hegvd,HEGVD) (PetscBLASInt*,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(unmlq,UNMLQ) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ungtr,UNGTR) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hetrd,HETRD) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trevc,TREVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hsein,HSEIN) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); PETSC_EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(stedc,STEDC) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); #endif #endif #endif slepc-3.4.2.dfsg.orig/include/slepcds.h0000644000175000017500000001605712211062077016675 0ustar gladkgladk/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCDS_H) #define __SLEPCDS_H #include #define DS_MAX_SOLVE 6 #define DS_MAX_FUN 6 PETSC_EXTERN PetscErrorCode DSInitializePackage(void); /*S DS - Direct solver (or dense system), to represent low-dimensional eigenproblems that must be solved within iterative solvers. This is an auxiliary object and is not normally needed by application programmers. Level: beginner .seealso: DSCreate() S*/ typedef struct _p_DS* DS; /*J DSType - String with the name of the type of direct solver. Roughly, there are as many types as problem types are available within SLEPc. Level: advanced .seealso: DSSetType(), DS J*/ typedef const char* DSType; #define DSHEP "hep" #define DSNHEP "nhep" #define DSGHEP "ghep" #define DSGHIEP "ghiep" #define DSGNHEP "gnhep" #define DSSVD "svd" #define DSQEP "qep" #define DSNEP "nep" /* Logging support */ PETSC_EXTERN PetscClassId DS_CLASSID; /*E DSStateType - Indicates in which state the direct solver is Level: advanced .seealso: DSSetState() E*/ typedef enum { DS_STATE_RAW, DS_STATE_INTERMEDIATE, DS_STATE_CONDENSED, DS_STATE_TRUNCATED } DSStateType; /*E DSMatType - Used to refer to one of the matrices stored internally in DS Notes: The matrices preferently refer to + DS_MAT_A - first matrix of eigenproblem/singular value problem . DS_MAT_B - second matrix of a generalized eigenproblem . DS_MAT_C - third matrix of a quadratic eigenproblem . DS_MAT_T - tridiagonal matrix . DS_MAT_D - diagonal matrix . DS_MAT_F - result of matrix function . DS_MAT_Q - orthogonal matrix of (right) Schur vectors . DS_MAT_Z - orthogonal matrix of left Schur vectors . DS_MAT_X - right eigenvectors . DS_MAT_Y - left eigenvectors . DS_MAT_U - left singular vectors . DS_MAT_VT - right singular vectors . DS_MAT_W - workspace matrix - DS_MAT_Ex - extra matrices (x=0,..,9) All matrices can have space to hold ld x ld elements, except for DS_MAT_T that has space for 3 x ld elements (ld = leading dimension) and DS_MAT_D that has space for just ld elements. Level: advanced .seealso: DSAllocate(), DSGetArray(), DSGetArrayReal(), DSVectors() E*/ typedef enum { DS_MAT_A, DS_MAT_B, DS_MAT_C, DS_MAT_T, DS_MAT_D, DS_MAT_F, DS_MAT_Q, DS_MAT_Z, DS_MAT_X, DS_MAT_Y, DS_MAT_U, DS_MAT_VT, DS_MAT_W, DS_MAT_E0, DS_MAT_E1, DS_MAT_E2, DS_MAT_E3, DS_MAT_E4, DS_MAT_E5, DS_MAT_E6, DS_MAT_E7, DS_MAT_E8, DS_MAT_E9, DS_NUM_MAT } DSMatType; /* Convenience for indexing extra matrices */ PETSC_EXTERN DSMatType DSMatExtra[]; #define DS_NUM_EXTRA 10 PETSC_EXTERN PetscErrorCode DSCreate(MPI_Comm,DS*); PETSC_EXTERN PetscErrorCode DSSetType(DS,DSType); PETSC_EXTERN PetscErrorCode DSGetType(DS,DSType*); PETSC_EXTERN PetscErrorCode DSSetOptionsPrefix(DS,const char *); PETSC_EXTERN PetscErrorCode DSAppendOptionsPrefix(DS,const char *); PETSC_EXTERN PetscErrorCode DSGetOptionsPrefix(DS,const char *[]); PETSC_EXTERN PetscErrorCode DSSetFromOptions(DS); PETSC_EXTERN PetscErrorCode DSView(DS,PetscViewer); PETSC_EXTERN PetscErrorCode DSDestroy(DS*); PETSC_EXTERN PetscErrorCode DSReset(DS); PETSC_EXTERN PetscErrorCode DSAllocate(DS,PetscInt); PETSC_EXTERN PetscErrorCode DSGetLeadingDimension(DS,PetscInt*); PETSC_EXTERN PetscErrorCode DSSetState(DS,DSStateType); PETSC_EXTERN PetscErrorCode DSGetState(DS,DSStateType*); PETSC_EXTERN PetscErrorCode DSSetDimensions(DS,PetscInt,PetscInt,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode DSGetDimensions(DS,PetscInt*,PetscInt*,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode DSTruncate(DS,PetscInt); PETSC_EXTERN PetscErrorCode DSSetMethod(DS,PetscInt); PETSC_EXTERN PetscErrorCode DSGetMethod(DS,PetscInt*); PETSC_EXTERN PetscErrorCode DSSetFunctionMethod(DS,PetscInt); PETSC_EXTERN PetscErrorCode DSGetFunctionMethod(DS,PetscInt*); PETSC_EXTERN PetscErrorCode DSSetCompact(DS,PetscBool); PETSC_EXTERN PetscErrorCode DSGetCompact(DS,PetscBool*); PETSC_EXTERN PetscErrorCode DSSetExtraRow(DS,PetscBool); PETSC_EXTERN PetscErrorCode DSGetExtraRow(DS,PetscBool*); PETSC_EXTERN PetscErrorCode DSSetRefined(DS,PetscBool); PETSC_EXTERN PetscErrorCode DSGetRefined(DS,PetscBool*); PETSC_EXTERN PetscErrorCode DSGetArray(DS,DSMatType,PetscScalar *a[]); PETSC_EXTERN PetscErrorCode DSRestoreArray(DS,DSMatType,PetscScalar *a[]); PETSC_EXTERN PetscErrorCode DSGetArrayReal(DS,DSMatType,PetscReal *a[]); PETSC_EXTERN PetscErrorCode DSRestoreArrayReal(DS,DSMatType,PetscReal *a[]); PETSC_EXTERN PetscErrorCode DSVectors(DS,DSMatType,PetscInt*,PetscReal*); PETSC_EXTERN PetscErrorCode DSSolve(DS,PetscScalar*,PetscScalar*); PETSC_EXTERN PetscErrorCode DSSort(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*); PETSC_EXTERN PetscErrorCode DSComputeFunction(DS,SlepcFunction); PETSC_EXTERN PetscErrorCode DSSetEigenvalueComparison(DS,PetscErrorCode (*)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*); PETSC_EXTERN PetscErrorCode DSGetEigenvalueComparison(DS,PetscErrorCode (**)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void**); PETSC_EXTERN PetscErrorCode DSUpdateExtraRow(DS); PETSC_EXTERN PetscErrorCode DSCond(DS,PetscReal*); PETSC_EXTERN PetscErrorCode DSTranslateHarmonic(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*); PETSC_EXTERN PetscErrorCode DSTranslateRKS(DS,PetscScalar); PETSC_EXTERN PetscErrorCode DSNormalize(DS,DSMatType,PetscInt); PETSC_EXTERN PetscErrorCode DSSetFN(DS,PetscInt,FN*); PETSC_EXTERN PetscErrorCode DSGetFN(DS,PetscInt,FN*); PETSC_EXTERN PetscErrorCode DSGetNumFN(DS,PetscInt*); PETSC_EXTERN PetscFunctionList DSList; PETSC_EXTERN PetscBool DSRegisterAllCalled; PETSC_EXTERN PetscErrorCode DSRegisterAll(void); PETSC_EXTERN PetscErrorCode DSRegister(const char[],PetscErrorCode(*)(DS)); #endif slepc-3.4.2.dfsg.orig/include/slepcmfn.h0000644000175000017500000001060612211062077017041 0ustar gladkgladk/* User interface for the SLEPC matrix function object. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCMFN_H) #define __SLEPCMFN_H #include #include PETSC_EXTERN PetscErrorCode MFNInitializePackage(void); /*S MFN - SLEPc object that encapsulates functionality for matrix functions. Level: beginner .seealso: MFNCreate() S*/ typedef struct _p_MFN* MFN; /*J MFNType - String with the name of a method for computing matrix functions. Level: beginner .seealso: MFNSetType(), MFN J*/ typedef const char* MFNType; #define MFNKRYLOV "krylov" /* Logging support */ PETSC_EXTERN PetscClassId MFN_CLASSID; PETSC_EXTERN PetscErrorCode MFNCreate(MPI_Comm,MFN *); PETSC_EXTERN PetscErrorCode MFNDestroy(MFN*); PETSC_EXTERN PetscErrorCode MFNReset(MFN); PETSC_EXTERN PetscErrorCode MFNSetType(MFN,MFNType); PETSC_EXTERN PetscErrorCode MFNGetType(MFN,MFNType*); PETSC_EXTERN PetscErrorCode MFNSetFunction(MFN,SlepcFunction); PETSC_EXTERN PetscErrorCode MFNGetFunction(MFN,SlepcFunction*); PETSC_EXTERN PetscErrorCode MFNSetOperator(MFN,Mat); PETSC_EXTERN PetscErrorCode MFNGetOperator(MFN,Mat*); PETSC_EXTERN PetscErrorCode MFNSetFromOptions(MFN); PETSC_EXTERN PetscErrorCode MFNSetUp(MFN); PETSC_EXTERN PetscErrorCode MFNSolve(MFN,Vec,Vec); PETSC_EXTERN PetscErrorCode MFNView(MFN,PetscViewer); PETSC_EXTERN PetscErrorCode MFNSetIP(MFN,IP); PETSC_EXTERN PetscErrorCode MFNGetIP(MFN,IP*); PETSC_EXTERN PetscErrorCode MFNSetDS(MFN,DS); PETSC_EXTERN PetscErrorCode MFNGetDS(MFN,DS*); PETSC_EXTERN PetscErrorCode MFNSetTolerances(MFN,PetscReal,PetscInt); PETSC_EXTERN PetscErrorCode MFNGetTolerances(MFN,PetscReal*,PetscInt*); PETSC_EXTERN PetscErrorCode MFNSetDimensions(MFN,PetscInt); PETSC_EXTERN PetscErrorCode MFNGetDimensions(MFN,PetscInt*); PETSC_EXTERN PetscErrorCode MFNSetScaleFactor(MFN,PetscScalar); PETSC_EXTERN PetscErrorCode MFNGetScaleFactor(MFN,PetscScalar*); PETSC_EXTERN PetscErrorCode MFNMonitor(MFN,PetscInt,PetscReal); PETSC_EXTERN PetscErrorCode MFNMonitorSet(MFN,PetscErrorCode (*)(MFN,PetscInt,PetscReal,void*),void*,PetscErrorCode (*)(void**)); PETSC_EXTERN PetscErrorCode MFNMonitorCancel(MFN); PETSC_EXTERN PetscErrorCode MFNGetMonitorContext(MFN,void **); PETSC_EXTERN PetscErrorCode MFNGetIterationNumber(MFN,PetscInt*); PETSC_EXTERN PetscErrorCode MFNSetErrorIfNotConverged(MFN,PetscBool); PETSC_EXTERN PetscErrorCode MFNGetErrorIfNotConverged(MFN,PetscBool*); PETSC_EXTERN PetscErrorCode MFNMonitorDefault(MFN,PetscInt,PetscReal,void*); PETSC_EXTERN PetscErrorCode MFNMonitorLG(MFN,PetscInt,PetscReal,void*); PETSC_EXTERN PetscErrorCode MFNSetOptionsPrefix(MFN,const char*); PETSC_EXTERN PetscErrorCode MFNAppendOptionsPrefix(MFN,const char*); PETSC_EXTERN PetscErrorCode MFNGetOptionsPrefix(MFN,const char*[]); /*E MFNConvergedReason - reason a matrix function iteration was said to have converged or diverged Level: beginner .seealso: MFNSolve(), MFNGetConvergedReason(), MFNSetTolerances() E*/ typedef enum {/* converged */ MFN_CONVERGED_TOL = 2, /* diverged */ MFN_DIVERGED_ITS = -3, MFN_DIVERGED_BREAKDOWN = -4, MFN_CONVERGED_ITERATING = 0} MFNConvergedReason; PETSC_EXTERN PetscErrorCode MFNGetConvergedReason(MFN,MFNConvergedReason *); PETSC_EXTERN PetscFunctionList MFNList; PETSC_EXTERN PetscBool MFNRegisterAllCalled; PETSC_EXTERN PetscErrorCode MFNRegisterAll(void); PETSC_EXTERN PetscErrorCode MFNRegister(const char[],PetscErrorCode(*)(MFN)); #endif slepc-3.4.2.dfsg.orig/include/slepcsvd.h0000644000175000017500000001523012211062077017053 0ustar gladkgladk/* User interface for SLEPc's singular value solvers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SLEPc - Scalable Library for Eigenvalue Problem Computations Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain This file is part of SLEPc. SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #if !defined(__SLEPCSVD_H) #define __SLEPCSVD_H #include PETSC_EXTERN PetscErrorCode SVDInitializePackage(void); /*S SVD - Abstract SLEPc object that manages all the singular value problem solvers. Level: beginner .seealso: SVDCreate() S*/ typedef struct _p_SVD* SVD; /*J SVDType - String with the name of a SLEPc singular value solver Level: beginner .seealso: SVDSetType(), SVD J*/ typedef const char* SVDType; #define SVDCROSS "cross" #define SVDCYCLIC "cyclic" #define SVDLAPACK "lapack" #define SVDLANCZOS "lanczos" #define SVDTRLANCZOS "trlanczos" /* Logging support */ PETSC_EXTERN PetscClassId SVD_CLASSID; /*E SVDTransposeMode - Determines how to handle the transpose of the matrix Level: advanced .seealso: SVDSetTransposeMode(), SVDGetTransposeMode() E*/ typedef enum { SVD_TRANSPOSE_EXPLICIT, SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode; /*E SVDWhich - Determines whether largest or smallest singular triplets are to be computed Level: intermediate .seealso: SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets() E*/ typedef enum { SVD_LARGEST, SVD_SMALLEST } SVDWhich; /*E SVDConvergedReason - Reason a singular value solver was said to have converged or diverged Level: beginner .seealso: SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances() E*/ typedef enum {/* converged */ SVD_CONVERGED_TOL = 2, /* diverged */ SVD_DIVERGED_ITS = -3, SVD_DIVERGED_BREAKDOWN = -4, SVD_CONVERGED_ITERATING = 0 } SVDConvergedReason; PETSC_EXTERN PetscErrorCode SVDCreate(MPI_Comm,SVD*); PETSC_EXTERN PetscErrorCode SVDSetIP(SVD,IP); PETSC_EXTERN PetscErrorCode SVDGetIP(SVD,IP*); PETSC_EXTERN PetscErrorCode SVDSetDS(SVD,DS); PETSC_EXTERN PetscErrorCode SVDGetDS(SVD,DS*); PETSC_EXTERN PetscErrorCode SVDSetType(SVD,SVDType); PETSC_EXTERN PetscErrorCode SVDGetType(SVD,SVDType*); PETSC_EXTERN PetscErrorCode SVDSetOperator(SVD,Mat); PETSC_EXTERN PetscErrorCode SVDGetOperator(SVD,Mat*); PETSC_EXTERN PetscErrorCode SVDSetInitialSpace(SVD,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode SVDSetInitialSpaceLeft(SVD,PetscInt,Vec*); PETSC_EXTERN PetscErrorCode SVDSetTransposeMode(SVD,SVDTransposeMode); PETSC_EXTERN PetscErrorCode SVDGetTransposeMode(SVD,SVDTransposeMode*); PETSC_EXTERN PetscErrorCode SVDSetDimensions(SVD,PetscInt,PetscInt,PetscInt); PETSC_EXTERN PetscErrorCode SVDGetDimensions(SVD,PetscInt*,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode SVDSetTolerances(SVD,PetscReal,PetscInt); PETSC_EXTERN PetscErrorCode SVDGetTolerances(SVD,PetscReal*,PetscInt*); PETSC_EXTERN PetscErrorCode SVDSetWhichSingularTriplets(SVD,SVDWhich); PETSC_EXTERN PetscErrorCode SVDGetWhichSingularTriplets(SVD,SVDWhich*); PETSC_EXTERN PetscErrorCode SVDSetFromOptions(SVD); PETSC_EXTERN PetscErrorCode SVDSetOptionsPrefix(SVD,const char*); PETSC_EXTERN PetscErrorCode SVDAppendOptionsPrefix(SVD,const char*); PETSC_EXTERN PetscErrorCode SVDGetOptionsPrefix(SVD,const char*[]); PETSC_EXTERN PetscErrorCode SVDSetUp(SVD); PETSC_EXTERN PetscErrorCode SVDSolve(SVD); PETSC_EXTERN PetscErrorCode SVDGetIterationNumber(SVD,PetscInt*); PETSC_EXTERN PetscErrorCode SVDGetConvergedReason(SVD,SVDConvergedReason*); PETSC_EXTERN PetscErrorCode SVDGetConverged(SVD,PetscInt*); PETSC_EXTERN PetscErrorCode SVDGetSingularTriplet(SVD,PetscInt,PetscReal*,Vec,Vec); PETSC_EXTERN PetscErrorCode SVDComputeResidualNorms(SVD,PetscInt,PetscReal*,PetscReal*); PETSC_EXTERN PetscErrorCode SVDComputeRelativeError(SVD,PetscInt,PetscReal*); PETSC_EXTERN PetscErrorCode SVDGetOperationCounters(SVD,PetscInt*,PetscInt*); PETSC_EXTERN PetscErrorCode SVDView(SVD,PetscViewer); PETSC_EXTERN PetscErrorCode SVDPrintSolution(SVD,PetscViewer); PETSC_EXTERN PetscErrorCode SVDDestroy(SVD*); PETSC_EXTERN PetscErrorCode SVDReset(SVD); PETSC_EXTERN PetscErrorCode SVDMonitor(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt); PETSC_EXTERN PetscErrorCode SVDMonitorSet(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**)); PETSC_EXTERN PetscErrorCode SVDMonitorCancel(SVD); PETSC_EXTERN PetscErrorCode SVDGetMonitorContext(SVD,void **); PETSC_EXTERN PetscErrorCode SVDMonitorAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode SVDMonitorFirst(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode SVDMonitorConverged(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode SVDMonitorLG(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode SVDMonitorLGAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*); PETSC_EXTERN PetscErrorCode SVDSetTrackAll(SVD,PetscBool); PETSC_EXTERN PetscErrorCode SVDGetTrackAll(SVD,PetscBool*); PETSC_EXTERN PetscErrorCode SVDCrossSetEPS(SVD,EPS); PETSC_EXTERN PetscErrorCode SVDCrossGetEPS(SVD,EPS*); PETSC_EXTERN PetscErrorCode SVDCyclicSetExplicitMatrix(SVD,PetscBool); PETSC_EXTERN PetscErrorCode SVDCyclicGetExplicitMatrix(SVD,PetscBool*); PETSC_EXTERN PetscErrorCode SVDCyclicSetEPS(SVD,EPS); PETSC_EXTERN PetscErrorCode SVDCyclicGetEPS(SVD,EPS*); PETSC_EXTERN PetscErrorCode SVDLanczosSetOneSide(SVD,PetscBool); PETSC_EXTERN PetscErrorCode SVDLanczosGetOneSide(SVD,PetscBool*); PETSC_EXTERN PetscErrorCode SVDTRLanczosSetOneSide(SVD,PetscBool); PETSC_EXTERN PetscErrorCode SVDTRLanczosGetOneSide(SVD,PetscBool*); PETSC_EXTERN PetscFunctionList SVDList; PETSC_EXTERN PetscBool SVDRegisterAllCalled; PETSC_EXTERN PetscErrorCode SVDRegisterAll(void); PETSC_EXTERN PetscErrorCode SVDRegister(const char[],PetscErrorCode(*)(SVD)); #endif slepc-3.4.2.dfsg.orig/TAGS0000644000175000017500000073075412211062077014134 0ustar gladkgladk makefile,1732 makefile:^?makefile^A,1 ALL:ALL25,1032 LOCDIR 26,1041 DIRS 27,1052 all:all34,1192 echo "Now to check if the library is working do:echo "Now to check if the library is working do52,2838 echo "=echo "53,2911 cmakegen:cmakegen61,3244 all-cmake:all-cmake64,3287 all-legacy:all-legacy66,3335 info:info70,3520 build:build116,5617 check:check125,6116 test:test126,6128 test_build:test_build128,6269 testexamples:testexamples137,6945 testfortran:testfortran148,7467 echo "Error:echo "Error160,8083 testblopex:testblopex165,8226 echo "Error:echo "Error176,8796 ranlib:ranlib181,8957 deletelibs:deletelibs185,9037 deletemods:deletemods187,9099 allclean:allclean191,9197 chk_petsc_dir:chk_petsc_dir197,9390 chk_slepc_dir:chk_slepc_dir208,10019 install:install219,10648 echo "=echo "297,14538 echo "It is usable with SLEPC_DIR=echo "It is usable with SLEPC_DIR299,14631 echo "Run the following to verify the install (in current directory)echo "Run the following to verify the install (in current directory300,14744 echo "make SLEPC_DIR=echo "make SLEPC_DIR301,14827 echo "=echo "302,14906 alldoc:alldoc312,15207 alldoc1:alldoc1315,15296 alldoc2:alldoc2324,15805 alldocclean:alldocclean329,15968 deletemanualpages:deletemanualpages330,16012 allcleanhtml:allcleanhtml335,16250 allfortranstubs:allfortranstubs339,16352 deletefortranstubs:deletefortranstubs344,16607 countfortranfunctions:countfortranfunctions351,16825 countcfunctions:countcfunctions358,17118 difffortranfunctions:difffortranfunctions364,17359 checkbadfortranstubs:checkbadfortranstubs371,17828 alletags:alletags400,19241 setup.py,577 setup.py:^?setup.py^A,1 def get_slepc_dir(40,1219 def get_config(44,1292 def bootstrap(55,1450 def get_petsc_dir(87,2587 def get_petsc_arch(98,2920 def config(102,3037 def build(114,3393 def install(126,3725 class context:context146,4376 def __init__(147,4391 def enter(150,4483 def exit(155,4611 class cmd_build(159,4696 def initialize_options(161,4722 def run(166,4938 class cmd_install(175,5133 def initialize_options(177,5163 def run(181,5266 class cmd_sdist(216,6233 def initialize_options(218,6259 def version(232,6771 def tarball(258,7851 bin/matlab/classes/slepcmatlabheader.h,576 slepcmatlabheader.h:^?slepcmatlabheader.h^A,1 typedef int MPI_Comm;29,1270 typedef int PetscBool;32,1318 typedef long int PetscPointer;33,1341 typedef PetscPointer Vec;34,1372 typedef PetscPointer Mat;35,1398 typedef PetscPointer KSP;36,1424 typedef PetscPointer PetscViewer;37,1450 typedef PetscPointer ST;39,1485 typedef PetscPointer EPS;48,1685 typedef int EPSProblemType;49,1711 typedef int EPSWhich;50,1739 typedef int EPSExtraction;51,1761 typedef PetscPointer SVD;73,2459 typedef int SVDWhich;74,2485 typedef PetscPointer QEP;91,3001 typedef int QEPProblemType;92,3027 typedef int QEPWhich;93,3055 config/arpack.py,18 arpack.py:^?arpack.py^A,1 def Check(29,990 config/blopex.py,21 blopex.py:^?blopex.py^A,1 def Install(30,1022 config/blzpack.py,18 blzpack.py:^?blzpack.py^A,1 def Check(29,990 config/check.py,124 check.py:^?check.py^A,1 def LinkWithOutput(29,993 def Link(58,1897 def FortranLink(63,2048 def GenerateGuesses(92,2920 def FortranLib(111,3395 config/cmakeboot.py,256 cmakeboot.py:^?cmakeboot.py^A,1 def noCheck(20,712 def quoteIfNeeded(23,767 class StdoutLogger(31,1030 def write(32,1058 class PETScMaker(35,1097 def __init__(36,1130 def __str__(47,1510 def setupModules(50,1544 def setup(72,3166 def cmakeboot(78,3306 def main(154,7059 config/cmakegen.py,620 cmakegen.py:^?cmakegen.py^A,1 class defaultdict(24,754 def __init__(25,783 def __getitem__(31,1110 def __missing__(36,1288 def __reduce__(41,1485 def copy(47,1716 def __copy__(49,1775 def __deepcopy__(51,1861 def __repr__(55,2034 class StdoutLogger(62,2245 def write(63,2273 def cmakeconditional(66,2312 def unexpected(67,2343 def pkgsources(91,3108 def compareDirLists(99,3579 def compareSourceLists(112,4227 def stripsplit(138,5598 def relpath(142,5815 def writeRoot(151,6213 def writePackage(189,7756 def body(192,7859 def main(201,8228 config/feast.py,18 feast.py:^?feast.py^A,1 def Check(29,990 config/generatefortranstubs.py,167 generatefortranstubs.py:^?generatefortranstubs.py^A,1 def FixFile(8,123 def FindSource(32,1294 def FixDir(46,1743 def PrepFtnDir(126,4544 def processDir(140,5004 def processf90interfaces(180,6636 def main(198,7594 config/lapack.py,18 lapack.py:^?lapack.py^A,1 def Check(29,990 config/log.py,94 log.py:^?log.py^A,1 def Open(26,956 def Println(31,1022 def Print(36,1093 def write(40,1151 def Exit(44,1205 config/petscconf.py,17 petscconf.py:^?petscconf.py^A,1 def Load(25,948 config/petscversion.py,17 petscversion.py:^?petscversion.py^A,1 def Load(25,948 config/primme.py,18 primme.py:^?primme.py^A,1 def Check(29,990 config/slepcversion.py,17 slepcversion.py:^?slepcversion.py^A,1 def Load(25,948 config/trlan.py,18 trlan.py:^?trlan.py^A,1 def Check(29,990 config/configure.py,0 configure.py:^?configure.py^A,1 include/makefile,141 makefile:^?makefile^A,1 CFLAGS 22,934 FFLAGS 23,945 SOURCEC 24,956 SOURCEF 25,967 SOURCEH 26,978 LIBBASE 29,1185 DIRS 30,1205 LOCDIR 31,1239 MANSEC 32,1259 include/slepcblaslapack.h,3846 slepcblaslapack.h:^?slepcblaslapack.h^A,1 #define __SLEPCBLASLAPACK_H25,1034 #define SLEPC_BLASLAPACKREAL(31,1207 #define SLEPC_BLASLAPACK(33,1292 #define SLEPC_BLASLAPACK(35,1348 #define SLEPC_BLASLAPACKREAL(38,1446 #define SLEPC_BLASLAPACK(40,1531 #define SLEPC_BLASLAPACK(42,1587 #define SLEPC_BLASLAPACKREAL(45,1650 #define SLEPC_BLASLAPACK(47,1735 #define SLEPC_BLASLAPACK(49,1791 #define SLEPC_BLASLAPACKREAL(55,1965 #define SLEPC_BLASLAPACK(57,2047 #define SLEPC_BLASLAPACK(59,2100 #define SLEPC_BLASLAPACKREAL(62,2195 #define SLEPC_BLASLAPACK(64,2277 #define SLEPC_BLASLAPACK(66,2330 #define SLEPC_BLASLAPACKREAL(69,2390 #define SLEPC_BLASLAPACK(71,2472 #define SLEPC_BLASLAPACK(73,2525 #define SLEPC_BLASLAPACKREAL(79,2628 #define SLEPC_BLASLAPACK(81,2710 #define SLEPC_BLASLAPACK(83,2763 #define SLEPC_BLASLAPACKREAL(86,2858 #define SLEPC_BLASLAPACK(88,2940 #define SLEPC_BLASLAPACK(90,2993 #define SLEPC_BLASLAPACKREAL(93,3053 #define SLEPC_BLASLAPACK(95,3135 #define SLEPC_BLASLAPACK(97,3188 #define LAPACKlaev2_ 104,3307 #define LAPACKgehrd_ 105,3358 #define LAPACKgetri_ 106,3409 #define LAPACKgelqf_ 107,3460 #define LAPACKtgexc_ 108,3511 #define LAPACKlarfg_ 109,3562 #define LAPACKlag2_ 110,3613 #define LAPACKlasv2_ 111,3666 #define LAPACKlartg_ 112,3721 #define LAPACKlaln2_ 113,3776 #define LAPACKorghr_ 115,3863 #define LAPACKorgqr_ 116,3914 #define LAPACKorghr_ 118,3971 #define LAPACKorgqr_ 119,4022 #define BLASrot_ 124,4211 #define BLASrot_ 127,4299 #define BLASrot_ 129,4389 #define BLASrot_ 131,4444 #define LAPACKlanhs_(139,4631 #define LAPACKlange_(140,4717 #define LAPACKggevx_(141,4809 #define LAPACKggev_(142,5051 #define LAPACKpbtrf_(143,5208 #define LAPACKlarf_(144,5300 #define LAPACKstevr_(146,5509 #define LAPACKbdsdc_(147,5691 #define LAPACKlamch_(148,5837 #define BLASsymm_(152,5976 #define LAPACKsyevr_(153,6101 #define LAPACKsyevd_(154,6287 #define LAPACKsygvd_(155,6411 #define LAPACKormlq_(156,6554 #define LAPACKorgtr_(157,6690 #define LAPACKsytrd_(158,6794 #define LAPACKtrevc_(159,6910 #define LAPACKgeevx_(160,7052 #define LAPACKtrexc_(161,7252 #define LAPACKgesdd_(162,7368 #define LAPACKtgevc_(163,7508 #define LAPACKhsein_(164,7662 #define LAPACKstedc_(165,7836 #define BLASsymm_(168,8007 #define LAPACKsyevr_(169,8132 #define LAPACKsyevd_(170,8330 #define LAPACKsygvd_(171,8466 #define LAPACKormlq_(172,8620 #define LAPACKorgtr_(173,8756 #define LAPACKsytrd_(174,8860 #define LAPACKtrevc_(175,8976 #define LAPACKgeevx_(176,9124 #define LAPACKtrexc_(177,9318 #define LAPACKgesdd_(178,9428 #define LAPACKtgevc_(179,9574 #define LAPACKhsein_(180,9734 #define LAPACKstedc_(181,9908 #define LAPACKlanhs_(187,10125 #define LAPACKlange_(188,10211 #define LAPACKggevx_(189,10303 #define LAPACKggev_(190,10545 #define LAPACKpbtrf_(191,10702 #define LAPACKlarf_(192,10794 #define LAPACKstevr_(194,11003 #define LAPACKbdsdc_(195,11185 #define LAPACKlamch_(196,11331 #define BLASsymm_(200,11470 #define LAPACKsyevr_(201,11595 #define LAPACKsyevd_(202,11781 #define LAPACKsygvd_(203,11905 #define LAPACKormlq_(204,12048 #define LAPACKorgtr_(205,12184 #define LAPACKsytrd_(206,12288 #define LAPACKtrevc_(207,12404 #define LAPACKgeevx_(208,12546 #define LAPACKtrexc_(209,12746 #define LAPACKgesdd_(210,12862 #define LAPACKtgevc_(211,13002 #define LAPACKhsein_(212,13156 #define LAPACKstedc_(213,13330 #define BLASsymm_(216,13501 #define LAPACKsyevr_(217,13626 #define LAPACKsyevd_(218,13824 #define LAPACKsygvd_(219,13960 #define LAPACKormlq_(220,14114 #define LAPACKorgtr_(221,14250 #define LAPACKsytrd_(222,14354 #define LAPACKtrevc_(223,14470 #define LAPACKgeevx_(224,14618 #define LAPACKtrexc_(225,14812 #define LAPACKgesdd_(226,14922 #define LAPACKtgevc_(227,15068 #define LAPACKhsein_(228,15228 #define LAPACKstedc_(229,15402 include/slepcds.h,1688 slepcds.h:^?slepcds.h^A,1 #define __SLEPCDS_H23,950 #define DS_MAX_SOLVE 26,992 #define DS_MAX_FUN 27,1015 typedef struct _p_DS* DS;39,1368 typedef const char* DSType;49,1597 #define DSHEP 50,1625 #define DSNHEP 51,1657 #define DSGHEP 52,1690 #define DSGHIEP 53,1723 #define DSGNHEP 54,1757 #define DSSVD 55,1791 #define DSQEP 56,1823 #define DSNEP 57,1855 PETSC_EXTERN PetscClassId DS_CLASSID;60,1910 typedef enum { DS_STATE_RAW,69,2066 DS_STATE_INTERMEDIATE,70,2095 DS_STATE_CONDENSED,71,2133 DS_STATE_TRUNCATED 72,2168 DS_STATE_TRUNCATED } DSStateType;72,2168 typedef enum { DS_MAT_A,102,3270 DS_MAT_B,103,3295 DS_MAT_C,104,3320 DS_MAT_T,105,3345 DS_MAT_D,106,3370 DS_MAT_F,107,3395 DS_MAT_Q,108,3420 DS_MAT_Z,109,3445 DS_MAT_X,110,3470 DS_MAT_Y,111,3495 DS_MAT_U,112,3520 DS_MAT_VT,113,3545 DS_MAT_W,114,3571 DS_MAT_E0,115,3596 DS_MAT_E1,116,3622 DS_MAT_E2,117,3648 DS_MAT_E3,118,3674 DS_MAT_E4,119,3700 DS_MAT_E5,120,3726 DS_MAT_E6,121,3752 DS_MAT_E7,122,3778 DS_MAT_E8,123,3804 DS_MAT_E9,124,3830 DS_NUM_MAT 125,3856 DS_NUM_MAT } DSMatType;125,3856 PETSC_EXTERN DSMatType DSMatExtra[DSMatExtra128,3942 #define DS_NUM_EXTRA 129,3979 PETSC_EXTERN PetscFunctionList DSList;179,6991 PETSC_EXTERN PetscBool DSRegisterAllCalled;180,7030 include/slepceps.h,4352 slepceps.h:^?slepceps.h^A,1 #define __SLEPCEPS_H25,1006 typedef struct _p_EPS* EPS;40,1290 typedef const char* EPSType;49,1435 #define EPSPOWER 50,1464 #define EPSSUBSPACE 51,1495 #define EPSARNOLDI 52,1529 #define EPSLANCZOS 53,1562 #define EPSKRYLOVSCHUR 54,1595 #define EPSGD 55,1632 #define EPSJD 56,1660 #define EPSRQCG 57,1688 #define EPSCISS 58,1718 #define EPSLAPACK 59,1748 #define EPSARPACK 60,1780 #define EPSBLZPACK 61,1812 #define EPSTRLAN 62,1845 #define EPSBLOPEX 63,1876 #define EPSPRIMME 64,1908 #define EPSFEAST 65,1940 PETSC_EXTERN PetscClassId EPS_CLASSID;68,1994 typedef enum { EPS_HEP=77,2178 EPS_GHEP,78,2204 EPS_NHEP,79,2229 EPS_GNHEP,80,2254 EPS_PGNHEP,81,2280 EPS_GHIEP 82,2307 EPS_GHIEP } EPSProblemType;82,2307 typedef enum { EPS_RITZ=92,2526 EPS_HARMONIC,93,2553 EPS_HARMONIC_RELATIVE,94,2582 EPS_HARMONIC_RIGHT,95,2620 EPS_HARMONIC_LARGEST,96,2655 EPS_REFINED,97,2692 EPS_REFINED_HARMONIC 98,2720 EPS_REFINED_HARMONIC } EPSExtraction;98,2720 typedef enum { EPS_LARGEST_MAGNITUDE=107,2933 EPS_SMALLEST_MAGNITUDE,108,2973 EPS_LARGEST_REAL,109,3012 EPS_SMALLEST_REAL,110,3045 EPS_LARGEST_IMAGINARY,111,3079 EPS_SMALLEST_IMAGINARY,112,3117 EPS_TARGET_MAGNITUDE,113,3156 EPS_TARGET_REAL,114,3193 EPS_TARGET_IMAGINARY,115,3225 EPS_ALL,116,3262 EPS_WHICH_USER 117,3286 EPS_WHICH_USER } EPSWhich;117,3286 typedef enum { EPS_BALANCE_NONE=126,3460 EPS_BALANCE_ONESIDE,127,3495 EPS_BALANCE_TWOSIDE,128,3531 EPS_BALANCE_USER 129,3567 EPS_BALANCE_USER } EPSBalance;129,3567 typedef enum { EPS_CONV_ABS=138,3761 EPS_CONV_EIG,139,3792 EPS_CONV_NORM,140,3821 EPS_CONV_USER 141,3851 EPS_CONV_USER } EPSConv;141,3851 EPS_CONVERGED_TOL 245,10397 EPS_DIVERGED_ITS 247,10479 EPS_DIVERGED_BREAKDOWN 248,10532 EPS_CONVERGED_ITERATING 249,10585 EPS_CONVERGED_ITERATING = 0} EPSConvergedReason;249,10585 PETSC_EXTERN PetscFunctionList EPSList;259,11107 PETSC_EXTERN PetscBool EPSRegisterAllCalled;260,11147 typedef enum { EPS_POWER_SHIFT_CONSTANT,275,11626 EPS_POWER_SHIFT_RAYLEIGH,276,11667 EPS_POWER_SHIFT_WILKINSON 277,11708 EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType;277,11708 PETSC_EXTERN const char *EPSPowerShiftTypes[EPSPowerShiftTypes278,11770 typedef enum { EPS_LANCZOS_REORTHOG_LOCAL,297,12430 EPS_LANCZOS_REORTHOG_FULL,298,12473 EPS_LANCZOS_REORTHOG_SELECTIVE,299,12515 EPS_LANCZOS_REORTHOG_PERIODIC,300,12562 EPS_LANCZOS_REORTHOG_PARTIAL,301,12608 EPS_LANCZOS_REORTHOG_DELAYED 302,12653 EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType;302,12653 PETSC_EXTERN const char *EPSLanczosReorthogTypes[EPSLanczosReorthogTypes303,12723 typedef enum { EPS_PRIMME_DYNAMIC,318,13224 EPS_PRIMME_DEFAULT_MIN_TIME,319,13259 EPS_PRIMME_DEFAULT_MIN_MATVECS,320,13303 EPS_PRIMME_ARNOLDI,321,13350 EPS_PRIMME_GD,322,13385 EPS_PRIMME_GD_PLUSK,323,13415 EPS_PRIMME_GD_OLSEN_PLUSK,324,13451 EPS_PRIMME_JD_OLSEN_PLUSK,325,13493 EPS_PRIMME_RQI,326,13535 EPS_PRIMME_JDQR,327,13566 EPS_PRIMME_JDQMR,328,13598 EPS_PRIMME_JDQMR_ETOL,329,13631 EPS_PRIMME_SUBSPACE_ITERATION,330,13669 EPS_PRIMME_LOBPCG_ORTHOBASIS,331,13715 EPS_PRIMME_LOBPCG_ORTHOBASISW 332,13760 EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod;332,13760 PETSC_EXTERN const char *EPSPRIMMEMethods[EPSPRIMMEMethods333,13824 typedef enum { EPS_ORTH_I=347,14331 EPS_ORTH_B,348,14360 EPS_ORTH_BOPT 349,14387 EPS_ORTH_BOPT } EPSOrthType;349,14387 include/slepcfn.h,347 slepcfn.h:^?slepcfn.h^A,1 #define __SLEPCFN_H23,950 typedef struct _p_FN* FN;34,1146 typedef const char* FNType;43,1291 #define FNRATIONAL 44,1319 #define FNEXP 45,1349 #define FNLOG 46,1374 #define FNPHI 47,1399 PETSC_EXTERN PetscClassId FN_CLASSID;50,1447 PETSC_EXTERN PetscFunctionList FNList;68,2334 PETSC_EXTERN PetscBool FNRegisterAllCalled;69,2373 include/slepcip.h,685 slepcip.h:^?slepcip.h^A,1 #define __SLEPCIP_H23,950 typedef struct _p_IP* IP;36,1257 typedef const char* IPType;50,1759 #define IPBILINEAR 51,1787 #define IPSESQUILINEAR 52,1821 #define IPINDEFINITE 53,1859 PETSC_EXTERN PetscClassId IP_CLASSID;56,1918 typedef enum { IP_ORTHOG_MGS,65,2135 IP_ORTHOG_CGS 66,2165 IP_ORTHOG_CGS } IPOrthogType;66,2165 typedef enum { IP_ORTHOG_REFINE_NEVER,76,2417 IP_ORTHOG_REFINE_IFNEEDED,77,2456 IP_ORTHOG_REFINE_ALWAYS 78,2498 IP_ORTHOG_REFINE_ALWAYS } IPOrthogRefineType;78,2498 PETSC_EXTERN PetscFunctionList IPList;113,4718 PETSC_EXTERN PetscBool IPRegisterAllCalled;114,4757 include/slepcmath.h,491 slepcmath.h:^?slepcmath.h^A,1 #define __SLEPCMATH_H26,1100 # define SLEPC_DEFAULT_TOL 32,1240 # define SLEPC_DEFAULT_TOL 34,1312 # define SLEPC_DEFAULT_TOL 36,1388 # define SLEPC_DEFAULT_TOL 38,1430 typedef enum { SLEPC_FUNCTION_NONE=50,1645 SLEPC_FUNCTION_EXP,51,1683 SLEPC_FUNCTION_LAST 52,1718 SLEPC_FUNCTION_LAST } SlepcFunction;52,1718 PETSC_STATIC_INLINE PetscReal SlepcAbs(71,2092 #define SlepcAbsEigenvalue(104,2907 #define SlepcAbsEigenvalue(106,2959 include/slepcmfn.h,547 slepcmfn.h:^?slepcmfn.h^A,1 #define __SLEPCMFN_H25,1008 typedef struct _p_MFN* MFN;38,1259 typedef const char* MFNType;47,1425 #define MFNKRYLOV 48,1454 PETSC_EXTERN PetscClassId MFN_CLASSID;51,1506 MFN_CONVERGED_TOL 103,3916 MFN_DIVERGED_ITS 105,3998 MFN_DIVERGED_BREAKDOWN 106,4051 MFN_CONVERGED_ITERATING 107,4104 MFN_CONVERGED_ITERATING = 0} MFNConvergedReason;107,4104 PETSC_EXTERN PetscFunctionList MFNList;111,4256 PETSC_EXTERN PetscBool MFNRegisterAllCalled;112,4296 include/slepcnep.h,1326 slepcnep.h:^?slepcnep.h^A,1 #define __SLEPCNEP_H25,1012 typedef struct _p_NEP* NEP;39,1284 typedef const char* NEPType;48,1432 #define NEPRII 49,1461 #define NEPSLP 50,1488 #define NEPNARNOLDI 51,1515 PETSC_EXTERN PetscClassId NEP_CLASSID;54,1570 typedef enum { NEP_LARGEST_MAGNITUDE=63,1769 NEP_SMALLEST_MAGNITUDE,64,1809 NEP_LARGEST_REAL,65,1848 NEP_SMALLEST_REAL,66,1881 NEP_LARGEST_IMAGINARY,67,1915 NEP_SMALLEST_IMAGINARY,68,1953 NEP_TARGET_MAGNITUDE,69,1992 NEP_TARGET_REAL,70,2029 NEP_TARGET_IMAGINARY}NEP_TARGET_IMAGINARY71,2061 NEP_TARGET_IMAGINARY} NEPWhich;71,2061 NEP_CONVERGED_FNORM_ABS 82,2339 NEP_CONVERGED_FNORM_RELATIVE 83,2392 NEP_CONVERGED_SNORM_RELATIVE 84,2445 NEP_DIVERGED_LINEAR_SOLVE 86,2527 NEP_DIVERGED_FUNCTION_COUNT 87,2580 NEP_DIVERGED_MAX_IT 88,2633 NEP_DIVERGED_BREAKDOWN 89,2686 NEP_DIVERGED_FNORM_NAN 90,2739 NEP_CONVERGED_ITERATING 91,2792 NEP_CONVERGED_ITERATING = 0} NEPConvergedReason;91,2792 PETSC_EXTERN PetscFunctionList NEPList;173,8176 PETSC_EXTERN PetscBool NEPRegisterAllCalled;174,8216 include/slepcqep.h,1232 slepcqep.h:^?slepcqep.h^A,1 #define __SLEPCQEP_H25,1012 typedef struct _p_QEP* QEP;38,1262 typedef const char* QEPType;47,1410 #define QEPLINEAR 48,1439 #define QEPQARNOLDI 49,1469 #define QEPQLANCZOS 50,1501 PETSC_EXTERN PetscClassId QEP_CLASSID;53,1556 typedef enum { QEP_GENERAL=62,1752 QEP_HERMITIAN,63,1782 QEP_GYROSCOPIC 64,1839 } QEPProblemType;65,1916 typedef enum { QEP_LARGEST_MAGNITUDE=74,2107 QEP_SMALLEST_MAGNITUDE,75,2147 QEP_LARGEST_REAL,76,2186 QEP_SMALLEST_REAL,77,2219 QEP_LARGEST_IMAGINARY,78,2253 QEP_SMALLEST_IMAGINARY,79,2291 QEP_TARGET_MAGNITUDE,80,2330 QEP_TARGET_REAL,81,2367 QEP_TARGET_IMAGINARY}QEP_TARGET_IMAGINARY82,2399 QEP_TARGET_IMAGINARY} QEPWhich;82,2399 QEP_CONVERGED_TOL 160,7035 QEP_DIVERGED_ITS 162,7117 QEP_DIVERGED_BREAKDOWN 163,7170 QEP_CONVERGED_ITERATING 164,7223 QEP_CONVERGED_ITERATING = 0} QEPConvergedReason;164,7223 PETSC_EXTERN PetscFunctionList QEPList;171,7588 PETSC_EXTERN PetscBool QEPRegisterAllCalled;172,7628 include/slepcst.h,588 slepcst.h:^?slepcst.h^A,1 #define __SLEPCST_H25,1010 typedef struct _p_ST* ST;39,1317 typedef const char* STType;48,1469 #define STSHELL 49,1497 #define STSHIFT 50,1525 #define STSINVERT 51,1553 #define STCAYLEY 52,1583 #define STFOLD 53,1612 #define STPRECOND 54,1639 PETSC_EXTERN PetscClassId ST_CLASSID;57,1692 typedef enum { ST_MATMODE_COPY,108,3888 ST_MATMODE_INPLACE,109,3920 ST_MATMODE_SHELL 110,3955 ST_MATMODE_SHELL } STMatMode;110,3955 PETSC_EXTERN PetscFunctionList STList;116,4243 PETSC_EXTERN PetscBool STRegisterAllCalled;117,4282 include/slepcsvd.h,935 slepcsvd.h:^?slepcsvd.h^A,1 #define __SLEPCSVD_H25,1006 typedef struct _p_SVD* SVD;38,1250 typedef const char* SVDType;47,1404 #define SVDCROSS 48,1433 #define SVDCYCLIC 49,1464 #define SVDLAPACK 50,1496 #define SVDLANCZOS 51,1528 #define SVDTRLANCZOS 52,1561 PETSC_EXTERN PetscClassId SVD_CLASSID;55,1619 typedef enum { SVD_TRANSPOSE_EXPLICIT,64,1820 SVD_TRANSPOSE_IMPLICIT 65,1859 SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;65,1859 typedef enum { SVD_LARGEST,75,2118 SVD_SMALLEST 76,2146 SVD_SMALLEST } SVDWhich;76,2146 SVD_CONVERGED_TOL 87,2416 SVD_DIVERGED_ITS 89,2498 SVD_DIVERGED_BREAKDOWN 90,2551 SVD_CONVERGED_ITERATING 91,2604 SVD_CONVERGED_ITERATING = 0 } SVDConvergedReason;91,2604 PETSC_EXTERN PetscFunctionList SVDList;157,6579 PETSC_EXTERN PetscBool SVDRegisterAllCalled;158,6619 include/slepcsys.h,118 slepcsys.h:^?slepcsys.h^A,1 #define __SLEPCSYS_H26,1067 #define SLEPC_AUTHOR_INFO 38,1415 PETSC_EXTERN PetscBool SlepcInitializeCalled;66,2655 include/slepcvec.h,54 slepcvec.h:^?slepcvec.h^A,1 #define __SLEPCVEC_H25,1016 #define VECCOMP 30,1134 include/slepcversion.h,516 slepcversion.h:^?slepcversion.h^A,1 #define __SLEPCVERSION_H2,31 #define SLEPC_VERSION_RELEASE 4,57 #define SLEPC_VERSION_MAJOR 5,92 #define SLEPC_VERSION_MINOR 6,127 #define SLEPC_VERSION_SUBMINOR 7,162 #define SLEPC_VERSION_PATCH 8,197 #define SLEPC_RELEASE_DATE 9,232 #define SLEPC_VERSION_DATE 10,280 #define SLEPC_VERSION_GIT 13,357 #define SLEPC_VERSION_DATE_GIT 17,445 #define SLEPC_VERSION_(20,496 #define SLEPC_VERSION_LT(26,715 #define SLEPC_VERSION_LE(34,1114 #define SLEPC_VERSION_GT(38,1252 #define SLEPC_VERSION_GE(41,1346 include/slepc.h,0 slepc.h:^?slepc.h^A,1 include/finclude/makefile,176 makefile:^?makefile^A,1 CFLAGS 24,971 FFLAGS 25,983 SOURCEC 26,995 SOURCEF 27,1007 SOURCEH 28,1019 LIBBASE 31,1418 DIRS 32,1439 MANSEC 33,1452 LOCDIR 34,1465 runexamples:runexamples38,1536 include/finclude/slepcdsdef.h,318 slepcdsdef.h:^?slepcdsdef.h^A,1 #define __SLEPCDS_H24,1011 #define DS 27,1074 #define DSType 30,1110 #define DSStateType 31,1145 #define DSMatType 32,1175 #define DSHEP 34,1206 #define DSNHEP 35,1232 #define DSGHEP 36,1259 #define DSGHIEP 37,1286 #define DSGNHEP 38,1314 #define DSSVD 39,1342 #define DSQEP 40,1368 #define DSNEP 41,1394 include/finclude/slepcepsdef.h,851 slepcepsdef.h:^?slepcepsdef.h^A,1 #define __SLEPCEPS_H24,1013 #define EPS 31,1177 #define EPSType 34,1233 #define EPSConvergedReason 35,1279 #define EPSProblemType 36,1320 #define EPSWhich 37,1361 #define EPSExtraction 38,1402 #define EPSBalance 39,1443 #define EPSConv 40,1484 #define EPSOrthType 41,1525 #define EPSPowerShiftType 42,1566 #define EPSLanczosReorthogType 43,1607 #define EPSPRIMMEMethod 44,1648 #define EPSPRIMMEPrecond 45,1689 #define EPSPOWER 48,1732 #define EPSSUBSPACE 49,1763 #define EPSARNOLDI 50,1797 #define EPSLANCZOS 51,1830 #define EPSKRYLOVSCHUR 52,1863 #define EPSGD 53,1900 #define EPSJD 54,1928 #define EPSRQCG 55,1956 #define EPSCISS 56,1986 #define EPSLAPACK 57,2016 #define EPSARPACK 58,2048 #define EPSBLZPACK 59,2080 #define EPSTRLAN 60,2113 #define EPSBLOPEX 61,2144 #define EPSPRIMME 62,2176 #define EPSFEAST 63,2208 include/finclude/slepcfndef.h,169 slepcfndef.h:^?slepcfndef.h^A,1 #define __SLEPCFN_H24,1011 #define FN 27,1074 #define FNType 30,1110 #define FNRATIONAL 32,1153 #define FNEXP 33,1183 #define FNLOG 34,1208 #define FNPHI 35,1233 include/finclude/slepcipdef.h,228 slepcipdef.h:^?slepcipdef.h^A,1 #define __SLEPCIP_H24,1011 #define IP 27,1074 #define IPType 30,1110 #define IPOrthogType 31,1152 #define IPOrthogRefineType 32,1189 #define IPBILINEAR 34,1227 #define IPSESQUILINEAR 35,1261 #define IPINDEFINITE 36,1299 include/finclude/slepcmfndef.h,138 slepcmfndef.h:^?slepcmfndef.h^A,1 #define __SLEPCMFN_H24,1013 #define MFN 30,1144 #define MFNType 33,1200 #define MFNConvergedReason 34,1246 #define MFNKRYLOV 37,1289 include/finclude/slepcnepdef.h,214 slepcnepdef.h:^?slepcnepdef.h^A,1 #define __SLEPCNEP_H24,1013 #define NEP 32,1211 #define NEPType 35,1263 #define NEPWhich 36,1305 #define NEPConvergedReason 37,1342 #define NEPRII 39,1380 #define NEPSLP 40,1407 #define NEPNARNOLDI 41,1434 include/finclude/slepcqepdef.h,254 slepcqepdef.h:^?slepcqepdef.h^A,1 #define __SLEPCQEP_H24,1013 #define QEP 32,1211 #define QEPType 35,1263 #define QEPProblemType 36,1305 #define QEPWhich 37,1342 #define QEPConvergedReason 38,1379 #define QEPLINEAR 40,1417 #define QEPQARNOLDI 41,1447 #define QEPQLANCZOS 42,1479 include/finclude/slepcstdef.h,253 slepcstdef.h:^?slepcstdef.h^A,1 #define __SLEPCST_H24,1011 #define ST 29,1109 #define STType 32,1152 #define STMatMode 33,1185 #define STSHELL 35,1214 #define STSHIFT 36,1242 #define STSINVERT 37,1270 #define STCAYLEY 38,1300 #define STFOLD 39,1329 #define STPRECOND 40,1356 include/finclude/slepcsvddef.h,309 slepcsvddef.h:^?slepcsvddef.h^A,1 #define __SLEPCSVD_H24,1013 #define SVD 31,1178 #define SVDType 34,1230 #define SVDTransposeMode 35,1272 #define SVDWhich 36,1309 #define SVDConvergedReason 37,1346 #define SVDCROSS 39,1384 #define SVDCYCLIC 40,1413 #define SVDLAPACK 41,1443 #define SVDLANCZOS 42,1473 #define SVDTRLANCZOS 43,1504 include/finclude/slepcsysdef.h,60 slepcsysdef.h:^?slepcsysdef.h^A,1 #define __SLEPCSYS_H25,1014 #define SlepcFunction 27,1036 include/finclude/slepcsys.h,0 slepcsys.h:^?slepcsys.h^A,1 include/finclude/slepcsvd.h90,0 slepcsvd.h90:^?slepcsvd.h90^A,1 include/finclude/slepcsvd.h,0 slepcsvd.h:^?slepcsvd.h^A,1 include/finclude/slepcst.h90,0 slepcst.h90:^?slepcst.h90^A,1 include/finclude/slepcst.h,0 slepcst.h:^?slepcst.h^A,1 include/finclude/slepcqep.h90,0 slepcqep.h90:^?slepcqep.h90^A,1 include/finclude/slepcqep.h,0 slepcqep.h:^?slepcqep.h^A,1 include/finclude/slepcnep.h90,0 slepcnep.h90:^?slepcnep.h90^A,1 include/finclude/slepcnep.h,0 slepcnep.h:^?slepcnep.h^A,1 include/finclude/slepcmfn.h90,0 slepcmfn.h90:^?slepcmfn.h90^A,1 include/finclude/slepcmfn.h,0 slepcmfn.h:^?slepcmfn.h^A,1 include/finclude/slepcip.h90,0 slepcip.h90:^?slepcip.h90^A,1 include/finclude/slepcip.h,0 slepcip.h:^?slepcip.h^A,1 include/finclude/slepcfn.h90,0 slepcfn.h90:^?slepcfn.h90^A,1 include/finclude/slepcfn.h,0 slepcfn.h:^?slepcfn.h^A,1 include/finclude/slepceps.h90,0 slepceps.h90:^?slepceps.h90^A,1 include/finclude/slepceps.h,0 slepceps.h:^?slepceps.h^A,1 include/finclude/slepcds.h90,0 slepcds.h90:^?slepcds.h90^A,1 include/finclude/slepcds.h,0 slepcds.h:^?slepcds.h^A,1 include/finclude/slepcdef.h,0 slepcdef.h:^?slepcdef.h^A,1 include/finclude/slepc.h90,0 slepc.h90:^?slepc.h90^A,1 include/finclude/slepc.h,0 slepc.h:^?slepc.h^A,1 include/finclude/ftn-custom/makefile,15 makefile:^?makefile^A,1 LOCDIR 22,934 include/finclude/ftn-custom/slepcds.h90,50 slepcds.h90:^?slepcds.h90^A,1 include/finclude/ftn-custom/slepcdsdef.h90,32 slepcdsdef.h90:^?slepcdsdef.h90^A,1 include/finclude/ftn-custom/slepceps.h90,52 slepceps.h90:^?slepceps.h90^A,1 include/finclude/ftn-custom/slepcepsdef.h90,33 slepcepsdef.h90:^?slepcepsdef.h90^A,1 include/finclude/ftn-custom/slepcfn.h90,50 slepcfn.h90:^?slepcfn.h90^A,1 include/finclude/ftn-custom/slepcfndef.h90,32 slepcfndef.h90:^?slepcfndef.h90^A,1 include/finclude/ftn-custom/slepcip.h90,50 slepcip.h90:^?slepcip.h90^A,1 include/finclude/ftn-custom/slepcipdef.h90,32 slepcipdef.h90:^?slepcipdef.h90^A,1 include/finclude/ftn-custom/slepcmfn.h90,52 slepcmfn.h90:^?slepcmfn.h90^A,1 include/finclude/ftn-custom/slepcmfndef.h90,33 slepcmfndef.h90:^?slepcmfndef.h90^A,1 include/finclude/ftn-custom/slepcnep.h90,52 slepcnep.h90:^?slepcnep.h90^A,1 include/finclude/ftn-custom/slepcnepdef.h90,33 slepcnepdef.h90:^?slepcnepdef.h90^A,1 include/finclude/ftn-custom/slepcqep.h90,52 slepcqep.h90:^?slepcqep.h90^A,1 include/finclude/ftn-custom/slepcqepdef.h90,33 slepcqepdef.h90:^?slepcqepdef.h90^A,1 include/finclude/ftn-custom/slepcst.h90,50 slepcst.h90:^?slepcst.h90^A,1 include/finclude/ftn-custom/slepcstdef.h90,32 slepcstdef.h90:^?slepcstdef.h90^A,1 include/finclude/ftn-custom/slepcsvd.h90,52 slepcsvd.h90:^?slepcsvd.h90^A,1 include/finclude/ftn-custom/slepcsvddef.h90,33 slepcsvddef.h90:^?slepcsvddef.h90^A,1 include/slepc-private/dsimpl.h,413 dsimpl.h:^?dsimpl.h^A,1 #define _DSIMPL23,946 PETSC_EXTERN PetscLogEvent DS_Solve,28,1022 PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,28,1022 PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,28,1022 PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other;28,1022 PETSC_INTERN const char *DSMatName[DSMatName29,1091 typedef struct _DSOps *DSOps;DSOps31,1130 struct _DSOps 33,1161 struct _p_DS 48,1869 include/slepc-private/epsimpl.h,252 epsimpl.h:^?epsimpl.h^A,1 #define _EPSIMPL23,947 PETSC_EXTERN PetscLogEvent EPS_SetUp,28,1025 PETSC_EXTERN PetscLogEvent EPS_SetUp,EPS_Solve;28,1025 typedef struct _EPSOps *EPSOps;EPSOps30,1074 struct _EPSOps 32,1107 #define MAXEPSMONITORS 47,1541 struct _p_EPS 52,1608 include/slepc-private/fnimpl.h,112 fnimpl.h:^?fnimpl.h^A,1 #define _FNIMPL23,946 typedef struct _FNOps *FNOps;FNOps28,1022 struct _FNOps 30,1053 struct _p_FN 36,1251 include/slepc-private/ipimpl.h,317 ipimpl.h:^?ipimpl.h^A,1 #define _IPIMPL23,946 PETSC_EXTERN PetscLogEvent IP_InnerProduct,28,1022 PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,28,1022 PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix;28,1022 typedef struct _IPOps *IPOps;IPOps30,1099 struct _IPOps 32,1130 struct _p_IP 41,1536 include/slepc-private/makefile,141 makefile:^?makefile^A,1 CFLAGS 22,934 FFLAGS 23,945 SOURCEC 24,956 SOURCEF 25,967 SOURCEH 26,978 LIBBASE 28,1100 DIRS 29,1120 LOCDIR 30,1132 MANSEC 31,1166 include/slepc-private/mfnimpl.h,253 mfnimpl.h:^?mfnimpl.h^A,1 #define _MFNIMPL23,947 PETSC_EXTERN PetscLogEvent MFN_SetUp,28,1025 PETSC_EXTERN PetscLogEvent MFN_SetUp, MFN_Solve;28,1025 typedef struct _MFNOps *MFNOps;MFNOps30,1075 struct _MFNOps 32,1108 #define MAXMFNMONITORS 45,1460 struct _p_MFN 50,1527 include/slepc-private/nepimpl.h,501 nepimpl.h:^?nepimpl.h^A,1 #define _NEPIMPL23,947 PETSC_EXTERN PetscLogEvent NEP_SetUp,28,1025 PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,28,1025 PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,28,1025 PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,28,1025 PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;28,1025 typedef struct _NEPOps *NEPOps;NEPOps30,1118 struct _NEPOps 32,1151 #define MAXNEPMONITORS 45,1495 struct _p_NEP 50,1562 include/slepc-private/qepimpl.h,321 qepimpl.h:^?qepimpl.h^A,1 #define _QEPIMPL23,947 PETSC_EXTERN PetscLogEvent QEP_SetUp,28,1025 PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve,28,1025 PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense;28,1025 typedef struct _QEPOps *QEPOps;QEPOps30,1086 struct _QEPOps 32,1119 #define MAXQEPMONITORS 45,1470 struct _p_QEP 50,1537 include/slepc-private/slepcimpl.h,1244 slepcimpl.h:^?slepcimpl.h^A,1 #define _SLEPCIMPL23,949 PETSC_INTERN PetscBool SlepcBeganPetsc;28,1029 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,29,1069 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;29,1069 #define SlepcHeaderCreate(52,1891 struct _n_SlepcConvMonitor 59,2322 typedef struct _n_SlepcConvMonitor* SlepcConvMonitor;63,2400 include/slepc-private/stimpl.h,283 stimpl.h:^?stimpl.h^A,1 #define _STIMPL23,937 PETSC_EXTERN PetscLogEvent ST_SetUp,28,1013 PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,28,1013 PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose;28,1013 typedef struct _STOps *STOps;STOps30,1078 struct _STOps 32,1109 struct _p_ST 47,1651 include/slepc-private/svdimpl.h,252 svdimpl.h:^?svdimpl.h^A,1 #define _SVDIMPL23,947 PETSC_EXTERN PetscLogEvent SVD_SetUp,28,1025 PETSC_EXTERN PetscLogEvent SVD_SetUp,SVD_Solve;28,1025 typedef struct _SVDOps *SVDOps;SVDOps30,1074 struct _SVDOps 32,1107 #define MAXSVDMONITORS 45,1451 struct _p_SVD 50,1518 include/slepc-private/vecimplslepc.h,380 vecimplslepc.h:^?vecimplslepc.h^A,1 #define _VECIMPLSLEPC23,946 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,28,1029 PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY;28,1029 } Vecs_Contiguous;34,1288 #define SlepcValidVecsContiguous(38,1339 #define SlepcValidVecComp(39,1397 #define SlepcValidVecsContiguous(43,1450 #define SlepcValidVecComp(55,1958 } Vec_Comp_N;69,2465 } Vec_Comp;75,2671 src/makefile,28 makefile:^?makefile^A,1 DIRS 22,926 LOCDIR 24,978 src/ds/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1008 LOCDIR 26,1044 MANSEC 27,1063 src/ds/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,960 src/ds/examples/tests/makefile,819 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1014 EXAMPLESF 29,1141 MANSEC 30,1154 TESTS 31,1170 TESTEXAMPLES_C 33,1259 test1:test148,1991 test2:test252,2073 test3:test356,2155 test4:test460,2237 test5:test564,2319 test6:test668,2401 test7:test772,2483 test8:test876,2565 test9:test980,2647 test10:test1084,2729 test11:test1188,2816 test12:test1292,2903 runtest1_1:runtest1_198,3077 runtest2_1:runtest2_1104,3289 runtest3_1:runtest3_1110,3507 runtest4_1:runtest4_1116,3719 runtest5_1:runtest5_1122,3931 runtest6_1:runtest6_1128,4143 runtest7_1:runtest7_1134,4355 runtest8_1:runtest8_1140,4567 runtest9_1:runtest9_1146,4779 runtest10_1:runtest10_1152,4991 runtest11_1:runtest11_1158,5209 runtest12_1:runtest12_1164,5427 src/ds/examples/tests/test1.c,100 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__27,1067 #define __FUNCT__ 28,1084 int main(29,1109 src/ds/examples/tests/test10.c,100 test10.c:^?test10.c^A,1 static char help[help22,924 #undef __FUNCT__27,1076 #define __FUNCT__ 28,1093 int main(29,1118 src/ds/examples/tests/test11.c,100 test11.c:^?test11.c^A,1 static char help[help22,924 #undef __FUNCT__27,1077 #define __FUNCT__ 28,1094 int main(29,1119 src/ds/examples/tests/test12.c,99 test12.c:^?test12.c^A,1 static char help[help22,924 #undef __FUNCT__26,987 #define __FUNCT__ 27,1004 int main(28,1029 src/ds/examples/tests/test2.c,100 test2.c:^?test2.c^A,1 static char help[help22,924 #undef __FUNCT__27,1066 #define __FUNCT__ 28,1083 int main(29,1108 src/ds/examples/tests/test3.c,100 test3.c:^?test3.c^A,1 static char help[help22,924 #undef __FUNCT__27,1087 #define __FUNCT__ 28,1104 int main(29,1129 src/ds/examples/tests/test4.c,100 test4.c:^?test4.c^A,1 static char help[help22,924 #undef __FUNCT__27,1068 #define __FUNCT__ 28,1085 int main(29,1110 src/ds/examples/tests/test5.c,100 test5.c:^?test5.c^A,1 static char help[help22,924 #undef __FUNCT__27,1068 #define __FUNCT__ 28,1085 int main(29,1110 src/ds/examples/tests/test6.c,100 test6.c:^?test6.c^A,1 static char help[help22,924 #undef __FUNCT__27,1089 #define __FUNCT__ 28,1106 int main(29,1131 src/ds/examples/tests/test7.c,100 test7.c:^?test7.c^A,1 static char help[help22,924 #undef __FUNCT__27,1066 #define __FUNCT__ 28,1083 int main(29,1108 src/ds/examples/tests/test8.c,100 test8.c:^?test8.c^A,1 static char help[help22,924 #undef __FUNCT__27,1087 #define __FUNCT__ 28,1104 int main(29,1129 src/ds/examples/tests/test9.c,100 test9.c:^?test9.c^A,1 static char help[help22,924 #undef __FUNCT__27,1067 #define __FUNCT__ 28,1084 int main(29,1109 src/ds/impls/makefile,77 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,1001 MANSEC 27,1026 src/ds/impls/ghep/dsghep.c,653 dsghep.c:^?dsghep.c^A,1 #undef __FUNCT__25,1013 #define __FUNCT__ 26,1030 PetscErrorCode DSAllocate_GHEP(27,1066 #undef __FUNCT__41,1550 #define __FUNCT__ 42,1567 PetscErrorCode DSView_GHEP(43,1599 #undef __FUNCT__56,1962 #define __FUNCT__ 57,1979 PetscErrorCode DSVectors_GHEP(58,2014 #undef __FUNCT__95,3272 #define __FUNCT__ 96,3289 PetscErrorCode DSNormalize_GHEP(97,3326 #undef __FUNCT__135,4393 #define __FUNCT__ 136,4410 PetscErrorCode DSSort_GHEP(137,4442 #undef __FUNCT__161,5189 #define __FUNCT__ 162,5206 PetscErrorCode DSSolve_GHEP(163,5239 #undef __FUNCT__220,7426 #define __FUNCT__ 221,7443 PETSC_EXTERN PetscErrorCode DSCreate_GHEP(222,7477 src/ds/impls/ghep/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,978 SOURCEH 28,989 LIBBASE 29,1000 DIRS 30,1020 MANSEC 31,1031 LOCDIR 32,1045 src/ds/impls/ghiep/dsghiep.c,1296 dsghiep.c:^?dsghiep.c^A,1 #undef __FUNCT__24,1012 #define __FUNCT__ 25,1029 PetscErrorCode DSAllocate_GHIEP(26,1066 #undef __FUNCT__42,1677 #define __FUNCT__ 43,1694 PetscErrorCode DSSwitchFormat_GHIEP(44,1735 #undef __FUNCT__88,3099 #define __FUNCT__ 89,3116 PetscErrorCode DSView_GHIEP(90,3149 #undef __FUNCT__177,7247 #define __FUNCT__ 178,7264 PetscErrorCode DSVectors_GHIEP_Eigen_Some(179,7311 #undef __FUNCT__273,10924 #define __FUNCT__ 274,10941 PetscErrorCode DSVectors_GHIEP(275,10977 #undef __FUNCT__313,12239 #define __FUNCT__ 314,12256 PetscErrorCode DSGHIEPComplexEigs(319,12430 #undef __FUNCT__394,14498 #define __FUNCT__ 395,14515 PetscErrorCode DSSort_GHIEP(396,14548 #undef __FUNCT__447,16199 #define __FUNCT__ 448,16216 PetscErrorCode DSGHIEPInverseIteration(453,16352 #undef __FUNCT__519,18826 #define __FUNCT__ 520,18843 PetscErrorCode DSGHIEPRealBlocks(524,18934 #undef __FUNCT__638,23068 #define __FUNCT__ 639,23085 PetscErrorCode DSSolve_GHIEP_QR_II(640,23125 #undef __FUNCT__732,26038 #define __FUNCT__ 733,26055 PetscErrorCode DSSolve_GHIEP_QR(734,26092 #undef __FUNCT__836,29667 #define __FUNCT__ 837,29684 PetscErrorCode DSNormalize_GHIEP(838,29722 #undef __FUNCT__893,31273 #define __FUNCT__ 894,31290 PETSC_EXTERN PetscErrorCode DSCreate_GHIEP(895,31325 src/ds/impls/ghiep/dsghiep_dqds.c,781 dsghiep_dqds.c:^?dsghiep_dqds.c^A,1 #undef __FUNCT__35,1404 #define __FUNCT__ 36,1421 static PetscErrorCode ScanJ(48,1669 #undef __FUNCT__84,2692 #define __FUNCT__ 85,2709 static PetscErrorCode Prologue(98,3138 #undef __FUNCT__162,5122 #define __FUNCT__ 163,5139 static PetscErrorCode LUfac(164,5165 #undef __FUNCT__197,6187 #define __FUNCT__ 198,6204 static PetscErrorCode RealDQDS(199,6233 #undef __FUNCT__228,7050 #define __FUNCT__ 229,7067 static PetscErrorCode TridqdsZhuang3(230,7102 #undef __FUNCT__306,9199 #define __FUNCT__ 307,9216 static PetscErrorCode TridqdsZhuang(308,9250 #undef __FUNCT__447,13102 #define __FUNCT__ 448,13119 static PetscErrorCode DSGHIEP_Eigen3DQDS(449,13158 #undef __FUNCT__749,25429 #define __FUNCT__ 750,25446 PetscErrorCode DSSolve_GHIEP_DQDS_II(751,25488 src/ds/impls/ghiep/dsghiep_hz.c,386 dsghiep_hz.c:^?dsghiep_hz.c^A,1 #undef __FUNCT__36,1478 #define __FUNCT__ 37,1495 static PetscErrorCode UnifiedRotation(42,1671 #undef __FUNCT__77,2923 #define __FUNCT__ 78,2940 static PetscErrorCode HZStep(79,2967 #undef __FUNCT__236,9189 #define __FUNCT__ 237,9206 static PetscErrorCode HZIteration(238,9238 #undef __FUNCT__308,11726 #define __FUNCT__ 309,11743 PetscErrorCode DSSolve_GHIEP_HZ(310,11780 src/ds/impls/ghiep/dsghiep_ivit.c,804 dsghiep_ivit.c:^?dsghiep_ivit.c^A,1 struct HRtr25,1013 #undef __FUNCT__38,1210 #define __FUNCT__ 39,1227 static PetscErrorCode HRGen(51,1526 #undef __FUNCT__90,2514 #define __FUNCT__ 91,2531 static PetscErrorCode HRApply(98,2679 #undef __FUNCT__122,3290 #define __FUNCT__ 123,3307 static PetscErrorCode TridiagDiag_HHR(135,3634 #undef __FUNCT__317,9941 #define __FUNCT__ 318,9958 static PetscErrorCode MadeHRtr(319,9987 #undef __FUNCT__395,12998 #define __FUNCT__ 396,13015 static PetscErrorCode TryHRIt(403,13302 #undef __FUNCT__544,19326 #define __FUNCT__ 545,19343 static PetscErrorCode PseudoOrthog_HR(549,19447 #undef __FUNCT__651,22569 #define __FUNCT__ 652,22586 PetscErrorCode DSGHIEPOrthogEigenv(653,22626 #undef __FUNCT__750,25441 #define __FUNCT__ 751,25458 PetscErrorCode DSIntermediate_GHIEP(755,25573 src/ds/impls/ghiep/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1022 SOURCEH 28,1033 LIBBASE 29,1044 DIRS 30,1064 MANSEC 31,1075 LOCDIR 32,1089 src/ds/impls/gnhep/dsgnhep.c,1191 dsgnhep.c:^?dsgnhep.c^A,1 #undef __FUNCT__44,1775 #define __FUNCT__ 45,1792 PetscErrorCode DSAllocate_GNHEP(46,1829 #undef __FUNCT__61,2373 #define __FUNCT__ 62,2390 PetscErrorCode DSView_GNHEP(63,2423 #undef __FUNCT__83,3041 #define __FUNCT__ 84,3058 PetscErrorCode DSVectors_GNHEP_Eigen_Some(85,3105 #undef __FUNCT__143,5571 #define __FUNCT__ 144,5588 PetscErrorCode DSVectors_GNHEP_Eigen_All(145,5634 #undef __FUNCT__193,7404 #define __FUNCT__ 194,7421 PetscErrorCode DSVectors_GNHEP(195,7457 #undef __FUNCT__216,8112 #define __FUNCT__ 217,8129 PetscErrorCode DSNormalize_GNHEP(218,8167 #undef __FUNCT__274,9833 #define __FUNCT__ 275,9850 PetscErrorCode DSSort_GNHEP_Arbitrary(276,9893 #undef __FUNCT__327,11971 #define __FUNCT__ 328,11988 PetscErrorCode DSSort_GNHEP_Total(329,12027 #undef __FUNCT__426,15308 #define __FUNCT__ 427,15325 PetscErrorCode DSSort_GNHEP(428,15358 #undef __FUNCT__441,15708 #define __FUNCT__ 442,15725 static PetscErrorCode CleanDenseSchur(448,15955 #undef __FUNCT__543,19818 #define __FUNCT__ 544,19835 PetscErrorCode DSSolve_GNHEP(545,19869 #undef __FUNCT__596,21965 #define __FUNCT__ 597,21982 PETSC_EXTERN PetscErrorCode DSCreate_GNHEP(598,22017 src/ds/impls/gnhep/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,979 SOURCEH 28,990 LIBBASE 29,1001 DIRS 30,1021 MANSEC 31,1032 LOCDIR 32,1046 src/ds/impls/hep/dshep.c,1673 dshep.c:^?dshep.c^A,1 #undef __FUNCT__25,1013 #define __FUNCT__ 26,1030 PetscErrorCode DSAllocate_HEP(27,1065 #undef __FUNCT__66,2631 #define __FUNCT__ 67,2648 static PetscErrorCode DSSwitchFormat_HEP(68,2687 #undef __FUNCT__106,3864 #define __FUNCT__ 107,3881 PetscErrorCode DSView_HEP(108,3912 #undef __FUNCT__174,6885 #define __FUNCT__ 175,6902 PetscErrorCode DSVectors_HEP(176,6936 #undef __FUNCT__213,8180 #define __FUNCT__ 214,8197 PetscErrorCode DSNormalize_HEP(215,8233 #undef __FUNCT__234,8762 #define __FUNCT__ 235,8779 static PetscErrorCode ArrowTridiag(283,10201 #undef __FUNCT__332,11611 #define __FUNCT__ 333,11628 static PetscErrorCode DSIntermediate_HEP(337,11729 #undef __FUNCT__392,13757 #define __FUNCT__ 393,13774 PetscErrorCode DSSort_HEP(394,13805 #undef __FUNCT__422,14618 #define __FUNCT__ 423,14635 PetscErrorCode DSUpdateExtraRow_HEP(424,14676 #undef __FUNCT__455,15524 #define __FUNCT__ 456,15541 PetscErrorCode DSSolve_HEP_QR(457,15576 #undef __FUNCT__509,17257 #define __FUNCT__ 510,17274 PetscErrorCode DSSolve_HEP_MRRR(511,17311 #undef __FUNCT__593,20307 #define __FUNCT__ 594,20324 PetscErrorCode DSSolve_HEP_DC(595,20359 #undef __FUNCT__659,22458 #define __FUNCT__ 660,22475 PetscErrorCode DSTruncate_HEP(661,22510 #undef __FUNCT__678,22917 #define __FUNCT__ 679,22934 PetscErrorCode DSCond_HEP(680,22965 #undef __FUNCT__724,24552 #define __FUNCT__ 725,24569 PetscErrorCode DSTranslateRKS_HEP(726,24608 #undef __FUNCT__778,26538 #define __FUNCT__ 779,26555 PetscErrorCode DSFunction_EXP_HEP_DIAG(780,26599 #undef __FUNCT__812,27500 #define __FUNCT__ 813,27517 PETSC_EXTERN PetscErrorCode DSCreate_HEP(814,27550 src/ds/impls/hep/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1044 src/ds/impls/nep/dsnep.c,650 dsnep.c:^?dsnep.c^A,1 #undef __FUNCT__25,1013 #define __FUNCT__ 26,1030 PetscErrorCode DSAllocate_NEP(27,1065 #undef __FUNCT__40,1550 #define __FUNCT__ 41,1567 PetscErrorCode DSView_NEP(42,1598 #undef __FUNCT__61,2210 #define __FUNCT__ 62,2227 PetscErrorCode DSVectors_NEP(63,2261 #undef __FUNCT__79,2732 #define __FUNCT__ 80,2749 PetscErrorCode DSNormalize_NEP(81,2785 #undef __FUNCT__114,3665 #define __FUNCT__ 115,3682 PetscErrorCode DSSort_NEP(116,3713 #undef __FUNCT__140,4459 #define __FUNCT__ 141,4476 PetscErrorCode DSSolve_NEP_SLP(142,4512 #undef __FUNCT__264,8529 #define __FUNCT__ 265,8546 PETSC_EXTERN PetscErrorCode DSCreate_NEP(266,8579 src/ds/impls/nep/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1044 src/ds/impls/nhep/dsnhep.c,1832 dsnhep.c:^?dsnhep.c^A,1 #undef __FUNCT__25,1013 #define __FUNCT__ 26,1030 PetscErrorCode DSAllocate_NHEP(27,1066 #undef __FUNCT__40,1491 #define __FUNCT__ 41,1508 PetscErrorCode DSView_NHEP(42,1540 #undef __FUNCT__60,2031 #define __FUNCT__ 61,2048 PetscErrorCode DSVectors_NHEP_Refined_Some(62,2096 #undef __FUNCT__117,4215 #define __FUNCT__ 118,4232 PetscErrorCode DSVectors_NHEP_Refined_All(119,4279 #undef __FUNCT__131,4541 #define __FUNCT__ 132,4558 PetscErrorCode DSVectors_NHEP_Eigen_Some(133,4604 #undef __FUNCT__205,7354 #define __FUNCT__ 206,7371 PetscErrorCode DSVectors_NHEP_Eigen_All(207,7416 #undef __FUNCT__247,8803 #define __FUNCT__ 248,8820 PetscErrorCode DSVectors_NHEP(249,8855 #undef __FUNCT__292,10272 #define __FUNCT__ 293,10289 PetscErrorCode DSNormalize_NHEP(294,10326 #undef __FUNCT__349,11873 #define __FUNCT__ 350,11890 PetscErrorCode DSSort_NHEP_Arbitrary(351,11932 #undef __FUNCT__399,13731 #define __FUNCT__ 400,13748 PetscErrorCode DSSort_NHEP_Total(401,13786 #undef __FUNCT__488,16324 #define __FUNCT__ 489,16341 PetscErrorCode DSSort_NHEP(490,16373 #undef __FUNCT__503,16720 #define __FUNCT__ 504,16737 PetscErrorCode DSUpdateExtraRow_NHEP(505,16779 #undef __FUNCT__527,17425 #define __FUNCT__ 528,17442 PetscErrorCode DSSolve_NHEP(529,17475 #undef __FUNCT__601,19955 #define __FUNCT__ 602,19972 PetscErrorCode DSTruncate_NHEP(603,20008 #undef __FUNCT__627,20656 #define __FUNCT__ 628,20673 PetscErrorCode DSCond_NHEP(629,20705 #undef __FUNCT__673,22317 #define __FUNCT__ 674,22334 PetscErrorCode DSTranslateHarmonic_NHEP(675,22379 #define MAX_PADE 756,25170 #undef __FUNCT__758,25190 #define __FUNCT__ 759,25207 PetscErrorCode DSFunction_EXP_NHEP_PADE(760,25252 #undef __FUNCT__864,28704 #define __FUNCT__ 865,28721 PETSC_EXTERN PetscErrorCode DSCreate_NHEP(866,28755 src/ds/impls/nhep/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,978 SOURCEH 28,989 LIBBASE 29,1000 DIRS 30,1020 MANSEC 31,1031 LOCDIR 32,1045 src/ds/impls/svd/dssvd.c,668 dssvd.c:^?dssvd.c^A,1 #undef __FUNCT__25,1013 #define __FUNCT__ 26,1030 PetscErrorCode DSAllocate_SVD(27,1065 #undef __FUNCT__67,2683 #define __FUNCT__ 68,2700 static PetscErrorCode DSSwitchFormat_SVD(69,2739 #undef __FUNCT__104,3834 #define __FUNCT__ 105,3851 PetscErrorCode DSView_SVD(106,3882 #undef __FUNCT__158,6132 #define __FUNCT__ 159,6149 PetscErrorCode DSVectors_SVD(160,6183 #undef __FUNCT__173,6499 #define __FUNCT__ 174,6516 PetscErrorCode DSSort_SVD(175,6547 #undef __FUNCT__203,7383 #define __FUNCT__ 204,7400 PetscErrorCode DSSolve_SVD_DC(205,7435 #undef __FUNCT__302,11274 #define __FUNCT__ 303,11291 PETSC_EXTERN PetscErrorCode DSCreate_SVD(304,11324 src/ds/impls/svd/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1044 src/ds/interface/dsbasic.c,3164 dsbasic.c:^?dsbasic.c^A,1 PetscFunctionList DSList 26,1006 PetscBool DSRegisterAllCalled 27,1036 PetscClassId DS_CLASSID 28,1089 PetscLogEvent DS_Solve 29,1123 static PetscBool DSPackageInitialized 30,1199 const char *DSMatName[DSMatName31,1253 DSMatType DSMatExtra[DSMatExtra32,1402 #undef __FUNCT__34,1551 #define __FUNCT__ 35,1568 PetscErrorCode DSFinalizePackage(44,1800 #undef __FUNCT__55,2050 #define __FUNCT__ 56,2067 PetscErrorCode DSInitializePackage(66,2387 #undef __FUNCT__105,3852 #define __FUNCT__ 106,3869 PetscErrorCode DSCreate(126,4264 #undef __FUNCT__173,5479 #define __FUNCT__ 174,5496 PetscErrorCode DSSetOptionsPrefix(194,6011 #undef __FUNCT__204,6269 #define __FUNCT__ 205,6286 PetscErrorCode DSAppendOptionsPrefix(224,6807 #undef __FUNCT__234,7071 #define __FUNCT__ 235,7088 PetscErrorCode DSGetOptionsPrefix(255,7585 #undef __FUNCT__266,7876 #define __FUNCT__ 267,7893 PetscErrorCode DSSetType(281,8141 #undef __FUNCT__303,8850 #define __FUNCT__ 304,8867 PetscErrorCode DSGetType(320,9157 #undef __FUNCT__329,9369 #define __FUNCT__ 330,9386 PetscErrorCode DSSetMethod(344,9675 #undef __FUNCT__355,10139 #define __FUNCT__ 356,10156 PetscErrorCode DSGetMethod(372,10435 #undef __FUNCT__381,10633 #define __FUNCT__ 382,10650 PetscErrorCode DSSetFunctionMethod(396,10980 #undef __FUNCT__407,11453 #define __FUNCT__ 408,11470 PetscErrorCode DSGetFunctionMethod(424,11801 #undef __FUNCT__433,12010 #define __FUNCT__ 434,12027 PetscErrorCode DSSetCompact(456,12588 #undef __FUNCT__465,12804 #define __FUNCT__ 466,12821 PetscErrorCode DSGetCompact(482,13072 #undef __FUNCT__491,13273 #define __FUNCT__ 492,13290 PetscErrorCode DSSetExtraRow(515,13964 #undef __FUNCT__525,14312 #define __FUNCT__ 526,14329 PetscErrorCode DSGetExtraRow(542,14576 #undef __FUNCT__551,14776 #define __FUNCT__ 552,14793 PetscErrorCode DSSetRefined(577,15493 #undef __FUNCT__586,15706 #define __FUNCT__ 587,15723 PetscErrorCode DSGetRefined(603,15973 #undef __FUNCT__612,16171 #define __FUNCT__ 613,16188 PetscErrorCode DSSetEigenvalueComparison(645,17246 #undef __FUNCT__654,17543 #define __FUNCT__ 655,17560 PetscErrorCode DSGetEigenvalueComparison(689,18646 #undef __FUNCT__698,18962 #define __FUNCT__ 699,18979 PetscErrorCode DSSetFN(723,19692 #undef __FUNCT__748,20589 #define __FUNCT__ 749,20606 PetscErrorCode DSGetFN(766,20972 #undef __FUNCT__776,21274 #define __FUNCT__ 777,21291 PetscErrorCode DSGetNumFN(794,21600 #undef __FUNCT__803,21784 #define __FUNCT__ 804,21801 PetscErrorCode DSSetFromOptions(818,22082 #undef __FUNCT__841,23128 #define __FUNCT__ 842,23145 PetscErrorCode DSView(867,23842 #undef __FUNCT__917,26169 #define __FUNCT__ 918,26186 PetscErrorCode DSAllocate(933,26595 #undef __FUNCT__950,27112 #define __FUNCT__ 951,27129 PetscErrorCode DSReset(964,27341 #undef __FUNCT__1000,28278 #define __FUNCT__ 1001,28295 PetscErrorCode DSDestroy(1014,28521 #undef __FUNCT__1027,28875 #define __FUNCT__ 1028,28892 PetscErrorCode DSRegister(1046,29265 #undef __FUNCT__1063,29814 #define __FUNCT__ 1064,29831 PetscErrorCode DSRegisterAll(1072,29987 src/ds/interface/dsops.c,1785 dsops.c:^?dsops.c^A,1 #undef __FUNCT__26,1031 #define __FUNCT__ 27,1048 PetscErrorCode DSGetLeadingDimension(44,1415 #undef __FUNCT__52,1594 #define __FUNCT__ 53,1611 PetscErrorCode DSSetState(76,2242 #undef __FUNCT__97,2831 #define __FUNCT__ 98,2848 PetscErrorCode DSGetState(114,3095 #undef __FUNCT__122,3278 #define __FUNCT__ 123,3295 PetscErrorCode DSSetDimensions(145,3857 #undef __FUNCT__187,5529 #define __FUNCT__ 188,5546 PetscErrorCode DSGetDimensions(212,6126 #undef __FUNCT__224,6427 #define __FUNCT__ 225,6444 PetscErrorCode DSTruncate(243,6890 #undef __FUNCT__263,7860 #define __FUNCT__ 264,7877 PetscErrorCode DSGetArray(283,8311 #undef __FUNCT__296,8873 #define __FUNCT__ 297,8890 PetscErrorCode DSRestoreArray(312,9199 #undef __FUNCT__326,9608 #define __FUNCT__ 327,9625 PetscErrorCode DSGetArrayReal(346,10072 #undef __FUNCT__359,10638 #define __FUNCT__ 360,10655 PetscErrorCode DSRestoreArrayReal(375,10976 #undef __FUNCT__389,11387 #define __FUNCT__ 390,11404 PetscErrorCode DSSolve(409,11898 #undef __FUNCT__429,12831 #define __FUNCT__ 430,12848 PetscErrorCode DSComputeFunction(448,13289 #undef __FUNCT__467,14245 #define __FUNCT__ 468,14262 PetscErrorCode DSSort(502,15625 #undef __FUNCT__524,16923 #define __FUNCT__ 525,16940 PetscErrorCode DSVectors(563,18167 #undef __FUNCT__583,19171 #define __FUNCT__ 584,19188 PetscErrorCode DSNormalize(606,19809 #undef __FUNCT__625,20727 #define __FUNCT__ 626,20744 PetscErrorCode DSUpdateExtraRow(640,21047 #undef __FUNCT__657,21830 #define __FUNCT__ 658,21847 PetscErrorCode DSCond(673,22147 #undef __FUNCT__689,22737 #define __FUNCT__ 690,22754 PetscErrorCode DSTranslateHarmonic(721,23851 #undef __FUNCT__738,24614 #define __FUNCT__ 739,24631 PetscErrorCode DSTranslateRKS(764,25503 src/ds/interface/dspriv.c,1409 dspriv.c:^?dspriv.c^A,1 #undef __FUNCT__27,1037 #define __FUNCT__ 28,1054 PetscErrorCode DSAllocateMat_Private(29,1096 #undef __FUNCT__48,1649 #define __FUNCT__ 49,1666 PetscErrorCode DSAllocateMatReal_Private(50,1712 #undef __FUNCT__67,2210 #define __FUNCT__ 68,2227 PetscErrorCode DSAllocateWork_Private(69,2270 #undef __FUNCT__95,3171 #define __FUNCT__ 96,3188 PetscErrorCode DSViewMat_Private(97,3226 #undef __FUNCT__153,5260 #define __FUNCT__ 154,5277 PetscErrorCode DSSortEigenvalues_Private(155,5323 #undef __FUNCT__209,6862 #define __FUNCT__ 210,6879 PetscErrorCode DSSortEigenvaluesReal_Private(211,6929 #undef __FUNCT__236,7658 #define __FUNCT__ 237,7675 PetscErrorCode DSCopyMatrix_Private(242,7815 #undef __FUNCT__260,8224 #define __FUNCT__ 261,8241 PetscErrorCode DSPermuteColumns_Private(262,8286 #undef __FUNCT__285,8805 #define __FUNCT__ 286,8822 PetscErrorCode DSPermuteRows_Private(287,8864 #undef __FUNCT__311,9474 #define __FUNCT__ 312,9491 PetscErrorCode DSPermuteBoth_Private(313,9533 #undef __FUNCT__342,10335 #define __FUNCT__ 343,10352 PetscErrorCode DSSetIdentity(348,10494 #undef __FUNCT__368,11129 #define __FUNCT__ 369,11146 PetscErrorCode DSComputeMatrix(375,11406 #undef __FUNCT__403,12416 #define __FUNCT__ 404,12433 PetscErrorCode DSOrthogonalize(416,12792 #undef __FUNCT__463,15004 #define __FUNCT__ 464,15021 PetscErrorCode DSPseudoOrthogonalize(479,15577 src/ds/interface/makefile,158 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,996 SOURCEH 28,1007 LIBBASE 29,1018 DIRS 30,1038 MANSEC 31,1049 LOCDIR 32,1063 src/ds/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1014 SOURCEH 28,1025 DIRS 29,1036 LIBBASE 30,1047 LOCDIR 31,1067 src/ds/interface/ftn-custom/zpsf.c,726 zpsf.c:^?zpsf.c^A,1 PETSC_EXTERN void PETSC_STDCALL dscreate_(41,1656 PETSC_EXTERN void PETSC_STDCALL dsdestroy_(46,1799 PETSC_EXTERN void PETSC_STDCALL dssetoptionsprefix_(51,1901 PETSC_EXTERN void PETSC_STDCALL dsappendoptionsprefix_(60,2135 PETSC_EXTERN void PETSC_STDCALL dsgetoptionsprefix_(69,2375 PETSC_EXTERN void PETSC_STDCALL dsview_(77,2638 src/eps/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1010 LOCDIR 26,1046 MANSEC 27,1066 src/eps/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,961 src/eps/examples/tests/makefile,2012 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1015 EXAMPLESF 30,1167 MANSEC 31,1209 TESTS 32,1226 TESTEXAMPLES_C 35,1361 TESTEXAMPLES_C_NOCOMPLEX 47,2106 TESTEXAMPLES_C_NOF128 48,2165 TESTEXAMPLES_FORTRAN 49,2224 TESTEXAMPLES_BLOPEX 52,2420 test1:test156,2525 test2:test260,2607 test3:test364,2689 test4:test468,2771 test5:test572,2853 test6:test676,2935 test7f:test7f80,3017 test8:test884,3104 test9:test988,3186 test10:test1092,3268 test11:test1196,3355 test12:test12100,3442 test13:test13104,3529 test14:test14108,3616 test14f:test14f112,3703 test15f:test15f116,3795 EPSALL 121,3973 EPSNS 122,4020 EPSAR 123,4059 TESTCODE 125,4079 runtest1_1:runtest1_1131,4288 runtest1_2:runtest1_2141,4661 runtest2_1:runtest2_1146,4848 runtest3_1:runtest3_1157,5286 runtest4_1:runtest4_1166,5562 runtest5_1:runtest5_1174,5751 runtest5_blopex:runtest5_blopex194,6736 testtest5_blopex:testtest5_blopex200,7018 ${MAKE} SLEPC_ARCH=${MAKE} SLEPC_ARCH210,7660 runtest6_1:runtest6_1212,7767 runtest7f_1:runtest7f_1221,8042 testtest7f:testtest7f226,8161 elif [ "${MPIEXEC}" elif [ "${MPIEXEC}"230,8371 GFORTRAN_UNBUFFERED_ALL=233,8544 cat test7f_1.tmp; ok=cat test7f_1.tmp; ok237,8928 ${MAKE} SLEPC_ARCH=${MAKE} SLEPC_ARCH239,9005 runtest8_1:runtest8_1243,9141 runtest9_1:runtest9_1252,9426 runtest10_1:runtest10_1262,9781 testtest10:testtest10271,10062 elif [ "${MPIEXEC}" elif [ "${MPIEXEC}"275,10285 cat test10_1.tmp; ok=cat test10_1.tmp; ok282,10844 cat test10_1.tmp; ok=cat test10_1.tmp; ok288,11337 ${MAKE} SLEPC_ARCH=${MAKE} SLEPC_ARCH290,11418 runtest11_1:runtest11_1294,11553 runtest12_1:runtest12_1306,12074 runtest13_1:runtest13_1315,12352 runtest13_2:runtest13_2324,12636 runtest14_1:runtest14_1333,12939 runtest14f_1:runtest14f_1338,13047 runtest15f_1:runtest15f_1343,13158 src/eps/examples/tests/test1.c,100 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__26,1034 #define __FUNCT__ 27,1051 int main(28,1076 src/eps/examples/tests/test10.c,100 test10.c:^?test10.c^A,1 static char help[help22,924 #undef __FUNCT__30,1335 #define __FUNCT__ 31,1352 int main 32,1377 src/eps/examples/tests/test11.c,285 test11.c:^?test11.c^A,1 static char help[help22,924 #undef __FUNCT__37,1557 #define __FUNCT__ 38,1574 int main(39,1599 #undef __FUNCT__136,5208 #define __FUNCT__ 137,5225 PetscErrorCode MatMarkovModel(157,6381 #undef __FUNCT__202,7766 #define __FUNCT__ 203,7783 PetscErrorCode MyEigenSort(212,8124 src/eps/examples/tests/test12.c,189 test12.c:^?test12.c^A,1 static char help[help22,924 #undef __FUNCT__29,1220 #define __FUNCT__ 30,1237 PetscErrorCode PCApply_User(31,1270 #undef __FUNCT__40,1435 #define __FUNCT__ 41,1452 int main(42,1477 src/eps/examples/tests/test13.c,197 test13.c:^?test13.c^A,1 static char help[help22,924 #undef __FUNCT__26,1007 #define __FUNCT__ 27,1024 PetscErrorCode MyArbitrarySelection(28,1065 #undef __funct__40,1404 #define __funct__ 41,1421 int main(42,1446 src/eps/examples/tests/test14.c,100 test14.c:^?test14.c^A,1 static char help[help22,924 #undef __FUNCT__26,1006 #define __FUNCT__ 27,1023 int main(28,1048 src/eps/examples/tests/test15f.F,40 test15f.F:^?test15f.F^A,1 subroutine MyEPSMonitor(189,6357 src/eps/examples/tests/test2.c,100 test2.c:^?test2.c^A,1 static char help[help22,924 #undef __FUNCT__26,1031 #define __FUNCT__ 27,1048 int main(28,1073 src/eps/examples/tests/test3.c,100 test3.c:^?test3.c^A,1 static char help[help22,924 #undef __FUNCT__26,1032 #define __FUNCT__ 27,1049 int main(28,1074 src/eps/examples/tests/test4.c,100 test4.c:^?test4.c^A,1 static char help[help22,924 #undef __FUNCT__29,1214 #define __FUNCT__ 30,1231 int main(31,1256 src/eps/examples/tests/test5.c,100 test5.c:^?test5.c^A,1 static char help[help22,924 #undef __FUNCT__29,1220 #define __FUNCT__ 30,1237 int main(31,1262 src/eps/examples/tests/test6.c,100 test6.c:^?test6.c^A,1 static char help[help22,924 #undef __FUNCT__29,1179 #define __FUNCT__ 30,1196 int main(31,1221 src/eps/examples/tests/test8.c,330 test8.c:^?test8.c^A,1 static char help[help22,924 #undef __FUNCT__36,1446 #define __FUNCT__ 37,1463 int main(38,1488 static void tv(117,4649 #undef __FUNCT__132,4930 #define __FUNCT__ 133,4947 PetscErrorCode MatMult_Laplacian2D(150,5467 #undef __FUNCT__182,6264 #define __FUNCT__ 183,6281 PetscErrorCode MatGetDiagonal_Laplacian2D(184,6328 src/eps/examples/tests/test9.c,285 test9.c:^?test9.c^A,1 static char help[help22,924 #undef __FUNCT__36,1559 #define __FUNCT__ 37,1576 int main(38,1601 #undef __FUNCT__127,4795 #define __FUNCT__ 128,4812 PetscErrorCode MatMarkovModel(148,5968 #undef __FUNCT__193,7353 #define __FUNCT__ 194,7370 PetscErrorCode MyEigenSort(202,7685 src/eps/examples/tests/test7f.F,0 test7f.F:^?test7f.F^A,1 src/eps/examples/tests/test14f.F,0 test14f.F:^?test14f.F^A,1 src/eps/examples/tutorials/ex1.c,100 ex1.c:^?ex1.c^A,1 static char help[help22,924 #undef __FUNCT__28,1178 #define __FUNCT__ 29,1195 int main(30,1220 src/eps/examples/tutorials/ex11.c,100 ex11.c:^?ex11.c^A,1 static char help[help22,924 #undef __FUNCT__30,1335 #define __FUNCT__ 31,1352 int main 32,1377 src/eps/examples/tutorials/ex12.c,194 ex12.c:^?ex12.c^A,1 static char help[help22,924 #undef __FUNCT__35,1429 #define __FUNCT__ 36,1446 int main 37,1471 #undef __FUNCT__188,7182 #define __FUNCT__ 189,7199 PetscErrorCode MatMarkovModel(208,8354 src/eps/examples/tutorials/ex13.c,100 ex13.c:^?ex13.c^A,1 static char help[help22,924 #undef __FUNCT__33,1422 #define __FUNCT__ 34,1439 int main(35,1464 src/eps/examples/tutorials/ex18.c,285 ex18.c:^?ex18.c^A,1 static char help[help22,924 #undef __FUNCT__37,1557 #define __FUNCT__ 38,1574 int main(39,1599 #undef __FUNCT__127,4870 #define __FUNCT__ 128,4887 PetscErrorCode MatMarkovModel(148,6043 #undef __FUNCT__193,7428 #define __FUNCT__ 194,7445 PetscErrorCode MyEigenSort(203,7786 src/eps/examples/tutorials/ex19.c,283 ex19.c:^?ex19.c^A,1 static char help[help22,924 #undef __FUNCT__30,1219 #define __FUNCT__ 31,1236 PetscErrorCode GetExactEigenvalues(32,1276 #undef __FUNCT__61,2066 #define __FUNCT__ 62,2083 PetscErrorCode FillMatrix(63,2114 #undef __FUNCT__96,3437 #define __FUNCT__ 97,3454 int main(98,3479 src/eps/examples/tutorials/ex2.c,100 ex2.c:^?ex2.c^A,1 static char help[help22,924 #undef __FUNCT__29,1247 #define __FUNCT__ 30,1264 int main(31,1289 src/eps/examples/tutorials/ex3.c,330 ex3.c:^?ex3.c^A,1 static char help[help22,924 #undef __FUNCT__36,1446 #define __FUNCT__ 37,1463 int main(38,1488 static void tv(115,4537 #undef __FUNCT__130,4818 #define __FUNCT__ 131,4835 PetscErrorCode MatMult_Laplacian2D(148,5355 #undef __FUNCT__180,6152 #define __FUNCT__ 181,6169 PetscErrorCode MatGetDiagonal_Laplacian2D(182,6216 src/eps/examples/tutorials/ex4.c,100 ex4.c:^?ex4.c^A,1 static char help[help22,924 #undef __FUNCT__29,1225 #define __FUNCT__ 30,1242 int main(31,1267 src/eps/examples/tutorials/ex5.c,194 ex5.c:^?ex5.c^A,1 static char help[help22,924 #undef __FUNCT__35,1448 #define __FUNCT__ 36,1465 int main(37,1490 #undef __FUNCT__116,4337 #define __FUNCT__ 117,4354 PetscErrorCode MatMarkovModel(137,5510 src/eps/examples/tutorials/ex6f.F,75 ex6f.F:^?ex6f.F^A,1 subroutine MatIsing_Mult(164,5750 SUBROUTINE MVMISG(199,6718 src/eps/examples/tutorials/ex7.c,100 ex7.c:^?ex7.c^A,1 static char help[help22,924 #undef __FUNCT__35,1670 #define __FUNCT__ 36,1687 int main(37,1712 src/eps/examples/tutorials/ex9.c,416 ex9.c:^?ex9.c^A,1 static char help[help22,924 } CTX_BRUSSEL;58,1996 #undef __FUNCT__60,2012 #define __FUNCT__ 61,2029 int main(62,2054 #undef __FUNCT__207,7602 #define __FUNCT__ 208,7619 PetscErrorCode MatMult_Brussel(209,7655 #undef __FUNCT__246,9100 #define __FUNCT__ 247,9117 PetscErrorCode MatShift_Brussel(248,9154 #undef __FUNCT__259,9391 #define __FUNCT__ 260,9408 PetscErrorCode MatGetDiagonal_Brussel(261,9451 src/eps/examples/tutorials/makefile,992 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1019 EXAMPLESF 29,1124 MANSEC 30,1162 TESTEXAMPLES_C 32,1180 TESTEXAMPLES_C_NOCOMPLEX 39,1614 TESTEXAMPLES_FORTRAN_NOCOMPLEX 41,1734 TESTEXAMPLES_F90 42,1796 ex1:ex146,1905 ex1f:ex1f50,1977 ex1f90:ex1f9054,2054 ex2:ex258,2141 ex3:ex362,2213 ex4:ex466,2285 ex5:ex570,2357 ex6f:ex6f74,2429 ex7:ex778,2506 ex9:ex982,2578 ex11:ex1186,2650 ex12:ex1290,2727 ex13:ex1394,2804 ex18:ex1898,2881 ex19:ex19102,2958 DATAPATH 107,3121 runex1_1:runex1_1109,3177 runex1f_1:runex1f_1115,3378 runex1f90_1:runex1f90_1121,3586 runex2_1:runex2_1127,3830 runex3_1:runex3_1133,4053 runex4_1:runex4_1139,4276 runex5_1:runex5_1145,4530 runex6f_1:runex6f_1151,4765 runex7_1:runex7_1157,5038 runex9_1:runex9_1163,5319 runex11_1:runex11_1169,5542 runex12_1:runex12_1175,5772 runex13_1:runex13_1181,6019 runex18_1:runex18_1187,6249 runex19_1:runex19_1193,6479 src/eps/examples/tutorials/ex1f90.F90,0 ex1f90.F90:^?ex1f90.F90^A,1 src/eps/examples/tutorials/ex1f.F,0 ex1f.F:^?ex1f.F^A,1 src/eps/impls/makefile,77 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,1022 MANSEC 27,1048 src/eps/impls/cg/makefile,76 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,972 MANSEC 27,1001 src/eps/impls/cg/rqcg/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,976 SOURCEH 28,987 LIBBASE 29,998 DIRS 30,1018 MANSEC 31,1029 LOCDIR 32,1044 src/eps/impls/cg/rqcg/rqcg.c,1123 rqcg.c:^?rqcg.c^A,1 } EPS_RQCG;48,1599 #undef __FUNCT__50,1612 #define __FUNCT__ 51,1629 PetscErrorCode EPSSetUp_RQCG(52,1663 #undef __FUNCT__113,4452 #define __FUNCT__ 114,4469 PetscErrorCode EPSSolve_RQCG(115,4503 #undef __FUNCT__262,11101 #define __FUNCT__ 263,11118 static PetscErrorCode EPSRQCGSetReset_RQCG(264,11159 #undef __FUNCT__273,11342 #define __FUNCT__ 274,11359 PetscErrorCode EPSRQCGSetReset(292,11819 #undef __FUNCT__303,12136 #define __FUNCT__ 304,12153 static PetscErrorCode EPSRQCGGetReset_RQCG(305,12194 #undef __FUNCT__314,12379 #define __FUNCT__ 315,12396 PetscErrorCode EPSRQCGGetReset(331,12694 #undef __FUNCT__342,12996 #define __FUNCT__ 343,13013 PetscErrorCode EPSReset_RQCG(344,13047 #undef __FUNCT__359,13502 #define __FUNCT__ 360,13519 PetscErrorCode EPSSetFromOptions_RQCG(361,13562 #undef __FUNCT__377,14021 #define __FUNCT__ 378,14038 PetscErrorCode EPSDestroy_RQCG(379,14074 #undef __FUNCT__390,14424 #define __FUNCT__ 391,14441 PetscErrorCode EPSView_RQCG(392,14474 #undef __FUNCT__406,14900 #define __FUNCT__ 407,14917 PETSC_EXTERN PetscErrorCode EPSCreate_RQCG(408,14952 src/eps/impls/ciss/ciss.c,3767 ciss.c:^?ciss.c^A,1 } EPS_CISS;80,2951 #undef __FUNCT__82,2964 #define __FUNCT__ 83,2981 static PetscErrorCode SetSolverComm(84,3015 #undef __FUNCT__96,3261 #define __FUNCT__ 97,3278 static PetscErrorCode SetPathParameter(98,3315 #undef __FUNCT__114,3751 #define __FUNCT__ 115,3768 static PetscErrorCode CISSVecSetRandom(116,3805 #undef __FUNCT__135,4346 #define __FUNCT__ 136,4363 static PetscErrorCode SolveLinearSystem(137,4401 #undef __FUNCT__183,6172 #define __FUNCT__ 184,6189 static PetscErrorCode ConstructS(185,6220 #undef __FUNCT__215,7257 #define __FUNCT__ 216,7274 static PetscErrorCode EstimateNumberEigs(217,7313 #undef __FUNCT__253,8706 #define __FUNCT__ 254,8723 static PetscErrorCode SetAddVector(255,8756 #undef __FUNCT__284,9777 #define __FUNCT__ 285,9794 static PetscErrorCode SolveAddLinearSystem(286,9835 #undef __FUNCT__304,10461 #define __FUNCT__ 305,10478 static PetscErrorCode CalcMu(306,10505 #undef __FUNCT__353,12379 #define __FUNCT__ 354,12396 static PetscErrorCode BlockHankel(355,12428 #undef __FUNCT__373,12919 #define __FUNCT__ 374,12936 static PetscErrorCode SVD(375,12960 #undef __FUNCT__428,14710 #define __FUNCT__ 429,14727 static PetscErrorCode ProjectMatrix(430,14761 #undef __FUNCT__452,15326 #define __FUNCT__ 453,15343 static PetscErrorCode isInsideGamma(454,15377 #undef __FUNCT__470,15815 #define __FUNCT__ 471,15832 PetscErrorCode EPSSetUp_CISS(472,15866 #undef __FUNCT__554,19572 #define __FUNCT__ 555,19589 PetscErrorCode EPSSolve_CISS(556,19623 #undef __FUNCT__744,27343 #define __FUNCT__ 745,27360 static PetscErrorCode EPSCISSSetRegion_CISS(746,27402 #undef __FUNCT__767,28051 #define __FUNCT__ 768,28068 PetscErrorCode EPSCISSSetRegion(790,28615 #undef __FUNCT__803,29112 #define __FUNCT__ 804,29129 static PetscErrorCode EPSCISSGetRegion_CISS(805,29171 #undef __FUNCT__816,29485 #define __FUNCT__ 817,29502 PetscErrorCode EPSCISSGetRegion(836,29912 #undef __FUNCT__846,30266 #define __FUNCT__ 847,30283 static PetscErrorCode EPSCISSSetSizes_CISS(848,30324 #undef __FUNCT__903,32553 #define __FUNCT__ 904,32570 PetscErrorCode EPSCISSSetSizes(936,33649 #undef __FUNCT__952,34330 #define __FUNCT__ 953,34347 static PetscErrorCode EPSCISSGetSizes_CISS(954,34388 #undef __FUNCT__968,34800 #define __FUNCT__ 969,34817 PetscErrorCode EPSCISSGetSizes(990,35302 #undef __FUNCT__1000,35720 #define __FUNCT__ 1001,35737 static PetscErrorCode EPSCISSSetThreshold_CISS(1002,35782 #undef __FUNCT__1026,36497 #define __FUNCT__ 1027,36514 PetscErrorCode EPSCISSSetThreshold(1047,37036 #undef __FUNCT__1059,37441 #define __FUNCT__ 1060,37458 static PetscErrorCode EPSCISSGetThreshold_CISS(1061,37503 #undef __FUNCT__1071,37766 #define __FUNCT__ 1072,37783 PetscErrorCode EPSCISSGetThreshold(1090,38187 #undef __FUNCT__1100,38501 #define __FUNCT__ 1101,38518 static PetscErrorCode EPSCISSSetRefinement_CISS(1102,38564 #undef __FUNCT__1128,39472 #define __FUNCT__ 1129,39489 PetscErrorCode EPSCISSSetRefinement(1151,40208 #undef __FUNCT__1164,40692 #define __FUNCT__ 1165,40709 static PetscErrorCode EPSCISSGetRefinement_CISS(1166,40755 #undef __FUNCT__1177,41086 #define __FUNCT__ 1178,41103 PetscErrorCode EPSCISSGetRefinement(1197,41613 #undef __FUNCT__1207,41963 #define __FUNCT__ 1208,41980 PetscErrorCode EPSReset_CISS(1209,42014 #undef __FUNCT__1234,42827 #define __FUNCT__ 1235,42844 PetscErrorCode EPSSetFromOptions_CISS(1236,42887 #undef __FUNCT__1275,45501 #define __FUNCT__ 1276,45518 PetscErrorCode EPSDestroy_CISS(1277,45554 #undef __FUNCT__1294,46488 #define __FUNCT__ 1295,46505 PetscErrorCode EPSView_CISS(1296,46538 #undef __FUNCT__1322,47977 #define __FUNCT__ 1323,47994 PETSC_EXTERN PetscErrorCode EPSCreate_CISS(1324,48029 src/eps/impls/ciss/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 26,964 FFLAGS 27,975 SOURCEC 28,986 SOURCEF 29,1004 SOURCEH 30,1015 LIBBASE 31,1026 DIRS 32,1046 MANSEC 33,1057 LOCDIR 34,1072 src/eps/impls/davidson/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,969 SOURCEH 28,980 LIBBASE 29,991 DIRS 30,1011 LOCDIR 31,1035 MANSEC 32,1070 src/eps/impls/davidson/common/davidson.c,2436 davidson.c:^?davidson.c^A,1 } EPS_DAVIDSON;50,2029 #undef __FUNCT__52,2046 #define __FUNCT__ 53,2063 PetscErrorCode EPSCreate_XD(54,2096 #undef __FUNCT__87,3297 #define __FUNCT__ 88,3314 PetscErrorCode EPSSetUp_XD(89,3346 #undef __FUNCT__308,13290 #define __FUNCT__ 309,13307 PetscErrorCode EPSSolve_XD(310,13339 #undef __FUNCT__346,14342 #define __FUNCT__ 347,14359 PetscErrorCode EPSReset_XD(348,14391 #undef __FUNCT__369,14957 #define __FUNCT__ 370,14974 PetscErrorCode EPSView_XD(371,15005 #undef __FUNCT__413,16896 #define __FUNCT__ 414,16913 PetscErrorCode EPSXDSetKrylovStart_XD(415,16956 #undef __FUNCT__424,17163 #define __FUNCT__ 425,17180 PetscErrorCode EPSXDGetKrylovStart_XD(426,17223 #undef __FUNCT__435,17432 #define __FUNCT__ 436,17449 PetscErrorCode EPSXDSetBlockSize_XD(437,17490 #undef __FUNCT__448,17883 #define __FUNCT__ 449,17900 PetscErrorCode EPSXDGetBlockSize_XD(450,17941 #undef __FUNCT__459,18141 #define __FUNCT__ 460,18158 PetscErrorCode EPSXDSetRestart_XD(461,18197 #undef __FUNCT__475,18760 #define __FUNCT__ 476,18777 PetscErrorCode EPSXDGetRestart_XD(477,18816 #undef __FUNCT__487,19060 #define __FUNCT__ 488,19077 PetscErrorCode EPSXDGetInitialSize_XD(489,19120 #undef __FUNCT__498,19328 #define __FUNCT__ 499,19345 PetscErrorCode EPSXDSetInitialSize_XD(500,19388 #undef __FUNCT__511,19800 #define __FUNCT__ 512,19817 PetscErrorCode EPSXDGetFix_XD(513,19852 #undef __FUNCT__522,20029 #define __FUNCT__ 523,20046 PetscErrorCode EPSJDSetFix_JD(524,20081 #undef __FUNCT__535,20425 #define __FUNCT__ 536,20442 PetscErrorCode EPSXDSetBOrth_XD(537,20479 #undef __FUNCT__546,20662 #define __FUNCT__ 547,20679 PetscErrorCode EPSXDGetBOrth_XD(548,20716 #undef __FUNCT__557,20901 #define __FUNCT__ 558,20918 PetscErrorCode EPSJDSetConstCorrectionTol_JD(559,20968 #undef __FUNCT__568,21196 #define __FUNCT__ 569,21213 PetscErrorCode EPSJDGetConstCorrectionTol_JD(570,21263 #undef __FUNCT__579,21493 #define __FUNCT__ 580,21510 PetscErrorCode EPSXDSetWindowSizes_XD(581,21553 #undef __FUNCT__595,22165 #define __FUNCT__ 596,22182 PetscErrorCode EPSXDGetWindowSizes_XD(597,22225 #undef __FUNCT__607,22499 #define __FUNCT__ 608,22516 PetscErrorCode EPSXDSetMethod(609,22551 #undef __FUNCT__618,22734 #define __FUNCT__ 619,22751 PetscErrorCode EPSXDGetMethod_XD(620,22789 #undef __FUNCT__629,22977 #define __FUNCT__ 630,22994 PetscErrorCode EPSComputeVectors_XD(640,23472 src/eps/impls/davidson/common/davidson.h,2230 davidson.h:^?davidson.h^A,1 typedef struct _dvdFunctionList 37,1360 } dvdFunctionList;41,1468 typedef PetscInt MatType_t;43,1488 #define DVD_MAT_HERMITIAN 44,1516 #define DVD_MAT_NEG_DEF 45,1549 #define DVD_MAT_POS_DEF 46,1580 #define DVD_MAT_SINGULAR 47,1611 #define DVD_MAT_COMPLEX 48,1643 #define DVD_MAT_IMPLICIT 49,1674 #define DVD_MAT_IDENTITY 50,1706 #define DVD_MAT_DIAG 51,1738 #define DVD_MAT_TRIANG 52,1766 #define DVD_MAT_UTRIANG 53,1796 #define DVD_MAT_LTRIANG 54,1827 #define DVD_MAT_UNITARY 55,1859 typedef PetscInt EPType_t;57,1892 #define DVD_EP_STD 58,1919 #define DVD_EP_HERMITIAN 59,1945 #define DVD_EP_INDEFINITE 60,1977 #define DVD_IS(62,2011 #define DVD_ISNOT(63,2043 DVD_HARM_NONE,66,2102 DVD_HARM_RR,67,2119 DVD_HARM_RRR,68,2134 DVD_HARM_REIGS,69,2150 DVD_HARM_LEIGS70,2168 } HarmType_t;71,2185 DVD_INITV_CLASSIC,74,2215 DVD_INITV_KRYLOV75,2236 } InitType_t;76,2255 DVD_PROJ_KXX,79,2285 DVD_PROJ_KZX80,2301 } ProjType_t;81,2316 DVD_METH_GD,84,2346 DVD_METH_JD,85,2361 DVD_METH_GD286,2376 } Method_t;87,2391 typedef struct _dvdDashboard 89,2404 } dvdDashboard;280,10398 #define DVD_FL_ADD_BEGIN(283,10467 #define DVD_FL_ADD_END(292,10757 #define DVD_FL_ADD_END0(296,10882 #define DVD_FL_ADD(305,11169 #define DVD_FL_CALL(307,11226 #define DVD_FL_DEL(313,11389 } dvdBlackboard;362,13407 #define DVD_STATE_PRECONF 364,13425 #define DVD_STATE_CONF 365,13453 #define DVD_STATE_RUN 366,13478 typedef PetscErrorCode (*dvdPrecond)dvdPrecond369,13522 typedef PetscErrorCode (*dvdCallback)dvdCallback370,13599 typedef PetscErrorCode (*e_Vchanged_type)e_Vchanged_type371,13653 typedef PetscBool (*isRestarting_type)isRestarting_type372,13771 typedef PetscErrorCode (*e_newIteration_type)e_newIteration_type373,13826 typedef PetscErrorCode (*improveX_type)improveX_type374,13888 typedef PetscErrorCode (*DvdReductionPostF)DvdReductionPostF377,14041 } DvdReductionChunk;386,14341 } DvdReduction;400,14813 } DvdMult_copy_func;405,14908 #undef __FUNCT__485,22220 #define __FUNCT__ 486,22237 PETSC_STATIC_INLINE PetscErrorCode dvd_improvex_compute_X(487,22280 #define _Ceil(517,23196 #define FromIntToScalar(518,23242 #define FromRealToScalar(519,23333 src/eps/impls/davidson/common/dvd_blas.c,2231 dvd_blas.c:^?dvd_blas.c^A,1 PetscLogEvent SLEPC_SlepcDenseMatProd 25,987 PetscLogEvent SLEPC_SlepcDenseNorm 26,1030 PetscLogEvent SLEPC_SlepcDenseCopy 27,1070 PetscLogEvent SLEPC_VecsMult 28,1110 #undef __FUNCT__33,1301 #define __FUNCT__ 34,1318 PetscErrorCode SlepcDenseMatProd(45,1672 #undef __FUNCT__84,3116 #define __FUNCT__ 85,3133 PetscErrorCode SlepcDenseMatProdTriang(99,3557 #undef __FUNCT__164,6276 #define __FUNCT__ 165,6293 PetscErrorCode SlepcDenseNorm(173,6570 #undef __FUNCT__205,7604 #define __FUNCT__ 206,7621 PetscErrorCode SlepcDenseCopy(213,7771 #undef __FUNCT__238,8532 #define __FUNCT__ 239,8549 PetscErrorCode SlepcDenseCopyTriang(246,8705 #undef __FUNCT__318,11413 #define __FUNCT__ 319,11430 PetscErrorCode SlepcUpdateVectorsZ(324,11591 #undef __FUNCT__333,11903 #define __FUNCT__ 334,11920 PetscErrorCode SlepcUpdateVectorsS(339,12093 #undef __FUNCT__392,14224 #define __FUNCT__ 393,14241 PetscErrorCode SlepcUpdateVectorsD(398,14378 #undef __FUNCT__449,16005 #define __FUNCT__ 450,16022 PetscErrorCode VecsMult(458,16370 #undef __FUNCT__606,21727 #define __FUNCT__ 607,21744 PetscErrorCode VecsMultIa(615,22145 #undef __FUNCT__665,24235 #define __FUNCT__ 666,24252 PetscErrorCode VecsMultIc(670,24356 #undef __FUNCT__690,24888 #define __FUNCT__ 691,24905 PetscErrorCode VecsMultIb(699,25269 #undef __FUNCT__741,26430 #define __FUNCT__ 742,26447 PetscErrorCode VecsMultS(749,26689 #undef __FUNCT__850,30776 #define __FUNCT__ 851,30793 PetscErrorCode VecsMultS_copy_func(852,30833 #undef __FUNCT__869,31365 #define __FUNCT__ 870,31382 PetscErrorCode VecsOrthonormalize(874,31512 #undef __FUNCT__928,33112 #define __FUNCT__ 929,33129 PetscErrorCode SlepcAllReduceSumBegin(933,33235 #undef __FUNCT__950,33691 #define __FUNCT__ 951,33708 PetscErrorCode SlepcAllReduceSum(952,33746 #undef __FUNCT__965,34309 #define __FUNCT__ 966,34326 PetscErrorCode SlepcAllReduceSumEnd(967,34367 #undef __FUNCT__989,34946 #define __FUNCT__ 990,34963 PetscErrorCode dvd_orthV(992,35021 #undef __FUNCT__1031,36815 #define __FUNCT__ 1032,36832 PetscErrorCode dvd_BorthV_faster(1034,36900 #undef __FUNCT__1078,39087 #define __FUNCT__ 1079,39104 PetscErrorCode dvd_BorthV_stable(1081,39172 src/eps/impls/davidson/common/dvd_calcpairs.c,2072 dvd_calcpairs.c:^?dvd_calcpairs.c^A,1 #undef __FUNCT__57,2883 #define __FUNCT__ 58,2900 PetscErrorCode dvd_calcpairs_qz(59,2937 #undef __FUNCT__233,10337 #define __FUNCT__ 234,10354 PetscErrorCode dvd_calcpairs_qz_start(235,10397 #undef __FUNCT__274,11623 #define __FUNCT__ 275,11640 PetscErrorCode dvd_calcpairs_qz_d(276,11679 #undef __FUNCT__285,11855 #define __FUNCT__ 286,11872 PetscErrorCode dvd_calcpairs_proj(287,11911 #define MAX_OPS 291,12009 #undef MAX_OPS379,15182 #undef __FUNCT__384,15282 #define __FUNCT__ 385,15299 PetscErrorCode dvd_calcpairs_updateV0(387,15384 #undef __FUNCT__425,17000 #define __FUNCT__ 426,17017 PetscErrorCode dvd_calcpairs_updateV1(428,17090 #undef __FUNCT__452,18169 #define __FUNCT__ 453,18186 PetscErrorCode dvd_calcpairs_updateW0(455,18271 #undef __FUNCT__494,20061 #define __FUNCT__ 495,20078 PetscErrorCode dvd_calcpairs_updateW1(497,20151 #undef __FUNCT__517,20799 #define __FUNCT__ 518,20816 PetscErrorCode dvd_calcpairs_updateAV0(520,20897 #undef __FUNCT__551,22182 #define __FUNCT__ 552,22199 PetscErrorCode dvd_calcpairs_updateAV1(554,22270 #undef __FUNCT__573,23048 #define __FUNCT__ 574,23065 PetscErrorCode dvd_calcpairs_updateBV0(576,23176 #undef __FUNCT__623,24989 #define __FUNCT__ 624,25006 PetscErrorCode dvd_calcpairs_updateBV1(626,25077 #undef __FUNCT__643,25795 #define __FUNCT__ 644,25812 PetscErrorCode dvd_calcpairs_projeig_solve(645,25860 #undef __FUNCT__676,27081 #define __FUNCT__ 677,27098 PetscErrorCode dvd_calcpairs_apply_arbitrary(678,27148 #undef __FUNCT__752,29413 #define __FUNCT__ 753,29430 PetscErrorCode dvd_calcpairs_selectPairs(754,29476 #undef __FUNCT__784,30487 #define __FUNCT__ 785,30504 PetscErrorCode dvd_calcpairs_res_0(789,30682 #undef __FUNCT__816,31919 #define __FUNCT__ 817,31936 PetscErrorCode dvd_calcpairs_proj_res(818,31979 #undef __FUNCT__871,33873 #define __FUNCT__ 872,33890 PetscErrorCode dvd_calcpairs_eig_res_0(879,34252 #undef __FUNCT__1007,39581 #define __FUNCT__ 1008,39598 PETSC_STATIC_INLINE PetscErrorCode dvd_calcpairs_updateBV0_gen(1009,39646 src/eps/impls/davidson/common/dvd_gd2.c,459 dvd_gd2.c:^?dvd_gd2.c^A,1 #define size_Z 33,1416 } dvdImprovex_gd2;41,1634 #undef __FUNCT__43,1654 #define __FUNCT__ 44,1671 PetscErrorCode dvd_improvex_gd2(45,1708 #undef __FUNCT__99,3603 #define __FUNCT__ 100,3620 PetscErrorCode dvd_improvex_gd2_d(101,3659 #define DVD_COMPLEX_RAYLEIGH_QUOTIENT(115,4013 #define DVD_COMPUTE_N_RR(135,5025 #define DVD_COMPUTE_N_RR(167,6586 #undef __FUNCT__183,7299 #define __FUNCT__ 184,7316 PetscErrorCode dvd_improvex_gd2_gen(185,7357 src/eps/impls/davidson/common/dvd_improvex.c,2640 dvd_improvex.c:^?dvd_improvex.c^A,1 #define size_Z 47,2831 } dvdImprovex_jd;92,4771 #undef __FUNCT__97,5028 #define __FUNCT__ 98,5045 PetscErrorCode dvd_improvex_jd(99,5081 #undef __FUNCT__175,7986 #define __FUNCT__ 176,8003 PetscErrorCode dvd_improvex_jd_start(177,8045 #undef __FUNCT__244,10840 #define __FUNCT__ 245,10857 PetscErrorCode dvd_improvex_jd_end(246,10897 #undef __FUNCT__262,11330 #define __FUNCT__ 263,11347 PetscErrorCode dvd_improvex_jd_d(264,11385 #undef __FUNCT__278,11737 #define __FUNCT__ 279,11754 PetscErrorCode dvd_improvex_jd_gen(280,11794 #undef __FUNCT__422,17161 #define __FUNCT__ 423,17178 PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmult(424,17214 #undef __FUNCT__465,18551 #define __FUNCT__ 466,18568 PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmulttrans(467,18609 #undef __FUNCT__506,19935 #define __FUNCT__ 507,19952 PetscErrorCode PCApplyBA_dvd(508,19986 #undef __FUNCT__569,21928 #define __FUNCT__ 570,21945 PetscErrorCode PCApply_dvd(571,21977 #undef __FUNCT__596,22714 #define __FUNCT__ 597,22731 PetscErrorCode PCApplyTranspose_dvd(598,22772 #undef __FUNCT__631,23773 #define __FUNCT__ 632,23790 PetscErrorCode MatMult_dvd_jd(633,23825 #undef __FUNCT__661,24724 #define __FUNCT__ 662,24741 PetscErrorCode MatMultTranspose_dvd_jd(663,24785 #undef __FUNCT__701,25910 #define __FUNCT__ 702,25927 PetscErrorCode MatGetVecs_dvd_jd(703,25965 #undef __FUNCT__744,26988 #define __FUNCT__ 745,27005 PetscErrorCode dvd_improvex_jd_proj_uv(746,27049 #undef __FUNCT__761,27454 #define __FUNCT__ 762,27471 PetscErrorCode dvd_improvex_jd_proj_cuv(772,27859 #define DVD_COMPLEX_RAYLEIGH_QUOTIENT(835,30709 #define DVD_COMPUTE_N_RR(855,31721 #define DVD_COMPUTE_N_RR(876,32738 #undef __FUNCT__892,33451 #define __FUNCT__ 893,33468 PetscErrorCode dvd_improvex_jd_proj_uv_KZX(902,33812 #undef __FUNCT__984,36755 #define __FUNCT__ 985,36772 PetscErrorCode dvd_improvex_jd_proj_uv_KXX(994,37074 #undef __FUNCT__1057,39357 #define __FUNCT__ 1058,39374 PetscErrorCode dvd_improvex_jd_lit_const(1059,39420 #undef __FUNCT__1074,39840 #define __FUNCT__ 1075,39857 PetscErrorCode dvd_improvex_jd_lit_const_0(1076,39905 *maxits maxits1101,40545 *tol tol1102,40571 typedef PetscInt (*funcV0_t)funcV0_t1108,40702 typedef PetscInt (*funcV1_t)funcV1_t1109,40770 #undef __FUNCT__1111,40856 #define __FUNCT__ 1112,40873 PetscErrorCode dvd_improvex_PfuncV(1114,40957 #undef __FUNCT__1149,42252 #define __FUNCT__ 1150,42269 PetscErrorCode dvd_improvex_apply_proj(1156,42485 #undef __FUNCT__1202,44407 #define __FUNCT__ 1203,44424 PetscErrorCode dvd_improvex_applytrans_proj(1209,44645 src/eps/impls/davidson/common/dvd_initv.c,388 dvd_initv.c:^?dvd_initv.c^A,1 } dvdInitV;36,1339 #undef __FUNCT__38,1352 #define __FUNCT__ 39,1369 PetscErrorCode dvd_initV(40,1399 #undef __FUNCT__69,2237 #define __FUNCT__ 70,2254 PetscErrorCode dvd_initV_classic_0(71,2294 #undef __FUNCT__91,2908 #define __FUNCT__ 92,2925 PetscErrorCode dvd_initV_krylov_0(93,2964 #undef __FUNCT__134,4593 #define __FUNCT__ 135,4610 PetscErrorCode dvd_initV_d(136,4642 src/eps/impls/davidson/common/dvd_schm.c,224 dvd_schm.c:^?dvd_schm.c^A,1 #define DVD_CHECKSUM(24,947 #undef __FUNCT__28,1097 #define __FUNCT__ 29,1114 PetscErrorCode dvd_schm_basic_preconf(30,1157 #undef __FUNCT__78,3203 #define __FUNCT__ 79,3220 PetscErrorCode dvd_schm_basic_conf(80,3260 src/eps/impls/davidson/common/dvd_testconv.c,374 dvd_testconv.c:^?dvd_testconv.c^A,1 #undef __FUNCT__35,1371 #define __FUNCT__ 36,1388 PetscErrorCode dvd_testconv_basic(37,1427 #undef __FUNCT__50,1731 #define __FUNCT__ 51,1748 PetscBool dvd_testconv_basic_0(52,1789 #undef __FUNCT__67,2237 #define __FUNCT__ 68,2254 PetscErrorCode dvd_testconv_slepc(69,2293 #undef __FUNCT__82,2597 #define __FUNCT__ 83,2614 PetscBool dvd_testconv_slepc_0(84,2655 src/eps/impls/davidson/common/dvd_updatev.c,936 dvd_updatev.c:^?dvd_updatev.c^A,1 } dvdManagV_basic;57,2305 #undef __FUNCT__60,2326 #define __FUNCT__ 61,2343 PetscErrorCode dvd_managementV_basic(62,2385 #undef __FUNCT__134,5253 #define __FUNCT__ 135,5270 PetscErrorCode dvd_updateV_start(136,5308 #undef __FUNCT__161,6008 #define __FUNCT__ 162,6025 PetscBool dvd_isrestarting_fullV(163,6068 #undef __FUNCT__178,6507 #define __FUNCT__ 179,6524 PetscErrorCode dvd_managementV_basic_d(180,6568 #undef __FUNCT__194,6912 #define __FUNCT__ 195,6929 PetscErrorCode dvd_updateV_extrapol(196,6970 #undef __FUNCT__228,7850 #define __FUNCT__ 229,7867 PetscErrorCode dvd_updateV_conv_gen(230,7908 #undef __FUNCT__296,10325 #define __FUNCT__ 297,10342 PetscErrorCode dvd_updateV_restart_gen(298,10386 #undef __FUNCT__369,13312 #define __FUNCT__ 370,13329 PetscErrorCode dvd_updateV_update_gen(371,13372 #undef __FUNCT__425,15275 #define __FUNCT__ 426,15292 PetscErrorCode dvd_updateV_testConv(428,15373 src/eps/impls/davidson/common/dvd_utils.c,2506 dvd_utils.c:^?dvd_utils.c^A,1 } dvdPCWrapper;35,1310 #undef __FUNCT__40,1376 #define __FUNCT__ 41,1393 PetscErrorCode dvd_static_precond_PC(42,1435 #undef __FUNCT__85,3044 #define __FUNCT__ 86,3061 PetscErrorCode dvd_improvex_precond_d(87,3104 #undef __FUNCT__99,3454 #define __FUNCT__ 100,3471 PetscErrorCode dvd_static_precond_PC_0(101,3515 } dvdJacobiPrecond;113,3828 #undef __FUNCT__115,3849 #define __FUNCT__ 116,3866 PetscErrorCode dvd_jacobi_precond(120,3976 #undef __FUNCT__160,5247 #define __FUNCT__ 161,5264 PetscErrorCode dvd_jacobi_precond_0(162,5305 #undef __FUNCT__183,5929 #define __FUNCT__ 184,5946 PetscErrorCode dvd_precond_none(188,6023 #define DVD_STAGE_INITV 203,6275 #define DVD_STAGE_NEWITER 204,6301 #define DVD_STAGE_CALCPAIRS 205,6329 #define DVD_STAGE_IMPROVEX 206,6359 #define DVD_STAGE_UPDATEV 207,6388 #define DVD_STAGE_ORTHV 208,6416 } DvdProfiler;218,6858 static PetscLogStage stages[stages220,6874 #undef __FUNCT__224,6948 #define __FUNCT__ 225,6965 PetscErrorCode dvd_prof_init(226,6999 #undef __FUNCT__241,7605 #define __FUNCT__ 242,7622 PetscErrorCode dvd_initV_prof(243,7657 #undef __FUNCT__255,7941 #define __FUNCT__ 256,7958 PetscErrorCode dvd_calcPairs_prof(257,7997 #undef __FUNCT__269,8293 #define __FUNCT__ 270,8310 PetscErrorCode dvd_improveX_prof(271,8348 #undef __FUNCT__283,8744 #define __FUNCT__ 284,8761 PetscErrorCode dvd_updateV_prof(285,8798 #undef __FUNCT__297,9088 #define __FUNCT__ 298,9105 PetscErrorCode dvd_orthV_prof(299,9140 #undef __FUNCT__311,9424 #define __FUNCT__ 312,9441 PetscErrorCode dvd_profiler(313,9474 #undef __FUNCT__335,10217 #define __FUNCT__ 336,10234 PetscErrorCode dvd_profiler_d(337,10269 } dvdHarmonic;368,11019 #undef __FUNCT__379,11507 #define __FUNCT__ 380,11524 PetscErrorCode dvd_harm_conf(381,11558 #undef __FUNCT__409,12489 #define __FUNCT__ 410,12506 PetscErrorCode dvd_harm_d(411,12537 #undef __FUNCT__421,12737 #define __FUNCT__ 422,12754 PetscErrorCode dvd_harm_transf(423,12790 #undef __FUNCT__449,13746 #define __FUNCT__ 450,13763 PetscErrorCode dvd_harm_updateW(451,13800 #undef __FUNCT__470,14328 #define __FUNCT__ 471,14345 PetscErrorCode dvd_harm_proj(472,14379 #undef __FUNCT__499,15464 #define __FUNCT__ 500,15481 PetscErrorCode dvd_harm_backtrans(501,15520 #undef __FUNCT__527,16220 #define __FUNCT__ 528,16237 PetscErrorCode dvd_harm_eig_backtrans(529,16280 #undef __FUNCT__541,16617 #define __FUNCT__ 542,16634 PetscErrorCode dvd_harm_eigs_trans(543,16674 src/eps/impls/davidson/common/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1096 SOURCEH 28,1107 LIBBASE 29,1129 DIRS 30,1149 MANSEC 31,1160 LOCDIR 32,1175 src/eps/impls/davidson/gd/gd.c,2021 gd.c:^?gd.c^A,1 #undef __FUNCT__46,1537 #define __FUNCT__ 47,1554 PetscErrorCode EPSSetFromOptions_GD(48,1595 #undef __FUNCT__108,4762 #define __FUNCT__ 109,4779 PetscErrorCode EPSSetUp_GD(110,4811 #undef __FUNCT__132,5446 #define __FUNCT__ 133,5463 PetscErrorCode EPSDestroy_GD(134,5497 #undef __FUNCT__157,7014 #define __FUNCT__ 158,7031 PetscErrorCode EPSGDSetKrylovStart(177,7481 #undef __FUNCT__188,7827 #define __FUNCT__ 189,7844 PetscErrorCode EPSGDGetKrylovStart(207,8256 #undef __FUNCT__218,8586 #define __FUNCT__ 219,8603 PetscErrorCode EPSGDSetBlockSize(237,9095 #undef __FUNCT__248,9428 #define __FUNCT__ 249,9445 PetscErrorCode EPSGDGetBlockSize(266,9834 #undef __FUNCT__277,10155 #define __FUNCT__ 278,10172 PetscErrorCode EPSGDGetRestart(296,10654 #undef __FUNCT__306,10956 #define __FUNCT__ 307,10973 PetscErrorCode EPSGDSetRestart(327,11624 #undef __FUNCT__339,12015 #define __FUNCT__ 340,12032 PetscErrorCode EPSGDGetInitialSize(364,12871 #undef __FUNCT__375,13202 #define __FUNCT__ 376,13219 PetscErrorCode EPSGDSetInitialSize(401,14151 #undef __FUNCT__412,14494 #define __FUNCT__ 413,14511 PetscErrorCode EPSGDSetBOrth(444,15611 #undef __FUNCT__455,15931 #define __FUNCT__ 456,15948 PetscErrorCode EPSGDGetBOrth(476,16384 #undef __FUNCT__487,16688 #define __FUNCT__ 488,16705 PetscErrorCode EPSGDGetWindowSizes(507,17207 #undef __FUNCT__517,17527 #define __FUNCT__ 518,17544 PetscErrorCode EPSGDSetWindowSizes(539,18221 #undef __FUNCT__551,18635 #define __FUNCT__ 552,18652 static PetscErrorCode EPSGDSetDoubleExpansion_GD(553,18699 #undef __FUNCT__562,18929 #define __FUNCT__ 563,18946 static PetscErrorCode EPSGDGetDoubleExpansion_GD(564,18993 #undef __FUNCT__576,19291 #define __FUNCT__ 577,19308 PetscErrorCode EPSGDGetDoubleExpansion(594,19657 #undef __FUNCT__605,19971 #define __FUNCT__ 606,19988 PetscErrorCode EPSGDSetDoubleExpansion(624,20553 #undef __FUNCT__635,20895 #define __FUNCT__ 636,20912 PETSC_EXTERN PetscErrorCode EPSCreate_GD(637,20945 src/eps/impls/davidson/gd/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,974 SOURCEH 28,985 LIBBASE 29,996 DIRS 30,1016 MANSEC 31,1027 LOCDIR 32,1042 src/eps/impls/davidson/jd/jd.c,1986 jd.c:^?jd.c^A,1 #undef __FUNCT__47,1615 #define __FUNCT__ 48,1632 PetscErrorCode EPSSetFromOptions_JD(49,1673 #undef __FUNCT__116,5298 #define __FUNCT__ 117,5315 PetscErrorCode EPSSetUp_JD(118,5347 #undef __FUNCT__141,6075 #define __FUNCT__ 142,6092 PetscErrorCode EPSDestroy_JD(143,6126 #undef __FUNCT__168,7829 #define __FUNCT__ 169,7846 PetscErrorCode EPSJDSetKrylovStart(188,8296 #undef __FUNCT__199,8642 #define __FUNCT__ 200,8659 PetscErrorCode EPSJDGetKrylovStart(218,9077 #undef __FUNCT__229,9407 #define __FUNCT__ 230,9424 PetscErrorCode EPSJDSetBlockSize(248,9916 #undef __FUNCT__259,10249 #define __FUNCT__ 260,10266 PetscErrorCode EPSJDGetBlockSize(277,10655 #undef __FUNCT__288,10976 #define __FUNCT__ 289,10993 PetscErrorCode EPSJDGetRestart(307,11475 #undef __FUNCT__317,11777 #define __FUNCT__ 318,11794 PetscErrorCode EPSJDSetRestart(338,12445 #undef __FUNCT__350,12836 #define __FUNCT__ 351,12853 PetscErrorCode EPSJDGetInitialSize(375,13692 #undef __FUNCT__386,14023 #define __FUNCT__ 387,14040 PetscErrorCode EPSJDSetInitialSize(412,14972 #undef __FUNCT__423,15315 #define __FUNCT__ 424,15332 PetscErrorCode EPSJDGetFix(446,15865 #undef __FUNCT__457,16155 #define __FUNCT__ 458,16172 PetscErrorCode EPSJDSetFix(481,16751 #undef __FUNCT__492,17057 #define __FUNCT__ 493,17074 PetscErrorCode EPSJDSetConstCorrectionTol(512,17687 #undef __FUNCT__523,18038 #define __FUNCT__ 524,18055 PetscErrorCode EPSJDGetConstCorrectionTol(542,18641 #undef __FUNCT__553,18974 #define __FUNCT__ 554,18991 PetscErrorCode EPSJDGetWindowSizes(573,19493 #undef __FUNCT__583,19813 #define __FUNCT__ 584,19830 PetscErrorCode EPSJDSetWindowSizes(605,20507 #undef __FUNCT__617,20921 #define __FUNCT__ 618,20938 PetscErrorCode EPSJDSetBOrth(649,22038 #undef __FUNCT__660,22358 #define __FUNCT__ 661,22375 PetscErrorCode EPSJDGetBOrth(681,22811 #undef __FUNCT__692,23115 #define __FUNCT__ 693,23132 PETSC_EXTERN PetscErrorCode EPSCreate_JD(694,23165 src/eps/impls/davidson/jd/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,974 SOURCEH 28,985 LIBBASE 29,996 DIRS 30,1016 MANSEC 31,1027 LOCDIR 32,1042 src/eps/impls/external/makefile,77 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,1008 MANSEC 27,1043 src/eps/impls/external/arpack/arpack.c,600 arpack.c:^?arpack.c^A,1 #undef __FUNCT__30,1199 #define __FUNCT__ 31,1216 PetscErrorCode EPSSetUp_ARPACK(32,1252 #undef __FUNCT__89,4100 #define __FUNCT__ 90,4117 PetscErrorCode EPSSolve_ARPACK(91,4153 #undef __FUNCT__284,12771 #define __FUNCT__ 285,12788 PetscErrorCode EPSBackTransform_ARPACK(286,12832 #undef __FUNCT__299,13146 #define __FUNCT__ 300,13163 PetscErrorCode EPSReset_ARPACK(301,13199 #undef __FUNCT__318,13674 #define __FUNCT__ 319,13691 PetscErrorCode EPSDestroy_ARPACK(320,13729 #undef __FUNCT__329,13893 #define __FUNCT__ 330,13910 PETSC_EXTERN PetscErrorCode EPSCreate_ARPACK(331,13947 src/eps/impls/external/arpack/arpackp.h,1206 arpackp.h:^?arpackp.h^A,1 #define __ARPACKP_H25,1006 } EPS_ARPACK;34,1184 #define SLEPC_ARPACK(47,1398 #define SLEPC_ARPACK(49,1482 #define SLEPC_ARPACK(51,1531 #define SLEPC_ARPACK(57,1631 #define SLEPC_ARPACK(59,1715 #define SLEPC_ARPACK(61,1764 #define SLEPC_ARPACK(71,1908 #define SLEPC_ARPACK(73,1992 #define SLEPC_ARPACK(75,2041 #define SLEPC_ARPACK(81,2141 #define SLEPC_ARPACK(83,2225 #define SLEPC_ARPACK(85,2274 #define SLEPC_ARPACK(99,2476 #define SLEPC_ARPACK(101,2561 #define SLEPC_ARPACK(103,2611 #define SLEPC_ARPACK(109,2712 #define SLEPC_ARPACK(111,2797 #define SLEPC_ARPACK(113,2847 #define SLEPC_ARPACK(123,2992 #define SLEPC_ARPACK(125,3077 #define SLEPC_ARPACK(127,3127 #define SLEPC_ARPACK(133,3228 #define SLEPC_ARPACK(135,3313 #define SLEPC_ARPACK(137,3363 #define COMM_ARG148,3471 #define ARPACKnaupd_(152,3522 #define ARPACKneupd_(153,3677 #define ARPACKsaupd_(154,3888 #define ARPACKseupd_(155,4043 #define ARPACKnaupd_(159,4244 #define ARPACKneupd_(160,4405 #define COMM_ARG 166,4643 #define ARPACKnaupd_(170,4705 #define ARPACKneupd_(171,4867 #define ARPACKsaupd_(172,5085 #define ARPACKseupd_(173,5247 #define ARPACKnaupd_(177,5455 #define ARPACKneupd_(178,5623 src/eps/impls/external/arpack/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 26,974 FFLAGS 27,985 SOURCEC 28,996 SOURCEF 29,1016 SOURCEH 30,1027 LIBBASE 31,1048 DIRS 32,1068 MANSEC 33,1079 LOCDIR 34,1094 src/eps/impls/external/blopex/blopex.c,1204 blopex.c:^?blopex.c^A,1 } EPS_BLOPEX;42,1560 #undef __FUNCT__44,1575 #define __FUNCT__ 45,1592 static void Precond_FnSingleVector(46,1635 #undef __FUNCT__57,1965 #define __FUNCT__ 58,1982 static void Precond_FnMultiVector(59,2024 #undef __FUNCT__69,2272 #define __FUNCT__ 70,2289 static void OperatorASingleVector(71,2331 #undef __FUNCT__97,3441 #define __FUNCT__ 98,3458 static void OperatorAMultiVector(99,3499 #undef __FUNCT__109,3745 #define __FUNCT__ 110,3762 static void OperatorBSingleVector(111,3804 #undef __FUNCT__123,4178 #define __FUNCT__ 124,4195 static void OperatorBMultiVector(125,4236 #undef __FUNCT__135,4482 #define __FUNCT__ 136,4499 PetscErrorCode EPSSetUp_BLOPEX(137,4535 #undef __FUNCT__210,7778 #define __FUNCT__ 211,7795 PetscErrorCode EPSSolve_BLOPEX(212,7831 #undef __FUNCT__279,10229 #define __FUNCT__ 280,10246 PetscErrorCode EPSReset_BLOPEX(281,10282 #undef __FUNCT__294,10626 #define __FUNCT__ 295,10643 PetscErrorCode EPSDestroy_BLOPEX(296,10681 #undef __FUNCT__306,10878 #define __FUNCT__ 307,10895 PetscErrorCode EPSSetFromOptions_BLOPEX(308,10940 #undef __FUNCT__332,11634 #define __FUNCT__ 333,11651 PETSC_EXTERN PetscErrorCode EPSCreate_BLOPEX(334,11688 src/eps/impls/external/blopex/makefile,162 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 27,1000 FFLAGS 28,1050 SOURCEC 29,1061 SOURCEF 30,1117 SOURCEH 31,1128 LIBBASE 32,1175 DIRS 33,1195 MANSEC 34,1206 LOCDIR 35,1221 src/eps/impls/external/blopex/petsc-interface.c,745 petsc-interface.c:^?petsc-interface.c^A,1 static PetscRandom LOBPCG_RandomContext 12,522 } komplex;16,608 BlopexInt PETSC_dpotrf_interface 18,620 BlopexInt PETSC_zpotrf_interface 33,910 BlopexInt PETSC_dsygv_interface 47,1197 BlopexInt PETSC_zsygv_interface 66,1742 void *PETSC_MimicVector(PETSC_MimicVector85,2319 BlopexInt PETSC_DestroyVector(94,2499 BlopexInt PETSC_InnerProd(103,2648 BlopexInt PETSC_CopyVector(111,2812 BlopexInt PETSC_ClearVector(119,2945 BlopexInt PETSC_SetRandomValues(127,3067 BlopexInt PETSC_ScaleVector(138,3390 BlopexInt PETSC_Axpy(146,3528 BlopexInt PETSC_VectorSize(154,3687 int LOBPCG_InitRandomContext(161,3779 int LOBPCG_SetFromOptionsRandomContext(176,4186 int LOBPCG_DestroyRandomContext(189,4620 int PETSCSetupInterpreter(197,4765 src/eps/impls/external/blopex/petsc-interface.h,37 petsc-interface.h:^?petsc-interface.h^A,1 #define PETSC_INTERFACE_HEADER7,334 src/eps/impls/external/blopex/slepc-interface.c,202 slepc-interface.c:^?slepc-interface.c^A,1 static void* mv_TempMultiVectorCreateFromPETScVector(31,1196 static void mv_TempMultiPETSCVectorDestroy(58,1885 int SLEPCSetupInterpreter(74,2272 void SLEPCSetupInterpreterForDignifiedDeath(86,2567 src/eps/impls/external/blopex/slepc-interface.h,39 slepc-interface.h:^?slepc-interface.h^A,1 #define SLEPC_INTERFACE_HEADER27,1093 src/eps/impls/external/blzpack/blzpack.c,1308 blzpack.c:^?blzpack.c^A,1 const char* blzpack_error[blzpack_error30,1195 #undef __FUNCT__66,2582 #define __FUNCT__ 67,2599 PetscErrorCode EPSSetUp_BLZPACK(68,2636 #undef __FUNCT__148,6614 #define __FUNCT__ 149,6631 PetscErrorCode EPSSolve_BLZPACK(150,6668 #undef __FUNCT__276,11909 #define __FUNCT__ 277,11926 PetscErrorCode EPSBackTransform_BLZPACK(278,11971 #undef __FUNCT__290,12250 #define __FUNCT__ 291,12267 PetscErrorCode EPSReset_BLZPACK(292,12304 #undef __FUNCT__307,12736 #define __FUNCT__ 308,12753 PetscErrorCode EPSDestroy_BLZPACK(309,12792 #undef __FUNCT__320,13156 #define __FUNCT__ 321,13173 PetscErrorCode EPSView_BLZPACK(322,13209 #undef __FUNCT__340,13909 #define __FUNCT__ 341,13926 PetscErrorCode EPSSetFromOptions_BLZPACK(342,13972 #undef __FUNCT__368,14720 #define __FUNCT__ 369,14737 static PetscErrorCode EPSBlzpackSetBlockSize_BLZPACK(370,14788 #undef __FUNCT__383,15207 #define __FUNCT__ 384,15224 PetscErrorCode EPSBlzpackSetBlockSize(399,15560 #undef __FUNCT__410,15882 #define __FUNCT__ 411,15899 static PetscErrorCode EPSBlzpackSetNSteps_BLZPACK(412,15947 #undef __FUNCT__424,16247 #define __FUNCT__ 425,16264 PetscErrorCode EPSBlzpackSetNSteps(442,16645 #undef __FUNCT__453,16973 #define __FUNCT__ 454,16990 PETSC_EXTERN PetscErrorCode EPSCreate_BLZPACK(455,17028 src/eps/impls/external/blzpack/blzpackp.h,253 blzpackp.h:^?blzpackp.h^A,1 #define __BLZPACKP_H25,1008 } EPS_BLZPACK;36,1394 #define SLEPC_BLZPACK(43,1511 #define SLEPC_BLZPACK(45,1594 #define SLEPC_BLZPACK(47,1641 #define BLZpack_ 59,1889 #define BLZpack_ 61,1941 #define BLZistorr_ 64,1995 #define BLZrstorr_ 65,2043 src/eps/impls/external/blzpack/makefile,161 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 27,998 FFLAGS 28,1009 SOURCEC 29,1020 SOURCEF 30,1041 SOURCEH 31,1052 LIBBASE 32,1074 DIRS 33,1094 MANSEC 34,1105 LOCDIR 35,1120 src/eps/impls/external/feast/feast.c,1117 feast.c:^?feast.c^A,1 #undef __FUNCT__29,1133 #define __FUNCT__ 30,1150 PetscErrorCode EPSSetUp_FEAST(31,1185 #undef __FUNCT__85,4183 #define __FUNCT__ 86,4200 PetscErrorCode EPSSolve_FEAST(87,4235 #undef __FUNCT__182,8179 #define __FUNCT__ 183,8196 PetscErrorCode EPSReset_FEAST(184,8231 #undef __FUNCT__198,8618 #define __FUNCT__ 199,8635 PetscErrorCode EPSDestroy_FEAST(200,8672 #undef __FUNCT__211,9033 #define __FUNCT__ 212,9050 PetscErrorCode EPSSetFromOptions_FEAST(213,9094 #undef __FUNCT__233,9643 #define __FUNCT__ 234,9660 PetscErrorCode EPSView_FEAST(235,9694 #undef __FUNCT__249,10139 #define __FUNCT__ 250,10156 static PetscErrorCode EPSFEASTSetNumPoints_FEAST(251,10203 #undef __FUNCT__264,10531 #define __FUNCT__ 265,10548 PetscErrorCode EPSFEASTSetNumPoints(283,10967 #undef __FUNCT__294,11300 #define __FUNCT__ 295,11317 static PetscErrorCode EPSFEASTGetNumPoints_FEAST(296,11364 #undef __FUNCT__305,11576 #define __FUNCT__ 306,11593 PetscErrorCode EPSFEASTGetNumPoints(323,11954 #undef __FUNCT__333,12240 #define __FUNCT__ 334,12257 PETSC_EXTERN PetscErrorCode EPSCreate_FEAST(335,12293 src/eps/impls/external/feast/feastp.h,550 feastp.h:^?feastp.h^A,1 #define __FEASTP_H25,1004 } EPS_FEAST;30,1168 #define SLEPC_FEAST(37,1279 #define SLEPC_FEAST(39,1358 #define SLEPC_FEAST(41,1403 #define SLEPC_FEASTM(49,1559 #define SLEPC_FEASTM(51,1649 #define SLEPC_FEASTM(53,1705 #define SLEPC_FEASTM(59,1811 #define SLEPC_FEASTM(61,1901 #define SLEPC_FEASTM(63,1957 #define SLEPC_FEASTM(73,2107 #define SLEPC_FEASTM(75,2197 #define SLEPC_FEASTM(77,2253 #define SLEPC_FEASTM(83,2359 #define SLEPC_FEASTM(85,2449 #define SLEPC_FEASTM(87,2505 #define FEASTinit_(94,2579 #define FEASTrci_(95,2640 src/eps/impls/external/feast/makefile,161 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 27,998 FFLAGS 28,1009 SOURCEC 29,1020 SOURCEF 30,1039 SOURCEH 31,1050 LIBBASE 32,1070 DIRS 33,1090 MANSEC 34,1101 LOCDIR 35,1116 src/eps/impls/external/primme/makefile,161 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 26,975 FFLAGS 27,1002 SOURCEC 28,1013 SOURCEF 29,1033 SOURCEH 30,1044 LIBBASE 31,1055 DIRS 32,1075 MANSEC 33,1086 LOCDIR 34,1101 src/eps/impls/external/primme/primme.c,1881 primme.c:^?primme.c^A,1 } EPS_PRIMME;41,1594 EPSPRIMMEMethod methodN[methodN43,1609 static void par_GlobalSumDouble(64,2222 #undef __FUNCT__70,2481 #define __FUNCT__ 71,2498 PetscErrorCode EPSSetUp_PRIMME(72,2534 #undef __FUNCT__174,7289 #define __FUNCT__ 175,7306 PetscErrorCode EPSSolve_PRIMME(176,7342 #undef __FUNCT__230,9197 #define __FUNCT__ 231,9214 static void multMatvec_PRIMME(232,9252 #undef __FUNCT__254,10102 #define __FUNCT__ 255,10119 static void applyPreconditioner_PRIMME(256,10166 #undef __FUNCT__279,11201 #define __FUNCT__ 280,11218 PetscErrorCode EPSReset_PRIMME(281,11254 #undef __FUNCT__294,11581 #define __FUNCT__ 295,11598 PetscErrorCode EPSDestroy_PRIMME(296,11636 #undef __FUNCT__309,12194 #define __FUNCT__ 310,12211 PetscErrorCode EPSView_PRIMME(311,12246 #undef __FUNCT__333,13079 #define __FUNCT__ 334,13096 PetscErrorCode EPSSetFromOptions_PRIMME(335,13141 #undef __FUNCT__370,14388 #define __FUNCT__ 371,14405 static PetscErrorCode EPSPRIMMESetBlockSize_PRIMME(372,14454 #undef __FUNCT__383,14846 #define __FUNCT__ 384,14863 PetscErrorCode EPSPRIMMESetBlockSize(409,15639 #undef __FUNCT__420,15959 #define __FUNCT__ 421,15976 static PetscErrorCode EPSPRIMMEGetBlockSize_PRIMME(422,16025 #undef __FUNCT__431,16238 #define __FUNCT__ 432,16255 PetscErrorCode EPSPRIMMEGetBlockSize(447,16575 #undef __FUNCT__457,16853 #define __FUNCT__ 458,16870 static PetscErrorCode EPSPRIMMESetMethod_PRIMME(459,16916 #undef __FUNCT__469,17208 #define __FUNCT__ 470,17225 PetscErrorCode EPSPRIMMESetMethod(496,18158 #undef __FUNCT__507,18499 #define __FUNCT__ 508,18516 static PetscErrorCode EPSPRIMMEGetMethod_PRIMME(509,18562 #undef __FUNCT__518,18795 #define __FUNCT__ 519,18812 PetscErrorCode EPSPRIMMEGetMethod(541,19605 #undef __FUNCT__551,19899 #define __FUNCT__ 552,19916 PETSC_EXTERN PetscErrorCode EPSCreate_PRIMME(553,19953 src/eps/impls/external/primme/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1018 SOURCEH 28,1029 DIRS 29,1040 LIBBASE 30,1051 LOCDIR 31,1071 src/eps/impls/external/primme/ftn-custom/zprimmef.c,135 zprimmef.c:^?zprimmef.c^A,1 PETSC_EXTERN void PETSC_STDCALL epsprimmegetmethod_(31,1173 src/eps/impls/external/trlan/makefile,161 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 27,998 FFLAGS 28,1009 SOURCEC 29,1020 SOURCEF 30,1039 SOURCEH 31,1050 LIBBASE 32,1070 DIRS 33,1090 MANSEC 34,1101 LOCDIR 35,1116 src/eps/impls/external/trlan/trlan.c,606 trlan.c:^?trlan.c^A,1 static EPS globaleps;30,1194 #undef __FUNCT__32,1217 #define __FUNCT__ 33,1234 PetscErrorCode EPSSetUp_TRLAN(34,1269 #undef __FUNCT__74,3263 #define __FUNCT__ 75,3280 static PetscBLASInt MatMult_TRLAN(76,3314 #undef __FUNCT__98,4295 #define __FUNCT__ 99,4312 PetscErrorCode EPSSolve_TRLAN(100,4347 #undef __FUNCT__151,6555 #define __FUNCT__ 152,6572 PetscErrorCode EPSReset_TRLAN(153,6607 #undef __FUNCT__164,6858 #define __FUNCT__ 165,6875 PetscErrorCode EPSDestroy_TRLAN(166,6912 #undef __FUNCT__175,7075 #define __FUNCT__ 176,7092 PETSC_EXTERN PetscErrorCode EPSCreate_TRLAN(177,7128 src/eps/impls/external/trlan/trlanp.h,120 trlanp.h:^?trlanp.h^A,1 #define __TRLANP_H25,1004 } EPS_TRLAN;32,1156 #define TRLan_ 40,1341 #define TRLan_ 42,1402 #define TRLan_ 44,1431 src/eps/impls/krylov/krylov.c,283 krylov.c:^?krylov.c^A,1 #undef __FUNCT__28,1078 #define __FUNCT__ 29,1095 PetscErrorCode EPSBasicArnoldi(43,1737 #undef __FUNCT__75,2748 #define __FUNCT__ 76,2765 PetscErrorCode EPSKrylovConvergence(94,3551 #undef __FUNCT__150,5491 #define __FUNCT__ 151,5508 PetscErrorCode EPSFullLanczos(173,6558 src/eps/impls/krylov/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,978 SOURCEH 28,989 LIBBASE 29,1000 DIRS 30,1020 LOCDIR 31,1059 MANSEC 32,1092 src/eps/impls/krylov/arnoldi/arnoldi.c,1267 arnoldi.c:^?arnoldi.c^A,1 } EPS_ARNOLDI;45,1420 #undef __FUNCT__47,1436 #define __FUNCT__ 48,1453 PetscErrorCode EPSSetUp_Arnoldi(49,1490 #undef __FUNCT__92,3595 #define __FUNCT__ 93,3612 PetscErrorCode EPSDelayedArnoldi(100,3937 #undef __FUNCT__202,7103 #define __FUNCT__ 203,7120 PetscErrorCode EPSDelayedArnoldi1(208,7302 #undef __FUNCT__254,8662 #define __FUNCT__ 255,8679 PetscErrorCode EPSSolve_Arnoldi(256,8716 #undef __FUNCT__342,12641 #define __FUNCT__ 343,12658 PetscErrorCode EPSSetFromOptions_Arnoldi(344,12704 #undef __FUNCT__360,13248 #define __FUNCT__ 361,13265 static PetscErrorCode EPSArnoldiSetDelayed_Arnoldi(362,13314 #undef __FUNCT__371,13526 #define __FUNCT__ 372,13543 PetscErrorCode EPSArnoldiSetDelayed(395,14191 #undef __FUNCT__406,14527 #define __FUNCT__ 407,14544 static PetscErrorCode EPSArnoldiGetDelayed_Arnoldi(408,14593 #undef __FUNCT__417,14807 #define __FUNCT__ 418,14824 PetscErrorCode EPSArnoldiGetDelayed(435,15216 #undef __FUNCT__446,15536 #define __FUNCT__ 447,15553 PetscErrorCode EPSDestroy_Arnoldi(448,15592 #undef __FUNCT__459,15955 #define __FUNCT__ 460,15972 PetscErrorCode EPSView_Arnoldi(461,16008 #undef __FUNCT__477,16480 #define __FUNCT__ 478,16497 PETSC_EXTERN PetscErrorCode EPSCreate_Arnoldi(479,16535 src/eps/impls/krylov/arnoldi/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,979 SOURCEH 28,990 LIBBASE 29,1001 DIRS 30,1021 MANSEC 31,1032 LOCDIR 32,1047 src/eps/impls/krylov/krylovschur/krylovschur.c,1515 krylovschur.c:^?krylovschur.c^A,1 #undef __FUNCT__47,1671 #define __FUNCT__ 48,1688 PetscErrorCode EPSGetArbitraryValues(49,1730 #undef __FUNCT__76,2693 #define __FUNCT__ 77,2710 PetscErrorCode EPSSetUp_KrylovSchur(78,2751 enum { EPS_KS_DEFAULT,83,2902 enum { EPS_KS_DEFAULT,EPS_KS_SYMM,83,2902 enum { EPS_KS_DEFAULT,EPS_KS_SYMM,EPS_KS_SLICE,83,2902 enum { EPS_KS_DEFAULT,EPS_KS_SYMM,EPS_KS_SLICE,EPS_KS_INDEF 83,2902 #undef __FUNCT__199,8713 #define __FUNCT__ 200,8730 PetscErrorCode EPSSolve_KrylovSchur_Default(201,8779 #undef __FUNCT__319,13576 #define __FUNCT__ 320,13593 static PetscErrorCode EPSKrylovSchurSetRestart_KrylovSchur(321,13650 #undef __FUNCT__334,14070 #define __FUNCT__ 335,14087 PetscErrorCode EPSKrylovSchurSetRestart(357,14678 #undef __FUNCT__368,15013 #define __FUNCT__ 369,15030 static PetscErrorCode EPSKrylovSchurGetRestart_KrylovSchur(370,15087 #undef __FUNCT__379,15300 #define __FUNCT__ 380,15317 PetscErrorCode EPSKrylovSchurGetRestart(397,15656 #undef __FUNCT__408,15975 #define __FUNCT__ 409,15992 PetscErrorCode EPSSetFromOptions_KrylovSchur(410,16042 #undef __FUNCT__426,16562 #define __FUNCT__ 427,16579 PetscErrorCode EPSView_KrylovSchur(428,16619 #undef __FUNCT__442,17095 #define __FUNCT__ 443,17112 PetscErrorCode EPSReset_KrylovSchur(444,17153 #undef __FUNCT__455,17395 #define __FUNCT__ 456,17412 PetscErrorCode EPSDestroy_KrylovSchur(457,17455 #undef __FUNCT__468,17830 #define __FUNCT__ 469,17847 PETSC_EXTERN PetscErrorCode EPSCreate_KrylovSchur(470,17889 src/eps/impls/krylov/krylovschur/krylovschur.h,189 krylovschur.h:^?krylovschur.h^A,1 #define __KRYLOVSCHUR_H25,991 typedef struct _n_shift *shift;shift34,1408 struct _n_shift 35,1440 struct _n_SR 48,2052 typedef struct _n_SR *SR;SR75,3225 } EPS_KRYLOVSCHUR;80,3312 src/eps/impls/krylov/krylovschur/ks-indef.c,211 ks-indef.c:^?ks-indef.c^A,1 #undef __FUNCT__30,1151 #define __FUNCT__ 31,1168 static PetscErrorCode EPSFullLanczosIndef(32,1208 #undef __FUNCT__71,2632 #define __FUNCT__ 72,2649 PetscErrorCode EPSSolve_KrylovSchur_Indefinite(73,2701 src/eps/impls/krylov/krylovschur/ks-slice.c,848 ks-slice.c:^?ks-slice.c^A,1 #undef __FUNCT__45,1582 #define __FUNCT__ 46,1599 static PetscErrorCode EPSCreateShift(47,1634 #undef __FUNCT__85,2884 #define __FUNCT__ 86,2901 static PetscErrorCode EPSExtractShift(87,2937 #undef __FUNCT__149,5098 #define __FUNCT__ 150,5115 static PetscErrorCode EPSKrylovSchur_Slice(151,5156 #undef __FUNCT__396,14739 #define __FUNCT__ 397,14756 static PetscErrorCode EPSGetNewShiftValue(398,14796 #undef __FUNCT__476,18842 #define __FUNCT__ 477,18859 static PetscErrorCode sortRealEigenvalues(478,18899 #undef __FUNCT__497,19465 #define __FUNCT__ 498,19482 static PetscErrorCode EPSStoreEigenpairs(499,19521 #undef __FUNCT__542,21114 #define __FUNCT__ 543,21131 static PetscErrorCode EPSLookForDeflation(544,21171 #undef __FUNCT__598,23300 #define __FUNCT__ 599,23317 PetscErrorCode EPSSolve_KrylovSchur_Slice(600,23364 src/eps/impls/krylov/krylovschur/ks-symm.c,102 ks-symm.c:^?ks-symm.c^A,1 #undef __FUNCT__31,1141 #define __FUNCT__ 32,1158 PetscErrorCode EPSSolve_KrylovSchur_Symm(33,1204 src/eps/impls/krylov/krylovschur/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1015 SOURCEH 28,1026 LIBBASE 29,1051 DIRS 30,1071 MANSEC 31,1082 LOCDIR 32,1097 src/eps/impls/krylov/lanczos/lanczos.c,1886 lanczos.c:^?lanczos.c^A,1 } EPS_LANCZOS;48,1571 #undef __FUNCT__50,1587 #define __FUNCT__ 51,1604 PetscErrorCode EPSSetUp_Lanczos(52,1641 #undef __FUNCT__108,4335 #define __FUNCT__ 109,4352 static PetscErrorCode EPSLocalLanczos(119,4847 #undef __FUNCT__168,6344 #define __FUNCT__ 169,6361 static PetscErrorCode DenseTridiagonal(188,6927 #undef __FUNCT__239,8799 #define __FUNCT__ 240,8816 static PetscErrorCode EPSSelectiveLanczos(244,8918 #undef __FUNCT__334,11644 #define __FUNCT__ 335,11661 static void update_omega(336,11694 #undef __FUNCT__372,12896 #define __FUNCT__ 373,12913 static void compute_int(374,12945 #undef __FUNCT__413,13891 #define __FUNCT__ 414,13908 static PetscErrorCode EPSPartialLanczos(418,14004 #undef __FUNCT__535,18126 #define __FUNCT__ 536,18143 static PetscErrorCode EPSBasicLanczos(554,18984 #undef __FUNCT__600,20803 #define __FUNCT__ 601,20820 PetscErrorCode EPSSolve_Lanczos(602,20857 #undef __FUNCT__783,27751 #define __FUNCT__ 784,27768 PetscErrorCode EPSSetFromOptions_Lanczos(785,27814 #undef __FUNCT__802,28461 #define __FUNCT__ 803,28478 static PetscErrorCode EPSLanczosSetReorthog_Lanczos(804,28528 #undef __FUNCT__824,29155 #define __FUNCT__ 825,29172 PetscErrorCode EPSLanczosSetReorthog(844,29730 #undef __FUNCT__855,30097 #define __FUNCT__ 856,30114 static PetscErrorCode EPSLanczosGetReorthog_Lanczos(857,30164 #undef __FUNCT__866,30395 #define __FUNCT__ 867,30412 PetscErrorCode EPSLanczosGetReorthog(884,30793 #undef __FUNCT__895,31144 #define __FUNCT__ 896,31161 PetscErrorCode EPSReset_Lanczos(897,31198 #undef __FUNCT__908,31477 #define __FUNCT__ 909,31494 PetscErrorCode EPSDestroy_Lanczos(910,31533 #undef __FUNCT__921,31898 #define __FUNCT__ 922,31915 PetscErrorCode EPSView_Lanczos(923,31951 #undef __FUNCT__937,32419 #define __FUNCT__ 938,32436 PETSC_EXTERN PetscErrorCode EPSCreate_Lanczos(939,32474 src/eps/impls/krylov/lanczos/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,979 SOURCEH 28,990 LIBBASE 29,1001 DIRS 30,1021 MANSEC 31,1032 LOCDIR 32,1047 src/eps/impls/lapack/lapack.c,391 lapack.c:^?lapack.c^A,1 #undef __FUNCT__28,1163 #define __FUNCT__ 29,1180 PetscErrorCode EPSSetUp_LAPACK(30,1216 #undef __FUNCT__134,5198 #define __FUNCT__ 135,5215 PetscErrorCode EPSSolve_LAPACK(136,5251 #undef __FUNCT__175,6725 #define __FUNCT__ 176,6742 PetscErrorCode EPSReset_LAPACK(177,6778 #undef __FUNCT__186,6940 #define __FUNCT__ 187,6957 PETSC_EXTERN PetscErrorCode EPSCreate_LAPACK(188,6994 src/eps/impls/lapack/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,978 SOURCEH 28,989 LIBBASE 29,1000 DIRS 30,1020 MANSEC 31,1031 LOCDIR 32,1046 src/eps/impls/power/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1045 src/eps/impls/power/power.c,1255 power.c:^?power.c^A,1 } EPS_POWER;51,1763 #undef __FUNCT__53,1777 #define __FUNCT__ 54,1794 PetscErrorCode EPSSetUp_Power(55,1829 #undef __FUNCT__92,3785 #define __FUNCT__ 93,3802 PetscErrorCode EPSSolve_Power(94,3837 #undef __FUNCT__238,9049 #define __FUNCT__ 239,9066 PetscErrorCode EPSSolve_TS_Power(240,9104 #undef __FUNCT__382,14730 #define __FUNCT__ 383,14747 PetscErrorCode EPSBackTransform_Power(384,14790 #undef __FUNCT__396,15078 #define __FUNCT__ 397,15095 PetscErrorCode EPSSetFromOptions_Power(398,15139 #undef __FUNCT__418,15839 #define __FUNCT__ 419,15856 static PetscErrorCode EPSPowerSetShiftType_Power(420,15903 #undef __FUNCT__437,16367 #define __FUNCT__ 438,16384 PetscErrorCode EPSPowerSetShiftType(467,17372 #undef __FUNCT__478,17718 #define __FUNCT__ 479,17735 static PetscErrorCode EPSPowerGetShiftType_Power(480,17782 #undef __FUNCT__489,17994 #define __FUNCT__ 490,18011 PetscErrorCode EPSPowerGetShiftType(507,18351 #undef __FUNCT__518,18681 #define __FUNCT__ 519,18698 PetscErrorCode EPSDestroy_Power(520,18735 #undef __FUNCT__531,19096 #define __FUNCT__ 532,19113 PetscErrorCode EPSView_Power(533,19147 #undef __FUNCT__547,19589 #define __FUNCT__ 548,19606 PETSC_EXTERN PetscErrorCode EPSCreate_Power(549,19642 src/eps/impls/subspace/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,980 SOURCEH 28,991 LIBBASE 29,1002 DIRS 30,1022 MANSEC 31,1033 LOCDIR 32,1048 src/eps/impls/subspace/subspace.c,747 subspace.c:^?subspace.c^A,1 } EPS_SUBSPACE;46,1457 #undef __FUNCT__48,1474 #define __FUNCT__ 49,1491 PetscErrorCode EPSSetUp_Subspace(50,1529 #undef __FUNCT__94,3681 #define __FUNCT__ 95,3698 static PetscErrorCode EPSSubspaceFindGroup(107,4193 #undef __FUNCT__143,5021 #define __FUNCT__ 144,5038 static PetscErrorCode EPSSubspaceResidualNorms(151,5351 #undef __FUNCT__180,6138 #define __FUNCT__ 181,6155 PetscErrorCode EPSSolve_Subspace(182,6193 #undef __FUNCT__345,12647 #define __FUNCT__ 346,12664 PetscErrorCode EPSReset_Subspace(347,12702 #undef __FUNCT__358,12975 #define __FUNCT__ 359,12992 PetscErrorCode EPSDestroy_Subspace(360,13032 #undef __FUNCT__369,13198 #define __FUNCT__ 370,13215 PETSC_EXTERN PetscErrorCode EPSCreate_Subspace(371,13254 src/eps/interface/basic.c,2604 basic.c:^?basic.c^A,1 PetscFunctionList EPSList 26,1045 PetscBool EPSRegisterAllCalled 27,1076 PetscClassId EPS_CLASSID 28,1130 PetscLogEvent EPS_SetUp 29,1165 static PetscBool EPSPackageInitialized 30,1212 const char *EPSPowerShiftTypes[EPSPowerShiftTypes32,1268 const char *EPSLanczosReorthogTypes[EPSLanczosReorthogTypes33,1381 const char *EPSPRIMMEMethods[EPSPRIMMEMethods34,1533 #undef __FUNCT__36,1811 #define __FUNCT__ 37,1828 PetscErrorCode EPSFinalizePackage(46,2060 #undef __FUNCT__57,2314 #define __FUNCT__ 58,2331 PetscErrorCode EPSInitializePackage(68,2655 #undef __FUNCT__105,3974 #define __FUNCT__ 106,3991 PetscErrorCode EPSView(134,4788 #define HERM 148,5250 #define HERM 150,5281 #undef __FUNCT__302,13408 #define __FUNCT__ 303,13425 PetscErrorCode EPSPrintSolution(324,13932 #undef __FUNCT__407,17418 #define __FUNCT__ 408,17435 PetscErrorCode EPSCreate(427,17785 #undef __FUNCT__511,20350 #define __FUNCT__ 512,20367 PetscErrorCode EPSSetType(542,21317 #undef __FUNCT__566,22131 #define __FUNCT__ 567,22148 PetscErrorCode EPSGetType(583,22427 #undef __FUNCT__592,22646 #define __FUNCT__ 593,22663 PetscErrorCode EPSRegister(620,23281 #undef __FUNCT__629,23504 #define __FUNCT__ 630,23521 PetscErrorCode EPSReset(644,23802 #undef __FUNCT__660,24317 #define __FUNCT__ 661,24334 PetscErrorCode EPSDestroy(674,24581 #undef __FUNCT__697,25546 #define __FUNCT__ 698,25563 PetscErrorCode EPSSetTarget(716,26006 #undef __FUNCT__729,26384 #define __FUNCT__ 730,26401 PetscErrorCode EPSGetTarget(749,26738 #undef __FUNCT__758,26957 #define __FUNCT__ 759,26974 PetscErrorCode EPSSetInterval(788,27963 #undef __FUNCT__800,28392 #define __FUNCT__ 801,28409 PetscErrorCode EPSGetInterval(821,28820 #undef __FUNCT__832,29111 #define __FUNCT__ 833,29128 PetscErrorCode EPSSetST(851,29567 #undef __FUNCT__866,29989 #define __FUNCT__ 867,30006 PetscErrorCode EPSGetST(884,30346 #undef __FUNCT__899,30715 #define __FUNCT__ 900,30732 PetscErrorCode EPSSetIP(918,31140 #undef __FUNCT__933,31562 #define __FUNCT__ 934,31579 PetscErrorCode EPSGetIP(950,31891 #undef __FUNCT__965,32260 #define __FUNCT__ 966,32277 PetscErrorCode EPSSetDS(984,32684 #undef __FUNCT__999,33106 #define __FUNCT__ 1000,33123 PetscErrorCode EPSGetDS(1016,33435 #undef __FUNCT__1031,33804 #define __FUNCT__ 1032,33821 PetscErrorCode EPSIsGeneralized(1049,34153 #undef __FUNCT__1058,34363 #define __FUNCT__ 1059,34380 PetscErrorCode EPSIsHermitian(1076,34708 #undef __FUNCT__1085,34914 #define __FUNCT__ 1086,34931 PetscErrorCode EPSIsPositive(1103,35305 src/eps/interface/default.c,1325 default.c:^?default.c^A,1 #undef __FUNCT__27,1089 #define __FUNCT__ 28,1106 PetscErrorCode EPSReset_Default(29,1143 #undef __FUNCT__40,1386 #define __FUNCT__ 41,1403 PetscErrorCode EPSBackTransform_Default(42,1448 #undef __FUNCT__51,1654 #define __FUNCT__ 52,1671 PetscErrorCode EPSComputeVectors_Default(58,1934 #undef __FUNCT__65,2073 #define __FUNCT__ 66,2090 PetscErrorCode EPSComputeVectors_Hermitian(71,2272 #undef __FUNCT__94,2918 #define __FUNCT__ 95,2935 PetscErrorCode EPSComputeVectors_Indefinite(100,3083 #undef __FUNCT__145,4524 #define __FUNCT__ 146,4541 PetscErrorCode EPSComputeVectors_Schur(156,4994 #undef __FUNCT__235,7459 #define __FUNCT__ 236,7476 PetscErrorCode EPSSetWorkVecs(252,7836 #undef __FUNCT__266,8210 #define __FUNCT__ 267,8227 PetscErrorCode EPSSetWhichEigenpairs_Default(272,8375 #undef __FUNCT__284,8732 #define __FUNCT__ 285,8749 PetscErrorCode EPSConvergedEigRelative(289,8874 #undef __FUNCT__299,9123 #define __FUNCT__ 300,9140 PetscErrorCode EPSConvergedAbsolute(304,9243 #undef __FUNCT__311,9434 #define __FUNCT__ 312,9451 PetscErrorCode EPSConvergedNormRelative(317,9601 #undef __FUNCT__327,9877 #define __FUNCT__ 328,9894 PetscErrorCode EPSComputeRitzVector(338,10191 #undef __FUNCT__388,11835 #define __FUNCT__ 389,11852 PetscErrorCode EPSBuildBalance_Krylov(394,12046 src/eps/interface/itregis.c,91 itregis.c:^?itregis.c^A,1 #undef __FUNCT__53,2103 #define __FUNCT__ 54,2120 PetscErrorCode EPSRegisterAll(64,2303 src/eps/interface/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1036 SOURCEH 28,1047 LIBBASE 29,1058 DIRS 30,1078 MANSEC 31,1089 LOCDIR 32,1104 src/eps/interface/mem.c,188 mem.c:^?mem.c^A,1 #undef __FUNCT__26,1033 #define __FUNCT__ 27,1050 PetscErrorCode EPSAllocateSolution(32,1205 #undef __FUNCT__71,2907 #define __FUNCT__ 72,2924 PetscErrorCode EPSFreeSolution(77,3059 src/eps/interface/monitor.c,854 monitor.c:^?monitor.c^A,1 #undef __FUNCT__27,1047 #define __FUNCT__ 28,1064 PetscErrorCode EPSMonitor(32,1153 #undef __FUNCT__44,1534 #define __FUNCT__ 45,1551 PetscErrorCode EPSMonitorSet(93,3575 #undef __FUNCT__104,4190 #define __FUNCT__ 105,4207 PetscErrorCode EPSMonitorCancel(123,4681 #undef __FUNCT__139,5058 #define __FUNCT__ 140,5075 PetscErrorCode EPSGetMonitorContext(157,5427 #undef __FUNCT__165,5616 #define __FUNCT__ 166,5633 PetscErrorCode EPSMonitorAll(187,6264 #undef __FUNCT__215,7529 #define __FUNCT__ 216,7546 PetscErrorCode EPSMonitorFirst(237,8175 #undef __FUNCT__261,9359 #define __FUNCT__ 262,9376 PetscErrorCode EPSMonitorConverged(287,10085 #undef __FUNCT__320,11572 #define __FUNCT__ 321,11589 PetscErrorCode EPSMonitorLG(322,11622 #undef __FUNCT__373,13732 #define __FUNCT__ 374,13749 PetscErrorCode EPSMonitorLGAll(375,13785 src/eps/interface/opts.c,2977 opts.c:^?opts.c^A,1 #undef __FUNCT__27,1082 #define __FUNCT__ 28,1099 PetscErrorCode EPSSetFromOptions(44,1488 #undef __FUNCT__235,14806 #define __FUNCT__ 236,14823 PetscErrorCode EPSGetTolerances(257,15279 #undef __FUNCT__266,15523 #define __FUNCT__ 267,15540 PetscErrorCode EPSSetTolerances(293,16242 #undef __FUNCT__319,17064 #define __FUNCT__ 320,17081 PetscErrorCode EPSGetDimensions(342,17635 #undef __FUNCT__352,17902 #define __FUNCT__ 353,17919 PetscErrorCode EPSSetDimensions(397,19711 #undef __FUNCT__429,20745 #define __FUNCT__ 430,20762 PetscErrorCode EPSSetWhichEigenpairs(491,23456 #undef __FUNCT__524,24409 #define __FUNCT__ 525,24426 PetscErrorCode EPSGetWhichEigenpairs(545,24874 #undef __FUNCT__554,25089 #define __FUNCT__ 555,25106 PetscErrorCode EPSSetLeftVectorsWanted(577,25800 #undef __FUNCT__589,26113 #define __FUNCT__ 590,26130 PetscErrorCode EPSGetLeftVectorsWanted(607,26487 #undef __FUNCT__616,26717 #define __FUNCT__ 617,26734 PetscErrorCode EPSSetMatrixNorms(652,28017 #undef __FUNCT__688,29384 #define __FUNCT__ 689,29401 PetscErrorCode EPSGetMatrixNorms(709,29919 #undef __FUNCT__719,30218 #define __FUNCT__ 720,30235 PetscErrorCode EPSSetEigenvalueComparison(752,31400 #undef __FUNCT__762,31745 #define __FUNCT__ 763,31762 PetscErrorCode EPSSetArbitrarySelection(807,33778 #undef __FUNCT__817,34105 #define __FUNCT__ 818,34122 PetscErrorCode EPSSetConvergenceTestFunction(848,35205 #undef __FUNCT__861,35741 #define __FUNCT__ 862,35758 PetscErrorCode EPSSetConvergenceTest(889,36716 #undef __FUNCT__906,37323 #define __FUNCT__ 907,37340 PetscErrorCode EPSGetConvergenceTest(924,37763 #undef __FUNCT__933,37973 #define __FUNCT__ 934,37990 PetscErrorCode EPSSetProblemType(969,39457 #undef __FUNCT__1012,40709 #define __FUNCT__ 1013,40726 PetscErrorCode EPSGetProblemType(1029,41040 #undef __FUNCT__1038,41261 #define __FUNCT__ 1039,41278 PetscErrorCode EPSSetExtraction(1073,42410 #undef __FUNCT__1082,42643 #define __FUNCT__ 1083,42660 PetscErrorCode EPSGetExtraction(1099,42975 #undef __FUNCT__1108,43192 #define __FUNCT__ 1109,43209 PetscErrorCode EPSSetBalance(1152,44973 #undef __FUNCT__1183,45982 #define __FUNCT__ 1184,45999 PetscErrorCode EPSGetBalance(1206,46496 #undef __FUNCT__1216,46801 #define __FUNCT__ 1217,46818 PetscErrorCode EPSSetTrueResidual(1245,47882 #undef __FUNCT__1254,48119 #define __FUNCT__ 1255,48136 PetscErrorCode EPSGetTrueResidual(1272,48480 #undef __FUNCT__1281,48701 #define __FUNCT__ 1282,48718 PetscErrorCode EPSSetTrackAll(1306,49478 #undef __FUNCT__1315,49715 #define __FUNCT__ 1316,49732 PetscErrorCode EPSGetTrackAll(1333,50057 #undef __FUNCT__1342,50278 #define __FUNCT__ 1343,50295 PetscErrorCode EPSSetOptionsPrefix(1370,51036 #undef __FUNCT__1386,51672 #define __FUNCT__ 1387,51689 PetscErrorCode EPSAppendOptionsPrefix(1406,52238 #undef __FUNCT__1422,52883 #define __FUNCT__ 1423,52900 PetscErrorCode EPSGetOptionsPrefix(1443,53401 src/eps/interface/setup.c,696 setup.c:^?setup.c^A,1 #undef __FUNCT__27,1067 #define __FUNCT__ 28,1084 PetscErrorCode EPSSetUp(48,1687 #undef __FUNCT__273,10700 #define __FUNCT__ 274,10717 PetscErrorCode EPSSetOperators(295,11335 #undef __FUNCT__328,12464 #define __FUNCT__ 329,12481 PetscErrorCode EPSGetOperators(346,12909 #undef __FUNCT__366,13385 #define __FUNCT__ 367,13402 PetscErrorCode EPSSetDeflationSpace(398,14399 #undef __FUNCT__427,15229 #define __FUNCT__ 428,15246 PetscErrorCode EPSRemoveDeflationSpace(441,15500 #undef __FUNCT__454,15803 #define __FUNCT__ 455,15820 PetscErrorCode EPSSetInitialSpace(484,16829 #undef __FUNCT__497,17281 #define __FUNCT__ 498,17298 PetscErrorCode EPSSetInitialSpaceLeft(528,18412 src/eps/interface/solve.c,2534 solve.c:^?solve.c^A,1 } EPSSortForSTData;31,1205 #undef __FUNCT__33,1226 #define __FUNCT__ 34,1243 static PetscErrorCode EPSSortForSTFunc(35,1280 #undef __FUNCT__48,1764 #define __FUNCT__ 49,1781 PetscErrorCode EPSSolve(68,2336 #undef __FUNCT__247,9057 #define __FUNCT__ 248,9074 PetscErrorCode EPSGetIterationNumber(273,9828 #undef __FUNCT__282,10038 #define __FUNCT__ 283,10055 PetscErrorCode EPSGetOperationCounters(310,10902 #undef __FUNCT__325,11396 #define __FUNCT__ 326,11413 PetscErrorCode EPSGetConverged(345,11793 #undef __FUNCT__354,12005 #define __FUNCT__ 355,12022 PetscErrorCode EPSGetConvergedReason(380,12691 #undef __FUNCT__389,12923 #define __FUNCT__ 390,12940 PetscErrorCode EPSGetInvariantSubspace(420,13968 #undef __FUNCT__444,14921 #define __FUNCT__ 445,14938 PetscErrorCode EPSGetInvariantSubspaceLeft(475,16025 #undef __FUNCT__493,16896 #define __FUNCT__ 494,16913 PetscErrorCode EPSGetEigenpair(530,18203 #undef __FUNCT__544,18869 #define __FUNCT__ 545,18886 PetscErrorCode EPSGetEigenvalue(573,19687 #undef __FUNCT__593,20335 #define __FUNCT__ 594,20352 PetscErrorCode EPSGetEigenvector(626,21396 #undef __FUNCT__667,22899 #define __FUNCT__ 668,22916 PetscErrorCode EPSGetEigenvectorLeft(697,23824 #undef __FUNCT__739,25479 #define __FUNCT__ 740,25496 PetscErrorCode EPSGetErrorEstimate(763,26042 #undef __FUNCT__775,26541 #define __FUNCT__ 776,26558 PetscErrorCode EPSGetErrorEstimateLeft(799,27173 #undef __FUNCT__812,27811 #define __FUNCT__ 813,27828 PetscErrorCode EPSComputeResidualNorm_Private(818,27995 #undef __FUNCT__875,30524 #define __FUNCT__ 876,30541 PetscErrorCode EPSComputeResidualNorm(901,31286 #undef __FUNCT__920,31926 #define __FUNCT__ 921,31943 PetscErrorCode EPSComputeResidualNormLeft(946,32754 #undef __FUNCT__1010,35479 #define __FUNCT__ 1011,35496 PetscErrorCode EPSComputeRelativeError_Private(1016,35658 #undef __FUNCT__1042,36395 #define __FUNCT__ 1043,36412 PetscErrorCode EPSComputeRelativeError(1063,36980 #undef __FUNCT__1082,37625 #define __FUNCT__ 1083,37642 PetscErrorCode EPSComputeRelativeErrorLeft(1104,38302 #undef __FUNCT__1149,39809 #define __FUNCT__ 1150,39826 PetscErrorCode EPSSortEigenvalues(1175,40523 #undef __FUNCT__1230,42081 #define __FUNCT__ 1231,42098 PetscErrorCode EPSCompareEigenvalues(1261,42992 #undef __FUNCT__1273,43450 #define __FUNCT__ 1274,43467 PetscErrorCode EPSGetStartVector(1307,44589 #undef __FUNCT__1349,46081 #define __FUNCT__ 1350,46098 PetscErrorCode EPSGetStartVectorLeft(1382,47181 src/eps/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1015 SOURCEH 28,1026 DIRS 29,1037 LIBBASE 30,1048 LOCDIR 31,1068 src/eps/interface/ftn-custom/zepsf.c,4410 zepsf.c:^?zepsf.c^A,1 PETSC_EXTERN void epsmonitorall_(94,4486 PETSC_EXTERN void epsmonitorlg_(99,4732 PETSC_EXTERN void epsmonitorlgall_(104,4976 PETSC_EXTERN void epsmonitorconverged_(109,5226 PETSC_EXTERN void epsmonitorfirst_(114,5484 } _cb;125,5936 #undef __FUNCT__128,6036 static PetscErrorCode ourmonitor(130,6084 #undef __FUNCT__136,6414 static PetscErrorCode ourdestroy(138,6462 #undef __FUNCT__145,6641 static PetscErrorCode ourconvergence(147,6693 #undef __FUNCT__153,7005 static PetscErrorCode oureigenvaluecomparison(155,7066 #undef __FUNCT__162,7404 static PetscErrorCode ourarbitraryfunc(164,7458 PETSC_EXTERN void PETSC_STDCALL epsdestroy_(171,7796 PETSC_EXTERN void PETSC_STDCALL epsview_(176,7903 PETSC_EXTERN void PETSC_STDCALL epssettype_(183,8090 PETSC_EXTERN void PETSC_STDCALL epsgettype_(192,8305 PETSC_EXTERN void PETSC_STDCALL epsgetoperators_(201,8584 PETSC_EXTERN void PETSC_STDCALL epssetoptionsprefix_(208,8774 PETSC_EXTERN void PETSC_STDCALL epsappendoptionsprefix_(217,9013 PETSC_EXTERN void PETSC_STDCALL epscreate_(226,9258 PETSC_EXTERN void PETSC_STDCALL epsmonitorset_(231,9400 PETSC_EXTERN void PETSC_STDCALL epsgetoptionsprefix_(266,11398 PETSC_EXTERN void PETSC_STDCALL epsgetst_(274,11666 PETSC_EXTERN void PETSC_STDCALL epsgetip_(279,11780 PETSC_EXTERN void PETSC_STDCALL epsgetds_(284,11894 PETSC_EXTERN void PETSC_STDCALL epsgetwhicheigenpairs_(289,12008 PETSC_EXTERN void PETSC_STDCALL epsgetproblemtype_(294,12160 PETSC_EXTERN void PETSC_STDCALL epsgetextraction_(299,12308 PETSC_EXTERN void PETSC_STDCALL epsgetconvergedreason_(304,12453 PETSC_EXTERN void PETSC_STDCALL epspowergetshifttype_(309,12617 PETSC_EXTERN void PETSC_STDCALL epslanczosgetreorthog_(314,12776 PETSC_EXTERN void PETSC_STDCALL epsconvergedabsolute_(319,12948 PETSC_EXTERN void PETSC_STDCALL epsconvergedeigrelative_(324,13183 PETSC_EXTERN void PETSC_STDCALL epsconvergednormrelative_(329,13424 PETSC_EXTERN void PETSC_STDCALL epssetconvergencetestfunction_(334,13667 PETSC_EXTERN void PETSC_STDCALL epsseteigenvaluecomparison_(349,14562 PETSC_EXTERN void PETSC_STDCALL epssetarbitraryselection_(356,15017 src/fn/fnbasic.c,1784 fnbasic.c:^?fnbasic.c^A,1 PetscFunctionList FNList 26,1005 PetscBool FNRegisterAllCalled 27,1035 PetscClassId FN_CLASSID 28,1088 static PetscBool FNPackageInitialized 29,1122 #undef __FUNCT__31,1177 #define __FUNCT__ 32,1194 PetscErrorCode FNFinalizePackage(41,1426 #undef __FUNCT__52,1676 #define __FUNCT__ 53,1693 PetscErrorCode FNInitializePackage(63,2013 #undef __FUNCT__97,3136 #define __FUNCT__ 98,3153 PetscErrorCode FNCreate(114,3414 #undef __FUNCT__136,3928 #define __FUNCT__ 137,3945 PetscErrorCode FNSetOptionsPrefix(157,4460 #undef __FUNCT__167,4718 #define __FUNCT__ 168,4735 PetscErrorCode FNAppendOptionsPrefix(187,5256 #undef __FUNCT__197,5520 #define __FUNCT__ 198,5537 PetscErrorCode FNGetOptionsPrefix(218,6034 #undef __FUNCT__229,6325 #define __FUNCT__ 230,6342 PetscErrorCode FNSetType(248,6744 #undef __FUNCT__270,7453 #define __FUNCT__ 271,7470 PetscErrorCode FNGetType(287,7760 #undef __FUNCT__296,7972 #define __FUNCT__ 297,7989 PetscErrorCode FNSetParameters(325,8995 #undef __FUNCT__355,10161 #define __FUNCT__ 356,10178 PetscErrorCode FNGetParameters(375,10685 #undef __FUNCT__386,11006 #define __FUNCT__ 387,11023 PetscErrorCode FNEvaluateFunction(404,11398 #undef __FUNCT__419,11816 #define __FUNCT__ 420,11833 PetscErrorCode FNEvaluateDerivative(437,12216 #undef __FUNCT__452,12638 #define __FUNCT__ 453,12655 PetscErrorCode FNSetFromOptions(467,12936 #undef __FUNCT__484,13514 #define __FUNCT__ 485,13531 PetscErrorCode FNView(508,14194 #undef __FUNCT__530,14985 #define __FUNCT__ 531,15002 PetscErrorCode FNDestroy(544,15228 #undef __FUNCT__558,15640 #define __FUNCT__ 559,15657 PetscErrorCode FNRegister(576,16033 #undef __FUNCT__588,16351 #define __FUNCT__ 589,16368 PetscErrorCode FNRegisterAll(597,16524 src/fn/fnexp.c,389 fnexp.c:^?fnexp.c^A,1 #undef __FUNCT__26,1036 #define __FUNCT__ 27,1053 PetscErrorCode FNEvaluateFunction_Exp(28,1096 #undef __FUNCT__40,1382 #define __FUNCT__ 41,1399 PetscErrorCode FNEvaluateDerivative_Exp(42,1444 #undef __FUNCT__59,1780 #define __FUNCT__ 60,1797 PetscErrorCode FNView_Exp(61,1828 #undef __FUNCT__91,2933 #define __FUNCT__ 92,2950 PETSC_EXTERN PetscErrorCode FNCreate_Exp(93,2983 src/fn/fnrational.c,412 fnrational.c:^?fnrational.c^A,1 #undef __FUNCT__27,1118 #define __FUNCT__ 28,1135 PetscErrorCode FNEvaluateFunction_Rational(29,1183 #undef __FUNCT__51,1591 #define __FUNCT__ 52,1608 PetscErrorCode FNEvaluateDerivative_Rational(53,1658 #undef __FUNCT__83,2196 #define __FUNCT__ 84,2213 PetscErrorCode FNView_Rational(85,2249 #undef __FUNCT__137,4690 #define __FUNCT__ 138,4707 PETSC_EXTERN PetscErrorCode FNCreate_Rational(139,4745 src/fn/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1000 SOURCEH 28,1011 LIBBASE 29,1083 DIRS 30,1103 MANSEC 31,1114 LOCDIR 32,1128 src/fn/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,960 src/fn/examples/tests/makefile,307 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1014 EXAMPLESF 28,1043 MANSEC 29,1056 TESTS 30,1072 TESTEXAMPLES_C 32,1098 =33,1155 test1:test137,1251 test2:test241,1333 runtest1_1:runtest1_147,1502 runtest2_1:runtest2_153,1714 src/fn/examples/tests/test1.c,99 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__26,999 #define __FUNCT__ 27,1016 int main(28,1041 src/fn/examples/tests/test2.c,100 test2.c:^?test2.c^A,1 static char help[help22,924 #undef __FUNCT__26,1002 #define __FUNCT__ 27,1019 int main(28,1044 src/ip/ipbasic.c,2038 ipbasic.c:^?ipbasic.c^A,1 PetscFunctionList IPList 26,1005 PetscBool IPRegisterAllCalled 27,1035 PetscClassId IP_CLASSID 28,1088 PetscLogEvent IP_InnerProduct 29,1122 static PetscBool IPPackageInitialized 30,1201 #undef __FUNCT__32,1256 #define __FUNCT__ 33,1273 PetscErrorCode IPFinalizePackage(42,1505 #undef __FUNCT__53,1755 #define __FUNCT__ 54,1772 PetscErrorCode IPInitializePackage(64,2092 #undef __FUNCT__102,3515 #define __FUNCT__ 103,3532 PetscErrorCode IPCreate(123,3928 #undef __FUNCT__152,4657 #define __FUNCT__ 153,4674 PetscErrorCode IPSetOptionsPrefix(173,5189 #undef __FUNCT__183,5447 #define __FUNCT__ 184,5464 PetscErrorCode IPAppendOptionsPrefix(203,5985 #undef __FUNCT__213,6249 #define __FUNCT__ 214,6266 PetscErrorCode IPGetOptionsPrefix(234,6763 #undef __FUNCT__245,7054 #define __FUNCT__ 246,7071 PetscErrorCode IPSetType(272,7881 #undef __FUNCT__294,8590 #define __FUNCT__ 295,8607 PetscErrorCode IPGetType(311,8893 #undef __FUNCT__320,9105 #define __FUNCT__ 321,9122 PetscErrorCode IPSetType_Default(326,9252 #undef __FUNCT__340,9560 #define __FUNCT__ 341,9577 PetscErrorCode IPSetFromOptions(355,9858 #undef __FUNCT__383,11231 #define __FUNCT__ 384,11248 PetscErrorCode IPSetOrthogonalization(416,12435 #undef __FUNCT__449,13503 #define __FUNCT__ 450,13520 PetscErrorCode IPGetOrthogonalization(470,13996 #undef __FUNCT__480,14321 #define __FUNCT__ 481,14338 PetscErrorCode IPView(506,15057 #undef __FUNCT__553,17071 #define __FUNCT__ 554,17088 PetscErrorCode IPReset(567,17300 #undef __FUNCT__583,17695 #define __FUNCT__ 584,17712 PetscErrorCode IPDestroy(597,17938 #undef __FUNCT__610,18292 #define __FUNCT__ 611,18309 PetscErrorCode IPGetOperationCounters(628,18667 #undef __FUNCT__637,18883 #define __FUNCT__ 638,18900 PetscErrorCode IPResetOperationCounters(652,19207 #undef __FUNCT__660,19377 #define __FUNCT__ 661,19394 PetscErrorCode IPRegister(678,19759 #undef __FUNCT__693,20174 #define __FUNCT__ 694,20191 PetscErrorCode IPRegisterAll(702,20347 src/ip/ipbiorthog.c,523 ipbiorthog.c:^?ipbiorthog.c^A,1 #undef __FUNCT__31,1216 #define __FUNCT__ 32,1233 static PetscErrorCode IPCGSBiOrthogonalization(33,1278 #undef __FUNCT__85,3350 #define __FUNCT__ 86,3367 PetscErrorCode IPBiOrthogonalize(118,4222 #undef __FUNCT__168,5779 #define __FUNCT__ 169,5796 PetscErrorCode IPPseudoOrthogonalizeCGS1(170,5842 #undef __FUNCT__227,7550 #define __FUNCT__ 228,7567 static PetscErrorCode IPPseudoOrthogonalizeCGS(229,7612 #undef __FUNCT__310,10196 #define __FUNCT__ 311,10213 PetscErrorCode IPPseudoOrthogonalize(350,11596 src/ip/ipborthog.c,332 ipborthog.c:^?ipborthog.c^A,1 #define MyPetscSqrtReal(29,1183 #undef __FUNCT__34,1413 #define __FUNCT__ 35,1430 PetscErrorCode IPBOrthogonalizeCGS1(36,1471 #undef __FUNCT__108,3459 #define __FUNCT__ 109,3476 static PetscErrorCode IPBOrthogonalizeCGS(110,3516 #undef __FUNCT__194,6581 #define __FUNCT__ 195,6598 PetscErrorCode IPBOrthogonalize(237,7945 src/ip/ipdot.c,2913 ipdot.c:^?ipdot.c^A,1 #define VecXDotBegin 29,1166 #define VecXDotEnd 30,1201 #define VecMXDotBegin 31,1234 #define VecMXDotEnd 32,1270 #define VecXDotBegin 34,1310 #define VecXDotEnd 35,1344 #define VecMXDotBegin 36,1376 #define VecMXDotEnd 37,1411 #undef __FUNCT__40,1452 #define __FUNCT__ 41,1469 PetscErrorCode IPNorm(69,2294 #undef __FUNCT__82,2653 #define __FUNCT__ 83,2670 PetscErrorCode IPNormBegin_Bilinear(84,2711 #undef __FUNCT__94,2928 #define __FUNCT__ 95,2945 PetscErrorCode IPNormBegin_Sesquilin(96,2987 #undef __FUNCT__110,3297 #define __FUNCT__ 111,3314 PetscErrorCode IPNormBegin_Indefinite(112,3357 #undef __FUNCT__126,3668 #define __FUNCT__ 127,3685 PetscErrorCode IPNormBegin(146,4157 #undef __FUNCT__158,4466 #define __FUNCT__ 159,4483 PetscErrorCode IPNormEnd_Bilinear(160,4522 #undef __FUNCT__180,5312 #define __FUNCT__ 181,5329 PetscErrorCode IPNormEnd_Sesquilin(182,5369 #undef __FUNCT__201,6098 #define __FUNCT__ 202,6115 PetscErrorCode IPNormEnd_Indefinite(203,6156 #undef __FUNCT__223,6947 #define __FUNCT__ 224,6964 PetscErrorCode IPNormEnd(245,7447 #undef __FUNCT__257,7752 #define __FUNCT__ 258,7769 PetscErrorCode IPInnerProduct(283,8495 #undef __FUNCT__300,9088 #define __FUNCT__ 301,9105 PetscErrorCode IPInnerProductBegin_Bilinear(302,9154 #undef __FUNCT__316,9495 #define __FUNCT__ 317,9512 PetscErrorCode IPInnerProductBegin_Sesquilin(318,9562 #undef __FUNCT__332,9902 #define __FUNCT__ 333,9919 PetscErrorCode IPInnerProductBegin(353,10448 #undef __FUNCT__369,10984 #define __FUNCT__ 370,11001 PetscErrorCode IPInnerProductEnd_Bilinear(371,11048 #undef __FUNCT__384,11329 #define __FUNCT__ 385,11346 PetscErrorCode IPInnerProductEnd_Sesquilin(386,11394 #undef __FUNCT__399,11674 #define __FUNCT__ 400,11691 PetscErrorCode IPInnerProductEnd(422,12241 #undef __FUNCT__437,12750 #define __FUNCT__ 438,12767 PetscErrorCode IPMInnerProduct(465,13604 #undef __FUNCT__483,14253 #define __FUNCT__ 484,14270 PetscErrorCode IPMInnerProductBegin_Bilinear(485,14320 #undef __FUNCT__499,14687 #define __FUNCT__ 500,14704 PetscErrorCode IPMInnerProductBegin_Sesquilin(501,14755 #undef __FUNCT__515,15121 #define __FUNCT__ 516,15138 PetscErrorCode IPMInnerProductBegin(537,15717 #undef __FUNCT__555,16344 #define __FUNCT__ 556,16361 PetscErrorCode IPMInnerProductEnd_Bilinear(557,16409 #undef __FUNCT__570,16716 #define __FUNCT__ 571,16733 PetscErrorCode IPMInnerProductEnd_Sesquilin(572,16782 #undef __FUNCT__585,17088 #define __FUNCT__ 586,17105 PetscErrorCode IPMInnerProductEnd(609,17705 #undef __FUNCT__626,18302 #define __FUNCT__ 627,18319 PETSC_EXTERN PetscErrorCode IPCreate_Bilinear(628,18357 #undef __FUNCT__641,18846 #define __FUNCT__ 642,18863 PETSC_EXTERN PetscErrorCode IPCreate_Sesquilin(643,18902 #undef __FUNCT__656,19374 #define __FUNCT__ 657,19391 PETSC_EXTERN PetscErrorCode IPCreate_Indefinite(658,19431 src/ip/ipform.c,367 ipform.c:^?ipform.c^A,1 #undef __FUNCT__26,1059 #define __FUNCT__ 27,1076 PetscErrorCode IPSetMatrix(47,1579 #undef __FUNCT__66,2039 #define __FUNCT__ 67,2056 PetscErrorCode IPGetMatrix(83,2462 #undef __FUNCT__92,2653 #define __FUNCT__ 93,2670 PetscErrorCode IPApplyMatrix_Private(94,2712 #undef __FUNCT__109,3196 #define __FUNCT__ 110,3213 PetscErrorCode IPApplyMatrix(130,3665 src/ip/iporthog.c,717 iporthog.c:^?iporthog.c^A,1 #undef __FUNCT__31,1201 #define __FUNCT__ 32,1218 static PetscErrorCode IPOrthogonalizeMGS1(33,1258 #undef __FUNCT__54,1850 #define __FUNCT__ 55,1867 PetscErrorCode IPOrthogonalizeCGS1(56,1907 #undef __FUNCT__135,4245 #define __FUNCT__ 136,4262 static PetscErrorCode IPOrthogonalizeMGS(137,4301 #undef __FUNCT__206,6598 #define __FUNCT__ 207,6615 static PetscErrorCode IPOrthogonalizeCGS(208,6654 #undef __FUNCT__289,9343 #define __FUNCT__ 290,9360 PetscErrorCode IPOrthogonalize(327,10580 #undef __FUNCT__355,11607 #define __FUNCT__ 356,11624 PetscErrorCode IPQRDecomposition(387,12564 #undef __FUNCT__424,13833 #define __FUNCT__ 425,13850 PetscErrorCode IPOrthonormalizeBasis_Private(431,14061 src/ip/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1032 SOURCEH 28,1043 LIBBASE 29,1155 DIRS 30,1175 MANSEC 31,1186 LOCDIR 32,1200 src/ip/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,960 src/ip/examples/tests/makefile,473 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1014 EXAMPLESF 28,1059 MANSEC 29,1072 TESTS 30,1088 TESTEXAMPLES_C 32,1126 =33,1183 =34,1240 =35,1297 test1:test139,1393 test2:test243,1475 test3:test347,1557 test4:test451,1639 runtest1_1:runtest1_157,1808 runtest2_1:runtest2_166,2277 runtest3_1:runtest3_175,2682 runtest4_1:runtest4_181,2894 src/ip/examples/tests/test1.c,100 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__27,1021 #define __FUNCT__ 28,1038 int main(29,1063 src/ip/examples/tests/test2.c,100 test2.c:^?test2.c^A,1 static char help[help22,924 #undef __FUNCT__26,1001 #define __FUNCT__ 27,1018 int main(28,1043 src/ip/examples/tests/test3.c,99 test3.c:^?test3.c^A,1 static char help[help22,924 #undef __FUNCT__26,995 #define __FUNCT__ 27,1012 int main(28,1037 src/ip/examples/tests/test4.c,100 test4.c:^?test4.c^A,1 static char help[help22,924 #undef __FUNCT__26,1003 #define __FUNCT__ 27,1020 int main(28,1045 src/ip/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1014 SOURCEH 28,1025 DIRS 29,1036 LIBBASE 30,1047 LOCDIR 31,1067 src/ip/ftn-custom/zipf.c,987 zipf.c:^?zipf.c^A,1 PETSC_EXTERN void PETSC_STDCALL ipcreate_(45,1862 PETSC_EXTERN void PETSC_STDCALL ipdestroy_(50,2005 PETSC_EXTERN void PETSC_STDCALL ipsetoptionsprefix_(55,2107 PETSC_EXTERN void PETSC_STDCALL ipappendoptionsprefix_(64,2341 PETSC_EXTERN void PETSC_STDCALL ipgetoptionsprefix_(73,2581 PETSC_EXTERN void PETSC_STDCALL ipgetorthogonalization_(81,2844 PETSC_EXTERN void PETSC_STDCALL ipview_(86,3058 PETSC_EXTERN void PETSC_STDCALL ipgetmatrix_(93,3240 src/mfn/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1010 LOCDIR 26,1046 MANSEC 27,1066 src/mfn/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,961 src/mfn/examples/tests/makefile,172 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1015 EXAMPLESF 28,1028 MANSEC 29,1041 TESTS 30,1058 TESTEXAMPLES_C 32,1072 src/mfn/examples/tutorials/ex23.c,194 ex23.c:^?ex23.c^A,1 static char help[help22,924 #undef __FUNCT__33,1233 #define __FUNCT__ 34,1250 int main(35,1275 #undef __FUNCT__132,5073 #define __FUNCT__ 133,5090 PetscErrorCode MatMarkovModel(138,5248 src/mfn/examples/tutorials/makefile,205 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1019 EXAMPLESF 28,1039 MANSEC 29,1052 TESTEXAMPLES_C 31,1070 ex23:ex2335,1157 runex23_1:runex23_141,1321 src/mfn/impls/makefile,76 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,974 MANSEC 27,1000 src/mfn/impls/krylov/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,981 SOURCEH 28,992 LIBBASE 29,1003 DIRS 30,1023 MANSEC 31,1034 LOCDIR 32,1049 src/mfn/impls/krylov/mfnkrylov.c,487 mfnkrylov.c:^?mfnkrylov.c^A,1 #undef __FUNCT__41,1378 #define __FUNCT__ 42,1395 PetscErrorCode MFNSetUp_Krylov(43,1431 #undef __FUNCT__58,1942 #define __FUNCT__ 59,1959 static PetscErrorCode MFNBasicArnoldi(60,1995 #undef __FUNCT__84,2774 #define __FUNCT__ 85,2791 PetscErrorCode MFNSolve_Krylov(86,2827 #undef __FUNCT__220,7242 #define __FUNCT__ 221,7259 PetscErrorCode MFNReset_Krylov(222,7295 #undef __FUNCT__234,7546 #define __FUNCT__ 235,7563 PETSC_EXTERN PetscErrorCode MFNCreate_Krylov(236,7600 src/mfn/interface/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1032 SOURCEH 28,1043 LIBBASE 29,1054 DIRS 30,1074 MANSEC 31,1085 LOCDIR 32,1100 src/mfn/interface/mfnbasic.c,1399 mfnbasic.c:^?mfnbasic.c^A,1 PetscFunctionList MFNList 26,1045 PetscBool MFNRegisterAllCalled 27,1076 PetscClassId MFN_CLASSID 28,1130 PetscLogEvent MFN_SetUp 29,1165 static PetscBool MFNPackageInitialized 30,1212 #undef __FUNCT__32,1268 #define __FUNCT__ 33,1285 PetscErrorCode MFNFinalizePackage(42,1517 #undef __FUNCT__53,1771 #define __FUNCT__ 54,1788 PetscErrorCode MFNInitializePackage(64,2112 #undef __FUNCT__101,3425 #define __FUNCT__ 102,3442 PetscErrorCode MFNView(130,4232 #undef __FUNCT__177,6338 #define __FUNCT__ 178,6355 PetscErrorCode MFNCreate(197,6700 #undef __FUNCT__241,7945 #define __FUNCT__ 242,7962 PetscErrorCode MFNSetType(272,8897 #undef __FUNCT__296,9711 #define __FUNCT__ 297,9728 PetscErrorCode MFNGetType(313,10011 #undef __FUNCT__322,10230 #define __FUNCT__ 323,10247 PetscErrorCode MFNRegister(350,10868 #undef __FUNCT__359,11091 #define __FUNCT__ 360,11108 PetscErrorCode MFNReset(374,11393 #undef __FUNCT__388,11806 #define __FUNCT__ 389,11823 PetscErrorCode MFNDestroy(402,12074 #undef __FUNCT__421,12769 #define __FUNCT__ 422,12786 PetscErrorCode MFNSetIP(440,13209 #undef __FUNCT__455,13631 #define __FUNCT__ 456,13648 PetscErrorCode MFNGetIP(472,13964 #undef __FUNCT__487,14333 #define __FUNCT__ 488,14350 PetscErrorCode MFNSetDS(506,14772 #undef __FUNCT__521,15194 #define __FUNCT__ 522,15211 PetscErrorCode MFNGetDS(538,15531 src/mfn/interface/mfnmon.c,560 mfnmon.c:^?mfnmon.c^A,1 #undef __FUNCT__27,1047 #define __FUNCT__ 28,1064 PetscErrorCode MFNMonitor(32,1153 #undef __FUNCT__44,1447 #define __FUNCT__ 45,1464 PetscErrorCode MFNMonitorSet(83,2883 #undef __FUNCT__94,3453 #define __FUNCT__ 95,3470 PetscErrorCode MFNMonitorCancel(113,3948 #undef __FUNCT__129,4325 #define __FUNCT__ 130,4342 PetscErrorCode MFNGetMonitorContext(147,4698 #undef __FUNCT__155,4887 #define __FUNCT__ 156,4904 PetscErrorCode MFNMonitorDefault(173,5326 #undef __FUNCT__188,6037 #define __FUNCT__ 189,6054 PetscErrorCode MFNMonitorLG(190,6087 src/mfn/interface/mfnopts.c,1392 mfnopts.c:^?mfnopts.c^A,1 #undef __FUNCT__27,1082 #define __FUNCT__ 28,1099 PetscErrorCode MFNSetFromOptions(44,1492 #undef __FUNCT__126,5245 #define __FUNCT__ 127,5262 PetscErrorCode MFNGetTolerances(148,5722 #undef __FUNCT__157,5966 #define __FUNCT__ 158,5983 PetscErrorCode MFNSetTolerances(184,6689 #undef __FUNCT__210,7511 #define __FUNCT__ 211,7528 PetscErrorCode MFNGetDimensions(227,7875 #undef __FUNCT__236,8077 #define __FUNCT__ 237,8094 PetscErrorCode MFNSetDimensions(258,8641 #undef __FUNCT__275,9121 #define __FUNCT__ 276,9138 PetscErrorCode MFNSetFunction(293,9522 #undef __FUNCT__308,9913 #define __FUNCT__ 309,9930 PetscErrorCode MFNGetFunction(325,10217 #undef __FUNCT__334,10427 #define __FUNCT__ 335,10444 PetscErrorCode MFNSetScaleFactor(356,10935 #undef __FUNCT__365,11169 #define __FUNCT__ 366,11186 PetscErrorCode MFNGetScaleFactor(382,11497 #undef __FUNCT__391,11713 #define __FUNCT__ 392,11730 PetscErrorCode MFNSetErrorIfNotConverged(414,12386 #undef __FUNCT__423,12630 #define __FUNCT__ 424,12647 PetscErrorCode MFNGetErrorIfNotConverged(441,13066 #undef __FUNCT__450,13297 #define __FUNCT__ 451,13314 PetscErrorCode MFNSetOptionsPrefix(478,14059 #undef __FUNCT__492,14571 #define __FUNCT__ 493,14588 PetscErrorCode MFNAppendOptionsPrefix(512,15141 #undef __FUNCT__526,15659 #define __FUNCT__ 527,15676 PetscErrorCode MFNGetOptionsPrefix(547,16181 src/mfn/interface/mfnregis.c,91 mfnregis.c:^?mfnregis.c^A,1 #undef __FUNCT__26,1034 #define __FUNCT__ 27,1051 PetscErrorCode MFNRegisterAll(37,1232 src/mfn/interface/mfnsetup.c,273 mfnsetup.c:^?mfnsetup.c^A,1 #undef __FUNCT__27,1067 #define __FUNCT__ 28,1084 PetscErrorCode MFNSetUp(47,1582 #undef __FUNCT__100,3434 #define __FUNCT__ 101,3451 PetscErrorCode MFNSetOperator(119,3884 #undef __FUNCT__138,4484 #define __FUNCT__ 139,4501 PetscErrorCode MFNGetOperator(155,4842 src/mfn/interface/mfnsolve.c,287 mfnsolve.c:^?mfnsolve.c^A,1 #undef __FUNCT__26,1036 #define __FUNCT__ 27,1053 PetscErrorCode MFNSolve(57,2043 #undef __FUNCT__101,3802 #define __FUNCT__ 102,3819 PetscErrorCode MFNGetIterationNumber(127,4577 #undef __FUNCT__136,4787 #define __FUNCT__ 137,4804 PetscErrorCode MFNGetConvergedReason(162,5506 src/mfn/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1015 SOURCEH 28,1026 DIRS 29,1037 LIBBASE 30,1048 LOCDIR 31,1068 src/mfn/interface/ftn-custom/zmfnf.c,1874 zmfnf.c:^?zmfnf.c^A,1 PETSC_EXTERN void mfnmonitordefault_(61,2641 PETSC_EXTERN void mfnmonitorlg_(66,2806 } _cb;74,3052 #undef __FUNCT__77,3152 static PetscErrorCode ourmonitor(79,3200 #undef __FUNCT__85,3416 static PetscErrorCode ourdestroy(87,3464 PETSC_EXTERN void PETSC_STDCALL mfndestroy_(94,3643 PETSC_EXTERN void PETSC_STDCALL mfnview_(99,3750 PETSC_EXTERN void PETSC_STDCALL mfnsettype_(106,3937 PETSC_EXTERN void PETSC_STDCALL mfngettype_(115,4152 PETSC_EXTERN void PETSC_STDCALL mfnsetoptionsprefix_(124,4431 PETSC_EXTERN void PETSC_STDCALL mfnappendoptionsprefix_(133,4670 PETSC_EXTERN void PETSC_STDCALL mfngetoptionsprefix_(142,4915 PETSC_EXTERN void PETSC_STDCALL mfncreate_(150,5183 PETSC_EXTERN void PETSC_STDCALL mfnmonitorset_(155,5325 PETSC_EXTERN void PETSC_STDCALL mfngetip_(174,6394 PETSC_EXTERN void PETSC_STDCALL mfngetds_(179,6508 PETSC_EXTERN void PETSC_STDCALL mfngetconvergedreason_(184,6622 src/nep/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1010 LOCDIR 26,1046 MANSEC 27,1066 src/nep/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,961 src/nep/examples/tests/makefile,172 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1015 EXAMPLESF 28,1028 MANSEC 29,1041 TESTS 30,1058 TESTEXAMPLES_C 32,1072 src/nep/examples/tutorials/ex20.c,595 ex20.c:^?ex20.c^A,1 static char help[help22,924 } ApplicationCtx;51,1782 #undef __FUNCT__53,1801 #define __FUNCT__ 54,1818 int main(55,1843 #undef __FUNCT__215,8225 #define __FUNCT__ 216,8242 PetscErrorCode FormInitialGuess(223,8386 #undef __FUNCT__233,8618 #define __FUNCT__ 234,8635 PetscErrorCode FormFunction(248,9023 #undef __FUNCT__308,10809 #define __FUNCT__ 309,10826 PetscErrorCode FormJacobian(323,11215 #undef __FUNCT__378,12769 #define __FUNCT__ 379,12786 PetscErrorCode CheckSolution(391,13120 #undef __FUNCT__419,14032 #define __FUNCT__ 420,14049 PetscErrorCode FixSign(429,14304 src/nep/examples/tutorials/ex21.c,1003 ex21.c:^?ex21.c^A,1 static char help[help22,924 } MatCtx;55,1852 } ApplicationCtx;63,2045 #undef __FUNCT__65,2064 #define __FUNCT__ 66,2081 int main(67,2106 #undef __FUNCT__215,7824 #define __FUNCT__ 216,7841 PetscErrorCode FormInitialGuess(223,7985 #undef __FUNCT__233,8217 #define __FUNCT__ 234,8234 PetscErrorCode FormFunction(248,8635 #undef __FUNCT__260,9002 #define __FUNCT__ 261,9019 PetscErrorCode FormJacobian(275,9421 #undef __FUNCT__287,9781 #define __FUNCT__ 288,9798 PetscErrorCode MatMult_Fun(289,9830 #undef __FUNCT__320,10851 #define __FUNCT__ 321,10868 PetscErrorCode MatGetDiagonal_Fun(322,10907 #undef __FUNCT__344,11591 #define __FUNCT__ 345,11608 PetscErrorCode MatDestroy_Fun(346,11643 #undef __FUNCT__358,11952 #define __FUNCT__ 359,11969 PetscErrorCode MatDuplicate_Fun(360,12006 #undef __FUNCT__386,13035 #define __FUNCT__ 387,13052 PetscErrorCode MatMult_Jac(388,13084 #undef __FUNCT__418,14044 #define __FUNCT__ 419,14061 PetscErrorCode MatDestroy_Jac(420,14096 src/nep/examples/tutorials/ex22.c,100 ex22.c:^?ex22.c^A,1 static char help[help22,924 #undef __FUNCT__46,1552 #define __FUNCT__ 47,1569 int main(48,1594 src/nep/examples/tutorials/makefile,361 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1019 EXAMPLESF 28,1053 MANSEC 29,1066 TESTEXAMPLES_C 31,1084 TESTEXAMPLES_C_NOCOMPLEX 34,1256 TESTEXAMPLES_F90 35,1283 ex20:ex2039,1351 ex21:ex2143,1428 ex22:ex2247,1505 runex20_1:runex20_153,1669 runex21_1:runex21_159,1877 runex22_1:runex22_165,2085 src/nep/impls/makefile,76 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,984 MANSEC 27,1010 src/nep/impls/narnoldi/makefile,158 makefile:^?makefile^A,1 ALL:ALL22,934 CFLAGS 24,944 FFLAGS 25,955 SOURCEC 26,966 SOURCEF 27,988 SOURCEH 28,1000 LIBBASE 29,1011 DIRS 30,1031 MANSEC 31,1042 LOCDIR 32,1057 src/nep/impls/narnoldi/narnoldi.c,299 narnoldi.c:^?narnoldi.c^A,1 #undef __FUNCT__40,1275 #define __FUNCT__ 41,1292 PetscErrorCode NEPSetUp_NARNOLDI(42,1330 #undef __FUNCT__74,2661 #define __FUNCT__ 75,2678 PetscErrorCode NEPSolve_NARNOLDI(76,2716 #undef __FUNCT__164,5881 #define __FUNCT__ 165,5898 PETSC_EXTERN PetscErrorCode NEPCreate_NARNOLDI(166,5937 src/nep/impls/rii/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,975 SOURCEH 28,986 LIBBASE 29,997 DIRS 30,1017 MANSEC 31,1028 LOCDIR 32,1043 src/nep/impls/rii/rii.c,284 rii.c:^?rii.c^A,1 #undef __FUNCT__40,1332 #define __FUNCT__ 41,1349 PetscErrorCode NEPSetUp_RII(42,1382 #undef __FUNCT__69,2506 #define __FUNCT__ 70,2523 PetscErrorCode NEPSolve_RII(71,2556 #undef __FUNCT__163,6040 #define __FUNCT__ 164,6057 PETSC_EXTERN PetscErrorCode NEPCreate_RII(165,6091 src/nep/impls/slp/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,975 SOURCEH 28,986 LIBBASE 29,997 DIRS 30,1017 MANSEC 31,1028 LOCDIR 32,1043 src/nep/impls/slp/slp.c,1071 slp.c:^?slp.c^A,1 } NEP_SLP;44,1509 #undef __FUNCT__46,1521 #define __FUNCT__ 47,1538 PetscErrorCode NEPSetUp_SLP(48,1571 #undef __FUNCT__89,3391 #define __FUNCT__ 90,3408 PetscErrorCode NEPSolve_SLP(91,3441 #undef __FUNCT__152,5649 #define __FUNCT__ 153,5666 PetscErrorCode NEPSetFromOptions_SLP(154,5708 #undef __FUNCT__163,5888 #define __FUNCT__ 164,5905 static PetscErrorCode NEPSLPSetEPS_SLP(165,5942 #undef __FUNCT__179,6330 #define __FUNCT__ 180,6347 PetscErrorCode NEPSLPSetEPS(195,6648 #undef __FUNCT__207,6980 #define __FUNCT__ 208,6997 static PetscErrorCode NEPSLPGetEPS_SLP(209,7034 #undef __FUNCT__229,7854 #define __FUNCT__ 230,7871 PetscErrorCode NEPSLPGetEPS(247,8202 #undef __FUNCT__258,8482 #define __FUNCT__ 259,8499 PetscErrorCode NEPView_SLP(260,8531 #undef __FUNCT__273,8939 #define __FUNCT__ 274,8956 PetscErrorCode NEPReset_SLP(275,8989 #undef __FUNCT__286,9256 #define __FUNCT__ 287,9273 PetscErrorCode NEPDestroy_SLP(288,9308 #undef __FUNCT__301,9742 #define __FUNCT__ 302,9759 PETSC_EXTERN PetscErrorCode NEPCreate_SLP(303,9793 src/nep/interface/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1045 SOURCEH 28,1056 LIBBASE 29,1067 DIRS 30,1087 MANSEC 31,1098 LOCDIR 32,1113 src/nep/interface/nepbasic.c,2486 nepbasic.c:^?nepbasic.c^A,1 PetscFunctionList NEPList 26,1029 PetscBool NEPRegisterAllCalled 27,1060 PetscClassId NEP_CLASSID 28,1114 PetscLogEvent NEP_SetUp 29,1149 static PetscBool NEPPackageInitialized 30,1252 #undef __FUNCT__32,1308 #define __FUNCT__ 33,1325 PetscErrorCode NEPFinalizePackage(42,1560 #undef __FUNCT__53,1814 #define __FUNCT__ 54,1831 PetscErrorCode NEPInitializePackage(64,2159 #undef __FUNCT__104,3763 #define __FUNCT__ 105,3780 PetscErrorCode NEPView(133,4577 #undef __FUNCT__226,9193 #define __FUNCT__ 227,9210 PetscErrorCode NEPCreate(243,9508 #undef __FUNCT__317,11807 #define __FUNCT__ 318,11824 PetscErrorCode NEPSetType(347,12745 #undef __FUNCT__371,13559 #define __FUNCT__ 372,13576 PetscErrorCode NEPGetType(388,13855 #undef __FUNCT__397,14074 #define __FUNCT__ 398,14091 PetscErrorCode NEPRegister(425,14719 #undef __FUNCT__434,14942 #define __FUNCT__ 435,14959 PetscErrorCode NEPReset(449,15240 #undef __FUNCT__466,15746 #define __FUNCT__ 467,15763 PetscErrorCode NEPDestroy(480,16010 #undef __FUNCT__512,17264 #define __FUNCT__ 513,17281 PetscErrorCode NEPSetIP(531,17699 #undef __FUNCT__546,18121 #define __FUNCT__ 547,18138 PetscErrorCode NEPGetIP(564,18463 #undef __FUNCT__579,18832 #define __FUNCT__ 580,18849 PetscErrorCode NEPSetDS(598,19266 #undef __FUNCT__613,19688 #define __FUNCT__ 614,19705 PetscErrorCode NEPGetDS(631,20030 #undef __FUNCT__646,20399 #define __FUNCT__ 647,20416 PetscErrorCode NEPSetKSP(665,20838 #undef __FUNCT__680,21272 #define __FUNCT__ 681,21289 PetscErrorCode NEPGetKSP(698,21614 #undef __FUNCT__716,22239 #define __FUNCT__ 717,22256 PetscErrorCode NEPSetTarget(735,22699 #undef __FUNCT__744,22930 #define __FUNCT__ 745,22947 PetscErrorCode NEPGetTarget(764,23284 #undef __FUNCT__773,23503 #define __FUNCT__ 774,23520 PetscErrorCode NEPSetFunction(802,24551 #undef __FUNCT__828,25411 #define __FUNCT__ 829,25428 PetscErrorCode NEPGetFunction(849,26016 #undef __FUNCT__860,26396 #define __FUNCT__ 861,26413 PetscErrorCode NEPSetJacobian(888,27360 #undef __FUNCT__907,27955 #define __FUNCT__ 908,27972 PetscErrorCode NEPGetJacobian(927,28501 #undef __FUNCT__937,28832 #define __FUNCT__ 938,28849 PetscErrorCode NEPSetSplitOperator(970,29950 #undef __FUNCT__1016,31627 #define __FUNCT__ 1017,31644 PetscErrorCode NEPGetSplitOperatorTerm(1036,32209 #undef __FUNCT__1046,32547 #define __FUNCT__ 1047,32564 PetscErrorCode NEPGetSplitOperatorInfo(1065,33083 src/nep/interface/nepdefault.c,378 nepdefault.c:^?nepdefault.c^A,1 #undef __FUNCT__27,1095 #define __FUNCT__ 28,1112 PetscErrorCode NEPReset_Default(29,1149 #undef __FUNCT__40,1392 #define __FUNCT__ 41,1409 PetscErrorCode NEPSetWorkVecs(57,1779 #undef __FUNCT__71,2153 #define __FUNCT__ 72,2170 PetscErrorCode NEPGetDefaultShift(76,2299 #undef __FUNCT__104,2964 #define __FUNCT__ 105,2981 PetscErrorCode NEPConvergedDefault(109,3100 src/nep/interface/nepmon.c,853 nepmon.c:^?nepmon.c^A,1 #undef __FUNCT__27,1050 #define __FUNCT__ 28,1067 PetscErrorCode NEPMonitor(32,1156 #undef __FUNCT__44,1512 #define __FUNCT__ 45,1529 PetscErrorCode NEPMonitorSet(93,3484 #undef __FUNCT__104,4086 #define __FUNCT__ 105,4103 PetscErrorCode NEPMonitorCancel(123,4576 #undef __FUNCT__139,4953 #define __FUNCT__ 140,4970 PetscErrorCode NEPGetMonitorContext(157,5343 #undef __FUNCT__165,5532 #define __FUNCT__ 166,5549 PetscErrorCode NEPMonitorAll(186,6137 #undef __FUNCT__210,7188 #define __FUNCT__ 211,7205 PetscErrorCode NEPMonitorFirst(231,7803 #undef __FUNCT__251,8783 #define __FUNCT__ 252,8800 PetscErrorCode NEPMonitorConverged(276,9456 #undef __FUNCT__305,10727 #define __FUNCT__ 306,10744 PetscErrorCode NEPMonitorLG(307,10777 #undef __FUNCT__335,11814 #define __FUNCT__ 336,11831 PetscErrorCode NEPMonitorLGAll(337,11867 src/nep/interface/nepopts.c,1731 nepopts.c:^?nepopts.c^A,1 #undef __FUNCT__27,1086 #define __FUNCT__ 28,1103 PetscErrorCode NEPSetFromOptions(44,1502 #undef __FUNCT__178,10414 #define __FUNCT__ 179,10431 PetscErrorCode NEPGetTolerances(204,11139 #undef __FUNCT__216,11545 #define __FUNCT__ 217,11562 PetscErrorCode NEPSetTolerances(249,12539 #undef __FUNCT__303,14503 #define __FUNCT__ 304,14520 PetscErrorCode NEPGetDimensions(326,15084 #undef __FUNCT__336,15351 #define __FUNCT__ 337,15368 PetscErrorCode NEPSetDimensions(374,16695 #undef __FUNCT__406,17729 #define __FUNCT__ 407,17746 PetscErrorCode NEPSetWhichEigenpairs(452,19607 #undef __FUNCT__483,20513 #define __FUNCT__ 484,20530 PetscErrorCode NEPGetWhichEigenpairs(504,20988 #undef __FUNCT__513,21203 #define __FUNCT__ 514,21220 PetscErrorCode NEPSetLagPreconditioner(538,21895 #undef __FUNCT__548,22210 #define __FUNCT__ 549,22227 PetscErrorCode NEPGetLagPreconditioner(565,22541 #undef __FUNCT__574,22750 #define __FUNCT__ 575,22767 PetscErrorCode NEPSetConstCorrectionTol(599,23432 #undef __FUNCT__608,23661 #define __FUNCT__ 609,23678 PetscErrorCode NEPGetConstCorrectionTol(625,24004 #undef __FUNCT__634,24217 #define __FUNCT__ 635,24234 PetscErrorCode NEPSetConvergenceTest(665,25304 #undef __FUNCT__680,25813 #define __FUNCT__ 681,25830 PetscErrorCode NEPSetTrackAll(704,26567 #undef __FUNCT__713,26804 #define __FUNCT__ 714,26821 PetscErrorCode NEPGetTrackAll(731,27146 #undef __FUNCT__740,27367 #define __FUNCT__ 741,27384 PetscErrorCode NEPSetOptionsPrefix(768,28137 #undef __FUNCT__785,28842 #define __FUNCT__ 786,28859 PetscErrorCode NEPAppendOptionsPrefix(805,29418 #undef __FUNCT__822,30129 #define __FUNCT__ 823,30146 PetscErrorCode NEPGetOptionsPrefix(843,30657 src/nep/interface/nepregis.c,91 nepregis.c:^?nepregis.c^A,1 #undef __FUNCT__28,1136 #define __FUNCT__ 29,1153 PetscErrorCode NEPRegisterAll(39,1328 src/nep/interface/nepsetup.c,377 nepsetup.c:^?nepsetup.c^A,1 #undef __FUNCT__27,1067 #define __FUNCT__ 28,1084 PetscErrorCode NEPSetUp(47,1561 #undef __FUNCT__162,5833 #define __FUNCT__ 163,5850 PetscErrorCode NEPSetInitialSpace(190,6762 #undef __FUNCT__203,7214 #define __FUNCT__ 204,7231 PetscErrorCode NEPAllocateSolution(210,7449 #undef __FUNCT__233,8290 #define __FUNCT__ 234,8307 PetscErrorCode NEPFreeSolution(239,8442 src/nep/interface/nepsolve.c,1924 nepsolve.c:^?nepsolve.c^A,1 #undef __FUNCT__27,1063 #define __FUNCT__ 28,1080 PetscErrorCode NEPSolve(45,1480 #undef __FUNCT__112,3891 #define __FUNCT__ 113,3908 PetscErrorCode NEP_KSPSolve(114,3941 #undef __FUNCT__127,4316 #define __FUNCT__ 128,4333 PetscErrorCode NEPProjectOperator(154,5142 #undef __FUNCT__194,6582 #define __FUNCT__ 195,6599 PetscErrorCode NEPApplyFunction(224,7510 #undef __FUNCT__250,8366 #define __FUNCT__ 251,8383 PetscErrorCode NEPApplyJacobian(279,9254 #undef __FUNCT__305,10103 #define __FUNCT__ 306,10120 PetscErrorCode NEPGetIterationNumber(331,10884 #undef __FUNCT__340,11094 #define __FUNCT__ 341,11111 PetscErrorCode NEPGetConverged(360,11501 #undef __FUNCT__369,11713 #define __FUNCT__ 370,11730 PetscErrorCode NEPGetConvergedReason(400,12791 #undef __FUNCT__409,13020 #define __FUNCT__ 410,13037 PetscErrorCode NEPGetEigenpair(438,13922 #undef __FUNCT__458,14661 #define __FUNCT__ 459,14678 PetscErrorCode NEPGetErrorEstimate(481,15192 #undef __FUNCT__493,15676 #define __FUNCT__ 494,15693 PetscErrorCode NEPComputeResidualNorm_Private(499,15860 #undef __FUNCT__515,16353 #define __FUNCT__ 516,16370 PetscErrorCode NEPComputeResidualNorm(540,17076 #undef __FUNCT__557,17612 #define __FUNCT__ 558,17629 PetscErrorCode NEPComputeRelativeError_Private(563,17791 #undef __FUNCT__579,18236 #define __FUNCT__ 580,18253 PetscErrorCode NEPComputeRelativeError(600,18859 #undef __FUNCT__617,19400 #define __FUNCT__ 618,19417 PetscErrorCode NEPSortEigenvalues(642,20041 #undef __FUNCT__665,20662 #define __FUNCT__ 666,20679 PetscErrorCode NEPCompareEigenvalues(692,21381 #undef __FUNCT__704,21807 #define __FUNCT__ 705,21824 PetscErrorCode NEPGetOperationCounters(727,22396 #undef __FUNCT__742,22833 #define __FUNCT__ 743,22850 PetscErrorCode NEPComputeFunction(768,23508 #undef __FUNCT__805,24628 #define __FUNCT__ 806,24645 PetscErrorCode NEPComputeJacobian(829,25230 src/nep/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1015 SOURCEH 28,1026 DIRS 29,1037 LIBBASE 30,1048 LOCDIR 31,1068 src/nep/interface/ftn-custom/znepf.c,2472 znepf.c:^?znepf.c^A,1 PETSC_EXTERN void nepmonitorall_(72,3198 PETSC_EXTERN void nepmonitorlg_(77,3419 PETSC_EXTERN void nepmonitorlgall_(82,3638 PETSC_EXTERN void nepmonitorconverged_(87,3863 PETSC_EXTERN void nepmonitorfirst_(92,4096 } _cb;100,4412 #undef __FUNCT__103,4512 static PetscErrorCode ourmonitor(105,4560 #undef __FUNCT__111,4860 static PetscErrorCode ourdestroy(113,4908 PETSC_EXTERN void PETSC_STDCALL nepdestroy_(120,5087 PETSC_EXTERN void PETSC_STDCALL nepview_(125,5194 PETSC_EXTERN void PETSC_STDCALL nepsettype_(132,5381 PETSC_EXTERN void PETSC_STDCALL nepgettype_(141,5596 PETSC_EXTERN void PETSC_STDCALL nepsetoptionsprefix_(150,5875 PETSC_EXTERN void PETSC_STDCALL nepappendoptionsprefix_(159,6114 PETSC_EXTERN void PETSC_STDCALL nepcreate_(168,6359 PETSC_EXTERN void PETSC_STDCALL nepgetoptionsprefix_(173,6501 PETSC_EXTERN void PETSC_STDCALL nepmonitorset_(181,6769 PETSC_EXTERN void PETSC_STDCALL nepgetip_(216,8754 PETSC_EXTERN void PETSC_STDCALL nepgetds_(221,8868 PETSC_EXTERN void PETSC_STDCALL nepgetksp_(226,8982 PETSC_EXTERN void PETSC_STDCALL nepgetwhicheigenpairs_(231,9101 PETSC_EXTERN void PETSC_STDCALL nepgetconvergedreason_(236,9253 src/qep/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1010 LOCDIR 26,1046 MANSEC 27,1066 src/qep/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,961 src/qep/examples/tests/makefile,336 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1015 EXAMPLESF 28,1044 MANSEC 29,1057 TESTS 30,1074 TESTEXAMPLES_C 32,1100 test1:test137,1253 test2:test241,1335 QEP 46,1503 QEPEPS 47,1518 EPS 48,1534 TESTCODE 50,1571 runtest1_1:runtest1_156,1780 runtest2_1:runtest2_170,2211 src/qep/examples/tests/test1.c,100 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__31,1344 #define __FUNCT__ 32,1361 int main(33,1386 src/qep/examples/tests/test2.c,101 test2.c:^?test2.c^A,1 static char help[help32,1387 #undef __FUNCT__41,1761 #define __FUNCT__ 42,1778 int main(43,1803 src/qep/examples/tutorials/ex16.c,100 ex16.c:^?ex16.c^A,1 static char help[help22,924 #undef __FUNCT__29,1209 #define __FUNCT__ 30,1226 int main(31,1251 src/qep/examples/tutorials/ex17.c,100 ex17.c:^?ex17.c^A,1 static char help[help22,924 #undef __FUNCT__30,1344 #define __FUNCT__ 31,1361 int main(32,1386 src/qep/examples/tutorials/makefile,391 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1019 EXAMPLESF 28,1046 MANSEC 29,1071 TESTEXAMPLES_C 31,1089 TESTEXAMPLES_C_NOCOMPLEX 32,1145 TESTEXAMPLES_F90 33,1201 ex16:ex1637,1307 ex16f90:ex16f9041,1384 ex17:ex1745,1476 DATAPATH 50,1639 runex16_1:runex16_152,1695 runex16f90_1:runex16f90_158,1937 runex17_1:runex17_164,2200 src/qep/examples/tutorials/ex16f90.F90,0 ex16f90.F90:^?ex16f90.F90^A,1 src/qep/impls/makefile,76 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,992 MANSEC 27,1018 src/qep/impls/linear/linear.c,2374 linear.c:^?linear.c^A,1 #undef __FUNCT__29,1138 #define __FUNCT__ 30,1155 PetscErrorCode QEPSetUp_Linear(31,1191 #undef __FUNCT__151,7295 #define __FUNCT__ 152,7312 static PetscErrorCode QEPLinearSelect_Norm(163,7785 #undef __FUNCT__235,10958 #define __FUNCT__ 236,10975 static PetscErrorCode QEPLinearSelect_Simple(246,11423 #undef __FUNCT__295,13418 #define __FUNCT__ 296,13435 PetscErrorCode QEPSolve_Linear(297,13471 #undef __FUNCT__324,14540 #define __FUNCT__ 325,14557 static PetscErrorCode EPSMonitor_Linear(326,14595 #undef __FUNCT__345,15248 #define __FUNCT__ 346,15265 PetscErrorCode QEPSetFromOptions_Linear(347,15310 #undef __FUNCT__376,16441 #define __FUNCT__ 377,16458 static PetscErrorCode QEPLinearSetCompanionForm_Linear(378,16511 #undef __FUNCT__392,16965 #define __FUNCT__ 393,16982 PetscErrorCode QEPLinearSetCompanionForm(411,17451 #undef __FUNCT__422,17788 #define __FUNCT__ 423,17805 static PetscErrorCode QEPLinearGetCompanionForm_Linear(424,17858 #undef __FUNCT__433,18059 #define __FUNCT__ 434,18076 PetscErrorCode QEPLinearGetCompanionForm(451,18476 #undef __FUNCT__462,18801 #define __FUNCT__ 463,18818 static PetscErrorCode QEPLinearSetExplicitMatrix_Linear(464,18872 #undef __FUNCT__473,19100 #define __FUNCT__ 474,19117 PetscErrorCode QEPLinearSetExplicitMatrix(492,19639 #undef __FUNCT__503,20008 #define __FUNCT__ 504,20025 static PetscErrorCode QEPLinearGetExplicitMatrix_Linear(505,20079 #undef __FUNCT__514,20309 #define __FUNCT__ 515,20326 PetscErrorCode QEPLinearGetExplicitMatrix(532,20731 #undef __FUNCT__543,21084 #define __FUNCT__ 544,21101 static PetscErrorCode QEPLinearSetEPS_Linear(545,21144 #undef __FUNCT__559,21541 #define __FUNCT__ 560,21558 PetscErrorCode QEPLinearSetEPS(575,21862 #undef __FUNCT__587,22200 #define __FUNCT__ 588,22217 static PetscErrorCode QEPLinearGetEPS_Linear(589,22260 #undef __FUNCT__610,23166 #define __FUNCT__ 611,23183 PetscErrorCode QEPLinearGetEPS(628,23516 #undef __FUNCT__639,23802 #define __FUNCT__ 640,23819 PetscErrorCode QEPView_Linear(641,23854 #undef __FUNCT__656,24511 #define __FUNCT__ 657,24528 PetscErrorCode QEPReset_Linear(658,24564 #undef __FUNCT__675,25105 #define __FUNCT__ 676,25122 PetscErrorCode QEPDestroy_Linear(677,25160 #undef __FUNCT__694,26024 #define __FUNCT__ 695,26041 PETSC_EXTERN PetscErrorCode QEPCreate_Linear(696,26078 src/qep/impls/linear/linearp.h,49 linearp.h:^?linearp.h^A,1 #define __LINEARP_H25,984 } QEP_LINEAR;36,1445 src/qep/impls/linear/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1050 SOURCEH 28,1061 LIBBASE 29,1082 DIRS 30,1102 MANSEC 31,1113 LOCDIR 32,1128 src/qep/impls/linear/qeplin_h1.c,616 qeplin_h1.c:^?qeplin_h1.c^A,1 #undef __FUNCT__36,1329 #define __FUNCT__ 37,1346 PetscErrorCode MatMult_Linear_H1A(38,1385 #undef __FUNCT__70,2585 #define __FUNCT__ 71,2602 PetscErrorCode MatMult_Linear_H1B(72,2641 #undef __FUNCT__103,3786 #define __FUNCT__ 104,3803 PetscErrorCode MatGetDiagonal_Linear_H1A(105,3849 #undef __FUNCT__126,4559 #define __FUNCT__ 127,4576 PetscErrorCode MatGetDiagonal_Linear_H1B(128,4622 #undef __FUNCT__137,4797 #define __FUNCT__ 138,4814 PetscErrorCode MatCreateExplicit_Linear_H1A(139,4863 #undef __FUNCT__148,5115 #define __FUNCT__ 149,5132 PetscErrorCode MatCreateExplicit_Linear_H1B(150,5181 src/qep/impls/linear/qeplin_h2.c,616 qeplin_h2.c:^?qeplin_h2.c^A,1 #undef __FUNCT__36,1329 #define __FUNCT__ 37,1346 PetscErrorCode MatMult_Linear_H2A(38,1385 #undef __FUNCT__70,2576 #define __FUNCT__ 71,2593 PetscErrorCode MatMult_Linear_H2B(72,2632 #undef __FUNCT__106,3968 #define __FUNCT__ 107,3985 PetscErrorCode MatGetDiagonal_Linear_H2A(108,4031 #undef __FUNCT__117,4206 #define __FUNCT__ 118,4223 PetscErrorCode MatGetDiagonal_Linear_H2B(119,4269 #undef __FUNCT__141,5047 #define __FUNCT__ 142,5064 PetscErrorCode MatCreateExplicit_Linear_H2A(143,5113 #undef __FUNCT__152,5379 #define __FUNCT__ 153,5396 PetscErrorCode MatCreateExplicit_Linear_H2B(154,5445 src/qep/impls/linear/qeplin_n1.c,616 qeplin_n1.c:^?qeplin_n1.c^A,1 #undef __FUNCT__36,1326 #define __FUNCT__ 37,1343 PetscErrorCode MatMult_Linear_N1A(38,1382 #undef __FUNCT__71,2623 #define __FUNCT__ 72,2640 PetscErrorCode MatMult_Linear_N1B(73,2679 #undef __FUNCT__104,3813 #define __FUNCT__ 105,3830 PetscErrorCode MatGetDiagonal_Linear_N1A(106,3876 #undef __FUNCT__128,4637 #define __FUNCT__ 129,4654 PetscErrorCode MatGetDiagonal_Linear_N1B(130,4700 #undef __FUNCT__152,5473 #define __FUNCT__ 153,5490 PetscErrorCode MatCreateExplicit_Linear_N1A(154,5539 #undef __FUNCT__175,6349 #define __FUNCT__ 176,6366 PetscErrorCode MatCreateExplicit_Linear_N1B(177,6415 src/qep/impls/linear/qeplin_n2.c,616 qeplin_n2.c:^?qeplin_n2.c^A,1 #undef __FUNCT__36,1326 #define __FUNCT__ 37,1343 PetscErrorCode MatMult_Linear_N2A(38,1382 #undef __FUNCT__69,2496 #define __FUNCT__ 70,2513 PetscErrorCode MatMult_Linear_N2B(71,2552 #undef __FUNCT__104,3811 #define __FUNCT__ 105,3828 PetscErrorCode MatGetDiagonal_Linear_N2A(106,3874 #undef __FUNCT__128,4626 #define __FUNCT__ 129,4643 PetscErrorCode MatGetDiagonal_Linear_N2B(130,4689 #undef __FUNCT__152,5449 #define __FUNCT__ 153,5466 PetscErrorCode MatCreateExplicit_Linear_N2A(154,5515 #undef __FUNCT__175,6311 #define __FUNCT__ 176,6328 PetscErrorCode MatCreateExplicit_Linear_N2B(177,6377 src/qep/impls/linear/qeplin_s1.c,616 qeplin_s1.c:^?qeplin_s1.c^A,1 #undef __FUNCT__36,1328 #define __FUNCT__ 37,1345 PetscErrorCode MatMult_Linear_S1A(38,1384 #undef __FUNCT__72,2683 #define __FUNCT__ 73,2700 PetscErrorCode MatMult_Linear_S1B(74,2739 #undef __FUNCT__106,3930 #define __FUNCT__ 107,3947 PetscErrorCode MatGetDiagonal_Linear_S1A(108,3993 #undef __FUNCT__130,4754 #define __FUNCT__ 131,4771 PetscErrorCode MatGetDiagonal_Linear_S1B(132,4817 #undef __FUNCT__155,5648 #define __FUNCT__ 156,5665 PetscErrorCode MatCreateExplicit_Linear_S1A(157,5714 #undef __FUNCT__166,5969 #define __FUNCT__ 167,5986 PetscErrorCode MatCreateExplicit_Linear_S1B(168,6035 src/qep/impls/linear/qeplin_s2.c,616 qeplin_s2.c:^?qeplin_s2.c^A,1 #undef __FUNCT__36,1328 #define __FUNCT__ 37,1345 PetscErrorCode MatMult_Linear_S2A(38,1384 #undef __FUNCT__70,2575 #define __FUNCT__ 71,2592 PetscErrorCode MatMult_Linear_S2B(72,2631 #undef __FUNCT__106,3967 #define __FUNCT__ 107,3984 PetscErrorCode MatGetDiagonal_Linear_S2A(108,4030 #undef __FUNCT__131,4861 #define __FUNCT__ 132,4878 PetscErrorCode MatGetDiagonal_Linear_S2B(133,4924 #undef __FUNCT__155,5684 #define __FUNCT__ 156,5701 PetscErrorCode MatCreateExplicit_Linear_S2A(157,5750 #undef __FUNCT__166,6016 #define __FUNCT__ 167,6033 PetscErrorCode MatCreateExplicit_Linear_S2B(168,6082 src/qep/impls/qarnoldi/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,980 SOURCEH 28,991 LIBBASE 29,1002 DIRS 30,1022 MANSEC 31,1033 LOCDIR 32,1048 src/qep/impls/qarnoldi/qarnoldi.c,501 qarnoldi.c:^?qarnoldi.c^A,1 #undef __FUNCT__42,1384 #define __FUNCT__ 43,1401 PetscErrorCode QEPSetUp_QArnoldi(44,1439 #undef __FUNCT__79,2772 #define __FUNCT__ 80,2789 static PetscErrorCode QEPQArnoldiCGS(84,2891 #undef __FUNCT__124,4234 #define __FUNCT__ 125,4251 static PetscErrorCode QEPQArnoldi(129,4329 #undef __FUNCT__192,6717 #define __FUNCT__ 193,6734 PetscErrorCode QEPSolve_QArnoldi(194,6772 #undef __FUNCT__310,11113 #define __FUNCT__ 311,11130 PETSC_EXTERN PetscErrorCode QEPCreate_QArnoldi(312,11169 src/qep/impls/qlanczos/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,980 SOURCEH 28,991 LIBBASE 29,1002 DIRS 30,1022 MANSEC 31,1033 LOCDIR 32,1048 src/qep/impls/qlanczos/qlanczos.c,604 qlanczos.c:^?qlanczos.c^A,1 #undef __FUNCT__42,1371 #define __FUNCT__ 43,1388 PetscErrorCode QEPSetUp_QLanczos(44,1426 #undef __FUNCT__81,2927 #define __FUNCT__ 82,2944 PetscErrorCode QEPQLanczosNorm_private(86,3061 #undef __FUNCT__102,3562 #define __FUNCT__ 103,3579 static PetscErrorCode QEPQLanczosCGS(107,3681 #undef __FUNCT__149,5243 #define __FUNCT__ 150,5260 static PetscErrorCode QEPQLanczos(154,5338 #undef __FUNCT__214,7630 #define __FUNCT__ 215,7647 PetscErrorCode QEPSolve_QLanczos(216,7685 #undef __FUNCT__362,13374 #define __FUNCT__ 363,13391 PETSC_EXTERN PetscErrorCode QEPCreate_QLanczos(364,13430 src/qep/interface/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1045 SOURCEH 28,1056 LIBBASE 29,1067 DIRS 30,1087 MANSEC 31,1098 LOCDIR 32,1113 src/qep/interface/qepbasic.c,1921 qepbasic.c:^?qepbasic.c^A,1 PetscFunctionList QEPList 26,1045 PetscBool QEPRegisterAllCalled 27,1076 PetscClassId QEP_CLASSID 28,1130 PetscLogEvent QEP_SetUp 29,1165 static PetscBool QEPPackageInitialized 30,1226 #undef __FUNCT__32,1282 #define __FUNCT__ 33,1299 PetscErrorCode QEPFinalizePackage(42,1534 #undef __FUNCT__53,1788 #define __FUNCT__ 54,1805 PetscErrorCode QEPInitializePackage(64,2133 #undef __FUNCT__102,3547 #define __FUNCT__ 103,3564 PetscErrorCode QEPView(131,4361 #define HERM 145,4802 #define HERM 147,4833 #undef __FUNCT__234,9327 #define __FUNCT__ 235,9344 PetscErrorCode QEPPrintSolution(256,9851 #undef __FUNCT__339,13331 #define __FUNCT__ 340,13348 PetscErrorCode QEPCreate(359,13693 #undef __FUNCT__424,15694 #define __FUNCT__ 425,15711 PetscErrorCode QEPSetType(455,16661 #undef __FUNCT__479,17475 #define __FUNCT__ 480,17492 PetscErrorCode QEPGetType(496,17771 #undef __FUNCT__505,17990 #define __FUNCT__ 506,18007 PetscErrorCode QEPRegister(533,18635 #undef __FUNCT__542,18858 #define __FUNCT__ 543,18875 PetscErrorCode QEPReset(557,19156 #undef __FUNCT__577,19794 #define __FUNCT__ 578,19811 PetscErrorCode QEPDestroy(591,20058 #undef __FUNCT__613,20969 #define __FUNCT__ 614,20986 PetscErrorCode QEPSetIP(632,21404 #undef __FUNCT__647,21826 #define __FUNCT__ 648,21843 PetscErrorCode QEPGetIP(665,22168 #undef __FUNCT__680,22537 #define __FUNCT__ 681,22554 PetscErrorCode QEPSetDS(699,22971 #undef __FUNCT__714,23393 #define __FUNCT__ 715,23410 PetscErrorCode QEPGetDS(732,23735 #undef __FUNCT__747,24104 #define __FUNCT__ 748,24121 PetscErrorCode QEPSetST(766,24560 #undef __FUNCT__781,24982 #define __FUNCT__ 782,24999 PetscErrorCode QEPGetST(799,25339 #undef __FUNCT__814,25708 #define __FUNCT__ 815,25725 PetscErrorCode QEPSetTarget(833,26168 #undef __FUNCT__846,26546 #define __FUNCT__ 847,26563 PetscErrorCode QEPGetTarget(866,26900 src/qep/interface/qepdefault.c,578 qepdefault.c:^?qepdefault.c^A,1 #undef __FUNCT__27,1095 #define __FUNCT__ 28,1112 PetscErrorCode QEPReset_Default(29,1149 #undef __FUNCT__40,1392 #define __FUNCT__ 41,1409 PetscErrorCode QEPSetWorkVecs(57,1779 #undef __FUNCT__71,2153 #define __FUNCT__ 72,2170 PetscErrorCode QEPConvergedDefault(76,2287 #undef __FUNCT__86,2532 #define __FUNCT__ 87,2549 PetscErrorCode QEPConvergedAbsolute(91,2652 #undef __FUNCT__98,2843 #define __FUNCT__ 99,2860 PetscErrorCode QEPComputeVectors_Schur(100,2904 #undef __FUNCT__120,3504 #define __FUNCT__ 121,3521 PetscErrorCode QEPKrylovConvergence(132,3812 src/qep/interface/qepmon.c,854 qepmon.c:^?qepmon.c^A,1 #undef __FUNCT__27,1050 #define __FUNCT__ 28,1067 PetscErrorCode QEPMonitor(32,1156 #undef __FUNCT__44,1537 #define __FUNCT__ 45,1554 PetscErrorCode QEPMonitorSet(93,3588 #undef __FUNCT__104,4203 #define __FUNCT__ 105,4220 PetscErrorCode QEPMonitorCancel(123,4693 #undef __FUNCT__139,5070 #define __FUNCT__ 140,5087 PetscErrorCode QEPGetMonitorContext(157,5460 #undef __FUNCT__165,5649 #define __FUNCT__ 166,5666 PetscErrorCode QEPMonitorAll(187,6317 #undef __FUNCT__212,7486 #define __FUNCT__ 213,7503 PetscErrorCode QEPMonitorFirst(234,8164 #undef __FUNCT__255,9268 #define __FUNCT__ 256,9285 PetscErrorCode QEPMonitorConverged(281,10004 #undef __FUNCT__311,11393 #define __FUNCT__ 312,11410 PetscErrorCode QEPMonitorLG(313,11443 #undef __FUNCT__341,12498 #define __FUNCT__ 342,12515 PetscErrorCode QEPMonitorLGAll(343,12551 src/qep/interface/qepopts.c,1917 qepopts.c:^?qepopts.c^A,1 #undef __FUNCT__27,1086 #define __FUNCT__ 28,1103 PetscErrorCode QEPSetFromOptions(44,1502 #undef __FUNCT__183,10503 #define __FUNCT__ 184,10520 PetscErrorCode QEPGetTolerances(205,10986 #undef __FUNCT__214,11230 #define __FUNCT__ 215,11247 PetscErrorCode QEPSetTolerances(241,11959 #undef __FUNCT__267,12781 #define __FUNCT__ 268,12798 PetscErrorCode QEPGetDimensions(290,13362 #undef __FUNCT__300,13629 #define __FUNCT__ 301,13646 PetscErrorCode QEPSetDimensions(338,14973 #undef __FUNCT__370,16007 #define __FUNCT__ 371,16024 PetscErrorCode QEPSetWhichEigenpairs(416,17885 #undef __FUNCT__447,18791 #define __FUNCT__ 448,18808 PetscErrorCode QEPGetWhichEigenpairs(468,19266 #undef __FUNCT__477,19481 #define __FUNCT__ 478,19498 PetscErrorCode QEPSetLeftVectorsWanted(500,20189 #undef __FUNCT__512,20502 #define __FUNCT__ 513,20519 PetscErrorCode QEPGetLeftVectorsWanted(530,20875 #undef __FUNCT__539,21105 #define __FUNCT__ 540,21122 PetscErrorCode QEPGetScaleFactor(560,21571 #undef __FUNCT__569,21785 #define __FUNCT__ 570,21802 PetscErrorCode QEPSetScaleFactor(594,22454 #undef __FUNCT__612,23016 #define __FUNCT__ 613,23033 PetscErrorCode QEPSetProblemType(643,24133 #undef __FUNCT__654,24544 #define __FUNCT__ 655,24561 PetscErrorCode QEPGetProblemType(671,24885 #undef __FUNCT__680,25106 #define __FUNCT__ 681,25123 PetscErrorCode QEPSetConvergenceTest(711,26178 #undef __FUNCT__720,26468 #define __FUNCT__ 721,26485 PetscErrorCode QEPSetTrackAll(744,27222 #undef __FUNCT__753,27459 #define __FUNCT__ 754,27476 PetscErrorCode QEPGetTrackAll(771,27801 #undef __FUNCT__780,28022 #define __FUNCT__ 781,28039 PetscErrorCode QEPSetOptionsPrefix(808,28792 #undef __FUNCT__822,29304 #define __FUNCT__ 823,29321 PetscErrorCode QEPAppendOptionsPrefix(842,29880 #undef __FUNCT__864,30730 #define __FUNCT__ 865,30747 PetscErrorCode QEPGetOptionsPrefix(885,31258 src/qep/interface/qepregis.c,91 qepregis.c:^?qepregis.c^A,1 #undef __FUNCT__28,1144 #define __FUNCT__ 29,1161 PetscErrorCode QEPRegisterAll(39,1336 src/qep/interface/qepsetup.c,679 qepsetup.c:^?qepsetup.c^A,1 #undef __FUNCT__27,1067 #define __FUNCT__ 28,1084 PetscErrorCode QEPSetUp(47,1561 #undef __FUNCT__190,6926 #define __FUNCT__ 191,6943 PetscErrorCode QEPSetOperators(211,7480 #undef __FUNCT__250,9094 #define __FUNCT__ 251,9111 PetscErrorCode QEPGetOperators(269,9516 #undef __FUNCT__279,9827 #define __FUNCT__ 280,9844 PetscErrorCode QEPSetInitialSpace(309,10792 #undef __FUNCT__322,11244 #define __FUNCT__ 323,11261 PetscErrorCode QEPSetInitialSpaceLeft(353,12314 #undef __FUNCT__366,12772 #define __FUNCT__ 367,12789 PetscErrorCode QEPAllocateSolution(373,13007 #undef __FUNCT__397,13928 #define __FUNCT__ 398,13945 PetscErrorCode QEPFreeSolution(403,14080 src/qep/interface/qepsolve.c,1456 qepsolve.c:^?qepsolve.c^A,1 } QEPSortForSTData;31,1209 #undef __FUNCT__33,1230 #define __FUNCT__ 34,1247 static PetscErrorCode QEPSortForSTFunc(35,1284 #undef __FUNCT__48,1768 #define __FUNCT__ 49,1785 PetscErrorCode QEPSolve(69,2432 #undef __FUNCT__180,6375 #define __FUNCT__ 181,6392 PetscErrorCode QEPGetIterationNumber(206,7156 #undef __FUNCT__215,7366 #define __FUNCT__ 216,7383 PetscErrorCode QEPGetConverged(235,7773 #undef __FUNCT__244,7985 #define __FUNCT__ 245,8002 PetscErrorCode QEPGetConvergedReason(270,8681 #undef __FUNCT__279,8910 #define __FUNCT__ 280,8927 PetscErrorCode QEPGetEigenpair(311,9939 #undef __FUNCT__358,11666 #define __FUNCT__ 359,11683 PetscErrorCode QEPGetErrorEstimate(382,12239 #undef __FUNCT__394,12738 #define __FUNCT__ 395,12755 PetscErrorCode QEPComputeResidualNorm_Private(400,12922 #undef __FUNCT__465,15757 #define __FUNCT__ 466,15774 PetscErrorCode QEPComputeResidualNorm(491,16537 #undef __FUNCT__510,17177 #define __FUNCT__ 511,17194 PetscErrorCode QEPComputeRelativeError_Private(516,17356 #undef __FUNCT__549,18346 #define __FUNCT__ 550,18363 PetscErrorCode QEPComputeRelativeError(570,18949 #undef __FUNCT__589,19594 #define __FUNCT__ 590,19611 PetscErrorCode QEPSortEigenvalues(615,20318 #undef __FUNCT__670,21870 #define __FUNCT__ 671,21887 PetscErrorCode QEPCompareEigenvalues(700,22747 #undef __FUNCT__712,23205 #define __FUNCT__ 713,23222 PetscErrorCode QEPGetOperationCounters(735,23811 src/qep/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1015 SOURCEH 28,1026 DIRS 29,1037 LIBBASE 30,1048 LOCDIR 31,1068 src/qep/interface/ftn-custom/zqepf.c,2497 zqepf.c:^?zqepf.c^A,1 PETSC_EXTERN void qepmonitorall_(72,3214 PETSC_EXTERN void qepmonitorlg_(77,3460 PETSC_EXTERN void qepmonitorlgall_(82,3704 PETSC_EXTERN void qepmonitorconverged_(87,3954 PETSC_EXTERN void qepmonitorfirst_(92,4212 } _cb;100,4553 #undef __FUNCT__103,4653 static PetscErrorCode ourmonitor(105,4701 #undef __FUNCT__111,5031 static PetscErrorCode ourdestroy(113,5079 PETSC_EXTERN void PETSC_STDCALL qepdestroy_(120,5258 PETSC_EXTERN void PETSC_STDCALL qepview_(125,5365 PETSC_EXTERN void PETSC_STDCALL qepsettype_(132,5552 PETSC_EXTERN void PETSC_STDCALL qepgettype_(141,5767 PETSC_EXTERN void PETSC_STDCALL qepsetoptionsprefix_(150,6046 PETSC_EXTERN void PETSC_STDCALL qepappendoptionsprefix_(159,6285 PETSC_EXTERN void PETSC_STDCALL qepcreate_(168,6530 PETSC_EXTERN void PETSC_STDCALL qepgetoptionsprefix_(173,6672 PETSC_EXTERN void PETSC_STDCALL qepmonitorset_(181,6940 PETSC_EXTERN void PETSC_STDCALL qepgetip_(216,8938 PETSC_EXTERN void PETSC_STDCALL qepgetds_(221,9052 PETSC_EXTERN void PETSC_STDCALL qepgetwhicheigenpairs_(226,9166 PETSC_EXTERN void PETSC_STDCALL qepgetproblemtype_(231,9318 PETSC_EXTERN void PETSC_STDCALL qepgetconvergedreason_(236,9466 src/st/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1008 LOCDIR 26,1044 MANSEC 27,1063 src/st/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,960 src/st/examples/tests/makefile,515 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1014 EXAMPLESF 28,1043 MANSEC 29,1056 TESTS 30,1072 TESTEXAMPLES_C 32,1104 test1:test138,1325 test2:test242,1407 test3:test346,1489 EPS 52,1658 TESTCODE 54,1691 runtest1_1:runtest1_160,1900 runtest1_2:runtest1_268,2148 runtest2_1:runtest2_176,2396 runtest2_2:runtest2_281,2490 runtest2_3:runtest2_386,2604 runtest3_1:runtest3_191,2716 runtest3_2:runtest3_296,2810 runtest3_3:runtest3_3101,2924 src/st/examples/tests/test1.c,621 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__31,1285 #define __FUNCT__ 32,1302 static PetscErrorCode MyShellMatCreate(33,1339 #undef __FUNCT__51,2139 #define __FUNCT__ 52,2156 int main(53,2181 #undef __FUNCT__131,5383 #define __FUNCT__ 132,5400 static PetscErrorCode MatMult_Shell(133,5434 #undef __FUNCT__144,5686 #define __FUNCT__ 145,5703 static PetscErrorCode MatMultTranspose_Shell(146,5746 #undef __FUNCT__157,6016 #define __FUNCT__ 158,6033 static PetscErrorCode MatGetDiagonal_Shell(159,6074 #undef __FUNCT__170,6338 #define __FUNCT__ 171,6355 static PetscErrorCode MatDuplicate_Shell(172,6394 src/st/examples/tests/test2.c,100 test2.c:^?test2.c^A,1 static char help[help22,924 #undef __FUNCT__26,1000 #define __FUNCT__ 27,1017 int main(28,1042 src/st/examples/tests/test3.c,100 test3.c:^?test3.c^A,1 static char help[help22,924 #undef __FUNCT__26,1002 #define __FUNCT__ 27,1019 int main(28,1044 src/st/examples/tutorials/ex10.c,599 ex10.c:^?ex10.c^A,1 static char help[help22,924 } SampleShellST;33,1356 #undef __FUNCT__42,1699 #define __FUNCT__ 43,1716 int main 44,1741 #undef __FUNCT__166,6565 #define __FUNCT__ 167,6582 PetscErrorCode STCreate_User(175,6791 #undef __FUNCT__188,7235 #define __FUNCT__ 189,7252 PetscErrorCode STSetUp_User(207,7879 #undef __FUNCT__219,8293 #define __FUNCT__ 220,8310 PetscErrorCode STApply_User(237,8766 #undef __FUNCT__248,9102 #define __FUNCT__ 249,9119 PetscErrorCode STBackTransform_User(268,9762 #undef __FUNCT__279,10052 #define __FUNCT__ 280,10069 PetscErrorCode STDestroy_User(288,10280 src/st/examples/tutorials/makefile,205 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1018 EXAMPLESF 28,1038 MANSEC 29,1051 TESTEXAMPLES_C 31,1068 ex10:ex1035,1160 runex10_1:runex10_141,1324 src/st/impls/makefile,77 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,1007 MANSEC 27,1032 src/st/impls/cayley/cayley.c,1739 cayley.c:^?cayley.c^A,1 } ST_CAYLEY;30,1112 #undef __FUNCT__32,1126 #define __FUNCT__ 33,1143 PetscErrorCode STApply_Cayley(34,1178 #undef __FUNCT__46,1520 #define __FUNCT__ 47,1537 PetscErrorCode STApplyTranspose_Cayley(48,1581 #undef __FUNCT__60,1957 #define __FUNCT__ 61,1974 static PetscErrorCode MatMult_Cayley(62,2009 #undef __FUNCT__89,2757 #define __FUNCT__ 90,2774 PetscErrorCode STGetBilinearForm_Cayley(91,2819 #undef __FUNCT__102,3065 #define __FUNCT__ 103,3082 PetscErrorCode STBackTransform_Cayley(104,3125 #undef __FUNCT__134,3882 #define __FUNCT__ 135,3899 PetscErrorCode STPostSolve_Cayley(136,3938 #undef __FUNCT__153,4356 #define __FUNCT__ 154,4373 PetscErrorCode STSetUp_Cayley(155,4408 #undef __FUNCT__193,5905 #define __FUNCT__ 194,5922 PetscErrorCode STSetShift_Cayley(195,5960 #undef __FUNCT__225,7138 #define __FUNCT__ 226,7155 PetscErrorCode STSetFromOptions_Cayley(227,7199 #undef __FUNCT__263,8426 #define __FUNCT__ 264,8443 static PetscErrorCode STCayleySetAntishift_Cayley(265,8491 #undef __FUNCT__279,8892 #define __FUNCT__ 280,8909 PetscErrorCode STCayleySetAntishift(303,9534 #undef __FUNCT__313,9852 #define __FUNCT__ 314,9869 static PetscErrorCode STCayleyGetAntishift_Cayley(315,9917 #undef __FUNCT__324,10102 #define __FUNCT__ 325,10119 PetscErrorCode STCayleyGetAntishift(342,10477 #undef __FUNCT__353,10785 #define __FUNCT__ 354,10802 PetscErrorCode STView_Cayley(355,10836 #undef __FUNCT__367,11199 #define __FUNCT__ 368,11216 PetscErrorCode STReset_Cayley(369,11251 #undef __FUNCT__379,11456 #define __FUNCT__ 380,11473 PetscErrorCode STDestroy_Cayley(381,11510 #undef __FUNCT__392,11866 #define __FUNCT__ 393,11883 PETSC_EXTERN PetscErrorCode STCreate_Cayley(394,11919 src/st/impls/cayley/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,978 SOURCEH 28,989 LIBBASE 29,1000 DIRS 30,1020 MANSEC 31,1031 LOCDIR 32,1045 src/st/impls/fold/fold.c,791 fold.c:^?fold.c^A,1 } ST_FOLD;29,1152 #undef __FUNCT__31,1164 #define __FUNCT__ 32,1181 PetscErrorCode STApply_Fold(33,1214 #undef __FUNCT__75,2894 #define __FUNCT__ 76,2911 PetscErrorCode STApplyTranspose_Fold(77,2953 #undef __FUNCT__119,4682 #define __FUNCT__ 120,4699 PetscErrorCode STBackTransform_Fold(121,4740 #undef __FUNCT__148,5387 #define __FUNCT__ 149,5404 PetscErrorCode STSetUp_Fold(150,5437 #undef __FUNCT__170,6102 #define __FUNCT__ 171,6119 PetscErrorCode STSetFromOptions_Fold(172,6161 #undef __FUNCT__198,6988 #define __FUNCT__ 199,7005 PetscErrorCode STReset_Fold(200,7038 #undef __FUNCT__210,7239 #define __FUNCT__ 211,7256 PetscErrorCode STDestroy_Fold(212,7291 #undef __FUNCT__221,7449 #define __FUNCT__ 222,7466 PETSC_EXTERN PetscErrorCode STCreate_Fold(223,7500 src/st/impls/fold/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,976 SOURCEH 28,987 LIBBASE 29,998 DIRS 30,1018 MANSEC 31,1029 LOCDIR 32,1043 src/st/impls/precond/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,979 SOURCEH 28,990 LIBBASE 29,1001 DIRS 30,1021 MANSEC 31,1032 LOCDIR 32,1046 src/st/impls/precond/precond.c,1393 precond.c:^?precond.c^A,1 } ST_PRECOND;28,1095 #undef __FUNCT__30,1110 #define __FUNCT__ 31,1127 PetscErrorCode STSetFromOptions_Precond(32,1172 #undef __FUNCT__60,2036 #define __FUNCT__ 61,2053 PetscErrorCode STSetUp_Precond(62,2089 #undef __FUNCT__146,4997 #define __FUNCT__ 147,5014 PetscErrorCode STSetShift_Precond(148,5053 #undef __FUNCT__162,5422 #define __FUNCT__ 163,5439 static PetscErrorCode STPrecondGetMatForPC_Precond(164,5488 #undef __FUNCT__180,5938 #define __FUNCT__ 181,5955 PetscErrorCode STPrecondGetMatForPC(198,6442 #undef __FUNCT__209,6731 #define __FUNCT__ 210,6748 static PetscErrorCode STPrecondSetMatForPC_Precond(211,6797 #undef __FUNCT__236,7702 #define __FUNCT__ 237,7719 PetscErrorCode STPrecondSetMatForPC(257,8395 #undef __FUNCT__269,8735 #define __FUNCT__ 270,8752 static PetscErrorCode STPrecondSetKSPHasMat_Precond(271,8802 #undef __FUNCT__280,9001 #define __FUNCT__ 281,9018 PetscErrorCode STPrecondSetKSPHasMat(302,9619 #undef __FUNCT__313,9946 #define __FUNCT__ 314,9963 static PetscErrorCode STPrecondGetKSPHasMat_Precond(315,10013 #undef __FUNCT__324,10214 #define __FUNCT__ 325,10231 PetscErrorCode STPrecondGetKSPHasMat(343,10650 #undef __FUNCT__354,10962 #define __FUNCT__ 355,10979 PetscErrorCode STDestroy_Precond(356,11017 #undef __FUNCT__369,11572 #define __FUNCT__ 370,11589 PETSC_EXTERN PetscErrorCode STCreate_Precond(371,11626 src/st/impls/shell/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1044 src/st/impls/shell/shell.c,1454 shell.c:^?shell.c^A,1 } ST_Shell;33,1382 #undef __FUNCT__35,1395 #define __FUNCT__ 36,1412 PetscErrorCode STShellGetContext(55,1808 #undef __FUNCT__69,2179 #define __FUNCT__ 70,2196 PetscErrorCode STShellSetContext(87,2581 #undef __FUNCT__102,2938 #define __FUNCT__ 103,2955 PetscErrorCode STApply_Shell(104,2989 #undef __FUNCT__119,3420 #define __FUNCT__ 120,3437 PetscErrorCode STApplyTranspose_Shell(121,3480 #undef __FUNCT__136,3948 #define __FUNCT__ 137,3965 PetscErrorCode STBackTransform_Shell(138,4007 #undef __FUNCT__154,4428 #define __FUNCT__ 155,4445 PetscErrorCode STDestroy_Shell(156,4481 #undef __FUNCT__168,4936 #define __FUNCT__ 169,4953 static PetscErrorCode STShellSetApply_Shell(170,4995 #undef __FUNCT__179,5201 #define __FUNCT__ 180,5218 static PetscErrorCode STShellSetApplyTranspose_Shell(181,5269 #undef __FUNCT__190,5499 #define __FUNCT__ 191,5516 static PetscErrorCode STShellSetBackTransform_Shell(192,5566 #undef __FUNCT__201,5817 #define __FUNCT__ 202,5834 PetscErrorCode STShellSetApply(226,6442 #undef __FUNCT__236,6748 #define __FUNCT__ 237,6765 PetscErrorCode STShellSetApplyTranspose(261,7403 #undef __FUNCT__271,7737 #define __FUNCT__ 272,7754 PetscErrorCode STShellSetBackTransform(297,8474 #undef __FUNCT__307,8852 #define __FUNCT__ 308,8869 PetscErrorCode STSetFromOptions_Shell(309,8912 #undef __FUNCT__354,10397 #define __FUNCT__ 355,10414 PETSC_EXTERN PetscErrorCode STCreate_Shell(356,10449 src/st/impls/shell/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1016 SOURCEH 28,1027 DIRS 29,1038 LIBBASE 30,1049 LOCDIR 31,1069 src/st/impls/shell/ftn-custom/zshell.c,884 zshell.c:^?zshell.c^A,1 } _cb;41,1643 #undef __FUNCT__44,1743 static PetscErrorCode ourshellapply(46,1794 #undef __FUNCT__52,1963 static PetscErrorCode ourshellapplytranspose(54,2023 #undef __FUNCT__60,2210 static PetscErrorCode ourshellbacktransform(62,2269 PETSC_EXTERN void PETSC_STDCALL stshellgetcontext_(68,2522 PETSC_EXTERN void PETSC_STDCALL stshellsetapply_(73,2656 PETSC_EXTERN void PETSC_STDCALL stshellsetapplytranspose_(79,2994 PETSC_EXTERN void PETSC_STDCALL stshellsetbacktransform_(85,3386 src/st/impls/shift/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1044 src/st/impls/shift/shift.c,779 shift.c:^?shift.c^A,1 #undef __FUNCT__27,1111 #define __FUNCT__ 28,1128 PetscErrorCode STApply_Shift(29,1162 #undef __FUNCT__45,1577 #define __FUNCT__ 46,1594 PetscErrorCode STApplyTranspose_Shift(47,1637 #undef __FUNCT__63,2093 #define __FUNCT__ 64,2110 PetscErrorCode STBackTransform_Shift(65,2152 #undef __FUNCT__76,2363 #define __FUNCT__ 77,2380 PetscErrorCode STPostSolve_Shift(78,2418 #undef __FUNCT__101,3089 #define __FUNCT__ 102,3106 PetscErrorCode STSetUp_Shift(103,3140 #undef __FUNCT__132,4125 #define __FUNCT__ 133,4142 PetscErrorCode STSetShift_Shift(134,4179 #undef __FUNCT__160,5209 #define __FUNCT__ 161,5226 PetscErrorCode STSetFromOptions_Shift(162,5269 #undef __FUNCT__188,6097 #define __FUNCT__ 189,6114 PETSC_EXTERN PetscErrorCode STCreate_Shift(190,6149 src/st/impls/sinvert/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,979 SOURCEH 28,990 LIBBASE 29,1001 DIRS 30,1021 MANSEC 31,1032 LOCDIR 32,1046 src/st/impls/sinvert/sinvert.c,795 sinvert.c:^?sinvert.c^A,1 #undef __FUNCT__26,1062 #define __FUNCT__ 27,1079 PetscErrorCode STApply_Sinvert(28,1115 #undef __FUNCT__44,1534 #define __FUNCT__ 45,1551 PetscErrorCode STApplyTranspose_Sinvert(46,1596 #undef __FUNCT__62,2053 #define __FUNCT__ 63,2070 PetscErrorCode STBackTransform_Sinvert(64,2114 #undef __FUNCT__89,2669 #define __FUNCT__ 90,2686 PetscErrorCode STPostSolve_Sinvert(91,2726 #undef __FUNCT__114,3400 #define __FUNCT__ 115,3417 PetscErrorCode STSetUp_Sinvert(116,3453 #undef __FUNCT__148,4519 #define __FUNCT__ 149,4536 PetscErrorCode STSetShift_Sinvert(150,4575 #undef __FUNCT__176,5618 #define __FUNCT__ 177,5635 PetscErrorCode STSetFromOptions_Sinvert(178,5680 #undef __FUNCT__204,6510 #define __FUNCT__ 205,6527 PETSC_EXTERN PetscErrorCode STCreate_Sinvert(206,6564 src/st/interface/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1026 SOURCEH 28,1037 LIBBASE 29,1048 DIRS 30,1068 MANSEC 31,1079 LOCDIR 32,1093 src/st/interface/shellmat.c,624 shellmat.c:^?shellmat.c^A,1 } ST_SHELLMAT;34,1284 #undef __FUNCT__36,1300 #define __FUNCT__ 37,1317 PetscErrorCode STMatShellShift(38,1353 #undef __FUNCT__49,1590 #define __FUNCT__ 50,1607 static PetscErrorCode MatMult_Shell(51,1641 #undef __FUNCT__77,2391 #define __FUNCT__ 78,2408 static PetscErrorCode MatMultTranspose_Shell(79,2451 #undef __FUNCT__105,3250 #define __FUNCT__ 106,3267 static PetscErrorCode MatGetDiagonal_Shell(107,3308 #undef __FUNCT__136,4173 #define __FUNCT__ 137,4190 static PetscErrorCode MatDestroy_Shell(138,4227 #undef __FUNCT__151,4562 #define __FUNCT__ 152,4579 PetscErrorCode STMatShellCreate(153,4616 src/st/interface/stfunc.c,1831 stfunc.c:^?stfunc.c^A,1 PetscClassId ST_CLASSID 26,1067 PetscLogEvent ST_SetUp 27,1100 static PetscBool STPackageInitialized 28,1166 #undef __FUNCT__30,1220 #define __FUNCT__ 31,1237 PetscErrorCode STFinalizePackage(40,1469 #undef __FUNCT__51,1719 #define __FUNCT__ 52,1736 PetscErrorCode STInitializePackage(62,2060 #undef __FUNCT__100,3456 #define __FUNCT__ 101,3473 PetscErrorCode STReset(114,3708 #undef __FUNCT__131,4243 #define __FUNCT__ 132,4260 PetscErrorCode STDestroy(145,4507 #undef __FUNCT__163,5163 #define __FUNCT__ 164,5180 PetscErrorCode STCreate(180,5501 #undef __FUNCT__215,6377 #define __FUNCT__ 216,6394 PetscErrorCode STSetOperators(235,6925 #undef __FUNCT__267,8111 #define __FUNCT__ 268,8128 PetscErrorCode STGetOperators(285,8573 #undef __FUNCT__296,9037 #define __FUNCT__ 297,9054 PetscErrorCode STGetNumMatrices(313,9386 #undef __FUNCT__322,9578 #define __FUNCT__ 323,9595 PetscErrorCode STSetShift(340,10007 #undef __FUNCT__357,10406 #define __FUNCT__ 358,10423 PetscErrorCode STGetShift(373,10699 #undef __FUNCT__382,10907 #define __FUNCT__ 383,10924 PetscErrorCode STSetDefaultShift(397,11249 #undef __FUNCT__406,11499 #define __FUNCT__ 407,11516 PetscErrorCode STSetBalanceMatrix(427,12083 #undef __FUNCT__442,12469 #define __FUNCT__ 443,12486 PetscErrorCode STGetBalanceMatrix(462,12962 #undef __FUNCT__471,13148 #define __FUNCT__ 472,13165 PetscErrorCode STSetOptionsPrefix(492,13716 #undef __FUNCT__505,14160 #define __FUNCT__ 506,14177 PetscErrorCode STAppendOptionsPrefix(526,14737 #undef __FUNCT__539,15206 #define __FUNCT__ 540,15223 PetscErrorCode STGetOptionsPrefix(560,15731 #undef __FUNCT__571,16022 #define __FUNCT__ 572,16039 PetscErrorCode STView(597,16737 #undef __FUNCT__657,19396 #define __FUNCT__ 658,19413 PetscErrorCode STRegister(686,20051 src/st/interface/stregis.c,90 stregis.c:^?stregis.c^A,1 #undef __FUNCT__31,1285 #define __FUNCT__ 32,1302 PetscErrorCode STRegisterAll(42,1492 src/st/interface/stset.c,731 stset.c:^?stset.c^A,1 PetscBool STRegisterAllCalled 26,1029 PetscFunctionList STList 27,1082 #undef __FUNCT__29,1113 #define __FUNCT__ 30,1130 PetscErrorCode STSetType(58,1875 #undef __FUNCT__82,2681 #define __FUNCT__ 83,2698 PetscErrorCode STGetType(100,3009 #undef __FUNCT__109,3221 #define __FUNCT__ 110,3238 PetscErrorCode STSetFromOptions(123,3569 #undef __FUNCT__175,5676 #define __FUNCT__ 176,5693 PetscErrorCode STSetMatStructure(206,6799 #undef __FUNCT__223,7273 #define __FUNCT__ 224,7290 PetscErrorCode STGetMatStructure(246,7909 #undef __FUNCT__255,8111 #define __FUNCT__ 256,8128 PetscErrorCode STSetMatMode(296,9787 #undef __FUNCT__306,10031 #define __FUNCT__ 307,10048 PetscErrorCode STGetMatMode(324,10422 src/st/interface/stsles.c,1059 stsles.c:^?stsles.c^A,1 #undef __FUNCT__28,1117 #define __FUNCT__ 29,1134 PetscErrorCode STMatMult(48,1546 #undef __FUNCT__66,2143 #define __FUNCT__ 67,2160 PetscErrorCode STMatMultTranspose(86,2582 #undef __FUNCT__104,3197 #define __FUNCT__ 105,3214 PetscErrorCode STMatSolve(124,3641 #undef __FUNCT__158,5147 #define __FUNCT__ 159,5164 PetscErrorCode STMatSolveTranspose(177,5570 #undef __FUNCT__211,7094 #define __FUNCT__ 212,7111 PetscErrorCode STMatSetHermitian(220,7301 #undef __FUNCT__243,7956 #define __FUNCT__ 244,7973 PetscErrorCode STSetKSP(258,8238 #undef __FUNCT__273,8662 #define __FUNCT__ 274,8679 PetscErrorCode STGetKSP(295,9149 #undef __FUNCT__314,9869 #define __FUNCT__ 315,9886 PetscErrorCode STGetOperationCounters(336,10393 #undef __FUNCT__345,10637 #define __FUNCT__ 346,10654 PetscErrorCode STResetOperationCounters(361,11032 #undef __FUNCT__370,11223 #define __FUNCT__ 371,11240 PetscErrorCode STCheckNullSpace_Default(372,11285 #undef __FUNCT__408,12411 #define __FUNCT__ 409,12428 PetscErrorCode STCheckNullSpace(430,13057 src/st/interface/stsolve.c,862 stsolve.c:^?stsolve.c^A,1 #undef __FUNCT__26,1067 #define __FUNCT__ 27,1084 PetscErrorCode STApply(46,1514 #undef __FUNCT__72,2461 #define __FUNCT__ 73,2478 PetscErrorCode STGetBilinearForm(92,2949 #undef __FUNCT__104,3313 #define __FUNCT__ 105,3330 PetscErrorCode STGetBilinearForm_Default(106,3376 #undef __FUNCT__119,3634 #define __FUNCT__ 120,3651 PetscErrorCode STApplyTranspose(139,4084 #undef __FUNCT__165,5078 #define __FUNCT__ 166,5095 PetscErrorCode STComputeExplicitOperator(191,5822 #undef __FUNCT__244,7886 #define __FUNCT__ 245,7903 PetscErrorCode STSetUp(258,8155 #undef __FUNCT__296,9622 #define __FUNCT__ 297,9639 PetscErrorCode STMatGAXPY_Private(308,10181 #undef __FUNCT__384,12633 #define __FUNCT__ 385,12650 PetscErrorCode STPostSolve(399,12969 #undef __FUNCT__411,13209 #define __FUNCT__ 412,13226 PetscErrorCode STBackTransform(427,13658 src/st/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1014 SOURCEH 28,1025 DIRS 29,1036 LIBBASE 30,1047 LOCDIR 31,1067 src/st/interface/ftn-custom/zstf.c,1061 zstf.c:^?zstf.c^A,1 PETSC_EXTERN void PETSC_STDCALL stsettype_(47,1926 PETSC_EXTERN void PETSC_STDCALL stgettype_(56,2136 PETSC_EXTERN void PETSC_STDCALL stcreate_(65,2410 PETSC_EXTERN void PETSC_STDCALL stdestroy_(70,2553 PETSC_EXTERN void PETSC_STDCALL stsetoptionsprefix_(75,2655 PETSC_EXTERN void PETSC_STDCALL stappendoptionsprefix_(84,2889 PETSC_EXTERN void PETSC_STDCALL stgetoptionsprefix_(93,3129 PETSC_EXTERN void PETSC_STDCALL stview_(101,3392 PETSC_EXTERN void PETSC_STDCALL stgetmatmode_(108,3574 src/svd/makefile,78 makefile:^?makefile^A,1 ALL:ALL22,926 SOURCEH 24,936 DIRS 25,1010 LOCDIR 26,1046 MANSEC 27,1066 src/svd/examples/makefile,44 makefile:^?makefile^A,1 ALL:ALL22,926 LOCDIR 24,932 DIRS 25,961 src/svd/examples/tests/makefile,401 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1015 EXAMPLESF 28,1052 MANSEC 29,1065 TESTS 30,1082 TESTEXAMPLES_C 32,1114 TESTEXAMPLES_C_NOF128=34,1226 test1:test138,1322 test2:test242,1404 test3:test346,1486 SVD 51,1654 SVDEPS 52,1685 EPS 53,1707 runtest1_1:runtest1_155,1748 runtest2_1:runtest2_169,2202 runtest3_1:runtest3_180,2632 src/svd/examples/tests/test1.c,100 test1.c:^?test1.c^A,1 static char help[help22,924 #undef __FUNCT__45,1703 #define __FUNCT__ 46,1720 int main(47,1745 src/svd/examples/tests/test2.c,100 test2.c:^?test2.c^A,1 static char help[help22,924 #undef __FUNCT__27,1091 #define __FUNCT__ 28,1108 int main(29,1133 src/svd/examples/tests/test3.c,100 test3.c:^?test3.c^A,1 static char help[help22,924 #undef __FUNCT__42,1546 #define __FUNCT__ 43,1563 int main(44,1588 src/svd/examples/tutorials/ex14.c,100 ex14.c:^?ex14.c^A,1 static char help[help22,924 #undef __FUNCT__29,1221 #define __FUNCT__ 30,1238 int main(31,1263 src/svd/examples/tutorials/ex15.c,100 ex15.c:^?ex15.c^A,1 static char help[help22,924 #undef __FUNCT__29,1160 #define __FUNCT__ 30,1177 int main(31,1202 src/svd/examples/tutorials/ex8.c,100 ex8.c:^?ex8.c^A,1 static char help[help22,924 #undef __FUNCT__45,1739 #define __FUNCT__ 46,1756 int main(47,1781 src/svd/examples/tutorials/makefile,431 makefile:^?makefile^A,1 CFLAGS 22,926 FFLAGS 23,939 CPPFLAGS 24,952 FPPFLAGS 25,965 LOCDIR 26,978 EXAMPLESC 27,1019 EXAMPLESF 28,1052 MANSEC 29,1073 TESTEXAMPLES_C 31,1091 TESTEXAMPLES_C_NOCOMPLEX 32,1144 TESTEXAMPLES_FORTRAN 33,1200 ex8:ex837,1268 ex14:ex1441,1340 ex15:ex1545,1417 ex15f:ex15f49,1494 DATAPATH 54,1662 runex8_1:runex8_156,1718 runex14_1:runex14_162,1919 runex15_1:runex15_168,2182 runex15f_1:runex15f_174,2390 src/svd/examples/tutorials/ex15f.F,0 ex15f.F:^?ex15f.F^A,1 src/svd/impls/makefile,77 makefile:^?makefile^A,1 ALL:ALL22,926 LIBBASE 24,936 DIRS 25,956 LOCDIR 26,1005 MANSEC 27,1031 src/svd/impls/cross/cross.c,1422 cross.c:^?cross.c^A,1 } SVD_CROSS;37,1291 #undef __FUNCT__39,1305 #define __FUNCT__ 40,1322 static PetscErrorCode MatMult_Cross(41,1356 #undef __FUNCT__55,1752 #define __FUNCT__ 56,1769 static PetscErrorCode MatGetDiagonal_Cross(57,1810 #undef __FUNCT__108,3847 #define __FUNCT__ 109,3864 PetscErrorCode SVDSetUp_Cross(110,3899 #undef __FUNCT__156,6025 #define __FUNCT__ 157,6042 PetscErrorCode SVDSolve_Cross(158,6077 #undef __FUNCT__178,6848 #define __FUNCT__ 179,6865 static PetscErrorCode SVDMonitor_Cross(180,6902 #undef __FUNCT__198,7515 #define __FUNCT__ 199,7532 PetscErrorCode SVDSetFromOptions_Cross(200,7576 #undef __FUNCT__209,7766 #define __FUNCT__ 210,7783 static PetscErrorCode SVDCrossSetEPS_Cross(211,7824 #undef __FUNCT__225,8226 #define __FUNCT__ 226,8243 PetscErrorCode SVDCrossSetEPS(241,8532 #undef __FUNCT__253,8868 #define __FUNCT__ 254,8885 static PetscErrorCode SVDCrossGetEPS_Cross(255,8926 #undef __FUNCT__279,9966 #define __FUNCT__ 280,9983 PetscErrorCode SVDCrossGetEPS(297,10301 #undef __FUNCT__308,10585 #define __FUNCT__ 309,10602 PetscErrorCode SVDView_Cross(310,10636 #undef __FUNCT__323,11058 #define __FUNCT__ 324,11075 PetscErrorCode SVDReset_Cross(325,11110 #undef __FUNCT__338,11483 #define __FUNCT__ 339,11500 PetscErrorCode SVDDestroy_Cross(340,11537 #undef __FUNCT__353,11983 #define __FUNCT__ 354,12000 PETSC_EXTERN PetscErrorCode SVDCreate_Cross(355,12036 src/svd/impls/cross/makefile,156 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,977 SOURCEH 28,988 LIBBASE 29,999 DIRS 30,1019 MANSEC 31,1030 LOCDIR 32,1045 src/svd/impls/cyclic/cyclic.c,1917 cyclic.c:^?cyclic.c^A,1 } SVD_CYCLIC;38,1343 #undef __FUNCT__40,1358 #define __FUNCT__ 41,1375 static PetscErrorCode MatMult_Cyclic(42,1410 #undef __FUNCT__72,2574 #define __FUNCT__ 73,2591 static PetscErrorCode MatGetDiagonal_Cyclic(74,2633 #undef __FUNCT__83,2811 #define __FUNCT__ 84,2828 PetscErrorCode SVDSetUp_Cyclic(85,2864 #undef __FUNCT__197,8672 #define __FUNCT__ 198,8689 PetscErrorCode SVDSolve_Cyclic(199,8725 #undef __FUNCT__244,10530 #define __FUNCT__ 245,10547 static PetscErrorCode SVDMonitor_Cyclic(246,10585 #undef __FUNCT__270,11312 #define __FUNCT__ 271,11329 PetscErrorCode SVDSetFromOptions_Cyclic(272,11374 #undef __FUNCT__296,12281 #define __FUNCT__ 297,12298 static PetscErrorCode SVDCyclicSetExplicitMatrix_Cyclic(298,12352 #undef __FUNCT__307,12586 #define __FUNCT__ 308,12603 PetscErrorCode SVDCyclicSetExplicitMatrix(326,13094 #undef __FUNCT__337,13463 #define __FUNCT__ 338,13480 static PetscErrorCode SVDCyclicGetExplicitMatrix_Cyclic(339,13534 #undef __FUNCT__348,13770 #define __FUNCT__ 349,13787 PetscErrorCode SVDCyclicGetExplicitMatrix(365,14112 #undef __FUNCT__376,14465 #define __FUNCT__ 377,14482 static PetscErrorCode SVDCyclicSetEPS_Cyclic(378,14525 #undef __FUNCT__392,14936 #define __FUNCT__ 393,14953 PetscErrorCode SVDCyclicSetEPS(408,15245 #undef __FUNCT__420,15583 #define __FUNCT__ 421,15600 static PetscErrorCode SVDCyclicGetEPS_Cyclic(422,15643 #undef __FUNCT__443,16566 #define __FUNCT__ 444,16583 PetscErrorCode SVDCyclicGetEPS(461,16904 #undef __FUNCT__472,17190 #define __FUNCT__ 473,17207 PetscErrorCode SVDView_Cyclic(474,17242 #undef __FUNCT__488,17795 #define __FUNCT__ 489,17812 PetscErrorCode SVDReset_Cyclic(490,17848 #undef __FUNCT__505,18325 #define __FUNCT__ 506,18342 PetscErrorCode SVDDestroy_Cyclic(507,18380 #undef __FUNCT__522,19042 #define __FUNCT__ 523,19059 PETSC_EXTERN PetscErrorCode SVDCreate_Cyclic(524,19096 src/svd/impls/cyclic/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,978 SOURCEH 28,989 LIBBASE 29,1000 DIRS 30,1020 MANSEC 31,1031 LOCDIR 32,1046 src/svd/impls/lanczos/gklanczos.c,1368 gklanczos.c:^?gklanczos.c^A,1 } SVD_LANCZOS;50,1696 #undef __FUNCT__52,1712 #define __FUNCT__ 53,1729 PetscErrorCode SVDSetUp_Lanczos(54,1766 #undef __FUNCT__87,3109 #define __FUNCT__ 88,3126 PetscErrorCode SVDTwoSideLanczos(89,3164 #undef __FUNCT__112,4192 #define __FUNCT__ 113,4209 static PetscErrorCode SVDOneSideLanczos(114,4247 #undef __FUNCT__161,5876 #define __FUNCT__ 162,5893 PetscErrorCode SVDSolve_Lanczos(163,5930 #undef __FUNCT__264,9596 #define __FUNCT__ 265,9613 PetscErrorCode SVDSetFromOptions_Lanczos(266,9659 #undef __FUNCT__282,10199 #define __FUNCT__ 283,10216 static PetscErrorCode SVDLanczosSetOneSide_Lanczos(284,10265 #undef __FUNCT__296,10546 #define __FUNCT__ 297,10563 PetscErrorCode SVDLanczosSetOneSide(321,11316 #undef __FUNCT__332,11652 #define __FUNCT__ 333,11669 PetscErrorCode SVDLanczosGetOneSide(350,12051 #undef __FUNCT__361,12371 #define __FUNCT__ 362,12388 static PetscErrorCode SVDLanczosGetOneSide_Lanczos(363,12437 #undef __FUNCT__372,12651 #define __FUNCT__ 373,12668 PetscErrorCode SVDReset_Lanczos(374,12705 #undef __FUNCT__383,12878 #define __FUNCT__ 384,12895 PetscErrorCode SVDDestroy_Lanczos(385,12934 #undef __FUNCT__396,13297 #define __FUNCT__ 397,13314 PetscErrorCode SVDView_Lanczos(398,13350 #undef __FUNCT__408,13669 #define __FUNCT__ 409,13686 PETSC_EXTERN PetscErrorCode SVDCreate_Lanczos(410,13724 src/svd/impls/lanczos/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,981 SOURCEH 28,992 LIBBASE 29,1003 DIRS 30,1023 MANSEC 31,1034 LOCDIR 32,1049 src/svd/impls/lapack/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,981 SOURCEH 28,992 LIBBASE 29,1003 DIRS 30,1023 MANSEC 31,1034 LOCDIR 32,1049 src/svd/impls/lapack/svdlapack.c,485 svdlapack.c:^?svdlapack.c^A,1 #undef __FUNCT__27,1081 #define __FUNCT__ 28,1098 PetscErrorCode SVDSetUp_LAPACK(29,1134 #undef __FUNCT__48,1724 #define __FUNCT__ 49,1741 PetscErrorCode SVDSolve_LAPACK(50,1777 #undef __FUNCT__106,3779 #define __FUNCT__ 107,3796 PetscErrorCode SVDReset_LAPACK(108,3832 #undef __FUNCT__117,4004 #define __FUNCT__ 118,4021 PetscErrorCode SVDDestroy_LAPACK(119,4059 #undef __FUNCT__128,4223 #define __FUNCT__ 129,4240 PETSC_EXTERN PetscErrorCode SVDCreate_LAPACK(130,4277 src/svd/impls/trlanczos/makefile,157 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,981 SOURCEH 28,992 LIBBASE 29,1003 DIRS 30,1023 MANSEC 31,1034 LOCDIR 32,1049 src/svd/impls/trlanczos/trlanczos.c,1416 trlanczos.c:^?trlanczos.c^A,1 } SVD_TRLANCZOS;50,1688 #undef __FUNCT__52,1706 #define __FUNCT__ 53,1723 PetscErrorCode SVDSetUp_TRLanczos(54,1762 #undef __FUNCT__85,2974 #define __FUNCT__ 86,2991 static PetscErrorCode SVDOneSideTRLanczosMGS(87,3034 #undef __FUNCT__120,4260 #define __FUNCT__ 121,4277 static PetscErrorCode SVDOneSideTRLanczosCGS(122,4320 #undef __FUNCT__231,8094 #define __FUNCT__ 232,8111 PetscErrorCode SVDSolve_TRLanczos(233,8150 #undef __FUNCT__345,12371 #define __FUNCT__ 346,12388 PetscErrorCode SVDSetFromOptions_TRLanczos(347,12436 #undef __FUNCT__363,12988 #define __FUNCT__ 364,13005 static PetscErrorCode SVDTRLanczosSetOneSide_TRLanczos(365,13058 #undef __FUNCT__374,13278 #define __FUNCT__ 375,13295 PetscErrorCode SVDTRLanczosSetOneSide(398,13989 #undef __FUNCT__409,14329 #define __FUNCT__ 410,14346 PetscErrorCode SVDTRLanczosGetOneSide(427,14734 #undef __FUNCT__438,15058 #define __FUNCT__ 439,15075 static PetscErrorCode SVDTRLanczosGetOneSide_TRLanczos(440,15128 #undef __FUNCT__449,15353 #define __FUNCT__ 450,15370 PetscErrorCode SVDReset_TRLanczos(451,15409 #undef __FUNCT__460,15584 #define __FUNCT__ 461,15601 PetscErrorCode SVDDestroy_TRLanczos(462,15642 #undef __FUNCT__473,16011 #define __FUNCT__ 474,16028 PetscErrorCode SVDView_TRLanczos(475,16066 #undef __FUNCT__485,16391 #define __FUNCT__ 486,16408 PETSC_EXTERN PetscErrorCode SVDCreate_TRLanczos(487,16448 src/svd/interface/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1041 SOURCEH 28,1052 LIBBASE 29,1063 DIRS 30,1083 MANSEC 31,1094 LOCDIR 32,1109 src/svd/interface/svdbasic.c,1503 svdbasic.c:^?svdbasic.c^A,1 PetscFunctionList SVDList 26,1045 PetscBool SVDRegisterAllCalled 27,1076 PetscClassId SVD_CLASSID 28,1130 PetscLogEvent SVD_SetUp 29,1165 static PetscBool SVDPackageInitialized 30,1212 #undef __FUNCT__32,1268 #define __FUNCT__ 33,1285 PetscErrorCode SVDFinalizePackage(42,1520 #undef __FUNCT__53,1774 #define __FUNCT__ 54,1791 PetscErrorCode SVDInitializePackage(64,2119 #undef __FUNCT__101,3438 #define __FUNCT__ 102,3455 PetscErrorCode SVDView(130,4254 #undef __FUNCT__192,7207 #define __FUNCT__ 193,7224 PetscErrorCode SVDPrintSolution(214,7753 #undef __FUNCT__272,10469 #define __FUNCT__ 273,10486 PetscErrorCode SVDCreate(292,10830 #undef __FUNCT__347,12497 #define __FUNCT__ 348,12514 PetscErrorCode SVDReset(362,12805 #undef __FUNCT__389,13753 #define __FUNCT__ 390,13770 PetscErrorCode SVDDestroy(403,14027 #undef __FUNCT__424,14891 #define __FUNCT__ 425,14908 PetscErrorCode SVDSetType(455,15857 #undef __FUNCT__479,16671 #define __FUNCT__ 480,16688 PetscErrorCode SVDGetType(496,16977 #undef __FUNCT__505,17196 #define __FUNCT__ 506,17213 PetscErrorCode SVDRegister(533,17833 #undef __FUNCT__542,18056 #define __FUNCT__ 543,18073 PetscErrorCode SVDSetIP(562,18504 #undef __FUNCT__577,18926 #define __FUNCT__ 578,18943 PetscErrorCode SVDGetIP(595,19278 #undef __FUNCT__610,19647 #define __FUNCT__ 611,19664 PetscErrorCode SVDSetDS(629,20091 #undef __FUNCT__644,20513 #define __FUNCT__ 645,20530 PetscErrorCode SVDGetDS(662,20865 src/svd/interface/svdmat.c,362 svdmat.c:^?svdmat.c^A,1 #undef __FUNCT__26,1039 #define __FUNCT__ 27,1056 PetscErrorCode SVDMatMult(28,1087 #undef __FUNCT__58,1783 #define __FUNCT__ 59,1800 PetscErrorCode SVDMatGetVecs(60,1834 #undef __FUNCT__73,2093 #define __FUNCT__ 74,2110 PetscErrorCode SVDMatGetSize(75,2144 #undef __FUNCT__88,2413 #define __FUNCT__ 89,2430 PetscErrorCode SVDMatGetLocalSize(90,2469 src/svd/interface/svdmon.c,853 svdmon.c:^?svdmon.c^A,1 #undef __FUNCT__27,1047 #define __FUNCT__ 28,1064 PetscErrorCode SVDMonitor(32,1153 #undef __FUNCT__44,1511 #define __FUNCT__ 45,1528 PetscErrorCode SVDMonitorSet(91,3451 #undef __FUNCT__102,4051 #define __FUNCT__ 103,4068 PetscErrorCode SVDMonitorCancel(121,4542 #undef __FUNCT__137,4919 #define __FUNCT__ 138,4936 PetscErrorCode SVDGetMonitorContext(155,5298 #undef __FUNCT__163,5487 #define __FUNCT__ 164,5504 PetscErrorCode SVDMonitorAll(184,6103 #undef __FUNCT__203,6932 #define __FUNCT__ 204,6949 PetscErrorCode SVDMonitorFirst(224,7560 #undef __FUNCT__239,8314 #define __FUNCT__ 240,8331 PetscErrorCode SVDMonitorConverged(263,8995 #undef __FUNCT__287,10044 #define __FUNCT__ 288,10061 PetscErrorCode SVDMonitorLG(289,10094 #undef __FUNCT__332,11850 #define __FUNCT__ 333,11867 PetscErrorCode SVDMonitorLGAll(334,11903 src/svd/interface/svdopts.c,1397 svdopts.c:^?svdopts.c^A,1 #undef __FUNCT__26,1033 #define __FUNCT__ 27,1050 PetscErrorCode SVDSetTransposeMode(61,2260 #undef __FUNCT__81,2887 #define __FUNCT__ 82,2904 PetscErrorCode SVDGetTransposeMode(101,3416 #undef __FUNCT__110,3638 #define __FUNCT__ 111,3655 PetscErrorCode SVDSetTolerances(135,4352 #undef __FUNCT__161,5169 #define __FUNCT__ 162,5186 PetscErrorCode SVDGetTolerances(183,5660 #undef __FUNCT__192,5904 #define __FUNCT__ 193,5921 PetscErrorCode SVDSetDimensions(230,7303 #undef __FUNCT__261,8311 #define __FUNCT__ 262,8328 PetscErrorCode SVDGetDimensions(284,8893 #undef __FUNCT__294,9160 #define __FUNCT__ 295,9177 PetscErrorCode SVDSetWhichSingularTriplets(322,9893 #undef __FUNCT__341,10400 #define __FUNCT__ 342,10417 PetscErrorCode SVDGetWhichSingularTriplets(362,10901 #undef __FUNCT__371,11122 #define __FUNCT__ 372,11139 PetscErrorCode SVDSetFromOptions(390,11549 #undef __FUNCT__486,16842 #define __FUNCT__ 487,16859 PetscErrorCode SVDSetTrackAll(511,17643 #undef __FUNCT__520,17880 #define __FUNCT__ 521,17897 PetscErrorCode SVDGetTrackAll(538,18232 #undef __FUNCT__548,18454 #define __FUNCT__ 549,18471 PetscErrorCode SVDSetOptionsPrefix(576,19222 #undef __FUNCT__603,20234 #define __FUNCT__ 604,20251 PetscErrorCode SVDAppendOptionsPrefix(623,20810 #undef __FUNCT__650,21846 #define __FUNCT__ 651,21863 PetscErrorCode SVDGetOptionsPrefix(671,22374 src/svd/interface/svdregis.c,91 svdregis.c:^?svdregis.c^A,1 #undef __FUNCT__30,1246 #define __FUNCT__ 31,1263 PetscErrorCode SVDRegisterAll(41,1453 src/svd/interface/svdsetup.c,469 svdsetup.c:^?svdsetup.c^A,1 #undef __FUNCT__27,1066 #define __FUNCT__ 28,1083 PetscErrorCode SVDSetOperator(42,1422 #undef __FUNCT__57,1864 #define __FUNCT__ 58,1881 PetscErrorCode SVDGetOperator(74,2291 #undef __FUNCT__83,2479 #define __FUNCT__ 84,2496 PetscErrorCode SVDSetUp(103,2999 #undef __FUNCT__232,7965 #define __FUNCT__ 233,7982 PetscErrorCode SVDSetInitialSpace(261,8949 #undef __FUNCT__274,9401 #define __FUNCT__ 275,9418 PetscErrorCode SVDSetInitialSpaceLeft(303,10389 src/svd/interface/svdsolve.c,798 svdsolve.c:^?svdsolve.c^A,1 #undef __FUNCT__26,1036 #define __FUNCT__ 27,1053 PetscErrorCode SVDSolve(44,1469 #undef __FUNCT__102,3580 #define __FUNCT__ 103,3597 PetscErrorCode SVDGetIterationNumber(127,4323 #undef __FUNCT__136,4533 #define __FUNCT__ 137,4550 PetscErrorCode SVDGetConvergedReason(162,5255 #undef __FUNCT__171,5487 #define __FUNCT__ 172,5504 PetscErrorCode SVDGetConverged(190,5863 #undef __FUNCT__199,6075 #define __FUNCT__ 200,6092 PetscErrorCode SVDGetSingularTriplet(225,6848 #undef __FUNCT__259,8287 #define __FUNCT__ 260,8304 PetscErrorCode SVDComputeResidualNorms(284,9065 #undef __FUNCT__332,10732 #define __FUNCT__ 333,10749 PetscErrorCode SVDComputeRelativeError(354,11404 #undef __FUNCT__370,11940 #define __FUNCT__ 371,11957 PetscErrorCode SVDGetOperationCounters(391,12449 src/svd/interface/ftn-custom/makefile,143 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,985 SOURCEC 26,996 SOURCEF 27,1015 SOURCEH 28,1026 DIRS 29,1037 LIBBASE 30,1048 LOCDIR 31,1068 src/svd/interface/ftn-custom/zsvdf.c,2489 zsvdf.c:^?zsvdf.c^A,1 PETSC_EXTERN void svdmonitorall_(71,3205 PETSC_EXTERN void svdmonitorlg_(76,3428 PETSC_EXTERN void svdmonitorlgall_(81,3649 PETSC_EXTERN void svdmonitorconverged_(86,3876 PETSC_EXTERN void svdmonitorfirst_(91,4111 } _cb;99,4429 #undef __FUNCT__102,4529 static PetscErrorCode ourmonitor(104,4577 #undef __FUNCT__110,4877 static PetscErrorCode ourdestroy(112,4925 PETSC_EXTERN void PETSC_STDCALL svddestroy_(119,5104 PETSC_EXTERN void PETSC_STDCALL svdview_(124,5211 PETSC_EXTERN void PETSC_STDCALL svdcreate_(131,5398 PETSC_EXTERN void PETSC_STDCALL svdsettype_(136,5540 PETSC_EXTERN void PETSC_STDCALL svdgettype_(145,5755 PETSC_EXTERN void PETSC_STDCALL svdgetip_(154,6034 PETSC_EXTERN void PETSC_STDCALL svdgetds_(159,6148 PETSC_EXTERN void PETSC_STDCALL svdmonitorset_(164,6262 PETSC_EXTERN void PETSC_STDCALL svdgettransposemode_(199,8245 PETSC_EXTERN void PETSC_STDCALL svdgetwhichsingulartriplets_(204,8399 PETSC_EXTERN void PETSC_STDCALL svdsetoptionsprefix_(209,8563 PETSC_EXTERN void PETSC_STDCALL svdappendoptionsprefix_(218,8802 PETSC_EXTERN void PETSC_STDCALL svdgetoptionsprefix_(227,9047 PETSC_EXTERN void PETSC_STDCALL svdgetconvergedreason_(235,9315 src/sys/makefile,158 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,993 SOURCEH 28,1004 LIBBASE 29,1015 MANSEC 30,1035 LOCDIR 31,1050 DIRS 32,1070 src/sys/slepcinit.c,1240 slepcinit.c:^?slepcinit.c^A,1 #undef __FUNCT__35,1364 #define __FUNCT__ 36,1381 PetscErrorCode SlepcGetVersion(51,1688 #undef __FUNCT__64,2182 #define __FUNCT__ 65,2199 PetscErrorCode SlepcPrintVersion(71,2320 #undef __FUNCT__86,2970 #define __FUNCT__ 87,2987 PetscErrorCode SlepcPrintHelpIntro(93,3122 PetscBool SlepcBeganPetsc 109,3817 PetscBool SlepcInitializeCalled 110,3858 #undef __FUNCT__114,3948 #define __FUNCT__ 115,3965 PetscErrorCode SlepcInitialize_DynamicLibraries(120,4127 #undef __FUNCT__137,4798 #define __FUNCT__ 138,4815 PetscErrorCode SlepcInitialize_LogEvents(142,4957 #undef __FUNCT__156,5619 #define __FUNCT__ 157,5636 PetscErrorCode SlepcInitialize(179,6394 #undef __FUNCT__208,7272 #define __FUNCT__ 209,7289 PetscErrorCode SlepcFinalize(220,7552 #undef __FUNCT__233,7838 #define __FUNCT__ 234,7855 PetscErrorCode SlepcInitializeNoArguments(245,8107 #undef __FUNCT__256,8340 #define __FUNCT__ 257,8357 PetscErrorCode SlepcInitialized(265,8539 PETSC_EXTERN PetscBool PetscBeganMPI;273,8730 #undef __FUNCT__275,8769 #define __FUNCT__ 276,8786 PetscErrorCode SlepcInitializeNoPointers(287,9050 #undef __FUNCT__302,9489 #define __FUNCT__ 303,9506 PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepc(314,9780 src/sys/slepcutil.c,2030 slepcutil.c:^?slepcutil.c^A,1 #undef __FUNCT__25,1029 #define __FUNCT__ 26,1046 PetscErrorCode SlepcMatConvertSeqDense(39,1360 #undef __FUNCT__77,2751 #define __FUNCT__ 78,2768 static PetscErrorCode SlepcMatTile_SeqAIJ(79,2808 #undef __FUNCT__187,6390 #define __FUNCT__ 188,6407 static PetscErrorCode SlepcMatTile_MPIAIJ(189,6447 #undef __FUNCT__333,12083 #define __FUNCT__ 334,12100 PetscErrorCode SlepcMatTile(362,12885 #undef __FUNCT__424,15758 #define __FUNCT__ 425,15775 PetscErrorCode SlepcCheckOrthogonality(455,16744 #undef __FUNCT__511,18502 #define __FUNCT__ 512,18519 PetscErrorCode SlepcConvMonitorDestroy(517,18677 #undef __FUNCT__528,18953 #define __FUNCT__ 529,18970 PetscErrorCode SlepcCompareLargestMagnitude(530,19019 #undef __FUNCT__543,19362 #define __FUNCT__ 544,19379 PetscErrorCode SlepcCompareSmallestMagnitude(545,19429 #undef __FUNCT__558,19773 #define __FUNCT__ 559,19790 PetscErrorCode SlepcCompareLargestReal(560,19834 #undef __FUNCT__573,20156 #define __FUNCT__ 574,20173 PetscErrorCode SlepcCompareSmallestReal(575,20218 #undef __FUNCT__588,20541 #define __FUNCT__ 589,20558 PetscErrorCode SlepcCompareLargestImaginary(590,20607 #undef __FUNCT__608,21036 #define __FUNCT__ 609,21053 PetscErrorCode SlepcCompareSmallestImaginary(610,21103 #undef __FUNCT__628,21533 #define __FUNCT__ 629,21550 PetscErrorCode SlepcCompareTargetMagnitude(630,21598 #undef __FUNCT__645,22063 #define __FUNCT__ 646,22080 PetscErrorCode SlepcCompareTargetReal(647,22123 #undef __FUNCT__661,22537 #define __FUNCT__ 662,22554 PetscErrorCode SlepcCompareTargetImaginary(663,22602 #undef __FUNCT__685,23220 #define __FUNCT__ 686,23237 PetscErrorCode SlepcCompareSmallestPosReal(691,23376 #undef __FUNCT__712,24094 #define __FUNCT__ 713,24111 PetscErrorCode SlepcBasisReference_Private(718,24319 #undef __FUNCT__736,24758 #define __FUNCT__ 737,24775 PetscErrorCode SlepcBasisDestroy_Private(742,24934 #undef __FUNCT__758,25244 #define __FUNCT__ 759,25261 PetscErrorCode SlepcSNPrintfScalar(775,25674 src/sys/f90-mod/makefile,359 makefile:^?makefile^A,1 ALL:ALL25,1036 speciallib:speciallib26,1056 specialfastlib:specialfastlib27,1083 SPECIALLIB 28,1114 SPECIALFASTLIB 29,1135 CFLAGS 32,1158 FFLAGS 33,1171 SOURCEC 34,1184 SOURCEF 35,1197 SOURCEH 36,1221 LIBBASE 37,1234 MANSEC 38,1256 LOCDIR 39,1273 CLEANFILES 40,1303 buildmod_slepc:buildmod_slepc44,1363 modcopy_slepc:modcopy_slepc49,1469 src/sys/f90-mod/slepcmod.F,0 slepcmod.F:^?slepcmod.F^A,1 src/sys/ftn-custom/makefile,161 makefile:^?makefile^A,1 ALL:ALL23,965 CFLAGS 24,974 FFLAGS 25,1026 SOURCEC 26,1037 SOURCEF 27,1079 SOURCEH 28,1090 DIRS 29,1101 LIBBASE 30,1112 MANSEC 31,1132 LOCDIR 32,1147 src/sys/ftn-custom/zslepc_start.c,194 zslepc_start.c:^?zslepc_start.c^A,1 PETSC_EXTERN void PETSC_STDCALL slepcinitialize_(43,1646 src/sys/ftn-custom/zslepc_startf.c,194 zslepc_startf.c:^?zslepc_startf.c^A,1 PetscErrorCode SlepcInitializeFortran(50,1808 PETSC_EXTERN void PETSC_STDCALL slepcinitializefortran_(56,1897 src/vec/contiguous.c,1008 contiguous.c:^?contiguous.c^A,1 PetscLogEvent SLEPC_UpdateVectors 28,1168 #undef __FUNCT__30,1228 #define __FUNCT__ 31,1245 static PetscErrorCode Vecs_ContiguousDestroy(35,1376 #undef __FUNCT__46,1640 #define __FUNCT__ 47,1657 static PetscErrorCode VecDuplicateVecs_Contiguous(51,1771 #undef __FUNCT__80,2899 #define __FUNCT__ 81,2916 PetscErrorCode SlepcVecSetTemplate(98,3394 #undef __FUNCT__111,3848 #define __FUNCT__ 112,3865 PetscErrorCode SlepcMatGetVecsTemplate(138,4611 #undef __FUNCT__159,5307 #define __FUNCT__ 160,5324 static PetscErrorCode SlepcUpdateVectors_Noncontiguous_Inplace(165,5486 #undef __FUNCT__213,7466 #define __FUNCT__ 214,7483 static PetscErrorCode SlepcUpdateVectors_Noncontiguous(224,7906 #undef __FUNCT__265,9030 #define __FUNCT__ 266,9047 PetscErrorCode SlepcUpdateVectors(302,10251 #undef __FUNCT__325,11136 #define __FUNCT__ 326,11153 PetscErrorCode SlepcUpdateStrideVectors(364,12389 #undef __FUNCT__420,14247 #define __FUNCT__ 421,14264 PetscErrorCode SlepcVecMAXPBY(445,14836 src/vec/makefile,159 makefile:^?makefile^A,1 ALL:ALL22,926 CFLAGS 24,936 FFLAGS 25,947 SOURCEC 26,958 SOURCEF 27,1002 SOURCEH 28,1013 LIBBASE 29,1035 DIRS 30,1055 MANSEC 31,1066 LOCDIR 32,1081 src/vec/veccomp.c,3958 veccomp.c:^?veccomp.c^A,1 static MPI_Datatype MPIU_NORM2=25,1032 static MPI_Op MPIU_NORM2_SUM=26,1086 static PetscBool VecCompInitialized 28,1160 #define __WITH_MPI__38,1489 PETSC_STATIC_INLINE void SumNorm2(41,1533 PETSC_STATIC_INLINE PetscReal GetNorm2(54,1834 PETSC_STATIC_INLINE void AddNorm2(59,1944 #undef __FUNCT__77,2298 #define __FUNCT__ 78,2315 static void SlepcSumNorm2_Local(79,2355 #undef __FUNCT__102,3082 #define __FUNCT__ 103,3099 static PetscErrorCode VecNormCompEnd(104,3134 #undef __FUNCT__116,3451 #define __FUNCT__ 117,3468 static PetscErrorCode VecNormCompInit(118,3504 #undef __FUNCT__133,4057 #define __FUNCT__ 134,4074 PetscErrorCode VecDestroy_Comp(135,4110 static struct _VecOps DvOps 156,4619 #undef __FUNCT__218,6331 #define __FUNCT__ 219,6348 PetscErrorCode VecDuplicateVecs_Comp(220,6390 #undef __FUNCT__234,6833 #define __FUNCT__ 235,6850 PetscErrorCode VecDestroyVecs_Comp(236,6890 #undef __FUNCT__249,7259 #define __FUNCT__ 250,7276 static PetscErrorCode VecCreate_Comp_Private(251,7319 #undef __FUNCT__307,8964 #define __FUNCT__ 308,8981 PETSC_EXTERN PetscErrorCode VecCreate_Comp(309,9016 #undef __FUNCT__318,9217 #define __FUNCT__ 319,9234 PetscErrorCode VecCreateComp(343,9923 #undef __FUNCT__363,10616 #define __FUNCT__ 364,10633 PetscErrorCode VecCreateCompWithVecs(383,11035 #undef __FUNCT__398,11509 #define __FUNCT__ 399,11526 PetscErrorCode VecDuplicate_Comp(400,11564 #undef __FUNCT__419,12156 #define __FUNCT__ 420,12173 PetscErrorCode VecCompGetSubVecs(437,12505 #undef __FUNCT__448,12732 #define __FUNCT__ 449,12749 PetscErrorCode VecCompSetSubVecs(465,13087 #undef __FUNCT__484,13531 #define __FUNCT__ 485,13548 PetscErrorCode VecAXPY_Comp(486,13581 #undef __FUNCT__501,13945 #define __FUNCT__ 502,13962 PetscErrorCode VecAYPX_Comp(503,13995 #undef __FUNCT__518,14359 #define __FUNCT__ 519,14376 PetscErrorCode VecAXPBY_Comp(520,14410 #undef __FUNCT__535,14798 #define __FUNCT__ 536,14815 PetscErrorCode VecMAXPY_Comp(537,14849 #undef __FUNCT__559,15407 #define __FUNCT__ 560,15424 PetscErrorCode VecWAXPY_Comp(561,15458 #undef __FUNCT__577,15888 #define __FUNCT__ 578,15905 PetscErrorCode VecAXPBYPCZ_Comp(579,15942 #undef __FUNCT__595,16427 #define __FUNCT__ 596,16444 PetscErrorCode VecGetSize_Comp(597,16480 #undef __FUNCT__608,16700 #define __FUNCT__ 609,16717 PetscErrorCode VecGetLocalSize_Comp(610,16758 #undef __FUNCT__621,16984 #define __FUNCT__ 622,17001 PetscErrorCode VecMax_Comp(623,17033 #undef __FUNCT__651,17691 #define __FUNCT__ 652,17708 PetscErrorCode VecMin_Comp(653,17740 #undef __FUNCT__681,18398 #define __FUNCT__ 682,18415 PetscErrorCode VecMaxPointwiseDivide_Comp(683,18462 #define __QUOTEME__(703,19019 #define __COMPOSE2__(704,19045 #define __COMPOSE3__(705,19076 #define __FUNC_TEMPLATE1__(707,19113 #undef __FUNCT__722,19480 #define __FUNCT__ 723,19497 #undef __FUNCT__726,19566 #define __FUNCT__ 727,19583 #undef __FUNCT__730,19654 #define __FUNCT__ 731,19671 #undef __FUNCT__734,19736 #define __FUNCT__ 735,19753 #undef __FUNCT__738,19810 #define __FUNCT__ 739,19827 #undef __FUNCT__742,19884 #define __FUNCT__ 743,19901 #define __FUNC_TEMPLATE2__(747,19959 #undef __FUNCT__762,20340 #define __FUNCT__ 763,20357 #undef __FUNCT__766,20426 #define __FUNCT__ 767,20443 #undef __FUNCT__770,20514 #define __FUNCT__ 771,20531 #undef __FUNCT__774,20604 #define __FUNCT__ 775,20621 #undef __FUNCT__778,20702 #define __FUNCT__ 779,20719 #define __FUNC_TEMPLATE3__(783,20793 #undef __FUNCT__800,21246 #define __FUNCT__ 801,21263 #undef __FUNCT__804,21322 #define __FUNCT__ 805,21339 #define __FUNC_TEMPLATE4__(809,21399 #undef __FUNCT__828,21940 #define __FUNCT__ 829,21957 #undef __FUNCT__832,22032 #define __FUNCT__ 833,22049 #undef __FUNCT__836,22130 #define __FUNCT__ 837,22147 #undef __FUNCT__840,22222 #define __FUNCT__ 841,22239 #undef __FUNCT__844,22316 #define __FUNCT__ 845,22333 src/vec/veccomp0.h,727 veccomp0.h:^?veccomp0.h^A,1 #define __SUF__(25,1012 #define __SUF__(27,1045 #define __QUOTEME_(29,1079 #define __QUOTEME(30,1104 #define __SUF_C__(31,1139 #undef __FUNCT__34,1184 #define __FUNCT__ 35,1201 PetscErrorCode __SUF__(36,1242 #undef __FUNCT__65,2035 #define __FUNCT__ 66,2052 PetscErrorCode __SUF__(67,2094 #undef __FUNCT__126,3691 #define __FUNCT__ 127,3708 PetscErrorCode __SUF__(128,3750 #undef __FUNCT__157,4547 #define __FUNCT__ 158,4564 PetscErrorCode __SUF__(159,4607 #undef __FUNCT__218,6214 #define __FUNCT__ 219,6231 PetscErrorCode __SUF__(220,6273 #undef __FUNCT__288,8548 #define __FUNCT__ 289,8565 PetscErrorCode __SUF__(290,8611 #undef __SUF__337,10177 #undef __QUOTEME338,10192 #undef __SUF_C__339,10209 src/vec/vecutil.c,188 vecutil.c:^?vecutil.c^A,1 #undef __FUNCT__27,1060 #define __FUNCT__ 28,1077 PetscErrorCode SlepcVecSetRandom(49,1708 #undef __FUNCT__79,2718 #define __FUNCT__ 80,2735 PetscErrorCode SlepcVecNormalize(97,3237 conf/slepc_rules,4572 slepc_rules:^?slepc_rules^A,1 @mypwd=23,940 @mypwd=`pwd`; cd ${SLEPC_DIR} 2>&1 > /dev/null;null23,940 @mypwd=`pwd`; cd ${SLEPC_DIR} 2>&1 > /dev/null; true_SLEPC_DIR=23,940 @mypwd=`pwd`; cd ${SLEPC_DIR} 2>&1 > /dev/null; true_SLEPC_DIR=`pwd`; cd $${mypwd} 2>&1 >/dev/null;null23,940 newpwd=24,1043 hasslepc=25,1114 echo "SLEPC_DIR " $${true_SLEPC_DIR} "Current directory" $${$$29,1423 -@if @if34,1635 DOCTEXT_PATH=35,1672 DOCTEXT_PATH=${PETSC_DIR}/src/docs/tex/doctext; export DOCTEXT_PATH;35,1672 ${SOURCEC} ${$40,1951 b=`ls ${LOC}/docs/manualpages/*/$${j}.html | cut -f9`f952,2471 l=53,2545 echo "

Examples

" >> $$b;56,2684 fi;57,2773 echo "BB
" | sed s?BB?${LOCDIR}$$i.html?g >> $$b;58,2797 grep -v /BODY $$b > ltmp;59,2899 echo "" >> ltmp;60,2945 mv -f ltmp $$b;61,2996 fi;62,3032 done;63,3054 fi;64,3076 done;65,3094 -@ROOT=@ROOT71,3305 loc=72,3388 ${MKDIR} -p $${$$73,3464 iroot=76,3658 IROOT=77,3716 IROOT=79,3826 IROOT=81,3877 fi;82,3910 ${RM} $${loc}/$$i.html;html83,3929 echo "
Actual source code: $${iroot}

" > $${loc}/$$i.html;html84,3969 ${MAPNAMES} -map /tmp/$$USER.htmlmap -inhtml | sed -e s?ROOT?$${IROOT}?g >> $${loc}/$$i.html html88,4428 fi;89,4539 -@ROOT=@ROOT91,4564 loc=92,4647 loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; ${RM} $${loc}/index.html;html92,4647 cat ${SLEPC_DIR}/src/docs/manualpages-sec/header_${MANSEC} | sed -e "s?Examples?Manual pages?g" -e "s?PETSC_DIR?$${ROOT}/?g"> $${loc}/index.html;html93,4748 -@loc=@loc95,5034 cmess=99,5228 echo "$${file}: $${cmess}
" >> $${loc}/index.html;html100,5321 fi;101,5425 done 102,5433 echo "$${file}/
" >> $${loc}/index.html;html106,5548 fi;107,5639 done;108,5648 echo " " >> $${loc}/index.html;html109,5671 echo "$${file}
" >> $${loc}/index.html;html112,5819 fi;113,5913 done;114,5922 fi 115,5945 echo " " >> $${loc}/index.html;html116,5963 -@loc=@loc118,6093 -@for dir in ${DIRS} ftn-auto ftn-custom f90-custom;custom123,6319 PETSCCONF=126,6484 PETSCCONF=128,6570 fi;129,6649 r=130,6669 PKGFLG=132,6761 grep -w "#define $${PKGFLG}" $${PETSCCONF} > /dev/null;null133,6799 continue;135,6914 fi;136,6944 fi;137,6966 r=138,6986 PKGFLG=140,7079 grep -w "#define $${PKGFLG}" $${PETSCCONF} > /dev/null;null141,7117 continue;143,7232 fi;144,7262 fi;145,7284 r=146,7304 PKGFLG=148,7395 grep -w "#define $${PKGFLG}" ${SLEPC_DIR}/${PETSC_ARCH}/include/slepcconf.h > /dev/null;null149,7433 grep -w "#define $${PKGFLG}" $${PETSCCONF} > /dev/null;null151,7581 continue;153,7700 fi;154,7732 fi;155,7756 fi;156,7778 r=157,7798 echo $$r | grep -w ${PETSC_LANGUAGE} > /dev/null;null159,7898 continue;161,8007 fi;162,8037 fi;163,8059 r=164,8079 echo $$r | grep -w ${PETSC_SCALAR} > /dev/null;null166,8177 continue;168,8285 fi;169,8315 fi;170,8337 r=171,8357 echo $$r | grep -w ${PETSC_PRECISION} > /dev/null;null173,8458 continue;175,8569 fi;176,8599 fi;177,8621 continue;179,8660 fi;180,8686 (cd $$dir 181,8704 echo ${ACTION} in: `pwd`pwd182,8730 ${OMAKE} slepc_tree ACTION=183,8770 -@${OMAKE} PETSC_ARCH=188,8978 conf/slepc_test,61 slepc_test:^?slepc_test^A,1 -@${OMAKE} testexamples_BLOPEX TESTEXAMPLES_BLOPEX=28,1073 conf/slepc_variables,23 slepc_variables:^?slepc_variables^A,1 SLEPC_LIB_DIR 25,1018 conf/slepc_common,0 slepc_common:^?slepc_common^A,1 slepc-3.4.2.dfsg.orig/config/0000755000175000017500000000000012214143515014700 5ustar gladkgladkslepc-3.4.2.dfsg.orig/config/petscconf.py0000644000175000017500000000543712211062077017247 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys def Load(petscdir): global ARCH,DIR,MAKE,SCALAR,PRECISION,ISINSTALL,DESTDIR,BFORT,TEST_RUNS,CC,CC_FLAGS,FC,AR,AR_FLAGS,AR_LIB_SUFFIX,RANLIB,IND64,BUILD_USING_CMAKE,MPIUNI if 'PETSC_ARCH' in os.environ and os.environ['PETSC_ARCH']: ISINSTALL = 0 ARCH = os.environ['PETSC_ARCH'] PETSCVARIABLES = os.sep.join([petscdir,ARCH,'conf','petscvariables']) PETSCCONF_H = os.sep.join([petscdir,ARCH,'include','petscconf.h']) else: ISINSTALL = 1 ARCH = 'arch-installed-petsc' PETSCVARIABLES = os.sep.join([petscdir,'conf','petscvariables']) PETSCCONF_H = os.sep.join([petscdir,'include','petscconf.h']) BUILD_USING_CMAKE = 0 try: f = open(PETSCVARIABLES) for l in f.readlines(): r = l.split('=',1) if len(r)!=2: continue k = r[0].strip() v = r[1].strip() if k == 'PETSC_SCALAR': SCALAR = v elif k == 'PETSC_PRECISION': PRECISION = v elif k == 'MAKE': MAKE = v elif k == 'DESTDIR': DESTDIR = v elif k == 'BFORT': BFORT = v elif k == 'TEST_RUNS': TEST_RUNS = v elif k == 'CC': CC = v elif k == 'CC_FLAGS': CC_FLAGS = v elif k == 'FC' and not v=='': FC = v elif k == 'AR': AR = v elif k == 'AR_FLAGS': AR_FLAGS = v elif k == 'AR_LIB_SUFFIX': AR_LIB_SUFFIX = v elif k == 'RANLIB': RANLIB = v elif k == 'PETSC_BUILD_USING_CMAKE': BUILD_USING_CMAKE = v f.close() except: sys.exit('ERROR: cannot process file ' + PETSCVARIABLES) IND64 = 0 MPIUNI = 0 try: f = open(PETSCCONF_H) for l in f.readlines(): l = l.split() if len(l)==3 and l[0]=='#define' and l[1]=='PETSC_USE_64BIT_INDICES' and l[2]=='1': IND64 = 1 elif len(l)==3 and l[0]=='#define' and l[1]=='PETSC_HAVE_MPIUNI' and l[2]=='1': MPIUNI = 1 f.close() except: sys.exit('ERROR: cannot process file ' + PETSCCONF_H) slepc-3.4.2.dfsg.orig/config/log.py0000644000175000017500000000253312211062077016036 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import sys import petscconf def Open(filename): global f f = open(filename,'w') return def Println(string): print string f.write(string) f.write('\n') def Print(string): print string, f.write(string+' ') def write(string): f.write(string) f.write('\n') def Exit(string): f.write(string) f.write('\n') f.close() print string sys.exit('ERROR: See "' + petscconf.ARCH + '/conf/configure.log" file for details') slepc-3.4.2.dfsg.orig/config/check.py0000644000175000017500000001106512211062077016332 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import commands import petscconf import log def LinkWithOutput(tmpdir,functions,callbacks,flags): code = '#include "petscksp.h"\n' for f in functions: code += 'PETSC_EXTERN int\n' + f + '();\n' for c in callbacks: code += 'int '+ c + '() { return 0; } \n' code += 'int main() {\n' code += 'Vec v; Mat m; KSP k;\n' code += 'PetscInitializeNoArguments();\n' code += 'VecCreate(PETSC_COMM_WORLD,&v);\n' code += 'MatCreate(PETSC_COMM_WORLD,&m);\n' code += 'KSPCreate(PETSC_COMM_WORLD,&k);\n' for f in functions: code += f + '();\n' code += 'return 0;\n}\n' cfile = open(os.sep.join([tmpdir,'checklink.c']),'w') cfile.write(code) cfile.close() (result, output) = commands.getstatusoutput(petscconf.MAKE + ' -C ' + tmpdir + ' checklink TESTFLAGS="'+str.join(' ',flags)+'"') try: os.remove('checklink.c') except OSError: pass if result: return (0,code + output) else: return (1,code + output) def Link(tmpdir,functions,callbacks,flags): (result, output) = LinkWithOutput(tmpdir,functions,callbacks,flags) log.write(output) return result def FortranLink(tmpdir,functions,callbacks,flags): output = '\n=== With linker flags: '+str.join(' ',flags) f = [] for i in functions: f.append(i+'_') c = [] for i in callbacks: c.append(i+'_') (result, output1) = LinkWithOutput(tmpdir,f,c,flags) output1 = '\n====== With underscore Fortran names\n' + output1 if result: return ('UNDERSCORE',output1) f = [] for i in functions: f.append(i.upper()) c = [] for i in callbacks: c.append(i.upper()) (result, output2) = LinkWithOutput(tmpdir,f,c,flags) output2 = '\n====== With capital Fortran names\n' + output2 if result: return ('CAPS',output2) (result, output3) = LinkWithOutput(tmpdir,functions,callbacks,flags) output3 = '\n====== With unmodified Fortran names\n' + output3 if result: return ('STDCALL',output3) return ('',output + output1 + output2 + output3) def GenerateGuesses(name): installdirs = ['/usr/local','/opt'] if 'HOME' in os.environ: installdirs.insert(0,os.environ['HOME']) dirs = [] for i in installdirs: dirs = dirs + [i + '/lib'] for d in [name,name.upper(),name.lower()]: dirs = dirs + [i + '/' + d] dirs = dirs + [i + '/' + d + '/lib'] dirs = dirs + [i + '/lib/' + d] for d in dirs[:]: if not os.path.exists(d): dirs.remove(d) dirs = [''] + dirs return dirs def FortranLib(tmpdir,conf,vars,cmake,name,dirs,libs,functions,callbacks = []): log.write('='*80) log.Println('Checking '+name+' library...') error = '' mangling = '' for d in dirs: for l in libs: if d: flags = ['-L' + d] + l else: flags = l (mangling, output) = FortranLink(tmpdir,functions,callbacks,flags) error += output if mangling: break if mangling: break if mangling: log.write(output) else: log.write(error) log.Println('ERROR: Unable to link with library '+ name) log.Println('ERROR: In directories '+''.join([s+' ' for s in dirs])) log.Println('ERROR: With flags '+''.join([s+' ' for s in flags])) log.Exit('') conf.write('#ifndef SLEPC_HAVE_' + name + '\n#define SLEPC_HAVE_' + name + ' 1\n#define SLEPC_' + name + '_HAVE_'+mangling+' 1\n#endif\n\n') vars.write(name + '_LIB = '+str.join(' ',flags)+'\n') cmake.write('set (SLEPC_HAVE_' + name + ' YES)\n') libname = ''.join([s.lstrip('-l')+' ' for s in l]) cmake.write('set (' + name + '_LIB "")\nforeach (libname ' + libname + ')\n string (TOUPPER ${libname} LIBNAME)\n find_library (${LIBNAME}LIB ${libname} HINTS '+ d +')\n list (APPEND ' + name + '_LIB "${${LIBNAME}LIB}")\nendforeach()\n') return flags slepc-3.4.2.dfsg.orig/config/configure.py0000755000175000017500000004664712211062077017257 0ustar gladkgladk#!/usr/bin/env python # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import time import commands import tempfile import shutil # Use en_US as language so that compiler messages are in English if 'LC_LOCAL' in os.environ and os.environ['LC_LOCAL'] != '' and os.environ['LC_LOCAL'] != 'en_US' and os.environ['LC_LOCAL']!= 'en_US.UTF-8': os.environ['LC_LOCAL'] = 'en_US.UTF-8' if 'LANG' in os.environ and os.environ['LANG'] != '' and os.environ['LANG'] != 'en_US' and os.environ['LANG'] != 'en_US.UTF-8': os.environ['LANG'] = 'en_US.UTF-8' # should be run from the toplevel configDir = os.path.abspath('config') if not os.path.isdir(configDir): raise RuntimeError('Run configure from $SLEPC_DIR, not '+os.path.abspath('.')) sys.path.insert(0, configDir) import petscversion import slepcversion import petscconf import log import check import arpack import blzpack import trlan import feast import lapack import primme import blopex if not hasattr(sys, 'version_info') or not sys.version_info[0] == 2 or not sys.version_info[1] >= 4: print '***** You must have Python2 version 2.4 or higher to run ./configure.py ******' print '* Python is easy to install for end users or sys-admin. *' print '* http://www.python.org/download/ *' print '* *' print '* You CANNOT configure SLEPc without Python *' print '*********************************************************************************' sys.exit(4) # support a few standard configure option types for l in range(1,len(sys.argv)): name = sys.argv[l] if name.startswith('--enable'): sys.argv[l] = name.replace('--enable','--with') if name.find('=') == -1: sys.argv[l] += '=1' if name.startswith('--disable'): sys.argv[l] = name.replace('--disable','--with') if name.find('=') == -1: sys.argv[l] += '=0' elif name.endswith('=1'): sys.argv[l].replace('=1','=0') if name.startswith('--without'): sys.argv[l] = name.replace('--without','--with') if name.find('=') == -1: sys.argv[l] += '=0' elif name.endswith('=1'): sys.argv[l].replace('=1','=0') # Check configure parameters havearpack = 0 arpackdir = '' arpacklibs = [] haveblzpack = 0 blzpackdir = '' blzpacklibs = [] havetrlan = 0 trlandir = '' trlanlibs = [] haveprimme = 0 primmedir = '' primmelibs = [] havefeast = 0 feastdir = '' feastlibs = [] getblopex = 0 haveblopex = 0 blopexurl = '' prefixdir = '' for i in sys.argv[1:]: if i.startswith('--with-arpack-dir='): arpackdir = i.split('=')[1] havearpack = 1 elif i.startswith('--with-arpack-flags='): arpacklibs = i.split('=')[1].split(',') havearpack = 1 elif i.startswith('--with-arpack'): havearpack = not i.endswith('=0') elif i.startswith('--with-blzpack-dir='): blzpackdir = i.split('=')[1] haveblzpack = 1 elif i.startswith('--with-blzpack-flags='): blzpacklibs = i.split('=')[1].split(',') haveblzpack = 1 elif i.startswith('--with-blzpack'): haveblzpack = not i.endswith('=0') elif i.startswith('--with-trlan-dir='): trlandir = i.split('=')[1] havetrlan = 1 elif i.startswith('--with-trlan-flags='): trlanlibs = i.split('=')[1].split(',') havetrlan = 1 elif i.startswith('--with-trlan'): havetrlan = not i.endswith('=0') elif i.startswith('--with-primme-dir'): primmedir = i.split('=')[1] haveprimme = 1 elif i.startswith('--with-primme-flags='): primmelibs = i.split('=')[1].split(',') haveprimme = 1 elif i.startswith('--with-primme'): haveprimme = not i.endswith('=0') elif i.startswith('--with-feast-dir='): feastdir = i.split('=')[1] havefeast = 1 elif i.startswith('--with-feast-flags='): feastlibs = i.split('=')[1].split(',') havefeast = 1 elif i.startswith('--with-feast'): havefeast = not i.endswith('=0') elif i.startswith('--download-blopex'): getblopex = not i.endswith('=0') try: blopexurl = i.split('=')[1] except IndexError: pass elif i.startswith('--prefix='): prefixdir = i.split('=')[1] elif i.startswith('--h') or i.startswith('-h') or i.startswith('-?'): print 'SLEPc Configure Help' print '-'*80 print ' --prefix= : Specify location to install SLEPc (e.g., /usr/local)' print 'ARPACK:' print ' --with-arpack : Indicate if you wish to test for ARPACK (PARPACK)' print ' --with-arpack-dir= : Indicate the directory for ARPACK libraries' print ' --with-arpack-flags= : Indicate comma-separated flags for linking ARPACK' print 'BLZPACK:' print ' --with-blzpack : Indicate if you wish to test for BLZPACK' print ' --with-blzpack-dir= : Indicate the directory for BLZPACK libraries' print ' --with-blzpack-flags= : Indicate comma-separated flags for linking BLZPACK' print 'TRLAN:' print ' --with-trlan : Indicate if you wish to test for TRLAN' print ' --with-trlan-dir= : Indicate the directory for TRLAN libraries' print ' --with-trlan-flags= : Indicate comma-separated flags for linking TRLAN' print 'PRIMME:' print ' --with-primme : Indicate if you wish to test for PRIMME' print ' --with-primme-dir= : Indicate the directory for PRIMME libraries' print ' --with-primme-flags= : Indicate comma-separated flags for linking PRIMME' print 'FEAST:' print ' --with-feast : Indicate if you wish to test for FEAST' print ' --with-feast-dir= : Indicate the directory for FEAST libraries' print ' --with-feast-flags= : Indicate comma-separated flags for linking FEAST' print 'BLOPEX:' print ' --download-blopex : Download and install BLOPEX in SLEPc directory' sys.exit(0) else: sys.exit('ERROR: Invalid argument ' + i +'. Use -h for help') prefixinstall = not prefixdir=='' # Check if enviroment is ok print 'Checking environment...' if 'SLEPC_DIR' in os.environ: slepcdir = os.environ['SLEPC_DIR'] if not os.path.exists(slepcdir) or not os.path.exists(os.sep.join([slepcdir,'config'])): sys.exit('ERROR: SLEPC_DIR enviroment variable is not valid') if os.path.realpath(os.getcwd()) != os.path.realpath(slepcdir): sys.exit('ERROR: SLEPC_DIR is not the current directory') else: slepcdir = os.getcwd(); if not os.path.exists(os.sep.join([slepcdir,'config'])): sys.exit('ERROR: Current directory is not valid') if 'PETSC_DIR' in os.environ: petscdir = os.environ['PETSC_DIR'] if not os.path.exists(petscdir): sys.exit('ERROR: PETSC_DIR enviroment variable is not valid') else: if prefixdir: petscdir = prefixdir os.environ['PETSC_DIR'] = petscdir else: sys.exit('ERROR: PETSC_DIR enviroment variable is not set') # Check PETSc version petscversion.Load(petscdir) slepcversion.Load(slepcdir) if petscversion.VERSION < slepcversion.VERSION: sys.exit('ERROR: This SLEPc version is not compatible with PETSc version '+petscversion.VERSION) # Check some information about PETSc configuration petscconf.Load(petscdir) if not petscconf.PRECISION in ['double','single','__float128']: sys.exit('ERROR: This SLEPc version does not work with '+petscconf.PRECISION+' precision') if prefixinstall and not petscconf.ISINSTALL: sys.exit('ERROR: SLEPc cannot be configured for non-source installation if PETSc is not configured in the same way.') # Check whether this is a working copy of the repository isrepo = 0 if os.path.exists(os.sep.join([slepcdir,'src','docs'])) and os.path.exists(os.sep.join([slepcdir,'.git'])): (status, output) = commands.getstatusoutput('git rev-parse') if status: print 'WARNING: SLEPC_DIR appears to be a git working copy, but git is not found in PATH' else: isrepo = 1 (status, gitrev) = commands.getstatusoutput('git log -1 --pretty=format:%H') (status, gitdate) = commands.getstatusoutput('git log -1 --pretty=format:%ci') # Create architecture directory and configuration files archdir = os.sep.join([slepcdir,petscconf.ARCH]) if not os.path.exists(archdir): try: os.mkdir(archdir) except: sys.exit('ERROR: cannot create architecture directory ' + archdir) confdir = os.sep.join([archdir,'conf']) if not os.path.exists(confdir): try: os.mkdir(confdir) except: sys.exit('ERROR: cannot create configuration directory ' + confdir) incdir = os.sep.join([archdir,'include']) if not os.path.exists(incdir): try: os.mkdir(incdir) except: sys.exit('ERROR: cannot create include directory ' + incdir) libdir = os.sep.join([archdir,'lib']) if not os.path.exists(libdir): try: os.mkdir(libdir) except: sys.exit('ERROR: cannot create lib directory ' + libdir) modulesdir = os.sep.join([libdir,'modules']) if not os.path.exists(modulesdir): try: os.mkdir(modulesdir) except: sys.exit('ERROR: cannot create modules directory ' + modulesdir) pkgconfigdir = os.sep.join([libdir,'pkgconfig']) if not os.path.exists(pkgconfigdir): try: os.mkdir(pkgconfigdir) except: sys.exit('ERROR: cannot create pkgconfig directory ' + pkgconfigdir) try: slepcvars = open(os.sep.join([confdir,'slepcvariables']),'w') if not prefixdir: prefixdir = archdir slepcvars.write('SLEPC_DESTDIR = ' + prefixdir +'\n') testruns = set(petscconf.TEST_RUNS.split()) testruns = testruns.intersection(set(['C','F90','Fortran','C_NoComplex','Fortran_NoComplex'])) if petscconf.PRECISION != '__float128': testruns = testruns.union(set(['C_NoF128'])) slepcvars.write('TEST_RUNS = ' + ' '.join(testruns) +'\n') except: sys.exit('ERROR: cannot create configuration file in ' + confdir) try: slepcrules = open(os.sep.join([confdir,'slepcrules']),'w') except: sys.exit('ERROR: cannot create rules file in ' + confdir) try: slepcconf = open(os.sep.join([incdir,'slepcconf.h']),'w') slepcconf.write('#if !defined(__SLEPCCONF_H)\n') slepcconf.write('#define __SLEPCCONF_H\n\n') if isrepo: slepcconf.write('#ifndef SLEPC_VERSION_GIT\n#define SLEPC_VERSION_GIT "' + gitrev + '"\n#endif\n\n') slepcconf.write('#ifndef SLEPC_VERSION_DATE_GIT\n#define SLEPC_VERSION_DATE_GIT "' + gitdate + '"\n#endif\n\n') slepcconf.write('#ifndef SLEPC_LIB_DIR\n#define SLEPC_LIB_DIR "' + prefixdir + '/lib"\n#endif\n\n') except: sys.exit('ERROR: cannot create configuration header in ' + confdir) try: cmake = open(os.sep.join([confdir,'SLEPcConfig.cmake']),'w') except: sys.exit('ERROR: cannot create CMake configuration file in ' + confdir) try: modules = open(os.sep.join([modulesdir,slepcversion.LVERSION+'-'+petscconf.ARCH]),'w') except: sys.exit('ERROR: cannot create modules file in ' + modulesdir) try: pkgconfig = open(os.sep.join([pkgconfigdir,'SLEPc.pc']),'w') except: sys.exit('ERROR: cannot create pkgconfig file in ' + pkgconfigdir) if prefixinstall and os.path.isfile(os.sep.join([prefixdir,'include','slepc.h'])): sys.exit('ERROR: prefix directory ' + prefixdir + ' contains files from a previous installation') # Create temporary directory and makefile for running tests try: tmpdir = tempfile.mkdtemp(prefix='slepc-') if not os.path.isdir(tmpdir): os.mkdir(tmpdir) except: sys.exit('ERROR: cannot create temporary directory') try: makefile = open(os.sep.join([tmpdir,'makefile']),'w') makefile.write('checklink: checklink.o chkopts\n') makefile.write('\t${CLINKER} -o checklink checklink.o ${TESTFLAGS} ${PETSC_KSP_LIB}\n') makefile.write('\t@${RM} -f checklink checklink.o\n') makefile.write('LOCDIR = ./\n') makefile.write('include ${PETSC_DIR}/conf/variables\n') makefile.write('include ${PETSC_DIR}/conf/rules\n') makefile.close() except: sys.exit('ERROR: cannot create makefile in temporary directory') # Open log file log.Open(os.sep.join([confdir,'configure.log'])) log.write('='*80) log.write('Starting Configure Run at '+time.ctime(time.time())) log.write('Configure Options: '+str.join(' ',sys.argv)) log.write('Working directory: '+os.getcwd()) log.write('Python version:\n' + sys.version) log.write('make: ' + petscconf.MAKE) log.write('PETSc source directory: ' + petscdir) log.write('PETSc install directory: ' + petscconf.DESTDIR) log.write('PETSc version: ' + petscversion.LVERSION) log.write('PETSc architecture: ' + petscconf.ARCH) log.write('SLEPc source directory: ' + slepcdir) log.write('SLEPc install directory: ' + prefixdir) log.write('SLEPc version: ' + slepcversion.LVERSION) log.write('='*80) # Check if PETSc is working log.Println('Checking PETSc installation...') if petscversion.VERSION > slepcversion.VERSION: log.Println('WARNING: PETSc version '+petscversion.VERSION+' is newer than SLEPc version '+slepcversion.VERSION) if petscversion.RELEASE != '1' and slepcversion.RELEASE == '1': log.Println('WARNING: using PETSc development version with a SLEPc release version') if petscconf.ISINSTALL: if os.path.realpath(petscconf.DESTDIR) != os.path.realpath(petscdir): log.Println('WARNING: PETSC_DIR does not point to PETSc installation path') if not check.Link(tmpdir,[],[],[]): log.Exit('ERROR: Unable to link with PETSc') # Check for external packages if havearpack: arpacklibs = arpack.Check(slepcconf,slepcvars,cmake,tmpdir,arpackdir,arpacklibs) if haveblzpack: blzpacklibs = blzpack.Check(slepcconf,slepcvars,cmake,tmpdir,blzpackdir,blzpacklibs) if havetrlan: trlanlibs = trlan.Check(slepcconf,slepcvars,cmake,tmpdir,trlandir,trlanlibs) if haveprimme: primmelibs = primme.Check(slepcconf,slepcvars,cmake,tmpdir,primmedir,primmelibs) if havefeast: feastlibs = feast.Check(slepcconf,slepcvars,cmake,tmpdir,feastdir,feastlibs) if getblopex: blopexlibs = blopex.Install(slepcconf,slepcvars,cmake,tmpdir,blopexurl,archdir) haveblopex = 1 # Check for missing LAPACK functions missing = lapack.Check(slepcconf,slepcvars,cmake,tmpdir) # Make Fortran stubs if necessary if isrepo and hasattr(petscconf,'FC'): try: import generatefortranstubs generatefortranstubs.main(slepcdir,petscconf.BFORT,os.getcwd(),0) generatefortranstubs.processf90interfaces(slepcdir,0) except AttributeError: sys.exit('ERROR: cannot generate Fortran stubs; try configuring PETSc with --download-sowing or use a mercurial version of PETSc') # CMake stuff cmake.write('set (SLEPC_PACKAGE_LIBS "${ARPACK_LIB}" "${BLZPACK_LIB}" "${TRLAN_LIB}" "${PRIMME_LIB}" "${FEAST_LIB}" "${BLOPEX_LIB}" )\n') cmake.write('set (SLEPC_PACKAGE_INCLUDES "${PRIMME_INCLUDE}")\n') cmake.write('find_library (PETSC_LIB petsc HINTS ${PETSc_BINARY_DIR}/lib )\n') cmake.write(''' if (NOT PETSC_LIB) # Interpret missing libpetsc to mean that PETSc was built --with-single-library=0 set (PETSC_LIB "") foreach (pkg sys vec mat dm ksp snes ts) string (TOUPPER ${pkg} PKG) find_library(PETSC${PKG}_LIB "petsc${pkg}" HINTS ${PETSc_BINARY_DIR}/lib) list (APPEND PETSC_LIB "${PETSC${PKG}_LIB}") endforeach () endif () ''') cmake.close() cmakeok = False if sys.version_info >= (2,5) and not petscconf.ISINSTALL and petscconf.BUILD_USING_CMAKE: import cmakegen try: cmakegen.main(slepcdir,petscdir,petscarch=petscconf.ARCH) except (OSError), e: log.Exit('ERROR: Generating CMakeLists.txt failed:\n' + str(e)) import cmakeboot try: cmakeok = cmakeboot.main(slepcdir,petscdir,petscarch=petscconf.ARCH,log=log) except (OSError), e: log.Exit('ERROR: Booting CMake in PETSC_ARCH failed:\n' + str(e)) except (ImportError, KeyError), e: log.Exit('ERROR: Importing cmakeboot failed:\n' + str(e)) # remove files created by PETSc's script for f in ['build.log','build.log.bkp','RDict.log']: try: os.remove(f) except OSError: pass if cmakeok: slepcvars.write('SLEPC_BUILD_USING_CMAKE = 1\n') # Modules file modules.write('#%Module\n\n') modules.write('proc ModulesHelp { } {\n') modules.write(' puts stderr "This module sets the path and environment variables for slepc-%s"\n' % slepcversion.LVERSION) modules.write(' puts stderr " see http://www.grycap.upv.es/slepc/ for more information"\n') modules.write(' puts stderr ""\n}\n') modules.write('module-whatis "SLEPc - Scalable Library for Eigenvalue Problem Computations"\n\n') modules.write('module load petsc\n') if prefixinstall: modules.write('set slepc_dir %s\n' % prefixdir) else: modules.write('set slepc_dir %s\n' % slepcdir) modules.write('setenv SLEPC_DIR $slepc_dir\n') # pkg-config file pkgconfig.write('Name: SLEPc, the Scalable Library for Eigenvalue Problem Computations\n') pkgconfig.write('Description: A parallel library to compute eigenvalues and eigenvectors of large, sparse matrices with iterative methods. It is based on PETSc.\n') pkgconfig.write('Version: %s\n' % slepcversion.LVERSION) pkgconfig.write('Requires: PETSc = %s\n' % petscversion.LVERSION) pkgconfig.write('Cflags: -I%s/include' % prefixdir) if not prefixinstall: pkgconfig.write(' -I%s/include' % slepcdir) pkgconfig.write('\nLibs: -L%s/lib -lslepc\n' % prefixdir) # Finish with configuration files slepcvars.close() slepcrules.close() slepcconf.write('#endif\n') slepcconf.close() modules.close() pkgconfig.close() shutil.rmtree(tmpdir) # Print summary log.Println('') log.Println('='*79) log.Println('SLEPc Configuration') log.Println('='*79) log.Println('') log.Println('SLEPc directory:') log.Println(' '+slepcdir) if archdir != prefixdir: log.Println('SLEPc prefix directory:') log.Println(' '+prefixdir) log.Println('PETSc directory:') log.Println(' '+petscdir) log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers') if havearpack: log.Println('ARPACK library flags:') log.Println(' '+str.join(' ',arpacklibs)) if haveblzpack: log.Println('BLZPACK library flags:') log.Println(' '+str.join(' ',blzpacklibs)) if havetrlan: log.Println('TRLAN library flags:') log.Println(' '+str.join(' ',trlanlibs)) if haveprimme: log.Println('PRIMME library flags:') log.Println(' '+str.join(' ',primmelibs)) if havefeast: log.Println('FEAST library flags:') log.Println(' '+str.join(' ',feastlibs)) if haveblopex: log.Println('BLOPEX library flags:') log.Println(' '+str.join(' ',blopexlibs)) if missing: log.Println('LAPACK missing functions:') log.Print(' ') for i in missing: log.Print(i) log.Println('') log.Println('') log.Println('WARNING: Some SLEPc functionality will not be available') log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation') print print 'xxx'+'='*73+'xxx' if cmakeok: buildtype = 'cmake' else: buildtype = 'legacy' print ' Configure stage complete. Now build the SLEPc library with ('+buildtype+' build):' print ' make SLEPC_DIR=$PWD PETSC_DIR='+petscdir+' PETSC_ARCH='+petscconf.ARCH print 'xxx'+'='*73+'xxx' print slepc-3.4.2.dfsg.orig/config/arpack.py0000644000175000017500000000453412211062077016521 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import petscconf import log import check def Check(conf,vars,cmake,tmpdir,directory,libs): if (petscconf.PRECISION != 'single') & (petscconf.PRECISION != 'double'): log.Exit('ERROR: ARPACK is supported only in single or double precision.') if petscconf.MPIUNI: if petscconf.SCALAR == 'real': if petscconf.PRECISION == 'single': functions = ['snaupd','sneupd','ssaupd','sseupd'] else: functions = ['dnaupd','dneupd','dsaupd','dseupd'] else: if petscconf.PRECISION == 'single': functions = ['cnaupd','cneupd'] else: functions = ['znaupd','zneupd'] else: if petscconf.SCALAR == 'real': if petscconf.PRECISION == 'single': functions = ['psnaupd','psneupd','pssaupd','psseupd'] else: functions = ['pdnaupd','pdneupd','pdsaupd','pdseupd'] else: if petscconf.PRECISION == 'single': functions = ['pcnaupd','pcneupd'] else: functions = ['pznaupd','pzneupd'] if libs: libs = [libs] else: if petscconf.MPIUNI: libs = [['-larpack'],['-larpack_LINUX'],['-larpack_SUN4']] else: libs = [['-lparpack','-larpack'],['-lparpack_MPI','-larpack'],['-lparpack_MPI-LINUX','-larpack_LINUX'],['-lparpack_MPI-SUN4','-larpack_SUN4']] if directory: dirs = [directory] else: dirs = check.GenerateGuesses('Arpack') return check.FortranLib(tmpdir,conf,vars,cmake,'ARPACK',dirs,libs,functions) slepc-3.4.2.dfsg.orig/config/blopex.py0000644000175000017500000001103112211062077016537 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import log import petscconf import urllib import urlparse import commands def Install(conf,vars,cmake,tmpdir,url,archdir): ''' Download and uncompress the BLOPEX tarball ''' log.write('='*80) log.Println('Installing BLOPEX...') if petscconf.PRECISION != 'double': log.Exit('ERROR: BLOPEX is supported only in double precision.') # Create externalpackages directory externdir = 'externalpackages' if not os.path.exists(externdir): try: os.mkdir(externdir) except: sys.exit('ERROR: cannot create directory ' + externdir) # Download tarball packagename = 'blopex-1.1.2' if url=='': url = 'http://www.grycap.upv.es/slepc/download/external/'+packagename+'.tar.gz' archiveZip = 'blopex.tar.gz' localFile = os.sep.join([externdir,archiveZip]) log.Println('Downloading '+url+' to '+localFile) if os.path.exists(localFile): os.remove(localFile) try: urllib.urlretrieve(url, localFile) except Exception, e: name = 'blopex' filename = os.path.basename(urlparse.urlparse(url)[2]) failureMessage = '''\ Unable to download package %s from: %s * If your network is disconnected - please reconnect and rerun config/configure.py * Alternatively, you can download the above URL manually, to /yourselectedlocation/%s and use the configure option: --download-%s=/yourselectedlocation/%s ''' % (name, url, filename, name, filename) raise RuntimeError(failureMessage) # Uncompress tarball destDir = os.sep.join([externdir,packagename]) log.Println('Uncompressing '+localFile+' to directory '+destDir) if os.path.exists(destDir): for root, dirs, files in os.walk(destDir, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root, name)) try: if sys.version_info >= (2,5): import tarfile tar = tarfile.open(localFile, "r:gz") tar.extractall(path=externdir) tar.close() os.remove(localFile) else: result,output = commands.getstatusoutput('cd '+externdir+'; gunzip '+archiveZip+'; tar -xf '+archiveZip.split('.gz')[0]) os.remove(localFile.split('.gz')[0]) except RuntimeError, e: raise RuntimeError('Error uncompressing '+archiveZip+': '+str(e)) # Configure g = open(os.path.join(destDir,'Makefile.inc'),'w') g.write('CC = '+petscconf.CC+'\n') if petscconf.IND64: blopexint = ' -DBlopexInt="long long" ' else: blopexint = '' g.write('CFLAGS = '+petscconf.CC_FLAGS.replace('-Wall','').replace('-Wshadow','')+blopexint+'\n') g.write('AR = '+petscconf.AR+' '+petscconf.AR_FLAGS+'\n') g.write('AR_LIB_SUFFIX = '+petscconf.AR_LIB_SUFFIX+'\n') g.write('RANLIB = '+petscconf.RANLIB+'\n') g.write('TARGET_ARCH = \n') g.close() # Build package result,output = commands.getstatusoutput('cd '+destDir+'&&'+petscconf.MAKE+' clean &&'+petscconf.MAKE) log.write(output) # Move files incDir = os.sep.join([archdir,'include']) libDir = os.sep.join([archdir,'lib']) os.rename(os.path.join(destDir,'lib/libBLOPEX.'+petscconf.AR_LIB_SUFFIX),os.path.join(libDir,'libBLOPEX.'+petscconf.AR_LIB_SUFFIX)) for root, dirs, files in os.walk(os.path.join(destDir,'include')): for name in files: os.rename(os.path.join(destDir,'include/'+name),os.path.join(incDir,name)) # Write configuration files conf.write('#ifndef SLEPC_HAVE_BLOPEX\n#define SLEPC_HAVE_BLOPEX 1\n#endif\n\n') vars.write('BLOPEX_LIB = -L' + libDir + ' -lBLOPEX\n') cmake.write('set (SLEPC_HAVE_BLOPEX YES)\n') cmake.write('find_library (BLOPEX_LIB BLOPEX HINTS '+ libDir +')\n') return ['-L' + libDir] + ['-I' + incDir] slepc-3.4.2.dfsg.orig/config/petscversion.py0000644000175000017500000000314612211062077020002 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys def Load(petscdir): global VERSION,RELEASE,PATCHLEVEL,LVERSION try: f = open(os.sep.join([petscdir,'include','petscversion.h'])) for l in f.readlines(): l = l.split() if len(l) == 3: if l[1] == 'PETSC_VERSION_RELEASE': RELEASE = l[2] if l[1] == 'PETSC_VERSION_MAJOR': major = l[2] elif l[1] == 'PETSC_VERSION_MINOR': minor = l[2] elif l[1] == 'PETSC_VERSION_SUBMINOR': subminor = l[2] elif l[1] == 'PETSC_VERSION_PATCH': PATCHLEVEL = l[2] f.close() VERSION = major + '.' + minor LVERSION = major + '.' + minor + '.' + subminor except: sys.exit('ERROR: file error while reading PETSC version') slepc-3.4.2.dfsg.orig/config/lapack.py0000644000175000017500000000746612211062077016522 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import petscconf import log import check def Check(conf,vars,cmake,tmpdir): log.write('='*80) log.Println('Checking LAPACK library...') # LAPACK standard functions l = ['laev2','gehrd','lanhs','lange','getri','trexc','trevc','geevx','ggevx','gelqf','gesdd','tgexc','tgevc','pbtrf','stedc','hsein','larfg','larf','trsen','tgsen'] # LAPACK functions with different real and complex versions if petscconf.SCALAR == 'real': l += ['orghr','syevr','syevd','sytrd','sygvd','ormlq','orgqr','orgtr'] if petscconf.PRECISION == 'single': prefix = 's' elif petscconf.PRECISION == '__float128': prefix = 'q' else: prefix = 'd' else: l += ['unghr','heevr','heevd','hetrd','hegvd','unmlq','ungqr','ungtr'] if petscconf.PRECISION == 'single': prefix = 'c' elif petscconf.PRECISION == '__float128': prefix = 'w' else: prefix = 'z' # add prefix to LAPACK names functions = [] for i in l: functions.append(prefix + i) # in this case, the real name represents both versions namesubst = {'unghr':'orghr', 'heevr':'syevr', 'heevd':'syevd', 'hetrd':'sytrd', 'hegvd':'sygvd', 'unmlq':'ormlq', 'ungqr':'orgqr', 'ungtr':'orgtr'} # LAPACK functions which are always used in real version if petscconf.PRECISION == 'single': functions += ['sstevr','sbdsdc','slamch','slag2','slasv2','slartg','slaln2'] elif petscconf.PRECISION == '__float128': functions += ['qstevr','qbdsdc','qlamch','qlag2','qlasv2','qlartg','qlaln2'] else: functions += ['dstevr','dbdsdc','dlamch','dlag2','dlasv2','dlartg','dlaln2'] # check for all functions at once all = [] for i in functions: f = '#if defined(PETSC_BLASLAPACK_UNDERSCORE)\n' f += i + '_\n' f += '#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)\n' f += i.upper() + '\n' f += '#else\n' f += i + '\n' f += '#endif\n' all.append(f) log.write('=== Checking all LAPACK functions...') if check.Link(tmpdir,all,[],[]): return [] # check functions one by one missing = [] for i in functions: f = '#if defined(PETSC_BLASLAPACK_UNDERSCORE)\n' f += i + '_\n' f += '#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)\n' f += i.upper() + '\n' f += '#else\n' f += i + '\n' f += '#endif\n' log.write('=== Checking LAPACK '+i+' function...') if not check.Link(tmpdir,[f],[],[]): missing.append(i) # some complex functions are represented by their real names if i[1:] in namesubst: nf = namesubst[i[1:]] else: nf = i[1:] conf.write('#ifndef SLEPC_MISSING_LAPACK_' + nf.upper() + '\n#define SLEPC_MISSING_LAPACK_' + nf.upper() + ' 1\n#endif\n\n') cmake.write('set (SLEPC_MISSING_LAPACK_' + nf.upper() + ' YES)\n') if missing: cmake.write('mark_as_advanced (' + ''.join([s.upper()+' ' for s in missing]) + ')\n') return missing slepc-3.4.2.dfsg.orig/config/cmakegen.py0000755000175000017500000002535112211062077017035 0ustar gladkgladk#!/usr/bin/env python # This file generates $SLEPC_DIR/CMakeLists.txt by parsing the makefiles # throughout the source tree, reading their constraints and included # sources, and encoding the rules through CMake conditionals. When CMake # runs, it will use the conditionals written to # # $SLEPC_DIR/$PETSC_ARCH/conf/SLEPcConfig.cmake # # after a successful configure. # # The generated CMakeLists.txt is independent of PETSC_ARCH. # # This script supports one option: # --verbose : Show mismatches between makefiles and the filesystem import os from collections import deque # compatibility code for python-2.4 from http://code.activestate.com/recipes/523034-emulate-collectionsdefaultdict/ try: from collections import defaultdict except: class defaultdict(dict): def __init__(self, default_factory=None, *a, **kw): if (default_factory is not None and not hasattr(default_factory, '__call__')): raise TypeError('first argument must be callable') dict.__init__(self, *a, **kw) self.default_factory = default_factory def __getitem__(self, key): try: return dict.__getitem__(self, key) except KeyError: return self.__missing__(key) def __missing__(self, key): if self.default_factory is None: raise KeyError(key) self[key] = value = self.default_factory() return value def __reduce__(self): if self.default_factory is None: args = tuple() else: args = self.default_factory, return type(self), args, None, None, self.items() def copy(self): return self.__copy__() def __copy__(self): return type(self)(self.default_factory, self) def __deepcopy__(self, memo): import copy return type(self)(self.default_factory, copy.deepcopy(self.items())) def __repr__(self): return 'defaultdict(%s, %s)' % (self.default_factory, dict.__repr__(self)) # Run with --verbose VERBOSE = False MISTAKES = [] class StdoutLogger(object): def write(self,str): print(str) def cmakeconditional(key,val): def unexpected(): raise RuntimeError('Unexpected') if key in ['package', 'function', 'define']: return val if key == 'precision': if val == 'double': return 'PETSC_USE_REAL_DOUBLE' elif val == 'single': return 'PETSC_USE_REAL_SINGLE' raise RuntimeError('Unexpected precision: %r'%val) if key == 'scalar': if val == 'real': return 'NOT PETSC_USE_COMPLEX' if val == 'complex': return 'PETSC_USE_COMPLEX' raise RuntimeError('Unexpected scalar: %r'%val) if key == 'language': if val == 'CXXONLY': return 'PETSC_CLANGUAGE_Cxx' if val == 'CONLY': return 'PETSC_CLANGUAGE_C' raise RuntimeError('Unexpected language: %r'%val) raise RuntimeError('Unhandled case: %r=%r'%(key,val)) def pkgsources(pkg): ''' Walks the source tree associated with 'pkg', analyzes the conditional written into the makefiles, and returns a list of sources associated with each unique conditional (as a dictionary). ''' from distutils.sysconfig import parse_makefile autodirs = set('ftn-auto ftn-custom f90-custom'.split()) # Automatically recurse into these, if they exist skipdirs = set('examples benchmarks'.split()) # Skip these during the build def compareDirLists(mdirs,dirs): smdirs = set(mdirs) sdirs = set(dirs).difference(autodirs) if not smdirs.issubset(sdirs): MISTAKES.append('Makefile contains directory not on filesystem: %s: %r' % (root, sorted(smdirs - sdirs))) if not VERBOSE: return if smdirs != sdirs: from sys import stderr print >>stderr, ('Directory mismatch at %s:\n\t%s: %r\n\t%s: %r\n\t%s: %r' % (root, 'in makefile ',sorted(smdirs), 'on filesystem ',sorted(sdirs), 'symmetric diff',sorted(smdirs.symmetric_difference(sdirs)))) def compareSourceLists(msources, files): smsources = set(msources) ssources = set(f for f in files if os.path.splitext(f)[1] in ['.c', '.cxx', '.cc', '.cpp', '.F']) if not smsources.issubset(ssources): MISTAKES.append('Makefile contains file not on filesystem: %s: %r' % (root, sorted(smsources - ssources))) if not VERBOSE: return if smsources != ssources: from sys import stderr print >>stderr, ('Source mismatch at %s:\n\t%s: %r\n\t%s: %r\n\t%s: %r' % (root, 'in makefile ',sorted(smsources), 'on filesystem ',sorted(ssources), 'symmetric diff',sorted(smsources.symmetric_difference(ssources)))) allconditions = defaultdict(set) sources = defaultdict(deque) for root,dirs,files in os.walk(os.path.join('src',pkg)): conditions = allconditions[os.path.dirname(root)].copy() makefile = os.path.join(root,'makefile') if not os.path.exists(makefile): continue makevars = parse_makefile(makefile) mdirs = makevars.get('DIRS','').split() # Directories specified in the makefile compareDirLists(mdirs,dirs) # diagnostic output to find unused directories candidates = set(mdirs).union(autodirs).difference(skipdirs) dirs[:] = list(candidates.intersection(dirs)) lines = open(makefile) def stripsplit(line): return filter(lambda c: c!="'", line[len('#requires'):]).split() conditions.update(set(tuple(stripsplit(line)) for line in lines if line.startswith('#requires'))) lines.close() def relpath(filename): return os.path.join(root,filename) sourcec = makevars.get('SOURCEC','').split() sourcef = makevars.get('SOURCEF','').split() compareSourceLists(sourcec+sourcef, files) # Diagnostic output about unused source files sources[repr(sorted(conditions))].extend(relpath(f) for f in sourcec + sourcef) allconditions[root] = conditions return sources def writeRoot(f,petscdir,petscarch): f.write(r'''cmake_minimum_required (VERSION 2.6.2) project (SLEPc C) set (PETSc_SOURCE_DIR %s) set (PETSc_BINARY_DIR %s) include (${PETSc_BINARY_DIR}/conf/PETScConfig.cmake) include (${SLEPc_BINARY_DIR}/conf/SLEPcConfig.cmake) if (PETSC_HAVE_FORTRAN) enable_language (Fortran) endif () if (PETSC_CLANGUAGE_Cxx OR PETSC_HAVE_CXX) enable_language (CXX) endif () if (APPLE) SET(CMAKE_C_ARCHIVE_FINISH " -c ") SET(CMAKE_CXX_ARCHIVE_FINISH " -c ") SET(CMAKE_Fortran_ARCHIVE_FINISH " -c ") endif () include_directories ("${PETSc_SOURCE_DIR}/include" "${PETSc_BINARY_DIR}/include") include_directories ("${SLEPc_SOURCE_DIR}/include" "${SLEPc_BINARY_DIR}/include") add_definitions (-D__INSDIR__= ) # CMake always uses the absolute path set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${SLEPc_BINARY_DIR}/lib" CACHE PATH "Output directory for SLEPc archives") set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${SLEPc_BINARY_DIR}/lib" CACHE PATH "Output directory for SLEPc libraries") set (CMAKE_Fortran_MODULE_DIRECTORY "${SLEPc_BINARY_DIR}/include" CACHE PATH "Output directory for fortran *.mod files") mark_as_advanced (CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_Fortran_MODULE_DIRECTORY) set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) ################### The following describes the build #################### ''' % (petscdir,os.sep.join([petscdir,petscarch]))) def writePackage(f,pkg,pkgdeps): for conds, srcs in pkgsources(pkg).items(): conds = eval(conds) def body(indentlevel): indent = ' '*(indentlevel+2) lfindent = '\n'+indent return ' '*indentlevel + 'list (APPEND SLEPC' + pkg.upper() + '_SRCS' + lfindent + lfindent.join(srcs) + lfindent + ')\n' if conds: f.write('if (%s)\n%sendif ()\n' % (' AND '.join(cmakeconditional(*c) for c in conds), body(2))) else: f.write(body(0)) def main(slepcdir,petscdir,petscarch,log=StdoutLogger()): import tempfile, shutil written = False # We delete the temporary file if it wasn't finished, otherwise rename (atomic) fd,tmplists = tempfile.mkstemp(prefix='CMakeLists.txt.',dir=slepcdir,text=True) try: f = os.fdopen(fd,'w') writeRoot(f,petscdir,petscarch) f.write('include_directories (${PETSC_PACKAGE_INCLUDES} ${SLEPC_PACKAGE_INCLUDES})\n') pkglist = [('sys' , ''), ('vec' , 'sys'), ('ip' , 'sys'), ('ds' , 'sys'), ('fn' , 'sys'), ('st' , 'ip sys'), ('eps' , 'ip ds st vec sys'), ('svd' , 'eps ip ds sys'), ('qep' , 'eps st ip ds sys'), ('nep' , 'eps ip ds fn sys'), ('mfn' , 'ip ds fn sys')] for pkg,deps in pkglist: writePackage(f,pkg,deps.split()) f.write (''' add_library (slepc %s) target_link_libraries (slepc ${PETSC_LIB} ${SLEPC_PACKAGE_LIBS} ${PETSC_PACKAGE_LIBS}) if (PETSC_WIN32FE) set_target_properties (slepc PROPERTIES RULE_LAUNCH_COMPILE "${PETSC_WIN32FE}") set_target_properties (slepc PROPERTIES RULE_LAUNCH_LINK "${PETSC_WIN32FE}") endif () ''' % (' '.join([r'${SLEPC' + pkg.upper() + r'_SRCS}' for pkg,deps in pkglist]),)) f.write(''' if (PETSC_CLANGUAGE_Cxx) foreach (file IN LISTS %s) if (file MATCHES "^.*\\\\.c$") set_source_files_properties(${file} PROPERTIES LANGUAGE CXX) endif () endforeach () endif()''' % ('\n '.join([r'SLEPC' + pkg.upper() + r'_SRCS' for (pkg,_) in pkglist]))) written = True finally: f.close() if written: shutil.move(tmplists,os.path.join(slepcdir,'CMakeLists.txt')) else: os.remove(tmplists) if MISTAKES: for m in MISTAKES: log.write(m + '\n') raise RuntimeError('PETSc makefiles contain mistakes or files are missing on filesystem.\n%s\nPossible reasons:\n\t1. Files were deleted locally, try "hg update".\n\t2. Files were deleted from mercurial, but were not removed from makefile. Send mail to petsc-maint@mcs.anl.gov.\n\t3. Someone forgot "hg add" new files. Send mail to petsc-maint@mcs.anl.gov.' % ('\n'.join(MISTAKES))) if __name__ == "__main__": import optparse parser = optparse.OptionParser() parser.add_option('--verbose', help='Show mismatches between makefiles and the filesystem', dest='verbose', action='store_true', default=False) (opts, extra_args) = parser.parse_args() if opts.verbose: VERBOSE = True main(slepcdir=os.environ['SLEPC_DIR'],petscdir=os.environ['PETSC_DIR'],petscarch=os.environ['PETSC_ARCH']) slepc-3.4.2.dfsg.orig/config/primme.py0000644000175000017500000000455112211062077016550 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import petscconf import log import check def Check(conf,vars,cmake,tmpdir,directory,libs): log.write('='*80) log.Println('Checking PRIMME library...') if petscconf.PRECISION != 'double': log.Exit('ERROR: PRIMME is supported only in double precision.') functions_base = ['primme_set_method','primme_Free','primme_initialize'] if directory: dirs = [directory] else: dirs = check.GenerateGuesses('Primme') include = 'PRIMMESRC/COMMONSRC' if not libs: libs = ['-lprimme'] if petscconf.SCALAR == 'real': functions = functions_base + ['dprimme'] else: functions = functions_base + ['zprimme'] for d in dirs: if d: l = ['-L' + d] + libs f = ['-I' + d + '/' + include] else: l = libs f = [] if check.Link(tmpdir,functions,[],l+f): conf.write('#ifndef SLEPC_HAVE_PRIMME\n#define SLEPC_HAVE_PRIMME 1\n#endif\n\n') vars.write('PRIMME_LIB = ' + str.join(' ', l) + '\n') vars.write('PRIMME_FLAGS = ' + str.join(' ', f) + '\n') cmake.write('set (SLEPC_HAVE_PRIMME YES)\n') cmake.write('find_library (PRIMME_LIB primme HINTS '+ d +')\n') cmake.write('find_path (PRIMME_INCLUDE primme.h ' + d + '/PRIMMESRC/COMMONSRC)\n') return l+f log.Println('ERROR: Unable to link with PRIMME library') log.Println('ERROR: In directories '+''.join([s+' ' for s in dirs])) log.Println('ERROR: With flags '+''.join([s+' ' for s in libs])) log.Exit('') slepc-3.4.2.dfsg.orig/config/cmakeboot.py0000755000175000017500000001747512211062077017237 0ustar gladkgladk#!/usr/bin/env python # This file initializes a CMake build in $SLEPC_DIR/$PETSC_ARCH using # the compilers and flags determined by BuildSystem. It is imported and # called by configure.py during configures in which CMake was detected, # but it can also be run as a stand-alone program. The library paths and # flags should have been written to # # $PETSC_DIR/$PETSC_ARCH/conf/PETScConfig.cmake # $SLEPC_DIR/$PETSC_ARCH/conf/SLEPcConfig.cmake # # by configure before running this script. import os,sys,string from collections import deque sys.path.insert(0, os.path.join(os.environ['PETSC_DIR'],'config')) sys.path.insert(0, os.path.join(os.environ['PETSC_DIR'],'config','BuildSystem')) import script def noCheck(command, status, output, error): return def quoteIfNeeded(path): "Don't need quotes unless the path has bits that would confuse the shell" safe = string.letters + string.digits + os.path.sep + os.path.pardir + '-_' if set(path).issubset(safe): return path else: return '"' + path + '"' class StdoutLogger(object): def write(self,str): print(str) class PETScMaker(script.Script): def __init__(self, slepcdir, petscdir, petscarch, argDB = None, framework = None): import RDict if not argDB: argDB = RDict.RDict(None, None, 0, 0, readonly = True) argDB.saveFilename = os.path.join(petscdir,petscarch,'conf','RDict.db') argDB.load() script.Script.__init__(self, argDB = argDB) self.framework = framework self.slepcdir = slepcdir def __str__(self): return '' def setupModules(self): self.mpi = self.framework.require('config.packages.MPI', None) self.base = self.framework.require('config.base', None) self.setCompilers = self.framework.require('config.setCompilers', None) self.arch = self.framework.require('PETSc.utilities.arch', None) self.petscdir = self.framework.require('PETSc.utilities.petscdir', None) self.languages = self.framework.require('PETSc.utilities.languages', None) self.debugging = self.framework.require('PETSc.utilities.debugging', None) self.make = self.framework.require('config.programs', None) self.cmake = self.framework.require('PETSc.packages.cmake', None) self.CHUD = self.framework.require('PETSc.utilities.CHUD', None) self.compilers = self.framework.require('config.compilers', None) self.types = self.framework.require('config.types', None) self.headers = self.framework.require('config.headers', None) self.functions = self.framework.require('config.functions', None) self.libraries = self.framework.require('config.libraries', None) self.scalarType = self.framework.require('PETSc.utilities.scalarTypes', None) self.memAlign = self.framework.require('PETSc.utilities.memAlign', None) self.libraryOptions= self.framework.require('PETSc.utilities.libraryOptions', None) self.compilerFlags = self.framework.require('config.compilerFlags', self) return def setup(self): script.Script.setup(self) if not self.framework: self.framework = self.loadConfigure() self.setupModules() def cmakeboot(self, args, log): import shlex self.setup() options = deque() output,error,retcode = self.executeShellCommand([self.cmake.cmake, '--version'], checkCommand=noCheck, log=log) import re m = re.match(r'cmake version (.+)$', output) if not m: self.logPrintBox('Could not parse CMake version: %s, falling back to legacy build' % output) return False from distutils.version import LooseVersion version = LooseVersion(m.groups()[0]) if version < LooseVersion('2.6.2'): self.logPrintBox('CMake version %s < 2.6.2, falling back to legacy build' % version.vstring) return False if self.languages.clanguage == 'Cxx' and version < LooseVersion('2.8'): self.logPrintBox('Cannot use --with-clanguage=C++ with CMake version %s < 2.8, falling back to legacy build' % version.vstring) return False # no support for: set_source_files_properties(${file} PROPERTIES LANGUAGE CXX) langlist = [('C','C')] if hasattr(self.compilers,'FC'): langlist.append(('FC','Fortran')) if (self.languages.clanguage == 'Cxx'): langlist.append(('Cxx','CXX')) win32fe = None for petsclanguage,cmakelanguage in langlist: self.setCompilers.pushLanguage(petsclanguage) compiler = self.setCompilers.getCompiler() flags = [self.setCompilers.getCompilerFlags(), self.setCompilers.CPPFLAGS, self.CHUD.CPPFLAGS] if compiler.split()[0].endswith('win32fe'): # Hack to support win32fe without changing the rest of configure win32fe = compiler.split()[0] + '.exe' compiler = ' '.join(compiler.split()[1:]) options.append('-DCMAKE_'+cmakelanguage+'_COMPILER:FILEPATH=' + compiler) options.append('-DCMAKE_'+cmakelanguage+'_FLAGS:STRING=' + ''.join(flags)) self.setCompilers.popLanguage() options.append('-DCMAKE_AR='+self.setCompilers.AR) ranlib = shlex.split(self.setCompilers.RANLIB)[0] options.append('-DCMAKE_RANLIB='+ranlib) if win32fe: options.append('-DPETSC_WIN32FE:FILEPATH=%s'%win32fe) # Default on Windows is to generate Visual Studio project files, but # 1. the build process for those is different, need to give different build instructions # 2. the current WIN32FE workaround does not work with VS project files options.append('-GUnix Makefiles') cmd = [self.cmake.cmake, '--trace', '--debug-output', self.slepcdir] + map(lambda x:x.strip(), options) + args archdir = os.path.join(self.slepcdir, self.arch.arch) try: # Try to remove the old cache because some versions of CMake lose CMAKE_C_FLAGS when reconfiguring this way os.remove(os.path.join(archdir, 'CMakeCache.txt')) except OSError: pass import shutil # Try to remove all the old CMake files to avoid infinite loop (CMake-2.8.10.2, maybe other versions) # http://www.mail-archive.com/cmake@cmake.org/msg44765.html self.logPrint('Removing: %s' % os.path.join(archdir, 'CMakeFiles', version.vstring)) shutil.rmtree(os.path.join(archdir, 'CMakeFiles', version.vstring), ignore_errors=True) log.write('Invoking: %s\n' % cmd) output,error,retcode = self.executeShellCommand(cmd, checkCommand = noCheck, log=log, cwd=archdir, timeout=30) if retcode: self.logPrintBox('CMake setup incomplete (status %d), falling back to legacy build' % (retcode,)) self.logPrint('Output: '+output+'\nError: '+error) cachetxt = os.path.join(archdir, 'CMakeCache.txt') try: f = open(cachetxt, 'r') log.write('Contents of %s:\n' % cachetxt) log.write(f.read()) f.close() except IOError, e: log.write('Could not read file %s: %r\n' % (cachetxt, e)) return False else: return True # Configure successful def main(slepcdir, petscdir, petscarch, argDB=None, framework=None, log=StdoutLogger(), args=[]): # This can be called as a stand-alone program, or by importing it from # python. The latter functionality is needed because argDB does not # get written until the very end of configure, but we want to run this # automatically during configure (if CMake is available). # # Strangely, we can't store log in the PETScMaker because # (somewhere) it creeps into framework (which I don't want to modify) # and makes the result unpickleable. This is not a problem when run # as a standalone program (because the database is read-only), but is # not okay when called from configure. return PETScMaker(slepcdir,petscdir,petscarch,argDB,framework).cmakeboot(args,log) if __name__ == "__main__": main(slepcdir=os.environ['SLEPC_DIR'], petscdir=os.environ['PETSC_DIR'], petscarch=os.environ['PETSC_ARCH'], args=sys.argv[1:]) slepc-3.4.2.dfsg.orig/config/feast.py0000644000175000017500000000356412211062077016364 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import petscconf import log import check def Check(conf,vars,cmake,tmpdir,directory,libs): if petscconf.SCALAR != 'complex': log.Exit('ERROR: FEAST is supported only with complex numbers.') if (petscconf.PRECISION != 'single') & (petscconf.PRECISION != 'double'): log.Exit('ERROR: FEAST is supported only in single or double precision.') functions = ['feastinit'] if petscconf.SCALAR == 'real': if petscconf.PRECISION == 'single': functions += ['sfeast_srci'] else: functions += ['dfeast_srci'] else: if petscconf.PRECISION == 'single': functions += ['cfeast_hrci'] else: functions += ['zfeast_hrci'] if libs: libs = [libs] else: if petscconf.MPIUNI: libs = [['-lpfeast']] else: libs = [['-lfeast']] if directory: dirs = [directory] else: dirs = check.GenerateGuesses('Feast') return check.FortranLib(tmpdir,conf,vars,cmake,'FEAST',dirs,libs,functions) slepc-3.4.2.dfsg.orig/config/blzpack.py0000644000175000017500000000314612211062077016704 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import petscconf import log import check def Check(conf,vars,cmake,tmpdir,directory,libs): if petscconf.SCALAR == 'complex': log.Exit('ERROR: BLZPACK does not support complex numbers.') if (petscconf.PRECISION != 'single') & (petscconf.PRECISION != 'double'): log.Exit('ERROR: BLZPACK is supported only in single or double precision.') if petscconf.PRECISION == 'single': functions = ['blzdrs'] else: functions = ['blzdrd'] if libs: libs = [libs] else: libs = [['-lblzpack']] if directory: dirs = [directory] else: dirs = check.GenerateGuesses('Blzpack') return check.FortranLib(tmpdir,conf,vars,cmake,'BLZPACK',dirs,libs,functions) slepc-3.4.2.dfsg.orig/config/slepcversion.py0000644000175000017500000000314612211062077017772 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys def Load(slepcdir): global VERSION,RELEASE,PATCHLEVEL,LVERSION try: f = open(os.sep.join([slepcdir,'include','slepcversion.h'])) for l in f.readlines(): l = l.split() if len(l) == 3: if l[1] == 'SLEPC_VERSION_RELEASE': RELEASE = l[2] if l[1] == 'SLEPC_VERSION_MAJOR': major = l[2] elif l[1] == 'SLEPC_VERSION_MINOR': minor = l[2] elif l[1] == 'SLEPC_VERSION_SUBMINOR': subminor = l[2] elif l[1] == 'SLEPC_VERSION_PATCH': PATCHLEVEL = l[2] f.close() VERSION = major + '.' + minor LVERSION = major + '.' + minor + '.' + subminor except: sys.exit('ERROR: file error while reading SLEPC version') slepc-3.4.2.dfsg.orig/config/trlan.py0000644000175000017500000000275112211062077016377 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # import os import sys import petscconf import log import check def Check(conf,vars,cmake,tmpdir,directory,libs): if petscconf.SCALAR == 'complex': log.Exit('ERROR: TRLAN is not available for complex scalars.') if petscconf.PRECISION != 'double': log.Exit('ERROR: TRLAN is supported only in double precision.') functions = ['trlan77'] if libs: libs = [libs] else: libs = [['-ltrlan_mpi']] if directory: dirs = [directory] else: dirs = check.GenerateGuesses('TRLan') return check.FortranLib(tmpdir,conf,vars,cmake,'TRLAN',dirs,libs,functions) slepc-3.4.2.dfsg.orig/CTAGS0000644000175000017500000200557312211062077014233 0ustar gladkgladk!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ !_TAG_PROGRAM_NAME Exuberant Ctags // !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ !_TAG_PROGRAM_VERSION 5.8 // 10 src/eps/examples/tutorials/ex6f.F /^ 10 CONTINUE$/;" l subroutine:MVMISG file: 100 src/eps/examples/tests/test14f.F /^ 100 format (\/'Diagonal Eigenproblem, n =',I3,' (Fortran)')$/;" l program:main file: 100 src/eps/examples/tests/test15f.F /^ 100 format (\/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')$/;" l program:main file: 100 src/eps/examples/tests/test7f.F /^ 100 format (\/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')$/;" l program:main file: 100 src/eps/examples/tutorials/ex1f.F /^ 100 format (\/'1-D Laplacian Eigenproblem, n =',I3,' (Fortran)')$/;" l program:main file: 100 src/eps/examples/tutorials/ex1f90.F90 /^ 100 format (\/'1-D Laplacian Eigenproblem, n =',I4,' (Fortran)')$/;" l program:main file: 100 src/qep/examples/tutorials/ex16f90.F90 /^ 100 format (\/'Quadratic Eigenproblem, N=',I6,' (',I4,'x',I4,' grid)')$/;" l program:main file: 100 src/svd/examples/tutorials/ex15f.F /^ 100 format (\/'Lauchli SVD, n =',I3,', mu=',E12.4,' (Fortran)')$/;" l program:main file: 110 src/eps/examples/tests/test14f.F /^ 110 format (' Type set to ',A)$/;" l program:main file: 110 src/eps/examples/tutorials/ex1f.F /^ 110 format (\/' Number of iterations of the method:',I4)$/;" l program:main file: 110 src/svd/examples/tutorials/ex15f.F /^ 110 format (\/' Number of iterations of the method:',I4)$/;" l program:main file: 120 src/eps/examples/tests/test14f.F /^ 120 format (' Problem type before changing = ',I2)$/;" l program:main file: 120 src/eps/examples/tests/test15f.F /^ 120 format (' Solution method: ',A)$/;" l program:main file: 120 src/eps/examples/tests/test7f.F /^ 120 format (' Solution method: ',A)$/;" l program:main file: 120 src/eps/examples/tutorials/ex1f.F /^ 120 format (' Solution method: ',A)$/;" l program:main file: 120 src/eps/examples/tutorials/ex1f90.F90 /^ 120 format (' Solution method: ',A)$/;" l program:main file: 120 src/qep/examples/tutorials/ex16f90.F90 /^ 120 format (' Solution method: ',A)$/;" l program:main file: 120 src/svd/examples/tutorials/ex15f.F /^ 120 format (' Solution method: ',A)$/;" l program:main file: 130 src/eps/examples/tests/test14f.F /^ 130 format (' ... changed to ',I2)$/;" l program:main file: 130 src/eps/examples/tests/test15f.F /^ 130 format (' Number of requested eigenvalues:',I2)$/;" l program:main file: 130 src/eps/examples/tests/test7f.F /^ 130 format (' Number of requested eigenvalues:',I2)$/;" l program:main file: 130 src/eps/examples/tutorials/ex1f.F /^ 130 format (' Number of requested eigenvalues:',I2)$/;" l program:main file: 130 src/eps/examples/tutorials/ex1f90.F90 /^ 130 format (' Number of requested eigenvalues:',I4)$/;" l program:main file: 130 src/qep/examples/tutorials/ex16f90.F90 /^ 130 format (' Number of requested eigenvalues:',I4)$/;" l program:main file: 130 src/svd/examples/tutorials/ex15f.F /^ 130 format (' Number of requested singular values:',I2)$/;" l program:main file: 140 src/eps/examples/tests/test14f.F /^ 140 format (' Extraction before changing = ',I2)$/;" l program:main file: 140 src/eps/examples/tests/test15f.F /^ 140 format(i3,' EPS nconv=',i2,' first unconverged value (error) ', &$/;" l subroutine:MyEPSMonitor file: 140 src/eps/examples/tutorials/ex1f.F /^ 140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)$/;" l program:main file: 140 src/qep/examples/tutorials/ex16f90.F90 /^ 140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)$/;" l program:main file: 140 src/svd/examples/tutorials/ex15f.F /^ 140 format (' Stopping condition: tol=',1P,E10.4,', maxit=',I4)$/;" l program:main file: 150 src/eps/examples/tests/test14f.F /^ 150 format (' ... changed to ',I2)$/;" l program:main file: 150 src/eps/examples/tutorials/ex1f.F /^ 150 format (' Number of converged eigenpairs:',I2\/)$/;" l program:main file: 150 src/svd/examples/tutorials/ex15f.F /^ 150 format (' Number of converged approximate singular triplets:',I2\/)$/;" l program:main file: 160 src/eps/examples/tests/test14f.F /^ 160 format (' Balance: ',I2,', its=',I2,', cutoff=',F8.6)$/;" l program:main file: 160 src/eps/examples/tutorials/ex1f.F /^ 160 format (1P,' ',E12.4,' ',E12.4)$/;" l program:main file: 160 src/svd/examples/tutorials/ex15f.F /^ 160 format (1P,' ',E12.4,' ',E12.4)$/;" l program:main file: 170 src/eps/examples/tests/test14f.F /^ 170 format (' Which = ',I2,', target = ',F3.1)$/;" l program:main file: 180 src/eps/examples/tests/test14f.F /^ 180 format (' Dimensions: nev=',I2,', ncv=',I2,', mpd=',I2)$/;" l program:main file: 190 src/eps/examples/tests/test14f.F /^ 190 format (' Tolerance =',F7.5,', max_its =',I4)$/;" l program:main file: 20 src/eps/examples/tutorials/ex6f.F /^ 20 CONTINUE $/;" l subroutine:MVMISG file: 200 src/eps/examples/tests/test14f.F /^ 200 format (' Convergence test =',I2)$/;" l program:main file: 210 src/eps/examples/tests/test14f.F /^ 210 format (' Finished - converged reason =',I2,', its=',I4)$/;" l program:main file: 30 src/eps/examples/tutorials/ex6f.F /^ 30 CONTINUE $/;" l subroutine:MVMISG file: 40 src/eps/examples/tutorials/ex6f.F /^ 40 CONTINUE $/;" l subroutine:MVMISG file: 50 src/eps/examples/tutorials/ex6f.F /^ 50 CONTINUE$/;" l subroutine:MVMISG file: 60 src/eps/examples/tutorials/ex6f.F /^ 60 CONTINUE$/;" l subroutine:MVMISG file: 999 src/eps/examples/tutorials/ex6f.F /^ 999 continue$/;" l program:main file: A include/slepc-private/mfnimpl.h /^ Mat A; \/* the problem matrix *\/$/;" m struct:_p_MFN A include/slepc-private/nepimpl.h /^ Mat *A; \/* matrix coefficients of split form *\/$/;" m struct:_p_NEP A include/slepc-private/stimpl.h /^ Mat *A; \/* Matrices which define the eigensystem *\/$/;" m struct:_p_ST A include/slepc-private/svdimpl.h /^ Mat A; \/* problem matrix (m>n) *\/$/;" m struct:_p_SVD A src/eps/examples/tutorials/ex1f90.F90 /^ type(Mat) A$/;" v program:main A src/eps/impls/davidson/common/davidson.h /^ Mat A, B; \/* Problem matrices *\/$/;" m struct:_dvdDashboard A src/eps/impls/external/primme/primme.c /^ Mat A; \/* problem matrix *\/$/;" m struct:__anon1 file: A src/qep/impls/linear/linearp.h /^ Mat A,B; \/* matrices of generalized eigenproblem *\/$/;" m struct:__anon1 ARPACKnaupd_ src/eps/impls/external/arpack/arpackp.h /^#define ARPACKnaupd_(/;" d ARPACKneupd_ src/eps/impls/external/arpack/arpackp.h /^#define ARPACKneupd_(/;" d ARPACKsaupd_ src/eps/impls/external/arpack/arpackp.h /^#define ARPACKsaupd_(/;" d ARPACKseupd_ src/eps/impls/external/arpack/arpackp.h /^#define ARPACKseupd_(/;" d AT include/slepc-private/svdimpl.h /^ Mat AT; \/* transposed matrix *\/$/;" m struct:_p_SVD AV src/eps/impls/cg/rqcg/rqcg.c /^ Vec *AV,*BV,*P,*G;$/;" m struct:__anon1 file: AV src/eps/impls/davidson/common/davidson.h /^ *AV, \/* A*V *\/$/;" m struct:_dvdDashboard AV src/eps/impls/krylov/lanczos/lanczos.c /^ Vec *AV;$/;" m struct:__anon1 file: AV src/eps/impls/subspace/subspace.c /^ Vec *AV;$/;" m struct:__anon1 file: AddNorm2 src/vec/veccomp.c /^PETSC_STATIC_INLINE void AddNorm2(PetscReal *ssq,PetscReal *scale,PetscReal x)$/;" f ApplicationCtx src/nep/examples/tutorials/ex20.c /^} ApplicationCtx;$/;" t typeref:struct:__anon1 file: ApplicationCtx src/nep/examples/tutorials/ex21.c /^} ApplicationCtx;$/;" t typeref:struct:__anon3 file: Aq src/eps/impls/external/feast/feastp.h /^ PetscScalar *work1,*work2,*Aq,*Bq; \/* workspace *\/$/;" m struct:__anon1 ArrowTridiag src/ds/impls/hep/dshep.c /^static PetscErrorCode ArrowTridiag(PetscBLASInt n,PetscReal *d,PetscReal *e,PetscScalar *Q,PetscBLASInt ld)$/;" f file: Astate include/slepc-private/stimpl.h /^ PetscInt *Astate; \/* State (to identify the original matrices) *\/$/;" m struct:_p_ST B src/eps/impls/davidson/common/davidson.h /^ Mat A, B; \/* Problem matrices *\/$/;" m struct:_dvdDashboard B src/qep/impls/linear/linearp.h /^ Mat A,B; \/* matrices of generalized eigenproblem *\/$/;" m struct:__anon1 BDS src/eps/impls/davidson/common/davidson.h /^ *BDS; \/* B * eps->DV *\/$/;" m struct:_dvdDashboard BLASrot_ include/slepcblaslapack.h /^#define BLASrot_ /;" d BLASsymm_ include/slepcblaslapack.h /^#define BLASsymm_(/;" d BLZistorr_ src/eps/impls/external/blzpack/blzpackp.h /^#define BLZistorr_ /;" d BLZpack_ src/eps/impls/external/blzpack/blzpackp.h /^#define BLZpack_ /;" d BLZrstorr_ src/eps/impls/external/blzpack/blzpackp.h /^#define BLZrstorr_ /;" d BV src/eps/impls/cg/rqcg/rqcg.c /^ Vec *AV,*BV,*P,*G;$/;" m struct:__anon1 file: BV src/eps/impls/davidson/common/davidson.h /^ *BV, \/* B*V *\/$/;" m struct:_dvdDashboard BV_shift src/eps/impls/davidson/common/davidson.h /^ BV_shift, \/* if true BV is shifted when vectors converge *\/$/;" m struct:_dvdDashboard BcX src/eps/impls/davidson/common/davidson.h /^ *BcX, \/* basis of B*cX *\/$/;" m struct:_dvdDashboard BlockHankel src/eps/impls/ciss/ciss.c /^static PetscErrorCode BlockHankel(EPS eps,PetscScalar *Mu,PetscInt s,Vec *H)$/;" f file: Bq src/eps/impls/external/feast/feastp.h /^ PetscScalar *work1,*work2,*Aq,*Bq; \/* workspace *\/$/;" m struct:__anon1 Bx include/slepc-private/ipimpl.h /^ Vec Bx;$/;" m struct:_p_IP C include/slepc-private/qepimpl.h /^ Mat M,C,K; \/* problem matrices *\/$/;" m struct:_p_QEP C src/qep/examples/tutorials/ex16f90.F90 /^ type(Mat) M, C,/;" v program:main C src/qep/impls/linear/linearp.h /^ Mat M,C,K; \/* copy of QEP coefficient matrices *\/$/;" m struct:__anon1 CFLAGS include/finclude/makefile /^CFLAGS =$/;" m CFLAGS include/makefile /^CFLAGS =$/;" m CFLAGS include/slepc-private/makefile /^CFLAGS =$/;" m CFLAGS src/ds/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/ghep/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/ghiep/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/gnhep/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/hep/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/nep/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/nhep/makefile /^CFLAGS =$/;" m CFLAGS src/ds/impls/svd/makefile /^CFLAGS =$/;" m CFLAGS src/ds/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/ds/interface/makefile /^CFLAGS =$/;" m CFLAGS src/eps/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/eps/examples/tutorials/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/cg/rqcg/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/ciss/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/davidson/common/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/davidson/gd/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/davidson/jd/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/davidson/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/external/arpack/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/external/blopex/makefile /^CFLAGS = ${BLOPEX_INCLUDE} -DBlopexInt=PetscInt$/;" m CFLAGS src/eps/impls/external/blzpack/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/external/feast/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/external/primme/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/external/primme/makefile /^CFLAGS = ${PRIMME_FLAGS}$/;" m CFLAGS src/eps/impls/external/trlan/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/krylov/arnoldi/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/krylov/krylovschur/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/krylov/lanczos/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/krylov/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/lapack/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/power/makefile /^CFLAGS =$/;" m CFLAGS src/eps/impls/subspace/makefile /^CFLAGS =$/;" m CFLAGS src/eps/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/eps/interface/makefile /^CFLAGS =$/;" m CFLAGS src/fn/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/fn/makefile /^CFLAGS =$/;" m CFLAGS src/ip/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/ip/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/ip/makefile /^CFLAGS =$/;" m CFLAGS src/mfn/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/mfn/examples/tutorials/makefile /^CFLAGS =$/;" m CFLAGS src/mfn/impls/krylov/makefile /^CFLAGS =$/;" m CFLAGS src/mfn/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/mfn/interface/makefile /^CFLAGS =$/;" m CFLAGS src/nep/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/nep/examples/tutorials/makefile /^CFLAGS =$/;" m CFLAGS src/nep/impls/narnoldi/makefile /^CFLAGS =$/;" m CFLAGS src/nep/impls/rii/makefile /^CFLAGS =$/;" m CFLAGS src/nep/impls/slp/makefile /^CFLAGS =$/;" m CFLAGS src/nep/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/nep/interface/makefile /^CFLAGS =$/;" m CFLAGS src/qep/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/qep/examples/tutorials/makefile /^CFLAGS =$/;" m CFLAGS src/qep/impls/linear/makefile /^CFLAGS =$/;" m CFLAGS src/qep/impls/qarnoldi/makefile /^CFLAGS =$/;" m CFLAGS src/qep/impls/qlanczos/makefile /^CFLAGS =$/;" m CFLAGS src/qep/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/qep/interface/makefile /^CFLAGS =$/;" m CFLAGS src/st/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/st/examples/tutorials/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/cayley/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/fold/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/precond/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/shell/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/shell/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/shift/makefile /^CFLAGS =$/;" m CFLAGS src/st/impls/sinvert/makefile /^CFLAGS =$/;" m CFLAGS src/st/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/st/interface/makefile /^CFLAGS =$/;" m CFLAGS src/svd/examples/tests/makefile /^CFLAGS =$/;" m CFLAGS src/svd/examples/tutorials/makefile /^CFLAGS =$/;" m CFLAGS src/svd/impls/cross/makefile /^CFLAGS =$/;" m CFLAGS src/svd/impls/cyclic/makefile /^CFLAGS =$/;" m CFLAGS src/svd/impls/lanczos/makefile /^CFLAGS =$/;" m CFLAGS src/svd/impls/lapack/makefile /^CFLAGS =$/;" m CFLAGS src/svd/impls/trlanczos/makefile /^CFLAGS =$/;" m CFLAGS src/svd/interface/ftn-custom/makefile /^CFLAGS =$/;" m CFLAGS src/svd/interface/makefile /^CFLAGS =$/;" m CFLAGS src/sys/f90-mod/makefile /^CFLAGS =$/;" m CFLAGS src/sys/ftn-custom/makefile /^CFLAGS = -DSLEPC_LIB_DIR='"${SLEPC_DESTDIR}\/lib"'$/;" m CFLAGS src/sys/makefile /^CFLAGS =$/;" m CFLAGS src/vec/makefile /^CFLAGS =$/;" m CISSVecSetRandom src/eps/impls/ciss/ciss.c /^static PetscErrorCode CISSVecSetRandom(Vec x,PetscRandom rctx)$/;" f file: CLEANFILES src/sys/f90-mod/makefile /^CLEANFILES = *.mod$/;" m COMM_ARG src/eps/impls/external/arpack/arpackp.h /^#define COMM_ARG /;" d COMM_ARG src/eps/impls/external/arpack/arpackp.h /^#define COMM_ARG$/;" d CPPFLAGS src/ds/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/eps/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/eps/examples/tutorials/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/fn/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/ip/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/mfn/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/mfn/examples/tutorials/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/nep/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/nep/examples/tutorials/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/qep/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/qep/examples/tutorials/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/st/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/st/examples/tutorials/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/svd/examples/tests/makefile /^CPPFLAGS =$/;" m CPPFLAGS src/svd/examples/tutorials/makefile /^CPPFLAGS =$/;" m CTX_BRUSSEL src/eps/examples/tutorials/ex9.c /^} CTX_BRUSSEL;$/;" t typeref:struct:__anon1 file: CalcMu src/eps/impls/ciss/ciss.c /^static PetscErrorCode CalcMu(EPS eps,PetscScalar *Mu)$/;" f file: Check config/arpack.py /^def Check(conf,vars,cmake,tmpdir,directory,libs):$/;" f Check config/blzpack.py /^def Check(conf,vars,cmake,tmpdir,directory,libs):$/;" f Check config/feast.py /^def Check(conf,vars,cmake,tmpdir,directory,libs):$/;" f Check config/lapack.py /^def Check(conf,vars,cmake,tmpdir):$/;" f Check config/primme.py /^def Check(conf,vars,cmake,tmpdir,directory,libs):$/;" f Check config/trlan.py /^def Check(conf,vars,cmake,tmpdir,directory,libs):$/;" f CheckSolution src/nep/examples/tutorials/ex20.c /^PetscErrorCode CheckSolution(PetscScalar lambda,Vec y,PetscReal *error,void *ctx)$/;" f CleanDenseSchur src/ds/impls/gnhep/dsgnhep.c /^static PetscErrorCode CleanDenseSchur(PetscInt n,PetscInt k,PetscScalar *S,PetscInt ldS,PetscScalar *T,PetscInt ldT,PetscScalar *X,PetscInt ldX,PetscScalar *Y,PetscInt ldY,PetscBool doProd)$/;" f file: ConstructS src/eps/impls/ciss/ciss.c /^static PetscErrorCode ConstructS(EPS eps,PetscInt M,Vec **S)$/;" f file: D include/slepc-private/epsimpl.h /^ Vec D; \/* diagonal matrix for balancing *\/$/;" m struct:_p_EPS D include/slepc-private/stimpl.h /^ Vec D; \/* diagonal matrix for balancing *\/$/;" m struct:_p_ST DATAPATH src/eps/examples/tutorials/makefile /^DATAPATH = ${SLEPC_DIR}\/share\/slepc\/datafiles\/matrices$/;" m DATAPATH src/qep/examples/tutorials/makefile /^DATAPATH = ${SLEPC_DIR}\/share\/slepc\/datafiles\/matrices$/;" m DATAPATH src/svd/examples/tutorials/makefile /^DATAPATH = ${SLEPC_DIR}\/share\/slepc\/datafiles\/matrices$/;" m DIRS include/finclude/makefile /^DIRS = $/;" m DIRS include/makefile /^DIRS = finclude slepc-private$/;" m DIRS include/slepc-private/makefile /^DIRS = $/;" m DIRS makefile /^DIRS = src include docs$/;" m DIRS src/ds/examples/makefile /^DIRS = tests$/;" m DIRS src/ds/impls/ghep/makefile /^DIRS =$/;" m DIRS src/ds/impls/ghiep/makefile /^DIRS =$/;" m DIRS src/ds/impls/gnhep/makefile /^DIRS =$/;" m DIRS src/ds/impls/hep/makefile /^DIRS =$/;" m DIRS src/ds/impls/makefile /^DIRS = hep nhep ghep ghiep gnhep svd nep$/;" m DIRS src/ds/impls/nep/makefile /^DIRS =$/;" m DIRS src/ds/impls/nhep/makefile /^DIRS =$/;" m DIRS src/ds/impls/svd/makefile /^DIRS =$/;" m DIRS src/ds/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/ds/interface/makefile /^DIRS =$/;" m DIRS src/ds/makefile /^DIRS = interface impls examples$/;" m DIRS src/eps/examples/makefile /^DIRS = tests tutorials$/;" m DIRS src/eps/impls/cg/makefile /^DIRS = rqcg$/;" m DIRS src/eps/impls/cg/rqcg/makefile /^DIRS =$/;" m DIRS src/eps/impls/ciss/makefile /^DIRS =$/;" m DIRS src/eps/impls/davidson/common/makefile /^DIRS =$/;" m DIRS src/eps/impls/davidson/gd/makefile /^DIRS =$/;" m DIRS src/eps/impls/davidson/jd/makefile /^DIRS =$/;" m DIRS src/eps/impls/davidson/makefile /^DIRS = common gd jd$/;" m DIRS src/eps/impls/external/arpack/makefile /^DIRS =$/;" m DIRS src/eps/impls/external/blopex/makefile /^DIRS =$/;" m DIRS src/eps/impls/external/blzpack/makefile /^DIRS =$/;" m DIRS src/eps/impls/external/feast/makefile /^DIRS =$/;" m DIRS src/eps/impls/external/makefile /^DIRS = arpack blopex blzpack primme trlan feast$/;" m DIRS src/eps/impls/external/primme/ftn-custom/makefile /^DIRS =$/;" m DIRS src/eps/impls/external/primme/makefile /^DIRS =$/;" m DIRS src/eps/impls/external/trlan/makefile /^DIRS =$/;" m DIRS src/eps/impls/krylov/arnoldi/makefile /^DIRS =$/;" m DIRS src/eps/impls/krylov/krylovschur/makefile /^DIRS =$/;" m DIRS src/eps/impls/krylov/lanczos/makefile /^DIRS =$/;" m DIRS src/eps/impls/krylov/makefile /^DIRS = arnoldi lanczos krylovschur$/;" m DIRS src/eps/impls/lapack/makefile /^DIRS =$/;" m DIRS src/eps/impls/makefile /^DIRS = power subspace krylov davidson cg ciss lapack external$/;" m DIRS src/eps/impls/power/makefile /^DIRS =$/;" m DIRS src/eps/impls/subspace/makefile /^DIRS =$/;" m DIRS src/eps/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/eps/interface/makefile /^DIRS =$/;" m DIRS src/eps/makefile /^DIRS = interface impls examples$/;" m DIRS src/fn/examples/makefile /^DIRS = tests$/;" m DIRS src/fn/makefile /^DIRS =$/;" m DIRS src/ip/examples/makefile /^DIRS = tests$/;" m DIRS src/ip/ftn-custom/makefile /^DIRS =$/;" m DIRS src/ip/makefile /^DIRS =$/;" m DIRS src/makefile /^DIRS = eps st svd qep nep mfn ip ds fn sys vec$/;" m DIRS src/mfn/examples/makefile /^DIRS = tests tutorials$/;" m DIRS src/mfn/impls/krylov/makefile /^DIRS =$/;" m DIRS src/mfn/impls/makefile /^DIRS = krylov$/;" m DIRS src/mfn/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/mfn/interface/makefile /^DIRS =$/;" m DIRS src/mfn/makefile /^DIRS = interface impls examples$/;" m DIRS src/nep/examples/makefile /^DIRS = tests tutorials$/;" m DIRS src/nep/impls/makefile /^DIRS = rii slp narnoldi$/;" m DIRS src/nep/impls/narnoldi/makefile /^DIRS =$/;" m DIRS src/nep/impls/rii/makefile /^DIRS =$/;" m DIRS src/nep/impls/slp/makefile /^DIRS =$/;" m DIRS src/nep/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/nep/interface/makefile /^DIRS =$/;" m DIRS src/nep/makefile /^DIRS = interface impls examples$/;" m DIRS src/qep/examples/makefile /^DIRS = tests tutorials$/;" m DIRS src/qep/impls/linear/makefile /^DIRS =$/;" m DIRS src/qep/impls/makefile /^DIRS = linear qarnoldi qlanczos$/;" m DIRS src/qep/impls/qarnoldi/makefile /^DIRS =$/;" m DIRS src/qep/impls/qlanczos/makefile /^DIRS =$/;" m DIRS src/qep/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/qep/interface/makefile /^DIRS =$/;" m DIRS src/qep/makefile /^DIRS = interface impls examples$/;" m DIRS src/st/examples/makefile /^DIRS = tests tutorials$/;" m DIRS src/st/impls/cayley/makefile /^DIRS =$/;" m DIRS src/st/impls/fold/makefile /^DIRS =$/;" m DIRS src/st/impls/makefile /^DIRS = shell shift sinvert cayley fold precond$/;" m DIRS src/st/impls/precond/makefile /^DIRS =$/;" m DIRS src/st/impls/shell/ftn-custom/makefile /^DIRS =$/;" m DIRS src/st/impls/shell/makefile /^DIRS =$/;" m DIRS src/st/impls/shift/makefile /^DIRS =$/;" m DIRS src/st/impls/sinvert/makefile /^DIRS =$/;" m DIRS src/st/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/st/interface/makefile /^DIRS =$/;" m DIRS src/st/makefile /^DIRS = interface impls examples$/;" m DIRS src/svd/examples/makefile /^DIRS = tests tutorials$/;" m DIRS src/svd/impls/cross/makefile /^DIRS =$/;" m DIRS src/svd/impls/cyclic/makefile /^DIRS =$/;" m DIRS src/svd/impls/lanczos/makefile /^DIRS =$/;" m DIRS src/svd/impls/lapack/makefile /^DIRS =$/;" m DIRS src/svd/impls/makefile /^DIRS = cross cyclic lapack lanczos trlanczos$/;" m DIRS src/svd/impls/trlanczos/makefile /^DIRS =$/;" m DIRS src/svd/interface/ftn-custom/makefile /^DIRS =$/;" m DIRS src/svd/interface/makefile /^DIRS =$/;" m DIRS src/svd/makefile /^DIRS = interface impls examples$/;" m DIRS src/sys/ftn-custom/makefile /^DIRS =$/;" m DIRS src/sys/makefile /^DIRS = f90-mod$/;" m DIRS src/vec/makefile /^DIRS =$/;" m DS include/finclude/slepcdsdef.h /^#define DS /;" d DS include/slepcds.h /^typedef struct _p_DS* DS;$/;" t typeref:struct:_p_DS DSAllocate src/ds/interface/dsbasic.c /^PetscErrorCode DSAllocate(DS ds,PetscInt ld)$/;" f DSAllocateMatReal_Private src/ds/interface/dspriv.c /^PetscErrorCode DSAllocateMatReal_Private(DS ds,DSMatType m)$/;" f DSAllocateMat_Private src/ds/interface/dspriv.c /^PetscErrorCode DSAllocateMat_Private(DS ds,DSMatType m)$/;" f DSAllocateWork_Private src/ds/interface/dspriv.c /^PetscErrorCode DSAllocateWork_Private(DS ds,PetscInt s,PetscInt r,PetscInt i)$/;" f DSAllocate_GHEP src/ds/impls/ghep/dsghep.c /^PetscErrorCode DSAllocate_GHEP(DS ds,PetscInt ld)$/;" f DSAllocate_GHIEP src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSAllocate_GHIEP(DS ds,PetscInt ld)$/;" f DSAllocate_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSAllocate_GNHEP(DS ds,PetscInt ld)$/;" f DSAllocate_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSAllocate_HEP(DS ds,PetscInt ld)$/;" f DSAllocate_NEP src/ds/impls/nep/dsnep.c /^PetscErrorCode DSAllocate_NEP(DS ds,PetscInt ld)$/;" f DSAllocate_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSAllocate_NHEP(DS ds,PetscInt ld)$/;" f DSAllocate_SVD src/ds/impls/svd/dssvd.c /^PetscErrorCode DSAllocate_SVD(DS ds,PetscInt ld)$/;" f DSAppendOptionsPrefix src/ds/interface/dsbasic.c /^PetscErrorCode DSAppendOptionsPrefix(DS ds,const char *prefix)$/;" f DSComputeFunction src/ds/interface/dsops.c /^PetscErrorCode DSComputeFunction(DS ds,SlepcFunction f)$/;" f DSComputeMatrix src/ds/interface/dspriv.c /^PetscErrorCode DSComputeMatrix(DS ds,PetscScalar lambda,PetscBool deriv,DSMatType mat)$/;" f DSCond src/ds/interface/dsops.c /^PetscErrorCode DSCond(DS ds,PetscReal *cond)$/;" f DSCond_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSCond_HEP(DS ds,PetscReal *cond)$/;" f DSCond_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSCond_NHEP(DS ds,PetscReal *cond)$/;" f DSCopyMatrix_Private src/ds/interface/dspriv.c /^PetscErrorCode DSCopyMatrix_Private(DS ds,DSMatType dst,DSMatType src)$/;" f DSCreate src/ds/interface/dsbasic.c /^PetscErrorCode DSCreate(MPI_Comm comm,DS *newds)$/;" f DSCreate_GHEP src/ds/impls/ghep/dsghep.c /^PETSC_EXTERN PetscErrorCode DSCreate_GHEP(DS ds)$/;" f DSCreate_GHIEP src/ds/impls/ghiep/dsghiep.c /^PETSC_EXTERN PetscErrorCode DSCreate_GHIEP(DS ds)$/;" f DSCreate_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PETSC_EXTERN PetscErrorCode DSCreate_GNHEP(DS ds)$/;" f DSCreate_HEP src/ds/impls/hep/dshep.c /^PETSC_EXTERN PetscErrorCode DSCreate_HEP(DS ds)$/;" f DSCreate_NEP src/ds/impls/nep/dsnep.c /^PETSC_EXTERN PetscErrorCode DSCreate_NEP(DS ds)$/;" f DSCreate_NHEP src/ds/impls/nhep/dsnhep.c /^PETSC_EXTERN PetscErrorCode DSCreate_NHEP(DS ds)$/;" f DSCreate_SVD src/ds/impls/svd/dssvd.c /^PETSC_EXTERN PetscErrorCode DSCreate_SVD(DS ds)$/;" f DSDestroy src/ds/interface/dsbasic.c /^PetscErrorCode DSDestroy(DS *ds)$/;" f DSFinalizePackage src/ds/interface/dsbasic.c /^PetscErrorCode DSFinalizePackage(void)$/;" f DSFunction_EXP_HEP_DIAG src/ds/impls/hep/dshep.c /^PetscErrorCode DSFunction_EXP_HEP_DIAG(DS ds)$/;" f DSFunction_EXP_NHEP_PADE src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSFunction_EXP_NHEP_PADE(DS ds)$/;" f DSGHEP include/finclude/slepcdsdef.h /^#define DSGHEP /;" d DSGHEP include/slepcds.h /^#define DSGHEP /;" d DSGHIEP include/finclude/slepcdsdef.h /^#define DSGHIEP /;" d DSGHIEP include/slepcds.h /^#define DSGHIEP /;" d DSGHIEPComplexEigs src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSGHIEPComplexEigs(DS ds,PetscInt n0,PetscInt n1,PetscScalar *wr,PetscScalar *wi)$/;" f DSGHIEPInverseIteration src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSGHIEPInverseIteration(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSGHIEPOrthogEigenv src/ds/impls/ghiep/dsghiep_ivit.c /^PetscErrorCode DSGHIEPOrthogEigenv(DS ds,DSMatType mat,PetscScalar *wr,PetscScalar *wi,PetscBool accum)$/;" f DSGHIEPRealBlocks src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSGHIEPRealBlocks(DS ds)$/;" f DSGHIEP_Eigen3DQDS src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode DSGHIEP_Eigen3DQDS(PetscInt n,PetscReal *a,PetscReal *b,PetscReal *c,PetscScalar *wr,PetscScalar *wi,PetscReal *work,PetscInt nw)$/;" f file: DSGNHEP include/finclude/slepcdsdef.h /^#define DSGNHEP /;" d DSGNHEP include/slepcds.h /^#define DSGNHEP /;" d DSGetArray src/ds/interface/dsops.c /^PetscErrorCode DSGetArray(DS ds,DSMatType m,PetscScalar *a[])$/;" f DSGetArrayReal src/ds/interface/dsops.c /^PetscErrorCode DSGetArrayReal(DS ds,DSMatType m,PetscReal *a[])$/;" f DSGetCompact src/ds/interface/dsbasic.c /^PetscErrorCode DSGetCompact(DS ds,PetscBool *comp)$/;" f DSGetDimensions src/ds/interface/dsops.c /^PetscErrorCode DSGetDimensions(DS ds,PetscInt *n,PetscInt *m,PetscInt *l,PetscInt *k,PetscInt *t)$/;" f DSGetEigenvalueComparison src/ds/interface/dsbasic.c /^PetscErrorCode DSGetEigenvalueComparison(DS ds,PetscErrorCode (**fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void** ctx)$/;" f DSGetExtraRow src/ds/interface/dsbasic.c /^PetscErrorCode DSGetExtraRow(DS ds,PetscBool *ext)$/;" f DSGetFN src/ds/interface/dsbasic.c /^PetscErrorCode DSGetFN(DS ds,PetscInt k,FN *f)$/;" f DSGetFunctionMethod src/ds/interface/dsbasic.c /^PetscErrorCode DSGetFunctionMethod(DS ds,PetscInt *meth)$/;" f DSGetLeadingDimension src/ds/interface/dsops.c /^PetscErrorCode DSGetLeadingDimension(DS ds,PetscInt *ld)$/;" f DSGetMethod src/ds/interface/dsbasic.c /^PetscErrorCode DSGetMethod(DS ds,PetscInt *meth)$/;" f DSGetNumFN src/ds/interface/dsbasic.c /^PetscErrorCode DSGetNumFN(DS ds,PetscInt *n)$/;" f DSGetOptionsPrefix src/ds/interface/dsbasic.c /^PetscErrorCode DSGetOptionsPrefix(DS ds,const char *prefix[])$/;" f DSGetRefined src/ds/interface/dsbasic.c /^PetscErrorCode DSGetRefined(DS ds,PetscBool *ref)$/;" f DSGetState src/ds/interface/dsops.c /^PetscErrorCode DSGetState(DS ds,DSStateType *state)$/;" f DSGetType src/ds/interface/dsbasic.c /^PetscErrorCode DSGetType(DS ds,DSType *type)$/;" f DSHEP include/finclude/slepcdsdef.h /^#define DSHEP /;" d DSHEP include/slepcds.h /^#define DSHEP /;" d DSInitializePackage src/ds/interface/dsbasic.c /^PetscErrorCode DSInitializePackage()$/;" f DSIntermediate_GHIEP src/ds/impls/ghiep/dsghiep_ivit.c /^PetscErrorCode DSIntermediate_GHIEP(DS ds)$/;" f DSIntermediate_HEP src/ds/impls/hep/dshep.c /^static PetscErrorCode DSIntermediate_HEP(DS ds)$/;" f file: DSList include/slepcds.h /^PETSC_EXTERN PetscFunctionList DSList;$/;" v DSList src/ds/interface/dsbasic.c /^PetscFunctionList DSList = 0;$/;" v DSMatExtra include/slepcds.h /^PETSC_EXTERN DSMatType DSMatExtra[];$/;" v DSMatExtra src/ds/interface/dsbasic.c /^DSMatType DSMatExtra[DS_NUM_EXTRA] = {DS_MAT_E0,DS_MAT_E1,DS_MAT_E2,DS_MAT_E3,DS_MAT_E4,DS_MAT_E5,DS_MAT_E6,DS_MAT_E7,DS_MAT_E8,DS_MAT_E9};$/;" v DSMatName include/slepc-private/dsimpl.h /^PETSC_INTERN const char *DSMatName[];$/;" v DSMatName src/ds/interface/dsbasic.c /^const char *DSMatName[DS_NUM_MAT] = {"A","B","C","T","D","F","Q","Z","X","Y","U","VT","W","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9"};$/;" v DSMatType include/finclude/slepcdsdef.h /^#define DSMatType /;" d DSMatType include/slepcds.h /^ DS_NUM_MAT } DSMatType;$/;" t typeref:enum:__anon2 DSNEP include/finclude/slepcdsdef.h /^#define DSNEP /;" d DSNEP include/slepcds.h /^#define DSNEP /;" d DSNHEP include/finclude/slepcdsdef.h /^#define DSNHEP /;" d DSNHEP include/slepcds.h /^#define DSNHEP /;" d DSNormalize src/ds/interface/dsops.c /^PetscErrorCode DSNormalize(DS ds,DSMatType mat,PetscInt col)$/;" f DSNormalize_GHEP src/ds/impls/ghep/dsghep.c /^PetscErrorCode DSNormalize_GHEP(DS ds,DSMatType mat,PetscInt col)$/;" f DSNormalize_GHIEP src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSNormalize_GHIEP(DS ds,DSMatType mat,PetscInt col)$/;" f DSNormalize_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSNormalize_GNHEP(DS ds,DSMatType mat,PetscInt col)$/;" f DSNormalize_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSNormalize_HEP(DS ds,DSMatType mat,PetscInt col)$/;" f DSNormalize_NEP src/ds/impls/nep/dsnep.c /^PetscErrorCode DSNormalize_NEP(DS ds,DSMatType mat,PetscInt col)$/;" f DSNormalize_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSNormalize_NHEP(DS ds,DSMatType mat,PetscInt col)$/;" f DSOps include/slepc-private/dsimpl.h /^typedef struct _DSOps *DSOps;$/;" t typeref:struct:_DSOps DSOrthogonalize src/ds/interface/dspriv.c /^PetscErrorCode DSOrthogonalize(DS ds,DSMatType mat,PetscInt cols,PetscInt *lindcols)$/;" f DSPackageInitialized src/ds/interface/dsbasic.c /^static PetscBool DSPackageInitialized = PETSC_FALSE;$/;" v file: DSPermuteBoth_Private src/ds/interface/dspriv.c /^PetscErrorCode DSPermuteBoth_Private(DS ds,PetscInt l,PetscInt n,DSMatType mat1,DSMatType mat2,PetscInt *perm)$/;" f DSPermuteColumns_Private src/ds/interface/dspriv.c /^PetscErrorCode DSPermuteColumns_Private(DS ds,PetscInt l,PetscInt n,DSMatType mat,PetscInt *perm)$/;" f DSPermuteRows_Private src/ds/interface/dspriv.c /^PetscErrorCode DSPermuteRows_Private(DS ds,PetscInt l,PetscInt n,DSMatType mat,PetscInt *perm)$/;" f DSPseudoOrthogonalize src/ds/interface/dspriv.c /^PetscErrorCode DSPseudoOrthogonalize(DS ds,DSMatType mat,PetscInt cols,PetscReal *s,PetscInt *lindcols,PetscReal *ns)$/;" f DSQEP include/finclude/slepcdsdef.h /^#define DSQEP /;" d DSQEP include/slepcds.h /^#define DSQEP /;" d DSRegister src/ds/interface/dsbasic.c /^PetscErrorCode DSRegister(const char *name,PetscErrorCode (*function)(DS))$/;" f DSRegisterAll src/ds/interface/dsbasic.c /^PetscErrorCode DSRegisterAll(void)$/;" f DSRegisterAllCalled include/slepcds.h /^PETSC_EXTERN PetscBool DSRegisterAllCalled;$/;" v DSRegisterAllCalled src/ds/interface/dsbasic.c /^PetscBool DSRegisterAllCalled = PETSC_FALSE;$/;" v DSReset src/ds/interface/dsbasic.c /^PetscErrorCode DSReset(DS ds)$/;" f DSRestoreArray src/ds/interface/dsops.c /^PetscErrorCode DSRestoreArray(DS ds,DSMatType m,PetscScalar *a[])$/;" f DSRestoreArrayReal src/ds/interface/dsops.c /^PetscErrorCode DSRestoreArrayReal(DS ds,DSMatType m,PetscReal *a[])$/;" f DSSVD include/finclude/slepcdsdef.h /^#define DSSVD /;" d DSSVD include/slepcds.h /^#define DSSVD /;" d DSSetCompact src/ds/interface/dsbasic.c /^PetscErrorCode DSSetCompact(DS ds,PetscBool comp)$/;" f DSSetDimensions src/ds/interface/dsops.c /^PetscErrorCode DSSetDimensions(DS ds,PetscInt n,PetscInt m,PetscInt l,PetscInt k)$/;" f DSSetEigenvalueComparison src/ds/interface/dsbasic.c /^PetscErrorCode DSSetEigenvalueComparison(DS ds,PetscErrorCode (*fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)$/;" f DSSetExtraRow src/ds/interface/dsbasic.c /^PetscErrorCode DSSetExtraRow(DS ds,PetscBool ext)$/;" f DSSetFN src/ds/interface/dsbasic.c /^PetscErrorCode DSSetFN(DS ds,PetscInt n,FN f[])$/;" f DSSetFromOptions src/ds/interface/dsbasic.c /^PetscErrorCode DSSetFromOptions(DS ds)$/;" f DSSetFunctionMethod src/ds/interface/dsbasic.c /^PetscErrorCode DSSetFunctionMethod(DS ds,PetscInt meth)$/;" f DSSetIdentity src/ds/interface/dspriv.c /^PetscErrorCode DSSetIdentity(DS ds,DSMatType mat)$/;" f DSSetMethod src/ds/interface/dsbasic.c /^PetscErrorCode DSSetMethod(DS ds,PetscInt meth)$/;" f DSSetOptionsPrefix src/ds/interface/dsbasic.c /^PetscErrorCode DSSetOptionsPrefix(DS ds,const char *prefix)$/;" f DSSetRefined src/ds/interface/dsbasic.c /^PetscErrorCode DSSetRefined(DS ds,PetscBool ref)$/;" f DSSetState src/ds/interface/dsops.c /^PetscErrorCode DSSetState(DS ds,DSStateType state)$/;" f DSSetType src/ds/interface/dsbasic.c /^PetscErrorCode DSSetType(DS ds,DSType type)$/;" f DSSolve src/ds/interface/dsops.c /^PetscErrorCode DSSolve(DS ds,PetscScalar *eigr,PetscScalar *eigi)$/;" f DSSolve_GHEP src/ds/impls/ghep/dsghep.c /^PetscErrorCode DSSolve_GHEP(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_GHIEP_DQDS_II src/ds/impls/ghiep/dsghiep_dqds.c /^PetscErrorCode DSSolve_GHIEP_DQDS_II(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_GHIEP_HZ src/ds/impls/ghiep/dsghiep_hz.c /^PetscErrorCode DSSolve_GHIEP_HZ(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_GHIEP_QR src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSSolve_GHIEP_QR(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_GHIEP_QR_II src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSSolve_GHIEP_QR_II(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSSolve_GNHEP(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_HEP_DC src/ds/impls/hep/dshep.c /^PetscErrorCode DSSolve_HEP_DC(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_HEP_MRRR src/ds/impls/hep/dshep.c /^PetscErrorCode DSSolve_HEP_MRRR(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_HEP_QR src/ds/impls/hep/dshep.c /^PetscErrorCode DSSolve_HEP_QR(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_NEP_SLP src/ds/impls/nep/dsnep.c /^PetscErrorCode DSSolve_NEP_SLP(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSSolve_NHEP(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSolve_SVD_DC src/ds/impls/svd/dssvd.c /^PetscErrorCode DSSolve_SVD_DC(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSort src/ds/interface/dsops.c /^PetscErrorCode DSSort(DS ds,PetscScalar *eigr,PetscScalar *eigi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSortEigenvaluesReal_Private src/ds/interface/dspriv.c /^PetscErrorCode DSSortEigenvaluesReal_Private(DS ds,PetscReal *eig,PetscInt *perm)$/;" f DSSortEigenvalues_Private src/ds/interface/dspriv.c /^PetscErrorCode DSSortEigenvalues_Private(DS ds,PetscScalar *wr,PetscScalar *wi,PetscInt *perm,PetscBool isghiep)$/;" f DSSort_GHEP src/ds/impls/ghep/dsghep.c /^PetscErrorCode DSSort_GHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_GHIEP src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSSort_GHIEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSSort_GNHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_GNHEP_Arbitrary src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSSort_GNHEP_Arbitrary(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_GNHEP_Total src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSSort_GNHEP_Total(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSort_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSSort_HEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_NEP src/ds/impls/nep/dsnep.c /^PetscErrorCode DSSort_NEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSSort_NHEP(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_NHEP_Arbitrary src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSSort_NHEP_Arbitrary(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSSort_NHEP_Total src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSSort_NHEP_Total(DS ds,PetscScalar *wr,PetscScalar *wi)$/;" f DSSort_SVD src/ds/impls/svd/dssvd.c /^PetscErrorCode DSSort_SVD(DS ds,PetscScalar *wr,PetscScalar *wi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)$/;" f DSStateType include/finclude/slepcdsdef.h /^#define DSStateType /;" d DSStateType include/slepcds.h /^ DS_STATE_TRUNCATED } DSStateType;$/;" t typeref:enum:__anon1 DSSwitchFormat_GHIEP src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSSwitchFormat_GHIEP(DS ds,PetscBool tocompact)$/;" f DSSwitchFormat_HEP src/ds/impls/hep/dshep.c /^static PetscErrorCode DSSwitchFormat_HEP(DS ds,PetscBool tocompact)$/;" f file: DSSwitchFormat_SVD src/ds/impls/svd/dssvd.c /^static PetscErrorCode DSSwitchFormat_SVD(DS ds,PetscBool tocompact)$/;" f file: DSTranslateHarmonic src/ds/interface/dsops.c /^PetscErrorCode DSTranslateHarmonic(DS ds,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *g,PetscReal *gamma)$/;" f DSTranslateHarmonic_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSTranslateHarmonic_NHEP(DS ds,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *gin,PetscReal *gamma)$/;" f DSTranslateRKS src/ds/interface/dsops.c /^PetscErrorCode DSTranslateRKS(DS ds,PetscScalar alpha)$/;" f DSTranslateRKS_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSTranslateRKS_HEP(DS ds,PetscScalar alpha)$/;" f DSTruncate src/ds/interface/dsops.c /^PetscErrorCode DSTruncate(DS ds,PetscInt n)$/;" f DSTruncate_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSTruncate_HEP(DS ds,PetscInt n)$/;" f DSTruncate_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSTruncate_NHEP(DS ds,PetscInt n)$/;" f DSType include/finclude/slepcdsdef.h /^#define DSType /;" d DSType include/slepcds.h /^typedef const char* DSType;$/;" t DSUpdateExtraRow src/ds/interface/dsops.c /^PetscErrorCode DSUpdateExtraRow(DS ds)$/;" f DSUpdateExtraRow_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSUpdateExtraRow_HEP(DS ds)$/;" f DSUpdateExtraRow_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSUpdateExtraRow_NHEP(DS ds)$/;" f DSVectors src/ds/interface/dsops.c /^PetscErrorCode DSVectors(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)$/;" f DSVectors_GHEP src/ds/impls/ghep/dsghep.c /^PetscErrorCode DSVectors_GHEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)$/;" f DSVectors_GHIEP src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSVectors_GHIEP(DS ds,DSMatType mat,PetscInt *k,PetscReal *rnorm)$/;" f DSVectors_GHIEP_Eigen_Some src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSVectors_GHIEP_Eigen_Some(DS ds,PetscInt *idx,PetscReal *rnorm)$/;" f DSVectors_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSVectors_GNHEP(DS ds,DSMatType mat,PetscInt *k,PetscReal *rnorm)$/;" f DSVectors_GNHEP_Eigen_All src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSVectors_GNHEP_Eigen_All(DS ds,PetscBool left)$/;" f DSVectors_GNHEP_Eigen_Some src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSVectors_GNHEP_Eigen_Some(DS ds,PetscInt *k,PetscBool left)$/;" f DSVectors_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSVectors_HEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)$/;" f DSVectors_NEP src/ds/impls/nep/dsnep.c /^PetscErrorCode DSVectors_NEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)$/;" f DSVectors_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSVectors_NHEP(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)$/;" f DSVectors_NHEP_Eigen_All src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSVectors_NHEP_Eigen_All(DS ds,PetscBool left)$/;" f DSVectors_NHEP_Eigen_Some src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSVectors_NHEP_Eigen_Some(DS ds,PetscInt *k,PetscReal *rnorm,PetscBool left)$/;" f DSVectors_NHEP_Refined_All src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSVectors_NHEP_Refined_All(DS ds,PetscBool left)$/;" f DSVectors_NHEP_Refined_Some src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSVectors_NHEP_Refined_Some(DS ds,PetscInt *k,PetscReal *rnorm,PetscBool left)$/;" f DSVectors_SVD src/ds/impls/svd/dssvd.c /^PetscErrorCode DSVectors_SVD(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)$/;" f DSView src/ds/interface/dsbasic.c /^PetscErrorCode DSView(DS ds,PetscViewer viewer)$/;" f DSViewMat_Private src/ds/interface/dspriv.c /^PetscErrorCode DSViewMat_Private(DS ds,PetscViewer viewer,DSMatType m)$/;" f DSView_GHEP src/ds/impls/ghep/dsghep.c /^PetscErrorCode DSView_GHEP(DS ds,PetscViewer viewer)$/;" f DSView_GHIEP src/ds/impls/ghiep/dsghiep.c /^PetscErrorCode DSView_GHIEP(DS ds,PetscViewer viewer)$/;" f DSView_GNHEP src/ds/impls/gnhep/dsgnhep.c /^PetscErrorCode DSView_GNHEP(DS ds,PetscViewer viewer)$/;" f DSView_HEP src/ds/impls/hep/dshep.c /^PetscErrorCode DSView_HEP(DS ds,PetscViewer viewer)$/;" f DSView_NEP src/ds/impls/nep/dsnep.c /^PetscErrorCode DSView_NEP(DS ds,PetscViewer viewer)$/;" f DSView_NHEP src/ds/impls/nhep/dsnhep.c /^PetscErrorCode DSView_NHEP(DS ds,PetscViewer viewer)$/;" f DSView_SVD src/ds/impls/svd/dssvd.c /^PetscErrorCode DSView_SVD(DS ds,PetscViewer viewer)$/;" f DS_CLASSID include/slepcds.h /^PETSC_EXTERN PetscClassId DS_CLASSID;$/;" v DS_CLASSID src/ds/interface/dsbasic.c /^PetscClassId DS_CLASSID = 0;$/;" v DS_Function include/slepc-private/dsimpl.h /^PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other;$/;" v DS_Function src/ds/interface/dsbasic.c /^PetscLogEvent DS_Solve = 0,DS_Function = 0,DS_Vectors = 0,DS_Other = 0;$/;" v DS_MAT_A include/slepcds.h /^typedef enum { DS_MAT_A,$/;" e enum:__anon2 DS_MAT_B include/slepcds.h /^ DS_MAT_B,$/;" e enum:__anon2 DS_MAT_C include/slepcds.h /^ DS_MAT_C,$/;" e enum:__anon2 DS_MAT_D include/slepcds.h /^ DS_MAT_D,$/;" e enum:__anon2 DS_MAT_E0 include/slepcds.h /^ DS_MAT_E0,$/;" e enum:__anon2 DS_MAT_E1 include/slepcds.h /^ DS_MAT_E1,$/;" e enum:__anon2 DS_MAT_E2 include/slepcds.h /^ DS_MAT_E2,$/;" e enum:__anon2 DS_MAT_E3 include/slepcds.h /^ DS_MAT_E3,$/;" e enum:__anon2 DS_MAT_E4 include/slepcds.h /^ DS_MAT_E4,$/;" e enum:__anon2 DS_MAT_E5 include/slepcds.h /^ DS_MAT_E5,$/;" e enum:__anon2 DS_MAT_E6 include/slepcds.h /^ DS_MAT_E6,$/;" e enum:__anon2 DS_MAT_E7 include/slepcds.h /^ DS_MAT_E7,$/;" e enum:__anon2 DS_MAT_E8 include/slepcds.h /^ DS_MAT_E8,$/;" e enum:__anon2 DS_MAT_E9 include/slepcds.h /^ DS_MAT_E9,$/;" e enum:__anon2 DS_MAT_F include/slepcds.h /^ DS_MAT_F,$/;" e enum:__anon2 DS_MAT_Q include/slepcds.h /^ DS_MAT_Q,$/;" e enum:__anon2 DS_MAT_T include/slepcds.h /^ DS_MAT_T,$/;" e enum:__anon2 DS_MAT_U include/slepcds.h /^ DS_MAT_U,$/;" e enum:__anon2 DS_MAT_VT include/slepcds.h /^ DS_MAT_VT,$/;" e enum:__anon2 DS_MAT_W include/slepcds.h /^ DS_MAT_W,$/;" e enum:__anon2 DS_MAT_X include/slepcds.h /^ DS_MAT_X,$/;" e enum:__anon2 DS_MAT_Y include/slepcds.h /^ DS_MAT_Y,$/;" e enum:__anon2 DS_MAT_Z include/slepcds.h /^ DS_MAT_Z,$/;" e enum:__anon2 DS_MAX_FUN include/slepcds.h /^#define DS_MAX_FUN /;" d DS_MAX_SOLVE include/slepcds.h /^#define DS_MAX_SOLVE /;" d DS_NUM_EXTRA include/slepcds.h /^#define DS_NUM_EXTRA /;" d DS_NUM_MAT include/slepcds.h /^ DS_NUM_MAT } DSMatType;$/;" e enum:__anon2 DS_Other include/slepc-private/dsimpl.h /^PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other;$/;" v DS_Other src/ds/interface/dsbasic.c /^PetscLogEvent DS_Solve = 0,DS_Function = 0,DS_Vectors = 0,DS_Other = 0;$/;" v DS_STATE_CONDENSED include/slepcds.h /^ DS_STATE_CONDENSED,$/;" e enum:__anon1 DS_STATE_INTERMEDIATE include/slepcds.h /^ DS_STATE_INTERMEDIATE,$/;" e enum:__anon1 DS_STATE_RAW include/slepcds.h /^typedef enum { DS_STATE_RAW,$/;" e enum:__anon1 DS_STATE_TRUNCATED include/slepcds.h /^ DS_STATE_TRUNCATED } DSStateType;$/;" e enum:__anon1 DS_Solve include/slepc-private/dsimpl.h /^PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other;$/;" v DS_Solve src/ds/interface/dsbasic.c /^PetscLogEvent DS_Solve = 0,DS_Function = 0,DS_Vectors = 0,DS_Other = 0;$/;" v DS_Vectors include/slepc-private/dsimpl.h /^PETSC_EXTERN PetscLogEvent DS_Solve,DS_Function,DS_Vectors,DS_Other;$/;" v DS_Vectors src/ds/interface/dsbasic.c /^PetscLogEvent DS_Solve = 0,DS_Function = 0,DS_Vectors = 0,DS_Other = 0;$/;" v DVD_CHECKSUM src/eps/impls/davidson/common/dvd_schm.c /^#define DVD_CHECKSUM(/;" d file: DVD_COMPLEX_RAYLEIGH_QUOTIENT src/eps/impls/davidson/common/dvd_gd2.c /^#define DVD_COMPLEX_RAYLEIGH_QUOTIENT(/;" d file: DVD_COMPLEX_RAYLEIGH_QUOTIENT src/eps/impls/davidson/common/dvd_improvex.c /^#define DVD_COMPLEX_RAYLEIGH_QUOTIENT(/;" d file: DVD_COMPUTE_N_RR src/eps/impls/davidson/common/dvd_gd2.c /^#define DVD_COMPUTE_N_RR(/;" d file: DVD_COMPUTE_N_RR src/eps/impls/davidson/common/dvd_improvex.c /^#define DVD_COMPUTE_N_RR(/;" d file: DVD_EP_HERMITIAN src/eps/impls/davidson/common/davidson.h /^#define DVD_EP_HERMITIAN /;" d DVD_EP_INDEFINITE src/eps/impls/davidson/common/davidson.h /^#define DVD_EP_INDEFINITE /;" d DVD_EP_STD src/eps/impls/davidson/common/davidson.h /^#define DVD_EP_STD /;" d DVD_FL_ADD src/eps/impls/davidson/common/davidson.h /^#define DVD_FL_ADD(/;" d DVD_FL_ADD_BEGIN src/eps/impls/davidson/common/davidson.h /^#define DVD_FL_ADD_BEGIN(/;" d DVD_FL_ADD_END src/eps/impls/davidson/common/davidson.h /^#define DVD_FL_ADD_END(/;" d DVD_FL_ADD_END0 src/eps/impls/davidson/common/davidson.h /^#define DVD_FL_ADD_END0(/;" d DVD_FL_CALL src/eps/impls/davidson/common/davidson.h /^#define DVD_FL_CALL(/;" d DVD_FL_DEL src/eps/impls/davidson/common/davidson.h /^#define DVD_FL_DEL(/;" d DVD_HARM_LEIGS src/eps/impls/davidson/common/davidson.h /^ DVD_HARM_LEIGS$/;" e enum:__anon2 DVD_HARM_NONE src/eps/impls/davidson/common/davidson.h /^ DVD_HARM_NONE,$/;" e enum:__anon2 DVD_HARM_REIGS src/eps/impls/davidson/common/davidson.h /^ DVD_HARM_REIGS,$/;" e enum:__anon2 DVD_HARM_RR src/eps/impls/davidson/common/davidson.h /^ DVD_HARM_RR,$/;" e enum:__anon2 DVD_HARM_RRR src/eps/impls/davidson/common/davidson.h /^ DVD_HARM_RRR,$/;" e enum:__anon2 DVD_INITV_CLASSIC src/eps/impls/davidson/common/davidson.h /^ DVD_INITV_CLASSIC,$/;" e enum:__anon3 DVD_INITV_KRYLOV src/eps/impls/davidson/common/davidson.h /^ DVD_INITV_KRYLOV$/;" e enum:__anon3 DVD_IS src/eps/impls/davidson/common/davidson.h /^#define DVD_IS(/;" d DVD_ISNOT src/eps/impls/davidson/common/davidson.h /^#define DVD_ISNOT(/;" d DVD_MAT_COMPLEX src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_COMPLEX /;" d DVD_MAT_DIAG src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_DIAG /;" d DVD_MAT_HERMITIAN src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_HERMITIAN /;" d DVD_MAT_IDENTITY src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_IDENTITY /;" d DVD_MAT_IMPLICIT src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_IMPLICIT /;" d DVD_MAT_LTRIANG src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_LTRIANG /;" d DVD_MAT_NEG_DEF src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_NEG_DEF /;" d DVD_MAT_POS_DEF src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_POS_DEF /;" d DVD_MAT_SINGULAR src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_SINGULAR /;" d DVD_MAT_TRIANG src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_TRIANG /;" d DVD_MAT_UNITARY src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_UNITARY /;" d DVD_MAT_UTRIANG src/eps/impls/davidson/common/davidson.h /^#define DVD_MAT_UTRIANG /;" d DVD_METH_GD src/eps/impls/davidson/common/davidson.h /^ DVD_METH_GD,$/;" e enum:__anon5 DVD_METH_GD2 src/eps/impls/davidson/common/davidson.h /^ DVD_METH_GD2$/;" e enum:__anon5 DVD_METH_JD src/eps/impls/davidson/common/davidson.h /^ DVD_METH_JD,$/;" e enum:__anon5 DVD_PROJ_KXX src/eps/impls/davidson/common/davidson.h /^ DVD_PROJ_KXX,$/;" e enum:__anon4 DVD_PROJ_KZX src/eps/impls/davidson/common/davidson.h /^ DVD_PROJ_KZX$/;" e enum:__anon4 DVD_STAGE_CALCPAIRS src/eps/impls/davidson/common/dvd_utils.c /^#define DVD_STAGE_CALCPAIRS /;" d file: DVD_STAGE_IMPROVEX src/eps/impls/davidson/common/dvd_utils.c /^#define DVD_STAGE_IMPROVEX /;" d file: DVD_STAGE_INITV src/eps/impls/davidson/common/dvd_utils.c /^#define DVD_STAGE_INITV /;" d file: DVD_STAGE_NEWITER src/eps/impls/davidson/common/dvd_utils.c /^#define DVD_STAGE_NEWITER /;" d file: DVD_STAGE_ORTHV src/eps/impls/davidson/common/dvd_utils.c /^#define DVD_STAGE_ORTHV /;" d file: DVD_STAGE_UPDATEV src/eps/impls/davidson/common/dvd_utils.c /^#define DVD_STAGE_UPDATEV /;" d file: DVD_STATE_CONF src/eps/impls/davidson/common/davidson.h /^#define DVD_STATE_CONF /;" d DVD_STATE_PRECONF src/eps/impls/davidson/common/davidson.h /^#define DVD_STATE_PRECONF /;" d DVD_STATE_RUN src/eps/impls/davidson/common/davidson.h /^#define DVD_STATE_RUN /;" d DenseTridiagonal src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode DenseTridiagonal(PetscInt n_,PetscReal *D,PetscReal *E,PetscReal *w,PetscScalar *V)$/;" f file: DvOps src/vec/veccomp.c /^static struct _VecOps DvOps = {VecDuplicate_Comp, \/* 1 *\/$/;" v typeref:struct:_VecOps file: DvdMult_copy_func src/eps/impls/davidson/common/davidson.h /^} DvdMult_copy_func;$/;" t typeref:struct:__anon9 DvdProfiler src/eps/impls/davidson/common/dvd_utils.c /^} DvdProfiler;$/;" t typeref:struct:__anon16 file: DvdReduction src/eps/impls/davidson/common/davidson.h /^} DvdReduction;$/;" t typeref:struct:__anon8 DvdReductionChunk src/eps/impls/davidson/common/davidson.h /^} DvdReductionChunk;$/;" t typeref:struct:__anon7 DvdReductionPostF src/eps/impls/davidson/common/davidson.h /^typedef PetscErrorCode (*DvdReductionPostF)(PetscScalar*,PetscInt,void*);$/;" t EPS bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer EPS;$/;" t EPS include/finclude/slepcepsdef.h /^#define EPS /;" d EPS include/slepceps.h /^typedef struct _p_EPS* EPS;$/;" t typeref:struct:_p_EPS EPS src/qep/examples/tests/makefile /^EPS = krylovschur arnoldi gd jd gd2$/;" m EPS src/st/examples/tests/makefile /^EPS = krylovschur arnoldi gd jd$/;" m EPS src/svd/examples/tests/makefile /^EPS = krylovschur arnoldi lanczos gd jd$/;" m EPSALL src/eps/examples/tests/makefile /^EPSALL = krylovschur arnoldi lanczos gd jd gd2$/;" m EPSAR src/eps/examples/tests/makefile /^EPSAR = gd jd gd2$/;" m EPSARNOLDI include/finclude/slepcepsdef.h /^#define EPSARNOLDI /;" d EPSARNOLDI include/slepceps.h /^#define EPSARNOLDI /;" d EPSARPACK include/finclude/slepcepsdef.h /^#define EPSARPACK /;" d EPSARPACK include/slepceps.h /^#define EPSARPACK /;" d EPSAllocateSolution src/eps/interface/mem.c /^PetscErrorCode EPSAllocateSolution(EPS eps)$/;" f EPSAppendOptionsPrefix src/eps/interface/opts.c /^PetscErrorCode EPSAppendOptionsPrefix(EPS eps,const char *prefix)$/;" f EPSArnoldiGetDelayed src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSArnoldiGetDelayed(EPS eps,PetscBool *delayed)$/;" f EPSArnoldiGetDelayed_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^static PetscErrorCode EPSArnoldiGetDelayed_Arnoldi(EPS eps,PetscBool *delayed)$/;" f file: EPSArnoldiSetDelayed src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSArnoldiSetDelayed(EPS eps,PetscBool delayed)$/;" f EPSArnoldiSetDelayed_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^static PetscErrorCode EPSArnoldiSetDelayed_Arnoldi(EPS eps,PetscBool delayed)$/;" f file: EPSBLOPEX include/finclude/slepcepsdef.h /^#define EPSBLOPEX /;" d EPSBLOPEX include/slepceps.h /^#define EPSBLOPEX /;" d EPSBLZPACK include/finclude/slepcepsdef.h /^#define EPSBLZPACK /;" d EPSBLZPACK include/slepceps.h /^#define EPSBLZPACK /;" d EPSBackTransform_ARPACK src/eps/impls/external/arpack/arpack.c /^PetscErrorCode EPSBackTransform_ARPACK(EPS eps)$/;" f EPSBackTransform_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSBackTransform_BLZPACK(EPS eps)$/;" f EPSBackTransform_Default src/eps/interface/default.c /^PetscErrorCode EPSBackTransform_Default(EPS eps)$/;" f EPSBackTransform_Power src/eps/impls/power/power.c /^PetscErrorCode EPSBackTransform_Power(EPS eps)$/;" f EPSBalance include/finclude/slepcepsdef.h /^#define EPSBalance /;" d EPSBalance include/slepceps.h /^ EPS_BALANCE_USER } EPSBalance;$/;" t typeref:enum:__anon6 EPSBasicArnoldi src/eps/impls/krylov/krylov.c /^PetscErrorCode EPSBasicArnoldi(EPS eps,PetscBool trans,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)$/;" f EPSBasicLanczos src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode EPSBasicLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *m,Vec f,PetscBool *breakdown,PetscReal anorm)$/;" f file: EPSBlzpackSetBlockSize src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSBlzpackSetBlockSize(EPS eps,PetscInt bs)$/;" f EPSBlzpackSetBlockSize_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^static PetscErrorCode EPSBlzpackSetBlockSize_BLZPACK(EPS eps,PetscInt bs)$/;" f file: EPSBlzpackSetNSteps src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSBlzpackSetNSteps(EPS eps,PetscInt nsteps)$/;" f EPSBlzpackSetNSteps_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^static PetscErrorCode EPSBlzpackSetNSteps_BLZPACK(EPS eps,PetscInt nsteps)$/;" f file: EPSBuildBalance_Krylov src/eps/interface/default.c /^PetscErrorCode EPSBuildBalance_Krylov(EPS eps)$/;" f EPSCISS include/finclude/slepcepsdef.h /^#define EPSCISS /;" d EPSCISS include/slepceps.h /^#define EPSCISS /;" d EPSCISSGetRefinement src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSGetRefinement(EPS eps, PetscInt *inner, PetscInt *outer,PetscInt *blsize)$/;" f EPSCISSGetRefinement_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSGetRefinement_CISS(EPS eps,PetscInt *inner,PetscInt *outer,PetscInt *blsize)$/;" f file: EPSCISSGetRegion src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSGetRegion(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale)$/;" f EPSCISSGetRegion_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSGetRegion_CISS(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale)$/;" f file: EPSCISSGetSizes src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSGetSizes(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal)$/;" f EPSCISSGetSizes_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSGetSizes_CISS(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal)$/;" f file: EPSCISSGetThreshold src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSGetThreshold(EPS eps,PetscReal *delta,PetscReal *spur)$/;" f EPSCISSGetThreshold_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSGetThreshold_CISS(EPS eps,PetscReal *delta,PetscReal *spur)$/;" f file: EPSCISSSetRefinement src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSSetRefinement(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize)$/;" f EPSCISSSetRefinement_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSSetRefinement_CISS(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize)$/;" f file: EPSCISSSetRegion src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSSetRegion(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale)$/;" f EPSCISSSetRegion_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSSetRegion_CISS(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale)$/;" f file: EPSCISSSetSizes src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSSetSizes(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal)$/;" f EPSCISSSetSizes_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSSetSizes_CISS(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal)$/;" f file: EPSCISSSetThreshold src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSCISSSetThreshold(EPS eps,PetscReal delta,PetscReal spur)$/;" f EPSCISSSetThreshold_CISS src/eps/impls/ciss/ciss.c /^static PetscErrorCode EPSCISSSetThreshold_CISS(EPS eps,PetscReal delta,PetscReal spur)$/;" f file: EPSCompareEigenvalues src/eps/interface/solve.c /^PetscErrorCode EPSCompareEigenvalues(EPS eps,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)$/;" f EPSComputeRelativeError src/eps/interface/solve.c /^PetscErrorCode EPSComputeRelativeError(EPS eps,PetscInt i,PetscReal *error)$/;" f EPSComputeRelativeErrorLeft src/eps/interface/solve.c /^PetscErrorCode EPSComputeRelativeErrorLeft(EPS eps,PetscInt i,PetscReal *error)$/;" f EPSComputeRelativeError_Private src/eps/interface/solve.c /^PetscErrorCode EPSComputeRelativeError_Private(EPS eps,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *error)$/;" f EPSComputeResidualNorm src/eps/interface/solve.c /^PetscErrorCode EPSComputeResidualNorm(EPS eps,PetscInt i,PetscReal *norm)$/;" f EPSComputeResidualNormLeft src/eps/interface/solve.c /^PetscErrorCode EPSComputeResidualNormLeft(EPS eps,PetscInt i,PetscReal *norm)$/;" f EPSComputeResidualNorm_Private src/eps/interface/solve.c /^PetscErrorCode EPSComputeResidualNorm_Private(EPS eps,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *norm)$/;" f EPSComputeRitzVector src/eps/interface/default.c /^PetscErrorCode EPSComputeRitzVector(EPS eps,PetscScalar *Zr,PetscScalar *Zi,Vec *V,PetscInt nv,Vec x,Vec y)$/;" f EPSComputeVectors_Default src/eps/interface/default.c /^PetscErrorCode EPSComputeVectors_Default(EPS eps)$/;" f EPSComputeVectors_Hermitian src/eps/interface/default.c /^PetscErrorCode EPSComputeVectors_Hermitian(EPS eps)$/;" f EPSComputeVectors_Indefinite src/eps/interface/default.c /^PetscErrorCode EPSComputeVectors_Indefinite(EPS eps)$/;" f EPSComputeVectors_Schur src/eps/interface/default.c /^PetscErrorCode EPSComputeVectors_Schur(EPS eps)$/;" f EPSComputeVectors_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSComputeVectors_XD(EPS eps)$/;" f EPSConv include/finclude/slepcepsdef.h /^#define EPSConv /;" d EPSConv include/slepceps.h /^ EPS_CONV_USER } EPSConv;$/;" t typeref:enum:__anon7 EPSConvergedAbsolute src/eps/interface/default.c /^PetscErrorCode EPSConvergedAbsolute(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)$/;" f EPSConvergedEigRelative src/eps/interface/default.c /^PetscErrorCode EPSConvergedEigRelative(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)$/;" f EPSConvergedNormRelative src/eps/interface/default.c /^PetscErrorCode EPSConvergedNormRelative(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)$/;" f EPSConvergedReason include/finclude/slepcepsdef.h /^#define EPSConvergedReason /;" d EPSConvergedReason include/slepceps.h /^ EPS_CONVERGED_ITERATING = 0} EPSConvergedReason;$/;" t typeref:enum:__anon8 EPSCreate src/eps/interface/basic.c /^PetscErrorCode EPSCreate(MPI_Comm comm,EPS *outeps)$/;" f EPSCreateShift src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode EPSCreateShift(EPS eps,PetscReal val,shift neighb0,shift neighb1)$/;" f file: EPSCreate_ARPACK src/eps/impls/external/arpack/arpack.c /^PETSC_EXTERN PetscErrorCode EPSCreate_ARPACK(EPS eps)$/;" f EPSCreate_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PETSC_EXTERN PetscErrorCode EPSCreate_Arnoldi(EPS eps)$/;" f EPSCreate_BLOPEX src/eps/impls/external/blopex/blopex.c /^PETSC_EXTERN PetscErrorCode EPSCreate_BLOPEX(EPS eps)$/;" f EPSCreate_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PETSC_EXTERN PetscErrorCode EPSCreate_BLZPACK(EPS eps)$/;" f EPSCreate_CISS src/eps/impls/ciss/ciss.c /^PETSC_EXTERN PetscErrorCode EPSCreate_CISS(EPS eps)$/;" f EPSCreate_FEAST src/eps/impls/external/feast/feast.c /^PETSC_EXTERN PetscErrorCode EPSCreate_FEAST(EPS eps)$/;" f EPSCreate_GD src/eps/impls/davidson/gd/gd.c /^PETSC_EXTERN PetscErrorCode EPSCreate_GD(EPS eps)$/;" f EPSCreate_JD src/eps/impls/davidson/jd/jd.c /^PETSC_EXTERN PetscErrorCode EPSCreate_JD(EPS eps)$/;" f EPSCreate_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^PETSC_EXTERN PetscErrorCode EPSCreate_KrylovSchur(EPS eps)$/;" f EPSCreate_LAPACK src/eps/impls/lapack/lapack.c /^PETSC_EXTERN PetscErrorCode EPSCreate_LAPACK(EPS eps)$/;" f EPSCreate_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PETSC_EXTERN PetscErrorCode EPSCreate_Lanczos(EPS eps)$/;" f EPSCreate_PRIMME src/eps/impls/external/primme/primme.c /^PETSC_EXTERN PetscErrorCode EPSCreate_PRIMME(EPS eps)$/;" f EPSCreate_Power src/eps/impls/power/power.c /^PETSC_EXTERN PetscErrorCode EPSCreate_Power(EPS eps)$/;" f EPSCreate_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PETSC_EXTERN PetscErrorCode EPSCreate_RQCG(EPS eps)$/;" f EPSCreate_Subspace src/eps/impls/subspace/subspace.c /^PETSC_EXTERN PetscErrorCode EPSCreate_Subspace(EPS eps)$/;" f EPSCreate_TRLAN src/eps/impls/external/trlan/trlan.c /^PETSC_EXTERN PetscErrorCode EPSCreate_TRLAN(EPS eps)$/;" f EPSCreate_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSCreate_XD(EPS eps)$/;" f EPSDelayedArnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSDelayedArnoldi(EPS eps,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)$/;" f EPSDelayedArnoldi1 src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSDelayedArnoldi1(EPS eps,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)$/;" f EPSDestroy src/eps/interface/basic.c /^PetscErrorCode EPSDestroy(EPS *eps)$/;" f EPSDestroy_ARPACK src/eps/impls/external/arpack/arpack.c /^PetscErrorCode EPSDestroy_ARPACK(EPS eps)$/;" f EPSDestroy_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSDestroy_Arnoldi(EPS eps)$/;" f EPSDestroy_BLOPEX src/eps/impls/external/blopex/blopex.c /^PetscErrorCode EPSDestroy_BLOPEX(EPS eps)$/;" f EPSDestroy_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSDestroy_BLZPACK(EPS eps)$/;" f EPSDestroy_CISS src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSDestroy_CISS(EPS eps)$/;" f EPSDestroy_FEAST src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSDestroy_FEAST(EPS eps)$/;" f EPSDestroy_GD src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSDestroy_GD(EPS eps)$/;" f EPSDestroy_JD src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSDestroy_JD(EPS eps)$/;" f EPSDestroy_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSDestroy_KrylovSchur(EPS eps)$/;" f EPSDestroy_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSDestroy_Lanczos(EPS eps)$/;" f EPSDestroy_PRIMME src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSDestroy_PRIMME(EPS eps)$/;" f EPSDestroy_Power src/eps/impls/power/power.c /^PetscErrorCode EPSDestroy_Power(EPS eps)$/;" f EPSDestroy_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSDestroy_RQCG(EPS eps)$/;" f EPSDestroy_Subspace src/eps/impls/subspace/subspace.c /^PetscErrorCode EPSDestroy_Subspace(EPS eps)$/;" f EPSDestroy_TRLAN src/eps/impls/external/trlan/trlan.c /^PetscErrorCode EPSDestroy_TRLAN(EPS eps)$/;" f EPSExtractShift src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode EPSExtractShift(EPS eps)$/;" f file: EPSExtraction bin/matlab/classes/slepcmatlabheader.h /^typedef int EPSExtraction;$/;" t EPSExtraction include/finclude/slepcepsdef.h /^#define EPSExtraction /;" d EPSExtraction include/slepceps.h /^ EPS_REFINED_HARMONIC } EPSExtraction;$/;" t typeref:enum:__anon4 EPSFEAST include/finclude/slepcepsdef.h /^#define EPSFEAST /;" d EPSFEAST include/slepceps.h /^#define EPSFEAST /;" d EPSFEASTGetNumPoints src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSFEASTGetNumPoints(EPS eps,PetscInt *npoints)$/;" f EPSFEASTGetNumPoints_FEAST src/eps/impls/external/feast/feast.c /^static PetscErrorCode EPSFEASTGetNumPoints_FEAST(EPS eps,PetscInt *npoints)$/;" f file: EPSFEASTSetNumPoints src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSFEASTSetNumPoints(EPS eps,PetscInt npoints)$/;" f EPSFEASTSetNumPoints_FEAST src/eps/impls/external/feast/feast.c /^static PetscErrorCode EPSFEASTSetNumPoints_FEAST(EPS eps,PetscInt npoints)$/;" f file: EPSFinalizePackage src/eps/interface/basic.c /^PetscErrorCode EPSFinalizePackage(void)$/;" f EPSFreeSolution src/eps/interface/mem.c /^PetscErrorCode EPSFreeSolution(EPS eps)$/;" f EPSFullLanczos src/eps/impls/krylov/krylov.c /^PetscErrorCode EPSFullLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown)$/;" f EPSFullLanczosIndef src/eps/impls/krylov/krylovschur/ks-indef.c /^static PetscErrorCode EPSFullLanczosIndef(EPS eps,PetscReal *alpha,PetscReal *beta,PetscReal *omega,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal *cos,Vec w)$/;" f file: EPSGD include/finclude/slepcepsdef.h /^#define EPSGD /;" d EPSGD include/slepceps.h /^#define EPSGD /;" d EPSGDGetBOrth src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetBOrth(EPS eps,EPSOrthType *borth)$/;" f EPSGDGetBlockSize src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)$/;" f EPSGDGetDoubleExpansion src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *flg)$/;" f EPSGDGetDoubleExpansion_GD src/eps/impls/davidson/gd/gd.c /^static PetscErrorCode EPSGDGetDoubleExpansion_GD(EPS eps,PetscBool *flg)$/;" f file: EPSGDGetInitialSize src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)$/;" f EPSGDGetKrylovStart src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)$/;" f EPSGDGetRestart src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)$/;" f EPSGDGetWindowSizes src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)$/;" f EPSGDSetBOrth src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetBOrth(EPS eps,EPSOrthType borth)$/;" f EPSGDSetBlockSize src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)$/;" f EPSGDSetDoubleExpansion src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool use_gd2)$/;" f EPSGDSetDoubleExpansion_GD src/eps/impls/davidson/gd/gd.c /^static PetscErrorCode EPSGDSetDoubleExpansion_GD(EPS eps,PetscBool use_gd2)$/;" f file: EPSGDSetInitialSize src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)$/;" f EPSGDSetKrylovStart src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)$/;" f EPSGDSetRestart src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)$/;" f EPSGDSetWindowSizes src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)$/;" f EPSGetArbitraryValues src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSGetArbitraryValues(EPS eps,PetscScalar *rr,PetscScalar *ri)$/;" f EPSGetBalance src/eps/interface/opts.c /^PetscErrorCode EPSGetBalance(EPS eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff)$/;" f EPSGetConverged src/eps/interface/solve.c /^PetscErrorCode EPSGetConverged(EPS eps,PetscInt *nconv)$/;" f EPSGetConvergedReason src/eps/interface/solve.c /^PetscErrorCode EPSGetConvergedReason(EPS eps,EPSConvergedReason *reason)$/;" f EPSGetConvergenceTest src/eps/interface/opts.c /^PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv)$/;" f EPSGetDS src/eps/interface/basic.c /^PetscErrorCode EPSGetDS(EPS eps,DS *ds)$/;" f EPSGetDimensions src/eps/interface/opts.c /^PetscErrorCode EPSGetDimensions(EPS eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)$/;" f EPSGetEigenpair src/eps/interface/solve.c /^PetscErrorCode EPSGetEigenpair(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi)$/;" f EPSGetEigenvalue src/eps/interface/solve.c /^PetscErrorCode EPSGetEigenvalue(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi)$/;" f EPSGetEigenvector src/eps/interface/solve.c /^PetscErrorCode EPSGetEigenvector(EPS eps,PetscInt i,Vec Vr,Vec Vi)$/;" f EPSGetEigenvectorLeft src/eps/interface/solve.c /^PetscErrorCode EPSGetEigenvectorLeft(EPS eps,PetscInt i,Vec Wr,Vec Wi)$/;" f EPSGetErrorEstimate src/eps/interface/solve.c /^PetscErrorCode EPSGetErrorEstimate(EPS eps,PetscInt i,PetscReal *errest)$/;" f EPSGetErrorEstimateLeft src/eps/interface/solve.c /^PetscErrorCode EPSGetErrorEstimateLeft(EPS eps,PetscInt i,PetscReal *errest)$/;" f EPSGetExtraction src/eps/interface/opts.c /^PetscErrorCode EPSGetExtraction(EPS eps,EPSExtraction *extr)$/;" f EPSGetIP src/eps/interface/basic.c /^PetscErrorCode EPSGetIP(EPS eps,IP *ip)$/;" f EPSGetInterval src/eps/interface/basic.c /^PetscErrorCode EPSGetInterval(EPS eps,PetscReal* inta,PetscReal* intb)$/;" f EPSGetInvariantSubspace src/eps/interface/solve.c /^PetscErrorCode EPSGetInvariantSubspace(EPS eps,Vec *v)$/;" f EPSGetInvariantSubspaceLeft src/eps/interface/solve.c /^PetscErrorCode EPSGetInvariantSubspaceLeft(EPS eps,Vec *v)$/;" f EPSGetIterationNumber src/eps/interface/solve.c /^PetscErrorCode EPSGetIterationNumber(EPS eps,PetscInt *its)$/;" f EPSGetLeftVectorsWanted src/eps/interface/opts.c /^PetscErrorCode EPSGetLeftVectorsWanted(EPS eps,PetscBool *leftvecs)$/;" f EPSGetMatrixNorms src/eps/interface/opts.c /^PetscErrorCode EPSGetMatrixNorms(EPS eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive)$/;" f EPSGetMonitorContext src/eps/interface/monitor.c /^PetscErrorCode EPSGetMonitorContext(EPS eps,void **ctx)$/;" f EPSGetNewShiftValue src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode EPSGetNewShiftValue(EPS eps,PetscInt side,PetscReal *newS)$/;" f file: EPSGetOperationCounters src/eps/interface/solve.c /^PetscErrorCode EPSGetOperationCounters(EPS eps,PetscInt* ops,PetscInt* dots,PetscInt* lits)$/;" f EPSGetOperators src/eps/interface/setup.c /^PetscErrorCode EPSGetOperators(EPS eps,Mat *A,Mat *B)$/;" f EPSGetOptionsPrefix src/eps/interface/opts.c /^PetscErrorCode EPSGetOptionsPrefix(EPS eps,const char *prefix[])$/;" f EPSGetProblemType src/eps/interface/opts.c /^PetscErrorCode EPSGetProblemType(EPS eps,EPSProblemType *type)$/;" f EPSGetST src/eps/interface/basic.c /^PetscErrorCode EPSGetST(EPS eps,ST *st)$/;" f EPSGetStartVector src/eps/interface/solve.c /^PetscErrorCode EPSGetStartVector(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown)$/;" f EPSGetStartVectorLeft src/eps/interface/solve.c /^PetscErrorCode EPSGetStartVectorLeft(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown)$/;" f EPSGetTarget src/eps/interface/basic.c /^PetscErrorCode EPSGetTarget(EPS eps,PetscScalar* target)$/;" f EPSGetTolerances src/eps/interface/opts.c /^PetscErrorCode EPSGetTolerances(EPS eps,PetscReal *tol,PetscInt *maxits)$/;" f EPSGetTrackAll src/eps/interface/opts.c /^PetscErrorCode EPSGetTrackAll(EPS eps,PetscBool *trackall)$/;" f EPSGetTrueResidual src/eps/interface/opts.c /^PetscErrorCode EPSGetTrueResidual(EPS eps,PetscBool *trueres)$/;" f EPSGetType src/eps/interface/basic.c /^PetscErrorCode EPSGetType(EPS eps,EPSType *type)$/;" f EPSGetWhichEigenpairs src/eps/interface/opts.c /^PetscErrorCode EPSGetWhichEigenpairs(EPS eps,EPSWhich *which)$/;" f EPSInitializePackage src/eps/interface/basic.c /^PetscErrorCode EPSInitializePackage()$/;" f EPSIsGeneralized src/eps/interface/basic.c /^PetscErrorCode EPSIsGeneralized(EPS eps,PetscBool* is)$/;" f EPSIsHermitian src/eps/interface/basic.c /^PetscErrorCode EPSIsHermitian(EPS eps,PetscBool* is)$/;" f EPSIsPositive src/eps/interface/basic.c /^PetscErrorCode EPSIsPositive(EPS eps,PetscBool* is)$/;" f EPSJD include/finclude/slepcepsdef.h /^#define EPSJD /;" d EPSJD include/slepceps.h /^#define EPSJD /;" d EPSJDGetBOrth src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetBOrth(EPS eps,EPSOrthType *borth)$/;" f EPSJDGetBlockSize src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize)$/;" f EPSJDGetConstCorrectionTol src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetConstCorrectionTol(EPS eps,PetscBool *constant)$/;" f EPSJDGetConstCorrectionTol_JD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSJDGetConstCorrectionTol_JD(EPS eps,PetscBool *constant)$/;" f EPSJDGetFix src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix)$/;" f EPSJDGetInitialSize src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize)$/;" f EPSJDGetKrylovStart src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscBool *krylovstart)$/;" f EPSJDGetRestart src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)$/;" f EPSJDGetWindowSizes src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)$/;" f EPSJDSetBOrth src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetBOrth(EPS eps,EPSOrthType borth)$/;" f EPSJDSetBlockSize src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize)$/;" f EPSJDSetConstCorrectionTol src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetConstCorrectionTol(EPS eps,PetscBool constant)$/;" f EPSJDSetConstCorrectionTol_JD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSJDSetConstCorrectionTol_JD(EPS eps,PetscBool constant)$/;" f EPSJDSetFix src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix)$/;" f EPSJDSetFix_JD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSJDSetFix_JD(EPS eps,PetscReal fix)$/;" f EPSJDSetInitialSize src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize)$/;" f EPSJDSetKrylovStart src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart)$/;" f EPSJDSetRestart src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)$/;" f EPSJDSetWindowSizes src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSJDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)$/;" f EPSKRYLOVSCHUR include/finclude/slepcepsdef.h /^#define EPSKRYLOVSCHUR /;" d EPSKRYLOVSCHUR include/slepceps.h /^#define EPSKRYLOVSCHUR /;" d EPSKrylovConvergence src/eps/impls/krylov/krylov.c /^PetscErrorCode EPSKrylovConvergence(EPS eps,PetscBool getall,PetscInt kini,PetscInt nits,Vec *V,PetscInt nv,PetscReal beta,PetscReal corrf,PetscInt *kout)$/;" f EPSKrylovSchurGetRestart src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSKrylovSchurGetRestart(EPS eps,PetscReal *keep)$/;" f EPSKrylovSchurGetRestart_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^static PetscErrorCode EPSKrylovSchurGetRestart_KrylovSchur(EPS eps,PetscReal *keep)$/;" f file: EPSKrylovSchurSetRestart src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSKrylovSchurSetRestart(EPS eps,PetscReal keep)$/;" f EPSKrylovSchurSetRestart_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^static PetscErrorCode EPSKrylovSchurSetRestart_KrylovSchur(EPS eps,PetscReal keep)$/;" f file: EPSKrylovSchur_Slice src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode EPSKrylovSchur_Slice(EPS eps)$/;" f file: EPSLANCZOS include/finclude/slepcepsdef.h /^#define EPSLANCZOS /;" d EPSLANCZOS include/slepceps.h /^#define EPSLANCZOS /;" d EPSLAPACK include/finclude/slepcepsdef.h /^#define EPSLAPACK /;" d EPSLAPACK include/slepceps.h /^#define EPSLAPACK /;" d EPSLanczosGetReorthog src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSLanczosGetReorthog(EPS eps,EPSLanczosReorthogType *reorthog)$/;" f EPSLanczosGetReorthog_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode EPSLanczosGetReorthog_Lanczos(EPS eps,EPSLanczosReorthogType *reorthog)$/;" f file: EPSLanczosReorthogType include/finclude/slepcepsdef.h /^#define EPSLanczosReorthogType /;" d EPSLanczosReorthogType include/slepceps.h /^ EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType;$/;" t typeref:enum:__anon10 EPSLanczosReorthogTypes include/slepceps.h /^PETSC_EXTERN const char *EPSLanczosReorthogTypes[];$/;" v EPSLanczosReorthogTypes src/eps/interface/basic.c /^const char *EPSLanczosReorthogTypes[] = {"LOCAL","FULL","SELECTIVE","PERIODIC","PARTIAL","DELAYED","EPSLanczosReorthogType","EPS_LANCZOS_REORTHOG_",0};$/;" v EPSLanczosSetReorthog src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSLanczosSetReorthog(EPS eps,EPSLanczosReorthogType reorthog)$/;" f EPSLanczosSetReorthog_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode EPSLanczosSetReorthog_Lanczos(EPS eps,EPSLanczosReorthogType reorthog)$/;" f file: EPSList include/slepceps.h /^PETSC_EXTERN PetscFunctionList EPSList;$/;" v EPSList src/eps/interface/basic.c /^PetscFunctionList EPSList = 0;$/;" v EPSLocalLanczos src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode EPSLocalLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown)$/;" f file: EPSLookForDeflation src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode EPSLookForDeflation(EPS eps)$/;" f file: EPSMonitor src/eps/interface/monitor.c /^PetscErrorCode EPSMonitor(EPS eps,PetscInt it,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest)$/;" f EPSMonitorAll src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f EPSMonitorCancel src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorCancel(EPS eps)$/;" f EPSMonitorConverged src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorConverged(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f EPSMonitorFirst src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorFirst(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f EPSMonitorLG src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorLG(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f EPSMonitorLGAll src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorLGAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f EPSMonitorSet src/eps/interface/monitor.c /^PetscErrorCode EPSMonitorSet(EPS eps,PetscErrorCode (*monitor)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))$/;" f EPSMonitor_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode EPSMonitor_Linear(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)$/;" f file: EPSNS src/eps/examples/tests/makefile /^EPSNS = krylovschur arnoldi gd jd gd2$/;" m EPSOps include/slepc-private/epsimpl.h /^typedef struct _EPSOps *EPSOps;$/;" t typeref:struct:_EPSOps EPSOrthType include/finclude/slepcepsdef.h /^#define EPSOrthType /;" d EPSOrthType include/slepceps.h /^ EPS_ORTH_BOPT } EPSOrthType;$/;" t typeref:enum:__anon12 EPSPOWER include/finclude/slepcepsdef.h /^#define EPSPOWER /;" d EPSPOWER include/slepceps.h /^#define EPSPOWER /;" d EPSPRIMME include/finclude/slepcepsdef.h /^#define EPSPRIMME /;" d EPSPRIMME include/slepceps.h /^#define EPSPRIMME /;" d EPSPRIMMEGetBlockSize src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs)$/;" f EPSPRIMMEGetBlockSize_PRIMME src/eps/impls/external/primme/primme.c /^static PetscErrorCode EPSPRIMMEGetBlockSize_PRIMME(EPS eps,PetscInt *bs)$/;" f file: EPSPRIMMEGetMethod src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSPRIMMEGetMethod(EPS eps,EPSPRIMMEMethod *method)$/;" f EPSPRIMMEGetMethod_PRIMME src/eps/impls/external/primme/primme.c /^static PetscErrorCode EPSPRIMMEGetMethod_PRIMME(EPS eps,EPSPRIMMEMethod *method)$/;" f file: EPSPRIMMEMethod include/finclude/slepcepsdef.h /^#define EPSPRIMMEMethod /;" d EPSPRIMMEMethod include/slepceps.h /^ EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod;$/;" t typeref:enum:__anon11 EPSPRIMMEMethods include/slepceps.h /^PETSC_EXTERN const char *EPSPRIMMEMethods[];$/;" v EPSPRIMMEMethods src/eps/interface/basic.c /^const char *EPSPRIMMEMethods[] = {"DYNAMIC","DEFAULT_MIN_TIME","DEFAULT_MIN_MATVECS","ARNOLDI","GD","GD_PLUSK","GD_OLSEN_PLUSK","JD_OLSEN_PLUSK","RQI","JDQR","JDQMR","JDQMR_ETOL","SUBSPACE_ITERATION","LOBPCG_ORTHOBASIS","LOBPCG_ORTHOBASISW","EPSPRIMMEMethod","EPS_PRIMME_",0};$/;" v EPSPRIMMEPrecond include/finclude/slepcepsdef.h /^#define EPSPRIMMEPrecond /;" d EPSPRIMMESetBlockSize src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs)$/;" f EPSPRIMMESetBlockSize_PRIMME src/eps/impls/external/primme/primme.c /^static PetscErrorCode EPSPRIMMESetBlockSize_PRIMME(EPS eps,PetscInt bs)$/;" f file: EPSPRIMMESetMethod src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSPRIMMESetMethod(EPS eps,EPSPRIMMEMethod method)$/;" f EPSPRIMMESetMethod_PRIMME src/eps/impls/external/primme/primme.c /^static PetscErrorCode EPSPRIMMESetMethod_PRIMME(EPS eps,EPSPRIMMEMethod method)$/;" f file: EPSPackageInitialized src/eps/interface/basic.c /^static PetscBool EPSPackageInitialized = PETSC_FALSE;$/;" v file: EPSPartialLanczos src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode EPSPartialLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal anorm)$/;" f file: EPSPowerGetShiftType src/eps/impls/power/power.c /^PetscErrorCode EPSPowerGetShiftType(EPS eps,EPSPowerShiftType *shift)$/;" f EPSPowerGetShiftType_Power src/eps/impls/power/power.c /^static PetscErrorCode EPSPowerGetShiftType_Power(EPS eps,EPSPowerShiftType *shift)$/;" f file: EPSPowerSetShiftType src/eps/impls/power/power.c /^PetscErrorCode EPSPowerSetShiftType(EPS eps,EPSPowerShiftType shift)$/;" f EPSPowerSetShiftType_Power src/eps/impls/power/power.c /^static PetscErrorCode EPSPowerSetShiftType_Power(EPS eps,EPSPowerShiftType shift)$/;" f file: EPSPowerShiftType include/finclude/slepcepsdef.h /^#define EPSPowerShiftType /;" d EPSPowerShiftType include/slepceps.h /^ EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType;$/;" t typeref:enum:__anon9 EPSPowerShiftTypes include/slepceps.h /^PETSC_EXTERN const char *EPSPowerShiftTypes[];$/;" v EPSPowerShiftTypes src/eps/interface/basic.c /^const char *EPSPowerShiftTypes[] = {"CONSTANT","RAYLEIGH","WILKINSON","EPSPowerShiftType","EPS_POWER_SHIFT_",0};$/;" v EPSPrintSolution src/eps/interface/basic.c /^PetscErrorCode EPSPrintSolution(EPS eps,PetscViewer viewer)$/;" f EPSProblemType bin/matlab/classes/slepcmatlabheader.h /^typedef int EPSProblemType;$/;" t EPSProblemType include/finclude/slepcepsdef.h /^#define EPSProblemType /;" d EPSProblemType include/slepceps.h /^ EPS_GHIEP } EPSProblemType;$/;" t typeref:enum:__anon3 EPSRQCG include/finclude/slepcepsdef.h /^#define EPSRQCG /;" d EPSRQCG include/slepceps.h /^#define EPSRQCG /;" d EPSRQCGGetReset src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSRQCGGetReset(EPS eps,PetscInt *nrest)$/;" f EPSRQCGGetReset_RQCG src/eps/impls/cg/rqcg/rqcg.c /^static PetscErrorCode EPSRQCGGetReset_RQCG(EPS eps,PetscInt *nrest)$/;" f file: EPSRQCGSetReset src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSRQCGSetReset(EPS eps,PetscInt nrest)$/;" f EPSRQCGSetReset_RQCG src/eps/impls/cg/rqcg/rqcg.c /^static PetscErrorCode EPSRQCGSetReset_RQCG(EPS eps,PetscInt nrest)$/;" f file: EPSRegister src/eps/interface/basic.c /^PetscErrorCode EPSRegister(const char *name,PetscErrorCode (*function)(EPS))$/;" f EPSRegisterAll src/eps/interface/itregis.c /^PetscErrorCode EPSRegisterAll(void)$/;" f EPSRegisterAllCalled include/slepceps.h /^PETSC_EXTERN PetscBool EPSRegisterAllCalled;$/;" v EPSRegisterAllCalled src/eps/interface/basic.c /^PetscBool EPSRegisterAllCalled = PETSC_FALSE;$/;" v EPSRemoveDeflationSpace src/eps/interface/setup.c /^PetscErrorCode EPSRemoveDeflationSpace(EPS eps)$/;" f EPSReset src/eps/interface/basic.c /^PetscErrorCode EPSReset(EPS eps)$/;" f EPSReset_ARPACK src/eps/impls/external/arpack/arpack.c /^PetscErrorCode EPSReset_ARPACK(EPS eps)$/;" f EPSReset_BLOPEX src/eps/impls/external/blopex/blopex.c /^PetscErrorCode EPSReset_BLOPEX(EPS eps)$/;" f EPSReset_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSReset_BLZPACK(EPS eps)$/;" f EPSReset_CISS src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSReset_CISS(EPS eps)$/;" f EPSReset_Default src/eps/interface/default.c /^PetscErrorCode EPSReset_Default(EPS eps)$/;" f EPSReset_FEAST src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSReset_FEAST(EPS eps)$/;" f EPSReset_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSReset_KrylovSchur(EPS eps)$/;" f EPSReset_LAPACK src/eps/impls/lapack/lapack.c /^PetscErrorCode EPSReset_LAPACK(EPS eps)$/;" f EPSReset_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSReset_Lanczos(EPS eps)$/;" f EPSReset_PRIMME src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSReset_PRIMME(EPS eps)$/;" f EPSReset_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSReset_RQCG(EPS eps)$/;" f EPSReset_Subspace src/eps/impls/subspace/subspace.c /^PetscErrorCode EPSReset_Subspace(EPS eps)$/;" f EPSReset_TRLAN src/eps/impls/external/trlan/trlan.c /^PetscErrorCode EPSReset_TRLAN(EPS eps)$/;" f EPSReset_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSReset_XD(EPS eps)$/;" f EPSSUBSPACE include/finclude/slepcepsdef.h /^#define EPSSUBSPACE /;" d EPSSUBSPACE include/slepceps.h /^#define EPSSUBSPACE /;" d EPSSelectiveLanczos src/eps/impls/krylov/lanczos/lanczos.c /^static PetscErrorCode EPSSelectiveLanczos(EPS eps,PetscReal *alpha,PetscReal *beta,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscBool *breakdown,PetscReal anorm)$/;" f file: EPSSetArbitrarySelection src/eps/interface/opts.c /^PetscErrorCode EPSSetArbitrarySelection(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*),void* ctx)$/;" f EPSSetBalance src/eps/interface/opts.c /^PetscErrorCode EPSSetBalance(EPS eps,EPSBalance bal,PetscInt its,PetscReal cutoff)$/;" f EPSSetConvergenceTest src/eps/interface/opts.c /^PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv)$/;" f EPSSetConvergenceTestFunction src/eps/interface/opts.c /^PetscErrorCode EPSSetConvergenceTestFunction(EPS eps,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)$/;" f EPSSetDS src/eps/interface/basic.c /^PetscErrorCode EPSSetDS(EPS eps,DS ds)$/;" f EPSSetDeflationSpace src/eps/interface/setup.c /^PetscErrorCode EPSSetDeflationSpace(EPS eps,PetscInt n,Vec *v)$/;" f EPSSetDimensions src/eps/interface/opts.c /^PetscErrorCode EPSSetDimensions(EPS eps,PetscInt nev,PetscInt ncv,PetscInt mpd)$/;" f EPSSetEigenvalueComparison src/eps/interface/opts.c /^PetscErrorCode EPSSetEigenvalueComparison(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)$/;" f EPSSetExtraction src/eps/interface/opts.c /^PetscErrorCode EPSSetExtraction(EPS eps,EPSExtraction extr)$/;" f EPSSetFromOptions src/eps/interface/opts.c /^PetscErrorCode EPSSetFromOptions(EPS eps)$/;" f EPSSetFromOptions_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSSetFromOptions_Arnoldi(EPS eps)$/;" f EPSSetFromOptions_BLOPEX src/eps/impls/external/blopex/blopex.c /^PetscErrorCode EPSSetFromOptions_BLOPEX(EPS eps)$/;" f EPSSetFromOptions_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSSetFromOptions_BLZPACK(EPS eps)$/;" f EPSSetFromOptions_CISS src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSSetFromOptions_CISS(EPS eps)$/;" f EPSSetFromOptions_FEAST src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSSetFromOptions_FEAST(EPS eps)$/;" f EPSSetFromOptions_GD src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSSetFromOptions_GD(EPS eps)$/;" f EPSSetFromOptions_JD src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSSetFromOptions_JD(EPS eps)$/;" f EPSSetFromOptions_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSSetFromOptions_KrylovSchur(EPS eps)$/;" f EPSSetFromOptions_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSSetFromOptions_Lanczos(EPS eps)$/;" f EPSSetFromOptions_PRIMME src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSSetFromOptions_PRIMME(EPS eps)$/;" f EPSSetFromOptions_Power src/eps/impls/power/power.c /^PetscErrorCode EPSSetFromOptions_Power(EPS eps)$/;" f EPSSetFromOptions_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSSetFromOptions_RQCG(EPS eps)$/;" f EPSSetIP src/eps/interface/basic.c /^PetscErrorCode EPSSetIP(EPS eps,IP ip)$/;" f EPSSetInitialSpace src/eps/interface/setup.c /^PetscErrorCode EPSSetInitialSpace(EPS eps,PetscInt n,Vec *is)$/;" f EPSSetInitialSpaceLeft src/eps/interface/setup.c /^PetscErrorCode EPSSetInitialSpaceLeft(EPS eps,PetscInt n,Vec *is)$/;" f EPSSetInterval src/eps/interface/basic.c /^PetscErrorCode EPSSetInterval(EPS eps,PetscReal inta,PetscReal intb)$/;" f EPSSetLeftVectorsWanted src/eps/interface/opts.c /^PetscErrorCode EPSSetLeftVectorsWanted(EPS eps,PetscBool leftvecs)$/;" f EPSSetMatrixNorms src/eps/interface/opts.c /^PetscErrorCode EPSSetMatrixNorms(EPS eps,PetscReal nrma,PetscReal nrmb,PetscBool adaptive)$/;" f EPSSetOperators src/eps/interface/setup.c /^PetscErrorCode EPSSetOperators(EPS eps,Mat A,Mat B)$/;" f EPSSetOptionsPrefix src/eps/interface/opts.c /^PetscErrorCode EPSSetOptionsPrefix(EPS eps,const char *prefix)$/;" f EPSSetProblemType src/eps/interface/opts.c /^PetscErrorCode EPSSetProblemType(EPS eps,EPSProblemType type)$/;" f EPSSetST src/eps/interface/basic.c /^PetscErrorCode EPSSetST(EPS eps,ST st)$/;" f EPSSetTarget src/eps/interface/basic.c /^PetscErrorCode EPSSetTarget(EPS eps,PetscScalar target)$/;" f EPSSetTolerances src/eps/interface/opts.c /^PetscErrorCode EPSSetTolerances(EPS eps,PetscReal tol,PetscInt maxits)$/;" f EPSSetTrackAll src/eps/interface/opts.c /^PetscErrorCode EPSSetTrackAll(EPS eps,PetscBool trackall)$/;" f EPSSetTrueResidual src/eps/interface/opts.c /^PetscErrorCode EPSSetTrueResidual(EPS eps,PetscBool trueres)$/;" f EPSSetType src/eps/interface/basic.c /^PetscErrorCode EPSSetType(EPS eps,EPSType type)$/;" f EPSSetUp src/eps/interface/setup.c /^PetscErrorCode EPSSetUp(EPS eps)$/;" f EPSSetUp_ARPACK src/eps/impls/external/arpack/arpack.c /^PetscErrorCode EPSSetUp_ARPACK(EPS eps)$/;" f EPSSetUp_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSSetUp_Arnoldi(EPS eps)$/;" f EPSSetUp_BLOPEX src/eps/impls/external/blopex/blopex.c /^PetscErrorCode EPSSetUp_BLOPEX(EPS eps)$/;" f EPSSetUp_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSSetUp_BLZPACK(EPS eps)$/;" f EPSSetUp_CISS src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSSetUp_CISS(EPS eps)$/;" f EPSSetUp_FEAST src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSSetUp_FEAST(EPS eps)$/;" f EPSSetUp_GD src/eps/impls/davidson/gd/gd.c /^PetscErrorCode EPSSetUp_GD(EPS eps)$/;" f EPSSetUp_JD src/eps/impls/davidson/jd/jd.c /^PetscErrorCode EPSSetUp_JD(EPS eps)$/;" f EPSSetUp_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSSetUp_KrylovSchur(EPS eps)$/;" f EPSSetUp_LAPACK src/eps/impls/lapack/lapack.c /^PetscErrorCode EPSSetUp_LAPACK(EPS eps)$/;" f EPSSetUp_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSSetUp_Lanczos(EPS eps)$/;" f EPSSetUp_PRIMME src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSSetUp_PRIMME(EPS eps)$/;" f EPSSetUp_Power src/eps/impls/power/power.c /^PetscErrorCode EPSSetUp_Power(EPS eps)$/;" f EPSSetUp_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSSetUp_RQCG(EPS eps)$/;" f EPSSetUp_Subspace src/eps/impls/subspace/subspace.c /^PetscErrorCode EPSSetUp_Subspace(EPS eps)$/;" f EPSSetUp_TRLAN src/eps/impls/external/trlan/trlan.c /^PetscErrorCode EPSSetUp_TRLAN(EPS eps)$/;" f EPSSetUp_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSSetUp_XD(EPS eps)$/;" f EPSSetWhichEigenpairs src/eps/interface/opts.c /^PetscErrorCode EPSSetWhichEigenpairs(EPS eps,EPSWhich which)$/;" f EPSSetWhichEigenpairs_Default src/eps/interface/default.c /^PetscErrorCode EPSSetWhichEigenpairs_Default(EPS eps)$/;" f EPSSetWorkVecs src/eps/interface/default.c /^PetscErrorCode EPSSetWorkVecs(EPS eps,PetscInt nw)$/;" f EPSSolve src/eps/interface/solve.c /^PetscErrorCode EPSSolve(EPS eps)$/;" f EPSSolve_ARPACK src/eps/impls/external/arpack/arpack.c /^PetscErrorCode EPSSolve_ARPACK(EPS eps)$/;" f EPSSolve_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSSolve_Arnoldi(EPS eps)$/;" f EPSSolve_BLOPEX src/eps/impls/external/blopex/blopex.c /^PetscErrorCode EPSSolve_BLOPEX(EPS eps)$/;" f EPSSolve_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSSolve_BLZPACK(EPS eps)$/;" f EPSSolve_CISS src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSSolve_CISS(EPS eps)$/;" f EPSSolve_FEAST src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSSolve_FEAST(EPS eps)$/;" f EPSSolve_KrylovSchur_Default src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSSolve_KrylovSchur_Default(EPS eps)$/;" f EPSSolve_KrylovSchur_Indefinite src/eps/impls/krylov/krylovschur/ks-indef.c /^PetscErrorCode EPSSolve_KrylovSchur_Indefinite(EPS eps)$/;" f EPSSolve_KrylovSchur_Slice src/eps/impls/krylov/krylovschur/ks-slice.c /^PetscErrorCode EPSSolve_KrylovSchur_Slice(EPS eps)$/;" f EPSSolve_KrylovSchur_Symm src/eps/impls/krylov/krylovschur/ks-symm.c /^PetscErrorCode EPSSolve_KrylovSchur_Symm(EPS eps)$/;" f EPSSolve_LAPACK src/eps/impls/lapack/lapack.c /^PetscErrorCode EPSSolve_LAPACK(EPS eps)$/;" f EPSSolve_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSSolve_Lanczos(EPS eps)$/;" f EPSSolve_PRIMME src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSSolve_PRIMME(EPS eps)$/;" f EPSSolve_Power src/eps/impls/power/power.c /^PetscErrorCode EPSSolve_Power(EPS eps)$/;" f EPSSolve_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSSolve_RQCG(EPS eps)$/;" f EPSSolve_Subspace src/eps/impls/subspace/subspace.c /^PetscErrorCode EPSSolve_Subspace(EPS eps)$/;" f EPSSolve_TRLAN src/eps/impls/external/trlan/trlan.c /^PetscErrorCode EPSSolve_TRLAN(EPS eps)$/;" f EPSSolve_TS_Power src/eps/impls/power/power.c /^PetscErrorCode EPSSolve_TS_Power(EPS eps)$/;" f EPSSolve_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSSolve_XD(EPS eps)$/;" f EPSSortEigenvalues src/eps/interface/solve.c /^PetscErrorCode EPSSortEigenvalues(EPS eps,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)$/;" f EPSSortForSTData src/eps/interface/solve.c /^} EPSSortForSTData;$/;" t typeref:struct:__anon1 file: EPSSortForSTFunc src/eps/interface/solve.c /^static PetscErrorCode EPSSortForSTFunc(PetscScalar ar,PetscScalar ai,$/;" f file: EPSStoreEigenpairs src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode EPSStoreEigenpairs(EPS eps)$/;" f file: EPSSubspaceFindGroup src/eps/impls/subspace/subspace.c /^static PetscErrorCode EPSSubspaceFindGroup(PetscInt l,PetscInt m,PetscScalar *wr,PetscScalar *wi,PetscReal *rsd,PetscReal grptol,PetscInt *ngrp,PetscReal *ctr,PetscReal *ae,PetscReal *arsd)$/;" f file: EPSSubspaceResidualNorms src/eps/impls/subspace/subspace.c /^static PetscErrorCode EPSSubspaceResidualNorms(Vec *V,Vec *AV,PetscScalar *T,PetscInt l,PetscInt m,PetscInt ldt,Vec w,PetscReal *rsd)$/;" f file: EPSTRLAN include/finclude/slepcepsdef.h /^#define EPSTRLAN /;" d EPSTRLAN include/slepceps.h /^#define EPSTRLAN /;" d EPSType include/finclude/slepcepsdef.h /^#define EPSType /;" d EPSType include/slepceps.h /^typedef const char* EPSType;$/;" t EPSView src/eps/interface/basic.c /^PetscErrorCode EPSView(EPS eps,PetscViewer viewer)$/;" f EPSView_Arnoldi src/eps/impls/krylov/arnoldi/arnoldi.c /^PetscErrorCode EPSView_Arnoldi(EPS eps,PetscViewer viewer)$/;" f EPSView_BLZPACK src/eps/impls/external/blzpack/blzpack.c /^PetscErrorCode EPSView_BLZPACK(EPS eps,PetscViewer viewer)$/;" f EPSView_CISS src/eps/impls/ciss/ciss.c /^PetscErrorCode EPSView_CISS(EPS eps,PetscViewer viewer)$/;" f EPSView_FEAST src/eps/impls/external/feast/feast.c /^PetscErrorCode EPSView_FEAST(EPS eps,PetscViewer viewer)$/;" f EPSView_KrylovSchur src/eps/impls/krylov/krylovschur/krylovschur.c /^PetscErrorCode EPSView_KrylovSchur(EPS eps,PetscViewer viewer)$/;" f EPSView_Lanczos src/eps/impls/krylov/lanczos/lanczos.c /^PetscErrorCode EPSView_Lanczos(EPS eps,PetscViewer viewer)$/;" f EPSView_PRIMME src/eps/impls/external/primme/primme.c /^PetscErrorCode EPSView_PRIMME(EPS eps,PetscViewer viewer)$/;" f EPSView_Power src/eps/impls/power/power.c /^PetscErrorCode EPSView_Power(EPS eps,PetscViewer viewer)$/;" f EPSView_RQCG src/eps/impls/cg/rqcg/rqcg.c /^PetscErrorCode EPSView_RQCG(EPS eps,PetscViewer viewer)$/;" f EPSView_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSView_XD(EPS eps,PetscViewer viewer)$/;" f EPSWhich bin/matlab/classes/slepcmatlabheader.h /^typedef int EPSWhich;$/;" t EPSWhich include/finclude/slepcepsdef.h /^#define EPSWhich /;" d EPSWhich include/slepceps.h /^ EPS_WHICH_USER } EPSWhich;$/;" t typeref:enum:__anon5 EPSXDGetBOrth_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetBOrth_XD(EPS eps,EPSOrthType *borth)$/;" f EPSXDGetBlockSize_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetBlockSize_XD(EPS eps,PetscInt *blocksize)$/;" f EPSXDGetFix_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetFix_XD(EPS eps,PetscReal *fix)$/;" f EPSXDGetInitialSize_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetInitialSize_XD(EPS eps,PetscInt *initialsize)$/;" f EPSXDGetKrylovStart_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetKrylovStart_XD(EPS eps,PetscBool *krylovstart)$/;" f EPSXDGetMethod_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetMethod_XD(EPS eps,Method_t *method)$/;" f EPSXDGetRestart_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetRestart_XD(EPS eps,PetscInt *minv,PetscInt *plusk)$/;" f EPSXDGetWindowSizes_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDGetWindowSizes_XD(EPS eps,PetscInt *pwindow,PetscInt *qwindow)$/;" f EPSXDSetBOrth_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetBOrth_XD(EPS eps,EPSOrthType borth)$/;" f EPSXDSetBlockSize_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetBlockSize_XD(EPS eps,PetscInt blocksize)$/;" f EPSXDSetInitialSize_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetInitialSize_XD(EPS eps,PetscInt initialsize)$/;" f EPSXDSetKrylovStart_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetKrylovStart_XD(EPS eps,PetscBool krylovstart)$/;" f EPSXDSetMethod src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetMethod(EPS eps,Method_t method)$/;" f EPSXDSetRestart_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetRestart_XD(EPS eps,PetscInt minv,PetscInt plusk)$/;" f EPSXDSetWindowSizes_XD src/eps/impls/davidson/common/davidson.c /^PetscErrorCode EPSXDSetWindowSizes_XD(EPS eps,PetscInt pwindow,PetscInt qwindow)$/;" f EPS_ALL include/slepceps.h /^ EPS_ALL,$/;" e enum:__anon5 EPS_ARNOLDI src/eps/impls/krylov/arnoldi/arnoldi.c /^} EPS_ARNOLDI;$/;" t typeref:struct:__anon1 file: EPS_ARPACK src/eps/impls/external/arpack/arpackp.h /^} EPS_ARPACK;$/;" t typeref:struct:__anon1 EPS_BALANCE_NONE include/slepceps.h /^typedef enum { EPS_BALANCE_NONE=1,$/;" e enum:__anon6 EPS_BALANCE_ONESIDE include/slepceps.h /^ EPS_BALANCE_ONESIDE,$/;" e enum:__anon6 EPS_BALANCE_TWOSIDE include/slepceps.h /^ EPS_BALANCE_TWOSIDE,$/;" e enum:__anon6 EPS_BALANCE_USER include/slepceps.h /^ EPS_BALANCE_USER } EPSBalance;$/;" e enum:__anon6 EPS_BLOPEX src/eps/impls/external/blopex/blopex.c /^} EPS_BLOPEX;$/;" t typeref:struct:__anon1 file: EPS_BLZPACK src/eps/impls/external/blzpack/blzpackp.h /^} EPS_BLZPACK;$/;" t typeref:struct:__anon1 EPS_CISS src/eps/impls/ciss/ciss.c /^} EPS_CISS;$/;" t typeref:struct:__anon1 file: EPS_CLASSID include/slepceps.h /^PETSC_EXTERN PetscClassId EPS_CLASSID;$/;" v EPS_CLASSID src/eps/interface/basic.c /^PetscClassId EPS_CLASSID = 0;$/;" v EPS_CONVERGED_ITERATING include/slepceps.h /^ EPS_CONVERGED_ITERATING = 0} EPSConvergedReason;$/;" e enum:__anon8 EPS_CONVERGED_TOL include/slepceps.h /^ EPS_CONVERGED_TOL = 2,$/;" e enum:__anon8 EPS_CONV_ABS include/slepceps.h /^typedef enum { EPS_CONV_ABS=1,$/;" e enum:__anon7 EPS_CONV_EIG include/slepceps.h /^ EPS_CONV_EIG,$/;" e enum:__anon7 EPS_CONV_NORM include/slepceps.h /^ EPS_CONV_NORM,$/;" e enum:__anon7 EPS_CONV_USER include/slepceps.h /^ EPS_CONV_USER } EPSConv;$/;" e enum:__anon7 EPS_DAVIDSON src/eps/impls/davidson/common/davidson.c /^} EPS_DAVIDSON;$/;" t typeref:struct:__anon1 file: EPS_DIVERGED_BREAKDOWN include/slepceps.h /^ EPS_DIVERGED_BREAKDOWN = -4,$/;" e enum:__anon8 EPS_DIVERGED_ITS include/slepceps.h /^ EPS_DIVERGED_ITS = -3,$/;" e enum:__anon8 EPS_FEAST src/eps/impls/external/feast/feastp.h /^} EPS_FEAST;$/;" t typeref:struct:__anon1 EPS_GHEP include/slepceps.h /^ EPS_GHEP,$/;" e enum:__anon3 EPS_GHIEP include/slepceps.h /^ EPS_GHIEP } EPSProblemType;$/;" e enum:__anon3 EPS_GNHEP include/slepceps.h /^ EPS_GNHEP,$/;" e enum:__anon3 EPS_HARMONIC include/slepceps.h /^ EPS_HARMONIC,$/;" e enum:__anon4 EPS_HARMONIC_LARGEST include/slepceps.h /^ EPS_HARMONIC_LARGEST,$/;" e enum:__anon4 EPS_HARMONIC_RELATIVE include/slepceps.h /^ EPS_HARMONIC_RELATIVE,$/;" e enum:__anon4 EPS_HARMONIC_RIGHT include/slepceps.h /^ EPS_HARMONIC_RIGHT,$/;" e enum:__anon4 EPS_HEP include/slepceps.h /^typedef enum { EPS_HEP=1,$/;" e enum:__anon3 EPS_KRYLOVSCHUR src/eps/impls/krylov/krylovschur/krylovschur.h /^} EPS_KRYLOVSCHUR;$/;" t typeref:struct:__anon1 EPS_LANCZOS src/eps/impls/krylov/lanczos/lanczos.c /^} EPS_LANCZOS;$/;" t typeref:struct:__anon1 file: EPS_LANCZOS_REORTHOG_DELAYED include/slepceps.h /^ EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType;$/;" e enum:__anon10 EPS_LANCZOS_REORTHOG_FULL include/slepceps.h /^ EPS_LANCZOS_REORTHOG_FULL,$/;" e enum:__anon10 EPS_LANCZOS_REORTHOG_LOCAL include/slepceps.h /^typedef enum { EPS_LANCZOS_REORTHOG_LOCAL,$/;" e enum:__anon10 EPS_LANCZOS_REORTHOG_PARTIAL include/slepceps.h /^ EPS_LANCZOS_REORTHOG_PARTIAL,$/;" e enum:__anon10 EPS_LANCZOS_REORTHOG_PERIODIC include/slepceps.h /^ EPS_LANCZOS_REORTHOG_PERIODIC,$/;" e enum:__anon10 EPS_LANCZOS_REORTHOG_SELECTIVE include/slepceps.h /^ EPS_LANCZOS_REORTHOG_SELECTIVE,$/;" e enum:__anon10 EPS_LARGEST_IMAGINARY include/slepceps.h /^ EPS_LARGEST_IMAGINARY,$/;" e enum:__anon5 EPS_LARGEST_MAGNITUDE include/slepceps.h /^typedef enum { EPS_LARGEST_MAGNITUDE=1,$/;" e enum:__anon5 EPS_LARGEST_REAL include/slepceps.h /^ EPS_LARGEST_REAL,$/;" e enum:__anon5 EPS_NHEP include/slepceps.h /^ EPS_NHEP,$/;" e enum:__anon3 EPS_ORTH_B include/slepceps.h /^ EPS_ORTH_B,$/;" e enum:__anon12 EPS_ORTH_BOPT include/slepceps.h /^ EPS_ORTH_BOPT } EPSOrthType;$/;" e enum:__anon12 EPS_ORTH_I include/slepceps.h /^typedef enum { EPS_ORTH_I=1,$/;" e enum:__anon12 EPS_PGNHEP include/slepceps.h /^ EPS_PGNHEP,$/;" e enum:__anon3 EPS_POWER src/eps/impls/power/power.c /^} EPS_POWER;$/;" t typeref:struct:__anon1 file: EPS_POWER_SHIFT_CONSTANT include/slepceps.h /^typedef enum { EPS_POWER_SHIFT_CONSTANT,$/;" e enum:__anon9 EPS_POWER_SHIFT_RAYLEIGH include/slepceps.h /^ EPS_POWER_SHIFT_RAYLEIGH,$/;" e enum:__anon9 EPS_POWER_SHIFT_WILKINSON include/slepceps.h /^ EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType;$/;" e enum:__anon9 EPS_PRIMME src/eps/impls/external/primme/primme.c /^} EPS_PRIMME;$/;" t typeref:struct:__anon1 file: EPS_PRIMME_ARNOLDI include/slepceps.h /^ EPS_PRIMME_ARNOLDI,$/;" e enum:__anon11 EPS_PRIMME_DEFAULT_MIN_MATVECS include/slepceps.h /^ EPS_PRIMME_DEFAULT_MIN_MATVECS,$/;" e enum:__anon11 EPS_PRIMME_DEFAULT_MIN_TIME include/slepceps.h /^ EPS_PRIMME_DEFAULT_MIN_TIME,$/;" e enum:__anon11 EPS_PRIMME_DYNAMIC include/slepceps.h /^typedef enum { EPS_PRIMME_DYNAMIC,$/;" e enum:__anon11 EPS_PRIMME_GD include/slepceps.h /^ EPS_PRIMME_GD,$/;" e enum:__anon11 EPS_PRIMME_GD_OLSEN_PLUSK include/slepceps.h /^ EPS_PRIMME_GD_OLSEN_PLUSK,$/;" e enum:__anon11 EPS_PRIMME_GD_PLUSK include/slepceps.h /^ EPS_PRIMME_GD_PLUSK,$/;" e enum:__anon11 EPS_PRIMME_JDQMR include/slepceps.h /^ EPS_PRIMME_JDQMR,$/;" e enum:__anon11 EPS_PRIMME_JDQMR_ETOL include/slepceps.h /^ EPS_PRIMME_JDQMR_ETOL,$/;" e enum:__anon11 EPS_PRIMME_JDQR include/slepceps.h /^ EPS_PRIMME_JDQR,$/;" e enum:__anon11 EPS_PRIMME_JD_OLSEN_PLUSK include/slepceps.h /^ EPS_PRIMME_JD_OLSEN_PLUSK,$/;" e enum:__anon11 EPS_PRIMME_LOBPCG_ORTHOBASIS include/slepceps.h /^ EPS_PRIMME_LOBPCG_ORTHOBASIS,$/;" e enum:__anon11 EPS_PRIMME_LOBPCG_ORTHOBASISW include/slepceps.h /^ EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod;$/;" e enum:__anon11 EPS_PRIMME_RQI include/slepceps.h /^ EPS_PRIMME_RQI,$/;" e enum:__anon11 EPS_PRIMME_SUBSPACE_ITERATION include/slepceps.h /^ EPS_PRIMME_SUBSPACE_ITERATION,$/;" e enum:__anon11 EPS_REFINED include/slepceps.h /^ EPS_REFINED,$/;" e enum:__anon4 EPS_REFINED_HARMONIC include/slepceps.h /^ EPS_REFINED_HARMONIC } EPSExtraction;$/;" e enum:__anon4 EPS_RITZ include/slepceps.h /^typedef enum { EPS_RITZ=1,$/;" e enum:__anon4 EPS_RQCG src/eps/impls/cg/rqcg/rqcg.c /^} EPS_RQCG;$/;" t typeref:struct:__anon1 file: EPS_SMALLEST_IMAGINARY include/slepceps.h /^ EPS_SMALLEST_IMAGINARY,$/;" e enum:__anon5 EPS_SMALLEST_MAGNITUDE include/slepceps.h /^ EPS_SMALLEST_MAGNITUDE,$/;" e enum:__anon5 EPS_SMALLEST_REAL include/slepceps.h /^ EPS_SMALLEST_REAL,$/;" e enum:__anon5 EPS_SUBSPACE src/eps/impls/subspace/subspace.c /^} EPS_SUBSPACE;$/;" t typeref:struct:__anon1 file: EPS_SetUp include/slepc-private/epsimpl.h /^PETSC_EXTERN PetscLogEvent EPS_SetUp,EPS_Solve;$/;" v EPS_SetUp src/eps/interface/basic.c /^PetscLogEvent EPS_SetUp = 0,EPS_Solve = 0;$/;" v EPS_Solve include/slepc-private/epsimpl.h /^PETSC_EXTERN PetscLogEvent EPS_SetUp,EPS_Solve;$/;" v EPS_Solve src/eps/interface/basic.c /^PetscLogEvent EPS_SetUp = 0,EPS_Solve = 0;$/;" v EPS_TARGET_IMAGINARY include/slepceps.h /^ EPS_TARGET_IMAGINARY,$/;" e enum:__anon5 EPS_TARGET_MAGNITUDE include/slepceps.h /^ EPS_TARGET_MAGNITUDE,$/;" e enum:__anon5 EPS_TARGET_REAL include/slepceps.h /^ EPS_TARGET_REAL,$/;" e enum:__anon5 EPS_TRLAN src/eps/impls/external/trlan/trlanp.h /^} EPS_TRLAN;$/;" t typeref:struct:__anon1 EPS_WHICH_USER include/slepceps.h /^ EPS_WHICH_USER } EPSWhich;$/;" e enum:__anon5 EPType_t src/eps/impls/davidson/common/davidson.h /^typedef PetscInt EPType_t;$/;" t EXAMPLESC src/ds/examples/tests/makefile /^EXAMPLESC = test1.c test2.c test3.c test4.c test5.c test6.c test7.c test8.c test9.c \\$/;" m EXAMPLESC src/eps/examples/tests/makefile /^EXAMPLESC = test1.c test2.c test3.c test4.c test5.c test6.c \\$/;" m EXAMPLESC src/eps/examples/tutorials/makefile /^EXAMPLESC = ex1.c ex2.c ex3.c ex4.c ex5.c ex7.c ex9.c ex11.c ex12.c ex13.c \\$/;" m EXAMPLESC src/fn/examples/tests/makefile /^EXAMPLESC = test1.c test2.c$/;" m EXAMPLESC src/ip/examples/tests/makefile /^EXAMPLESC = test1.c test2.c test3.c test4.c$/;" m EXAMPLESC src/mfn/examples/tests/makefile /^EXAMPLESC =$/;" m EXAMPLESC src/mfn/examples/tutorials/makefile /^EXAMPLESC = ex23.c$/;" m EXAMPLESC src/nep/examples/tests/makefile /^EXAMPLESC =$/;" m EXAMPLESC src/nep/examples/tutorials/makefile /^EXAMPLESC = ex20.c ex21.c ex22.c$/;" m EXAMPLESC src/qep/examples/tests/makefile /^EXAMPLESC = test1.c test2.c$/;" m EXAMPLESC src/qep/examples/tutorials/makefile /^EXAMPLESC = ex16.c ex17.c$/;" m EXAMPLESC src/st/examples/tests/makefile /^EXAMPLESC = test1.c test2.c$/;" m EXAMPLESC src/st/examples/tutorials/makefile /^EXAMPLESC = ex10.c$/;" m EXAMPLESC src/svd/examples/tests/makefile /^EXAMPLESC = test1.c test2.c test3.c$/;" m EXAMPLESC src/svd/examples/tutorials/makefile /^EXAMPLESC = ex8.c ex14.c ex15.c$/;" m EXAMPLESF src/ds/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/eps/examples/tests/makefile /^EXAMPLESF = test7f.F test14f.F test15f.F$/;" m EXAMPLESF src/eps/examples/tutorials/makefile /^EXAMPLESF = ex1f.F ex1f90.F90 ex6f.F$/;" m EXAMPLESF src/fn/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/ip/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/mfn/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/mfn/examples/tutorials/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/nep/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/nep/examples/tutorials/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/qep/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/qep/examples/tutorials/makefile /^EXAMPLESF = ex16f90.F90$/;" m EXAMPLESF src/st/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/st/examples/tutorials/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/svd/examples/tests/makefile /^EXAMPLESF =$/;" m EXAMPLESF src/svd/examples/tutorials/makefile /^EXAMPLESF = ex15f.F$/;" m EstimateNumberEigs src/eps/impls/ciss/ciss.c /^static PetscErrorCode EstimateNumberEigs(EPS eps,Vec *S1,PetscInt *L_add)$/;" f file: Exit config/log.py /^def Exit(string):$/;" f FEASTinit_ src/eps/impls/external/feast/feastp.h /^#define FEASTinit_(/;" d FEASTrci_ src/eps/impls/external/feast/feastp.h /^#define FEASTrci_(/;" d FFLAGS include/finclude/makefile /^FFLAGS =$/;" m FFLAGS include/makefile /^FFLAGS =$/;" m FFLAGS include/slepc-private/makefile /^FFLAGS =$/;" m FFLAGS src/ds/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/ghep/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/ghiep/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/gnhep/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/hep/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/nep/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/nhep/makefile /^FFLAGS =$/;" m FFLAGS src/ds/impls/svd/makefile /^FFLAGS =$/;" m FFLAGS src/ds/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/ds/interface/makefile /^FFLAGS =$/;" m FFLAGS src/eps/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/eps/examples/tutorials/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/cg/rqcg/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/ciss/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/davidson/common/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/davidson/gd/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/davidson/jd/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/davidson/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/arpack/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/blopex/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/blzpack/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/feast/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/primme/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/primme/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/external/trlan/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/krylov/arnoldi/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/krylov/krylovschur/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/krylov/lanczos/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/krylov/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/lapack/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/power/makefile /^FFLAGS =$/;" m FFLAGS src/eps/impls/subspace/makefile /^FFLAGS =$/;" m FFLAGS src/eps/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/eps/interface/makefile /^FFLAGS =$/;" m FFLAGS src/fn/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/fn/makefile /^FFLAGS =$/;" m FFLAGS src/ip/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/ip/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/ip/makefile /^FFLAGS =$/;" m FFLAGS src/mfn/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/mfn/examples/tutorials/makefile /^FFLAGS =$/;" m FFLAGS src/mfn/impls/krylov/makefile /^FFLAGS =$/;" m FFLAGS src/mfn/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/mfn/interface/makefile /^FFLAGS =$/;" m FFLAGS src/nep/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/nep/examples/tutorials/makefile /^FFLAGS =$/;" m FFLAGS src/nep/impls/narnoldi/makefile /^FFLAGS =$/;" m FFLAGS src/nep/impls/rii/makefile /^FFLAGS =$/;" m FFLAGS src/nep/impls/slp/makefile /^FFLAGS =$/;" m FFLAGS src/nep/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/nep/interface/makefile /^FFLAGS =$/;" m FFLAGS src/qep/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/qep/examples/tutorials/makefile /^FFLAGS =$/;" m FFLAGS src/qep/impls/linear/makefile /^FFLAGS =$/;" m FFLAGS src/qep/impls/qarnoldi/makefile /^FFLAGS =$/;" m FFLAGS src/qep/impls/qlanczos/makefile /^FFLAGS =$/;" m FFLAGS src/qep/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/qep/interface/makefile /^FFLAGS =$/;" m FFLAGS src/st/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/st/examples/tutorials/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/cayley/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/fold/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/precond/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/shell/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/shell/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/shift/makefile /^FFLAGS =$/;" m FFLAGS src/st/impls/sinvert/makefile /^FFLAGS =$/;" m FFLAGS src/st/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/st/interface/makefile /^FFLAGS =$/;" m FFLAGS src/svd/examples/tests/makefile /^FFLAGS =$/;" m FFLAGS src/svd/examples/tutorials/makefile /^FFLAGS =$/;" m FFLAGS src/svd/impls/cross/makefile /^FFLAGS =$/;" m FFLAGS src/svd/impls/cyclic/makefile /^FFLAGS =$/;" m FFLAGS src/svd/impls/lanczos/makefile /^FFLAGS =$/;" m FFLAGS src/svd/impls/lapack/makefile /^FFLAGS =$/;" m FFLAGS src/svd/impls/trlanczos/makefile /^FFLAGS =$/;" m FFLAGS src/svd/interface/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/svd/interface/makefile /^FFLAGS =$/;" m FFLAGS src/sys/f90-mod/makefile /^FFLAGS =$/;" m FFLAGS src/sys/ftn-custom/makefile /^FFLAGS =$/;" m FFLAGS src/sys/makefile /^FFLAGS =$/;" m FFLAGS src/vec/makefile /^FFLAGS =$/;" m FN include/finclude/slepcfndef.h /^#define FN /;" d FN include/slepcfn.h /^typedef struct _p_FN* FN;$/;" t typeref:struct:_p_FN FNAppendOptionsPrefix src/fn/fnbasic.c /^PetscErrorCode FNAppendOptionsPrefix(FN fn,const char *prefix)$/;" f FNCreate src/fn/fnbasic.c /^PetscErrorCode FNCreate(MPI_Comm comm,FN *newfn)$/;" f FNCreate_Exp src/fn/fnexp.c /^PETSC_EXTERN PetscErrorCode FNCreate_Exp(FN fn)$/;" f FNCreate_Rational src/fn/fnrational.c /^PETSC_EXTERN PetscErrorCode FNCreate_Rational(FN fn)$/;" f FNDestroy src/fn/fnbasic.c /^PetscErrorCode FNDestroy(FN *fn)$/;" f FNEXP include/finclude/slepcfndef.h /^#define FNEXP /;" d FNEXP include/slepcfn.h /^#define FNEXP /;" d FNEvaluateDerivative src/fn/fnbasic.c /^PetscErrorCode FNEvaluateDerivative(FN fn,PetscScalar x,PetscScalar *y)$/;" f FNEvaluateDerivative_Exp src/fn/fnexp.c /^PetscErrorCode FNEvaluateDerivative_Exp(FN fn,PetscScalar x,PetscScalar *yp)$/;" f FNEvaluateDerivative_Rational src/fn/fnrational.c /^PetscErrorCode FNEvaluateDerivative_Rational(FN fn,PetscScalar x,PetscScalar *yp)$/;" f FNEvaluateFunction src/fn/fnbasic.c /^PetscErrorCode FNEvaluateFunction(FN fn,PetscScalar x,PetscScalar *y)$/;" f FNEvaluateFunction_Exp src/fn/fnexp.c /^PetscErrorCode FNEvaluateFunction_Exp(FN fn,PetscScalar x,PetscScalar *y)$/;" f FNEvaluateFunction_Rational src/fn/fnrational.c /^PetscErrorCode FNEvaluateFunction_Rational(FN fn,PetscScalar x,PetscScalar *y)$/;" f FNFinalizePackage src/fn/fnbasic.c /^PetscErrorCode FNFinalizePackage(void)$/;" f FNGetOptionsPrefix src/fn/fnbasic.c /^PetscErrorCode FNGetOptionsPrefix(FN fn,const char *prefix[])$/;" f FNGetParameters src/fn/fnbasic.c /^PetscErrorCode FNGetParameters(FN fn,PetscInt *na,PetscScalar *alpha[],PetscInt *nb,PetscScalar *beta[])$/;" f FNGetType src/fn/fnbasic.c /^PetscErrorCode FNGetType(FN fn,FNType *type)$/;" f FNInitializePackage src/fn/fnbasic.c /^PetscErrorCode FNInitializePackage(void)$/;" f FNLOG include/finclude/slepcfndef.h /^#define FNLOG /;" d FNLOG include/slepcfn.h /^#define FNLOG /;" d FNList include/slepcfn.h /^PETSC_EXTERN PetscFunctionList FNList;$/;" v FNList src/fn/fnbasic.c /^PetscFunctionList FNList = 0;$/;" v FNOps include/slepc-private/fnimpl.h /^typedef struct _FNOps *FNOps;$/;" t typeref:struct:_FNOps FNPHI include/finclude/slepcfndef.h /^#define FNPHI /;" d FNPHI include/slepcfn.h /^#define FNPHI /;" d FNPackageInitialized src/fn/fnbasic.c /^static PetscBool FNPackageInitialized = PETSC_FALSE;$/;" v file: FNRATIONAL include/finclude/slepcfndef.h /^#define FNRATIONAL /;" d FNRATIONAL include/slepcfn.h /^#define FNRATIONAL /;" d FNRegister src/fn/fnbasic.c /^PetscErrorCode FNRegister(const char *name,PetscErrorCode (*function)(FN))$/;" f FNRegisterAll src/fn/fnbasic.c /^PetscErrorCode FNRegisterAll(void)$/;" f FNRegisterAllCalled include/slepcfn.h /^PETSC_EXTERN PetscBool FNRegisterAllCalled;$/;" v FNRegisterAllCalled src/fn/fnbasic.c /^PetscBool FNRegisterAllCalled = PETSC_FALSE;$/;" v FNSetFromOptions src/fn/fnbasic.c /^PetscErrorCode FNSetFromOptions(FN fn)$/;" f FNSetOptionsPrefix src/fn/fnbasic.c /^PetscErrorCode FNSetOptionsPrefix(FN fn,const char *prefix)$/;" f FNSetParameters src/fn/fnbasic.c /^PetscErrorCode FNSetParameters(FN fn,PetscInt na,PetscScalar *alpha,PetscInt nb,PetscScalar *beta)$/;" f FNSetType src/fn/fnbasic.c /^PetscErrorCode FNSetType(FN fn,FNType type)$/;" f FNType include/finclude/slepcfndef.h /^#define FNType /;" d FNType include/slepcfn.h /^typedef const char* FNType;$/;" t FNView src/fn/fnbasic.c /^PetscErrorCode FNView(FN fn,PetscViewer viewer)$/;" f FNView_Exp src/fn/fnexp.c /^PetscErrorCode FNView_Exp(FN fn,PetscViewer viewer)$/;" f FNView_Rational src/fn/fnrational.c /^PetscErrorCode FNView_Rational(FN fn,PetscViewer viewer)$/;" f FN_CLASSID include/slepcfn.h /^PETSC_EXTERN PetscClassId FN_CLASSID;$/;" v FN_CLASSID src/fn/fnbasic.c /^PetscClassId FN_CLASSID = 0;$/;" v FPPFLAGS src/ds/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/eps/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/eps/examples/tutorials/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/fn/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/ip/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/mfn/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/mfn/examples/tutorials/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/nep/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/nep/examples/tutorials/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/qep/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/qep/examples/tutorials/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/st/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/st/examples/tutorials/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/svd/examples/tests/makefile /^FPPFLAGS =$/;" m FPPFLAGS src/svd/examples/tutorials/makefile /^FPPFLAGS =$/;" m FillMatrix src/eps/examples/tutorials/ex19.c /^PetscErrorCode FillMatrix(DM da,Mat A)$/;" f FindSource config/generatefortranstubs.py /^def FindSource(filename):$/;" f FixDir config/generatefortranstubs.py /^def FixDir(petscdir,dir,verbose):$/;" f FixFile config/generatefortranstubs.py /^def FixFile(filename):$/;" f FixSign src/nep/examples/tutorials/ex20.c /^PetscErrorCode FixSign(Vec x)$/;" f FormFunction src/nep/examples/tutorials/ex20.c /^PetscErrorCode FormFunction(NEP nep,PetscScalar lambda,Mat *fun,Mat *B,MatStructure *flg,void *ctx)$/;" f FormFunction src/nep/examples/tutorials/ex21.c /^PetscErrorCode FormFunction(NEP nep,PetscScalar lambda,Mat *fun,Mat *B,MatStructure *flg,void *ctx)$/;" f FormInitialGuess src/nep/examples/tutorials/ex20.c /^PetscErrorCode FormInitialGuess(Vec x)$/;" f FormInitialGuess src/nep/examples/tutorials/ex21.c /^PetscErrorCode FormInitialGuess(Vec x)$/;" f FormJacobian src/nep/examples/tutorials/ex20.c /^PetscErrorCode FormJacobian(NEP nep,PetscScalar lambda,Mat *jac,MatStructure *flg,void *ctx)$/;" f FormJacobian src/nep/examples/tutorials/ex21.c /^PetscErrorCode FormJacobian(NEP nep,PetscScalar lambda,Mat *jac,MatStructure *flg,void *ctx)$/;" f FortranLib config/check.py /^def FortranLib(tmpdir,conf,vars,cmake,name,dirs,libs,functions,callbacks = []):$/;" f FortranLink config/check.py /^def FortranLink(tmpdir,functions,callbacks,flags):$/;" f FromIntToScalar src/eps/impls/davidson/common/davidson.h /^#define FromIntToScalar(/;" d FromRealToScalar src/eps/impls/davidson/common/davidson.h /^#define FromRealToScalar(/;" d G src/eps/impls/cg/rqcg/rqcg.c /^ Vec *AV,*BV,*P,*G;$/;" m struct:__anon1 file: G src/eps/impls/davidson/common/davidson.h /^ *G, \/* Projected problem matrix B*\/$/;" m struct:_dvdDashboard GenerateGuesses config/check.py /^def GenerateGuesses(name):$/;" f GetExactEigenvalues src/eps/examples/tutorials/ex19.c /^PetscErrorCode GetExactEigenvalues(PetscInt M,PetscInt N,PetscInt P,PetscInt nconv,PetscReal *exact)$/;" f GetNorm2 src/vec/veccomp.c /^PETSC_STATIC_INLINE PetscReal GetNorm2(PetscReal ssq,PetscReal scale)$/;" f H src/eps/impls/davidson/common/davidson.h /^ PetscScalar *H, \/* Projected problem matrix A*\/$/;" m struct:_dvdDashboard HERM src/eps/interface/basic.c /^#define HERM /;" d file: HERM src/qep/interface/qepbasic.c /^#define HERM /;" d file: HRApply src/ds/impls/ghiep/dsghiep_ivit.c /^static PetscErrorCode HRApply(PetscInt n,PetscScalar *x1,PetscInt inc1,PetscScalar *x2,PetscInt inc2,PetscReal c,PetscReal s)$/;" f file: HRGen src/ds/impls/ghiep/dsghiep_ivit.c /^static PetscErrorCode HRGen(PetscReal x1,PetscReal x2,PetscInt *type,PetscReal *c,PetscReal *s,PetscReal *r,PetscReal *cond)$/;" f file: HRtr src/ds/impls/ghiep/dsghiep_ivit.c /^struct HRtr$/;" s file: HZIteration src/ds/impls/ghiep/dsghiep_hz.c /^static PetscErrorCode HZIteration(PetscBLASInt nn,PetscBLASInt cgd,PetscReal *aa,PetscReal *bb,PetscReal *dd,PetscScalar *uu,PetscBLASInt ld)$/;" f file: HZStep src/ds/impls/ghiep/dsghiep_hz.c /^static PetscErrorCode HZStep(PetscBLASInt ntop,PetscBLASInt nn,PetscReal tr,PetscReal dt,PetscReal *aa,PetscReal *bb,PetscReal *dd,PetscScalar *uu,PetscInt n,PetscInt ld,PetscBool *flag)$/;" f file: HarmType_t src/eps/impls/davidson/common/davidson.h /^} HarmType_t;$/;" t typeref:enum:__anon2 IP include/finclude/slepcipdef.h /^#define IP /;" d IP include/slepcip.h /^typedef struct _p_IP* IP;$/;" t typeref:struct:_p_IP IPAppendOptionsPrefix src/ip/ipbasic.c /^PetscErrorCode IPAppendOptionsPrefix(IP ip,const char *prefix)$/;" f IPApplyMatrix src/ip/ipform.c /^PetscErrorCode IPApplyMatrix(IP ip,Vec x,Vec y)$/;" f IPApplyMatrix_Private src/ip/ipform.c /^PetscErrorCode IPApplyMatrix_Private(IP ip,Vec x)$/;" f IPBILINEAR include/finclude/slepcipdef.h /^#define IPBILINEAR /;" d IPBILINEAR include/slepcip.h /^#define IPBILINEAR /;" d IPBOrthogonalize src/ip/ipborthog.c /^PetscErrorCode IPBOrthogonalize(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f IPBOrthogonalizeCGS src/ip/ipborthog.c /^static PetscErrorCode IPBOrthogonalizeCGS(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f file: IPBOrthogonalizeCGS1 src/ip/ipborthog.c /^PetscErrorCode IPBOrthogonalizeCGS1(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *onorm,PetscReal *norm)$/;" f IPBiOrthogonalize src/ip/ipbiorthog.c /^PetscErrorCode IPBiOrthogonalize(IP ip,PetscInt n,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *norm)$/;" f IPCGSBiOrthogonalization src/ip/ipbiorthog.c /^static PetscErrorCode IPCGSBiOrthogonalization(IP ip,PetscInt n_,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *hnorm,PetscReal *norm)$/;" f file: IPCreate src/ip/ipbasic.c /^PetscErrorCode IPCreate(MPI_Comm comm,IP *newip)$/;" f IPCreate_Bilinear src/ip/ipdot.c /^PETSC_EXTERN PetscErrorCode IPCreate_Bilinear(IP ip)$/;" f IPCreate_Indefinite src/ip/ipdot.c /^PETSC_EXTERN PetscErrorCode IPCreate_Indefinite(IP ip)$/;" f IPCreate_Sesquilin src/ip/ipdot.c /^PETSC_EXTERN PetscErrorCode IPCreate_Sesquilin(IP ip)$/;" f IPDestroy src/ip/ipbasic.c /^PetscErrorCode IPDestroy(IP *ip)$/;" f IPFinalizePackage src/ip/ipbasic.c /^PetscErrorCode IPFinalizePackage(void)$/;" f IPGetMatrix src/ip/ipform.c /^PetscErrorCode IPGetMatrix(IP ip,Mat* mat)$/;" f IPGetOperationCounters src/ip/ipbasic.c /^PetscErrorCode IPGetOperationCounters(IP ip,PetscInt *dots)$/;" f IPGetOptionsPrefix src/ip/ipbasic.c /^PetscErrorCode IPGetOptionsPrefix(IP ip,const char *prefix[])$/;" f IPGetOrthogonalization src/ip/ipbasic.c /^PetscErrorCode IPGetOrthogonalization(IP ip,IPOrthogType *type,IPOrthogRefineType *refine,PetscReal *eta)$/;" f IPGetType src/ip/ipbasic.c /^PetscErrorCode IPGetType(IP ip,IPType *type)$/;" f IPINDEFINITE include/finclude/slepcipdef.h /^#define IPINDEFINITE /;" d IPINDEFINITE include/slepcip.h /^#define IPINDEFINITE /;" d IPInitializePackage src/ip/ipbasic.c /^PetscErrorCode IPInitializePackage(void)$/;" f IPInnerProduct src/ip/ipdot.c /^PetscErrorCode IPInnerProduct(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPInnerProductBegin src/ip/ipdot.c /^PetscErrorCode IPInnerProductBegin(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPInnerProductBegin_Bilinear src/ip/ipdot.c /^PetscErrorCode IPInnerProductBegin_Bilinear(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPInnerProductBegin_Sesquilin src/ip/ipdot.c /^PetscErrorCode IPInnerProductBegin_Sesquilin(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPInnerProductEnd src/ip/ipdot.c /^PetscErrorCode IPInnerProductEnd(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPInnerProductEnd_Bilinear src/ip/ipdot.c /^PetscErrorCode IPInnerProductEnd_Bilinear(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPInnerProductEnd_Sesquilin src/ip/ipdot.c /^PetscErrorCode IPInnerProductEnd_Sesquilin(IP ip,Vec x,Vec y,PetscScalar *p)$/;" f IPList include/slepcip.h /^PETSC_EXTERN PetscFunctionList IPList;$/;" v IPList src/ip/ipbasic.c /^PetscFunctionList IPList = 0;$/;" v IPMInnerProduct src/ip/ipdot.c /^PetscErrorCode IPMInnerProduct(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPMInnerProductBegin src/ip/ipdot.c /^PetscErrorCode IPMInnerProductBegin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPMInnerProductBegin_Bilinear src/ip/ipdot.c /^PetscErrorCode IPMInnerProductBegin_Bilinear(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPMInnerProductBegin_Sesquilin src/ip/ipdot.c /^PetscErrorCode IPMInnerProductBegin_Sesquilin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPMInnerProductEnd src/ip/ipdot.c /^PetscErrorCode IPMInnerProductEnd(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPMInnerProductEnd_Bilinear src/ip/ipdot.c /^PetscErrorCode IPMInnerProductEnd_Bilinear(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPMInnerProductEnd_Sesquilin src/ip/ipdot.c /^PetscErrorCode IPMInnerProductEnd_Sesquilin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)$/;" f IPNorm src/ip/ipdot.c /^PetscErrorCode IPNorm(IP ip,Vec x,PetscReal *norm)$/;" f IPNormBegin src/ip/ipdot.c /^PetscErrorCode IPNormBegin(IP ip,Vec x,PetscReal *norm)$/;" f IPNormBegin_Bilinear src/ip/ipdot.c /^PetscErrorCode IPNormBegin_Bilinear(IP ip,Vec x,PetscReal *norm)$/;" f IPNormBegin_Indefinite src/ip/ipdot.c /^PetscErrorCode IPNormBegin_Indefinite(IP ip,Vec x,PetscReal *norm)$/;" f IPNormBegin_Sesquilin src/ip/ipdot.c /^PetscErrorCode IPNormBegin_Sesquilin(IP ip,Vec x,PetscReal *norm)$/;" f IPNormEnd src/ip/ipdot.c /^PetscErrorCode IPNormEnd(IP ip,Vec x,PetscReal *norm)$/;" f IPNormEnd_Bilinear src/ip/ipdot.c /^PetscErrorCode IPNormEnd_Bilinear(IP ip,Vec x,PetscReal *norm)$/;" f IPNormEnd_Indefinite src/ip/ipdot.c /^PetscErrorCode IPNormEnd_Indefinite(IP ip,Vec x,PetscReal *norm)$/;" f IPNormEnd_Sesquilin src/ip/ipdot.c /^PetscErrorCode IPNormEnd_Sesquilin(IP ip,Vec x,PetscReal *norm)$/;" f IPOps include/slepc-private/ipimpl.h /^typedef struct _IPOps *IPOps;$/;" t typeref:struct:_IPOps IPOrthogRefineType include/finclude/slepcipdef.h /^#define IPOrthogRefineType /;" d IPOrthogRefineType include/slepcip.h /^ IP_ORTHOG_REFINE_ALWAYS } IPOrthogRefineType;$/;" t typeref:enum:__anon14 IPOrthogType include/finclude/slepcipdef.h /^#define IPOrthogType /;" d IPOrthogType include/slepcip.h /^ IP_ORTHOG_CGS } IPOrthogType;$/;" t typeref:enum:__anon13 IPOrthogonalize src/ip/iporthog.c /^PetscErrorCode IPOrthogonalize(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f IPOrthogonalizeCGS src/ip/iporthog.c /^static PetscErrorCode IPOrthogonalizeCGS(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f file: IPOrthogonalizeCGS1 src/ip/iporthog.c /^PetscErrorCode IPOrthogonalizeCGS1(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *onorm,PetscReal *norm)$/;" f IPOrthogonalizeMGS src/ip/iporthog.c /^static PetscErrorCode IPOrthogonalizeMGS(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f file: IPOrthogonalizeMGS1 src/ip/iporthog.c /^static PetscErrorCode IPOrthogonalizeMGS1(IP ip,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H)$/;" f file: IPOrthonormalizeBasis_Private src/ip/iporthog.c /^PetscErrorCode IPOrthonormalizeBasis_Private(IP ip,PetscInt *m,Vec **W,Vec *V)$/;" f IPPackageInitialized src/ip/ipbasic.c /^static PetscBool IPPackageInitialized = PETSC_FALSE;$/;" v file: IPPseudoOrthogonalize src/ip/ipbiorthog.c /^PetscErrorCode IPPseudoOrthogonalize(IP ip,PetscInt n,Vec *V,PetscReal *omega,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f IPPseudoOrthogonalizeCGS src/ip/ipbiorthog.c /^static PetscErrorCode IPPseudoOrthogonalizeCGS(IP ip,PetscInt n,Vec *V,PetscReal *omega,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)$/;" f file: IPPseudoOrthogonalizeCGS1 src/ip/ipbiorthog.c /^PetscErrorCode IPPseudoOrthogonalizeCGS1(IP ip,PetscInt n,Vec *V,PetscReal* omega,Vec v,PetscScalar *H,PetscReal *onorm,PetscReal *norm)$/;" f IPQRDecomposition src/ip/iporthog.c /^PetscErrorCode IPQRDecomposition(IP ip,Vec *V,PetscInt m,PetscInt n,PetscScalar *R,PetscInt ldr)$/;" f IPRegister src/ip/ipbasic.c /^PetscErrorCode IPRegister(const char *name,PetscErrorCode (*function)(IP))$/;" f IPRegisterAll src/ip/ipbasic.c /^PetscErrorCode IPRegisterAll(void)$/;" f IPRegisterAllCalled include/slepcip.h /^PETSC_EXTERN PetscBool IPRegisterAllCalled;$/;" v IPRegisterAllCalled src/ip/ipbasic.c /^PetscBool IPRegisterAllCalled = PETSC_FALSE;$/;" v IPReset src/ip/ipbasic.c /^PetscErrorCode IPReset(IP ip)$/;" f IPResetOperationCounters src/ip/ipbasic.c /^PetscErrorCode IPResetOperationCounters(IP ip)$/;" f IPSESQUILINEAR include/finclude/slepcipdef.h /^#define IPSESQUILINEAR /;" d IPSESQUILINEAR include/slepcip.h /^#define IPSESQUILINEAR /;" d IPSetFromOptions src/ip/ipbasic.c /^PetscErrorCode IPSetFromOptions(IP ip)$/;" f IPSetMatrix src/ip/ipform.c /^PetscErrorCode IPSetMatrix(IP ip,Mat mat)$/;" f IPSetOptionsPrefix src/ip/ipbasic.c /^PetscErrorCode IPSetOptionsPrefix(IP ip,const char *prefix)$/;" f IPSetOrthogonalization src/ip/ipbasic.c /^PetscErrorCode IPSetOrthogonalization(IP ip,IPOrthogType type,IPOrthogRefineType refine,PetscReal eta)$/;" f IPSetType src/ip/ipbasic.c /^PetscErrorCode IPSetType(IP ip,IPType type)$/;" f IPSetType_Default src/ip/ipbasic.c /^PetscErrorCode IPSetType_Default(IP ip)$/;" f IPType include/finclude/slepcipdef.h /^#define IPType /;" d IPType include/slepcip.h /^typedef const char* IPType;$/;" t IPView src/ip/ipbasic.c /^PetscErrorCode IPView(IP ip,PetscViewer viewer)$/;" f IP_ApplyMatrix include/slepc-private/ipimpl.h /^PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix;$/;" v IP_ApplyMatrix src/ip/ipbasic.c /^PetscLogEvent IP_InnerProduct = 0,IP_Orthogonalize = 0,IP_ApplyMatrix = 0;$/;" v IP_CLASSID include/slepcip.h /^PETSC_EXTERN PetscClassId IP_CLASSID;$/;" v IP_CLASSID src/ip/ipbasic.c /^PetscClassId IP_CLASSID = 0;$/;" v IP_InnerProduct include/slepc-private/ipimpl.h /^PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix;$/;" v IP_InnerProduct src/ip/ipbasic.c /^PetscLogEvent IP_InnerProduct = 0,IP_Orthogonalize = 0,IP_ApplyMatrix = 0;$/;" v IP_ORTHOG_CGS include/slepcip.h /^ IP_ORTHOG_CGS } IPOrthogType;$/;" e enum:__anon13 IP_ORTHOG_MGS include/slepcip.h /^typedef enum { IP_ORTHOG_MGS,$/;" e enum:__anon13 IP_ORTHOG_REFINE_ALWAYS include/slepcip.h /^ IP_ORTHOG_REFINE_ALWAYS } IPOrthogRefineType;$/;" e enum:__anon14 IP_ORTHOG_REFINE_IFNEEDED include/slepcip.h /^ IP_ORTHOG_REFINE_IFNEEDED,$/;" e enum:__anon14 IP_ORTHOG_REFINE_NEVER include/slepcip.h /^typedef enum { IP_ORTHOG_REFINE_NEVER,$/;" e enum:__anon14 IP_Orthogonalize include/slepc-private/ipimpl.h /^PETSC_EXTERN PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix;$/;" v IP_Orthogonalize src/ip/ipbasic.c /^PetscLogEvent IP_InnerProduct = 0,IP_Orthogonalize = 0,IP_ApplyMatrix = 0;$/;" v IS include/slepc-private/epsimpl.h /^ Vec *IS,*ISL; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_EPS IS include/slepc-private/nepimpl.h /^ Vec *IS; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_NEP IS include/slepc-private/qepimpl.h /^ Vec *IS,*ISL; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_QEP IS include/slepc-private/svdimpl.h /^ Vec *IS,*ISL; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_SVD ISL include/slepc-private/epsimpl.h /^ Vec *IS,*ISL; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_EPS ISL include/slepc-private/qepimpl.h /^ Vec *IS,*ISL; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_QEP ISL include/slepc-private/svdimpl.h /^ Vec *IS,*ISL; \/* placeholder for references to user-provided initial space *\/$/;" m struct:_p_SVD InitType_t src/eps/impls/davidson/common/davidson.h /^} InitType_t;$/;" t typeref:enum:__anon3 Install config/blopex.py /^def Install(conf,vars,cmake,tmpdir,url,archdir):$/;" f K include/slepc-private/qepimpl.h /^ Mat M,C,K; \/* problem matrices *\/$/;" m struct:_p_QEP K src/qep/examples/tutorials/ex16f90.F90 /^ type(Mat) M, C, K$/;" v program:main K src/qep/impls/linear/linearp.h /^ Mat M,C,K; \/* copy of QEP coefficient matrices *\/$/;" m struct:__anon1 KSP bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer KSP;$/;" t KZ src/eps/impls/davidson/common/dvd_improvex.c /^ *KZ; \/* KZ vecs for the projector KZ*inv(X'*KZ)*X' *\/$/;" m struct:__anon11 file: L src/eps/impls/ciss/ciss.c /^ PetscInt L; \/* block size (16) *\/$/;" m struct:__anon1 file: LAPACKbdsdc_ include/slepcblaslapack.h /^#define LAPACKbdsdc_(/;" d LAPACKgeevx_ include/slepcblaslapack.h /^#define LAPACKgeevx_(/;" d LAPACKgehrd_ include/slepcblaslapack.h /^#define LAPACKgehrd_ /;" d LAPACKgelqf_ include/slepcblaslapack.h /^#define LAPACKgelqf_ /;" d LAPACKgesdd_ include/slepcblaslapack.h /^#define LAPACKgesdd_(/;" d LAPACKgetri_ include/slepcblaslapack.h /^#define LAPACKgetri_ /;" d LAPACKggev_ include/slepcblaslapack.h /^#define LAPACKggev_(/;" d LAPACKggevx_ include/slepcblaslapack.h /^#define LAPACKggevx_(/;" d LAPACKhsein_ include/slepcblaslapack.h /^#define LAPACKhsein_(/;" d LAPACKlaev2_ include/slepcblaslapack.h /^#define LAPACKlaev2_ /;" d LAPACKlag2_ include/slepcblaslapack.h /^#define LAPACKlag2_ /;" d LAPACKlaln2_ include/slepcblaslapack.h /^#define LAPACKlaln2_ /;" d LAPACKlamch_ include/slepcblaslapack.h /^#define LAPACKlamch_(/;" d LAPACKlange_ include/slepcblaslapack.h /^#define LAPACKlange_(/;" d LAPACKlanhs_ include/slepcblaslapack.h /^#define LAPACKlanhs_(/;" d LAPACKlarf_ include/slepcblaslapack.h /^#define LAPACKlarf_(/;" d LAPACKlarfg_ include/slepcblaslapack.h /^#define LAPACKlarfg_ /;" d LAPACKlartg_ include/slepcblaslapack.h /^#define LAPACKlartg_ /;" d LAPACKlasv2_ include/slepcblaslapack.h /^#define LAPACKlasv2_ /;" d LAPACKorghr_ include/slepcblaslapack.h /^#define LAPACKorghr_ /;" d LAPACKorgqr_ include/slepcblaslapack.h /^#define LAPACKorgqr_ /;" d LAPACKorgtr_ include/slepcblaslapack.h /^#define LAPACKorgtr_(/;" d LAPACKormlq_ include/slepcblaslapack.h /^#define LAPACKormlq_(/;" d LAPACKpbtrf_ include/slepcblaslapack.h /^#define LAPACKpbtrf_(/;" d LAPACKstedc_ include/slepcblaslapack.h /^#define LAPACKstedc_(/;" d LAPACKstevr_ include/slepcblaslapack.h /^#define LAPACKstevr_(/;" d LAPACKsyevd_ include/slepcblaslapack.h /^#define LAPACKsyevd_(/;" d LAPACKsyevr_ include/slepcblaslapack.h /^#define LAPACKsyevr_(/;" d LAPACKsygvd_ include/slepcblaslapack.h /^#define LAPACKsygvd_(/;" d LAPACKsytrd_ include/slepcblaslapack.h /^#define LAPACKsytrd_(/;" d LAPACKtgevc_ include/slepcblaslapack.h /^#define LAPACKtgevc_(/;" d LAPACKtgexc_ include/slepcblaslapack.h /^#define LAPACKtgexc_ /;" d LAPACKtrevc_ include/slepcblaslapack.h /^#define LAPACKtrevc_(/;" d LAPACKtrexc_ include/slepcblaslapack.h /^#define LAPACKtrexc_(/;" d LIBBASE include/finclude/makefile /^LIBBASE = libslepc$/;" m LIBBASE include/makefile /^LIBBASE = libslepc$/;" m LIBBASE include/slepc-private/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/ghep/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/ghiep/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/gnhep/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/hep/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/nep/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/nhep/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/impls/svd/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ds/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/cg/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/cg/rqcg/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/ciss/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/davidson/common/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/davidson/gd/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/davidson/jd/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/davidson/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/arpack/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/blopex/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/blzpack/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/feast/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/primme/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/primme/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/external/trlan/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/krylov/arnoldi/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/krylov/krylovschur/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/krylov/lanczos/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/krylov/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/lapack/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/power/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/impls/subspace/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/eps/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/fn/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ip/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/ip/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/mfn/impls/krylov/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/mfn/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/mfn/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/mfn/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/nep/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/nep/impls/narnoldi/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/nep/impls/rii/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/nep/impls/slp/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/nep/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/nep/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/qep/impls/linear/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/qep/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/qep/impls/qarnoldi/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/qep/impls/qlanczos/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/qep/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/qep/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/cayley/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/fold/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/precond/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/shell/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/shell/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/shift/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/impls/sinvert/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/st/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/impls/cross/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/impls/cyclic/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/impls/lanczos/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/impls/lapack/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/impls/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/impls/trlanczos/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/interface/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/svd/interface/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/sys/f90-mod/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/sys/ftn-custom/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/sys/makefile /^LIBBASE = libslepc$/;" m LIBBASE src/vec/makefile /^LIBBASE = libslepc$/;" m LOBPCG_DestroyRandomContext src/eps/impls/external/blopex/petsc-interface.c /^int LOBPCG_DestroyRandomContext(void)$/;" f LOBPCG_InitRandomContext src/eps/impls/external/blopex/petsc-interface.c /^int LOBPCG_InitRandomContext(MPI_Comm comm,PetscRandom rand)$/;" f LOBPCG_RandomContext src/eps/impls/external/blopex/petsc-interface.c /^static PetscRandom LOBPCG_RandomContext = NULL;$/;" v file: LOBPCG_SetFromOptionsRandomContext src/eps/impls/external/blopex/petsc-interface.c /^int LOBPCG_SetFromOptionsRandomContext(void)$/;" f LOCDIR include/finclude/ftn-custom/makefile /^LOCDIR = include\/finclude\/ftn-custom\/$/;" m LOCDIR include/finclude/makefile /^LOCDIR = include\/finclude\/$/;" m LOCDIR include/makefile /^LOCDIR = include\/$/;" m LOCDIR include/slepc-private/makefile /^LOCDIR = include\/slepc-private\/$/;" m LOCDIR makefile /^LOCDIR = .$/;" m LOCDIR src/ds/examples/makefile /^LOCDIR = src\/ds\/examples\/$/;" m LOCDIR src/ds/examples/tests/makefile /^LOCDIR = src\/ds\/examples\/tests\/$/;" m LOCDIR src/ds/impls/ghep/makefile /^LOCDIR = src\/ds\/impls\/ghep\/$/;" m LOCDIR src/ds/impls/ghiep/makefile /^LOCDIR = src\/ds\/impls\/ghiep\/$/;" m LOCDIR src/ds/impls/gnhep/makefile /^LOCDIR = src\/ds\/impls\/gnhep\/$/;" m LOCDIR src/ds/impls/hep/makefile /^LOCDIR = src\/ds\/impls\/hep\/$/;" m LOCDIR src/ds/impls/makefile /^LOCDIR = src\/ds\/impls\/$/;" m LOCDIR src/ds/impls/nep/makefile /^LOCDIR = src\/ds\/impls\/nep\/$/;" m LOCDIR src/ds/impls/nhep/makefile /^LOCDIR = src\/ds\/impls\/nhep\/$/;" m LOCDIR src/ds/impls/svd/makefile /^LOCDIR = src\/ds\/impls\/svd\/$/;" m LOCDIR src/ds/interface/ftn-custom/makefile /^LOCDIR = src\/ds\/interface\/ftn-custom\/$/;" m LOCDIR src/ds/interface/makefile /^LOCDIR = src\/ds\/interface\/$/;" m LOCDIR src/ds/makefile /^LOCDIR = src\/ds\/$/;" m LOCDIR src/eps/examples/makefile /^LOCDIR = src\/eps\/examples\/$/;" m LOCDIR src/eps/examples/tests/makefile /^LOCDIR = src\/eps\/examples\/tests\/$/;" m LOCDIR src/eps/examples/tutorials/makefile /^LOCDIR = src\/eps\/examples\/tutorials\/$/;" m LOCDIR src/eps/impls/cg/makefile /^LOCDIR = src\/eps\/impls\/cg\/$/;" m LOCDIR src/eps/impls/cg/rqcg/makefile /^LOCDIR = src\/eps\/impls\/cg\/rqcg\/$/;" m LOCDIR src/eps/impls/ciss/makefile /^LOCDIR = src\/eps\/impls\/ciss\/$/;" m LOCDIR src/eps/impls/davidson/common/makefile /^LOCDIR = src\/eps\/impls\/davidson\/common\/$/;" m LOCDIR src/eps/impls/davidson/gd/makefile /^LOCDIR = src\/eps\/impls\/davidson\/gd\/$/;" m LOCDIR src/eps/impls/davidson/jd/makefile /^LOCDIR = src\/eps\/impls\/davidson\/jd\/$/;" m LOCDIR src/eps/impls/davidson/makefile /^LOCDIR = src\/eps\/impls\/davidson\/$/;" m LOCDIR src/eps/impls/external/arpack/makefile /^LOCDIR = src\/eps\/impls\/external\/arpack\/$/;" m LOCDIR src/eps/impls/external/blopex/makefile /^LOCDIR = src\/eps\/impls\/external\/blopex\/$/;" m LOCDIR src/eps/impls/external/blzpack/makefile /^LOCDIR = src\/eps\/impls\/external\/blzpack\/$/;" m LOCDIR src/eps/impls/external/feast/makefile /^LOCDIR = src\/eps\/impls\/external\/feast\/$/;" m LOCDIR src/eps/impls/external/makefile /^LOCDIR = src\/eps\/impls\/external\/$/;" m LOCDIR src/eps/impls/external/primme/ftn-custom/makefile /^LOCDIR = src\/eps\/impls\/external\/primme\/ftn-custom\/$/;" m LOCDIR src/eps/impls/external/primme/makefile /^LOCDIR = src\/eps\/impls\/external\/primme\/$/;" m LOCDIR src/eps/impls/external/trlan/makefile /^LOCDIR = src\/eps\/impls\/external\/trlan\/$/;" m LOCDIR src/eps/impls/krylov/arnoldi/makefile /^LOCDIR = src\/eps\/impls\/krylov\/arnoldi\/$/;" m LOCDIR src/eps/impls/krylov/krylovschur/makefile /^LOCDIR = src\/eps\/impls\/krylov\/krylovschur\/$/;" m LOCDIR src/eps/impls/krylov/lanczos/makefile /^LOCDIR = src\/eps\/impls\/krylov\/lanczos\/$/;" m LOCDIR src/eps/impls/krylov/makefile /^LOCDIR = src\/eps\/impls\/krylov\/$/;" m LOCDIR src/eps/impls/lapack/makefile /^LOCDIR = src\/eps\/impls\/lapack\/$/;" m LOCDIR src/eps/impls/makefile /^LOCDIR = src\/eps\/impls\/$/;" m LOCDIR src/eps/impls/power/makefile /^LOCDIR = src\/eps\/impls\/power\/$/;" m LOCDIR src/eps/impls/subspace/makefile /^LOCDIR = src\/eps\/impls\/subspace\/$/;" m LOCDIR src/eps/interface/ftn-custom/makefile /^LOCDIR = src\/eps\/interface\/ftn-custom\/$/;" m LOCDIR src/eps/interface/makefile /^LOCDIR = src\/eps\/interface\/$/;" m LOCDIR src/eps/makefile /^LOCDIR = src\/eps\/$/;" m LOCDIR src/fn/examples/makefile /^LOCDIR = src\/fn\/examples\/$/;" m LOCDIR src/fn/examples/tests/makefile /^LOCDIR = src\/fn\/examples\/tests\/$/;" m LOCDIR src/fn/makefile /^LOCDIR = src\/fn\/$/;" m LOCDIR src/ip/examples/makefile /^LOCDIR = src\/ip\/examples\/$/;" m LOCDIR src/ip/examples/tests/makefile /^LOCDIR = src\/ip\/examples\/tests\/$/;" m LOCDIR src/ip/ftn-custom/makefile /^LOCDIR = src\/ip\/ftn-custom\/$/;" m LOCDIR src/ip/makefile /^LOCDIR = src\/ip\/$/;" m LOCDIR src/makefile /^LOCDIR = src\/$/;" m LOCDIR src/mfn/examples/makefile /^LOCDIR = src\/mfn\/examples\/$/;" m LOCDIR src/mfn/examples/tests/makefile /^LOCDIR = src\/mfn\/examples\/tests\/$/;" m LOCDIR src/mfn/examples/tutorials/makefile /^LOCDIR = src\/mfn\/examples\/tutorials\/$/;" m LOCDIR src/mfn/impls/krylov/makefile /^LOCDIR = src\/mfn\/impls\/krylov\/$/;" m LOCDIR src/mfn/impls/makefile /^LOCDIR = src\/mfn\/impls\/$/;" m LOCDIR src/mfn/interface/ftn-custom/makefile /^LOCDIR = src\/mfn\/interface\/ftn-custom\/$/;" m LOCDIR src/mfn/interface/makefile /^LOCDIR = src\/mfn\/interface\/$/;" m LOCDIR src/mfn/makefile /^LOCDIR = src\/mfn\/$/;" m LOCDIR src/nep/examples/makefile /^LOCDIR = src\/nep\/examples\/$/;" m LOCDIR src/nep/examples/tests/makefile /^LOCDIR = src\/nep\/examples\/tests\/$/;" m LOCDIR src/nep/examples/tutorials/makefile /^LOCDIR = src\/nep\/examples\/tutorials\/$/;" m LOCDIR src/nep/impls/makefile /^LOCDIR = src\/nep\/impls\/$/;" m LOCDIR src/nep/impls/narnoldi/makefile /^LOCDIR = src\/nep\/impls\/narnoldi\/$/;" m LOCDIR src/nep/impls/rii/makefile /^LOCDIR = src\/nep\/impls\/rii\/$/;" m LOCDIR src/nep/impls/slp/makefile /^LOCDIR = src\/nep\/impls\/slp\/$/;" m LOCDIR src/nep/interface/ftn-custom/makefile /^LOCDIR = src\/nep\/interface\/ftn-custom\/$/;" m LOCDIR src/nep/interface/makefile /^LOCDIR = src\/nep\/interface\/$/;" m LOCDIR src/nep/makefile /^LOCDIR = src\/nep\/$/;" m LOCDIR src/qep/examples/makefile /^LOCDIR = src\/qep\/examples\/$/;" m LOCDIR src/qep/examples/tests/makefile /^LOCDIR = src\/qep\/examples\/tests\/$/;" m LOCDIR src/qep/examples/tutorials/makefile /^LOCDIR = src\/qep\/examples\/tutorials\/$/;" m LOCDIR src/qep/impls/linear/makefile /^LOCDIR = src\/qep\/impls\/linear\/$/;" m LOCDIR src/qep/impls/makefile /^LOCDIR = src\/qep\/impls\/$/;" m LOCDIR src/qep/impls/qarnoldi/makefile /^LOCDIR = src\/qep\/impls\/qarnoldi\/$/;" m LOCDIR src/qep/impls/qlanczos/makefile /^LOCDIR = src\/qep\/impls\/qlanczos\/$/;" m LOCDIR src/qep/interface/ftn-custom/makefile /^LOCDIR = src\/qep\/interface\/ftn-custom\/$/;" m LOCDIR src/qep/interface/makefile /^LOCDIR = src\/qep\/interface\/$/;" m LOCDIR src/qep/makefile /^LOCDIR = src\/qep\/$/;" m LOCDIR src/st/examples/makefile /^LOCDIR = src\/st\/examples\/$/;" m LOCDIR src/st/examples/tests/makefile /^LOCDIR = src\/st\/examples\/tests\/$/;" m LOCDIR src/st/examples/tutorials/makefile /^LOCDIR = src\/st\/examples\/tutorials\/$/;" m LOCDIR src/st/impls/cayley/makefile /^LOCDIR = src\/st\/impls\/cayley\/$/;" m LOCDIR src/st/impls/fold/makefile /^LOCDIR = src\/st\/impls\/fold\/$/;" m LOCDIR src/st/impls/makefile /^LOCDIR = src\/st\/impls\/$/;" m LOCDIR src/st/impls/precond/makefile /^LOCDIR = src\/st\/impls\/precond\/$/;" m LOCDIR src/st/impls/shell/ftn-custom/makefile /^LOCDIR = src\/st\/impls\/shell\/ftn-custom\/$/;" m LOCDIR src/st/impls/shell/makefile /^LOCDIR = src\/st\/impls\/shell\/$/;" m LOCDIR src/st/impls/shift/makefile /^LOCDIR = src\/st\/impls\/shift\/$/;" m LOCDIR src/st/impls/sinvert/makefile /^LOCDIR = src\/st\/impls\/sinvert\/$/;" m LOCDIR src/st/interface/ftn-custom/makefile /^LOCDIR = src\/st\/interface\/ftn-custom\/$/;" m LOCDIR src/st/interface/makefile /^LOCDIR = src\/st\/interface\/$/;" m LOCDIR src/st/makefile /^LOCDIR = src\/st\/$/;" m LOCDIR src/svd/examples/makefile /^LOCDIR = src\/svd\/examples\/$/;" m LOCDIR src/svd/examples/tests/makefile /^LOCDIR = src\/svd\/examples\/tests\/$/;" m LOCDIR src/svd/examples/tutorials/makefile /^LOCDIR = src\/svd\/examples\/tutorials\/$/;" m LOCDIR src/svd/impls/cross/makefile /^LOCDIR = src\/svd\/impls\/cross\/$/;" m LOCDIR src/svd/impls/cyclic/makefile /^LOCDIR = src\/svd\/impls\/cyclic\/$/;" m LOCDIR src/svd/impls/lanczos/makefile /^LOCDIR = src\/svd\/impls\/lanczos\/$/;" m LOCDIR src/svd/impls/lapack/makefile /^LOCDIR = src\/svd\/impls\/lapack\/$/;" m LOCDIR src/svd/impls/makefile /^LOCDIR = src\/svd\/impls\/$/;" m LOCDIR src/svd/impls/trlanczos/makefile /^LOCDIR = src\/svd\/impls\/trlanczos\/$/;" m LOCDIR src/svd/interface/ftn-custom/makefile /^LOCDIR = src\/svd\/interface\/ftn-custom\/$/;" m LOCDIR src/svd/interface/makefile /^LOCDIR = src\/svd\/interface\/$/;" m LOCDIR src/svd/makefile /^LOCDIR = src\/svd\/$/;" m LOCDIR src/sys/f90-mod/makefile /^LOCDIR = src\/sys\/f90-mod\/$/;" m LOCDIR src/sys/ftn-custom/makefile /^LOCDIR = src\/sys\/ftn-custom\/$/;" m LOCDIR src/sys/makefile /^LOCDIR = src\/sys\/$/;" m LOCDIR src/vec/makefile /^LOCDIR = src\/vec\/$/;" m LUfac src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode LUfac(PetscInt n,PetscReal *a,PetscReal *b,PetscReal shift,PetscReal tol,PetscReal norm,PetscReal *L,PetscReal *U,PetscInt *fail,PetscReal *work,PetscInt nw)$/;" f file: L_max src/eps/impls/ciss/ciss.c /^ PetscInt L_max; \/* maximum number of columns of the source matrix V *\/$/;" m struct:__anon1 file: Link config/check.py /^def Link(tmpdir,functions,callbacks,flags):$/;" f LinkWithOutput config/check.py /^def LinkWithOutput(tmpdir,functions,callbacks,flags):$/;" f Load config/petscconf.py /^def Load(petscdir):$/;" f Load config/petscversion.py /^def Load(petscdir):$/;" f Load config/slepcversion.py /^def Load(slepcdir):$/;" f LooseVersion config/cmakeboot.py /^ from distutils.version import LooseVersion$/;" i M include/slepc-private/qepimpl.h /^ Mat M,C,K; \/* problem matrices *\/$/;" m struct:_p_QEP M src/eps/impls/ciss/ciss.c /^ PetscInt M; \/* moment degree (N\/4 = 4) *\/$/;" m struct:__anon1 file: M src/eps/impls/davidson/common/davidson.h /^ PetscScalar *M;$/;" m struct:__anon9 M src/qep/examples/tutorials/ex16f90.F90 /^ type(Ma/;" v program:main M src/qep/impls/linear/linearp.h /^ Mat M,C,K; \/* copy of QEP coefficient matrices *\/$/;" m struct:__anon1 MANSEC include/finclude/makefile /^MANSEC = $/;" m MANSEC include/makefile /^MANSEC = $/;" m MANSEC include/slepc-private/makefile /^MANSEC = $/;" m MANSEC src/ds/examples/tests/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/ghep/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/ghiep/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/gnhep/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/hep/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/nep/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/nhep/makefile /^MANSEC = DS$/;" m MANSEC src/ds/impls/svd/makefile /^MANSEC = DS$/;" m MANSEC src/ds/interface/makefile /^MANSEC = DS$/;" m MANSEC src/ds/makefile /^MANSEC = DS$/;" m MANSEC src/eps/examples/tests/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/examples/tutorials/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/cg/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/cg/rqcg/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/ciss/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/davidson/common/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/davidson/gd/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/davidson/jd/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/davidson/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/arpack/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/blopex/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/blzpack/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/feast/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/primme/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/external/trlan/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/krylov/arnoldi/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/krylov/krylovschur/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/krylov/lanczos/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/krylov/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/lapack/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/power/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/impls/subspace/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/interface/makefile /^MANSEC = EPS$/;" m MANSEC src/eps/makefile /^MANSEC = EPS$/;" m MANSEC src/fn/examples/tests/makefile /^MANSEC = FN$/;" m MANSEC src/fn/makefile /^MANSEC = FN$/;" m MANSEC src/ip/examples/tests/makefile /^MANSEC = IP$/;" m MANSEC src/ip/makefile /^MANSEC = IP$/;" m MANSEC src/mfn/examples/tests/makefile /^MANSEC = MFN$/;" m MANSEC src/mfn/examples/tutorials/makefile /^MANSEC = MFN$/;" m MANSEC src/mfn/impls/krylov/makefile /^MANSEC = MFN$/;" m MANSEC src/mfn/impls/makefile /^MANSEC = MFN$/;" m MANSEC src/mfn/interface/makefile /^MANSEC = MFN$/;" m MANSEC src/mfn/makefile /^MANSEC = MFN$/;" m MANSEC src/nep/examples/tests/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/examples/tutorials/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/impls/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/impls/narnoldi/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/impls/rii/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/impls/slp/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/interface/makefile /^MANSEC = NEP$/;" m MANSEC src/nep/makefile /^MANSEC = NEP$/;" m MANSEC src/qep/examples/tests/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/examples/tutorials/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/impls/linear/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/impls/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/impls/qarnoldi/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/impls/qlanczos/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/interface/makefile /^MANSEC = QEP$/;" m MANSEC src/qep/makefile /^MANSEC = QEP$/;" m MANSEC src/st/examples/tests/makefile /^MANSEC = ST$/;" m MANSEC src/st/examples/tutorials/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/cayley/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/fold/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/precond/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/shell/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/shift/makefile /^MANSEC = ST$/;" m MANSEC src/st/impls/sinvert/makefile /^MANSEC = ST$/;" m MANSEC src/st/interface/makefile /^MANSEC = ST$/;" m MANSEC src/st/makefile /^MANSEC = ST$/;" m MANSEC src/svd/examples/tests/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/examples/tutorials/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/impls/cross/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/impls/cyclic/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/impls/lanczos/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/impls/lapack/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/impls/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/impls/trlanczos/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/interface/makefile /^MANSEC = SVD$/;" m MANSEC src/svd/makefile /^MANSEC = SVD$/;" m MANSEC src/sys/f90-mod/makefile /^MANSEC = sys$/;" m MANSEC src/sys/ftn-custom/makefile /^MANSEC = sys$/;" m MANSEC src/sys/makefile /^MANSEC = sys$/;" m MANSEC src/vec/makefile /^MANSEC = sys$/;" m MAXEPSMONITORS include/slepc-private/epsimpl.h /^#define MAXEPSMONITORS /;" d MAXMFNMONITORS include/slepc-private/mfnimpl.h /^#define MAXMFNMONITORS /;" d MAXNEPMONITORS include/slepc-private/nepimpl.h /^#define MAXNEPMONITORS /;" d MAXQEPMONITORS include/slepc-private/qepimpl.h /^#define MAXQEPMONITORS /;" d MAXSVDMONITORS include/slepc-private/svdimpl.h /^#define MAXSVDMONITORS /;" d MAX_OPS src/eps/impls/davidson/common/dvd_calcpairs.c /^#define MAX_OPS /;" d file: MAX_OPS src/eps/impls/davidson/common/dvd_calcpairs.c /^#undef MAX_OPS$/;" d file: MAX_PADE src/ds/impls/nhep/dsnhep.c /^#define MAX_PADE /;" d file: MFN include/finclude/slepcmfndef.h /^#define MFN /;" d MFN include/slepcmfn.h /^typedef struct _p_MFN* MFN;$/;" t typeref:struct:_p_MFN MFNAppendOptionsPrefix src/mfn/interface/mfnopts.c /^PetscErrorCode MFNAppendOptionsPrefix(MFN mfn,const char *prefix)$/;" f MFNBasicArnoldi src/mfn/impls/krylov/mfnkrylov.c /^static PetscErrorCode MFNBasicArnoldi(MFN mfn,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec f,PetscReal *beta,PetscBool *breakdown)$/;" f file: MFNConvergedReason include/finclude/slepcmfndef.h /^#define MFNConvergedReason /;" d MFNConvergedReason include/slepcmfn.h /^ MFN_CONVERGED_ITERATING = 0} MFNConvergedReason;$/;" t typeref:enum:__anon16 MFNCreate src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNCreate(MPI_Comm comm,MFN *outmfn)$/;" f MFNCreate_Krylov src/mfn/impls/krylov/mfnkrylov.c /^PETSC_EXTERN PetscErrorCode MFNCreate_Krylov(MFN mfn)$/;" f MFNDestroy src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNDestroy(MFN *mfn)$/;" f MFNFinalizePackage src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNFinalizePackage(void)$/;" f MFNGetConvergedReason src/mfn/interface/mfnsolve.c /^PetscErrorCode MFNGetConvergedReason(MFN mfn,MFNConvergedReason *reason)$/;" f MFNGetDS src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNGetDS(MFN mfn,DS *ds)$/;" f MFNGetDimensions src/mfn/interface/mfnopts.c /^PetscErrorCode MFNGetDimensions(MFN mfn,PetscInt *ncv)$/;" f MFNGetErrorIfNotConverged src/mfn/interface/mfnopts.c /^PetscErrorCode MFNGetErrorIfNotConverged(MFN mfn,PetscBool *flag)$/;" f MFNGetFunction src/mfn/interface/mfnopts.c /^PetscErrorCode MFNGetFunction(MFN mfn,SlepcFunction *fun)$/;" f MFNGetIP src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNGetIP(MFN mfn,IP *ip)$/;" f MFNGetIterationNumber src/mfn/interface/mfnsolve.c /^PetscErrorCode MFNGetIterationNumber(MFN mfn,PetscInt *its)$/;" f MFNGetMonitorContext src/mfn/interface/mfnmon.c /^PetscErrorCode MFNGetMonitorContext(MFN mfn,void **ctx)$/;" f MFNGetOperator src/mfn/interface/mfnsetup.c /^PetscErrorCode MFNGetOperator(MFN mfn,Mat *A)$/;" f MFNGetOptionsPrefix src/mfn/interface/mfnopts.c /^PetscErrorCode MFNGetOptionsPrefix(MFN mfn,const char *prefix[])$/;" f MFNGetScaleFactor src/mfn/interface/mfnopts.c /^PetscErrorCode MFNGetScaleFactor(MFN mfn,PetscScalar *alpha)$/;" f MFNGetTolerances src/mfn/interface/mfnopts.c /^PetscErrorCode MFNGetTolerances(MFN mfn,PetscReal *tol,PetscInt *maxits)$/;" f MFNGetType src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNGetType(MFN mfn,MFNType *type)$/;" f MFNInitializePackage src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNInitializePackage(void)$/;" f MFNKRYLOV include/finclude/slepcmfndef.h /^#define MFNKRYLOV /;" d MFNKRYLOV include/slepcmfn.h /^#define MFNKRYLOV /;" d MFNList include/slepcmfn.h /^PETSC_EXTERN PetscFunctionList MFNList;$/;" v MFNList src/mfn/interface/mfnbasic.c /^PetscFunctionList MFNList = 0;$/;" v MFNMonitor src/mfn/interface/mfnmon.c /^PetscErrorCode MFNMonitor(MFN mfn,PetscInt it,PetscReal errest)$/;" f MFNMonitorCancel src/mfn/interface/mfnmon.c /^PetscErrorCode MFNMonitorCancel(MFN mfn)$/;" f MFNMonitorDefault src/mfn/interface/mfnmon.c /^PetscErrorCode MFNMonitorDefault(MFN mfn,PetscInt its,PetscReal errest,void *monctx)$/;" f MFNMonitorLG src/mfn/interface/mfnmon.c /^PetscErrorCode MFNMonitorLG(MFN mfn,PetscInt its,PetscReal errest,void *monctx)$/;" f MFNMonitorSet src/mfn/interface/mfnmon.c /^PetscErrorCode MFNMonitorSet(MFN mfn,PetscErrorCode (*monitor)(MFN,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))$/;" f MFNOps include/slepc-private/mfnimpl.h /^typedef struct _MFNOps *MFNOps;$/;" t typeref:struct:_MFNOps MFNPackageInitialized src/mfn/interface/mfnbasic.c /^static PetscBool MFNPackageInitialized = PETSC_FALSE;$/;" v file: MFNRegister src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNRegister(const char *name,PetscErrorCode (*function)(MFN))$/;" f MFNRegisterAll src/mfn/interface/mfnregis.c /^PetscErrorCode MFNRegisterAll(void)$/;" f MFNRegisterAllCalled include/slepcmfn.h /^PETSC_EXTERN PetscBool MFNRegisterAllCalled;$/;" v MFNRegisterAllCalled src/mfn/interface/mfnbasic.c /^PetscBool MFNRegisterAllCalled = PETSC_FALSE;$/;" v MFNReset src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNReset(MFN mfn)$/;" f MFNReset_Krylov src/mfn/impls/krylov/mfnkrylov.c /^PetscErrorCode MFNReset_Krylov(MFN mfn)$/;" f MFNSetDS src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNSetDS(MFN mfn,DS ds)$/;" f MFNSetDimensions src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetDimensions(MFN mfn,PetscInt ncv)$/;" f MFNSetErrorIfNotConverged src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetErrorIfNotConverged(MFN mfn,PetscBool flg)$/;" f MFNSetFromOptions src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetFromOptions(MFN mfn)$/;" f MFNSetFunction src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetFunction(MFN mfn,SlepcFunction fun)$/;" f MFNSetIP src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNSetIP(MFN mfn,IP ip)$/;" f MFNSetOperator src/mfn/interface/mfnsetup.c /^PetscErrorCode MFNSetOperator(MFN mfn,Mat A)$/;" f MFNSetOptionsPrefix src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetOptionsPrefix(MFN mfn,const char *prefix)$/;" f MFNSetScaleFactor src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetScaleFactor(MFN mfn,PetscScalar alpha)$/;" f MFNSetTolerances src/mfn/interface/mfnopts.c /^PetscErrorCode MFNSetTolerances(MFN mfn,PetscReal tol,PetscInt maxits)$/;" f MFNSetType src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNSetType(MFN mfn,MFNType type)$/;" f MFNSetUp src/mfn/interface/mfnsetup.c /^PetscErrorCode MFNSetUp(MFN mfn)$/;" f MFNSetUp_Krylov src/mfn/impls/krylov/mfnkrylov.c /^PetscErrorCode MFNSetUp_Krylov(MFN mfn)$/;" f MFNSolve src/mfn/interface/mfnsolve.c /^PetscErrorCode MFNSolve(MFN mfn,Vec b,Vec x)$/;" f MFNSolve_Krylov src/mfn/impls/krylov/mfnkrylov.c /^PetscErrorCode MFNSolve_Krylov(MFN mfn,Vec b,Vec x)$/;" f MFNType include/finclude/slepcmfndef.h /^#define MFNType /;" d MFNType include/slepcmfn.h /^typedef const char* MFNType;$/;" t MFNView src/mfn/interface/mfnbasic.c /^PetscErrorCode MFNView(MFN mfn,PetscViewer viewer)$/;" f MFN_CLASSID include/slepcmfn.h /^PETSC_EXTERN PetscClassId MFN_CLASSID;$/;" v MFN_CLASSID src/mfn/interface/mfnbasic.c /^PetscClassId MFN_CLASSID = 0;$/;" v MFN_CONVERGED_ITERATING include/slepcmfn.h /^ MFN_CONVERGED_ITERATING = 0} MFNConvergedReason;$/;" e enum:__anon16 MFN_CONVERGED_TOL include/slepcmfn.h /^ MFN_CONVERGED_TOL = 2,$/;" e enum:__anon16 MFN_DIVERGED_BREAKDOWN include/slepcmfn.h /^ MFN_DIVERGED_BREAKDOWN = -4,$/;" e enum:__anon16 MFN_DIVERGED_ITS include/slepcmfn.h /^ MFN_DIVERGED_ITS = -3,$/;" e enum:__anon16 MFN_SetUp include/slepc-private/mfnimpl.h /^PETSC_EXTERN PetscLogEvent MFN_SetUp, MFN_Solve;$/;" v MFN_SetUp src/mfn/interface/mfnbasic.c /^PetscLogEvent MFN_SetUp = 0,MFN_Solve = 0;$/;" v MFN_Solve include/slepc-private/mfnimpl.h /^PETSC_EXTERN PetscLogEvent MFN_SetUp, MFN_Solve;$/;" v MFN_Solve src/mfn/interface/mfnbasic.c /^PetscLogEvent MFN_SetUp = 0,MFN_Solve = 0;$/;" v MISTAKES config/cmakegen.py /^MISTAKES = []$/;" v MPIU_NORM1_AND_2 src/vec/veccomp.c /^static MPI_Datatype MPIU_NORM2=0, MPIU_NORM1_AND_2=0;$/;" v file: MPIU_NORM2 src/vec/veccomp.c /^static MPI_Datatype MPIU_NORM2=0, MPIU_NORM1_AND_2=0;$/;" v file: MPIU_NORM2_SUM src/vec/veccomp.c /^static MPI_Op MPIU_NORM2_SUM=0;$/;" v file: MPI_Comm bin/matlab/classes/slepcmatlabheader.h /^typedef int MPI_Comm;$/;" t MVMISG src/eps/examples/tutorials/ex6f.F /^ SUBROUTINE MVMISG(/;" s MadeHRtr src/ds/impls/ghiep/dsghiep_ivit.c /^static PetscErrorCode MadeHRtr(PetscInt sz,PetscInt n,PetscInt idx0,PetscInt n0,PetscInt idx1,PetscInt n1,struct HRtr *tr1,struct HRtr *tr2,PetscReal *ncond,PetscScalar *work,PetscInt lw)$/;" f file: Mat bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer Mat;$/;" t MatCreateExplicit_Linear_H1A src/qep/impls/linear/qeplin_h1.c /^PetscErrorCode MatCreateExplicit_Linear_H1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)$/;" f MatCreateExplicit_Linear_H1B src/qep/impls/linear/qeplin_h1.c /^PetscErrorCode MatCreateExplicit_Linear_H1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)$/;" f MatCreateExplicit_Linear_H2A src/qep/impls/linear/qeplin_h2.c /^PetscErrorCode MatCreateExplicit_Linear_H2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)$/;" f MatCreateExplicit_Linear_H2B src/qep/impls/linear/qeplin_h2.c /^PetscErrorCode MatCreateExplicit_Linear_H2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)$/;" f MatCreateExplicit_Linear_N1A src/qep/impls/linear/qeplin_n1.c /^PetscErrorCode MatCreateExplicit_Linear_N1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)$/;" f MatCreateExplicit_Linear_N1B src/qep/impls/linear/qeplin_n1.c /^PetscErrorCode MatCreateExplicit_Linear_N1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)$/;" f MatCreateExplicit_Linear_N2A src/qep/impls/linear/qeplin_n2.c /^PetscErrorCode MatCreateExplicit_Linear_N2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)$/;" f MatCreateExplicit_Linear_N2B src/qep/impls/linear/qeplin_n2.c /^PetscErrorCode MatCreateExplicit_Linear_N2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)$/;" f MatCreateExplicit_Linear_S1A src/qep/impls/linear/qeplin_s1.c /^PetscErrorCode MatCreateExplicit_Linear_S1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)$/;" f MatCreateExplicit_Linear_S1B src/qep/impls/linear/qeplin_s1.c /^PetscErrorCode MatCreateExplicit_Linear_S1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)$/;" f MatCreateExplicit_Linear_S2A src/qep/impls/linear/qeplin_s2.c /^PetscErrorCode MatCreateExplicit_Linear_S2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)$/;" f MatCreateExplicit_Linear_S2B src/qep/impls/linear/qeplin_s2.c /^PetscErrorCode MatCreateExplicit_Linear_S2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)$/;" f MatCtx src/nep/examples/tutorials/ex21.c /^} MatCtx;$/;" t typeref:struct:__anon2 file: MatDestroy_Fun src/nep/examples/tutorials/ex21.c /^PetscErrorCode MatDestroy_Fun(Mat A)$/;" f MatDestroy_Jac src/nep/examples/tutorials/ex21.c /^PetscErrorCode MatDestroy_Jac(Mat A)$/;" f MatDestroy_Shell src/st/interface/shellmat.c /^static PetscErrorCode MatDestroy_Shell(Mat A)$/;" f file: MatDuplicate_Fun src/nep/examples/tutorials/ex21.c /^PetscErrorCode MatDuplicate_Fun(Mat A,MatDuplicateOption op,Mat *B)$/;" f MatDuplicate_Shell src/st/examples/tests/test1.c /^static PetscErrorCode MatDuplicate_Shell(Mat S,MatDuplicateOption op,Mat *M)$/;" f file: MatGetDiagonal_Brussel src/eps/examples/tutorials/ex9.c /^PetscErrorCode MatGetDiagonal_Brussel(Mat A,Vec diag)$/;" f MatGetDiagonal_Cross src/svd/impls/cross/cross.c /^static PetscErrorCode MatGetDiagonal_Cross(Mat B,Vec d)$/;" f file: MatGetDiagonal_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode MatGetDiagonal_Cyclic(Mat B,Vec diag)$/;" f file: MatGetDiagonal_Fun src/nep/examples/tutorials/ex21.c /^PetscErrorCode MatGetDiagonal_Fun(Mat A,Vec diag)$/;" f MatGetDiagonal_Laplacian2D src/eps/examples/tests/test8.c /^PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag)$/;" f MatGetDiagonal_Laplacian2D src/eps/examples/tutorials/ex3.c /^PetscErrorCode MatGetDiagonal_Laplacian2D(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_H1A src/qep/impls/linear/qeplin_h1.c /^PetscErrorCode MatGetDiagonal_Linear_H1A(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_H1B src/qep/impls/linear/qeplin_h1.c /^PetscErrorCode MatGetDiagonal_Linear_H1B(Mat B,Vec diag)$/;" f MatGetDiagonal_Linear_H2A src/qep/impls/linear/qeplin_h2.c /^PetscErrorCode MatGetDiagonal_Linear_H2A(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_H2B src/qep/impls/linear/qeplin_h2.c /^PetscErrorCode MatGetDiagonal_Linear_H2B(Mat B,Vec diag)$/;" f MatGetDiagonal_Linear_N1A src/qep/impls/linear/qeplin_n1.c /^PetscErrorCode MatGetDiagonal_Linear_N1A(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_N1B src/qep/impls/linear/qeplin_n1.c /^PetscErrorCode MatGetDiagonal_Linear_N1B(Mat B,Vec diag)$/;" f MatGetDiagonal_Linear_N2A src/qep/impls/linear/qeplin_n2.c /^PetscErrorCode MatGetDiagonal_Linear_N2A(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_N2B src/qep/impls/linear/qeplin_n2.c /^PetscErrorCode MatGetDiagonal_Linear_N2B(Mat B,Vec diag)$/;" f MatGetDiagonal_Linear_S1A src/qep/impls/linear/qeplin_s1.c /^PetscErrorCode MatGetDiagonal_Linear_S1A(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_S1B src/qep/impls/linear/qeplin_s1.c /^PetscErrorCode MatGetDiagonal_Linear_S1B(Mat B,Vec diag)$/;" f MatGetDiagonal_Linear_S2A src/qep/impls/linear/qeplin_s2.c /^PetscErrorCode MatGetDiagonal_Linear_S2A(Mat A,Vec diag)$/;" f MatGetDiagonal_Linear_S2B src/qep/impls/linear/qeplin_s2.c /^PetscErrorCode MatGetDiagonal_Linear_S2B(Mat B,Vec diag)$/;" f MatGetDiagonal_Shell src/st/examples/tests/test1.c /^static PetscErrorCode MatGetDiagonal_Shell(Mat S,Vec diag)$/;" f file: MatGetDiagonal_Shell src/st/interface/shellmat.c /^static PetscErrorCode MatGetDiagonal_Shell(Mat A,Vec diag)$/;" f file: MatGetVecs_dvd_jd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode MatGetVecs_dvd_jd(Mat A,Vec *right,Vec *left)$/;" f MatIsing_Mult src/eps/examples/tutorials/ex6f.F /^ subroutine MatIsing_Mult(/;" s MatMarkovModel src/eps/examples/tests/test11.c /^PetscErrorCode MatMarkovModel(PetscInt m,Mat A)$/;" f MatMarkovModel src/eps/examples/tests/test9.c /^PetscErrorCode MatMarkovModel(PetscInt m,Mat A)$/;" f MatMarkovModel src/eps/examples/tutorials/ex12.c /^PetscErrorCode MatMarkovModel(PetscInt m,Mat A)$/;" f MatMarkovModel src/eps/examples/tutorials/ex18.c /^PetscErrorCode MatMarkovModel(PetscInt m,Mat A)$/;" f MatMarkovModel src/eps/examples/tutorials/ex5.c /^PetscErrorCode MatMarkovModel(PetscInt m,Mat A)$/;" f MatMarkovModel src/mfn/examples/tutorials/ex23.c /^PetscErrorCode MatMarkovModel(PetscInt m,Mat A)$/;" f MatMultTranspose_Shell src/st/examples/tests/test1.c /^static PetscErrorCode MatMultTranspose_Shell(Mat S,Vec x,Vec y)$/;" f file: MatMultTranspose_Shell src/st/interface/shellmat.c /^static PetscErrorCode MatMultTranspose_Shell(Mat A,Vec x,Vec y)$/;" f file: MatMultTranspose_dvd_jd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode MatMultTranspose_dvd_jd(Mat A,Vec in,Vec out)$/;" f MatMult_Brussel src/eps/examples/tutorials/ex9.c /^PetscErrorCode MatMult_Brussel(Mat A,Vec x,Vec y)$/;" f MatMult_Cayley src/st/impls/cayley/cayley.c /^static PetscErrorCode MatMult_Cayley(Mat B,Vec x,Vec y)$/;" f file: MatMult_Cross src/svd/impls/cross/cross.c /^static PetscErrorCode MatMult_Cross(Mat B,Vec x,Vec y)$/;" f file: MatMult_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode MatMult_Cyclic(Mat B,Vec x,Vec y)$/;" f file: MatMult_Fun src/nep/examples/tutorials/ex21.c /^PetscErrorCode MatMult_Fun(Mat A,Vec x,Vec y)$/;" f MatMult_Jac src/nep/examples/tutorials/ex21.c /^PetscErrorCode MatMult_Jac(Mat A,Vec x,Vec y)$/;" f MatMult_Laplacian2D src/eps/examples/tests/test8.c /^PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y)$/;" f MatMult_Laplacian2D src/eps/examples/tutorials/ex3.c /^PetscErrorCode MatMult_Laplacian2D(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_H1A src/qep/impls/linear/qeplin_h1.c /^PetscErrorCode MatMult_Linear_H1A(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_H1B src/qep/impls/linear/qeplin_h1.c /^PetscErrorCode MatMult_Linear_H1B(Mat B,Vec x,Vec y)$/;" f MatMult_Linear_H2A src/qep/impls/linear/qeplin_h2.c /^PetscErrorCode MatMult_Linear_H2A(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_H2B src/qep/impls/linear/qeplin_h2.c /^PetscErrorCode MatMult_Linear_H2B(Mat B,Vec x,Vec y)$/;" f MatMult_Linear_N1A src/qep/impls/linear/qeplin_n1.c /^PetscErrorCode MatMult_Linear_N1A(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_N1B src/qep/impls/linear/qeplin_n1.c /^PetscErrorCode MatMult_Linear_N1B(Mat B,Vec x,Vec y)$/;" f MatMult_Linear_N2A src/qep/impls/linear/qeplin_n2.c /^PetscErrorCode MatMult_Linear_N2A(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_N2B src/qep/impls/linear/qeplin_n2.c /^PetscErrorCode MatMult_Linear_N2B(Mat B,Vec x,Vec y)$/;" f MatMult_Linear_S1A src/qep/impls/linear/qeplin_s1.c /^PetscErrorCode MatMult_Linear_S1A(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_S1B src/qep/impls/linear/qeplin_s1.c /^PetscErrorCode MatMult_Linear_S1B(Mat B,Vec x,Vec y)$/;" f MatMult_Linear_S2A src/qep/impls/linear/qeplin_s2.c /^PetscErrorCode MatMult_Linear_S2A(Mat A,Vec x,Vec y)$/;" f MatMult_Linear_S2B src/qep/impls/linear/qeplin_s2.c /^PetscErrorCode MatMult_Linear_S2B(Mat B,Vec x,Vec y)$/;" f MatMult_Shell src/st/examples/tests/test1.c /^static PetscErrorCode MatMult_Shell(Mat S,Vec x,Vec y)$/;" f file: MatMult_Shell src/st/interface/shellmat.c /^static PetscErrorCode MatMult_Shell(Mat A,Vec x,Vec y)$/;" f file: MatMult_TRLAN src/eps/impls/external/trlan/trlan.c /^static PetscBLASInt MatMult_TRLAN(PetscBLASInt *n,PetscBLASInt *m,PetscReal *xin,PetscBLASInt *ldx,PetscReal *yout,PetscBLASInt *ldy)$/;" f file: MatMult_dvd_jd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode MatMult_dvd_jd(Mat A,Vec in,Vec out)$/;" f MatShift_Brussel src/eps/examples/tutorials/ex9.c /^PetscErrorCode MatShift_Brussel(PetscScalar* a,Mat Y)$/;" f MatType_t src/eps/impls/davidson/common/davidson.h /^typedef PetscInt MatType_t;$/;" t Method_t src/eps/impls/davidson/common/davidson.h /^} Method_t;$/;" t typeref:enum:__anon5 MyArbitrarySelection src/eps/examples/tests/test13.c /^PetscErrorCode MyArbitrarySelection(PetscScalar eigr,PetscScalar eigi,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx)$/;" f MyEPSMonitor src/eps/examples/tests/test15f.F /^ subroutine MyEPSMonitor(/;" s MyEigenSort src/eps/examples/tests/test11.c /^PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)$/;" f MyEigenSort src/eps/examples/tests/test9.c /^PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)$/;" f MyEigenSort src/eps/examples/tutorials/ex18.c /^PetscErrorCode MyEigenSort(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)$/;" f MyPetscSqrtReal src/ip/ipborthog.c /^#define MyPetscSqrtReal(/;" d file: MyShellMatCreate src/st/examples/tests/test1.c /^static PetscErrorCode MyShellMatCreate(Mat *A,Mat *M)$/;" f file: N include/slepc-private/vecimplslepc.h /^ PetscInt N; \/* virtual global size *\/$/;" m struct:__anon2 N src/eps/impls/ciss/ciss.c /^ PetscInt N; \/* number of integration points (32) *\/$/;" m struct:__anon1 file: NEP include/finclude/slepcnepdef.h /^#define NEP /;" d NEP include/slepcnep.h /^typedef struct _p_NEP* NEP;$/;" t typeref:struct:_p_NEP NEPAllocateSolution src/nep/interface/nepsetup.c /^PetscErrorCode NEPAllocateSolution(NEP nep)$/;" f NEPAppendOptionsPrefix src/nep/interface/nepopts.c /^PetscErrorCode NEPAppendOptionsPrefix(NEP nep,const char *prefix)$/;" f NEPApplyFunction src/nep/interface/nepsolve.c /^PetscErrorCode NEPApplyFunction(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,Mat *B,MatStructure *flg)$/;" f NEPApplyJacobian src/nep/interface/nepsolve.c /^PetscErrorCode NEPApplyJacobian(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,MatStructure *flg)$/;" f NEPCompareEigenvalues src/nep/interface/nepsolve.c /^PetscErrorCode NEPCompareEigenvalues(NEP nep,PetscScalar a,PetscScalar b,PetscInt *result)$/;" f NEPComputeFunction src/nep/interface/nepsolve.c /^PetscErrorCode NEPComputeFunction(NEP nep,PetscScalar lambda,Mat *A,Mat *B,MatStructure *flg)$/;" f NEPComputeJacobian src/nep/interface/nepsolve.c /^PetscErrorCode NEPComputeJacobian(NEP nep,PetscScalar lambda,Mat *A,MatStructure *flg)$/;" f NEPComputeRelativeError src/nep/interface/nepsolve.c /^PetscErrorCode NEPComputeRelativeError(NEP nep,PetscInt i,PetscReal *error)$/;" f NEPComputeRelativeError_Private src/nep/interface/nepsolve.c /^PetscErrorCode NEPComputeRelativeError_Private(NEP nep,PetscScalar lambda,Vec x,PetscReal *error)$/;" f NEPComputeResidualNorm src/nep/interface/nepsolve.c /^PetscErrorCode NEPComputeResidualNorm(NEP nep,PetscInt i,PetscReal *norm)$/;" f NEPComputeResidualNorm_Private src/nep/interface/nepsolve.c /^PetscErrorCode NEPComputeResidualNorm_Private(NEP nep,PetscScalar lambda,Vec x,PetscReal *norm)$/;" f NEPConvergedDefault src/nep/interface/nepdefault.c /^PetscErrorCode NEPConvergedDefault(NEP nep,PetscInt it,PetscReal xnorm,PetscReal snorm,PetscReal fnorm,NEPConvergedReason *reason,void *ctx)$/;" f NEPConvergedReason include/finclude/slepcnepdef.h /^#define NEPConvergedReason /;" d NEPConvergedReason include/slepcnep.h /^ NEP_CONVERGED_ITERATING = 0} NEPConvergedReason;$/;" t typeref:enum:__anon18 NEPCreate src/nep/interface/nepbasic.c /^PetscErrorCode NEPCreate(MPI_Comm comm,NEP *outnep)$/;" f NEPCreate_NARNOLDI src/nep/impls/narnoldi/narnoldi.c /^PETSC_EXTERN PetscErrorCode NEPCreate_NARNOLDI(NEP nep)$/;" f NEPCreate_RII src/nep/impls/rii/rii.c /^PETSC_EXTERN PetscErrorCode NEPCreate_RII(NEP nep)$/;" f NEPCreate_SLP src/nep/impls/slp/slp.c /^PETSC_EXTERN PetscErrorCode NEPCreate_SLP(NEP nep)$/;" f NEPDestroy src/nep/interface/nepbasic.c /^PetscErrorCode NEPDestroy(NEP *nep)$/;" f NEPDestroy_SLP src/nep/impls/slp/slp.c /^PetscErrorCode NEPDestroy_SLP(NEP nep)$/;" f NEPFinalizePackage src/nep/interface/nepbasic.c /^PetscErrorCode NEPFinalizePackage(void)$/;" f NEPFreeSolution src/nep/interface/nepsetup.c /^PetscErrorCode NEPFreeSolution(NEP nep)$/;" f NEPGetConstCorrectionTol src/nep/interface/nepopts.c /^PetscErrorCode NEPGetConstCorrectionTol(NEP nep,PetscBool *cct)$/;" f NEPGetConverged src/nep/interface/nepsolve.c /^PetscErrorCode NEPGetConverged(NEP nep,PetscInt *nconv)$/;" f NEPGetConvergedReason src/nep/interface/nepsolve.c /^PetscErrorCode NEPGetConvergedReason(NEP nep,NEPConvergedReason *reason)$/;" f NEPGetDS src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetDS(NEP nep,DS *ds)$/;" f NEPGetDefaultShift src/nep/interface/nepdefault.c /^PetscErrorCode NEPGetDefaultShift(NEP nep,PetscScalar *sigma)$/;" f NEPGetDimensions src/nep/interface/nepopts.c /^PetscErrorCode NEPGetDimensions(NEP nep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)$/;" f NEPGetEigenpair src/nep/interface/nepsolve.c /^PetscErrorCode NEPGetEigenpair(NEP nep,PetscInt i,PetscScalar *eig,Vec V)$/;" f NEPGetErrorEstimate src/nep/interface/nepsolve.c /^PetscErrorCode NEPGetErrorEstimate(NEP nep,PetscInt i,PetscReal *errest)$/;" f NEPGetFunction src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetFunction(NEP nep,Mat *A,Mat *B,PetscErrorCode (**fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void **ctx)$/;" f NEPGetIP src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetIP(NEP nep,IP *ip)$/;" f NEPGetIterationNumber src/nep/interface/nepsolve.c /^PetscErrorCode NEPGetIterationNumber(NEP nep,PetscInt *its)$/;" f NEPGetJacobian src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetJacobian(NEP nep,Mat *A,PetscErrorCode (**jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void **ctx)$/;" f NEPGetKSP src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetKSP(NEP nep,KSP *ksp)$/;" f NEPGetLagPreconditioner src/nep/interface/nepopts.c /^PetscErrorCode NEPGetLagPreconditioner(NEP nep,PetscInt *lag)$/;" f NEPGetMonitorContext src/nep/interface/nepmon.c /^PetscErrorCode NEPGetMonitorContext(NEP nep,void **ctx)$/;" f NEPGetOperationCounters src/nep/interface/nepsolve.c /^PetscErrorCode NEPGetOperationCounters(NEP nep,PetscInt* nfuncs,PetscInt* dots,PetscInt* lits)$/;" f NEPGetOptionsPrefix src/nep/interface/nepopts.c /^PetscErrorCode NEPGetOptionsPrefix(NEP nep,const char *prefix[])$/;" f NEPGetSplitOperatorInfo src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetSplitOperatorInfo(NEP nep,PetscInt *n,MatStructure *str)$/;" f NEPGetSplitOperatorTerm src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetSplitOperatorTerm(NEP nep,PetscInt k,Mat *A,FN *f)$/;" f NEPGetTarget src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetTarget(NEP nep,PetscScalar* target)$/;" f NEPGetTolerances src/nep/interface/nepopts.c /^PetscErrorCode NEPGetTolerances(NEP nep,PetscReal *abstol,PetscReal *rtol,PetscReal *stol,PetscInt *maxit,PetscInt *maxf)$/;" f NEPGetTrackAll src/nep/interface/nepopts.c /^PetscErrorCode NEPGetTrackAll(NEP nep,PetscBool *trackall)$/;" f NEPGetType src/nep/interface/nepbasic.c /^PetscErrorCode NEPGetType(NEP nep,NEPType *type)$/;" f NEPGetWhichEigenpairs src/nep/interface/nepopts.c /^PetscErrorCode NEPGetWhichEigenpairs(NEP nep,NEPWhich *which)$/;" f NEPInitializePackage src/nep/interface/nepbasic.c /^PetscErrorCode NEPInitializePackage(void)$/;" f NEPList include/slepcnep.h /^PETSC_EXTERN PetscFunctionList NEPList;$/;" v NEPList src/nep/interface/nepbasic.c /^PetscFunctionList NEPList = 0;$/;" v NEPMonitor src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitor(NEP nep,PetscInt it,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest)$/;" f NEPMonitorAll src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)$/;" f NEPMonitorCancel src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorCancel(NEP nep)$/;" f NEPMonitorConverged src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorConverged(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)$/;" f NEPMonitorFirst src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorFirst(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)$/;" f NEPMonitorLG src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorLG(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)$/;" f NEPMonitorLGAll src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorLGAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)$/;" f NEPMonitorSet src/nep/interface/nepmon.c /^PetscErrorCode NEPMonitorSet(NEP nep,PetscErrorCode (*monitor)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))$/;" f NEPNARNOLDI include/finclude/slepcnepdef.h /^#define NEPNARNOLDI /;" d NEPNARNOLDI include/slepcnep.h /^#define NEPNARNOLDI /;" d NEPOps include/slepc-private/nepimpl.h /^typedef struct _NEPOps *NEPOps;$/;" t typeref:struct:_NEPOps NEPPackageInitialized src/nep/interface/nepbasic.c /^static PetscBool NEPPackageInitialized = PETSC_FALSE;$/;" v file: NEPProjectOperator src/nep/interface/nepsolve.c /^PetscErrorCode NEPProjectOperator(NEP nep,PetscInt j0,PetscInt j1,Vec f)$/;" f NEPRII include/finclude/slepcnepdef.h /^#define NEPRII /;" d NEPRII include/slepcnep.h /^#define NEPRII /;" d NEPRegister src/nep/interface/nepbasic.c /^PetscErrorCode NEPRegister(const char *name,PetscErrorCode (*function)(NEP))$/;" f NEPRegisterAll src/nep/interface/nepregis.c /^PetscErrorCode NEPRegisterAll(void)$/;" f NEPRegisterAllCalled include/slepcnep.h /^PETSC_EXTERN PetscBool NEPRegisterAllCalled;$/;" v NEPRegisterAllCalled src/nep/interface/nepbasic.c /^PetscBool NEPRegisterAllCalled = PETSC_FALSE;$/;" v NEPReset src/nep/interface/nepbasic.c /^PetscErrorCode NEPReset(NEP nep)$/;" f NEPReset_Default src/nep/interface/nepdefault.c /^PetscErrorCode NEPReset_Default(NEP nep)$/;" f NEPReset_SLP src/nep/impls/slp/slp.c /^PetscErrorCode NEPReset_SLP(NEP nep)$/;" f NEPSLP include/finclude/slepcnepdef.h /^#define NEPSLP /;" d NEPSLP include/slepcnep.h /^#define NEPSLP /;" d NEPSLPGetEPS src/nep/impls/slp/slp.c /^PetscErrorCode NEPSLPGetEPS(NEP nep,EPS *eps)$/;" f NEPSLPGetEPS_SLP src/nep/impls/slp/slp.c /^static PetscErrorCode NEPSLPGetEPS_SLP(NEP nep,EPS *eps)$/;" f file: NEPSLPSetEPS src/nep/impls/slp/slp.c /^PetscErrorCode NEPSLPSetEPS(NEP nep,EPS eps)$/;" f NEPSLPSetEPS_SLP src/nep/impls/slp/slp.c /^static PetscErrorCode NEPSLPSetEPS_SLP(NEP nep,EPS eps)$/;" f file: NEPSetConstCorrectionTol src/nep/interface/nepopts.c /^PetscErrorCode NEPSetConstCorrectionTol(NEP nep,PetscBool cct)$/;" f NEPSetConvergenceTest src/nep/interface/nepopts.c /^PetscErrorCode NEPSetConvergenceTest(NEP nep,PetscErrorCode (*func)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void* ctx,PetscErrorCode (*destroy)(void*))$/;" f NEPSetDS src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetDS(NEP nep,DS ds)$/;" f NEPSetDimensions src/nep/interface/nepopts.c /^PetscErrorCode NEPSetDimensions(NEP nep,PetscInt nev,PetscInt ncv,PetscInt mpd)$/;" f NEPSetFromOptions src/nep/interface/nepopts.c /^PetscErrorCode NEPSetFromOptions(NEP nep)$/;" f NEPSetFromOptions_SLP src/nep/impls/slp/slp.c /^PetscErrorCode NEPSetFromOptions_SLP(NEP nep)$/;" f NEPSetFunction src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetFunction(NEP nep,Mat A,Mat B,PetscErrorCode (*fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void *ctx)$/;" f NEPSetIP src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetIP(NEP nep,IP ip)$/;" f NEPSetInitialSpace src/nep/interface/nepsetup.c /^PetscErrorCode NEPSetInitialSpace(NEP nep,PetscInt n,Vec *is)$/;" f NEPSetJacobian src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetJacobian(NEP nep,Mat A,PetscErrorCode (*jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void *ctx)$/;" f NEPSetKSP src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetKSP(NEP nep,KSP ksp)$/;" f NEPSetLagPreconditioner src/nep/interface/nepopts.c /^PetscErrorCode NEPSetLagPreconditioner(NEP nep,PetscInt lag)$/;" f NEPSetOptionsPrefix src/nep/interface/nepopts.c /^PetscErrorCode NEPSetOptionsPrefix(NEP nep,const char *prefix)$/;" f NEPSetSplitOperator src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetSplitOperator(NEP nep,PetscInt n,Mat A[],FN f[],MatStructure str)$/;" f NEPSetTarget src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetTarget(NEP nep,PetscScalar target)$/;" f NEPSetTolerances src/nep/interface/nepopts.c /^PetscErrorCode NEPSetTolerances(NEP nep,PetscReal abstol,PetscReal rtol,PetscReal stol,PetscInt maxit,PetscInt maxf)$/;" f NEPSetTrackAll src/nep/interface/nepopts.c /^PetscErrorCode NEPSetTrackAll(NEP nep,PetscBool trackall)$/;" f NEPSetType src/nep/interface/nepbasic.c /^PetscErrorCode NEPSetType(NEP nep,NEPType type)$/;" f NEPSetUp src/nep/interface/nepsetup.c /^PetscErrorCode NEPSetUp(NEP nep)$/;" f NEPSetUp_NARNOLDI src/nep/impls/narnoldi/narnoldi.c /^PetscErrorCode NEPSetUp_NARNOLDI(NEP nep)$/;" f NEPSetUp_RII src/nep/impls/rii/rii.c /^PetscErrorCode NEPSetUp_RII(NEP nep)$/;" f NEPSetUp_SLP src/nep/impls/slp/slp.c /^PetscErrorCode NEPSetUp_SLP(NEP nep)$/;" f NEPSetWhichEigenpairs src/nep/interface/nepopts.c /^PetscErrorCode NEPSetWhichEigenpairs(NEP nep,NEPWhich which)$/;" f NEPSetWorkVecs src/nep/interface/nepdefault.c /^PetscErrorCode NEPSetWorkVecs(NEP nep,PetscInt nw)$/;" f NEPSolve src/nep/interface/nepsolve.c /^PetscErrorCode NEPSolve(NEP nep)$/;" f NEPSolve_NARNOLDI src/nep/impls/narnoldi/narnoldi.c /^PetscErrorCode NEPSolve_NARNOLDI(NEP nep)$/;" f NEPSolve_RII src/nep/impls/rii/rii.c /^PetscErrorCode NEPSolve_RII(NEP nep)$/;" f NEPSolve_SLP src/nep/impls/slp/slp.c /^PetscErrorCode NEPSolve_SLP(NEP nep)$/;" f NEPSortEigenvalues src/nep/interface/nepsolve.c /^PetscErrorCode NEPSortEigenvalues(NEP nep,PetscInt n,PetscScalar *eig,PetscInt *perm)$/;" f NEPType include/finclude/slepcnepdef.h /^#define NEPType /;" d NEPType include/slepcnep.h /^typedef const char* NEPType;$/;" t NEPView src/nep/interface/nepbasic.c /^PetscErrorCode NEPView(NEP nep,PetscViewer viewer)$/;" f NEPView_SLP src/nep/impls/slp/slp.c /^PetscErrorCode NEPView_SLP(NEP nep,PetscViewer viewer)$/;" f NEPWhich include/finclude/slepcnepdef.h /^#define NEPWhich /;" d NEPWhich include/slepcnep.h /^ NEP_TARGET_IMAGINARY} NEPWhich;$/;" t typeref:enum:__anon17 NEP_CLASSID include/slepcnep.h /^PETSC_EXTERN PetscClassId NEP_CLASSID;$/;" v NEP_CLASSID src/nep/interface/nepbasic.c /^PetscClassId NEP_CLASSID = 0;$/;" v NEP_CONVERGED_FNORM_ABS include/slepcnep.h /^ NEP_CONVERGED_FNORM_ABS = 2,$/;" e enum:__anon18 NEP_CONVERGED_FNORM_RELATIVE include/slepcnep.h /^ NEP_CONVERGED_FNORM_RELATIVE = 3,$/;" e enum:__anon18 NEP_CONVERGED_ITERATING include/slepcnep.h /^ NEP_CONVERGED_ITERATING = 0} NEPConvergedReason;$/;" e enum:__anon18 NEP_CONVERGED_SNORM_RELATIVE include/slepcnep.h /^ NEP_CONVERGED_SNORM_RELATIVE = 4,$/;" e enum:__anon18 NEP_DIVERGED_BREAKDOWN include/slepcnep.h /^ NEP_DIVERGED_BREAKDOWN = -4,$/;" e enum:__anon18 NEP_DIVERGED_FNORM_NAN include/slepcnep.h /^ NEP_DIVERGED_FNORM_NAN = -5,$/;" e enum:__anon18 NEP_DIVERGED_FUNCTION_COUNT include/slepcnep.h /^ NEP_DIVERGED_FUNCTION_COUNT = -2,$/;" e enum:__anon18 NEP_DIVERGED_LINEAR_SOLVE include/slepcnep.h /^ NEP_DIVERGED_LINEAR_SOLVE = -1,$/;" e enum:__anon18 NEP_DIVERGED_MAX_IT include/slepcnep.h /^ NEP_DIVERGED_MAX_IT = -3,$/;" e enum:__anon18 NEP_Dense include/slepc-private/nepimpl.h /^PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;$/;" v NEP_Dense src/nep/interface/nepbasic.c /^PetscLogEvent NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0;$/;" v NEP_FunctionEval include/slepc-private/nepimpl.h /^PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;$/;" v NEP_FunctionEval src/nep/interface/nepbasic.c /^PetscLogEvent NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0;$/;" v NEP_JacobianEval include/slepc-private/nepimpl.h /^PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;$/;" v NEP_JacobianEval src/nep/interface/nepbasic.c /^PetscLogEvent NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0;$/;" v NEP_KSPSolve src/nep/interface/nepsolve.c /^PetscErrorCode NEP_KSPSolve(NEP nep,Vec b,Vec x)$/;" f NEP_LARGEST_IMAGINARY include/slepcnep.h /^ NEP_LARGEST_IMAGINARY,$/;" e enum:__anon17 NEP_LARGEST_MAGNITUDE include/slepcnep.h /^typedef enum { NEP_LARGEST_MAGNITUDE=1,$/;" e enum:__anon17 NEP_LARGEST_REAL include/slepcnep.h /^ NEP_LARGEST_REAL,$/;" e enum:__anon17 NEP_SLP src/nep/impls/slp/slp.c /^} NEP_SLP;$/;" t typeref:struct:__anon1 file: NEP_SMALLEST_IMAGINARY include/slepcnep.h /^ NEP_SMALLEST_IMAGINARY,$/;" e enum:__anon17 NEP_SMALLEST_MAGNITUDE include/slepcnep.h /^ NEP_SMALLEST_MAGNITUDE,$/;" e enum:__anon17 NEP_SMALLEST_REAL include/slepcnep.h /^ NEP_SMALLEST_REAL,$/;" e enum:__anon17 NEP_SetUp include/slepc-private/nepimpl.h /^PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;$/;" v NEP_SetUp src/nep/interface/nepbasic.c /^PetscLogEvent NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0;$/;" v NEP_Solve include/slepc-private/nepimpl.h /^PETSC_EXTERN PetscLogEvent NEP_SetUp,NEP_Solve,NEP_Dense,NEP_FunctionEval,NEP_JacobianEval;$/;" v NEP_Solve src/nep/interface/nepbasic.c /^PetscLogEvent NEP_SetUp = 0,NEP_Solve = 0,NEP_Dense = 0,NEP_FunctionEval = 0,NEP_JacobianEval = 0;$/;" v NEP_TARGET_IMAGINARY include/slepcnep.h /^ NEP_TARGET_IMAGINARY} NEPWhich;$/;" e enum:__anon17 NEP_TARGET_MAGNITUDE include/slepcnep.h /^ NEP_TARGET_MAGNITUDE,$/;" e enum:__anon17 NEP_TARGET_REAL include/slepcnep.h /^ NEP_TARGET_REAL,$/;" e enum:__anon17 OP include/slepc-private/svdimpl.h /^ Mat OP; \/* problem matrix *\/$/;" m struct:_p_SVD Open config/log.py /^def Open(filename):$/;" f OperatorAMultiVector src/eps/impls/external/blopex/blopex.c /^static void OperatorAMultiVector(void *data,void *x,void *y)$/;" f file: OperatorASingleVector src/eps/impls/external/blopex/blopex.c /^static void OperatorASingleVector(void *data,void *x,void *y)$/;" f file: OperatorBMultiVector src/eps/impls/external/blopex/blopex.c /^static void OperatorBMultiVector(void *data,void *x,void *y)$/;" f file: OperatorBSingleVector src/eps/impls/external/blopex/blopex.c /^static void OperatorBSingleVector(void *data,void *x,void *y)$/;" f file: P src/eps/impls/cg/rqcg/rqcg.c /^ Vec *AV,*BV,*P,*G;$/;" m struct:__anon1 file: PCApplyBA_dvd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode PCApplyBA_dvd(PC pc,PCSide side,Vec in,Vec out,Vec w)$/;" f PCApplyTranspose_dvd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode PCApplyTranspose_dvd(PC pc,Vec in,Vec out)$/;" f PCApply_User src/eps/examples/tests/test12.c /^PetscErrorCode PCApply_User(PC pc,Vec x,Vec y)$/;" f PCApply_dvd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode PCApply_dvd(PC pc,Vec in,Vec out)$/;" f PETSCSetupInterpreter src/eps/impls/external/blopex/petsc-interface.c /^int PETSCSetupInterpreter(mv_InterfaceInterpreter *i)$/;" f PETSC_Axpy src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_Axpy(void *alpha,void *x,void *y)$/;" f PETSC_ClearVector src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_ClearVector(void *x)$/;" f PETSC_CopyVector src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_CopyVector(void *x,void *y)$/;" f PETSC_DestroyVector src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_DestroyVector(void *vvector)$/;" f PETSC_END_LEN src/sys/ftn-custom/zslepc_start.c /^PETSC_EXTERN void PETSC_STDCALL slepcinitialize_(CHAR filename PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f PETSC_INTERFACE_HEADER src/eps/impls/external/blopex/petsc-interface.h /^#define PETSC_INTERFACE_HEADER$/;" d PETSC_InnerProd src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_InnerProd(void *x,void *y,void *result)$/;" f PETSC_MimicVector src/eps/impls/external/blopex/petsc-interface.c /^void *PETSC_MimicVector(void *vvector)$/;" f PETSC_ScaleVector src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_ScaleVector(double alpha,void *x)$/;" f PETSC_SetRandomValues src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_SetRandomValues(void* v,BlopexInt seed)$/;" f PETSC_VectorSize src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_VectorSize(void *x)$/;" f PETSC_dpotrf_interface src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_dpotrf_interface (char *uplo,BlopexInt *n,double *a,BlopexInt * lda,BlopexInt *info)$/;" f PETSC_dsygv_interface src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_dsygv_interface (BlopexInt *itype,char *jobz,char *uplo,BlopexInt *n,double *a,BlopexInt *lda,double *b,BlopexInt *ldb,double *w,double *work,BlopexInt *lwork,BlopexInt *info)$/;" f PETSC_zpotrf_interface src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_zpotrf_interface (char *uplo,BlopexInt *n,komplex *a,BlopexInt* lda,BlopexInt *info)$/;" f PETSC_zsygv_interface src/eps/impls/external/blopex/petsc-interface.c /^BlopexInt PETSC_zsygv_interface (BlopexInt *itype,char *jobz,char *uplo,BlopexInt *n,komplex *a,BlopexInt *lda,komplex *b,BlopexInt *ldb,double *w,komplex *work,BlopexInt *lwork,double *rwork,BlopexInt *info)$/;" f PETScMaker config/cmakeboot.py /^class PETScMaker(script.Script):$/;" c Pa src/eps/impls/davidson/common/dvd_utils.c /^ Pa, Pb; \/* H=W'*(Pa*AV - Pb*BV), G=W'*(Wa*AV - Wb*BV) *\/$/;" m struct:__anon17 file: Pb src/eps/impls/davidson/common/dvd_utils.c /^ Pa, Pb; \/* H=W'*(Pa*AV - Pb*BV), G=W'*(Wa*AV - Wb*BV) *\/$/;" m struct:__anon17 file: PetscBeganMPI src/sys/slepcinit.c /^PETSC_EXTERN PetscBool PetscBeganMPI;$/;" v PetscBool bin/matlab/classes/slepcmatlabheader.h /^typedef int PetscBool;$/;" t PetscDLLibraryRegister_slepc src/sys/slepcinit.c /^PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepc(char *path)$/;" f PetscPointer bin/matlab/classes/slepcmatlabheader.h /^typedef long int PetscPointer;$/;" t PetscViewer bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer PetscViewer;$/;" t Precond_FnMultiVector src/eps/impls/external/blopex/blopex.c /^static void Precond_FnMultiVector(void *data,void *x,void *y)$/;" f file: Precond_FnSingleVector src/eps/impls/external/blopex/blopex.c /^static void Precond_FnSingleVector(void *data,void *x,void *y)$/;" f file: PrepFtnDir config/generatefortranstubs.py /^def PrepFtnDir(dir):$/;" f Print config/log.py /^def Print(string):$/;" f Println config/log.py /^def Println(string):$/;" f ProjType_t src/eps/impls/davidson/common/davidson.h /^} ProjType_t;$/;" t typeref:enum:__anon4 ProjectMatrix src/eps/impls/ciss/ciss.c /^static PetscErrorCode ProjectMatrix(Mat A,PetscInt nv,PetscInt ld,Vec *Q,PetscScalar *H,Vec w,PetscBool isherm)$/;" f file: Prologue src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode Prologue(PetscInt n,PetscReal *a,PetscReal *b,PetscReal gl,PetscReal gr,PetscInt *m,PetscReal *shift,PetscReal *work,PetscReal nw)$/;" f file: PseudoOrthog_HR src/ds/impls/ghiep/dsghiep_ivit.c /^static PetscErrorCode PseudoOrthog_HR(PetscInt *nv,PetscScalar *V,PetscInt ldv,PetscReal *s,PetscScalar *R,PetscInt ldr,PetscBLASInt *perm,PetscBLASInt *cmplxEig,PetscBool *breakdown,PetscScalar *work,PetscInt nw)$/;" f file: QEP bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer QEP;$/;" t QEP include/finclude/slepcqepdef.h /^#define QEP /;" d QEP include/slepcqep.h /^typedef struct _p_QEP* QEP;$/;" t typeref:struct:_p_QEP QEP src/qep/examples/tests/makefile /^QEP = qarnoldi$/;" m QEPAllocateSolution src/qep/interface/qepsetup.c /^PetscErrorCode QEPAllocateSolution(QEP qep)$/;" f QEPAppendOptionsPrefix src/qep/interface/qepopts.c /^PetscErrorCode QEPAppendOptionsPrefix(QEP qep,const char *prefix)$/;" f QEPCompareEigenvalues src/qep/interface/qepsolve.c /^PetscErrorCode QEPCompareEigenvalues(QEP qep,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)$/;" f QEPComputeRelativeError src/qep/interface/qepsolve.c /^PetscErrorCode QEPComputeRelativeError(QEP qep,PetscInt i,PetscReal *error)$/;" f QEPComputeRelativeError_Private src/qep/interface/qepsolve.c /^PetscErrorCode QEPComputeRelativeError_Private(QEP qep,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *error)$/;" f QEPComputeResidualNorm src/qep/interface/qepsolve.c /^PetscErrorCode QEPComputeResidualNorm(QEP qep,PetscInt i,PetscReal *norm)$/;" f QEPComputeResidualNorm_Private src/qep/interface/qepsolve.c /^PetscErrorCode QEPComputeResidualNorm_Private(QEP qep,PetscScalar kr,PetscScalar ki,Vec xr,Vec xi,PetscReal *norm)$/;" f QEPComputeVectors_Schur src/qep/interface/qepdefault.c /^PetscErrorCode QEPComputeVectors_Schur(QEP qep)$/;" f QEPConvergedAbsolute src/qep/interface/qepdefault.c /^PetscErrorCode QEPConvergedAbsolute(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)$/;" f QEPConvergedDefault src/qep/interface/qepdefault.c /^PetscErrorCode QEPConvergedDefault(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)$/;" f QEPConvergedReason include/finclude/slepcqepdef.h /^#define QEPConvergedReason /;" d QEPConvergedReason include/slepcqep.h /^ QEP_CONVERGED_ITERATING = 0} QEPConvergedReason;$/;" t typeref:enum:__anon21 QEPCreate src/qep/interface/qepbasic.c /^PetscErrorCode QEPCreate(MPI_Comm comm,QEP *outqep)$/;" f QEPCreate_Linear src/qep/impls/linear/linear.c /^PETSC_EXTERN PetscErrorCode QEPCreate_Linear(QEP qep)$/;" f QEPCreate_QArnoldi src/qep/impls/qarnoldi/qarnoldi.c /^PETSC_EXTERN PetscErrorCode QEPCreate_QArnoldi(QEP qep)$/;" f QEPCreate_QLanczos src/qep/impls/qlanczos/qlanczos.c /^PETSC_EXTERN PetscErrorCode QEPCreate_QLanczos(QEP qep)$/;" f QEPDestroy src/qep/interface/qepbasic.c /^PetscErrorCode QEPDestroy(QEP *qep)$/;" f QEPDestroy_Linear src/qep/impls/linear/linear.c /^PetscErrorCode QEPDestroy_Linear(QEP qep)$/;" f QEPEPS src/qep/examples/tests/makefile /^QEPEPS = linear$/;" m QEPFinalizePackage src/qep/interface/qepbasic.c /^PetscErrorCode QEPFinalizePackage(void)$/;" f QEPFreeSolution src/qep/interface/qepsetup.c /^PetscErrorCode QEPFreeSolution(QEP qep)$/;" f QEPGetConverged src/qep/interface/qepsolve.c /^PetscErrorCode QEPGetConverged(QEP qep,PetscInt *nconv)$/;" f QEPGetConvergedReason src/qep/interface/qepsolve.c /^PetscErrorCode QEPGetConvergedReason(QEP qep,QEPConvergedReason *reason)$/;" f QEPGetDS src/qep/interface/qepbasic.c /^PetscErrorCode QEPGetDS(QEP qep,DS *ds)$/;" f QEPGetDimensions src/qep/interface/qepopts.c /^PetscErrorCode QEPGetDimensions(QEP qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)$/;" f QEPGetEigenpair src/qep/interface/qepsolve.c /^PetscErrorCode QEPGetEigenpair(QEP qep,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi)$/;" f QEPGetErrorEstimate src/qep/interface/qepsolve.c /^PetscErrorCode QEPGetErrorEstimate(QEP qep,PetscInt i,PetscReal *errest)$/;" f QEPGetIP src/qep/interface/qepbasic.c /^PetscErrorCode QEPGetIP(QEP qep,IP *ip)$/;" f QEPGetIterationNumber src/qep/interface/qepsolve.c /^PetscErrorCode QEPGetIterationNumber(QEP qep,PetscInt *its)$/;" f QEPGetLeftVectorsWanted src/qep/interface/qepopts.c /^PetscErrorCode QEPGetLeftVectorsWanted(QEP qep,PetscBool *leftvecs)$/;" f QEPGetMonitorContext src/qep/interface/qepmon.c /^PetscErrorCode QEPGetMonitorContext(QEP qep,void **ctx)$/;" f QEPGetOperationCounters src/qep/interface/qepsolve.c /^PetscErrorCode QEPGetOperationCounters(QEP qep,PetscInt* matvecs,PetscInt* dots,PetscInt* lits)$/;" f QEPGetOperators src/qep/interface/qepsetup.c /^PetscErrorCode QEPGetOperators(QEP qep,Mat *M,Mat *C,Mat *K)$/;" f QEPGetOptionsPrefix src/qep/interface/qepopts.c /^PetscErrorCode QEPGetOptionsPrefix(QEP qep,const char *prefix[])$/;" f QEPGetProblemType src/qep/interface/qepopts.c /^PetscErrorCode QEPGetProblemType(QEP qep,QEPProblemType *type)$/;" f QEPGetST src/qep/interface/qepbasic.c /^PetscErrorCode QEPGetST(QEP qep,ST *st)$/;" f QEPGetScaleFactor src/qep/interface/qepopts.c /^PetscErrorCode QEPGetScaleFactor(QEP qep,PetscReal *alpha)$/;" f QEPGetTarget src/qep/interface/qepbasic.c /^PetscErrorCode QEPGetTarget(QEP qep,PetscScalar* target)$/;" f QEPGetTolerances src/qep/interface/qepopts.c /^PetscErrorCode QEPGetTolerances(QEP qep,PetscReal *tol,PetscInt *maxits)$/;" f QEPGetTrackAll src/qep/interface/qepopts.c /^PetscErrorCode QEPGetTrackAll(QEP qep,PetscBool *trackall)$/;" f QEPGetType src/qep/interface/qepbasic.c /^PetscErrorCode QEPGetType(QEP qep,QEPType *type)$/;" f QEPGetWhichEigenpairs src/qep/interface/qepopts.c /^PetscErrorCode QEPGetWhichEigenpairs(QEP qep,QEPWhich *which)$/;" f QEPInitializePackage src/qep/interface/qepbasic.c /^PetscErrorCode QEPInitializePackage(void)$/;" f QEPKrylovConvergence src/qep/interface/qepdefault.c /^PetscErrorCode QEPKrylovConvergence(QEP qep,PetscBool getall,PetscInt kini,PetscInt nits,PetscInt nv,PetscReal beta,PetscInt *kout)$/;" f QEPLINEAR include/finclude/slepcqepdef.h /^#define QEPLINEAR /;" d QEPLINEAR include/slepcqep.h /^#define QEPLINEAR /;" d QEPLinearGetCompanionForm src/qep/impls/linear/linear.c /^PetscErrorCode QEPLinearGetCompanionForm(QEP qep,PetscInt *cform)$/;" f QEPLinearGetCompanionForm_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearGetCompanionForm_Linear(QEP qep,PetscInt *cform)$/;" f file: QEPLinearGetEPS src/qep/impls/linear/linear.c /^PetscErrorCode QEPLinearGetEPS(QEP qep,EPS *eps)$/;" f QEPLinearGetEPS_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearGetEPS_Linear(QEP qep,EPS *eps)$/;" f file: QEPLinearGetExplicitMatrix src/qep/impls/linear/linear.c /^PetscErrorCode QEPLinearGetExplicitMatrix(QEP qep,PetscBool *explicitmatrix)$/;" f QEPLinearGetExplicitMatrix_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearGetExplicitMatrix_Linear(QEP qep,PetscBool *explicitmatrix)$/;" f file: QEPLinearSelect_Norm src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearSelect_Norm(QEP qep,EPS eps)$/;" f file: QEPLinearSelect_Simple src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearSelect_Simple(QEP qep,EPS eps)$/;" f file: QEPLinearSetCompanionForm src/qep/impls/linear/linear.c /^PetscErrorCode QEPLinearSetCompanionForm(QEP qep,PetscInt cform)$/;" f QEPLinearSetCompanionForm_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearSetCompanionForm_Linear(QEP qep,PetscInt cform)$/;" f file: QEPLinearSetEPS src/qep/impls/linear/linear.c /^PetscErrorCode QEPLinearSetEPS(QEP qep,EPS eps)$/;" f QEPLinearSetEPS_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearSetEPS_Linear(QEP qep,EPS eps)$/;" f file: QEPLinearSetExplicitMatrix src/qep/impls/linear/linear.c /^PetscErrorCode QEPLinearSetExplicitMatrix(QEP qep,PetscBool explicitmatrix)$/;" f QEPLinearSetExplicitMatrix_Linear src/qep/impls/linear/linear.c /^static PetscErrorCode QEPLinearSetExplicitMatrix_Linear(QEP qep,PetscBool explicitmatrix)$/;" f file: QEPList include/slepcqep.h /^PETSC_EXTERN PetscFunctionList QEPList;$/;" v QEPList src/qep/interface/qepbasic.c /^PetscFunctionList QEPList = 0;$/;" v QEPMonitor src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitor(QEP qep,PetscInt it,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest)$/;" f QEPMonitorAll src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f QEPMonitorCancel src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorCancel(QEP qep)$/;" f QEPMonitorConverged src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f QEPMonitorFirst src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f QEPMonitorLG src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorLG(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f QEPMonitorLGAll src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorLGAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)$/;" f QEPMonitorSet src/qep/interface/qepmon.c /^PetscErrorCode QEPMonitorSet(QEP qep,PetscErrorCode (*monitor)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))$/;" f QEPOps include/slepc-private/qepimpl.h /^typedef struct _QEPOps *QEPOps;$/;" t typeref:struct:_QEPOps QEPPackageInitialized src/qep/interface/qepbasic.c /^static PetscBool QEPPackageInitialized = PETSC_FALSE;$/;" v file: QEPPrintSolution src/qep/interface/qepbasic.c /^PetscErrorCode QEPPrintSolution(QEP qep,PetscViewer viewer)$/;" f QEPProblemType bin/matlab/classes/slepcmatlabheader.h /^typedef int QEPProblemType;$/;" t QEPProblemType include/finclude/slepcqepdef.h /^#define QEPProblemType /;" d QEPProblemType include/slepcqep.h /^ } QEPProblemType;$/;" t typeref:enum:__anon19 QEPQARNOLDI include/finclude/slepcqepdef.h /^#define QEPQARNOLDI /;" d QEPQARNOLDI include/slepcqep.h /^#define QEPQARNOLDI /;" d QEPQArnoldi src/qep/impls/qarnoldi/qarnoldi.c /^static PetscErrorCode QEPQArnoldi(QEP qep,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscReal *beta,PetscBool *breakdown,PetscScalar *work)$/;" f file: QEPQArnoldiCGS src/qep/impls/qarnoldi/qarnoldi.c /^static PetscErrorCode QEPQArnoldiCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work)$/;" f file: QEPQLANCZOS include/finclude/slepcqepdef.h /^#define QEPQLANCZOS /;" d QEPQLANCZOS include/slepcqep.h /^#define QEPQLANCZOS /;" d QEPQLanczos src/qep/impls/qlanczos/qlanczos.c /^static PetscErrorCode QEPQLanczos(QEP qep,PetscScalar *H,PetscInt ldh,PetscReal *omega,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscBool *breakdown,PetscScalar *work,Vec *t_)$/;" f file: QEPQLanczosCGS src/qep/impls/qlanczos/qlanczos.c /^static PetscErrorCode QEPQLanczosCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscReal *omega,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work,Vec vw)$/;" f file: QEPQLanczosNorm_private src/qep/impls/qlanczos/qlanczos.c /^PetscErrorCode QEPQLanczosNorm_private(QEP qep,Vec v1,Vec v2,PetscReal *norm,Vec vw)$/;" f QEPRegister src/qep/interface/qepbasic.c /^PetscErrorCode QEPRegister(const char *name,PetscErrorCode (*function)(QEP))$/;" f QEPRegisterAll src/qep/interface/qepregis.c /^PetscErrorCode QEPRegisterAll(void)$/;" f QEPRegisterAllCalled include/slepcqep.h /^PETSC_EXTERN PetscBool QEPRegisterAllCalled;$/;" v QEPRegisterAllCalled src/qep/interface/qepbasic.c /^PetscBool QEPRegisterAllCalled = PETSC_FALSE;$/;" v QEPReset src/qep/interface/qepbasic.c /^PetscErrorCode QEPReset(QEP qep)$/;" f QEPReset_Default src/qep/interface/qepdefault.c /^PetscErrorCode QEPReset_Default(QEP qep)$/;" f QEPReset_Linear src/qep/impls/linear/linear.c /^PetscErrorCode QEPReset_Linear(QEP qep)$/;" f QEPSetConvergenceTest src/qep/interface/qepopts.c /^PetscErrorCode QEPSetConvergenceTest(QEP qep,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)$/;" f QEPSetDS src/qep/interface/qepbasic.c /^PetscErrorCode QEPSetDS(QEP qep,DS ds)$/;" f QEPSetDimensions src/qep/interface/qepopts.c /^PetscErrorCode QEPSetDimensions(QEP qep,PetscInt nev,PetscInt ncv,PetscInt mpd)$/;" f QEPSetFromOptions src/qep/interface/qepopts.c /^PetscErrorCode QEPSetFromOptions(QEP qep)$/;" f QEPSetFromOptions_Linear src/qep/impls/linear/linear.c /^PetscErrorCode QEPSetFromOptions_Linear(QEP qep)$/;" f QEPSetIP src/qep/interface/qepbasic.c /^PetscErrorCode QEPSetIP(QEP qep,IP ip)$/;" f QEPSetInitialSpace src/qep/interface/qepsetup.c /^PetscErrorCode QEPSetInitialSpace(QEP qep,PetscInt n,Vec *is)$/;" f QEPSetInitialSpaceLeft src/qep/interface/qepsetup.c /^PetscErrorCode QEPSetInitialSpaceLeft(QEP qep,PetscInt n,Vec *is)$/;" f QEPSetLeftVectorsWanted src/qep/interface/qepopts.c /^PetscErrorCode QEPSetLeftVectorsWanted(QEP qep,PetscBool leftvecs)$/;" f QEPSetOperators src/qep/interface/qepsetup.c /^PetscErrorCode QEPSetOperators(QEP qep,Mat M,Mat C,Mat K)$/;" f QEPSetOptionsPrefix src/qep/interface/qepopts.c /^PetscErrorCode QEPSetOptionsPrefix(QEP qep,const char *prefix)$/;" f QEPSetProblemType src/qep/interface/qepopts.c /^PetscErrorCode QEPSetProblemType(QEP qep,QEPProblemType type)$/;" f QEPSetST src/qep/interface/qepbasic.c /^PetscErrorCode QEPSetST(QEP qep,ST st)$/;" f QEPSetScaleFactor src/qep/interface/qepopts.c /^PetscErrorCode QEPSetScaleFactor(QEP qep,PetscReal alpha)$/;" f QEPSetTarget src/qep/interface/qepbasic.c /^PetscErrorCode QEPSetTarget(QEP qep,PetscScalar target)$/;" f QEPSetTolerances src/qep/interface/qepopts.c /^PetscErrorCode QEPSetTolerances(QEP qep,PetscReal tol,PetscInt maxits)$/;" f QEPSetTrackAll src/qep/interface/qepopts.c /^PetscErrorCode QEPSetTrackAll(QEP qep,PetscBool trackall)$/;" f QEPSetType src/qep/interface/qepbasic.c /^PetscErrorCode QEPSetType(QEP qep,QEPType type)$/;" f QEPSetUp src/qep/interface/qepsetup.c /^PetscErrorCode QEPSetUp(QEP qep)$/;" f QEPSetUp_Linear src/qep/impls/linear/linear.c /^PetscErrorCode QEPSetUp_Linear(QEP qep)$/;" f QEPSetUp_QArnoldi src/qep/impls/qarnoldi/qarnoldi.c /^PetscErrorCode QEPSetUp_QArnoldi(QEP qep)$/;" f QEPSetUp_QLanczos src/qep/impls/qlanczos/qlanczos.c /^PetscErrorCode QEPSetUp_QLanczos(QEP qep)$/;" f QEPSetWhichEigenpairs src/qep/interface/qepopts.c /^PetscErrorCode QEPSetWhichEigenpairs(QEP qep,QEPWhich which)$/;" f QEPSetWorkVecs src/qep/interface/qepdefault.c /^PetscErrorCode QEPSetWorkVecs(QEP qep,PetscInt nw)$/;" f QEPSolve src/qep/interface/qepsolve.c /^PetscErrorCode QEPSolve(QEP qep)$/;" f QEPSolve_Linear src/qep/impls/linear/linear.c /^PetscErrorCode QEPSolve_Linear(QEP qep)$/;" f QEPSolve_QArnoldi src/qep/impls/qarnoldi/qarnoldi.c /^PetscErrorCode QEPSolve_QArnoldi(QEP qep)$/;" f QEPSolve_QLanczos src/qep/impls/qlanczos/qlanczos.c /^PetscErrorCode QEPSolve_QLanczos(QEP qep)$/;" f QEPSortEigenvalues src/qep/interface/qepsolve.c /^PetscErrorCode QEPSortEigenvalues(QEP qep,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)$/;" f QEPSortForSTData src/qep/interface/qepsolve.c /^} QEPSortForSTData;$/;" t typeref:struct:__anon1 file: QEPSortForSTFunc src/qep/interface/qepsolve.c /^static PetscErrorCode QEPSortForSTFunc(PetscScalar ar,PetscScalar ai,$/;" f file: QEPType include/finclude/slepcqepdef.h /^#define QEPType /;" d QEPType include/slepcqep.h /^typedef const char* QEPType;$/;" t QEPView src/qep/interface/qepbasic.c /^PetscErrorCode QEPView(QEP qep,PetscViewer viewer)$/;" f QEPView_Linear src/qep/impls/linear/linear.c /^PetscErrorCode QEPView_Linear(QEP qep,PetscViewer viewer)$/;" f QEPWhich bin/matlab/classes/slepcmatlabheader.h /^typedef int QEPWhich;$/;" t QEPWhich include/finclude/slepcqepdef.h /^#define QEPWhich /;" d QEPWhich include/slepcqep.h /^ QEP_TARGET_IMAGINARY} QEPWhich;$/;" t typeref:enum:__anon20 QEP_CLASSID include/slepcqep.h /^PETSC_EXTERN PetscClassId QEP_CLASSID;$/;" v QEP_CLASSID src/qep/interface/qepbasic.c /^PetscClassId QEP_CLASSID = 0;$/;" v QEP_CONVERGED_ITERATING include/slepcqep.h /^ QEP_CONVERGED_ITERATING = 0} QEPConvergedReason;$/;" e enum:__anon21 QEP_CONVERGED_TOL include/slepcqep.h /^ QEP_CONVERGED_TOL = 2,$/;" e enum:__anon21 QEP_DIVERGED_BREAKDOWN include/slepcqep.h /^ QEP_DIVERGED_BREAKDOWN = -4,$/;" e enum:__anon21 QEP_DIVERGED_ITS include/slepcqep.h /^ QEP_DIVERGED_ITS = -3,$/;" e enum:__anon21 QEP_Dense include/slepc-private/qepimpl.h /^PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense;$/;" v QEP_Dense src/qep/interface/qepbasic.c /^PetscLogEvent QEP_SetUp = 0,QEP_Solve = 0,QEP_Dense = 0;$/;" v QEP_GENERAL include/slepcqep.h /^typedef enum { QEP_GENERAL=1,$/;" e enum:__anon19 QEP_GYROSCOPIC include/slepcqep.h /^ QEP_GYROSCOPIC \/* M, K Hermitian, M>0, C skew-Hermitian *\/$/;" e enum:__anon19 QEP_HERMITIAN include/slepcqep.h /^ QEP_HERMITIAN, \/* M, C, K Hermitian *\/$/;" e enum:__anon19 QEP_LARGEST_IMAGINARY include/slepcqep.h /^ QEP_LARGEST_IMAGINARY,$/;" e enum:__anon20 QEP_LARGEST_MAGNITUDE include/slepcqep.h /^typedef enum { QEP_LARGEST_MAGNITUDE=1,$/;" e enum:__anon20 QEP_LARGEST_REAL include/slepcqep.h /^ QEP_LARGEST_REAL,$/;" e enum:__anon20 QEP_LINEAR src/qep/impls/linear/linearp.h /^} QEP_LINEAR;$/;" t typeref:struct:__anon1 QEP_SMALLEST_IMAGINARY include/slepcqep.h /^ QEP_SMALLEST_IMAGINARY,$/;" e enum:__anon20 QEP_SMALLEST_MAGNITUDE include/slepcqep.h /^ QEP_SMALLEST_MAGNITUDE,$/;" e enum:__anon20 QEP_SMALLEST_REAL include/slepcqep.h /^ QEP_SMALLEST_REAL,$/;" e enum:__anon20 QEP_SetUp include/slepc-private/qepimpl.h /^PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense;$/;" v QEP_SetUp src/qep/interface/qepbasic.c /^PetscLogEvent QEP_SetUp = 0,QEP_Solve = 0,QEP_Dense = 0;$/;" v QEP_Solve include/slepc-private/qepimpl.h /^PETSC_EXTERN PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense;$/;" v QEP_Solve src/qep/interface/qepbasic.c /^PetscLogEvent QEP_SetUp = 0,QEP_Solve = 0,QEP_Dense = 0;$/;" v QEP_TARGET_IMAGINARY include/slepcqep.h /^ QEP_TARGET_IMAGINARY} QEPWhich;$/;" e enum:__anon20 QEP_TARGET_MAGNITUDE include/slepcqep.h /^ QEP_TARGET_MAGNITUDE,$/;" e enum:__anon20 QEP_TARGET_REAL include/slepcqep.h /^ QEP_TARGET_REAL,$/;" e enum:__anon20 RDict config/cmakeboot.py /^ import RDict$/;" i RealDQDS src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode RealDQDS(PetscInt n,PetscReal *L,PetscReal *U,PetscReal shift,PetscReal tol,PetscReal norm,PetscReal *L1,PetscReal *U1,PetscInt *fail)$/;" f file: S src/eps/impls/ciss/ciss.c /^ Vec *S;$/;" m struct:__anon1 file: S src/eps/impls/davidson/common/davidson.h /^ *S, \/* first Schur matrix, S = pY'*H*pX *\/$/;" m struct:_dvdDashboard S src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscScalar *S; \/* Matrix for projected problem *\/$/;" m struct:_n_SR SLEPCSetupInterpreter src/eps/impls/external/blopex/slepc-interface.c /^int SLEPCSetupInterpreter(mv_InterfaceInterpreter *i)$/;" f SLEPCSetupInterpreterForDignifiedDeath src/eps/impls/external/blopex/slepc-interface.c /^void SLEPCSetupInterpreterForDignifiedDeath(mv_InterfaceInterpreter *i)$/;" f SLEPC_ARPACK src/eps/impls/external/arpack/arpackp.h /^#define SLEPC_ARPACK(/;" d SLEPC_AUTHOR_INFO include/slepcsys.h /^#define SLEPC_AUTHOR_INFO /;" d SLEPC_BLASLAPACK include/slepcblaslapack.h /^#define SLEPC_BLASLAPACK(/;" d SLEPC_BLASLAPACKREAL include/slepcblaslapack.h /^#define SLEPC_BLASLAPACKREAL(/;" d SLEPC_BLZPACK src/eps/impls/external/blzpack/blzpackp.h /^#define SLEPC_BLZPACK(/;" d SLEPC_DEFAULT_TOL include/slepcmath.h /^# define SLEPC_DEFAULT_TOL /;" d SLEPC_FEAST src/eps/impls/external/feast/feastp.h /^#define SLEPC_FEAST(/;" d SLEPC_FEASTM src/eps/impls/external/feast/feastp.h /^#define SLEPC_FEASTM(/;" d SLEPC_FUNCTION_EXP include/slepcmath.h /^ SLEPC_FUNCTION_EXP,$/;" e enum:__anon15 SLEPC_FUNCTION_LAST include/slepcmath.h /^ SLEPC_FUNCTION_LAST } SlepcFunction;$/;" e enum:__anon15 SLEPC_FUNCTION_NONE include/slepcmath.h /^typedef enum { SLEPC_FUNCTION_NONE=0,$/;" e enum:__anon15 SLEPC_INTERFACE_HEADER src/eps/impls/external/blopex/slepc-interface.h /^#define SLEPC_INTERFACE_HEADER$/;" d SLEPC_RELEASE_DATE include/slepcversion.h /^#define SLEPC_RELEASE_DATE /;" d SLEPC_SlepcDenseCopy include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_SlepcDenseCopy src/eps/impls/davidson/common/dvd_blas.c /^PetscLogEvent SLEPC_SlepcDenseCopy = 0;$/;" v SLEPC_SlepcDenseMatInvProd include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_SlepcDenseMatProd include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_SlepcDenseMatProd src/eps/impls/davidson/common/dvd_blas.c /^PetscLogEvent SLEPC_SlepcDenseMatProd = 0;$/;" v SLEPC_SlepcDenseNorm include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_SlepcDenseNorm src/eps/impls/davidson/common/dvd_blas.c /^PetscLogEvent SLEPC_SlepcDenseNorm = 0;$/;" v SLEPC_SlepcDenseOrth include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_UpdateVectors include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_UpdateVectors include/slepc-private/vecimplslepc.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY;$/;" v SLEPC_UpdateVectors src/vec/contiguous.c /^PetscLogEvent SLEPC_UpdateVectors = 0,SLEPC_VecMAXPBY = 0;$/;" v SLEPC_VERSION makefile /^ -@grep "define SLEPC_VERSION" ${SLEPC_DIR}\/include\/slepcversion.h | ${SED} "s\/........\/\/"$/;" m SLEPC_VERSION_ include/slepcversion.h /^#define SLEPC_VERSION_(/;" d SLEPC_VERSION_DATE include/slepcversion.h /^#define SLEPC_VERSION_DATE /;" d SLEPC_VERSION_DATE_GIT include/slepcversion.h /^#define SLEPC_VERSION_DATE_GIT /;" d SLEPC_VERSION_GE include/slepcversion.h /^#define SLEPC_VERSION_GE(/;" d SLEPC_VERSION_GIT include/slepcversion.h /^#define SLEPC_VERSION_GIT /;" d SLEPC_VERSION_GT include/slepcversion.h /^#define SLEPC_VERSION_GT(/;" d SLEPC_VERSION_LE include/slepcversion.h /^#define SLEPC_VERSION_LE(/;" d SLEPC_VERSION_LT include/slepcversion.h /^#define SLEPC_VERSION_LT(/;" d SLEPC_VERSION_MAJOR include/slepcversion.h /^#define SLEPC_VERSION_MAJOR /;" d SLEPC_VERSION_MINOR include/slepcversion.h /^#define SLEPC_VERSION_MINOR /;" d SLEPC_VERSION_PATCH include/slepcversion.h /^#define SLEPC_VERSION_PATCH /;" d SLEPC_VERSION_RELEASE include/slepcversion.h /^#define SLEPC_VERSION_RELEASE /;" d SLEPC_VERSION_SUBMINOR include/slepcversion.h /^#define SLEPC_VERSION_SUBMINOR /;" d SLEPC_VecMAXPBY include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_VecMAXPBY include/slepc-private/vecimplslepc.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY;$/;" v SLEPC_VecMAXPBY src/vec/contiguous.c /^PetscLogEvent SLEPC_UpdateVectors = 0,SLEPC_VecMAXPBY = 0;$/;" v SLEPC_VecsMult include/slepc-private/slepcimpl.h /^PETSC_EXTERN PetscLogEvent SLEPC_UpdateVectors,SLEPC_VecMAXPBY,SLEPC_SlepcDenseMatProd,SLEPC_SlepcDenseOrth,SLEPC_SlepcDenseMatInvProd,SLEPC_SlepcDenseNorm,SLEPC_SlepcDenseCopy,SLEPC_VecsMult;$/;" v SLEPC_VecsMult src/eps/impls/davidson/common/dvd_blas.c /^PetscLogEvent SLEPC_VecsMult = 0;$/;" v SOURCEC include/finclude/makefile /^SOURCEC =$/;" m SOURCEC include/makefile /^SOURCEC =$/;" m SOURCEC include/slepc-private/makefile /^SOURCEC =$/;" m SOURCEC src/ds/impls/ghep/makefile /^SOURCEC = dsghep.c$/;" m SOURCEC src/ds/impls/ghiep/makefile /^SOURCEC = dsghiep_ivit.c dsghiep.c dsghiep_hz.c dsghiep_dqds.c$/;" m SOURCEC src/ds/impls/gnhep/makefile /^SOURCEC = dsgnhep.c$/;" m SOURCEC src/ds/impls/hep/makefile /^SOURCEC = dshep.c$/;" m SOURCEC src/ds/impls/nep/makefile /^SOURCEC = dsnep.c$/;" m SOURCEC src/ds/impls/nhep/makefile /^SOURCEC = dsnhep.c$/;" m SOURCEC src/ds/impls/svd/makefile /^SOURCEC = dssvd.c$/;" m SOURCEC src/ds/interface/ftn-custom/makefile /^SOURCEC = zpsf.c$/;" m SOURCEC src/ds/interface/makefile /^SOURCEC = dsbasic.c dsops.c dspriv.c$/;" m SOURCEC src/eps/impls/cg/rqcg/makefile /^SOURCEC = rqcg.c$/;" m SOURCEC src/eps/impls/ciss/makefile /^SOURCEC = ciss.c$/;" m SOURCEC src/eps/impls/davidson/common/makefile /^SOURCEC = davidson.c dvd_blas.c dvd_calcpairs.c dvd_improvex.c dvd_initv.c dvd_schm.c dvd_testconv.c dvd_updatev.c dvd_utils.c dvd_gd2.c$/;" m SOURCEC src/eps/impls/davidson/gd/makefile /^SOURCEC = gd.c$/;" m SOURCEC src/eps/impls/davidson/jd/makefile /^SOURCEC = jd.c$/;" m SOURCEC src/eps/impls/davidson/makefile /^SOURCEC =$/;" m SOURCEC src/eps/impls/external/arpack/makefile /^SOURCEC = arpack.c$/;" m SOURCEC src/eps/impls/external/blopex/makefile /^SOURCEC = blopex.c slepc-interface.c petsc-interface.c$/;" m SOURCEC src/eps/impls/external/blzpack/makefile /^SOURCEC = blzpack.c$/;" m SOURCEC src/eps/impls/external/feast/makefile /^SOURCEC = feast.c$/;" m SOURCEC src/eps/impls/external/primme/ftn-custom/makefile /^SOURCEC = zprimmef.c$/;" m SOURCEC src/eps/impls/external/primme/makefile /^SOURCEC = primme.c$/;" m SOURCEC src/eps/impls/external/trlan/makefile /^SOURCEC = trlan.c$/;" m SOURCEC src/eps/impls/krylov/arnoldi/makefile /^SOURCEC = arnoldi.c$/;" m SOURCEC src/eps/impls/krylov/krylovschur/makefile /^SOURCEC = krylovschur.c ks-symm.c ks-slice.c ks-indef.c$/;" m SOURCEC src/eps/impls/krylov/lanczos/makefile /^SOURCEC = lanczos.c$/;" m SOURCEC src/eps/impls/krylov/makefile /^SOURCEC = krylov.c$/;" m SOURCEC src/eps/impls/lapack/makefile /^SOURCEC = lapack.c$/;" m SOURCEC src/eps/impls/power/makefile /^SOURCEC = power.c$/;" m SOURCEC src/eps/impls/subspace/makefile /^SOURCEC = subspace.c$/;" m SOURCEC src/eps/interface/ftn-custom/makefile /^SOURCEC = zepsf.c$/;" m SOURCEC src/eps/interface/makefile /^SOURCEC = monitor.c basic.c default.c itregis.c opts.c setup.c solve.c mem.c$/;" m SOURCEC src/fn/makefile /^SOURCEC = fnbasic.c fnrational.c fnexp.c$/;" m SOURCEC src/ip/ftn-custom/makefile /^SOURCEC = zipf.c$/;" m SOURCEC src/ip/makefile /^SOURCEC = ipbasic.c ipdot.c iporthog.c ipborthog.c ipform.c ipbiorthog.c$/;" m SOURCEC src/mfn/impls/krylov/makefile /^SOURCEC = mfnkrylov.c$/;" m SOURCEC src/mfn/interface/ftn-custom/makefile /^SOURCEC = zmfnf.c$/;" m SOURCEC src/mfn/interface/makefile /^SOURCEC = mfnmon.c mfnbasic.c mfnregis.c mfnopts.c mfnsetup.c mfnsolve.c$/;" m SOURCEC src/nep/impls/narnoldi/makefile /^SOURCEC = narnoldi.c$/;" m SOURCEC src/nep/impls/rii/makefile /^SOURCEC = rii.c$/;" m SOURCEC src/nep/impls/slp/makefile /^SOURCEC = slp.c$/;" m SOURCEC src/nep/interface/ftn-custom/makefile /^SOURCEC = znepf.c$/;" m SOURCEC src/nep/interface/makefile /^SOURCEC = nepmon.c nepbasic.c nepdefault.c nepregis.c nepopts.c nepsetup.c nepsolve.c$/;" m SOURCEC src/qep/impls/linear/makefile /^SOURCEC = linear.c qeplin_n1.c qeplin_n2.c qeplin_s1.c qeplin_s2.c qeplin_h1.c qeplin_h2.c$/;" m SOURCEC src/qep/impls/qarnoldi/makefile /^SOURCEC = qarnoldi.c$/;" m SOURCEC src/qep/impls/qlanczos/makefile /^SOURCEC = qlanczos.c$/;" m SOURCEC src/qep/interface/ftn-custom/makefile /^SOURCEC = zqepf.c$/;" m SOURCEC src/qep/interface/makefile /^SOURCEC = qepmon.c qepbasic.c qepdefault.c qepregis.c qepopts.c qepsetup.c qepsolve.c$/;" m SOURCEC src/st/impls/cayley/makefile /^SOURCEC = cayley.c$/;" m SOURCEC src/st/impls/fold/makefile /^SOURCEC = fold.c$/;" m SOURCEC src/st/impls/precond/makefile /^SOURCEC = precond.c$/;" m SOURCEC src/st/impls/shell/ftn-custom/makefile /^SOURCEC = zshell.c$/;" m SOURCEC src/st/impls/shell/makefile /^SOURCEC = shell.c$/;" m SOURCEC src/st/impls/shift/makefile /^SOURCEC = shift.c$/;" m SOURCEC src/st/impls/sinvert/makefile /^SOURCEC = sinvert.c$/;" m SOURCEC src/st/interface/ftn-custom/makefile /^SOURCEC = zstf.c$/;" m SOURCEC src/st/interface/makefile /^SOURCEC = stfunc.c stset.c stsolve.c stsles.c stregis.c shellmat.c$/;" m SOURCEC src/svd/impls/cross/makefile /^SOURCEC = cross.c$/;" m SOURCEC src/svd/impls/cyclic/makefile /^SOURCEC = cyclic.c$/;" m SOURCEC src/svd/impls/lanczos/makefile /^SOURCEC = gklanczos.c$/;" m SOURCEC src/svd/impls/lapack/makefile /^SOURCEC = svdlapack.c$/;" m SOURCEC src/svd/impls/trlanczos/makefile /^SOURCEC = trlanczos.c$/;" m SOURCEC src/svd/interface/ftn-custom/makefile /^SOURCEC = zsvdf.c$/;" m SOURCEC src/svd/interface/makefile /^SOURCEC = svdregis.c svdbasic.c svdopts.c svdsetup.c svdsolve.c svdmon.c svdmat.c$/;" m SOURCEC src/sys/f90-mod/makefile /^SOURCEC =$/;" m SOURCEC src/sys/ftn-custom/makefile /^SOURCEC = zslepc_start.c zslepc_startf.c$/;" m SOURCEC src/sys/makefile /^SOURCEC = slepcinit.c slepcutil.c$/;" m SOURCEC src/vec/makefile /^SOURCEC = vecutil.c veccomp.c contiguous.c$/;" m SOURCEF include/finclude/makefile /^SOURCEF =$/;" m SOURCEF include/makefile /^SOURCEF =$/;" m SOURCEF include/slepc-private/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/ghep/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/ghiep/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/gnhep/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/hep/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/nep/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/nhep/makefile /^SOURCEF =$/;" m SOURCEF src/ds/impls/svd/makefile /^SOURCEF =$/;" m SOURCEF src/ds/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/ds/interface/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/cg/rqcg/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/ciss/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/davidson/common/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/davidson/gd/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/davidson/jd/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/davidson/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/arpack/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/blopex/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/blzpack/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/feast/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/primme/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/primme/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/external/trlan/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/krylov/arnoldi/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/krylov/krylovschur/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/krylov/lanczos/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/krylov/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/lapack/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/power/makefile /^SOURCEF =$/;" m SOURCEF src/eps/impls/subspace/makefile /^SOURCEF =$/;" m SOURCEF src/eps/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/eps/interface/makefile /^SOURCEF =$/;" m SOURCEF src/fn/makefile /^SOURCEF =$/;" m SOURCEF src/ip/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/ip/makefile /^SOURCEF =$/;" m SOURCEF src/mfn/impls/krylov/makefile /^SOURCEF =$/;" m SOURCEF src/mfn/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/mfn/interface/makefile /^SOURCEF =$/;" m SOURCEF src/nep/impls/narnoldi/makefile /^SOURCEF = $/;" m SOURCEF src/nep/impls/rii/makefile /^SOURCEF =$/;" m SOURCEF src/nep/impls/slp/makefile /^SOURCEF =$/;" m SOURCEF src/nep/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/nep/interface/makefile /^SOURCEF =$/;" m SOURCEF src/qep/impls/linear/makefile /^SOURCEF =$/;" m SOURCEF src/qep/impls/qarnoldi/makefile /^SOURCEF =$/;" m SOURCEF src/qep/impls/qlanczos/makefile /^SOURCEF =$/;" m SOURCEF src/qep/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/qep/interface/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/cayley/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/fold/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/precond/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/shell/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/shell/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/shift/makefile /^SOURCEF =$/;" m SOURCEF src/st/impls/sinvert/makefile /^SOURCEF =$/;" m SOURCEF src/st/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/st/interface/makefile /^SOURCEF =$/;" m SOURCEF src/svd/impls/cross/makefile /^SOURCEF =$/;" m SOURCEF src/svd/impls/cyclic/makefile /^SOURCEF =$/;" m SOURCEF src/svd/impls/lanczos/makefile /^SOURCEF =$/;" m SOURCEF src/svd/impls/lapack/makefile /^SOURCEF =$/;" m SOURCEF src/svd/impls/trlanczos/makefile /^SOURCEF =$/;" m SOURCEF src/svd/interface/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/svd/interface/makefile /^SOURCEF =$/;" m SOURCEF src/sys/f90-mod/makefile /^SOURCEF = slepcmod.F$/;" m SOURCEF src/sys/ftn-custom/makefile /^SOURCEF =$/;" m SOURCEF src/sys/makefile /^SOURCEF =$/;" m SOURCEF src/vec/makefile /^SOURCEF =$/;" m SOURCEH include/finclude/makefile /^SOURCEH = slepc.h slepceps.h slepcst.h slepcsvd.h slepcqep.h slepcnep.h slepcmfn.h slepcip.h slepcds.h slepcfn.h \\$/;" m SOURCEH include/makefile /^SOURCEH = slepc.h slepcsys.h slepcmath.h slepcversion.h slepcblaslapack.h \\$/;" m SOURCEH include/slepc-private/makefile /^SOURCEH = epsimpl.h stimpl.h svdimpl.h ipimpl.h qepimpl.h nepimpl.h \\$/;" m SOURCEH src/ds/impls/ghep/makefile /^SOURCEH =$/;" m SOURCEH src/ds/impls/ghiep/makefile /^SOURCEH =$/;" m SOURCEH src/ds/impls/gnhep/makefile /^SOURCEH =$/;" m SOURCEH src/ds/impls/hep/makefile /^SOURCEH =$/;" m SOURCEH src/ds/impls/nep/makefile /^SOURCEH =$/;" m SOURCEH src/ds/impls/nhep/makefile /^SOURCEH =$/;" m SOURCEH src/ds/impls/svd/makefile /^SOURCEH =$/;" m SOURCEH src/ds/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/ds/interface/makefile /^SOURCEH =$/;" m SOURCEH src/ds/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/dsimpl.h ..\/..\/include\/slepcds.h$/;" m SOURCEH src/eps/impls/cg/rqcg/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/ciss/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/davidson/common/makefile /^SOURCEH = davidson.h$/;" m SOURCEH src/eps/impls/davidson/gd/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/davidson/jd/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/davidson/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/external/arpack/makefile /^SOURCEH = arpackp.h$/;" m SOURCEH src/eps/impls/external/blopex/makefile /^SOURCEH = slepc-interface.h petsc-interface.h$/;" m SOURCEH src/eps/impls/external/blzpack/makefile /^SOURCEH = blzpackp.h$/;" m SOURCEH src/eps/impls/external/feast/makefile /^SOURCEH = feastp.h$/;" m SOURCEH src/eps/impls/external/primme/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/external/primme/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/external/trlan/makefile /^SOURCEH = trlanp.h$/;" m SOURCEH src/eps/impls/krylov/arnoldi/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/krylov/krylovschur/makefile /^SOURCEH = krylovschur.h$/;" m SOURCEH src/eps/impls/krylov/lanczos/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/krylov/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/lapack/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/power/makefile /^SOURCEH =$/;" m SOURCEH src/eps/impls/subspace/makefile /^SOURCEH =$/;" m SOURCEH src/eps/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/eps/interface/makefile /^SOURCEH =$/;" m SOURCEH src/eps/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/epsimpl.h ..\/..\/include\/slepceps.h$/;" m SOURCEH src/fn/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/fnimpl.h ..\/..\/include\/slepcfn.h$/;" m SOURCEH src/ip/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/ip/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/ipimpl.h ..\/..\/include\/slepcip.h ..\/eps\/impls\/davidson\/common\/davidson.h$/;" m SOURCEH src/mfn/impls/krylov/makefile /^SOURCEH =$/;" m SOURCEH src/mfn/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/mfn/interface/makefile /^SOURCEH =$/;" m SOURCEH src/mfn/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/mfnimpl.h ..\/..\/include\/slepcmfn.h$/;" m SOURCEH src/nep/impls/narnoldi/makefile /^SOURCEH =$/;" m SOURCEH src/nep/impls/rii/makefile /^SOURCEH =$/;" m SOURCEH src/nep/impls/slp/makefile /^SOURCEH =$/;" m SOURCEH src/nep/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/nep/interface/makefile /^SOURCEH =$/;" m SOURCEH src/nep/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/nepimpl.h ..\/..\/include\/slepcnep.h$/;" m SOURCEH src/qep/impls/linear/makefile /^SOURCEH = linearp.h$/;" m SOURCEH src/qep/impls/qarnoldi/makefile /^SOURCEH =$/;" m SOURCEH src/qep/impls/qlanczos/makefile /^SOURCEH =$/;" m SOURCEH src/qep/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/qep/interface/makefile /^SOURCEH =$/;" m SOURCEH src/qep/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/qepimpl.h ..\/..\/include\/slepcqep.h$/;" m SOURCEH src/st/impls/cayley/makefile /^SOURCEH =$/;" m SOURCEH src/st/impls/fold/makefile /^SOURCEH =$/;" m SOURCEH src/st/impls/precond/makefile /^SOURCEH =$/;" m SOURCEH src/st/impls/shell/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/st/impls/shell/makefile /^SOURCEH =$/;" m SOURCEH src/st/impls/shift/makefile /^SOURCEH =$/;" m SOURCEH src/st/impls/sinvert/makefile /^SOURCEH =$/;" m SOURCEH src/st/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/st/interface/makefile /^SOURCEH =$/;" m SOURCEH src/st/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/stimpl.h ..\/..\/include\/slepcst.h$/;" m SOURCEH src/svd/impls/cross/makefile /^SOURCEH =$/;" m SOURCEH src/svd/impls/cyclic/makefile /^SOURCEH =$/;" m SOURCEH src/svd/impls/lanczos/makefile /^SOURCEH =$/;" m SOURCEH src/svd/impls/lapack/makefile /^SOURCEH =$/;" m SOURCEH src/svd/impls/trlanczos/makefile /^SOURCEH =$/;" m SOURCEH src/svd/interface/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/svd/interface/makefile /^SOURCEH =$/;" m SOURCEH src/svd/makefile /^SOURCEH = ..\/..\/include\/slepc-private\/svdimpl.h ..\/..\/include\/slepcsvd.h$/;" m SOURCEH src/sys/f90-mod/makefile /^SOURCEH =$/;" m SOURCEH src/sys/ftn-custom/makefile /^SOURCEH =$/;" m SOURCEH src/sys/makefile /^SOURCEH =$/;" m SOURCEH src/vec/makefile /^SOURCEH = veccomp0.h$/;" m SPECIALFASTLIB src/sys/f90-mod/makefile /^SPECIALFASTLIB = yes$/;" m SPECIALLIB src/sys/f90-mod/makefile /^SPECIALLIB = yes$/;" m SR src/eps/impls/krylov/krylovschur/krylovschur.h /^typedef struct _n_SR *SR;$/;" t typeref:struct:_n_SR ST bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer ST;$/;" t ST include/finclude/slepcstdef.h /^#define ST /;" d ST include/slepcst.h /^typedef struct _p_ST* ST;$/;" t typeref:struct:_p_ST STAppendOptionsPrefix src/st/interface/stfunc.c /^PetscErrorCode STAppendOptionsPrefix(ST st,const char *prefix)$/;" f STApply src/st/interface/stsolve.c /^PetscErrorCode STApply(ST st,Vec x,Vec y)$/;" f STApplyTranspose src/st/interface/stsolve.c /^PetscErrorCode STApplyTranspose(ST st,Vec x,Vec y)$/;" f STApplyTranspose_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STApplyTranspose_Cayley(ST st,Vec x,Vec y)$/;" f STApplyTranspose_Fold src/st/impls/fold/fold.c /^PetscErrorCode STApplyTranspose_Fold(ST st,Vec x,Vec y)$/;" f STApplyTranspose_Shell src/st/impls/shell/shell.c /^PetscErrorCode STApplyTranspose_Shell(ST st,Vec x,Vec y)$/;" f STApplyTranspose_Shift src/st/impls/shift/shift.c /^PetscErrorCode STApplyTranspose_Shift(ST st,Vec x,Vec y)$/;" f STApplyTranspose_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STApplyTranspose_Sinvert(ST st,Vec x,Vec y)$/;" f STApply_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STApply_Cayley(ST st,Vec x,Vec y)$/;" f STApply_Fold src/st/impls/fold/fold.c /^PetscErrorCode STApply_Fold(ST st,Vec x,Vec y)$/;" f STApply_Shell src/st/impls/shell/shell.c /^PetscErrorCode STApply_Shell(ST st,Vec x,Vec y)$/;" f STApply_Shift src/st/impls/shift/shift.c /^PetscErrorCode STApply_Shift(ST st,Vec x,Vec y)$/;" f STApply_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STApply_Sinvert(ST st,Vec x,Vec y)$/;" f STApply_User src/st/examples/tutorials/ex10.c /^PetscErrorCode STApply_User(ST st,Vec x,Vec y)$/;" f STBackTransform src/st/interface/stsolve.c /^PetscErrorCode STBackTransform(ST st,PetscInt n,PetscScalar* eigr,PetscScalar* eigi)$/;" f STBackTransform_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STBackTransform_Cayley(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f STBackTransform_Fold src/st/impls/fold/fold.c /^PetscErrorCode STBackTransform_Fold(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f STBackTransform_Shell src/st/impls/shell/shell.c /^PetscErrorCode STBackTransform_Shell(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f STBackTransform_Shift src/st/impls/shift/shift.c /^PetscErrorCode STBackTransform_Shift(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f STBackTransform_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STBackTransform_Sinvert(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f STBackTransform_User src/st/examples/tutorials/ex10.c /^PetscErrorCode STBackTransform_User(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f STCAYLEY include/finclude/slepcstdef.h /^#define STCAYLEY /;" d STCAYLEY include/slepcst.h /^#define STCAYLEY /;" d STCayleyGetAntishift src/st/impls/cayley/cayley.c /^PetscErrorCode STCayleyGetAntishift(ST st,PetscScalar *nu)$/;" f STCayleyGetAntishift_Cayley src/st/impls/cayley/cayley.c /^static PetscErrorCode STCayleyGetAntishift_Cayley(ST st,PetscScalar *nu)$/;" f file: STCayleySetAntishift src/st/impls/cayley/cayley.c /^PetscErrorCode STCayleySetAntishift(ST st,PetscScalar nu)$/;" f STCayleySetAntishift_Cayley src/st/impls/cayley/cayley.c /^static PetscErrorCode STCayleySetAntishift_Cayley(ST st,PetscScalar newshift)$/;" f file: STCheckNullSpace src/st/interface/stsles.c /^PetscErrorCode STCheckNullSpace(ST st,PetscInt n,const Vec V[])$/;" f STCheckNullSpace_Default src/st/interface/stsles.c /^PetscErrorCode STCheckNullSpace_Default(ST st,PetscInt n,const Vec V[])$/;" f STComputeExplicitOperator src/st/interface/stsolve.c /^PetscErrorCode STComputeExplicitOperator(ST st,Mat *mat)$/;" f STCreate src/st/interface/stfunc.c /^PetscErrorCode STCreate(MPI_Comm comm,ST *newst)$/;" f STCreate_Cayley src/st/impls/cayley/cayley.c /^PETSC_EXTERN PetscErrorCode STCreate_Cayley(ST st)$/;" f STCreate_Fold src/st/impls/fold/fold.c /^PETSC_EXTERN PetscErrorCode STCreate_Fold(ST st)$/;" f STCreate_Precond src/st/impls/precond/precond.c /^PETSC_EXTERN PetscErrorCode STCreate_Precond(ST st)$/;" f STCreate_Shell src/st/impls/shell/shell.c /^PETSC_EXTERN PetscErrorCode STCreate_Shell(ST st)$/;" f STCreate_Shift src/st/impls/shift/shift.c /^PETSC_EXTERN PetscErrorCode STCreate_Shift(ST st)$/;" f STCreate_Sinvert src/st/impls/sinvert/sinvert.c /^PETSC_EXTERN PetscErrorCode STCreate_Sinvert(ST st)$/;" f STCreate_User src/st/examples/tutorials/ex10.c /^PetscErrorCode STCreate_User(SampleShellST **shell)$/;" f STDestroy src/st/interface/stfunc.c /^PetscErrorCode STDestroy(ST *st)$/;" f STDestroy_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STDestroy_Cayley(ST st)$/;" f STDestroy_Fold src/st/impls/fold/fold.c /^PetscErrorCode STDestroy_Fold(ST st)$/;" f STDestroy_Precond src/st/impls/precond/precond.c /^PetscErrorCode STDestroy_Precond(ST st)$/;" f STDestroy_Shell src/st/impls/shell/shell.c /^PetscErrorCode STDestroy_Shell(ST st)$/;" f STDestroy_User src/st/examples/tutorials/ex10.c /^PetscErrorCode STDestroy_User(SampleShellST *shell)$/;" f STFOLD include/finclude/slepcstdef.h /^#define STFOLD /;" d STFOLD include/slepcst.h /^#define STFOLD /;" d STFinalizePackage src/st/interface/stfunc.c /^PetscErrorCode STFinalizePackage(void)$/;" f STGetBalanceMatrix src/st/interface/stfunc.c /^PetscErrorCode STGetBalanceMatrix(ST st,Vec *D)$/;" f STGetBilinearForm src/st/interface/stsolve.c /^PetscErrorCode STGetBilinearForm(ST st,Mat *B)$/;" f STGetBilinearForm_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STGetBilinearForm_Cayley(ST st,Mat *B)$/;" f STGetBilinearForm_Default src/st/interface/stsolve.c /^PetscErrorCode STGetBilinearForm_Default(ST st,Mat *B)$/;" f STGetKSP src/st/interface/stsles.c /^PetscErrorCode STGetKSP(ST st,KSP* ksp)$/;" f STGetMatMode src/st/interface/stset.c /^PetscErrorCode STGetMatMode(ST st,STMatMode *mode)$/;" f STGetMatStructure src/st/interface/stset.c /^PetscErrorCode STGetMatStructure(ST st,MatStructure *str)$/;" f STGetNumMatrices src/st/interface/stfunc.c /^PetscErrorCode STGetNumMatrices(ST st,PetscInt *n)$/;" f STGetOperationCounters src/st/interface/stsles.c /^PetscErrorCode STGetOperationCounters(ST st,PetscInt* ops,PetscInt* lits)$/;" f STGetOperators src/st/interface/stfunc.c /^PetscErrorCode STGetOperators(ST st,PetscInt k,Mat *A)$/;" f STGetOptionsPrefix src/st/interface/stfunc.c /^PetscErrorCode STGetOptionsPrefix(ST st,const char *prefix[])$/;" f STGetShift src/st/interface/stfunc.c /^PetscErrorCode STGetShift(ST st,PetscScalar* shift)$/;" f STGetType src/st/interface/stset.c /^PetscErrorCode STGetType(ST st,STType *type)$/;" f STInitializePackage src/st/interface/stfunc.c /^PetscErrorCode STInitializePackage(void)$/;" f STList include/slepcst.h /^PETSC_EXTERN PetscFunctionList STList;$/;" v STList src/st/interface/stset.c /^PetscFunctionList STList = 0;$/;" v STMatGAXPY_Private src/st/interface/stsolve.c /^PetscErrorCode STMatGAXPY_Private(ST st,PetscScalar alpha,PetscScalar beta,PetscInt deg,PetscInt k,PetscBool initial)$/;" f STMatMode include/finclude/slepcstdef.h /^#define STMatMode /;" d STMatMode include/slepcst.h /^ ST_MATMODE_SHELL } STMatMode;$/;" t typeref:enum:__anon22 STMatMult src/st/interface/stsles.c /^PetscErrorCode STMatMult(ST st,PetscInt k,Vec x,Vec y)$/;" f STMatMultTranspose src/st/interface/stsles.c /^PetscErrorCode STMatMultTranspose(ST st,PetscInt k,Vec x,Vec y)$/;" f STMatSetHermitian src/st/interface/stsles.c /^PetscErrorCode STMatSetHermitian(ST st,Mat M)$/;" f STMatShellCreate src/st/interface/shellmat.c /^PetscErrorCode STMatShellCreate(ST st,PetscScalar alpha,PetscInt nmat,PetscInt *matIdx,Mat *mat)$/;" f STMatShellShift src/st/interface/shellmat.c /^PetscErrorCode STMatShellShift(Mat A,PetscScalar alpha)$/;" f STMatSolve src/st/interface/stsles.c /^PetscErrorCode STMatSolve(ST st,PetscInt k,Vec b,Vec x)$/;" f STMatSolveTranspose src/st/interface/stsles.c /^PetscErrorCode STMatSolveTranspose(ST st,PetscInt k,Vec b,Vec x)$/;" f STOps include/slepc-private/stimpl.h /^typedef struct _STOps *STOps;$/;" t typeref:struct:_STOps STPRECOND include/finclude/slepcstdef.h /^#define STPRECOND /;" d STPRECOND include/slepcst.h /^#define STPRECOND /;" d STPackageInitialized src/st/interface/stfunc.c /^static PetscBool STPackageInitialized = PETSC_FALSE;$/;" v file: STPostSolve src/st/interface/stsolve.c /^PetscErrorCode STPostSolve(ST st)$/;" f STPostSolve_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STPostSolve_Cayley(ST st)$/;" f STPostSolve_Shift src/st/impls/shift/shift.c /^PetscErrorCode STPostSolve_Shift(ST st)$/;" f STPostSolve_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STPostSolve_Sinvert(ST st)$/;" f STPrecondGetKSPHasMat src/st/impls/precond/precond.c /^PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat)$/;" f STPrecondGetKSPHasMat_Precond src/st/impls/precond/precond.c /^static PetscErrorCode STPrecondGetKSPHasMat_Precond(ST st,PetscBool *setmat)$/;" f file: STPrecondGetMatForPC src/st/impls/precond/precond.c /^PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat)$/;" f STPrecondGetMatForPC_Precond src/st/impls/precond/precond.c /^static PetscErrorCode STPrecondGetMatForPC_Precond(ST st,Mat *mat)$/;" f file: STPrecondSetKSPHasMat src/st/impls/precond/precond.c /^PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat)$/;" f STPrecondSetKSPHasMat_Precond src/st/impls/precond/precond.c /^static PetscErrorCode STPrecondSetKSPHasMat_Precond(ST st,PetscBool setmat)$/;" f file: STPrecondSetMatForPC src/st/impls/precond/precond.c /^PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat)$/;" f STPrecondSetMatForPC_Precond src/st/impls/precond/precond.c /^static PetscErrorCode STPrecondSetMatForPC_Precond(ST st,Mat mat)$/;" f file: STRegister src/st/interface/stfunc.c /^PetscErrorCode STRegister(const char *name,PetscErrorCode (*function)(ST))$/;" f STRegisterAll src/st/interface/stregis.c /^PetscErrorCode STRegisterAll(void)$/;" f STRegisterAllCalled include/slepcst.h /^PETSC_EXTERN PetscBool STRegisterAllCalled;$/;" v STRegisterAllCalled src/st/interface/stset.c /^PetscBool STRegisterAllCalled = PETSC_FALSE;$/;" v STReset src/st/interface/stfunc.c /^PetscErrorCode STReset(ST st)$/;" f STResetOperationCounters src/st/interface/stsles.c /^PetscErrorCode STResetOperationCounters(ST st)$/;" f STReset_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STReset_Cayley(ST st)$/;" f STReset_Fold src/st/impls/fold/fold.c /^PetscErrorCode STReset_Fold(ST st)$/;" f STSHELL include/finclude/slepcstdef.h /^#define STSHELL /;" d STSHELL include/slepcst.h /^#define STSHELL /;" d STSHIFT include/finclude/slepcstdef.h /^#define STSHIFT /;" d STSHIFT include/slepcst.h /^#define STSHIFT /;" d STSINVERT include/finclude/slepcstdef.h /^#define STSINVERT /;" d STSINVERT include/slepcst.h /^#define STSINVERT /;" d STSetBalanceMatrix src/st/interface/stfunc.c /^PetscErrorCode STSetBalanceMatrix(ST st,Vec D)$/;" f STSetDefaultShift src/st/interface/stfunc.c /^PetscErrorCode STSetDefaultShift(ST st,PetscScalar defaultshift)$/;" f STSetFromOptions src/st/interface/stset.c /^PetscErrorCode STSetFromOptions(ST st)$/;" f STSetFromOptions_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STSetFromOptions_Cayley(ST st)$/;" f STSetFromOptions_Fold src/st/impls/fold/fold.c /^PetscErrorCode STSetFromOptions_Fold(ST st)$/;" f STSetFromOptions_Precond src/st/impls/precond/precond.c /^PetscErrorCode STSetFromOptions_Precond(ST st)$/;" f STSetFromOptions_Shell src/st/impls/shell/shell.c /^PetscErrorCode STSetFromOptions_Shell(ST st)$/;" f STSetFromOptions_Shift src/st/impls/shift/shift.c /^PetscErrorCode STSetFromOptions_Shift(ST st)$/;" f STSetFromOptions_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STSetFromOptions_Sinvert(ST st)$/;" f STSetKSP src/st/interface/stsles.c /^PetscErrorCode STSetKSP(ST st,KSP ksp)$/;" f STSetMatMode src/st/interface/stset.c /^PetscErrorCode STSetMatMode(ST st,STMatMode mode)$/;" f STSetMatStructure src/st/interface/stset.c /^PetscErrorCode STSetMatStructure(ST st,MatStructure str)$/;" f STSetOperators src/st/interface/stfunc.c /^PetscErrorCode STSetOperators(ST st,PetscInt n,Mat A[])$/;" f STSetOptionsPrefix src/st/interface/stfunc.c /^PetscErrorCode STSetOptionsPrefix(ST st,const char *prefix)$/;" f STSetShift src/st/interface/stfunc.c /^PetscErrorCode STSetShift(ST st,PetscScalar shift)$/;" f STSetShift_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STSetShift_Cayley(ST st,PetscScalar newshift)$/;" f STSetShift_Precond src/st/impls/precond/precond.c /^PetscErrorCode STSetShift_Precond(ST st,PetscScalar newshift)$/;" f STSetShift_Shift src/st/impls/shift/shift.c /^PetscErrorCode STSetShift_Shift(ST st,PetscScalar newshift)$/;" f STSetShift_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STSetShift_Sinvert(ST st,PetscScalar newshift)$/;" f STSetType src/st/interface/stset.c /^PetscErrorCode STSetType(ST st,STType type)$/;" f STSetUp src/st/interface/stsolve.c /^PetscErrorCode STSetUp(ST st)$/;" f STSetUp_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STSetUp_Cayley(ST st)$/;" f STSetUp_Fold src/st/impls/fold/fold.c /^PetscErrorCode STSetUp_Fold(ST st)$/;" f STSetUp_Precond src/st/impls/precond/precond.c /^PetscErrorCode STSetUp_Precond(ST st)$/;" f STSetUp_Shift src/st/impls/shift/shift.c /^PetscErrorCode STSetUp_Shift(ST st)$/;" f STSetUp_Sinvert src/st/impls/sinvert/sinvert.c /^PetscErrorCode STSetUp_Sinvert(ST st)$/;" f STSetUp_User src/st/examples/tutorials/ex10.c /^PetscErrorCode STSetUp_User(SampleShellST *shell,ST st)$/;" f STShellGetContext src/st/impls/shell/shell.c /^PetscErrorCode STShellGetContext(ST st,void **ctx)$/;" f STShellSetApply src/st/impls/shell/shell.c /^PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec))$/;" f STShellSetApplyTranspose src/st/impls/shell/shell.c /^PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec))$/;" f STShellSetApplyTranspose_Shell src/st/impls/shell/shell.c /^static PetscErrorCode STShellSetApplyTranspose_Shell(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec))$/;" f file: STShellSetApply_Shell src/st/impls/shell/shell.c /^static PetscErrorCode STShellSetApply_Shell(ST st,PetscErrorCode (*apply)(ST,Vec,Vec))$/;" f file: STShellSetBackTransform src/st/impls/shell/shell.c /^PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*))$/;" f STShellSetBackTransform_Shell src/st/impls/shell/shell.c /^static PetscErrorCode STShellSetBackTransform_Shell(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*))$/;" f file: STShellSetContext src/st/impls/shell/shell.c /^PetscErrorCode STShellSetContext(ST st,void *ctx)$/;" f STType include/finclude/slepcstdef.h /^#define STType /;" d STType include/slepcst.h /^typedef const char* STType;$/;" t STView src/st/interface/stfunc.c /^PetscErrorCode STView(ST st,PetscViewer viewer)$/;" f STView_Cayley src/st/impls/cayley/cayley.c /^PetscErrorCode STView_Cayley(ST st,PetscViewer viewer)$/;" f ST_Apply include/slepc-private/stimpl.h /^PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose;$/;" v ST_Apply src/st/interface/stfunc.c /^PetscLogEvent ST_SetUp = 0,ST_Apply = 0,ST_ApplyTranspose = 0;$/;" v ST_ApplyTranspose include/slepc-private/stimpl.h /^PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose;$/;" v ST_ApplyTranspose src/st/interface/stfunc.c /^PetscLogEvent ST_SetUp = 0,ST_Apply = 0,ST_ApplyTranspose = 0;$/;" v ST_CAYLEY src/st/impls/cayley/cayley.c /^} ST_CAYLEY;$/;" t typeref:struct:__anon1 file: ST_CLASSID include/slepcst.h /^PETSC_EXTERN PetscClassId ST_CLASSID;$/;" v ST_CLASSID src/st/interface/stfunc.c /^PetscClassId ST_CLASSID = 0;$/;" v ST_FOLD src/st/impls/fold/fold.c /^} ST_FOLD;$/;" t typeref:struct:__anon1 file: ST_MATMODE_COPY include/slepcst.h /^typedef enum { ST_MATMODE_COPY,$/;" e enum:__anon22 ST_MATMODE_INPLACE include/slepcst.h /^ ST_MATMODE_INPLACE,$/;" e enum:__anon22 ST_MATMODE_SHELL include/slepcst.h /^ ST_MATMODE_SHELL } STMatMode;$/;" e enum:__anon22 ST_PRECOND src/st/impls/precond/precond.c /^} ST_PRECOND;$/;" t typeref:struct:__anon1 file: ST_SHELLMAT src/st/interface/shellmat.c /^} ST_SHELLMAT;$/;" t typeref:struct:__anon1 file: ST_SetUp include/slepc-private/stimpl.h /^PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose;$/;" v ST_SetUp src/st/interface/stfunc.c /^PetscLogEvent ST_SetUp = 0,ST_Apply = 0,ST_ApplyTranspose = 0;$/;" v ST_Shell src/st/impls/shell/shell.c /^} ST_Shell;$/;" t typeref:struct:__anon1 file: SVD bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer SVD;$/;" t SVD include/finclude/slepcsvddef.h /^#define SVD /;" d SVD include/slepcsvd.h /^typedef struct _p_SVD* SVD;$/;" t typeref:struct:_p_SVD SVD src/eps/impls/ciss/ciss.c /^static PetscErrorCode SVD(EPS eps,Vec *Q,PetscInt *K,PetscBool isqr)$/;" f file: SVD src/svd/examples/tests/makefile /^SVD = lanczos lapack trlanczos$/;" m SVDAppendOptionsPrefix src/svd/interface/svdopts.c /^PetscErrorCode SVDAppendOptionsPrefix(SVD svd,const char *prefix)$/;" f SVDCROSS include/finclude/slepcsvddef.h /^#define SVDCROSS /;" d SVDCROSS include/slepcsvd.h /^#define SVDCROSS /;" d SVDCYCLIC include/finclude/slepcsvddef.h /^#define SVDCYCLIC /;" d SVDCYCLIC include/slepcsvd.h /^#define SVDCYCLIC /;" d SVDComputeRelativeError src/svd/interface/svdsolve.c /^PetscErrorCode SVDComputeRelativeError(SVD svd,PetscInt i,PetscReal *error)$/;" f SVDComputeResidualNorms src/svd/interface/svdsolve.c /^PetscErrorCode SVDComputeResidualNorms(SVD svd,PetscInt i,PetscReal *norm1,PetscReal *norm2)$/;" f SVDConvergedReason include/finclude/slepcsvddef.h /^#define SVDConvergedReason /;" d SVDConvergedReason include/slepcsvd.h /^ SVD_CONVERGED_ITERATING = 0 } SVDConvergedReason;$/;" t typeref:enum:__anon25 SVDCreate src/svd/interface/svdbasic.c /^PetscErrorCode SVDCreate(MPI_Comm comm,SVD *outsvd)$/;" f SVDCreate_Cross src/svd/impls/cross/cross.c /^PETSC_EXTERN PetscErrorCode SVDCreate_Cross(SVD svd)$/;" f SVDCreate_Cyclic src/svd/impls/cyclic/cyclic.c /^PETSC_EXTERN PetscErrorCode SVDCreate_Cyclic(SVD svd)$/;" f SVDCreate_LAPACK src/svd/impls/lapack/svdlapack.c /^PETSC_EXTERN PetscErrorCode SVDCreate_LAPACK(SVD svd)$/;" f SVDCreate_Lanczos src/svd/impls/lanczos/gklanczos.c /^PETSC_EXTERN PetscErrorCode SVDCreate_Lanczos(SVD svd)$/;" f SVDCreate_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PETSC_EXTERN PetscErrorCode SVDCreate_TRLanczos(SVD svd)$/;" f SVDCrossGetEPS src/svd/impls/cross/cross.c /^PetscErrorCode SVDCrossGetEPS(SVD svd,EPS *eps)$/;" f SVDCrossGetEPS_Cross src/svd/impls/cross/cross.c /^static PetscErrorCode SVDCrossGetEPS_Cross(SVD svd,EPS *eps)$/;" f file: SVDCrossSetEPS src/svd/impls/cross/cross.c /^PetscErrorCode SVDCrossSetEPS(SVD svd,EPS eps)$/;" f SVDCrossSetEPS_Cross src/svd/impls/cross/cross.c /^static PetscErrorCode SVDCrossSetEPS_Cross(SVD svd,EPS eps)$/;" f file: SVDCyclicGetEPS src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDCyclicGetEPS(SVD svd,EPS *eps)$/;" f SVDCyclicGetEPS_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode SVDCyclicGetEPS_Cyclic(SVD svd,EPS *eps)$/;" f file: SVDCyclicGetExplicitMatrix src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDCyclicGetExplicitMatrix(SVD svd,PetscBool *explicitmatrix)$/;" f SVDCyclicGetExplicitMatrix_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode SVDCyclicGetExplicitMatrix_Cyclic(SVD svd,PetscBool *explicitmatrix)$/;" f file: SVDCyclicSetEPS src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDCyclicSetEPS(SVD svd,EPS eps)$/;" f SVDCyclicSetEPS_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode SVDCyclicSetEPS_Cyclic(SVD svd,EPS eps)$/;" f file: SVDCyclicSetExplicitMatrix src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDCyclicSetExplicitMatrix(SVD svd,PetscBool explicitmatrix)$/;" f SVDCyclicSetExplicitMatrix_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode SVDCyclicSetExplicitMatrix_Cyclic(SVD svd,PetscBool explicitmatrix)$/;" f file: SVDDestroy src/svd/interface/svdbasic.c /^PetscErrorCode SVDDestroy(SVD *svd)$/;" f SVDDestroy_Cross src/svd/impls/cross/cross.c /^PetscErrorCode SVDDestroy_Cross(SVD svd)$/;" f SVDDestroy_Cyclic src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDDestroy_Cyclic(SVD svd)$/;" f SVDDestroy_LAPACK src/svd/impls/lapack/svdlapack.c /^PetscErrorCode SVDDestroy_LAPACK(SVD svd)$/;" f SVDDestroy_Lanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDDestroy_Lanczos(SVD svd)$/;" f SVDDestroy_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDDestroy_TRLanczos(SVD svd)$/;" f SVDEPS src/svd/examples/tests/makefile /^SVDEPS = cross cyclic$/;" m SVDFinalizePackage src/svd/interface/svdbasic.c /^PetscErrorCode SVDFinalizePackage(void)$/;" f SVDGetConverged src/svd/interface/svdsolve.c /^PetscErrorCode SVDGetConverged(SVD svd,PetscInt *nconv)$/;" f SVDGetConvergedReason src/svd/interface/svdsolve.c /^PetscErrorCode SVDGetConvergedReason(SVD svd,SVDConvergedReason *reason)$/;" f SVDGetDS src/svd/interface/svdbasic.c /^PetscErrorCode SVDGetDS(SVD svd,DS *ds)$/;" f SVDGetDimensions src/svd/interface/svdopts.c /^PetscErrorCode SVDGetDimensions(SVD svd,PetscInt *nsv,PetscInt *ncv,PetscInt *mpd)$/;" f SVDGetIP src/svd/interface/svdbasic.c /^PetscErrorCode SVDGetIP(SVD svd,IP *ip)$/;" f SVDGetIterationNumber src/svd/interface/svdsolve.c /^PetscErrorCode SVDGetIterationNumber(SVD svd,PetscInt *its)$/;" f SVDGetMonitorContext src/svd/interface/svdmon.c /^PetscErrorCode SVDGetMonitorContext(SVD svd,void **ctx)$/;" f SVDGetOperationCounters src/svd/interface/svdsolve.c /^PetscErrorCode SVDGetOperationCounters(SVD svd,PetscInt* matvecs,PetscInt* dots)$/;" f SVDGetOperator src/svd/interface/svdsetup.c /^PetscErrorCode SVDGetOperator(SVD svd,Mat *A)$/;" f SVDGetOptionsPrefix src/svd/interface/svdopts.c /^PetscErrorCode SVDGetOptionsPrefix(SVD svd,const char *prefix[])$/;" f SVDGetSingularTriplet src/svd/interface/svdsolve.c /^PetscErrorCode SVDGetSingularTriplet(SVD svd,PetscInt i,PetscReal *sigma,Vec u,Vec v)$/;" f SVDGetTolerances src/svd/interface/svdopts.c /^PetscErrorCode SVDGetTolerances(SVD svd,PetscReal *tol,PetscInt *maxits)$/;" f SVDGetTrackAll src/svd/interface/svdopts.c /^PetscErrorCode SVDGetTrackAll(SVD svd,PetscBool *trackall)$/;" f SVDGetTransposeMode src/svd/interface/svdopts.c /^PetscErrorCode SVDGetTransposeMode(SVD svd,SVDTransposeMode *mode)$/;" f SVDGetType src/svd/interface/svdbasic.c /^PetscErrorCode SVDGetType(SVD svd,SVDType *type)$/;" f SVDGetWhichSingularTriplets src/svd/interface/svdopts.c /^PetscErrorCode SVDGetWhichSingularTriplets(SVD svd,SVDWhich *which)$/;" f SVDInitializePackage src/svd/interface/svdbasic.c /^PetscErrorCode SVDInitializePackage(void)$/;" f SVDLANCZOS include/finclude/slepcsvddef.h /^#define SVDLANCZOS /;" d SVDLANCZOS include/slepcsvd.h /^#define SVDLANCZOS /;" d SVDLAPACK include/finclude/slepcsvddef.h /^#define SVDLAPACK /;" d SVDLAPACK include/slepcsvd.h /^#define SVDLAPACK /;" d SVDLanczosGetOneSide src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDLanczosGetOneSide(SVD svd,PetscBool *oneside)$/;" f SVDLanczosGetOneSide_Lanczos src/svd/impls/lanczos/gklanczos.c /^static PetscErrorCode SVDLanczosGetOneSide_Lanczos(SVD svd,PetscBool *oneside)$/;" f file: SVDLanczosSetOneSide src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDLanczosSetOneSide(SVD svd,PetscBool oneside)$/;" f SVDLanczosSetOneSide_Lanczos src/svd/impls/lanczos/gklanczos.c /^static PetscErrorCode SVDLanczosSetOneSide_Lanczos(SVD svd,PetscBool oneside)$/;" f file: SVDList include/slepcsvd.h /^PETSC_EXTERN PetscFunctionList SVDList;$/;" v SVDList src/svd/interface/svdbasic.c /^PetscFunctionList SVDList = 0;$/;" v SVDMatGetLocalSize src/svd/interface/svdmat.c /^PetscErrorCode SVDMatGetLocalSize(SVD svd,PetscInt *m,PetscInt *n)$/;" f SVDMatGetSize src/svd/interface/svdmat.c /^PetscErrorCode SVDMatGetSize(SVD svd,PetscInt *m,PetscInt *n)$/;" f SVDMatGetVecs src/svd/interface/svdmat.c /^PetscErrorCode SVDMatGetVecs(SVD svd,Vec *x,Vec *y)$/;" f SVDMatMult src/svd/interface/svdmat.c /^PetscErrorCode SVDMatMult(SVD svd,PetscBool trans,Vec x,Vec y)$/;" f SVDMonitor src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitor(SVD svd,PetscInt it,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest)$/;" f SVDMonitorAll src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)$/;" f SVDMonitorCancel src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorCancel(SVD svd)$/;" f SVDMonitorConverged src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorConverged(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)$/;" f SVDMonitorFirst src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorFirst(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)$/;" f SVDMonitorLG src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorLG(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)$/;" f SVDMonitorLGAll src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorLGAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)$/;" f SVDMonitorSet src/svd/interface/svdmon.c /^PetscErrorCode SVDMonitorSet(SVD svd,PetscErrorCode (*monitor)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))$/;" f SVDMonitor_Cross src/svd/impls/cross/cross.c /^static PetscErrorCode SVDMonitor_Cross(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)$/;" f file: SVDMonitor_Cyclic src/svd/impls/cyclic/cyclic.c /^static PetscErrorCode SVDMonitor_Cyclic(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)$/;" f file: SVDOneSideLanczos src/svd/impls/lanczos/gklanczos.c /^static PetscErrorCode SVDOneSideLanczos(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec u,Vec u_1,PetscInt k,PetscInt n,PetscScalar* work)$/;" f file: SVDOneSideTRLanczosCGS src/svd/impls/trlanczos/trlanczos.c /^static PetscErrorCode SVDOneSideTRLanczosCGS(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec* U,PetscInt nconv,PetscInt l,PetscInt n,PetscScalar* work)$/;" f file: SVDOneSideTRLanczosMGS src/svd/impls/trlanczos/trlanczos.c /^static PetscErrorCode SVDOneSideTRLanczosMGS(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec* U,PetscInt nconv,PetscInt l,PetscInt n,PetscScalar* work)$/;" f file: SVDOps include/slepc-private/svdimpl.h /^typedef struct _SVDOps *SVDOps;$/;" t typeref:struct:_SVDOps SVDPackageInitialized src/svd/interface/svdbasic.c /^static PetscBool SVDPackageInitialized = PETSC_FALSE;$/;" v file: SVDPrintSolution src/svd/interface/svdbasic.c /^PetscErrorCode SVDPrintSolution(SVD svd,PetscViewer viewer)$/;" f SVDRegister src/svd/interface/svdbasic.c /^PetscErrorCode SVDRegister(const char *name,PetscErrorCode (*function)(SVD))$/;" f SVDRegisterAll src/svd/interface/svdregis.c /^PetscErrorCode SVDRegisterAll(void)$/;" f SVDRegisterAllCalled include/slepcsvd.h /^PETSC_EXTERN PetscBool SVDRegisterAllCalled;$/;" v SVDRegisterAllCalled src/svd/interface/svdbasic.c /^PetscBool SVDRegisterAllCalled = PETSC_FALSE;$/;" v SVDReset src/svd/interface/svdbasic.c /^PetscErrorCode SVDReset(SVD svd)$/;" f SVDReset_Cross src/svd/impls/cross/cross.c /^PetscErrorCode SVDReset_Cross(SVD svd)$/;" f SVDReset_Cyclic src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDReset_Cyclic(SVD svd)$/;" f SVDReset_LAPACK src/svd/impls/lapack/svdlapack.c /^PetscErrorCode SVDReset_LAPACK(SVD svd)$/;" f SVDReset_Lanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDReset_Lanczos(SVD svd)$/;" f SVDReset_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDReset_TRLanczos(SVD svd)$/;" f SVDSetDS src/svd/interface/svdbasic.c /^PetscErrorCode SVDSetDS(SVD svd,DS ds)$/;" f SVDSetDimensions src/svd/interface/svdopts.c /^PetscErrorCode SVDSetDimensions(SVD svd,PetscInt nsv,PetscInt ncv,PetscInt mpd)$/;" f SVDSetFromOptions src/svd/interface/svdopts.c /^PetscErrorCode SVDSetFromOptions(SVD svd)$/;" f SVDSetFromOptions_Cross src/svd/impls/cross/cross.c /^PetscErrorCode SVDSetFromOptions_Cross(SVD svd)$/;" f SVDSetFromOptions_Cyclic src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDSetFromOptions_Cyclic(SVD svd)$/;" f SVDSetFromOptions_Lanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDSetFromOptions_Lanczos(SVD svd)$/;" f SVDSetFromOptions_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDSetFromOptions_TRLanczos(SVD svd)$/;" f SVDSetIP src/svd/interface/svdbasic.c /^PetscErrorCode SVDSetIP(SVD svd,IP ip)$/;" f SVDSetInitialSpace src/svd/interface/svdsetup.c /^PetscErrorCode SVDSetInitialSpace(SVD svd,PetscInt n,Vec *is)$/;" f SVDSetInitialSpaceLeft src/svd/interface/svdsetup.c /^PetscErrorCode SVDSetInitialSpaceLeft(SVD svd,PetscInt n,Vec *is)$/;" f SVDSetOperator src/svd/interface/svdsetup.c /^PetscErrorCode SVDSetOperator(SVD svd,Mat mat)$/;" f SVDSetOptionsPrefix src/svd/interface/svdopts.c /^PetscErrorCode SVDSetOptionsPrefix(SVD svd,const char *prefix)$/;" f SVDSetTolerances src/svd/interface/svdopts.c /^PetscErrorCode SVDSetTolerances(SVD svd,PetscReal tol,PetscInt maxits)$/;" f SVDSetTrackAll src/svd/interface/svdopts.c /^PetscErrorCode SVDSetTrackAll(SVD svd,PetscBool trackall)$/;" f SVDSetTransposeMode src/svd/interface/svdopts.c /^PetscErrorCode SVDSetTransposeMode(SVD svd,SVDTransposeMode mode)$/;" f SVDSetType src/svd/interface/svdbasic.c /^PetscErrorCode SVDSetType(SVD svd,SVDType type)$/;" f SVDSetUp src/svd/interface/svdsetup.c /^PetscErrorCode SVDSetUp(SVD svd)$/;" f SVDSetUp_Cross src/svd/impls/cross/cross.c /^PetscErrorCode SVDSetUp_Cross(SVD svd)$/;" f SVDSetUp_Cyclic src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDSetUp_Cyclic(SVD svd)$/;" f SVDSetUp_LAPACK src/svd/impls/lapack/svdlapack.c /^PetscErrorCode SVDSetUp_LAPACK(SVD svd)$/;" f SVDSetUp_Lanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDSetUp_Lanczos(SVD svd)$/;" f SVDSetUp_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDSetUp_TRLanczos(SVD svd)$/;" f SVDSetWhichSingularTriplets src/svd/interface/svdopts.c /^PetscErrorCode SVDSetWhichSingularTriplets(SVD svd,SVDWhich which)$/;" f SVDSolve src/svd/interface/svdsolve.c /^PetscErrorCode SVDSolve(SVD svd)$/;" f SVDSolve_Cross src/svd/impls/cross/cross.c /^PetscErrorCode SVDSolve_Cross(SVD svd)$/;" f SVDSolve_Cyclic src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDSolve_Cyclic(SVD svd)$/;" f SVDSolve_LAPACK src/svd/impls/lapack/svdlapack.c /^PetscErrorCode SVDSolve_LAPACK(SVD svd)$/;" f SVDSolve_Lanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDSolve_Lanczos(SVD svd)$/;" f SVDSolve_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDSolve_TRLanczos(SVD svd)$/;" f SVDTRLANCZOS include/finclude/slepcsvddef.h /^#define SVDTRLANCZOS /;" d SVDTRLANCZOS include/slepcsvd.h /^#define SVDTRLANCZOS /;" d SVDTRLanczosGetOneSide src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDTRLanczosGetOneSide(SVD svd,PetscBool *oneside)$/;" f SVDTRLanczosGetOneSide_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^static PetscErrorCode SVDTRLanczosGetOneSide_TRLanczos(SVD svd,PetscBool *oneside)$/;" f file: SVDTRLanczosSetOneSide src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDTRLanczosSetOneSide(SVD svd,PetscBool oneside)$/;" f SVDTRLanczosSetOneSide_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^static PetscErrorCode SVDTRLanczosSetOneSide_TRLanczos(SVD svd,PetscBool oneside)$/;" f file: SVDTransposeMode include/finclude/slepcsvddef.h /^#define SVDTransposeMode /;" d SVDTransposeMode include/slepcsvd.h /^ SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;$/;" t typeref:enum:__anon23 SVDTwoSideLanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDTwoSideLanczos(SVD svd,PetscReal *alpha,PetscReal *beta,Vec *V,Vec v,Vec *U,PetscInt k,PetscInt n,PetscScalar* work)$/;" f SVDType include/finclude/slepcsvddef.h /^#define SVDType /;" d SVDType include/slepcsvd.h /^typedef const char* SVDType;$/;" t SVDView src/svd/interface/svdbasic.c /^PetscErrorCode SVDView(SVD svd,PetscViewer viewer)$/;" f SVDView_Cross src/svd/impls/cross/cross.c /^PetscErrorCode SVDView_Cross(SVD svd,PetscViewer viewer)$/;" f SVDView_Cyclic src/svd/impls/cyclic/cyclic.c /^PetscErrorCode SVDView_Cyclic(SVD svd,PetscViewer viewer)$/;" f SVDView_Lanczos src/svd/impls/lanczos/gklanczos.c /^PetscErrorCode SVDView_Lanczos(SVD svd,PetscViewer viewer)$/;" f SVDView_TRLanczos src/svd/impls/trlanczos/trlanczos.c /^PetscErrorCode SVDView_TRLanczos(SVD svd,PetscViewer viewer)$/;" f SVDWhich bin/matlab/classes/slepcmatlabheader.h /^typedef int SVDWhich;$/;" t SVDWhich include/finclude/slepcsvddef.h /^#define SVDWhich /;" d SVDWhich include/slepcsvd.h /^ SVD_SMALLEST } SVDWhich;$/;" t typeref:enum:__anon24 SVD_CLASSID include/slepcsvd.h /^PETSC_EXTERN PetscClassId SVD_CLASSID;$/;" v SVD_CLASSID src/svd/interface/svdbasic.c /^PetscClassId SVD_CLASSID = 0;$/;" v SVD_CONVERGED_ITERATING include/slepcsvd.h /^ SVD_CONVERGED_ITERATING = 0 } SVDConvergedReason;$/;" e enum:__anon25 SVD_CONVERGED_TOL include/slepcsvd.h /^ SVD_CONVERGED_TOL = 2,$/;" e enum:__anon25 SVD_CROSS src/svd/impls/cross/cross.c /^} SVD_CROSS;$/;" t typeref:struct:__anon1 file: SVD_CYCLIC src/svd/impls/cyclic/cyclic.c /^} SVD_CYCLIC;$/;" t typeref:struct:__anon1 file: SVD_DIVERGED_BREAKDOWN include/slepcsvd.h /^ SVD_DIVERGED_BREAKDOWN = -4,$/;" e enum:__anon25 SVD_DIVERGED_ITS include/slepcsvd.h /^ SVD_DIVERGED_ITS = -3,$/;" e enum:__anon25 SVD_LANCZOS src/svd/impls/lanczos/gklanczos.c /^} SVD_LANCZOS;$/;" t typeref:struct:__anon1 file: SVD_LARGEST include/slepcsvd.h /^typedef enum { SVD_LARGEST,$/;" e enum:__anon24 SVD_SMALLEST include/slepcsvd.h /^ SVD_SMALLEST } SVDWhich;$/;" e enum:__anon24 SVD_SetUp include/slepc-private/svdimpl.h /^PETSC_EXTERN PetscLogEvent SVD_SetUp,SVD_Solve;$/;" v SVD_SetUp src/svd/interface/svdbasic.c /^PetscLogEvent SVD_SetUp = 0,SVD_Solve = 0;$/;" v SVD_Solve include/slepc-private/svdimpl.h /^PETSC_EXTERN PetscLogEvent SVD_SetUp,SVD_Solve;$/;" v SVD_Solve src/svd/interface/svdbasic.c /^PetscLogEvent SVD_SetUp = 0,SVD_Solve = 0;$/;" v SVD_TRANSPOSE_EXPLICIT include/slepcsvd.h /^typedef enum { SVD_TRANSPOSE_EXPLICIT,$/;" e enum:__anon23 SVD_TRANSPOSE_IMPLICIT include/slepcsvd.h /^ SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;$/;" e enum:__anon23 SVD_TRLANCZOS src/svd/impls/trlanczos/trlanczos.c /^} SVD_TRLANCZOS;$/;" t typeref:struct:__anon1 file: SampleShellST src/st/examples/tutorials/ex10.c /^} SampleShellST;$/;" t typeref:struct:__anon1 file: ScanJ src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode ScanJ(PetscInt n,PetscReal *a,PetscReal *b,PetscReal *gl,PetscReal *gr,PetscReal *sigma)$/;" f file: SetAddVector src/eps/impls/ciss/ciss.c /^static PetscErrorCode SetAddVector(EPS eps,PetscInt Ladd_end)$/;" f file: SetPathParameter src/eps/impls/ciss/ciss.c /^static PetscErrorCode SetPathParameter(EPS eps)$/;" f file: SetSolverComm src/eps/impls/ciss/ciss.c /^static PetscErrorCode SetSolverComm(EPS eps)$/;" f file: SlepcAbs include/slepcmath.h /^PETSC_STATIC_INLINE PetscReal SlepcAbs(PetscReal x,PetscReal y)$/;" f SlepcAbsEigenvalue include/slepcmath.h /^#define SlepcAbsEigenvalue(/;" d SlepcAllReduceSum src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcAllReduceSum(DvdReduction *r,PetscInt size_in,DvdReductionPostF f,void *ptr,PetscScalar **in)$/;" f SlepcAllReduceSumBegin src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcAllReduceSumBegin(DvdReductionChunk *ops,PetscInt max_size_ops,PetscScalar *in,PetscScalar *out,PetscInt max_size_in,DvdReduction *r,MPI_Comm comm)$/;" f SlepcAllReduceSumEnd src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcAllReduceSumEnd(DvdReduction *r)$/;" f SlepcBasisDestroy_Private src/sys/slepcutil.c /^PetscErrorCode SlepcBasisDestroy_Private(PetscInt *m,Vec **W)$/;" f SlepcBasisReference_Private src/sys/slepcutil.c /^PetscErrorCode SlepcBasisReference_Private(PetscInt n,Vec *V,PetscInt *m,Vec **W)$/;" f SlepcBeganPetsc include/slepc-private/slepcimpl.h /^PETSC_INTERN PetscBool SlepcBeganPetsc;$/;" v SlepcBeganPetsc src/sys/slepcinit.c /^PetscBool SlepcBeganPetsc = PETSC_FALSE;$/;" v SlepcCheckOrthogonality src/sys/slepcutil.c /^PetscErrorCode SlepcCheckOrthogonality(Vec *V,PetscInt nv,Vec *W,PetscInt nw,Mat B,PetscViewer viewer,PetscReal *lev)$/;" f SlepcCompareLargestImaginary src/sys/slepcutil.c /^PetscErrorCode SlepcCompareLargestImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareLargestMagnitude src/sys/slepcutil.c /^PetscErrorCode SlepcCompareLargestMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareLargestReal src/sys/slepcutil.c /^PetscErrorCode SlepcCompareLargestReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareSmallestImaginary src/sys/slepcutil.c /^PetscErrorCode SlepcCompareSmallestImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareSmallestMagnitude src/sys/slepcutil.c /^PetscErrorCode SlepcCompareSmallestMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareSmallestPosReal src/sys/slepcutil.c /^PetscErrorCode SlepcCompareSmallestPosReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareSmallestReal src/sys/slepcutil.c /^PetscErrorCode SlepcCompareSmallestReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareTargetImaginary src/sys/slepcutil.c /^PetscErrorCode SlepcCompareTargetImaginary(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareTargetMagnitude src/sys/slepcutil.c /^PetscErrorCode SlepcCompareTargetMagnitude(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcCompareTargetReal src/sys/slepcutil.c /^PetscErrorCode SlepcCompareTargetReal(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result,void *ctx)$/;" f SlepcConvMonitor include/slepc-private/slepcimpl.h /^typedef struct _n_SlepcConvMonitor* SlepcConvMonitor;$/;" t typeref:struct:_n_SlepcConvMonitor SlepcConvMonitorDestroy src/sys/slepcutil.c /^PetscErrorCode SlepcConvMonitorDestroy(SlepcConvMonitor *ctx)$/;" f SlepcDenseCopy src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcDenseCopy(PetscScalar *Y,PetscInt ldY,PetscScalar *X,PetscInt ldX,PetscInt rX,PetscInt cX)$/;" f SlepcDenseCopyTriang src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcDenseCopyTriang(PetscScalar *Y,MatType_t sY,PetscInt ldY,PetscScalar *X,MatType_t sX,PetscInt ldX,PetscInt rX,PetscInt cX)$/;" f SlepcDenseMatProd src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcDenseMatProd(PetscScalar *C,PetscInt _ldC,PetscScalar b,PetscScalar a,const PetscScalar *A,PetscInt _ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,PetscInt _ldB,PetscInt rB,PetscInt cB,PetscBool Bt)$/;" f SlepcDenseMatProdTriang src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcDenseMatProdTriang(PetscScalar *C,MatType_t sC,PetscInt ldC,const PetscScalar *A,MatType_t sA,PetscInt ldA,PetscInt rA,PetscInt cA,PetscBool At,const PetscScalar *B,MatType_t sB,PetscInt ldB,PetscInt rB,PetscInt cB,PetscBool Bt)$/;" f SlepcDenseNorm src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcDenseNorm(PetscScalar *A,PetscInt ldA,PetscInt _rA,PetscInt cA,PetscScalar *eigi)$/;" f SlepcFinalize src/sys/slepcinit.c /^PetscErrorCode SlepcFinalize(void)$/;" f SlepcFunction include/finclude/slepcsysdef.h /^#define SlepcFunction /;" d SlepcFunction include/slepcmath.h /^ SLEPC_FUNCTION_LAST } SlepcFunction;$/;" t typeref:enum:__anon15 SlepcGetVersion src/sys/slepcinit.c /^PetscErrorCode SlepcGetVersion(char version[],size_t len)$/;" f SlepcHeaderCreate include/slepc-private/slepcimpl.h /^#define SlepcHeaderCreate(/;" d SlepcInitialize src/sys/slepcinit.c /^PetscErrorCode SlepcInitialize(int *argc,char ***args,const char file[],const char help[])$/;" f SlepcInitializeCalled include/slepcsys.h /^PETSC_EXTERN PetscBool SlepcInitializeCalled;$/;" v SlepcInitializeCalled src/sys/slepcinit.c /^PetscBool SlepcInitializeCalled = PETSC_FALSE;$/;" v SlepcInitializeFortran src/sys/ftn-custom/zslepc_startf.c /^PetscErrorCode SlepcInitializeFortran(void)$/;" f SlepcInitializeNoArguments src/sys/slepcinit.c /^PetscErrorCode SlepcInitializeNoArguments(void)$/;" f SlepcInitializeNoPointers src/sys/slepcinit.c /^PetscErrorCode SlepcInitializeNoPointers(int argc,char **args,const char *filename,const char *help)$/;" f SlepcInitialize_DynamicLibraries src/sys/slepcinit.c /^PetscErrorCode SlepcInitialize_DynamicLibraries(void)$/;" f SlepcInitialize_LogEvents src/sys/slepcinit.c /^PetscErrorCode SlepcInitialize_LogEvents(void)$/;" f SlepcInitialized src/sys/slepcinit.c /^PetscErrorCode SlepcInitialized(PetscBool *isInitialized)$/;" f SlepcMatConvertSeqDense src/sys/slepcutil.c /^PetscErrorCode SlepcMatConvertSeqDense(Mat mat,Mat *newmat)$/;" f SlepcMatGetVecsTemplate src/vec/contiguous.c /^PetscErrorCode SlepcMatGetVecsTemplate(Mat mat,Vec *right,Vec *left)$/;" f SlepcMatTile src/sys/slepcutil.c /^PetscErrorCode SlepcMatTile(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat *G)$/;" f SlepcMatTile_MPIAIJ src/sys/slepcutil.c /^static PetscErrorCode SlepcMatTile_MPIAIJ(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat G)$/;" f file: SlepcMatTile_SeqAIJ src/sys/slepcutil.c /^static PetscErrorCode SlepcMatTile_SeqAIJ(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat G)$/;" f file: SlepcPrintHelpIntro src/sys/slepcinit.c /^PetscErrorCode SlepcPrintHelpIntro(MPI_Comm comm)$/;" f SlepcPrintVersion src/sys/slepcinit.c /^PetscErrorCode SlepcPrintVersion(MPI_Comm comm)$/;" f SlepcSNPrintfScalar src/sys/slepcutil.c /^PetscErrorCode SlepcSNPrintfScalar(char *str,size_t len,PetscScalar val,PetscBool exp)$/;" f SlepcSumNorm2_Local src/vec/veccomp.c /^static void SlepcSumNorm2_Local(void *in,void *out,PetscMPIInt *cnt,MPI_Datatype *datatype)$/;" f file: SlepcUpdateStrideVectors src/vec/contiguous.c /^PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans)$/;" f SlepcUpdateVectors src/vec/contiguous.c /^PetscErrorCode SlepcUpdateVectors(PetscInt n,Vec *V,PetscInt s,PetscInt e,const PetscScalar *Q,PetscInt ldq,PetscBool qtrans)$/;" f SlepcUpdateVectorsD src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcUpdateVectorsD(Vec *X,PetscInt cX,PetscScalar alpha,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *work,PetscInt lwork)$/;" f SlepcUpdateVectorsS src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcUpdateVectorsS(Vec *Y,PetscInt dY,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,PetscInt dX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM)$/;" f SlepcUpdateVectorsZ src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode SlepcUpdateVectorsZ(Vec *Y,PetscScalar beta,PetscScalar alpha,Vec *X,PetscInt cX,const PetscScalar *M,PetscInt ldM,PetscInt rM,PetscInt cM)$/;" f SlepcUpdateVectors_Noncontiguous src/vec/contiguous.c /^static PetscErrorCode SlepcUpdateVectors_Noncontiguous(PetscInt n,Vec *V,PetscInt s,PetscInt e,const PetscScalar *Q,PetscInt ldq,PetscBool qtrans)$/;" f file: SlepcUpdateVectors_Noncontiguous_Inplace src/vec/contiguous.c /^static PetscErrorCode SlepcUpdateVectors_Noncontiguous_Inplace(PetscInt m_,Vec *V,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans)$/;" f file: SlepcValidVecComp include/slepc-private/vecimplslepc.h /^#define SlepcValidVecComp(/;" d SlepcValidVecsContiguous include/slepc-private/vecimplslepc.h /^#define SlepcValidVecsContiguous(/;" d SlepcVecMAXPBY src/vec/contiguous.c /^PetscErrorCode SlepcVecMAXPBY(Vec y,PetscScalar beta,PetscScalar alpha,PetscInt nv,PetscScalar a[],Vec x[])$/;" f SlepcVecNormalize src/vec/vecutil.c /^PetscErrorCode SlepcVecNormalize(Vec xr,Vec xi,PetscBool iscomplex,PetscReal *norm)$/;" f SlepcVecSetRandom src/vec/vecutil.c /^PetscErrorCode SlepcVecSetRandom(Vec x,PetscRandom rctx)$/;" f SlepcVecSetTemplate src/vec/contiguous.c /^PetscErrorCode SlepcVecSetTemplate(Vec v)$/;" f SolveAddLinearSystem src/eps/impls/ciss/ciss.c /^static PetscErrorCode SolveAddLinearSystem(EPS eps,PetscInt Ladd_start,PetscInt Ladd_end)$/;" f file: SolveLinearSystem src/eps/impls/ciss/ciss.c /^static PetscErrorCode SolveLinearSystem(EPS eps)$/;" f file: StdoutLogger config/cmakeboot.py /^class StdoutLogger(object):$/;" c StdoutLogger config/cmakegen.py /^class StdoutLogger(object):$/;" c SumNorm2 src/vec/veccomp.c /^PETSC_STATIC_INLINE void SumNorm2(PetscReal *ssq0,PetscReal *scale0,PetscReal *ssq1,PetscReal *scale1)$/;" f T include/slepc-private/stimpl.h /^ Mat *T; \/* Matrices resulting from transformation *\/$/;" m struct:_p_ST T src/eps/examples/tutorials/ex9.c /^ Mat T;$/;" m struct:__anon1 file: T src/eps/impls/davidson/common/davidson.h /^ *T, \/* second Schur matrix, T = pY'*G*pX *\/$/;" m struct:_dvdDashboard TESTCODE src/eps/examples/tests/makefile /^TESTCODE = \\$/;" m TESTCODE src/qep/examples/tests/makefile /^TESTCODE = \\$/;" m TESTCODE src/st/examples/tests/makefile /^TESTCODE = \\$/;" m TESTEXAMPLES_BLOPEX src/eps/examples/tests/makefile /^TESTEXAMPLES_BLOPEX = test5.PETSc runtest5_blopex test5.rm$/;" m TESTEXAMPLES_C src/ds/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \\$/;" m TESTEXAMPLES_C src/eps/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \\$/;" m TESTEXAMPLES_C src/eps/examples/tutorials/makefile /^TESTEXAMPLES_C = ex2.PETSc runex2_1 ex2.rm \\$/;" m TESTEXAMPLES_C src/fn/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \\$/;" m TESTEXAMPLES_C src/ip/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \\$/;" m TESTEXAMPLES_C src/mfn/examples/tests/makefile /^TESTEXAMPLES_C =$/;" m TESTEXAMPLES_C src/mfn/examples/tutorials/makefile /^TESTEXAMPLES_C = ex23.PETSc runex23_1 ex23.rm$/;" m TESTEXAMPLES_C src/nep/examples/tests/makefile /^TESTEXAMPLES_C =$/;" m TESTEXAMPLES_C src/nep/examples/tutorials/makefile /^TESTEXAMPLES_C = ex20.PETSc runex20_1 ex20.rm \\$/;" m TESTEXAMPLES_C src/qep/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \\$/;" m TESTEXAMPLES_C src/qep/examples/tutorials/makefile /^TESTEXAMPLES_C = ex16.PETSc runex16_1 ex16.rm$/;" m TESTEXAMPLES_C src/st/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 runtest1_2 test1.rm \\$/;" m TESTEXAMPLES_C src/st/examples/tutorials/makefile /^TESTEXAMPLES_C = ex10.PETSc runex10_1 ex10.rm$/;" m TESTEXAMPLES_C src/svd/examples/tests/makefile /^TESTEXAMPLES_C = test1.PETSc runtest1_1 test1.rm \\$/;" m TESTEXAMPLES_C src/svd/examples/tutorials/makefile /^TESTEXAMPLES_C = ex8.PETSc runex8_1 ex8.rm$/;" m TESTEXAMPLES_C_NOCOMPLEX src/eps/examples/tests/makefile /^TESTEXAMPLES_C_NOCOMPLEX = test1.PETSc runtest1_2 test1.rm$/;" m TESTEXAMPLES_C_NOCOMPLEX src/eps/examples/tutorials/makefile /^TESTEXAMPLES_C_NOCOMPLEX = ex4.PETSc runex4_1 ex4.rm \\$/;" m TESTEXAMPLES_C_NOCOMPLEX src/nep/examples/tutorials/makefile /^TESTEXAMPLES_C_NOCOMPLEX =$/;" m TESTEXAMPLES_C_NOCOMPLEX src/qep/examples/tutorials/makefile /^TESTEXAMPLES_C_NOCOMPLEX = ex17.PETSc runex17_1 ex17.rm$/;" m TESTEXAMPLES_C_NOCOMPLEX src/svd/examples/tutorials/makefile /^TESTEXAMPLES_C_NOCOMPLEX = ex14.PETSc runex14_1 ex14.rm$/;" m TESTEXAMPLES_C_NOF128 src/eps/examples/tests/makefile /^TESTEXAMPLES_C_NOF128 = test5.PETSc runtest5_1 test5.rm$/;" m TESTEXAMPLES_C_NOF128 src/svd/examples/tests/makefile /^TESTEXAMPLES_C_NOF128= test2.PETSc runtest2_1 test2.rm$/;" m TESTEXAMPLES_F90 src/eps/examples/tutorials/makefile /^TESTEXAMPLES_F90 = ex1f90.PETSc runex1f90_1 ex1f90.rm$/;" m TESTEXAMPLES_F90 src/nep/examples/tutorials/makefile /^TESTEXAMPLES_F90 =$/;" m TESTEXAMPLES_F90 src/qep/examples/tutorials/makefile /^TESTEXAMPLES_F90 = ex16f90.PETSc runex16f90_1 ex16f90.rm$/;" m TESTEXAMPLES_FORTRAN src/eps/examples/tests/makefile /^TESTEXAMPLES_FORTRAN = test7f.PETSc runtest7f_1 test7f.rm \\$/;" m TESTEXAMPLES_FORTRAN src/svd/examples/tutorials/makefile /^TESTEXAMPLES_FORTRAN =$/;" m TESTEXAMPLES_FORTRAN_NOCOMPLEX src/eps/examples/tutorials/makefile /^TESTEXAMPLES_FORTRAN_NOCOMPLEX = ex6f.PETSc runex6f_1 ex6f.rm$/;" m TESTS src/ds/examples/tests/makefile /^TESTS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12$/;" m TESTS src/eps/examples/tests/makefile /^TESTS = test1 test2 test3 test4 test5 test6 test7f test8 test9 test10 \\$/;" m TESTS src/fn/examples/tests/makefile /^TESTS = test1 test2$/;" m TESTS src/ip/examples/tests/makefile /^TESTS = test1 test2 test3 test4$/;" m TESTS src/mfn/examples/tests/makefile /^TESTS =$/;" m TESTS src/nep/examples/tests/makefile /^TESTS =$/;" m TESTS src/qep/examples/tests/makefile /^TESTS = test1 test2$/;" m TESTS src/st/examples/tests/makefile /^TESTS = test1 test2 test3$/;" m TESTS src/svd/examples/tests/makefile /^TESTS = test1 test2 test3$/;" m TRLan_ src/eps/impls/external/trlan/trlanp.h /^#define TRLan_ /;" d TridiagDiag_HHR src/ds/impls/ghiep/dsghiep_ivit.c /^static PetscErrorCode TridiagDiag_HHR(PetscInt n,PetscScalar *A,PetscInt lda,PetscReal *s,PetscScalar* Q,PetscInt ldq,PetscBool flip,PetscReal *d,PetscReal *e,PetscInt *perm_,PetscScalar *work,PetscInt nw,PetscReal *rwork,PetscInt nwr,PetscBLASInt *iwork,PetscInt nwi)$/;" f file: TridqdsZhuang src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode TridqdsZhuang(PetscInt n,PetscReal *e,PetscReal *q,PetscReal sum,PetscReal prod,PetscReal tol,PetscReal norm,PetscReal tolDef,PetscReal *e1,PetscReal *q1,PetscInt *fail)$/;" f file: TridqdsZhuang3 src/ds/impls/ghiep/dsghiep_dqds.c /^static PetscErrorCode TridqdsZhuang3(PetscInt n,PetscReal *e,PetscReal *q,PetscReal sum,PetscReal prod,PetscReal tol,PetscReal norm,PetscReal tolDef,PetscInt *fail)$/;" f file: TryHRIt src/ds/impls/ghiep/dsghiep_ivit.c /^static PetscErrorCode TryHRIt(PetscInt n,PetscInt j,PetscInt sz,PetscScalar *H,PetscInt ldh,PetscScalar *R,PetscInt ldr,PetscReal *s,PetscBool *exg,PetscBool *ok,PetscInt *n0,PetscInt *n1,PetscInt *idx0,PetscInt *idx1,PetscScalar *work,PetscInt nw)$/;" f file: U include/slepc-private/svdimpl.h /^ Vec *U,*V; \/* left and right singular vectors *\/$/;" m struct:_p_SVD UnifiedRotation src/ds/impls/ghiep/dsghiep_hz.c /^static PetscErrorCode UnifiedRotation(PetscReal x,PetscReal y,PetscReal sygn,PetscReal *rot,PetscReal *rcond,PetscBool *swap)$/;" f file: V include/slepc-private/epsimpl.h /^ Vec *V; \/* set of basis vectors and computed eigenvectors *\/$/;" m struct:_p_EPS V include/slepc-private/mfnimpl.h /^ Vec *V; \/* set of basis vectors *\/$/;" m struct:_p_MFN V include/slepc-private/nepimpl.h /^ Vec *V; \/* set of basis vectors and computed eigenvectors *\/$/;" m struct:_p_NEP V include/slepc-private/qepimpl.h /^ Vec *V; \/* set of basis vectors and computed eigenvectors *\/$/;" m struct:_p_QEP V include/slepc-private/svdimpl.h /^ Vec *U,*V; \/* left and right singular vectors *\/$/;" m struct:_p_SVD V src/eps/impls/ciss/ciss.c /^ Vec *V;$/;" m struct:__anon1 file: V src/eps/impls/davidson/common/davidson.h /^ Vec *V, \/* searching subspace *\/$/;" m struct:_dvdDashboard V src/eps/impls/krylov/krylovschur/krylovschur.h /^ Vec *V;$/;" m struct:_n_SR VDef src/eps/impls/krylov/krylovschur/krylovschur.h /^ Vec *VDef; \/* Vector for deflation *\/$/;" m struct:_n_SR VECCOMP include/slepcvec.h /^#define VECCOMP /;" d VERBOSE config/cmakegen.py /^ VERBOSE = True$/;" v VERBOSE config/cmakegen.py /^VERBOSE = False$/;" v V_new_e src/eps/impls/davidson/common/davidson.h /^ V_new_e; \/* added to V the columns V_new_s:V_new_e *\/$/;" m struct:_dvdDashboard V_new_s src/eps/impls/davidson/common/davidson.h /^ V_new_s,$/;" m struct:_dvdDashboard V_tra_e src/eps/impls/davidson/common/davidson.h /^ V_tra_e, \/* cX <- [cX V*MT(0:V_tra_s-1)], V <- V*MT(V_tra_s:V_tra_e) *\/$/;" m struct:_dvdDashboard V_tra_s src/eps/impls/davidson/common/davidson.h /^ V_tra_s,$/;" m struct:_dvdDashboard Valencia include/finclude/slepc.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcds.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcdsdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepceps.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcepsdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcfn.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcfndef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcip.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcipdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcmfn.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcmfndef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcnep.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcnepdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcqep.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcqepdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcst.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcstdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcsvd.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcsvddef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcsys.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Valencia include/finclude/slepcsysdef.h /^! Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain$/;" v Vec bin/matlab/classes/slepcmatlabheader.h /^typedef PetscPointer Vec;$/;" t VecAXPBYPCZ_Comp src/vec/veccomp.c /^PetscErrorCode VecAXPBYPCZ_Comp(Vec v,PetscScalar alpha,PetscScalar beta,PetscScalar gamma,Vec w,Vec z)$/;" f VecAXPBY_Comp src/vec/veccomp.c /^PetscErrorCode VecAXPBY_Comp(Vec v,PetscScalar alpha,PetscScalar beta,Vec w)$/;" f VecAXPY_Comp src/vec/veccomp.c /^PetscErrorCode VecAXPY_Comp(Vec v,PetscScalar alpha,Vec w)$/;" f VecAYPX_Comp src/vec/veccomp.c /^PetscErrorCode VecAYPX_Comp(Vec v,PetscScalar alpha,Vec w)$/;" f VecCompGetSubVecs src/vec/veccomp.c /^PetscErrorCode VecCompGetSubVecs(Vec win,PetscInt *n,const Vec **x)$/;" f VecCompInitialized src/vec/veccomp.c /^static PetscBool VecCompInitialized = PETSC_FALSE;$/;" v file: VecCompSetSubVecs src/vec/veccomp.c /^PetscErrorCode VecCompSetSubVecs(Vec win,PetscInt n,Vec *x)$/;" f VecCreateComp src/vec/veccomp.c /^PetscErrorCode VecCreateComp(MPI_Comm comm,PetscInt *Nx,PetscInt n,VecType t,Vec Vparent,Vec *V)$/;" f VecCreateCompWithVecs src/vec/veccomp.c /^PetscErrorCode VecCreateCompWithVecs(Vec *x,PetscInt n,Vec Vparent,Vec *V)$/;" f VecCreate_Comp src/vec/veccomp.c /^PETSC_EXTERN PetscErrorCode VecCreate_Comp(Vec V)$/;" f VecCreate_Comp_Private src/vec/veccomp.c /^static PetscErrorCode VecCreate_Comp_Private(Vec v,Vec *x,PetscInt nx,PetscBool x_to_me,Vec_Comp_N *n)$/;" f file: VecDestroyVecs_Comp src/vec/veccomp.c /^PetscErrorCode VecDestroyVecs_Comp(PetscInt m,Vec v[])$/;" f VecDestroy_Comp src/vec/veccomp.c /^PetscErrorCode VecDestroy_Comp(Vec v)$/;" f VecDotNorm2_Comp src/vec/veccomp0.h /^PetscErrorCode __SUF__(VecDotNorm2_Comp)(Vec v,Vec w,PetscScalar *dp,PetscScalar *nm)$/;" f VecDot_Comp src/vec/veccomp0.h /^PetscErrorCode __SUF__(VecDot_Comp)(Vec a,Vec b,PetscScalar *z)$/;" f VecDuplicateVecs_Comp src/vec/veccomp.c /^PetscErrorCode VecDuplicateVecs_Comp(Vec w,PetscInt m,Vec *V[])$/;" f VecDuplicateVecs_Contiguous src/vec/contiguous.c /^static PetscErrorCode VecDuplicateVecs_Contiguous(Vec v,PetscInt m,Vec *V[])$/;" f file: VecDuplicate_Comp src/vec/veccomp.c /^PetscErrorCode VecDuplicate_Comp(Vec win,Vec *V)$/;" f VecGetLocalSize_Comp src/vec/veccomp.c /^PetscErrorCode VecGetLocalSize_Comp(Vec v,PetscInt *size)$/;" f VecGetSize_Comp src/vec/veccomp.c /^PetscErrorCode VecGetSize_Comp(Vec v,PetscInt *size)$/;" f VecMAXPY_Comp src/vec/veccomp.c /^PetscErrorCode VecMAXPY_Comp(Vec v,PetscInt n,const PetscScalar *alpha,Vec *w)$/;" f VecMDot_Comp src/vec/veccomp0.h /^PetscErrorCode __SUF__(VecMDot_Comp)(Vec a,PetscInt n,const Vec b[],PetscScalar *z)$/;" f VecMTDot_Comp src/vec/veccomp0.h /^PetscErrorCode __SUF__(VecMTDot_Comp)(Vec a,PetscInt n,const Vec b[],PetscScalar *z)$/;" f VecMXDotBegin src/ip/ipdot.c /^#define VecMXDotBegin /;" d file: VecMXDotEnd src/ip/ipdot.c /^#define VecMXDotEnd /;" d file: VecMaxPointwiseDivide_Comp src/vec/veccomp.c /^PetscErrorCode VecMaxPointwiseDivide_Comp(Vec v,Vec w,PetscReal *m)$/;" f VecMax_Comp src/vec/veccomp.c /^PetscErrorCode VecMax_Comp(Vec v,PetscInt *idx,PetscReal *z)$/;" f VecMin_Comp src/vec/veccomp.c /^PetscErrorCode VecMin_Comp(Vec v,PetscInt *idx,PetscReal *z)$/;" f VecNormCompEnd src/vec/veccomp.c /^static PetscErrorCode VecNormCompEnd(void)$/;" f file: VecNormCompInit src/vec/veccomp.c /^static PetscErrorCode VecNormCompInit()$/;" f file: VecNorm_Comp src/vec/veccomp0.h /^PetscErrorCode __SUF__(VecNorm_Comp)(Vec a,NormType t,PetscReal *norm)$/;" f VecTDot_Comp src/vec/veccomp0.h /^PetscErrorCode __SUF__(VecTDot_Comp)(Vec a,Vec b,PetscScalar *z)$/;" f VecWAXPY_Comp src/vec/veccomp.c /^PetscErrorCode VecWAXPY_Comp(Vec v,PetscScalar alpha,Vec w,Vec z)$/;" f VecXDotBegin src/ip/ipdot.c /^#define VecXDotBegin /;" d file: VecXDotEnd src/ip/ipdot.c /^#define VecXDotEnd /;" d file: Vec_Comp include/slepc-private/vecimplslepc.h /^} Vec_Comp;$/;" t typeref:struct:__anon3 Vec_Comp_N include/slepc-private/vecimplslepc.h /^} Vec_Comp_N;$/;" t typeref:struct:__anon2 VecsMult src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsMult(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,PetscScalar *workS0,PetscScalar *workS1)$/;" f VecsMultIa src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsMultIa(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV)$/;" f VecsMultIb src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsMultIb(PetscScalar *M,MatType_t sM,PetscInt ldM,PetscInt rM,PetscInt cM,PetscScalar *auxS,Vec V)$/;" f VecsMultIc src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsMultIc(PetscScalar *M,MatType_t sM,PetscInt ldM,PetscInt rM,PetscInt cM,Vec V)$/;" f VecsMultS src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsMultS(PetscScalar *M,MatType_t sM,PetscInt ldM,Vec *U,PetscInt sU,PetscInt eU,Vec *V,PetscInt sV,PetscInt eV,DvdReduction *r,DvdMult_copy_func *sr)$/;" f VecsMultS_copy_func src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsMultS_copy_func(PetscScalar *out,PetscInt size_out,void *ptr)$/;" f VecsOrthonormalize src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode VecsOrthonormalize(Vec *V,PetscInt n,PetscScalar *wS0,PetscScalar *wS1)$/;" f Vecs_Contiguous include/slepc-private/vecimplslepc.h /^} Vecs_Contiguous;$/;" t typeref:struct:__anon1 Vecs_ContiguousDestroy src/vec/contiguous.c /^static PetscErrorCode Vecs_ContiguousDestroy(void *ctx)$/;" f file: W include/slepc-private/epsimpl.h /^ Vec *W; \/* set of left basis vectors and computed left eigenvectors *\/$/;" m struct:_p_EPS W include/slepc-private/qepimpl.h /^ Vec *W; \/* set of left basis vectors and computed left eigenvectors *\/$/;" m struct:_p_QEP W src/eps/impls/davidson/common/davidson.h /^ *W, \/* testing subspace *\/$/;" m struct:_dvdDashboard WARRANTY include/finclude/slepc.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcds.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcdsdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepceps.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcepsdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcfn.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcfndef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcip.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcipdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcmfn.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcmfndef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcnep.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcnepdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcqep.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcqepdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcst.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcstdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcsvd.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcsvddef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcsys.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v WARRANTY include/finclude/slepcsysdef.h /^! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS$/;" v W_shift src/eps/impls/davidson/common/davidson.h /^ W_shift; \/* if true W is shifted when vectors converge *\/$/;" m struct:_dvdDashboard Wa src/eps/impls/davidson/common/dvd_utils.c /^ Wa, Wb, \/* span{W} = span{Wa*AV - Wb*BV} *\/$/;" m struct:__anon17 file: Wb src/eps/impls/davidson/common/dvd_utils.c /^ Wa, Wb, \/* span{W} = span{Wa*AV - Wb*BV} *\/$/;" m struct:__anon17 file: XKZ src/eps/impls/davidson/common/dvd_improvex.c /^ *XKZ, \/* X'*KZ *\/$/;" m struct:__anon11 file: Y src/eps/impls/ciss/ciss.c /^ Vec *Y;$/;" m struct:__anon1 file: Y src/eps/impls/external/blopex/blopex.c /^ mv_MultiVectorPtr Y;$/;" m struct:__anon1 file: _Ceil src/eps/impls/davidson/common/davidson.h /^#define _Ceil(/;" d _DSIMPL include/slepc-private/dsimpl.h /^#define _DSIMPL$/;" d _DSOps include/slepc-private/dsimpl.h /^struct _DSOps {$/;" s _EPSIMPL include/slepc-private/epsimpl.h /^#define _EPSIMPL$/;" d _EPSOps include/slepc-private/epsimpl.h /^struct _EPSOps {$/;" s _FNIMPL include/slepc-private/fnimpl.h /^#define _FNIMPL$/;" d _FNOps include/slepc-private/fnimpl.h /^struct _FNOps {$/;" s _IPIMPL include/slepc-private/ipimpl.h /^#define _IPIMPL$/;" d _IPOps include/slepc-private/ipimpl.h /^struct _IPOps {$/;" s _MFNIMPL include/slepc-private/mfnimpl.h /^#define _MFNIMPL$/;" d _MFNOps include/slepc-private/mfnimpl.h /^struct _MFNOps {$/;" s _NEPIMPL include/slepc-private/nepimpl.h /^#define _NEPIMPL$/;" d _NEPOps include/slepc-private/nepimpl.h /^struct _NEPOps {$/;" s _QEPIMPL include/slepc-private/qepimpl.h /^#define _QEPIMPL$/;" d _QEPOps include/slepc-private/qepimpl.h /^struct _QEPOps {$/;" s _SLEPCIMPL include/slepc-private/slepcimpl.h /^#define _SLEPCIMPL$/;" d _STIMPL include/slepc-private/stimpl.h /^#define _STIMPL$/;" d _STOps include/slepc-private/stimpl.h /^struct _STOps {$/;" s _SVDIMPL include/slepc-private/svdimpl.h /^#define _SVDIMPL$/;" d _SVDOps include/slepc-private/svdimpl.h /^struct _SVDOps {$/;" s _VECIMPLSLEPC include/slepc-private/vecimplslepc.h /^#define _VECIMPLSLEPC$/;" d __ARPACKP_H src/eps/impls/external/arpack/arpackp.h /^#define __ARPACKP_H$/;" d __BLZPACKP_H src/eps/impls/external/blzpack/blzpackp.h /^#define __BLZPACKP_H$/;" d __COMPOSE2__ src/vec/veccomp.c /^#define __COMPOSE2__(/;" d file: __COMPOSE3__ src/vec/veccomp.c /^#define __COMPOSE3__(/;" d file: __FEASTP_H src/eps/impls/external/feast/feastp.h /^#define __FEASTP_H$/;" d __FUNCT__ src/ds/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test10.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test10.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test11.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test11.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test12.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test12.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test3.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test3.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test4.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test4.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test5.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test5.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test6.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test6.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test7.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test7.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test8.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test8.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/examples/tests/test9.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/examples/tests/test9.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/ghep/dsghep.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/ghep/dsghep.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep_dqds.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep_dqds.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep_hz.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep_hz.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep_ivit.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/ghiep/dsghiep_ivit.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/gnhep/dsgnhep.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/gnhep/dsgnhep.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/hep/dshep.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/hep/dshep.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/nep/dsnep.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/nep/dsnep.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/nhep/dsnhep.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/nhep/dsnhep.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/impls/svd/dssvd.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/impls/svd/dssvd.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/interface/dsbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/interface/dsbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/interface/dsops.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/interface/dsops.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ds/interface/dspriv.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ds/interface/dspriv.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test10.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test10.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test11.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test11.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test12.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test12.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test13.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test13.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test14.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test14.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test3.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test3.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test4.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test4.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test5.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test5.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test6.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test6.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test8.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test8.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tests/test9.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tests/test9.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex11.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex11.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex12.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex12.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex13.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex13.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex18.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex18.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex19.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex19.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex3.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex3.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex4.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex4.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex5.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex5.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex7.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex7.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/examples/tutorials/ex9.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/examples/tutorials/ex9.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/cg/rqcg/rqcg.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/cg/rqcg/rqcg.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/ciss/ciss.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/ciss/ciss.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/davidson.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/davidson.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/davidson.h /^#define __FUNCT__ /;" d __FUNCT__ src/eps/impls/davidson/common/davidson.h /^#undef __FUNCT__$/;" d __FUNCT__ src/eps/impls/davidson/common/dvd_blas.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_blas.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_calcpairs.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_calcpairs.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_gd2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_gd2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_improvex.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_improvex.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_initv.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_initv.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_schm.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_schm.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_testconv.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_testconv.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_updatev.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_updatev.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_utils.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/common/dvd_utils.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/gd/gd.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/gd/gd.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/davidson/jd/jd.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/davidson/jd/jd.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/external/arpack/arpack.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/external/arpack/arpack.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/external/blopex/blopex.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/external/blopex/blopex.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/external/blzpack/blzpack.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/external/blzpack/blzpack.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/external/feast/feast.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/external/feast/feast.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/external/primme/primme.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/external/primme/primme.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/external/trlan/trlan.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/external/trlan/trlan.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/arnoldi/arnoldi.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/arnoldi/arnoldi.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/krylov.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/krylov.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/krylovschur.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/krylovschur.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/ks-indef.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/ks-indef.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/ks-slice.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/ks-slice.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/ks-symm.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/krylovschur/ks-symm.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/krylov/lanczos/lanczos.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/krylov/lanczos/lanczos.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/lapack/lapack.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/lapack/lapack.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/power/power.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/power/power.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/impls/subspace/subspace.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/impls/subspace/subspace.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/basic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/basic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/default.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/default.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/ftn-custom/zepsf.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/ftn-custom/zepsf.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/itregis.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/itregis.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/mem.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/mem.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/monitor.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/monitor.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/opts.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/opts.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/setup.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/setup.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/eps/interface/solve.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/eps/interface/solve.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/fn/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/fn/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/fn/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/fn/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/fn/fnbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/fn/fnbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/fn/fnexp.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/fn/fnexp.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/fn/fnrational.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/fn/fnrational.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/examples/tests/test3.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/examples/tests/test3.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/examples/tests/test4.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/examples/tests/test4.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/ipbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/ipbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/ipbiorthog.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/ipbiorthog.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/ipborthog.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/ipborthog.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/ipdot.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/ipdot.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/ipform.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/ipform.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/ip/iporthog.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/ip/iporthog.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/examples/tutorials/ex23.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/examples/tutorials/ex23.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/impls/krylov/mfnkrylov.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/impls/krylov/mfnkrylov.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/ftn-custom/zmfnf.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/ftn-custom/zmfnf.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/mfnbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/mfnbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/mfnmon.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/mfnmon.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/mfnopts.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/mfnopts.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/mfnregis.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/mfnregis.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/mfnsetup.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/mfnsetup.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/mfn/interface/mfnsolve.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/mfn/interface/mfnsolve.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/examples/tutorials/ex20.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/examples/tutorials/ex20.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/examples/tutorials/ex21.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/examples/tutorials/ex21.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/examples/tutorials/ex22.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/examples/tutorials/ex22.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/impls/narnoldi/narnoldi.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/impls/narnoldi/narnoldi.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/impls/rii/rii.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/impls/rii/rii.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/impls/slp/slp.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/impls/slp/slp.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/ftn-custom/znepf.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/ftn-custom/znepf.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepdefault.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepdefault.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepmon.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepmon.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepopts.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepopts.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepregis.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepregis.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepsetup.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepsetup.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/nep/interface/nepsolve.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/nep/interface/nepsolve.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/examples/tutorials/ex16.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/examples/tutorials/ex16.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/examples/tutorials/ex17.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/examples/tutorials/ex17.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/linear.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/linear.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/qeplin_h1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/qeplin_h1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/qeplin_h2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/qeplin_h2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/qeplin_n1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/qeplin_n1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/qeplin_n2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/qeplin_n2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/qeplin_s1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/qeplin_s1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/linear/qeplin_s2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/linear/qeplin_s2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/qarnoldi/qarnoldi.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/qarnoldi/qarnoldi.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/impls/qlanczos/qlanczos.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/impls/qlanczos/qlanczos.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/ftn-custom/zqepf.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/ftn-custom/zqepf.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepdefault.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepdefault.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepmon.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepmon.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepopts.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepopts.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepregis.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepregis.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepsetup.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepsetup.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/qep/interface/qepsolve.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/qep/interface/qepsolve.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/examples/tests/test3.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/examples/tests/test3.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/examples/tutorials/ex10.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/examples/tutorials/ex10.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/cayley/cayley.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/cayley/cayley.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/fold/fold.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/fold/fold.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/precond/precond.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/precond/precond.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/shell/ftn-custom/zshell.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/shell/ftn-custom/zshell.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/shell/shell.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/shell/shell.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/shift/shift.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/shift/shift.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/impls/sinvert/sinvert.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/impls/sinvert/sinvert.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/interface/shellmat.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/interface/shellmat.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/interface/stfunc.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/interface/stfunc.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/interface/stregis.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/interface/stregis.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/interface/stset.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/interface/stset.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/interface/stsles.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/interface/stsles.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/st/interface/stsolve.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/st/interface/stsolve.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/examples/tests/test1.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/examples/tests/test1.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/examples/tests/test2.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/examples/tests/test2.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/examples/tests/test3.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/examples/tests/test3.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/examples/tutorials/ex14.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/examples/tutorials/ex14.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/examples/tutorials/ex15.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/examples/tutorials/ex15.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/examples/tutorials/ex8.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/examples/tutorials/ex8.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/impls/cross/cross.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/impls/cross/cross.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/impls/cyclic/cyclic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/impls/cyclic/cyclic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/impls/lanczos/gklanczos.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/impls/lanczos/gklanczos.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/impls/lapack/svdlapack.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/impls/lapack/svdlapack.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/impls/trlanczos/trlanczos.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/impls/trlanczos/trlanczos.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/ftn-custom/zsvdf.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/ftn-custom/zsvdf.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdbasic.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdbasic.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdmat.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdmat.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdmon.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdmon.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdopts.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdopts.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdregis.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdregis.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdsetup.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdsetup.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/svd/interface/svdsolve.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/svd/interface/svdsolve.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/sys/slepcinit.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/sys/slepcinit.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/sys/slepcutil.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/sys/slepcutil.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/vec/contiguous.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/vec/contiguous.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/vec/veccomp.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/vec/veccomp.c /^#undef __FUNCT__$/;" d file: __FUNCT__ src/vec/veccomp0.h /^#define __FUNCT__ /;" d __FUNCT__ src/vec/veccomp0.h /^#undef __FUNCT__$/;" d __FUNCT__ src/vec/vecutil.c /^#define __FUNCT__ /;" d file: __FUNCT__ src/vec/vecutil.c /^#undef __FUNCT__$/;" d file: __FUNC_TEMPLATE1__ src/vec/veccomp.c /^#define __FUNC_TEMPLATE1__(/;" d file: __FUNC_TEMPLATE2__ src/vec/veccomp.c /^#define __FUNC_TEMPLATE2__(/;" d file: __FUNC_TEMPLATE3__ src/vec/veccomp.c /^#define __FUNC_TEMPLATE3__(/;" d file: __FUNC_TEMPLATE4__ src/vec/veccomp.c /^#define __FUNC_TEMPLATE4__(/;" d file: __KRYLOVSCHUR_H src/eps/impls/krylov/krylovschur/krylovschur.h /^#define __KRYLOVSCHUR_H$/;" d __LINEARP_H src/qep/impls/linear/linearp.h /^#define __LINEARP_H$/;" d __QUOTEME src/vec/veccomp0.h /^#define __QUOTEME(/;" d __QUOTEME src/vec/veccomp0.h /^#undef __QUOTEME$/;" d __QUOTEME_ src/vec/veccomp0.h /^#define __QUOTEME_(/;" d __QUOTEME__ src/vec/veccomp.c /^#define __QUOTEME__(/;" d file: __SLEPCBLASLAPACK_H include/slepcblaslapack.h /^#define __SLEPCBLASLAPACK_H$/;" d __SLEPCDS_H include/finclude/slepcdsdef.h /^#define __SLEPCDS_H$/;" d __SLEPCDS_H include/slepcds.h /^#define __SLEPCDS_H$/;" d __SLEPCEPS_H include/finclude/slepcepsdef.h /^#define __SLEPCEPS_H$/;" d __SLEPCEPS_H include/slepceps.h /^#define __SLEPCEPS_H$/;" d __SLEPCFN_H include/finclude/slepcfndef.h /^#define __SLEPCFN_H$/;" d __SLEPCFN_H include/slepcfn.h /^#define __SLEPCFN_H$/;" d __SLEPCIP_H include/finclude/slepcipdef.h /^#define __SLEPCIP_H$/;" d __SLEPCIP_H include/slepcip.h /^#define __SLEPCIP_H$/;" d __SLEPCMATH_H include/slepcmath.h /^#define __SLEPCMATH_H$/;" d __SLEPCMFN_H include/finclude/slepcmfndef.h /^#define __SLEPCMFN_H$/;" d __SLEPCMFN_H include/slepcmfn.h /^#define __SLEPCMFN_H$/;" d __SLEPCNEP_H include/finclude/slepcnepdef.h /^#define __SLEPCNEP_H$/;" d __SLEPCNEP_H include/slepcnep.h /^#define __SLEPCNEP_H$/;" d __SLEPCQEP_H include/finclude/slepcqepdef.h /^#define __SLEPCQEP_H$/;" d __SLEPCQEP_H include/slepcqep.h /^#define __SLEPCQEP_H$/;" d __SLEPCST_H include/finclude/slepcstdef.h /^#define __SLEPCST_H$/;" d __SLEPCST_H include/slepcst.h /^#define __SLEPCST_H$/;" d __SLEPCSVD_H include/finclude/slepcsvddef.h /^#define __SLEPCSVD_H$/;" d __SLEPCSVD_H include/slepcsvd.h /^#define __SLEPCSVD_H$/;" d __SLEPCSYS_H include/finclude/slepcsysdef.h /^#define __SLEPCSYS_H$/;" d __SLEPCSYS_H include/slepcsys.h /^#define __SLEPCSYS_H$/;" d __SLEPCVEC_H include/slepcvec.h /^#define __SLEPCVEC_H$/;" d __SLEPCVERSION_H include/slepcversion.h /^#define __SLEPCVERSION_H$/;" d __SUF_C__ src/vec/veccomp0.h /^#define __SUF_C__(/;" d __SUF_C__ src/vec/veccomp0.h /^#undef __SUF_C__$/;" d __SUF__ src/vec/veccomp0.h /^#define __SUF__(/;" d __SUF__ src/vec/veccomp0.h /^#undef __SUF__$/;" d __TRLANP_H src/eps/impls/external/trlan/trlanp.h /^#define __TRLANP_H$/;" d __WITH_MPI__ src/vec/veccomp.c /^#define __WITH_MPI__$/;" d file: __copy__ config/cmakegen.py /^ def __copy__(self):$/;" m class:defaultdict file: __deepcopy__ config/cmakegen.py /^ def __deepcopy__(self, memo):$/;" m class:defaultdict file: __funct__ src/eps/examples/tests/test13.c /^#define __funct__ /;" d file: __funct__ src/eps/examples/tests/test13.c /^#undef __funct__$/;" d file: __getitem__ config/cmakegen.py /^ def __getitem__(self, key):$/;" m class:defaultdict file: __init__ config/cmakeboot.py /^ def __init__(self, slepcdir, petscdir, petscarch, argDB = None, framework = None):$/;" m class:PETScMaker __init__ config/cmakegen.py /^ def __init__(self, default_factory=None, *a, **kw):$/;" m class:defaultdict __init__ setup.py /^ def __init__(self):$/;" m class:context __missing__ config/cmakegen.py /^ def __missing__(self, key):$/;" m class:defaultdict file: __reduce__ config/cmakegen.py /^ def __reduce__(self):$/;" m class:defaultdict file: __repr__ config/cmakegen.py /^ def __repr__(self):$/;" m class:defaultdict file: __str__ config/cmakeboot.py /^ def __str__(self):$/;" m class:PETScMaker file: _build setup.py /^from distutils.command.build import build as _build$/;" i _cb src/eps/interface/ftn-custom/zepsf.c /^} _cb;$/;" v typeref:struct:__anon1 file: _cb src/mfn/interface/ftn-custom/zmfnf.c /^} _cb;$/;" v typeref:struct:__anon1 file: _cb src/nep/interface/ftn-custom/znepf.c /^} _cb;$/;" v typeref:struct:__anon1 file: _cb src/qep/interface/ftn-custom/zqepf.c /^} _cb;$/;" v typeref:struct:__anon1 file: _cb src/st/impls/shell/ftn-custom/zshell.c /^} _cb;$/;" v typeref:struct:__anon1 file: _cb src/svd/interface/ftn-custom/zsvdf.c /^} _cb;$/;" v typeref:struct:__anon1 file: _dvdDashboard src/eps/impls/davidson/common/davidson.h /^typedef struct _dvdDashboard {$/;" s _dvdFunctionList src/eps/impls/davidson/common/davidson.h /^typedef struct _dvdFunctionList {$/;" s _install setup.py /^ from distutils.command.install import install as _install$/;" i _install setup.py /^ from setuptools.command.install import install as _install$/;" i _n_SR src/eps/impls/krylov/krylovschur/krylovschur.h /^struct _n_SR {$/;" s _n_SlepcConvMonitor include/slepc-private/slepcimpl.h /^struct _n_SlepcConvMonitor {$/;" s _n_shift src/eps/impls/krylov/krylovschur/krylovschur.h /^struct _n_shift {$/;" s _p_DS include/slepc-private/dsimpl.h /^struct _p_DS {$/;" s _p_EPS include/slepc-private/epsimpl.h /^struct _p_EPS {$/;" s _p_FN include/slepc-private/fnimpl.h /^struct _p_FN {$/;" s _p_IP include/slepc-private/ipimpl.h /^struct _p_IP {$/;" s _p_MFN include/slepc-private/mfnimpl.h /^struct _p_MFN {$/;" s _p_NEP include/slepc-private/nepimpl.h /^struct _p_NEP {$/;" s _p_QEP include/slepc-private/qepimpl.h /^struct _p_QEP {$/;" s _p_ST include/slepc-private/stimpl.h /^struct _p_ST {$/;" s _p_SVD include/slepc-private/svdimpl.h /^struct _p_SVD {$/;" s _sdist setup.py /^from distutils.command.sdist import sdist as _sdist$/;" i abspath setup.py /^ from os.path import join, isdir, abspath$/;" i abstol include/slepc-private/nepimpl.h /^ PetscReal abstol,rtol,stol; \/* user tolerances *\/$/;" m struct:_p_NEP adaptive include/slepc-private/epsimpl.h /^ PetscBool adaptive; \/* whether matrix norms are adaptively improved *\/$/;" m struct:_p_EPS allResiduals src/eps/impls/davidson/common/dvd_updatev.c /^ allResiduals; \/* if computing all the residuals *\/$/;" m struct:__anon13 file: allocate include/slepc-private/dsimpl.h /^ PetscErrorCode (*allocate)(DS,PetscInt);$/;" m struct:_DSOps allocated_ncv include/slepc-private/epsimpl.h /^ PetscInt allocated_ncv; \/* number of basis vectors allocated *\/$/;" m struct:_p_EPS allocated_ncv include/slepc-private/mfnimpl.h /^ PetscInt allocated_ncv; \/* number of basis vectors allocated *\/$/;" m struct:_p_MFN allocated_ncv include/slepc-private/nepimpl.h /^ PetscInt allocated_ncv; \/* number of basis vectors allocated *\/$/;" m struct:_p_NEP allocated_ncv include/slepc-private/qepimpl.h /^ PetscInt allocated_ncv; \/* number of basis vectors allocated *\/$/;" m struct:_p_QEP alpha include/slepc-private/fnimpl.h /^ PetscScalar *alpha; \/* first group of parameters *\/$/;" m struct:_p_FN alpha src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscReal alpha;$/;" m struct:HRtr file: alpha src/eps/examples/tutorials/ex9.c /^ PetscScalar alpha,beta,tau1,tau2,sigma;$/;" m struct:__anon1 file: alpha src/st/interface/shellmat.c /^ PetscScalar alpha;$/;" m struct:__anon1 file: apply include/slepc-private/stimpl.h /^ PetscErrorCode (*apply)(ST,Vec,Vec);$/;" m struct:_STOps apply src/st/impls/shell/ftn-custom/zshell.c /^ PetscFortranCallbackId apply;$/;" m struct:__anon1 file: apply src/st/impls/shell/shell.c /^ PetscErrorCode (*apply)(ST,Vec,Vec);$/;" m struct:__anon1 file: applyPreconditioner_PRIMME src/eps/impls/external/primme/primme.c /^static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme)$/;" f file: applys include/slepc-private/stimpl.h /^ PetscInt applys;$/;" m struct:_p_ST applytrans include/slepc-private/stimpl.h /^ PetscErrorCode (*applytrans)(ST,Vec,Vec);$/;" m struct:_STOps applytrans src/st/impls/shell/shell.c /^ PetscErrorCode (*applytrans)(ST,Vec,Vec);$/;" m struct:__anon1 file: applytranspose src/st/impls/shell/ftn-custom/zshell.c /^ PetscFortranCallbackId applytranspose;$/;" m struct:__anon1 file: arbitrary include/slepc-private/epsimpl.h /^ PetscErrorCode (*arbitrary)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*);$/;" m struct:_p_EPS arbitrary src/eps/interface/ftn-custom/zepsf.c /^ PetscFortranCallbackId arbitrary;$/;" m struct:__anon1 file: arbitraryctx include/slepc-private/epsimpl.h /^ void *arbitraryctx;$/;" m struct:_p_EPS archdir config/configure.py /^archdir = os.sep.join([slepcdir,petscconf.ARCH])$/;" v arpack config/configure.py /^import arpack$/;" i arpackdir config/configure.py /^ arpackdir = i.split('=')[1]$/;" v arpackdir config/configure.py /^arpackdir = ''$/;" v arpacklibs config/configure.py /^ arpacklibs = i.split('=')[1].split(',')$/;" v arpacklibs config/configure.py /^ arpacklibs = arpack.Check(slepcconf,slepcvars,cmake,tmpdir,arpackdir,arpacklibs)$/;" v arpacklibs config/configure.py /^arpacklibs = []$/;" v array include/slepc-private/vecimplslepc.h /^ PetscScalar *array; \/* pointer to common storage *\/$/;" m struct:__anon1 author setup.py /^ author='SLEPc Team',$/;" v author_email setup.py /^ author_email='slepc-maint@grycap.upv.es',$/;" v auxS src/eps/impls/davidson/common/davidson.h /^ *auxS; \/* auxiliary scalars *\/$/;" m struct:_dvdDashboard auxS src/eps/impls/davidson/common/dvd_improvex.c /^ PetscScalar *auxS, \/* auxiliar scalars *\/$/;" m struct:__anon11 file: auxV src/eps/impls/davidson/common/davidson.h /^ Vec *auxV; \/* auxiliary vectors *\/$/;" m struct:_dvdDashboard auxV src/eps/impls/davidson/common/dvd_improvex.c /^ *auxV; \/* auxiliar vectors *\/$/;" m struct:__anon11 file: back src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscScalar *eig,*eigi,*monit,*back;$/;" m struct:_n_SR backtransform include/slepc-private/epsimpl.h /^ PetscErrorCode (*backtransform)(EPS);$/;" m struct:_EPSOps backtransform include/slepc-private/stimpl.h /^ PetscErrorCode (*backtransform)(ST,PetscInt,PetscScalar*,PetscScalar*);$/;" m struct:_STOps backtransform src/st/impls/shell/ftn-custom/zshell.c /^ PetscFortranCallbackId backtransform;$/;" m struct:__anon1 file: backtransform src/st/impls/shell/shell.c /^ PetscErrorCode (*backtransform)(ST,PetscInt n,PetscScalar*,PetscScalar*);$/;" m struct:__anon1 file: balance include/slepc-private/epsimpl.h /^ EPSBalance balance; \/* the balancing method *\/$/;" m struct:_p_EPS balance_cutoff include/slepc-private/epsimpl.h /^ PetscReal balance_cutoff; \/* cutoff value for balancing *\/$/;" m struct:_p_EPS balance_its include/slepc-private/epsimpl.h /^ PetscInt balance_its; \/* number of iterations of the balancing method *\/$/;" m struct:_p_EPS beta include/slepc-private/fnimpl.h /^ PetscScalar *beta; \/* second group of parameters *\/$/;" m struct:_p_FN beta src/eps/examples/tutorials/ex9.c /^ PetscScalar alpha,beta,tau1,tau2,sigma;$/;" m struct:__anon1 file: beta src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal beta;$/;" m struct:_n_SR blap_fn src/eps/impls/external/blopex/blopex.c /^ lobpcg_BLASLAPACKFunctions blap_fn;$/;" m struct:__anon1 file: block_size src/eps/impls/external/blzpack/blzpackp.h /^ PetscBLASInt block_size; \/* block size *\/$/;" m struct:__anon1 blocksize src/eps/impls/davidson/common/davidson.c /^ PetscInt blocksize, \/* block size *\/$/;" m struct:__anon1 file: blopex config/configure.py /^import blopex$/;" i blopexlibs config/configure.py /^ blopexlibs = blopex.Install(slepcconf,slepcvars,cmake,tmpdir,blopexurl,archdir)$/;" v blopexurl config/configure.py /^blopexurl = ''$/;" v blzpack config/configure.py /^import blzpack$/;" i blzpack_error src/eps/impls/external/blzpack/blzpack.c /^const char* blzpack_error[33] = {$/;" v blzpackdir config/configure.py /^ blzpackdir = i.split('=')[1]$/;" v blzpackdir config/configure.py /^blzpackdir = ''$/;" v blzpacklibs config/configure.py /^ blzpacklibs = i.split('=')[1].split(',')$/;" v blzpacklibs config/configure.py /^ blzpacklibs = blzpack.Check(slepcconf,slepcvars,cmake,tmpdir,blzpackdir,blzpacklibs)$/;" v blzpacklibs config/configure.py /^blzpacklibs = []$/;" v body config/cmakegen.py /^ def body(indentlevel):$/;" f function:writePackage bootstrap setup.py /^def bootstrap():$/;" f bs src/eps/impls/davidson/common/davidson.h /^ bs; \/* max vectors that expands the subspace every iteration *\/$/;" m struct:_dvdDashboard build setup.py /^def build(dry_run=False):$/;" f cS src/eps/impls/davidson/common/davidson.h /^ *cS, \/* first Schur matrix of converged pairs *\/$/;" m struct:_dvdDashboard cT src/eps/impls/davidson/common/davidson.h /^ *cT; \/* second Schur matrix of converged pairs *\/$/;" m struct:_dvdDashboard cX src/eps/impls/davidson/common/davidson.h /^ *cX, \/* converged right eigenvectors *\/$/;" m struct:_dvdDashboard cX_in_AV src/eps/impls/davidson/common/davidson.h /^ cX_in_AV, \/* number of converged vectors in AV *\/$/;" m struct:_dvdDashboard cX_in_BV src/eps/impls/davidson/common/davidson.h /^ cX_in_BV, \/* number of converged vectors in BV *\/$/;" m struct:_dvdDashboard cX_in_G src/eps/impls/davidson/common/davidson.h /^ cX_in_G; \/* number of converged vectors in G *\/$/;" m struct:_dvdDashboard cX_in_H src/eps/impls/davidson/common/davidson.h /^ cX_in_H, \/* number of converged vectors in H *\/$/;" m struct:_dvdDashboard cX_in_V src/eps/impls/davidson/common/davidson.h /^ cX_in_V, \/* number of converged vectors in V *\/$/;" m struct:_dvdDashboard cX_in_W src/eps/impls/davidson/common/davidson.h /^ cX_in_W, \/* number of converged vectors in W *\/$/;" m struct:_dvdDashboard cX_in_impr src/eps/impls/davidson/common/davidson.c /^ cX_in_impr; \/* converged vectors in the projector *\/$/;" m struct:__anon1 file: cX_in_proj src/eps/impls/davidson/common/davidson.c /^ PetscInt cX_in_proj, \/* converged vectors in the projected problem *\/$/;" m struct:__anon1 file: cY src/eps/impls/davidson/common/davidson.h /^ *cY, \/* converged left eigenvectors *\/$/;" m struct:_dvdDashboard calcPairs src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcPairs)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard calcPairs_data src/eps/impls/davidson/common/davidson.h /^ void *calcPairs_data;$/;" m struct:_dvdDashboard calcpairs_W src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_W)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard calcpairs_W_data src/eps/impls/davidson/common/davidson.h /^ void *calcpairs_W_data;$/;" m struct:_dvdDashboard calcpairs_eig_backtrans src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_eig_backtrans)(struct _dvdDashboard*,PetscScalar,PetscScalar,PetscScalar*,PetscScalar*);$/;" m struct:_dvdDashboard calcpairs_eigs_trans src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_eigs_trans)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard calcpairs_proj_res src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_proj_res)(struct _dvdDashboard*,PetscInt r_s,PetscInt r_e,Vec *R);$/;" m struct:_dvdDashboard calcpairs_proj_trans src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_proj_trans)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard calcpairs_residual src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_residual)(struct _dvdDashboard*,PetscInt s,PetscInt e,Vec *R);$/;" m struct:_dvdDashboard calcpairs_residual_data src/eps/impls/davidson/common/davidson.h /^ void *calcpairs_residual_data;$/;" m struct:_dvdDashboard calcpairs_residual_eig src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_residual_eig)(struct _dvdDashboard*,PetscInt s,PetscInt e,Vec *R);$/;" m struct:_dvdDashboard calcpairs_selectPairs src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*calcpairs_selectPairs)(struct _dvdDashboard*,PetscInt n);$/;" m struct:_dvdDashboard cctol include/slepc-private/nepimpl.h /^ PetscBool cctol; \/* constant correction tolerance *\/$/;" m struct:_p_NEP ceigi src/eps/impls/davidson/common/davidson.h /^ *ceigr, *ceigi, \/* converged eigenvalues *\/$/;" m struct:_dvdDashboard ceigr src/eps/impls/davidson/common/davidson.h /^ *ceigr, *ceigi, \/* converged eigenvalues *\/$/;" m struct:_dvdDashboard center src/eps/impls/ciss/ciss.c /^ PetscScalar center; \/* center of the region where to find eigenpairs (default: 0.0) *\/$/;" m struct:__anon1 file: cform src/qep/impls/linear/linearp.h /^ PetscInt cform; \/* companion form *\/$/;" m struct:__anon1 check config/arpack.py /^import check$/;" i check config/blzpack.py /^import check$/;" i check config/configure.py /^import check$/;" i check config/feast.py /^import check$/;" i check config/lapack.py /^import check$/;" i check config/primme.py /^import check$/;" i check config/trlan.py /^import check$/;" i checknullspace include/slepc-private/stimpl.h /^ PetscErrorCode (*checknullspace)(ST,PetscInt,const Vec[]);$/;" m struct:_STOps classifiers setup.py /^ classifiers= classifiers.split('\\n')[1:-1],$/;" v cmake config/configure.py /^ cmake = open(os.sep.join([confdir,'SLEPcConfig.cmake']),'w')$/;" v cmakeboot config/cmakeboot.py /^ def cmakeboot(self, args, log):$/;" m class:PETScMaker cmakeboot config/configure.py /^ import cmakeboot$/;" i cmakeconditional config/cmakegen.py /^def cmakeconditional(key,val):$/;" f cmakegen config/configure.py /^ import cmakegen$/;" i cmakeok config/configure.py /^ cmakeok = cmakeboot.main(slepcdir,petscdir,petscarch=petscconf.ARCH,log=log)$/;" v cmakeok config/configure.py /^cmakeok = False$/;" v cmd_build setup.py /^class cmd_build(_build):$/;" c cmd_install setup.py /^class cmd_install(_install):$/;" c cmd_sdist setup.py /^class cmd_sdist(_sdist):$/;" c cmdclass setup.py /^ cmdclass={$/;" v comm src/eps/impls/davidson/common/davidson.h /^ MPI_Comm comm; \/* MPI communicator *\/$/;" m struct:__anon8 commands config/blopex.py /^import commands$/;" i commands config/check.py /^import commands$/;" i commands config/configure.py /^import commands$/;" i commands config/generatefortranstubs.py /^ import commands$/;" i comp src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscBool comp[2]; \/* Shows completion of subintervals (left and right) *\/$/;" m struct:_n_shift compact include/slepc-private/dsimpl.h /^ PetscBool compact; \/* whether the matrices are stored in compact form *\/$/;" m struct:_p_DS compareDirLists config/cmakegen.py /^ def compareDirLists(mdirs,dirs):$/;" f function:pkgsources compareSourceLists config/cmakegen.py /^ def compareSourceLists(msources, files):$/;" f function:pkgsources comparison include/slepc-private/dsimpl.h /^ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);$/;" m struct:_p_DS comparison include/slepc-private/epsimpl.h /^ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);$/;" m struct:_p_EPS comparison include/slepc-private/nepimpl.h /^ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);$/;" m struct:_p_NEP comparison include/slepc-private/qepimpl.h /^ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);$/;" m struct:_p_QEP comparison src/eps/interface/ftn-custom/zepsf.c /^ PetscFortranCallbackId comparison;$/;" m struct:__anon1 file: comparison src/eps/interface/solve.c /^ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);$/;" m struct:__anon1 file: comparison src/qep/interface/qepsolve.c /^ PetscErrorCode (*comparison)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);$/;" m struct:__anon1 file: comparisonctx include/slepc-private/dsimpl.h /^ void *comparisonctx;$/;" m struct:_p_DS comparisonctx include/slepc-private/epsimpl.h /^ void *comparisonctx;$/;" m struct:_p_EPS comparisonctx include/slepc-private/nepimpl.h /^ void *comparisonctx;$/;" m struct:_p_NEP comparisonctx include/slepc-private/qepimpl.h /^ void *comparisonctx;$/;" m struct:_p_QEP comparisonctx src/eps/interface/solve.c /^ void *comparisonctx;$/;" m struct:__anon1 file: comparisonctx src/qep/interface/qepsolve.c /^ void *comparisonctx;$/;" m struct:__anon1 file: compute_int src/eps/impls/krylov/lanczos/lanczos.c /^static void compute_int(PetscBool *which,PetscReal *mu,PetscInt j,PetscReal delta,PetscReal eta)$/;" f file: computefun include/slepc-private/dsimpl.h /^ PetscErrorCode (*computefun[SLEPC_FUNCTION_LAST][DS_MAX_FUN])(DS);$/;" m struct:_DSOps computefunction include/slepc-private/nepimpl.h /^ PetscErrorCode (*computefunction)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*);$/;" m struct:_p_NEP computejacobian include/slepc-private/nepimpl.h /^ PetscErrorCode (*computejacobian)(NEP,PetscScalar,Mat*,MatStructure*,void*);$/;" m struct:_p_NEP computevectors include/slepc-private/epsimpl.h /^ PetscErrorCode (*computevectors)(EPS);$/;" m struct:_EPSOps cond include/slepc-private/dsimpl.h /^ PetscErrorCode (*cond)(DS,PetscReal*);$/;" m struct:_DSOps confdir config/configure.py /^confdir = os.sep.join([archdir,'conf'])$/;" v config setup.py /^def config(dry_run=False):$/;" f configDir config/configure.py /^configDir = os.path.abspath('config')$/;" v context setup.py /^class context:$/;" c conv include/slepc-private/epsimpl.h /^ EPSConv conv; \/* convergence test *\/$/;" m struct:_p_EPS conv_ps src/eps/impls/davidson/common/davidson.h /^ DS conv_ps, \/* projected problem with the converged pairs *\/$/;" m struct:_dvdDashboard converged include/slepc-private/epsimpl.h /^ PetscErrorCode (*converged)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);$/;" m struct:_p_EPS converged include/slepc-private/nepimpl.h /^ PetscErrorCode (*converged)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*);$/;" m struct:_p_NEP converged include/slepc-private/qepimpl.h /^ PetscErrorCode (*converged)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);$/;" m struct:_p_QEP convergedctx include/slepc-private/epsimpl.h /^ void *convergedctx;$/;" m struct:_p_EPS convergedctx include/slepc-private/nepimpl.h /^ void *convergedctx;$/;" m struct:_p_NEP convergedctx include/slepc-private/qepimpl.h /^ void *convergedctx;$/;" m struct:_p_QEP convergeddestroy include/slepc-private/nepimpl.h /^ PetscErrorCode (*convergeddestroy)(void*);$/;" m struct:_p_NEP convergence src/eps/interface/ftn-custom/zepsf.c /^ PetscFortranCallbackId convergence;$/;" m struct:__anon1 file: copy config/cmakegen.py /^ import copy$/;" i copy config/cmakegen.py /^ def copy(self):$/;" m class:defaultdict correctXnorm src/eps/impls/davidson/common/davidson.h /^ correctXnorm; \/* if true, norm of X are computed *\/$/;" m struct:_dvdDashboard cs src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscReal cs;$/;" m struct:HRtr file: ctx src/st/impls/shell/shell.c /^ void *ctx; \/* user provided context *\/$/;" m struct:__anon1 file: d src/eps/impls/davidson/common/davidson.h /^ void *d;$/;" m struct:_dvdFunctionList d src/eps/impls/davidson/common/dvd_improvex.c /^ *d; \/* the currect dvdDashboard reference *\/$/;" m struct:__anon11 file: data include/slepc-private/epsimpl.h /^ void *data; \/* placeholder for misc stuff associated$/;" m struct:_p_EPS data include/slepc-private/mfnimpl.h /^ void *data; \/* placeholder for misc stuff associated$/;" m struct:_p_MFN data include/slepc-private/nepimpl.h /^ void *data; \/* placeholder for misc stuff associated$/;" m struct:_p_NEP data include/slepc-private/qepimpl.h /^ void *data; \/* placeholder for misc stuff associated$/;" m struct:_p_QEP data include/slepc-private/stimpl.h /^ void *data;$/;" m struct:_p_ST data include/slepc-private/svdimpl.h /^ void *data; \/* placeholder for misc stuff associated$/;" m struct:_p_SVD data src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscScalar *data;$/;" m struct:HRtr file: ddb src/eps/impls/davidson/common/davidson.c /^ dvdDashboard ddb;$/;" m struct:__anon1 file: defaultdict config/cmakegen.py /^ class defaultdict(dict):$/;" c defaultdict config/cmakegen.py /^ from collections import defaultdict$/;" i defl include/slepc-private/epsimpl.h /^ Vec *defl; \/* deflation space *\/$/;" m struct:_p_EPS defsigma include/slepc-private/stimpl.h /^ PetscScalar defsigma; \/* Default value of the shift *\/$/;" m struct:_p_ST delayed src/eps/impls/krylov/arnoldi/arnoldi.c /^ PetscBool delayed;$/;" m struct:__anon1 file: delta src/eps/impls/ciss/ciss.c /^ PetscReal delta; \/* threshold of singular value (1e-12) *\/$/;" m struct:__anon1 file: deque config/cmakeboot.py /^from collections import deque$/;" i deque config/cmakegen.py /^from collections import deque$/;" i description setup.py /^ description=description.pop(0),$/;" v description setup.py /^description = __doc__.split('\\n')[1:-1]; del description[1:3]$/;" v destDir config/blopex.py /^ destDir = os.sep.join([externdir,packagename])$/;" v destroy include/slepc-private/epsimpl.h /^ PetscErrorCode (*destroy)(EPS);$/;" m struct:_EPSOps destroy include/slepc-private/mfnimpl.h /^ PetscErrorCode (*destroy)(MFN);$/;" m struct:_MFNOps destroy include/slepc-private/nepimpl.h /^ PetscErrorCode (*destroy)(NEP);$/;" m struct:_NEPOps destroy include/slepc-private/qepimpl.h /^ PetscErrorCode (*destroy)(QEP);$/;" m struct:_QEPOps destroy include/slepc-private/stimpl.h /^ PetscErrorCode (*destroy)(ST);$/;" m struct:_STOps destroy include/slepc-private/svdimpl.h /^ PetscErrorCode (*destroy)(SVD);$/;" m struct:_SVDOps destroyList src/eps/impls/davidson/common/davidson.h /^ *destroyList; \/* destructor list *\/$/;" m struct:_dvdDashboard diag src/svd/impls/cross/cross.c /^ Vec w,diag;$/;" m struct:__anon1 file: diagA src/eps/impls/davidson/common/dvd_utils.c /^ Vec diagA, diagB;$/;" m struct:__anon15 file: diagB src/eps/impls/davidson/common/dvd_utils.c /^ Vec diagA, diagB;$/;" m struct:__anon15 file: dir src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt dir; \/* Determines the order of values in eig (+1 incr, -1 decr) *\/$/;" m struct:_n_SR download_url setup.py /^ download_url=tarball(),$/;" v ds include/slepc-private/epsimpl.h /^ DS ds; \/* direct solver object *\/$/;" m struct:_p_EPS ds include/slepc-private/mfnimpl.h /^ DS ds; \/* direct solver object *\/$/;" m struct:_p_MFN ds include/slepc-private/nepimpl.h /^ DS ds; \/* direct solver object *\/$/;" m struct:_p_NEP ds include/slepc-private/qepimpl.h /^ DS ds; \/* direct solver object *\/$/;" m struct:_p_QEP ds include/slepc-private/svdimpl.h /^ DS ds; \/* direct solver object *\/$/;" m struct:_p_SVD ds_ortho include/slepc-private/epsimpl.h /^ PetscBool ds_ortho; \/* if defl vectors have been stored & orthonormalized *\/$/;" m struct:_p_EPS dsappendoptionsprefix_ src/ds/interface/ftn-custom/zpsf.c /^#define dsappendoptionsprefix_ /;" d file: dsappendoptionsprefix_ src/ds/interface/ftn-custom/zpsf.c /^PETSC_EXTERN void PETSC_STDCALL dsappendoptionsprefix_(DS *ds,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f dscreate_ src/ds/interface/ftn-custom/zpsf.c /^#define dscreate_ /;" d file: dscreate_ src/ds/interface/ftn-custom/zpsf.c /^PETSC_EXTERN void PETSC_STDCALL dscreate_(MPI_Fint *comm,DS *newds,PetscErrorCode *ierr)$/;" f dsdestroy_ src/ds/interface/ftn-custom/zpsf.c /^#define dsdestroy_ /;" d file: dsdestroy_ src/ds/interface/ftn-custom/zpsf.c /^PETSC_EXTERN void PETSC_STDCALL dsdestroy_(DS *ds,PetscErrorCode *ierr)$/;" f dsgetoptionsprefix_ src/ds/interface/ftn-custom/zpsf.c /^#define dsgetoptionsprefix_ /;" d file: dsgetoptionsprefix_ src/ds/interface/ftn-custom/zpsf.c /^PETSC_EXTERN void PETSC_STDCALL dsgetoptionsprefix_(DS *ds,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f dssetoptionsprefix_ src/ds/interface/ftn-custom/zpsf.c /^#define dssetoptionsprefix_ /;" d file: dssetoptionsprefix_ src/ds/interface/ftn-custom/zpsf.c /^PETSC_EXTERN void PETSC_STDCALL dssetoptionsprefix_(DS *ds,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f dsview_ src/ds/interface/ftn-custom/zpsf.c /^#define dsview_ /;" d file: dsview_ src/ds/interface/ftn-custom/zpsf.c /^PETSC_EXTERN void PETSC_STDCALL dsview_(DS *ds,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f dvdBlackboard src/eps/impls/davidson/common/davidson.h /^} dvdBlackboard;$/;" t typeref:struct:__anon6 dvdCallback src/eps/impls/davidson/common/davidson.h /^typedef PetscErrorCode (*dvdCallback)(dvdDashboard*);$/;" t dvdDashboard src/eps/impls/davidson/common/davidson.h /^} dvdDashboard;$/;" t typeref:struct:_dvdDashboard dvdFunctionList src/eps/impls/davidson/common/davidson.h /^} dvdFunctionList;$/;" t typeref:struct:_dvdFunctionList dvdHarmonic src/eps/impls/davidson/common/dvd_utils.c /^} dvdHarmonic;$/;" t typeref:struct:__anon17 file: dvdImprovex_gd2 src/eps/impls/davidson/common/dvd_gd2.c /^} dvdImprovex_gd2;$/;" t typeref:struct:__anon10 file: dvdImprovex_jd src/eps/impls/davidson/common/dvd_improvex.c /^} dvdImprovex_jd;$/;" t typeref:struct:__anon11 file: dvdInitV src/eps/impls/davidson/common/dvd_initv.c /^} dvdInitV;$/;" t typeref:struct:__anon12 file: dvdJacobiPrecond src/eps/impls/davidson/common/dvd_utils.c /^} dvdJacobiPrecond;$/;" t typeref:struct:__anon15 file: dvdManagV_basic src/eps/impls/davidson/common/dvd_updatev.c /^} dvdManagV_basic;$/;" t typeref:struct:__anon13 file: dvdPCWrapper src/eps/impls/davidson/common/dvd_utils.c /^} dvdPCWrapper;$/;" t typeref:struct:__anon14 file: dvdPrecond src/eps/impls/davidson/common/davidson.h /^typedef PetscErrorCode (*dvdPrecond)(dvdDashboard*,PetscInt i,Vec x,Vec Px);$/;" t dvd_BorthV_faster src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode dvd_BorthV_faster(IP ip,Vec *defl,Vec *BDS,PetscReal *BDSn,PetscInt size_DS,Vec *cX,Vec *BcX,PetscReal *BcXn,PetscInt size_cX,Vec *V,Vec *BV,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand)$/;" f dvd_BorthV_stable src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode dvd_BorthV_stable(IP ip,Vec *defl,PetscReal *BDSn,PetscInt size_DS,Vec *cX,PetscReal *BcXn,PetscInt size_cX,Vec *V,PetscReal *BVn,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand)$/;" f dvd_aux_matmult src/eps/impls/davidson/common/dvd_improvex.c /^PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmult(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV)$/;" f dvd_aux_matmulttrans src/eps/impls/davidson/common/dvd_improvex.c /^PETSC_STATIC_INLINE PetscErrorCode dvd_aux_matmulttrans(dvdImprovex_jd *data,const Vec *x,const Vec *y,const Vec *auxV)$/;" f dvd_calcPairs_prof src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_calcPairs_prof(dvdDashboard* d)$/;" f dvd_calcpairs_apply_arbitrary src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_apply_arbitrary(dvdDashboard *d,PetscInt r_s,PetscInt r_e,PetscScalar **rr_,PetscScalar **ri_)$/;" f dvd_calcpairs_eig_res_0 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_eig_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R)$/;" f dvd_calcpairs_proj src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_proj(dvdDashboard *d)$/;" f dvd_calcpairs_proj_res src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_proj_res(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R)$/;" f dvd_calcpairs_projeig_solve src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_projeig_solve(dvdDashboard *d)$/;" f dvd_calcpairs_qz src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_qz(dvdDashboard *d,dvdBlackboard *b,EPSOrthType orth,IP ipI,PetscInt cX_proj,PetscBool harm)$/;" f dvd_calcpairs_qz_d src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_qz_d(dvdDashboard *d)$/;" f dvd_calcpairs_qz_start src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_qz_start(dvdDashboard *d)$/;" f dvd_calcpairs_res_0 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_res_0(dvdDashboard *d,PetscInt r_s,PetscInt r_e,Vec *R)$/;" f dvd_calcpairs_selectPairs src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_selectPairs(dvdDashboard *d,PetscInt n)$/;" f dvd_calcpairs_updateAV0 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateAV0(dvdDashboard *d)$/;" f dvd_calcpairs_updateAV1 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateAV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)$/;" f dvd_calcpairs_updateBV0 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateBV0(dvdDashboard *d)$/;" f dvd_calcpairs_updateBV0_gen src/eps/impls/davidson/common/dvd_calcpairs.c /^PETSC_STATIC_INLINE PetscErrorCode dvd_calcpairs_updateBV0_gen(dvdDashboard *d,Vec *real_BV,PetscInt *size_cBV,Vec **BV,PetscInt *size_BV,PetscInt *max_size_BV,PetscBool BV_shift,PetscInt *cX_in_proj,DSMatType mat)$/;" f dvd_calcpairs_updateBV1 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateBV1(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)$/;" f dvd_calcpairs_updateV0 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateV0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)$/;" f dvd_calcpairs_updateV1 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateV1(dvdDashboard *d)$/;" f dvd_calcpairs_updateW0 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateW0(dvdDashboard *d,DvdReduction *r,DvdMult_copy_func **sr)$/;" f dvd_calcpairs_updateW1 src/eps/impls/davidson/common/dvd_calcpairs.c /^PetscErrorCode dvd_calcpairs_updateW1(dvdDashboard *d)$/;" f dvd_harm_backtrans src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_backtrans(dvdHarmonic *data,PetscScalar *ar,PetscScalar *ai)$/;" f dvd_harm_conf src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_conf(dvdDashboard *d,dvdBlackboard *b,HarmType_t mode,PetscBool fixedTarget,PetscScalar t)$/;" f dvd_harm_d src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_d(dvdDashboard *d)$/;" f dvd_harm_eig_backtrans src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_eig_backtrans(dvdDashboard *d,PetscScalar ar,PetscScalar ai,PetscScalar *br,PetscScalar *bi)$/;" f dvd_harm_eigs_trans src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_eigs_trans(dvdDashboard *d)$/;" f dvd_harm_proj src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_proj(dvdDashboard *d)$/;" f dvd_harm_transf src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_transf(dvdHarmonic *dvdh,PetscScalar t)$/;" f dvd_harm_updateW src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_harm_updateW(dvdDashboard *d)$/;" f dvd_improveX_prof src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_improveX_prof(dvdDashboard* d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D)$/;" f dvd_improvex_PfuncV src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_PfuncV(dvdDashboard *d,void *funcV,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,Vec *auxV,PetscScalar *auxS)$/;" f dvd_improvex_apply_proj src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_apply_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS)$/;" f dvd_improvex_applytrans_proj src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_applytrans_proj(dvdDashboard *d,Vec *V,PetscInt cV,PetscScalar *auxS)$/;" f dvd_improvex_compute_X src/eps/impls/davidson/common/davidson.h /^PETSC_STATIC_INLINE PetscErrorCode dvd_improvex_compute_X(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,PetscScalar *pX,PetscInt ld)$/;" f dvd_improvex_gd2 src/eps/impls/davidson/common/dvd_gd2.c /^PetscErrorCode dvd_improvex_gd2(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs)$/;" f dvd_improvex_gd2_d src/eps/impls/davidson/common/dvd_gd2.c /^PetscErrorCode dvd_improvex_gd2_d(dvdDashboard *d)$/;" f dvd_improvex_gd2_gen src/eps/impls/davidson/common/dvd_gd2.c /^PetscErrorCode dvd_improvex_gd2_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D)$/;" f dvd_improvex_jd src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd(dvdDashboard *d,dvdBlackboard *b,KSP ksp,PetscInt max_bs,PetscInt cX_impr,PetscBool dynamic)$/;" f dvd_improvex_jd_d src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_d(dvdDashboard *d)$/;" f dvd_improvex_jd_end src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_end(dvdDashboard *d)$/;" f dvd_improvex_jd_gen src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_gen(dvdDashboard *d,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D)$/;" f dvd_improvex_jd_lit_const src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_lit_const(dvdDashboard *d,dvdBlackboard *b,PetscInt maxits,PetscReal tol,PetscReal fix)$/;" f dvd_improvex_jd_lit_const_0 src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_lit_const_0(dvdDashboard *d,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol)$/;" f dvd_improvex_jd_proj_cuv src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_proj_cuv(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec **u,Vec **v,Vec *kr,Vec **auxV,PetscScalar **auxS,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld)$/;" f dvd_improvex_jd_proj_uv src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_proj_uv(dvdDashboard *d,dvdBlackboard *b,ProjType_t p)$/;" f dvd_improvex_jd_proj_uv_KXX src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_proj_uv_KXX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld)$/;" f dvd_improvex_jd_proj_uv_KZX src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_proj_uv_KZX(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld)$/;" f dvd_improvex_jd_start src/eps/impls/davidson/common/dvd_improvex.c /^PetscErrorCode dvd_improvex_jd_start(dvdDashboard *d)$/;" f dvd_improvex_precond_d src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_improvex_precond_d(dvdDashboard *d)$/;" f dvd_initV src/eps/impls/davidson/common/dvd_initv.c /^PetscErrorCode dvd_initV(dvdDashboard *d, dvdBlackboard *b, PetscInt k,PetscInt user, PetscBool krylov)$/;" f dvd_initV_classic_0 src/eps/impls/davidson/common/dvd_initv.c /^PetscErrorCode dvd_initV_classic_0(dvdDashboard *d)$/;" f dvd_initV_d src/eps/impls/davidson/common/dvd_initv.c /^PetscErrorCode dvd_initV_d(dvdDashboard *d)$/;" f dvd_initV_krylov_0 src/eps/impls/davidson/common/dvd_initv.c /^PetscErrorCode dvd_initV_krylov_0(dvdDashboard *d)$/;" f dvd_initV_prof src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_initV_prof(dvdDashboard* d)$/;" f dvd_isrestarting_fullV src/eps/impls/davidson/common/dvd_updatev.c /^PetscBool dvd_isrestarting_fullV(dvdDashboard *d)$/;" f dvd_jacobi_precond src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_jacobi_precond(dvdDashboard *d,dvdBlackboard *b)$/;" f dvd_jacobi_precond_0 src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_jacobi_precond_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px)$/;" f dvd_managementV_basic src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_managementV_basic(dvdDashboard *d,dvdBlackboard *b,PetscInt bs,PetscInt mpd,PetscInt min_size_V,PetscInt plusk,PetscBool harm,PetscBool allResiduals)$/;" f dvd_managementV_basic_d src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_managementV_basic_d(dvdDashboard *d)$/;" f dvd_orthV src/eps/impls/davidson/common/dvd_blas.c /^PetscErrorCode dvd_orthV(IP ip,Vec *defl,PetscInt size_DS,Vec *cX,PetscInt size_cX,Vec *V,PetscInt V_new_s,PetscInt V_new_e,PetscScalar *auxS,PetscRandom rand)$/;" f dvd_orthV_prof src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_orthV_prof(dvdDashboard *d)$/;" f dvd_precond_none src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_precond_none(dvdDashboard *d,PetscInt i,Vec x,Vec Px)$/;" f dvd_prof_init src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_prof_init()$/;" f dvd_profiler src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_profiler(dvdDashboard *d,dvdBlackboard *b)$/;" f dvd_profiler_d src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_profiler_d(dvdDashboard *d)$/;" f dvd_schm_basic_conf src/eps/impls/davidson/common/dvd_schm.c /^PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,IP ip,HarmType_t harmMode,PetscBool fixedTarget,PetscScalar t,KSP ksp,PetscReal fix,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,PetscBool dynamic,Method_t method)$/;" f dvd_schm_basic_preconf src/eps/impls/davidson/common/dvd_schm.c /^PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d,dvdBlackboard *b,PetscInt mpd,PetscInt min_size_V,PetscInt bs,PetscInt ini_size_V,PetscInt size_initV,PetscInt plusk,HarmType_t harmMode,KSP ksp,InitType_t init,PetscBool allResiduals,EPSOrthType orth,PetscInt cX_proj,PetscInt cX_impr,Method_t method)$/;" f dvd_static_precond_PC src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_static_precond_PC(dvdDashboard *d,dvdBlackboard *b,PC pc)$/;" f dvd_static_precond_PC_0 src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_static_precond_PC_0(dvdDashboard *d,PetscInt i,Vec x,Vec Px)$/;" f dvd_testconv_basic src/eps/impls/davidson/common/dvd_testconv.c /^PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b)$/;" f dvd_testconv_basic_0 src/eps/impls/davidson/common/dvd_testconv.c /^PetscBool dvd_testconv_basic_0(dvdDashboard *d, PetscScalar eigvr,$/;" f dvd_testconv_slepc src/eps/impls/davidson/common/dvd_testconv.c /^PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b)$/;" f dvd_testconv_slepc_0 src/eps/impls/davidson/common/dvd_testconv.c /^PetscBool dvd_testconv_slepc_0(dvdDashboard *d, PetscScalar eigvr,$/;" f dvd_updateV_conv_gen src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_updateV_conv_gen(dvdDashboard *d)$/;" f dvd_updateV_extrapol src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_updateV_extrapol(dvdDashboard *d)$/;" f dvd_updateV_prof src/eps/impls/davidson/common/dvd_utils.c /^PetscErrorCode dvd_updateV_prof(dvdDashboard *d)$/;" f dvd_updateV_restart_gen src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_updateV_restart_gen(dvdDashboard *d)$/;" f dvd_updateV_start src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_updateV_start(dvdDashboard *d)$/;" f dvd_updateV_testConv src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_updateV_testConv(dvdDashboard *d,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv)$/;" f dvd_updateV_update_gen src/eps/impls/davidson/common/dvd_updatev.c /^PetscErrorCode dvd_updateV_update_gen(dvdDashboard *d)$/;" f dynamic src/eps/impls/davidson/common/davidson.c /^ PetscBool dynamic; \/* true if dynamic stopping criterion is used *\/$/;" m struct:__anon1 file: dynamic src/eps/impls/davidson/common/dvd_improvex.c /^ dynamic; \/* if the dynamic stopping criterion is applied *\/$/;" m struct:__anon11 file: e0 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 e1 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 e_Vchanged src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*e_Vchanged)(struct _dvdDashboard*,PetscInt s_imm,PetscInt e_imm,PetscInt s_new,PetscInt e_new);$/;" m struct:_dvdDashboard e_Vchanged_data src/eps/impls/davidson/common/davidson.h /^ void *e_Vchanged_data;$/;" m struct:_dvdDashboard e_Vchanged_type src/eps/impls/davidson/common/davidson.h /^typedef PetscErrorCode (*e_Vchanged_type)(dvdDashboard*,PetscInt s_imm,PetscInt e_imm,PetscInt s_new,PetscInt e_new);$/;" t e_newIteration src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*e_newIteration)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard e_newIteration_data src/eps/impls/davidson/common/davidson.h /^ void *e_newIteration_data;$/;" m struct:_dvdDashboard e_newIteration_type src/eps/impls/davidson/common/davidson.h /^typedef PetscErrorCode (*e_newIteration_type)(dvdDashboard*);$/;" t eig include/slepc-private/nepimpl.h /^ PetscScalar *eig; \/* computed eigenvalues *\/$/;" m struct:_p_NEP eig src/eps/impls/external/blzpack/blzpackp.h /^ PetscScalar *eig;$/;" m struct:__anon1 eig src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscScalar *eig,*eigi,*monit,*back;$/;" m struct:_n_SR eigenvectors src/eps/impls/external/blopex/blopex.c /^ mv_MultiVectorPtr eigenvectors;$/;" m struct:__anon1 file: eigi include/slepc-private/epsimpl.h /^ PetscScalar *eigr,*eigi; \/* real and imaginary parts of eigenvalues *\/$/;" m struct:_p_EPS eigi include/slepc-private/qepimpl.h /^ PetscScalar *eigr,*eigi; \/* real and imaginary parts of eigenvalues *\/$/;" m struct:_p_QEP eigi src/eps/impls/davidson/common/davidson.h /^ *eigr, *eigi, \/* current eigenvalues *\/$/;" m struct:_dvdDashboard eigi src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscScalar *eig,*eigi,*monit,*back;$/;" m struct:_n_SR eigr include/slepc-private/epsimpl.h /^ PetscScalar *eigr,*eigi; \/* real and imaginary parts of eigenvalues *\/$/;" m struct:_p_EPS eigr include/slepc-private/qepimpl.h /^ PetscScalar *eigr,*eigi; \/* real and imaginary parts of eigenvalues *\/$/;" m struct:_p_QEP eigr src/eps/impls/davidson/common/davidson.h /^ *eigr, *eigi, \/* current eigenvalues *\/$/;" m struct:_dvdDashboard endList src/eps/impls/davidson/common/davidson.h /^ *endList, \/* ending list *\/$/;" m struct:_dvdDashboard enter setup.py /^ def enter(self):$/;" m class:context eps src/eps/impls/davidson/common/davidson.h /^ EPS eps; \/* Connection to SLEPc *\/$/;" m struct:_dvdDashboard eps src/eps/impls/external/primme/primme.c /^ EPS eps; \/* EPS current context *\/$/;" m struct:__anon1 file: eps src/nep/impls/slp/slp.c /^ EPS eps; \/* linear eigensolver for T*z = mu*Tp*z *\/$/;" m struct:__anon1 file: eps src/qep/impls/linear/linearp.h /^ EPS eps; \/* linear eigensolver for Az=lBz *\/$/;" m struct:__anon1 eps src/svd/impls/cross/cross.c /^ EPS eps;$/;" m struct:__anon1 file: eps src/svd/impls/cyclic/cyclic.c /^ EPS eps;$/;" m struct:__anon1 file: epsappendoptionsprefix_ src/eps/interface/ftn-custom/zepsf.c /^#define epsappendoptionsprefix_ /;" d file: epsappendoptionsprefix_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsappendoptionsprefix_(EPS *eps,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f epsconvergedabsolute_ src/eps/interface/ftn-custom/zepsf.c /^#define epsconvergedabsolute_ /;" d file: epsconvergedabsolute_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsconvergedabsolute_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr)$/;" f epsconvergedeigrelative_ src/eps/interface/ftn-custom/zepsf.c /^#define epsconvergedeigrelative_ /;" d file: epsconvergedeigrelative_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsconvergedeigrelative_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr)$/;" f epsconvergednormrelative_ src/eps/interface/ftn-custom/zepsf.c /^#define epsconvergednormrelative_ /;" d file: epsconvergednormrelative_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsconvergednormrelative_(EPS *eps,PetscScalar *eigr,PetscScalar *eigi,PetscReal *res,PetscReal *errest,void *ctx,PetscErrorCode *ierr)$/;" f epscreate_ src/eps/interface/ftn-custom/zepsf.c /^#define epscreate_ /;" d file: epscreate_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epscreate_(MPI_Fint *comm,EPS *eps,PetscErrorCode *ierr)$/;" f epsdestroy_ src/eps/interface/ftn-custom/zepsf.c /^#define epsdestroy_ /;" d file: epsdestroy_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsdestroy_(EPS *eps,PetscErrorCode *ierr)$/;" f epsgetconvergedreason_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetconvergedreason_ /;" d file: epsgetconvergedreason_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetconvergedreason_(EPS *eps,EPSConvergedReason *reason,PetscErrorCode *ierr)$/;" f epsgetds_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetds_ /;" d file: epsgetds_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetds_(EPS *eps,DS *ds,PetscErrorCode *ierr)$/;" f epsgetextraction_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetextraction_ /;" d file: epsgetextraction_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetextraction_(EPS *eps,EPSExtraction *proj,PetscErrorCode *ierr)$/;" f epsgetip_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetip_ /;" d file: epsgetip_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetip_(EPS *eps,IP *ip,PetscErrorCode *ierr)$/;" f epsgetoperators_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetoperators_ /;" d file: epsgetoperators_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetoperators_(EPS *eps,Mat *A,Mat *B,PetscErrorCode *ierr)$/;" f epsgetoptionsprefix_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetoptionsprefix_ /;" d file: epsgetoptionsprefix_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetoptionsprefix_(EPS *eps,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f epsgetproblemtype_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetproblemtype_ /;" d file: epsgetproblemtype_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetproblemtype_(EPS *eps,EPSProblemType *type,PetscErrorCode *ierr)$/;" f epsgetst_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetst_ /;" d file: epsgetst_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetst_(EPS *eps,ST *st,PetscErrorCode *ierr)$/;" f epsgettype_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgettype_ /;" d file: epsgettype_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgettype_(EPS *eps,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f epsgetwhicheigenpairs_ src/eps/interface/ftn-custom/zepsf.c /^#define epsgetwhicheigenpairs_ /;" d file: epsgetwhicheigenpairs_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsgetwhicheigenpairs_(EPS *eps,EPSWhich *which,PetscErrorCode *ierr)$/;" f epslanczosgetreorthog_ src/eps/interface/ftn-custom/zepsf.c /^#define epslanczosgetreorthog_ /;" d file: epslanczosgetreorthog_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epslanczosgetreorthog_(EPS *eps,EPSLanczosReorthogType *reorthog,PetscErrorCode *ierr)$/;" f epsmonitorall_ src/eps/interface/ftn-custom/zepsf.c /^#define epsmonitorall_ /;" d file: epsmonitorall_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void epsmonitorall_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f epsmonitorconverged_ src/eps/interface/ftn-custom/zepsf.c /^#define epsmonitorconverged_ /;" d file: epsmonitorconverged_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void epsmonitorconverged_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f epsmonitorfirst_ src/eps/interface/ftn-custom/zepsf.c /^#define epsmonitorfirst_ /;" d file: epsmonitorfirst_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void epsmonitorfirst_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f epsmonitorlg_ src/eps/interface/ftn-custom/zepsf.c /^#define epsmonitorlg_ /;" d file: epsmonitorlg_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void epsmonitorlg_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f epsmonitorlgall_ src/eps/interface/ftn-custom/zepsf.c /^#define epsmonitorlgall_ /;" d file: epsmonitorlgall_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void epsmonitorlgall_(EPS *eps,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f epsmonitorset_ src/eps/interface/ftn-custom/zepsf.c /^#define epsmonitorset_ /;" d file: epsmonitorset_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsmonitorset_(EPS *eps,void (PETSC_STDCALL *monitor)(EPS*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr)$/;" f epspowergetshifttype_ src/eps/interface/ftn-custom/zepsf.c /^#define epspowergetshifttype_ /;" d file: epspowergetshifttype_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epspowergetshifttype_(EPS *eps,EPSPowerShiftType *shift,PetscErrorCode *ierr)$/;" f epsprimmegetmethod_ src/eps/impls/external/primme/ftn-custom/zprimmef.c /^#define epsprimmegetmethod_ /;" d file: epsprimmegetmethod_ src/eps/impls/external/primme/ftn-custom/zprimmef.c /^PETSC_EXTERN void PETSC_STDCALL epsprimmegetmethod_(EPS *eps,EPSPRIMMEMethod *method,PetscErrorCode *ierr)$/;" f epssetarbitraryselection_ src/eps/interface/ftn-custom/zepsf.c /^#define epssetarbitraryselection_ /;" d file: epssetarbitraryselection_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epssetarbitraryselection_(EPS *eps,void (PETSC_STDCALL *func)(PetscScalar*,PetscScalar*,Vec*,Vec*,PetscScalar*,PetscScalar*,void*,PetscErrorCode*),void *ctx,PetscErrorCode *ierr)$/;" f epssetconvergencetestfunction_ src/eps/interface/ftn-custom/zepsf.c /^#define epssetconvergencetestfunction_ /;" d file: epssetconvergencetestfunction_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epssetconvergencetestfunction_(EPS *eps,void (PETSC_STDCALL *func)(EPS*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,void*,PetscErrorCode*),void* ctx,PetscErrorCode *ierr)$/;" f epsseteigenvaluecomparison_ src/eps/interface/ftn-custom/zepsf.c /^#define epsseteigenvaluecomparison_ /;" d file: epsseteigenvaluecomparison_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsseteigenvaluecomparison_(EPS *eps,void (PETSC_STDCALL *func)(PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*,void*),void* ctx,PetscErrorCode *ierr)$/;" f epssetoptionsprefix_ src/eps/interface/ftn-custom/zepsf.c /^#define epssetoptionsprefix_ /;" d file: epssetoptionsprefix_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epssetoptionsprefix_(EPS *eps,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f epssettype_ src/eps/interface/ftn-custom/zepsf.c /^#define epssettype_ /;" d file: epssettype_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epssettype_(EPS *eps,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f epsview_ src/eps/interface/ftn-custom/zepsf.c /^#define epsview_ /;" d file: epsview_ src/eps/interface/ftn-custom/zepsf.c /^PETSC_EXTERN void PETSC_STDCALL epsview_(EPS *eps,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f errest include/slepc-private/epsimpl.h /^ PetscReal *errest; \/* error estimates *\/$/;" m struct:_p_EPS errest include/slepc-private/mfnimpl.h /^ PetscReal errest; \/* error estimate *\/$/;" m struct:_p_MFN errest include/slepc-private/nepimpl.h /^ PetscReal *errest; \/* error estimates *\/$/;" m struct:_p_NEP errest include/slepc-private/qepimpl.h /^ PetscReal *errest; \/* error estimates *\/$/;" m struct:_p_QEP errest include/slepc-private/svdimpl.h /^ PetscReal *errest; \/* error estimates *\/$/;" m struct:_p_SVD errest src/eps/impls/davidson/common/davidson.h /^ *errest, \/* relative error eigenpairs *\/$/;" m struct:_dvdDashboard errest src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal *errest;$/;" m struct:_n_SR errest_left include/slepc-private/epsimpl.h /^ PetscReal *errest_left; \/* left error estimates *\/$/;" m struct:_p_EPS errorifnotconverged include/slepc-private/mfnimpl.h /^ PetscBool errorifnotconverged; \/* error out if MFNSolve() does not converge *\/$/;" m struct:_p_MFN est_eig src/eps/impls/ciss/ciss.c /^ PetscReal est_eig;$/;" m struct:__anon1 file: evaluatederivative include/slepc-private/fnimpl.h /^ PetscErrorCode (*evaluatederivative)(FN,PetscScalar,PetscScalar*);$/;" m struct:_FNOps evaluatefunction include/slepc-private/fnimpl.h /^ PetscErrorCode (*evaluatefunction)(FN,PetscScalar,PetscScalar*);$/;" m struct:_FNOps evecsavailable include/slepc-private/epsimpl.h /^ PetscBool evecsavailable; \/* computed eigenvectors *\/$/;" m struct:_p_EPS exit setup.py /^ def exit(self):$/;" m class:context explicitmatrix src/qep/impls/linear/linearp.h /^ PetscBool explicitmatrix;$/;" m struct:__anon1 explicitmatrix src/svd/impls/cyclic/cyclic.c /^ PetscBool explicitmatrix;$/;" m struct:__anon1 file: ext src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal ext[2]; \/* Limits for accepted values *\/$/;" m struct:_n_shift extraction include/slepc-private/epsimpl.h /^ EPSExtraction extraction; \/* which kind of extraction to be applied *\/$/;" m struct:_p_EPS extrarow include/slepc-private/dsimpl.h /^ PetscBool extrarow; \/* assume the matrix dimension is (n+1) x n *\/$/;" m struct:_p_DS f include/slepc-private/dsimpl.h /^ FN f[DS_NUM_EXTRA]; \/* functions provided via DSSetFN() *\/$/;" m struct:_p_DS f include/slepc-private/nepimpl.h /^ FN *f; \/* matrix functions of split form *\/$/;" m struct:_p_NEP f src/eps/impls/davidson/common/davidson.h /^ f; \/* function called after the reduction *\/$/;" m struct:__anon7 f src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*f)(void*);$/;" m struct:_dvdFunctionList feast config/configure.py /^import feast$/;" i feastdir config/configure.py /^ feastdir = i.split('=')[1]$/;" v feastdir config/configure.py /^feastdir = ''$/;" v feastlibs config/configure.py /^ feastlibs = i.split('=')[1].split(',')$/;" v feastlibs config/configure.py /^ feastlibs = feast.Check(slepcconf,slepcvars,cmake,tmpdir,feastdir,feastlibs)$/;" v feastlibs config/configure.py /^feastlibs = []$/;" v find_executable setup.py /^from distutils.spawn import find_executable$/;" i fix src/eps/impls/davidson/common/davidson.c /^ PetscReal fix; \/* the fix parameter *\/$/;" m struct:__anon1 file: fix src/eps/impls/davidson/common/dvd_improvex.c /^ fix; \/* tolerance for using the approx. eigenvalue *\/$/;" m struct:__anon11 file: free_scalars src/eps/impls/davidson/common/davidson.h /^ *free_scalars; \/* free scalars *\/$/;" m struct:__anon6 free_vecs src/eps/impls/davidson/common/davidson.h /^ Vec *free_vecs; \/* free global vectors *\/$/;" m struct:__anon6 friends include/slepc-private/vecimplslepc.h /^ PetscInt friends; \/* number of vectors sharing this structure *\/$/;" m struct:__anon2 friends src/eps/impls/davidson/common/dvd_improvex.c /^ friends, \/* reference vector for composite vectors *\/$/;" m struct:__anon11 file: funcV0_t src/eps/impls/davidson/common/dvd_improvex.c /^typedef PetscInt (*funcV0_t)(dvdDashboard*,PetscInt,PetscInt,Vec*);$/;" t file: funcV1_t src/eps/impls/davidson/common/dvd_improvex.c /^typedef PetscInt (*funcV1_t)(dvdDashboard*,PetscInt,PetscInt,Vec*,PetscScalar*,Vec);$/;" t file: function include/slepc-private/mfnimpl.h /^ SlepcFunction function; \/* which function to compute *\/$/;" m struct:_p_MFN function include/slepc-private/nepimpl.h /^ Mat function,function_pre;$/;" m struct:_p_NEP function_pre include/slepc-private/nepimpl.h /^ Mat function,function_pre;$/;" m struct:_p_NEP functionctx include/slepc-private/nepimpl.h /^ void *functionctx;$/;" m struct:_p_NEP funmethod include/slepc-private/dsimpl.h /^ PetscInt funmethod; \/* to choose among methods for function evaluation *\/$/;" m struct:_p_DS g config/blopex.py /^ g = open(os.path.join(destDir,'Makefile.inc'),'w')$/;" v generatefortranstubs config/configure.py /^ import generatefortranstubs$/;" i get_petsc_arch setup.py /^def get_petsc_arch():$/;" f get_petsc_dir setup.py /^def get_petsc_dir():$/;" f get_platform setup.py /^from distutils.util import get_platform$/;" i getbilinearform include/slepc-private/stimpl.h /^ PetscErrorCode (*getbilinearform)(ST,Mat*);$/;" m struct:_STOps getblopex config/configure.py /^ getblopex = not i.endswith('=0')$/;" v getblopex config/configure.py /^getblopex = 0$/;" v globaleps src/eps/impls/external/trlan/trlan.c /^static EPS globaleps;$/;" v file: h src/nep/examples/tutorials/ex20.c /^ PetscReal h; \/* mesh spacing *\/$/;" m struct:__anon1 file: h src/nep/examples/tutorials/ex21.c /^ PetscReal h; \/* mesh spacing *\/$/;" m struct:__anon3 file: h src/nep/examples/tutorials/ex21.c /^ PetscReal h;$/;" m struct:__anon2 file: hasEnd src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscBool hasEnd; \/* Tells whether the interval has an end *\/$/;" m struct:_n_SR havearpack config/configure.py /^ havearpack = 1$/;" v havearpack config/configure.py /^ havearpack = not i.endswith('=0')$/;" v havearpack config/configure.py /^havearpack = 0$/;" v haveblopex config/configure.py /^ haveblopex = 1$/;" v haveblopex config/configure.py /^haveblopex = 0$/;" v haveblzpack config/configure.py /^ haveblzpack = 1$/;" v haveblzpack config/configure.py /^ haveblzpack = not i.endswith('=0')$/;" v haveblzpack config/configure.py /^haveblzpack = 0$/;" v havefeast config/configure.py /^ havefeast = 1$/;" v havefeast config/configure.py /^ havefeast = not i.endswith('=0')$/;" v havefeast config/configure.py /^havefeast = 0$/;" v haveprimme config/configure.py /^ haveprimme = 1$/;" v haveprimme config/configure.py /^ haveprimme = not i.endswith('=0')$/;" v haveprimme config/configure.py /^haveprimme = 0$/;" v havetrlan config/configure.py /^ havetrlan = 1$/;" v havetrlan config/configure.py /^ havetrlan = not i.endswith('=0')$/;" v havetrlan config/configure.py /^havetrlan = 0$/;" v help src/ds/examples/tests/test1.c /^static char help[] = "Test DSNHEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test10.c /^static char help[] = "Test matrix exponential in DSHEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test11.c /^static char help[] = "Test matrix exponential in DSNHEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test12.c /^static char help[] = "Test DSNEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test2.c /^static char help[] = "Test DSHEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test3.c /^static char help[] = "Test DSHEP with compact storage.\\n\\n";$/;" v file: help src/ds/examples/tests/test4.c /^static char help[] = "Test DSGNHEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test5.c /^static char help[] = "Test DSGHIEP.\\n\\n";$/;" v file: help src/ds/examples/tests/test6.c /^static char help[] = "Test DSGHIEP with compact storage.\\n\\n";$/;" v file: help src/ds/examples/tests/test7.c /^static char help[] = "Test DSSVD.\\n\\n";$/;" v file: help src/ds/examples/tests/test8.c /^static char help[] = "Test DSSVD with compact storage.\\n\\n";$/;" v file: help src/ds/examples/tests/test9.c /^static char help[] = "Test DSGHEP.\\n\\n";$/;" v file: help src/eps/examples/tests/test1.c /^static char help[] = "Tests B-orthonormality of eigenvectors in a GHEP problem.\\n\\n";$/;" v file: help src/eps/examples/tests/test10.c /^static char help[] = "Computes the smallest nonzero eigenvalue of the Laplacian of a graph.\\n\\n"$/;" v file: help src/eps/examples/tests/test11.c /^static char help[] = "Solves the same problem as in ex5, but with a user-defined sorting criterion."$/;" v file: help src/eps/examples/tests/test12.c /^static char help[] = "Diagonal eigenproblem. Illustrates use of shell preconditioner.\\n\\n"$/;" v file: help src/eps/examples/tests/test13.c /^static char help[] = "Test EPSSetArbitrarySelection.\\n\\n";$/;" v file: help src/eps/examples/tests/test14.c /^static char help[] = "Test EPS interface functions.\\n\\n";$/;" v file: help src/eps/examples/tests/test2.c /^static char help[] = "Tests multiple calls to EPSSolve with the same matrix.\\n\\n";$/;" v file: help src/eps/examples/tests/test3.c /^static char help[] = "Tests multiple calls to EPSSolve with different matrix.\\n\\n";$/;" v file: help src/eps/examples/tests/test4.c /^static char help[] = "Test the solution of a HEP without calling EPSSetFromOptions (based on ex1.c).\\n\\n"$/;" v file: help src/eps/examples/tests/test5.c /^static char help[] = "Test EPS with different builds with a matrix loaded from a file.\\n"$/;" v file: help src/eps/examples/tests/test6.c /^static char help[] = "Diagonal eigenproblem.\\n\\n"$/;" v file: help src/eps/examples/tests/test8.c /^static char help[] = "Solves the same eigenproblem as in example ex2, but using a shell matrix. "$/;" v file: help src/eps/examples/tests/test9.c /^static char help[] = "Eigenvalue problem associated with a Markov model of a random walk on a triangular grid. "$/;" v file: help src/eps/examples/tutorials/ex1.c /^static char help[] = "Standard symmetric eigenproblem corresponding to the Laplacian operator in 1 dimension.\\n\\n"$/;" v file: help src/eps/examples/tutorials/ex11.c /^static char help[] = "Computes the smallest nonzero eigenvalue of the Laplacian of a graph.\\n\\n"$/;" v file: help src/eps/examples/tutorials/ex12.c /^static char help[] = "Solves the same eigenproblem as in example ex5, but computing also left eigenvectors. "$/;" v file: help src/eps/examples/tutorials/ex13.c /^static char help[] = "Generalized Symmetric eigenproblem.\\n\\n"$/;" v file: help src/eps/examples/tutorials/ex18.c /^static char help[] = "Solves the same problem as in ex5, but with a user-defined sorting criterion."$/;" v file: help src/eps/examples/tutorials/ex19.c /^static char help[] = "Standard symmetric eigenproblem for the 3-D Laplacian built with the DM interface.\\n\\n"$/;" v file: help src/eps/examples/tutorials/ex2.c /^static char help[] = "Standard symmetric eigenproblem corresponding to the Laplacian operator in 2 dimensions.\\n\\n"$/;" v file: help src/eps/examples/tutorials/ex3.c /^static char help[] = "Solves the same eigenproblem as in example ex2, but using a shell matrix. "$/;" v file: help src/eps/examples/tutorials/ex4.c /^static char help[] = "Solves a standard eigensystem Ax=kx with the matrix loaded from a file.\\n"$/;" v file: help src/eps/examples/tutorials/ex5.c /^static char help[] = "Eigenvalue problem associated with a Markov model of a random walk on a triangular grid. "$/;" v file: help src/eps/examples/tutorials/ex7.c /^static char help[] = "Solves a generalized eigensystem Ax=kBx with matrices loaded from a file.\\n"$/;" v file: help src/eps/examples/tutorials/ex9.c /^static char help[] = "Solves a problem associated to the Brusselator wave model in chemical reactions, illustrating the use of shell matrices.\\n\\n"$/;" v file: help src/fn/examples/tests/test1.c /^static char help[] = "Test rational function.\\n\\n";$/;" v file: help src/fn/examples/tests/test2.c /^static char help[] = "Test exponential function.\\n\\n";$/;" v file: help src/ip/examples/tests/test1.c /^static char help[] = "Test IPQRDecomposition.\\n\\n";$/;" v file: help src/ip/examples/tests/test2.c /^static char help[] = "Test SlepcUpdateVectors.\\n\\n";$/;" v file: help src/ip/examples/tests/test3.c /^static char help[] = "Test indefinite IP.\\n\\n";$/;" v file: help src/ip/examples/tests/test4.c /^static char help[] = "Test IPPseudoOrthogonalize.\\n\\n";$/;" v file: help src/mfn/examples/tutorials/ex23.c /^static char help[] = "Computes exp(A)*v for a matrix associated with a Markov model.\\n\\n"$/;" v file: help src/nep/examples/tutorials/ex20.c /^static char help[] = "Simple 1-D nonlinear eigenproblem.\\n\\n"$/;" v file: help src/nep/examples/tutorials/ex21.c /^static char help[] = "Simple 1-D nonlinear eigenproblem (matrix-free version, sequential).\\n\\n"$/;" v file: help src/nep/examples/tutorials/ex22.c /^static char help[] = "Delay differential equation.\\n\\n"$/;" v file: help src/qep/examples/tests/test1.c /^static char help[] = "Test the solution of a QEP without calling QEPSetFromOptions (based on ex16.c).\\n\\n"$/;" v file: help src/qep/examples/tests/test2.c /^static char help[] = "Test the solution of a QEP from a finite element model of "$/;" v file: help src/qep/examples/tutorials/ex16.c /^static char help[] = "Quadratic eigenproblem for testing the QEP object.\\n\\n"$/;" v file: help src/qep/examples/tutorials/ex17.c /^static char help[] = "Solves a quadratic eigenproblem (l^2*M + l*C + K)*x = 0 with matrices loaded from a file.\\n\\n"$/;" v file: help src/st/examples/tests/test1.c /^static char help[] = "Test ST with shell matrices as problem matrices.\\n\\n";$/;" v file: help src/st/examples/tests/test2.c /^static char help[] = "Test ST with one matrix.\\n\\n";$/;" v file: help src/st/examples/tests/test3.c /^static char help[] = "Test ST with two matrices.\\n\\n";$/;" v file: help src/st/examples/tutorials/ex10.c /^static char help[] = "Illustrates the use of shell spectral transformations. "$/;" v file: help src/svd/examples/tests/test1.c /^static char help[] = "Test the solution of a SVD without calling SVDSetFromOptions (based on ex8.c).\\n\\n"$/;" v file: help src/svd/examples/tests/test2.c /^static char help[] = "Test SVD with different builds with a matrix loaded from a file"$/;" v file: help src/svd/examples/tests/test3.c /^static char help[] = "Test SVD with user-provided initial vectors.\\n\\n"$/;" v file: help src/svd/examples/tutorials/ex14.c /^static char help[] = "Solves a singular value problem with the matrix loaded from a file.\\n"$/;" v file: help src/svd/examples/tutorials/ex15.c /^static char help[] = "Singular value decomposition of the Lauchli matrix.\\n"$/;" v file: help src/svd/examples/tutorials/ex8.c /^static char help[] = "Estimates the 2-norm condition number of a matrix A, that is, the ratio of the largest to the smallest singular values of A. "$/;" v file: i0 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 i1 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 i2 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 iXKZ src/eps/impls/davidson/common/dvd_improvex.c /^ *iXKZ; \/* inverse of XKZ *\/$/;" m struct:__anon11 file: iXKZPivots src/eps/impls/davidson/common/dvd_improvex.c /^ *iXKZPivots; \/* array of pivots *\/$/;" m struct:__anon11 file: idx src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscInt idx[2];$/;" m struct:HRtr file: idxDef src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt *idxDef; \/* For deflation *\/$/;" m struct:_n_SR ii src/eps/impls/external/blopex/blopex.c /^ mv_InterfaceInterpreter ii;$/;" m struct:__anon1 file: imag src/eps/impls/external/blopex/petsc-interface.c /^ double real,imag;$/;" m struct:__anon2 file: improveX src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*improveX)(struct _dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);$/;" m struct:_dvdDashboard improveX_data src/eps/impls/davidson/common/davidson.h /^ void *improveX_data;$/;" m struct:_dvdDashboard improveX_type src/eps/impls/davidson/common/davidson.h /^typedef PetscErrorCode (*improveX_type)(dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);$/;" t improvex_jd_lit src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*improvex_jd_lit)(struct _dvdDashboard*,PetscInt i,PetscScalar* theta,PetscScalar* thetai,PetscInt *maxits,PetscReal *tol);$/;" m struct:_dvdDashboard improvex_jd_proj_uv src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*improvex_jd_proj_uv)(struct _dvdDashboard*,PetscInt i_s,PetscInt i_e,Vec *u,Vec *v,Vec *kr,Vec *auxV,PetscScalar *theta,PetscScalar *thetai,PetscScalar *pX,PetscScalar *pY,PetscInt ld);$/;" m struct:_dvdDashboard improvex_precond src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*improvex_precond)(struct _dvdDashboard*,PetscInt i,Vec x,Vec Px);$/;" m struct:_dvdDashboard improvex_precond_data src/eps/impls/davidson/common/davidson.h /^ void *improvex_precond_data;$/;" m struct:_dvdDashboard in src/eps/impls/davidson/common/davidson.h /^ *in, \/* vector to sum-up with more nodes *\/$/;" m struct:__anon8 incDir config/blopex.py /^ incDir = os.sep.join([archdir,'include'])$/;" v incdir config/configure.py /^incdir = os.sep.join([archdir,'include'])$/;" v index src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt index; \/* Index in eig where found values are stored *\/$/;" m struct:_n_shift indexEig src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt indexEig;$/;" m struct:_n_SR inertia src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt inertia;$/;" m struct:_n_shift inertia0 src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt inertia0,inertia1;$/;" m struct:_n_SR inertia1 src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt inertia0,inertia1;$/;" m struct:_n_SR initV src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*initV)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard initV_data src/eps/impls/davidson/common/davidson.h /^ void *initV_data;$/;" m struct:_dvdDashboard initialize_options setup.py /^ def initialize_options(self):$/;" m class:cmd_build initialize_options setup.py /^ def initialize_options(self):$/;" m class:cmd_install initialize_options setup.py /^ def initialize_options(self):$/;" m class:cmd_sdist initialsize src/eps/impls/davidson/common/davidson.c /^ initialsize, \/* initial size of V *\/$/;" m struct:__anon1 file: innerproductbegin include/slepc-private/ipimpl.h /^ PetscErrorCode (*innerproductbegin)(IP,Vec,Vec,PetscScalar*);$/;" m struct:_IPOps innerproductend include/slepc-private/ipimpl.h /^ PetscErrorCode (*innerproductend)(IP,Vec,Vec,PetscScalar*);$/;" m struct:_IPOps innerproducts include/slepc-private/ipimpl.h /^ PetscInt innerproducts;$/;" m struct:_p_IP install setup.py /^def install(dest_dir, prefix=None, dry_run=False):$/;" f int0 src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal int0,int1; \/* Extremes of the interval *\/$/;" m struct:_n_SR int1 src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal int0,int1; \/* Extremes of the interval *\/$/;" m struct:_n_SR inta include/slepc-private/epsimpl.h /^ PetscReal inta,intb; \/* interval [a,b] for spectrum slicing *\/$/;" m struct:_p_EPS intb include/slepc-private/epsimpl.h /^ PetscReal inta,intb; \/* interval [a,b] for spectrum slicing *\/$/;" m struct:_p_EPS ip include/slepc-private/epsimpl.h /^ IP ip; \/* innerproduct object *\/$/;" m struct:_p_EPS ip include/slepc-private/mfnimpl.h /^ IP ip; \/* innerproduct object *\/$/;" m struct:_p_MFN ip include/slepc-private/nepimpl.h /^ IP ip; \/* innerproduct object *\/$/;" m struct:_p_NEP ip include/slepc-private/qepimpl.h /^ IP ip; \/* innerproduct object *\/$/;" m struct:_p_QEP ip include/slepc-private/svdimpl.h /^ IP ip; \/* innerproduct object *\/$/;" m struct:_p_SVD ipB src/eps/impls/davidson/common/davidson.c /^ EPSOrthType ipB; \/* true if B-ortho is used *\/$/;" m struct:__anon1 file: ipI src/eps/impls/davidson/common/davidson.h /^ IP ipI;$/;" m struct:_dvdDashboard ipV src/eps/impls/davidson/common/davidson.h /^ IP ipV, \/* orthogonal routine options for V subspace *\/$/;" m struct:_dvdDashboard ipW src/eps/impls/davidson/common/davidson.h /^ ipW; \/* orthogonal routine options for W subspace *\/$/;" m struct:_dvdDashboard ipappendoptionsprefix_ src/ip/ftn-custom/zipf.c /^#define ipappendoptionsprefix_ /;" d file: ipappendoptionsprefix_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipappendoptionsprefix_(IP *ip,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f ipcreate_ src/ip/ftn-custom/zipf.c /^#define ipcreate_ /;" d file: ipcreate_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipcreate_(MPI_Fint *comm,IP *newip,PetscErrorCode *ierr)$/;" f ipdestroy_ src/ip/ftn-custom/zipf.c /^#define ipdestroy_ /;" d file: ipdestroy_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipdestroy_(IP *ip,PetscErrorCode *ierr)$/;" f ipgetmatrix_ src/ip/ftn-custom/zipf.c /^#define ipgetmatrix_ /;" d file: ipgetmatrix_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipgetmatrix_(IP *ip,Mat *mat,PetscErrorCode *ierr)$/;" f ipgetoptionsprefix_ src/ip/ftn-custom/zipf.c /^#define ipgetoptionsprefix_ /;" d file: ipgetoptionsprefix_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipgetoptionsprefix_(IP *ip,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f ipgetorthogonalization_ src/ip/ftn-custom/zipf.c /^#define ipgetorthogonalization_ /;" d file: ipgetorthogonalization_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipgetorthogonalization_(IP *ip,IPOrthogType *type,IPOrthogRefineType *refinement,PetscReal *eta,PetscErrorCode *ierr)$/;" f ipsetoptionsprefix_ src/ip/ftn-custom/zipf.c /^#define ipsetoptionsprefix_ /;" d file: ipsetoptionsprefix_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipsetoptionsprefix_(IP *ip,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f ipview_ src/ip/ftn-custom/zipf.c /^#define ipview_ /;" d file: ipview_ src/ip/ftn-custom/zipf.c /^PETSC_EXTERN void PETSC_STDCALL ipview_(IP *ip,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f isInsideGamma src/eps/impls/ciss/ciss.c /^static PetscErrorCode isInsideGamma(EPS eps,PetscInt nv,PetscBool *fl)$/;" f file: isRestarting src/eps/impls/davidson/common/davidson.h /^ PetscBool (*isRestarting)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard isRestarting_data src/eps/impls/davidson/common/davidson.h /^ void *isRestarting_data;$/;" m struct:_dvdDashboard isRestarting_type src/eps/impls/davidson/common/davidson.h /^typedef PetscBool (*isRestarting_type)(dvdDashboard*);$/;" t isdir setup.py /^ from os.path import join, isdir, abspath$/;" i isgeneralized include/slepc-private/epsimpl.h /^ PetscBool isgeneralized;$/;" m struct:_p_EPS ishermitian include/slepc-private/epsimpl.h /^ PetscBool ishermitian;$/;" m struct:_p_EPS ispositive include/slepc-private/epsimpl.h /^ PetscBool ispositive;$/;" m struct:_p_EPS isreal src/eps/impls/ciss/ciss.c /^ PetscBool isreal; \/* A and B are real *\/$/;" m struct:__anon1 file: isrepo config/configure.py /^ isrepo = 1$/;" v isrepo config/configure.py /^isrepo = 0$/;" v istor src/eps/impls/external/blzpack/blzpackp.h /^ PetscBLASInt *istor;$/;" m struct:__anon1 iterCompl src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt iterCompl;$/;" m struct:_n_SR its include/slepc-private/epsimpl.h /^ PetscInt its; \/* number of iterations so far computed *\/$/;" m struct:_p_EPS its include/slepc-private/mfnimpl.h /^ PetscInt its; \/* number of iterations so far computed *\/$/;" m struct:_p_MFN its include/slepc-private/nepimpl.h /^ PetscInt its; \/* number of iterations so far computed *\/$/;" m struct:_p_NEP its include/slepc-private/qepimpl.h /^ PetscInt its; \/* number of iterations so far computed *\/$/;" m struct:_p_QEP its include/slepc-private/svdimpl.h /^ PetscInt its; \/* iteration counter *\/$/;" m struct:_p_SVD itsKs src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt itsKs; \/* Krylovschur restarts *\/$/;" m struct:_n_SR iwork include/slepc-private/dsimpl.h /^ PetscBLASInt *iwork;$/;" m struct:_p_DS jacobian include/slepc-private/nepimpl.h /^ Mat jacobian;$/;" m struct:_p_NEP jacobianctx include/slepc-private/nepimpl.h /^ void *jacobianctx;$/;" m struct:_p_NEP join setup.py /^ from os.path import join, isdir, abspath$/;" i k include/slepc-private/dsimpl.h /^ PetscInt k; \/* intermediate dimension (e.g. position of arrow) *\/$/;" m struct:_p_DS k src/eps/impls/davidson/common/dvd_initv.c /^ PetscInt k, \/* desired initial subspace size *\/$/;" m struct:__anon12 file: kappa src/nep/examples/tutorials/ex20.c /^ PetscScalar kappa; \/* ratio between stiffness of spring and attached mass *\/$/;" m struct:__anon1 file: kappa src/nep/examples/tutorials/ex21.c /^ PetscScalar kappa; \/* ratio between stiffness of spring and attached mass *\/$/;" m struct:__anon3 file: kappa src/nep/examples/tutorials/ex21.c /^ PetscScalar lambda,kappa;$/;" m struct:__anon2 file: keep src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal keep;$/;" m struct:__anon1 keywords setup.py /^ keywords = ['SLEPc','PETSc', 'MPI'],$/;" v komplex src/eps/impls/external/blopex/petsc-interface.c /^} komplex;$/;" t typeref:struct:__anon2 file: krylovstart src/eps/impls/davidson/common/davidson.c /^ PetscBool krylovstart; \/* true if the starting subspace is a Krylov basis *\/$/;" m struct:__anon1 file: ksp include/slepc-private/nepimpl.h /^ KSP ksp; \/* linear solver object *\/$/;" m struct:_p_NEP ksp include/slepc-private/stimpl.h /^ KSP ksp;$/;" m struct:_p_ST ksp src/eps/impls/ciss/ciss.c /^ KSP *ksp;$/;" m struct:__anon1 file: ksp src/eps/impls/davidson/common/dvd_improvex.c /^ KSP ksp; \/* correction equation solver *\/$/;" m struct:__anon11 file: ksp src/eps/impls/external/primme/primme.c /^ KSP ksp; \/* linear solver and preconditioner *\/$/;" m struct:__anon1 file: ksp src/st/examples/tutorials/ex10.c /^ KSP ksp;$/;" m struct:__anon1 file: ksp_max_size src/eps/impls/davidson/common/dvd_improvex.c /^ ksp_max_size; \/* the ksp maximum subvectors size *\/$/;" m struct:__anon11 file: kspidx include/slepc-private/stimpl.h /^ PetscInt kspidx; \/* which T matrix is associated to ksp *\/$/;" m struct:_p_ST ktol include/slepc-private/nepimpl.h /^ PetscReal ktol; \/* tolerance for linear solver *\/$/;" m struct:_p_NEP l include/slepc-private/dsimpl.h /^ PetscInt l; \/* number of locked (inactive) leading columns *\/$/;" m struct:_p_DS lN include/slepc-private/vecimplslepc.h /^ PetscInt lN; \/* virtual local size *\/$/;" m struct:__anon2 lag include/slepc-private/nepimpl.h /^ PetscInt lag; \/* interval to rebuild preconditioner *\/$/;" m struct:_p_NEP lambda src/nep/examples/tutorials/ex21.c /^ PetscScalar lambda,kappa;$/;" m struct:__anon2 file: lapack config/configure.py /^import lapack$/;" i lastTol src/eps/impls/davidson/common/dvd_improvex.c /^ lastTol, \/* last tol for dynamic stopping criterion *\/$/;" m struct:__anon11 file: ld include/slepc-private/dsimpl.h /^ PetscInt ld; \/* leading dimension *\/$/;" m struct:_p_DS ld src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 ldH src/eps/impls/davidson/common/davidson.h /^ PetscInt ldH, \/* leading dimension of H *\/$/;" m struct:_dvdDashboard ldS src/eps/impls/davidson/common/davidson.h /^ ldS, \/* leading dimension of S *\/$/;" m struct:_dvdDashboard ldT src/eps/impls/davidson/common/davidson.h /^ ldT, \/* leading dimension of T *\/$/;" m struct:_dvdDashboard ldXKZ src/eps/impls/davidson/common/dvd_improvex.c /^ ldXKZ, \/* leading dimension of XKZ *\/$/;" m struct:__anon11 file: ldcS src/eps/impls/davidson/common/davidson.h /^ ldcS, \/* leading dimension of cS *\/$/;" m struct:_dvdDashboard ldcT src/eps/impls/davidson/common/davidson.h /^ ldcT, \/* leading dimension of cT *\/$/;" m struct:_dvdDashboard ldiXKZ src/eps/impls/davidson/common/dvd_improvex.c /^ ldiXKZ, \/* leading dimension of iXKZ *\/$/;" m struct:__anon11 file: ldoldU src/eps/impls/davidson/common/dvd_updatev.c /^ ldoldU, \/* leading dimension of oldU *\/$/;" m struct:__anon13 file: leftvecs include/slepc-private/epsimpl.h /^ PetscBool leftvecs; \/* if left eigenvectors are requested *\/$/;" m struct:_p_EPS leftvecs include/slepc-private/qepimpl.h /^ PetscBool leftvecs; \/* if left eigenvectors are requested *\/$/;" m struct:_p_QEP libDir config/blopex.py /^ libDir = os.sep.join([archdir,'lib'])$/;" v libdir config/configure.py /^libdir = os.sep.join([archdir,'lib'])$/;" v license setup.py /^ license='LGPL',$/;" v lineariterations include/slepc-private/stimpl.h /^ PetscInt lineariterations;$/;" m struct:_p_ST linits include/slepc-private/nepimpl.h /^ PetscInt nfuncs,linits; \/* operation counters *\/$/;" m struct:_p_NEP linits include/slepc-private/qepimpl.h /^ PetscInt matvecs,linits; \/* operation counters *\/$/;" m struct:_p_QEP liwork include/slepc-private/dsimpl.h /^ PetscInt lwork,lrwork,liwork;$/;" m struct:_p_DS log config/arpack.py /^import log$/;" i log config/blopex.py /^import log$/;" i log config/blzpack.py /^import log$/;" i log config/check.py /^import log$/;" i log config/configure.py /^import log$/;" i log config/feast.py /^import log$/;" i log config/lapack.py /^import log$/;" i log config/primme.py /^import log$/;" i log config/trlan.py /^import log$/;" i log setup.py /^from distutils import log$/;" i long_description setup.py /^ long_description='\\n'.join(description),$/;" v lrwork include/slepc-private/dsimpl.h /^ PetscInt lwork,lrwork,liwork;$/;" m struct:_p_DS lwork include/slepc-private/dsimpl.h /^ PetscInt lwork,lrwork,liwork;$/;" m struct:_p_DS lwork include/slepc-private/ipimpl.h /^ PetscInt lwork;$/;" m struct:_p_IP lwork src/eps/impls/external/trlan/trlanp.h /^ PetscBLASInt lwork;$/;" m struct:__anon1 lworkl src/eps/impls/external/arpack/arpackp.h /^ PetscBLASInt lworkl;$/;" m struct:__anon1 m include/slepc-private/dsimpl.h /^ PetscInt m; \/* current column dimension (for SVD only) *\/$/;" m struct:_p_DS m src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscInt m;$/;" m struct:HRtr file: main config/cmakeboot.py /^def main(slepcdir, petscdir, petscarch, argDB=None, framework=None, log=StdoutLogger(), args=[]):$/;" f main config/cmakegen.py /^def main(slepcdir,petscdir,petscarch,log=StdoutLogger()):$/;" f main config/generatefortranstubs.py /^def main(petscdir,bfort,dir,verbose):$/;" f main src/ds/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test10.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test11.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test12.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test3.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test4.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test5.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test6.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test7.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test8.c /^int main(int argc,char **argv)$/;" f main src/ds/examples/tests/test9.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test10.c /^int main (int argc,char **argv)$/;" f main src/eps/examples/tests/test11.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test12.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test13.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test14.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test14f.F /^ program main$/;" p main src/eps/examples/tests/test15f.F /^ program main$/;" p main src/eps/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test3.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test4.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test5.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test6.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test7f.F /^ program main$/;" p main src/eps/examples/tests/test8.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tests/test9.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex1.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex11.c /^int main (int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex12.c /^int main (int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex13.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex18.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex19.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex1f.F /^ program main$/;" p main src/eps/examples/tutorials/ex1f90.F90 /^ program main$/;" p main src/eps/examples/tutorials/ex2.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex3.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex4.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex5.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex6f.F /^ program main$/;" p main src/eps/examples/tutorials/ex7.c /^int main(int argc,char **argv)$/;" f main src/eps/examples/tutorials/ex9.c /^int main(int argc,char **argv)$/;" f main src/fn/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/fn/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/ip/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/ip/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/ip/examples/tests/test3.c /^int main(int argc,char **argv)$/;" f main src/ip/examples/tests/test4.c /^int main(int argc,char **argv)$/;" f main src/mfn/examples/tutorials/ex23.c /^int main(int argc,char **argv)$/;" f main src/nep/examples/tutorials/ex20.c /^int main(int argc,char **argv)$/;" f main src/nep/examples/tutorials/ex21.c /^int main(int argc,char **argv)$/;" f main src/nep/examples/tutorials/ex22.c /^int main(int argc,char **argv)$/;" f main src/qep/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/qep/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/qep/examples/tutorials/ex16.c /^int main(int argc,char **argv)$/;" f main src/qep/examples/tutorials/ex16f90.F90 /^ program main$/;" p main src/qep/examples/tutorials/ex17.c /^int main(int argc,char **argv)$/;" f main src/st/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/st/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/st/examples/tests/test3.c /^int main(int argc,char **argv)$/;" f main src/st/examples/tutorials/ex10.c /^int main (int argc,char **argv)$/;" f main src/svd/examples/tests/test1.c /^int main(int argc,char **argv)$/;" f main src/svd/examples/tests/test2.c /^int main(int argc,char **argv)$/;" f main src/svd/examples/tests/test3.c /^int main(int argc,char **argv)$/;" f main src/svd/examples/tutorials/ex14.c /^int main(int argc,char **argv)$/;" f main src/svd/examples/tutorials/ex15.c /^int main(int argc,char **argv)$/;" f main src/svd/examples/tutorials/ex15f.F /^ program main$/;" p main src/svd/examples/tutorials/ex8.c /^int main(int argc,char **argv)$/;" f maintainer setup.py /^ maintainer='Lisandro Dalcin',$/;" v maintainer_email setup.py /^ maintainer_email='dalcinl@gmail.com',$/;" v makefile config/configure.py /^ makefile = open(os.sep.join([tmpdir,'makefile']),'w')$/;" v mat include/slepc-private/dsimpl.h /^ PetscScalar *mat[DS_NUM_MAT]; \/* the matrices *\/$/;" m struct:_p_DS mat src/svd/impls/cross/cross.c /^ Mat mat;$/;" m struct:__anon1 file: mat src/svd/impls/cyclic/cyclic.c /^ Mat mat;$/;" m struct:__anon1 file: matIdx src/st/interface/shellmat.c /^ PetscInt *matIdx;$/;" m struct:__anon1 file: matrix include/slepc-private/ipimpl.h /^ Mat matrix;$/;" m struct:_p_IP matvecs include/slepc-private/qepimpl.h /^ PetscInt matvecs,linits; \/* operation counters *\/$/;" m struct:_p_QEP matvecs include/slepc-private/svdimpl.h /^ PetscInt matvecs;$/;" m struct:_p_SVD maxPend src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt maxPend; \/* Size of "pending" array *\/$/;" m struct:_n_SR max_cX_in_impr src/eps/impls/davidson/common/davidson.h /^ max_cX_in_impr, \/* max vectros from cX in the projector *\/$/;" m struct:_dvdDashboard max_cX_in_proj src/eps/impls/davidson/common/davidson.h /^ max_cX_in_proj, \/* max vectors from cX in the projected problem *\/$/;" m struct:_dvdDashboard max_funcs include/slepc-private/nepimpl.h /^ PetscInt max_funcs; \/* maximum number of function evaluations *\/$/;" m struct:_p_NEP max_it include/slepc-private/epsimpl.h /^ PetscInt max_it; \/* maximum number of iterations *\/$/;" m struct:_p_EPS max_it include/slepc-private/mfnimpl.h /^ PetscInt max_it; \/* maximum number of iterations *\/$/;" m struct:_p_MFN max_it include/slepc-private/nepimpl.h /^ PetscInt max_it; \/* maximum number of iterations *\/$/;" m struct:_p_NEP max_it include/slepc-private/qepimpl.h /^ PetscInt max_it; \/* maximum number of iterations *\/$/;" m struct:_p_QEP max_it include/slepc-private/svdimpl.h /^ PetscInt max_it; \/* max iterations *\/$/;" m struct:_p_SVD max_nev src/eps/impls/davidson/common/davidson.h /^ max_nev, \/* max number of converged pairs *\/$/;" m struct:__anon6 max_size_AV src/eps/impls/davidson/common/davidson.h /^ max_size_AV, \/* max size of AV *\/$/;" m struct:_dvdDashboard max_size_BV src/eps/impls/davidson/common/davidson.h /^ max_size_BV, \/* max size of BV *\/$/;" m struct:_dvdDashboard max_size_P src/eps/impls/davidson/common/davidson.h /^ max_size_P, \/* number of computed vectors for the projector *\/$/;" m struct:__anon6 max_size_P src/eps/impls/davidson/common/davidson.h /^ max_size_P, \/* max unconverged vectors in the projector *\/$/;" m struct:_dvdDashboard max_size_V src/eps/impls/davidson/common/davidson.h /^ max_size_V, \/* max size of V *\/$/;" m struct:_dvdDashboard max_size_V src/eps/impls/davidson/common/davidson.h /^ PetscInt max_size_V, \/* max size of the searching subspace (mpd) *\/$/;" m struct:__anon6 max_size_W src/eps/impls/davidson/common/davidson.h /^ max_size_W, \/* max size of W *\/$/;" m struct:_dvdDashboard max_size_X src/eps/impls/davidson/common/davidson.h /^ max_size_X, \/* max size of X (bs) *\/$/;" m struct:__anon6 max_size_X src/eps/impls/davidson/common/davidson.h /^ max_size_X, \/* max new vectors in V *\/$/;" m struct:_dvdDashboard max_size_auxS src/eps/impls/davidson/common/davidson.h /^ max_size_auxS, \/* max size of auxiliary scalars *\/$/;" m struct:__anon6 max_size_auxV src/eps/impls/davidson/common/davidson.h /^ max_size_auxV, \/* max size of auxiliary vecs *\/$/;" m struct:__anon6 max_size_cP src/eps/impls/davidson/common/davidson.h /^ max_size_cP, \/* number of converged vectors in the projectors *\/$/;" m struct:__anon6 max_size_cS src/eps/impls/davidson/common/davidson.h /^ max_size_cS, \/* max size of cS and cT *\/$/;" m struct:_dvdDashboard max_size_cX_proj src/eps/impls/davidson/common/davidson.h /^ max_size_cX_proj, \/* max converged vectors in the projected problem *\/$/;" m struct:__anon6 max_size_in src/eps/impls/davidson/common/davidson.h /^ max_size_in; \/* max size of in *\/$/;" m struct:__anon8 max_size_oldX src/eps/impls/davidson/common/davidson.h /^ max_size_oldX, \/* max size of oldX *\/$/;" m struct:__anon6 max_size_ops src/eps/impls/davidson/common/davidson.h /^ max_size_ops; \/* max size of ops *\/$/;" m struct:__anon8 max_size_proj src/eps/impls/davidson/common/davidson.h /^ max_size_proj, \/* max size projected problem *\/$/;" m struct:__anon6 max_size_proj src/eps/impls/davidson/common/davidson.h /^ max_size_proj, \/* max size projected problem *\/$/;" m struct:_dvdDashboard maxits src/eps/impls/davidson/common/dvd_improvex.c /^ PetscInt maxits, \/* maximum number of iterations *\/$/;" m struct:__anon11 file: maxlan src/eps/impls/external/trlan/trlanp.h /^ PetscBLASInt maxlan;$/;" m struct:__anon1 metadata setup.py /^metadata = {$/;" v method include/slepc-private/dsimpl.h /^ PetscInt method; \/* identifies the variant to be used *\/$/;" m struct:_p_DS method src/eps/impls/davidson/common/davidson.c /^ PetscInt method; \/* method for improving the approximate solution *\/$/;" m struct:__anon1 file: method src/eps/impls/external/primme/primme.c /^ primme_preset_method method; \/* primme method *\/$/;" m struct:__anon1 file: methodN src/eps/impls/external/primme/primme.c /^EPSPRIMMEMethod methodN[] = {$/;" v mfnappendoptionsprefix_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnappendoptionsprefix_ /;" d file: mfnappendoptionsprefix_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfnappendoptionsprefix_(MFN *mfn,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f mfncreate_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfncreate_ /;" d file: mfncreate_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfncreate_(MPI_Fint *comm,MFN *mfn,PetscErrorCode *ierr)$/;" f mfndestroy_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfndestroy_ /;" d file: mfndestroy_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfndestroy_(MFN *mfn,PetscErrorCode *ierr)$/;" f mfngetconvergedreason_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfngetconvergedreason_ /;" d file: mfngetconvergedreason_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfngetconvergedreason_(MFN *mfn,MFNConvergedReason *reason,PetscErrorCode *ierr)$/;" f mfngetds_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfngetds_ /;" d file: mfngetds_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfngetds_(MFN *mfn,DS *ds,PetscErrorCode *ierr)$/;" f mfngetip_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfngetip_ /;" d file: mfngetip_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfngetip_(MFN *mfn,IP *ip,PetscErrorCode *ierr)$/;" f mfngetoptionsprefix_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfngetoptionsprefix_ /;" d file: mfngetoptionsprefix_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfngetoptionsprefix_(MFN *mfn,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f mfngettype_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfngettype_ /;" d file: mfngettype_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfngettype_(MFN *mfn,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f mfnmonitordefault_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnmonitordefault_ /;" d file: mfnmonitordefault_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void mfnmonitordefault_(MFN *mfn,PetscInt *it,PetscReal *errest,void *ctx,PetscErrorCode *ierr)$/;" f mfnmonitorlg_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnmonitorlg_ /;" d file: mfnmonitorlg_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void mfnmonitorlg_(MFN *mfn,PetscInt *it,PetscReal *errest,void *ctx,PetscErrorCode *ierr)$/;" f mfnmonitorset_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnmonitorset_ /;" d file: mfnmonitorset_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfnmonitorset_(MFN *mfn,void (PETSC_STDCALL *monitor)(MFN*,PetscInt*,PetscReal*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr)$/;" f mfnsetoptionsprefix_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnsetoptionsprefix_ /;" d file: mfnsetoptionsprefix_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfnsetoptionsprefix_(MFN *mfn,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f mfnsettype_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnsettype_ /;" d file: mfnsettype_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfnsettype_(MFN *mfn,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f mfnview_ src/mfn/interface/ftn-custom/zmfnf.c /^#define mfnview_ /;" d file: mfnview_ src/mfn/interface/ftn-custom/zmfnf.c /^PETSC_EXTERN void PETSC_STDCALL mfnview_(MFN *mfn,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f min_size_V src/eps/impls/davidson/common/dvd_updatev.c /^ min_size_V, \/* restart with this number of eigenvectors *\/$/;" m struct:__anon13 file: minnerproductbegin include/slepc-private/ipimpl.h /^ PetscErrorCode (*minnerproductbegin)(IP,Vec,PetscInt,const Vec[],PetscScalar*);$/;" m struct:_IPOps minnerproductend include/slepc-private/ipimpl.h /^ PetscErrorCode (*minnerproductend)(IP,Vec,PetscInt,const Vec[],PetscScalar*);$/;" m struct:_IPOps minv src/eps/impls/davidson/common/davidson.c /^ minv, \/* size of V after restarting *\/$/;" m struct:__anon1 file: missing config/configure.py /^missing = lapack.Check(slepcconf,slepcvars,cmake,tmpdir)$/;" v mkpath setup.py /^ from distutils.dir_util import mkpath$/;" i mkpath setup.py /^ from distutils.dir_util import mkpath$/;" i mode src/eps/impls/davidson/common/dvd_utils.c /^ mode;$/;" m struct:__anon17 file: modules config/configure.py /^ modules = open(os.sep.join([modulesdir,slepcversion.LVERSION+'-'+petscconf.ARCH]),'w')$/;" v modulesdir config/configure.py /^modulesdir = os.sep.join([libdir,'modules'])$/;" v monit src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscScalar *eig,*eigi,*monit,*back;$/;" m struct:_n_SR monitor include/slepc-private/epsimpl.h /^ PetscErrorCode (*monitor[MAXEPSMONITORS])(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);$/;" m struct:_p_EPS monitor include/slepc-private/mfnimpl.h /^ PetscErrorCode (*monitor[MAXMFNMONITORS])(MFN,PetscInt,PetscReal,void*);$/;" m struct:_p_MFN monitor include/slepc-private/nepimpl.h /^ PetscErrorCode (*monitor[MAXNEPMONITORS])(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);$/;" m struct:_p_NEP monitor include/slepc-private/qepimpl.h /^ PetscErrorCode (*monitor[MAXQEPMONITORS])(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);$/;" m struct:_p_QEP monitor include/slepc-private/svdimpl.h /^ PetscErrorCode (*monitor[MAXSVDMONITORS])(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);$/;" m struct:_p_SVD monitor src/eps/interface/ftn-custom/zepsf.c /^ PetscFortranCallbackId monitor;$/;" m struct:__anon1 file: monitor src/mfn/interface/ftn-custom/zmfnf.c /^ PetscFortranCallbackId monitor;$/;" m struct:__anon1 file: monitor src/nep/interface/ftn-custom/znepf.c /^ PetscFortranCallbackId monitor;$/;" m struct:__anon1 file: monitor src/qep/interface/ftn-custom/zqepf.c /^ PetscFortranCallbackId monitor;$/;" m struct:__anon1 file: monitor src/svd/interface/ftn-custom/zsvdf.c /^ PetscFortranCallbackId monitor;$/;" m struct:__anon1 file: monitorcontext include/slepc-private/epsimpl.h /^ void *monitorcontext[MAXEPSMONITORS];$/;" m struct:_p_EPS monitorcontext include/slepc-private/mfnimpl.h /^ void *monitorcontext[MAXMFNMONITORS];$/;" m struct:_p_MFN monitorcontext include/slepc-private/nepimpl.h /^ void *monitorcontext[MAXNEPMONITORS];$/;" m struct:_p_NEP monitorcontext include/slepc-private/qepimpl.h /^ void *monitorcontext[MAXQEPMONITORS];$/;" m struct:_p_QEP monitorcontext include/slepc-private/svdimpl.h /^ void *monitorcontext[MAXSVDMONITORS];$/;" m struct:_p_SVD monitordestroy include/slepc-private/epsimpl.h /^ PetscErrorCode (*monitordestroy[MAXEPSMONITORS])(void**);$/;" m struct:_p_EPS monitordestroy include/slepc-private/mfnimpl.h /^ PetscErrorCode (*monitordestroy[MAXMFNMONITORS])(void**);$/;" m struct:_p_MFN monitordestroy include/slepc-private/nepimpl.h /^ PetscErrorCode (*monitordestroy[MAXNEPMONITORS])(void**);$/;" m struct:_p_NEP monitordestroy include/slepc-private/qepimpl.h /^ PetscErrorCode (*monitordestroy[MAXQEPMONITORS])(void**);$/;" m struct:_p_QEP monitordestroy include/slepc-private/svdimpl.h /^ PetscErrorCode (*monitordestroy[MAXSVDMONITORS])(void**);$/;" m struct:_p_SVD monitordestroy src/eps/interface/ftn-custom/zepsf.c /^ PetscFortranCallbackId monitordestroy;$/;" m struct:__anon1 file: monitordestroy src/mfn/interface/ftn-custom/zmfnf.c /^ PetscFortranCallbackId monitordestroy;$/;" m struct:__anon1 file: monitordestroy src/nep/interface/ftn-custom/znepf.c /^ PetscFortranCallbackId monitordestroy;$/;" m struct:__anon1 file: monitordestroy src/qep/interface/ftn-custom/zqepf.c /^ PetscFortranCallbackId monitordestroy;$/;" m struct:__anon1 file: monitordestroy src/svd/interface/ftn-custom/zsvdf.c /^ PetscFortranCallbackId monitordestroy;$/;" m struct:__anon1 file: mpd include/slepc-private/epsimpl.h /^ PetscInt mpd; \/* maximum dimension of projected problem *\/$/;" m struct:_p_EPS mpd include/slepc-private/nepimpl.h /^ PetscInt mpd; \/* maximum dimension of projected problem *\/$/;" m struct:_p_NEP mpd include/slepc-private/qepimpl.h /^ PetscInt mpd; \/* maximum dimension of projected problem *\/$/;" m struct:_p_QEP mpd include/slepc-private/svdimpl.h /^ PetscInt mpd; \/* maximum dimension of projected problem *\/$/;" m struct:_p_SVD mpd src/eps/impls/davidson/common/dvd_updatev.c /^ mpd; \/* max size of the searching subspace *\/$/;" m struct:__anon13 file: mstr include/slepc-private/nepimpl.h /^ MatStructure mstr; \/* pattern of split matrices *\/$/;" m struct:_p_NEP multMatvec_PRIMME src/eps/impls/external/primme/primme.c /^static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme)$/;" f file: mv_TempMultiPETSCVectorDestroy src/eps/impls/external/blopex/slepc-interface.c /^static void mv_TempMultiPETSCVectorDestroy(void* x_)$/;" f file: mv_TempMultiVectorCreateFromPETScVector src/eps/impls/external/blopex/slepc-interface.c /^static void* mv_TempMultiVectorCreateFromPETScVector(void* ii_,BlopexInt n,void* sample)$/;" f file: n include/slepc-private/dsimpl.h /^ PetscInt n; \/* current dimension *\/$/;" m struct:_p_DS n include/slepc-private/epsimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_EPS n include/slepc-private/mfnimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_MFN n include/slepc-private/nepimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_NEP n include/slepc-private/qepimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_QEP n include/slepc-private/svdimpl.h /^ PetscInt n; \/* maximun size of descomposition *\/$/;" m struct:_p_SVD n include/slepc-private/vecimplslepc.h /^ PetscInt n; \/* number of active subvectors *\/$/;" m struct:__anon2 n include/slepc-private/vecimplslepc.h /^ Vec_Comp_N *n; \/* structure shared by friend vectors *\/$/;" m struct:__anon3 n src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscInt n[2];$/;" m struct:HRtr file: nBDS src/eps/impls/davidson/common/davidson.h /^ *nBDS, \/* B-norms of DS *\/$/;" m struct:_dvdDashboard nBV src/eps/impls/davidson/common/davidson.h /^ *nBV, \/* B-norms of V *\/$/;" m struct:_dvdDashboard nBcX src/eps/impls/davidson/common/davidson.h /^ *nBcX, \/* B-norms of cX *\/$/;" m struct:_dvdDashboard nBpX src/eps/impls/davidson/common/davidson.h /^ *nBpX, \/* B-norms of pX *\/$/;" m struct:_dvdDashboard nMAXCompl src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt nMAXCompl;$/;" m struct:_n_SR nPend src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt nPend; \/* Number of pending shifts *\/$/;" m struct:_n_SR nR src/eps/impls/davidson/common/davidson.h /^ *nR, \/* residual norm *\/$/;" m struct:_dvdDashboard nS src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt nS;$/;" m struct:_n_SR nX src/eps/impls/davidson/common/davidson.h /^ *nX, \/* X norm *\/$/;" m struct:_dvdDashboard na include/slepc-private/fnimpl.h /^ PetscInt na;$/;" m struct:_p_FN name config/configure.py /^ name = sys.argv[l]$/;" v nb include/slepc-private/fnimpl.h /^ PetscInt nb;$/;" m struct:_p_FN nconv include/slepc-private/epsimpl.h /^ PetscInt nconv; \/* number of converged eigenvalues *\/$/;" m struct:_p_EPS nconv include/slepc-private/nepimpl.h /^ PetscInt nconv; \/* number of converged eigenvalues *\/$/;" m struct:_p_NEP nconv include/slepc-private/qepimpl.h /^ PetscInt nconv; \/* number of converged eigenvalues *\/$/;" m struct:_p_QEP nconv include/slepc-private/svdimpl.h /^ PetscInt nconv; \/* number of converged values *\/$/;" m struct:_p_SVD nconv src/eps/impls/davidson/common/davidson.h /^ PetscInt nconv;$/;" m struct:_dvdDashboard nconv src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt nconv[2]; \/* Converged on each side (accepted or not) *\/$/;" m struct:_n_shift ncv include/slepc-private/epsimpl.h /^ PetscInt ncv; \/* number of basis vectors *\/$/;" m struct:_p_EPS ncv include/slepc-private/mfnimpl.h /^ PetscInt ncv; \/* number of basis vectors *\/$/;" m struct:_p_MFN ncv include/slepc-private/nepimpl.h /^ PetscInt ncv; \/* number of basis vectors *\/$/;" m struct:_p_NEP ncv include/slepc-private/qepimpl.h /^ PetscInt ncv; \/* number of basis vectors *\/$/;" m struct:_p_QEP ncv include/slepc-private/svdimpl.h /^ PetscInt ncv; \/* basis size *\/$/;" m struct:_p_SVD nds include/slepc-private/epsimpl.h /^ PetscInt nds; \/* number of basis vectors of deflation space *\/$/;" m struct:_p_EPS neighb src/eps/impls/krylov/krylovschur/krylovschur.h /^ shift neighb[2]; \/* Adjacent shifts *\/$/;" m struct:_n_shift neigs src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt neigs; \/* Number of values found *\/$/;" m struct:_n_shift nepappendoptionsprefix_ src/nep/interface/ftn-custom/znepf.c /^#define nepappendoptionsprefix_ /;" d file: nepappendoptionsprefix_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepappendoptionsprefix_(NEP *nep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f nepcreate_ src/nep/interface/ftn-custom/znepf.c /^#define nepcreate_ /;" d file: nepcreate_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepcreate_(MPI_Fint *comm,NEP *nep,PetscErrorCode *ierr)$/;" f nepdestroy_ src/nep/interface/ftn-custom/znepf.c /^#define nepdestroy_ /;" d file: nepdestroy_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepdestroy_(NEP *nep,PetscErrorCode *ierr)$/;" f nepgetconvergedreason_ src/nep/interface/ftn-custom/znepf.c /^#define nepgetconvergedreason_ /;" d file: nepgetconvergedreason_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgetconvergedreason_(NEP *nep,NEPConvergedReason *reason,PetscErrorCode *ierr)$/;" f nepgetds_ src/nep/interface/ftn-custom/znepf.c /^#define nepgetds_ /;" d file: nepgetds_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgetds_(NEP *nep,DS *ds,PetscErrorCode *ierr)$/;" f nepgetip_ src/nep/interface/ftn-custom/znepf.c /^#define nepgetip_ /;" d file: nepgetip_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgetip_(NEP *nep,IP *ip,PetscErrorCode *ierr)$/;" f nepgetksp src/nep/interface/ftn-custom/znepf.c /^#define nepgetksp /;" d file: nepgetksp_ src/nep/interface/ftn-custom/znepf.c /^#define nepgetksp_ /;" d file: nepgetksp_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgetksp_(NEP *nep,KSP *ksp,PetscErrorCode *ierr)$/;" f nepgetoptionsprefix_ src/nep/interface/ftn-custom/znepf.c /^#define nepgetoptionsprefix_ /;" d file: nepgetoptionsprefix_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgetoptionsprefix_(NEP *nep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f nepgettype_ src/nep/interface/ftn-custom/znepf.c /^#define nepgettype_ /;" d file: nepgettype_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgettype_(NEP *nep,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f nepgetwhicheigenpairs_ src/nep/interface/ftn-custom/znepf.c /^#define nepgetwhicheigenpairs_ /;" d file: nepgetwhicheigenpairs_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepgetwhicheigenpairs_(NEP *nep,NEPWhich *which,PetscErrorCode *ierr)$/;" f nepmonitorall_ src/nep/interface/ftn-custom/znepf.c /^#define nepmonitorall_ /;" d file: nepmonitorall_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void nepmonitorall_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f nepmonitorconverged_ src/nep/interface/ftn-custom/znepf.c /^#define nepmonitorconverged_ /;" d file: nepmonitorconverged_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void nepmonitorconverged_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f nepmonitorfirst_ src/nep/interface/ftn-custom/znepf.c /^#define nepmonitorfirst_ /;" d file: nepmonitorfirst_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void nepmonitorfirst_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f nepmonitorlg_ src/nep/interface/ftn-custom/znepf.c /^#define nepmonitorlg_ /;" d file: nepmonitorlg_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void nepmonitorlg_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f nepmonitorlgall_ src/nep/interface/ftn-custom/znepf.c /^#define nepmonitorlgall_ /;" d file: nepmonitorlgall_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void nepmonitorlgall_(NEP *nep,PetscInt *it,PetscInt *nconv,PetscScalar *eig,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f nepmonitorset_ src/nep/interface/ftn-custom/znepf.c /^#define nepmonitorset_ /;" d file: nepmonitorset_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepmonitorset_(NEP *nep,void (PETSC_STDCALL *monitor)(NEP*,PetscInt*,PetscInt*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr)$/;" f nepsetoptionsprefix_ src/nep/interface/ftn-custom/znepf.c /^#define nepsetoptionsprefix_ /;" d file: nepsetoptionsprefix_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepsetoptionsprefix_(NEP *nep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f nepsettype_ src/nep/interface/ftn-custom/znepf.c /^#define nepsettype_ /;" d file: nepsettype_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepsettype_(NEP *nep,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f nepview_ src/nep/interface/ftn-custom/znepf.c /^#define nepview_ /;" d file: nepview_ src/nep/interface/ftn-custom/znepf.c /^PETSC_EXTERN void PETSC_STDCALL nepview_(NEP *nep,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f nev include/slepc-private/epsimpl.h /^ PetscInt nev; \/* number of eigenvalues to compute *\/$/;" m struct:_p_EPS nev include/slepc-private/nepimpl.h /^ PetscInt nev; \/* number of eigenvalues to compute *\/$/;" m struct:_p_NEP nev include/slepc-private/qepimpl.h /^ PetscInt nev; \/* number of eigenvalues to compute *\/$/;" m struct:_p_QEP nev src/eps/impls/davidson/common/davidson.h /^ PetscInt nev; \/* number of eigenpairs *\/$/;" m struct:_dvdDashboard next src/eps/impls/davidson/common/davidson.h /^ struct _dvdFunctionList *next;$/;" m struct:_dvdFunctionList typeref:struct:_dvdFunctionList::_dvdFunctionList nf include/slepc-private/dsimpl.h /^ PetscInt nf; \/* number of functions in f[] *\/$/;" m struct:_p_DS nfuncs include/slepc-private/nepimpl.h /^ PetscInt nfuncs,linits; \/* operation counters *\/$/;" m struct:_p_NEP nini include/slepc-private/epsimpl.h /^ PetscInt nini,ninil; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_EPS nini include/slepc-private/nepimpl.h /^ PetscInt nini; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_NEP nini include/slepc-private/qepimpl.h /^ PetscInt nini,ninil; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_QEP nini include/slepc-private/svdimpl.h /^ PetscInt nini,ninil; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_SVD ninil include/slepc-private/epsimpl.h /^ PetscInt nini,ninil; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_EPS ninil include/slepc-private/qepimpl.h /^ PetscInt nini,ninil; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_QEP ninil include/slepc-private/svdimpl.h /^ PetscInt nini,ninil; \/* number of initial vectors (negative means not copied yet) *\/$/;" m struct:_p_SVD nleap src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt nleap;$/;" m struct:_n_SR nloc include/slepc-private/epsimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_EPS nloc include/slepc-private/mfnimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_MFN nloc include/slepc-private/nepimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_NEP nloc include/slepc-private/qepimpl.h /^ PetscInt n,nloc; \/* problem dimensions (global, local) *\/$/;" m struct:_p_QEP nmat include/slepc-private/stimpl.h /^ PetscInt nmat; \/* Number of matrices *\/$/;" m struct:_p_ST nmat src/st/interface/shellmat.c /^ PetscInt nmat;$/;" m struct:__anon1 file: noCheck config/cmakeboot.py /^def noCheck(command, status, output, error):$/;" f normalize include/slepc-private/dsimpl.h /^ PetscErrorCode (*normalize)(DS,DSMatType,PetscInt);$/;" m struct:_DSOps normbegin include/slepc-private/ipimpl.h /^ PetscErrorCode (*normbegin)(IP,Vec,PetscReal*);$/;" m struct:_IPOps normend include/slepc-private/ipimpl.h /^ PetscErrorCode (*normend)(IP,Vec,PetscReal*);$/;" m struct:_IPOps npart src/eps/impls/ciss/ciss.c /^ PetscInt npart; \/* number of partitions of the matrix (1) *\/$/;" m struct:__anon1 file: npoints src/eps/impls/external/feast/feastp.h /^ PetscBLASInt npoints; \/* number of contour points *\/$/;" m struct:__anon1 npreconv src/eps/impls/davidson/common/davidson.h /^ PetscInt npreconv;$/;" m struct:_dvdDashboard nrest src/eps/impls/cg/rqcg/rqcg.c /^ PetscInt nrest;$/;" m struct:__anon1 file: nrma include/slepc-private/epsimpl.h /^ PetscReal nrma,nrmb; \/* matrix norms *\/$/;" m struct:_p_EPS nrmb include/slepc-private/epsimpl.h /^ PetscReal nrma,nrmb; \/* matrix norms *\/$/;" m struct:_p_EPS nsch src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt nsch[2]; \/* Number of missing values for each subinterval *\/$/;" m struct:_n_shift nsteps src/eps/impls/external/blzpack/blzpackp.h /^ PetscBLASInt nsteps; \/* maximum number of steps per run *\/$/;" m struct:__anon1 nsv include/slepc-private/svdimpl.h /^ PetscInt nsv; \/* number of requested values *\/$/;" m struct:_p_SVD nt include/slepc-private/nepimpl.h /^ PetscInt nt; \/* number of terms in split form *\/$/;" m struct:_p_NEP nu src/st/impls/cayley/cayley.c /^ PetscScalar nu;$/;" m struct:__anon1 file: nu_set src/st/impls/cayley/cayley.c /^ PetscBool nu_set;$/;" m struct:__anon1 file: numEigs src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt numEigs; \/* Number of eigenvalues in the interval *\/$/;" m struct:_n_SR num_solve_point src/eps/impls/ciss/ciss.c /^ PetscInt num_solve_point;$/;" m struct:__anon1 file: numbermonitors include/slepc-private/epsimpl.h /^ PetscInt numbermonitors;$/;" m struct:_p_EPS numbermonitors include/slepc-private/mfnimpl.h /^ PetscInt numbermonitors;$/;" m struct:_p_MFN numbermonitors include/slepc-private/nepimpl.h /^ PetscInt numbermonitors;$/;" m struct:_p_NEP numbermonitors include/slepc-private/qepimpl.h /^ PetscInt numbermonitors;$/;" m struct:_p_QEP numbermonitors include/slepc-private/svdimpl.h /^ PetscInt numbermonitors;$/;" m struct:_p_SVD nv include/slepc-private/epsimpl.h /^ PetscInt nv; \/* size of current Schur decomposition *\/$/;" m struct:_p_EPS nv include/slepc-private/mfnimpl.h /^ PetscInt nv; \/* size of current Schur decomposition *\/$/;" m struct:_p_MFN nvecs include/slepc-private/vecimplslepc.h /^ PetscInt nvecs; \/* number of vectors that share this array *\/$/;" m struct:__anon1 nwork include/slepc-private/epsimpl.h /^ PetscInt nwork;$/;" m struct:_p_EPS nwork include/slepc-private/mfnimpl.h /^ PetscInt nwork;$/;" m struct:_p_MFN nwork include/slepc-private/nepimpl.h /^ PetscInt nwork;$/;" m struct:_p_NEP nwork include/slepc-private/qepimpl.h /^ PetscInt nwork;$/;" m struct:_p_QEP nx include/slepc-private/vecimplslepc.h /^ PetscInt nx; \/* number of available subvectors *\/$/;" m struct:__anon3 oldU src/eps/impls/davidson/common/dvd_updatev.c /^ *oldU, \/* previous projected right igenvectors *\/$/;" m struct:__anon13 file: oldV src/eps/impls/davidson/common/dvd_updatev.c /^ *oldV; \/* previous projected left eigenvectors *\/$/;" m struct:__anon13 file: old_calcPairs src/eps/impls/davidson/common/dvd_utils.c /^ PetscErrorCode (*old_calcPairs)(struct _dvdDashboard*);$/;" m struct:__anon16 file: old_improveX src/eps/impls/davidson/common/dvd_gd2.c /^ improveX_type old_improveX; \/* old improveX *\/$/;" m struct:__anon10 file: old_improveX src/eps/impls/davidson/common/dvd_improvex.c /^ old_improveX; \/* old improveX *\/$/;" m struct:__anon11 file: old_improveX src/eps/impls/davidson/common/dvd_utils.c /^ PetscErrorCode (*old_improveX)(struct _dvdDashboard*,Vec *D,PetscInt max_size_D,PetscInt r_s,PetscInt r_e,PetscInt *size_D);$/;" m struct:__anon16 file: old_improveX_data src/eps/impls/davidson/common/dvd_gd2.c /^ void *old_improveX_data; \/* old improveX_data *\/$/;" m struct:__anon10 file: old_improveX_data src/eps/impls/davidson/common/dvd_improvex.c /^ *old_improveX_data; \/* old improveX_data *\/$/;" m struct:__anon11 file: old_initV src/eps/impls/davidson/common/dvd_utils.c /^ PetscErrorCode (*old_initV)(struct _dvdDashboard*);$/;" m struct:__anon16 file: old_initV_data src/eps/impls/davidson/common/dvd_initv.c /^ void *old_initV_data; \/* old initV data *\/$/;" m struct:__anon12 file: old_isRestarting src/eps/impls/davidson/common/dvd_updatev.c /^ old_isRestarting;$/;" m struct:__anon13 file: old_orthV src/eps/impls/davidson/common/dvd_utils.c /^ PetscErrorCode (*old_orthV)(struct _dvdDashboard*);$/;" m struct:__anon16 file: old_pc src/eps/impls/davidson/common/dvd_improvex.c /^ PC old_pc; \/* old pc in ksp *\/$/;" m struct:__anon11 file: old_size_X src/eps/impls/davidson/common/dvd_improvex.c /^ old_size_X; \/* last number of improved vectors *\/$/;" m struct:__anon11 file: old_updateV src/eps/impls/davidson/common/dvd_utils.c /^ PetscErrorCode (*old_updateV)(struct _dvdDashboard*);$/;" m struct:__anon16 file: old_updateV_data src/eps/impls/davidson/common/dvd_updatev.c /^ *old_updateV_data;$/;" m struct:__anon13 file: oldnconv include/slepc-private/slepcimpl.h /^ PetscInt oldnconv;$/;" m struct:_n_SlepcConvMonitor omega src/eps/impls/ciss/ciss.c /^ PetscScalar *omega;$/;" m struct:__anon1 file: oneside src/svd/impls/lanczos/gklanczos.c /^ PetscBool oneside;$/;" m struct:__anon1 file: oneside src/svd/impls/trlanczos/trlanczos.c /^ PetscBool oneside;$/;" m struct:__anon1 file: ops src/eps/impls/davidson/common/davidson.h /^ *ops; \/* vector of reduction operations *\/$/;" m struct:__anon8 optparse config/cmakegen.py /^ import optparse$/;" i orthoV_type src/eps/impls/davidson/common/davidson.h /^ EPSOrthType orthoV_type;$/;" m struct:_dvdDashboard orthog_eta include/slepc-private/ipimpl.h /^ PetscReal orthog_eta; \/* refinement threshold *\/$/;" m struct:_p_IP orthog_ref include/slepc-private/ipimpl.h /^ IPOrthogRefineType orthog_ref; \/* refinement method *\/$/;" m struct:_p_IP orthog_type include/slepc-private/ipimpl.h /^ IPOrthogType orthog_type; \/* which orthogonalization to use *\/$/;" m struct:_p_IP os config/arpack.py /^import os$/;" i os config/blopex.py /^import os$/;" i os config/blzpack.py /^import os$/;" i os config/check.py /^import os$/;" i os config/cmakeboot.py /^import os,sys,string$/;" i os config/cmakegen.py /^import os$/;" i os config/configure.py /^import os$/;" i os config/feast.py /^import os$/;" i os config/generatefortranstubs.py /^ import os.path$/;" i os config/generatefortranstubs.py /^import os$/;" i os config/lapack.py /^import os$/;" i os config/petscconf.py /^import os$/;" i os config/petscversion.py /^import os$/;" i os config/primme.py /^import os$/;" i os config/slepcversion.py /^import os$/;" i os config/trlan.py /^import os$/;" i os setup.py /^import sys, os$/;" i ourarbitraryfunc src/eps/interface/ftn-custom/zepsf.c /^static PetscErrorCode ourarbitraryfunc(PetscScalar er,PetscScalar ei,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx)$/;" f file: ourconvergence src/eps/interface/ftn-custom/zepsf.c /^static PetscErrorCode ourconvergence(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)$/;" f file: ourdestroy src/eps/interface/ftn-custom/zepsf.c /^static PetscErrorCode ourdestroy(void** ctx)$/;" f file: ourdestroy src/mfn/interface/ftn-custom/zmfnf.c /^static PetscErrorCode ourdestroy(void** ctx)$/;" f file: ourdestroy src/nep/interface/ftn-custom/znepf.c /^static PetscErrorCode ourdestroy(void** ctx)$/;" f file: ourdestroy src/qep/interface/ftn-custom/zqepf.c /^static PetscErrorCode ourdestroy(void** ctx)$/;" f file: ourdestroy src/svd/interface/ftn-custom/zsvdf.c /^static PetscErrorCode ourdestroy(void** ctx)$/;" f file: oureigenvaluecomparison src/eps/interface/ftn-custom/zepsf.c /^static PetscErrorCode oureigenvaluecomparison(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *r,void *ctx)$/;" f file: ourmonitor src/eps/interface/ftn-custom/zepsf.c /^static PetscErrorCode ourmonitor(EPS eps,PetscInt i,PetscInt nc,PetscScalar *er,PetscScalar *ei,PetscReal *d,PetscInt l,void* ctx)$/;" f file: ourmonitor src/mfn/interface/ftn-custom/zmfnf.c /^static PetscErrorCode ourmonitor(MFN mfn,PetscInt i,PetscReal d,void* ctx)$/;" f file: ourmonitor src/nep/interface/ftn-custom/znepf.c /^static PetscErrorCode ourmonitor(NEP nep,PetscInt i,PetscInt nc,PetscScalar *eig,PetscReal *d,PetscInt l,void* ctx)$/;" f file: ourmonitor src/qep/interface/ftn-custom/zqepf.c /^static PetscErrorCode ourmonitor(QEP qep,PetscInt i,PetscInt nc,PetscScalar *er,PetscScalar *ei,PetscReal *d,PetscInt l,void* ctx)$/;" f file: ourmonitor src/svd/interface/ftn-custom/zsvdf.c /^static PetscErrorCode ourmonitor(SVD svd,PetscInt i,PetscInt nc,PetscReal *sigma,PetscReal *d,PetscInt l,void* ctx)$/;" f file: ourshellapply src/st/impls/shell/ftn-custom/zshell.c /^static PetscErrorCode ourshellapply(ST st,Vec x,Vec y)$/;" f file: ourshellapplytranspose src/st/impls/shell/ftn-custom/zshell.c /^static PetscErrorCode ourshellapplytranspose(ST st,Vec x,Vec y)$/;" f file: ourshellbacktransform src/st/impls/shell/ftn-custom/zshell.c /^static PetscErrorCode ourshellbacktransform(ST st,PetscInt n,PetscScalar *eigr,PetscScalar *eigi)$/;" f file: out src/eps/impls/davidson/common/davidson.h /^ *out; \/* final vector *\/$/;" m struct:__anon7 out src/eps/impls/davidson/common/davidson.h /^ *out; \/* final vector *\/$/;" m struct:__anon8 own_scalars src/eps/impls/davidson/common/davidson.h /^ own_scalars; \/* number of local scalars *\/$/;" m struct:__anon6 own_vecs src/eps/impls/davidson/common/davidson.h /^ own_vecs, \/* number of global vecs *\/$/;" m struct:__anon6 package_dir setup.py /^ package_dir = {'slepc': 'pypi'},$/;" v packages setup.py /^ packages = ['slepc'],$/;" v par_GlobalSumDouble src/eps/impls/external/primme/primme.c /^static void par_GlobalSumDouble(void *sendBuf,void *recvBuf,int *count,primme_params *primme)$/;" f file: parse_makefile config/cmakegen.py /^ from distutils.sysconfig import parse_makefile$/;" i parser config/cmakegen.py /^ parser = optparse.OptionParser()$/;" v path config/generatefortranstubs.py /^ import os.path$/;" i pc src/eps/impls/davidson/common/dvd_utils.c /^ PC pc;$/;" m struct:__anon14 file: pending src/eps/impls/krylov/krylovschur/krylovschur.h /^ shift *pending; \/* Pending shifts array *\/$/;" m struct:_n_SR perm include/slepc-private/dsimpl.h /^ PetscInt *perm; \/* permutation *\/$/;" m struct:_p_DS perm include/slepc-private/epsimpl.h /^ PetscInt *perm; \/* permutation for eigenvalue ordering *\/$/;" m struct:_p_EPS perm include/slepc-private/nepimpl.h /^ PetscInt *perm; \/* permutation for eigenvalue ordering *\/$/;" m struct:_p_NEP perm include/slepc-private/qepimpl.h /^ PetscInt *perm; \/* permutation for eigenvalue ordering *\/$/;" m struct:_p_QEP perm include/slepc-private/svdimpl.h /^ PetscInt *perm; \/* permutation for singular value ordering *\/$/;" m struct:_p_SVD perm src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscInt *perm; \/* Permutation for keeping the eigenvalues in order *\/$/;" m struct:_n_SR petsc setup.py /^ import petsc$/;" i petscconf config/arpack.py /^import petscconf$/;" i petscconf config/blopex.py /^import petscconf$/;" i petscconf config/blzpack.py /^import petscconf$/;" i petscconf config/check.py /^import petscconf$/;" i petscconf config/configure.py /^import petscconf$/;" i petscconf config/feast.py /^import petscconf$/;" i petscconf config/lapack.py /^import petscconf$/;" i petscconf config/log.py /^import petscconf$/;" i petscconf config/primme.py /^import petscconf$/;" i petscconf config/trlan.py /^import petscconf$/;" i petscdir config/configure.py /^ petscdir = prefixdir$/;" v petscdir config/configure.py /^ petscdir = os.environ['PETSC_DIR']$/;" v petscinitialize_ src/sys/ftn-custom/zslepc_start.c /^#define petscinitialize_ /;" d file: petscversion config/configure.py /^import petscversion$/;" i pkgconfig config/configure.py /^ pkgconfig = open(os.sep.join([pkgconfigdir,'SLEPc.pc']),'w')$/;" v pkgconfigdir config/configure.py /^pkgconfigdir = os.sep.join([libdir,'pkgconfig'])$/;" v pkgsources config/cmakegen.py /^def pkgsources(pkg):$/;" f platforms setup.py /^ platforms=['POSIX'],$/;" v plusk src/eps/impls/davidson/common/davidson.c /^ plusk; \/* keep plusk eigenvectors from the last iteration *\/$/;" m struct:__anon1 file: plusk src/eps/impls/davidson/common/dvd_updatev.c /^ plusk, \/* when restart, save plusk vectors from last iteration *\/$/;" m struct:__anon13 file: postsolve include/slepc-private/stimpl.h /^ PetscErrorCode (*postsolve)(ST);$/;" m struct:_STOps pp src/eps/impls/ciss/ciss.c /^ PetscScalar *pp;$/;" m struct:__anon1 file: preTestConv src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*preTestConv)(struct _dvdDashboard*,PetscInt s,PetscInt pre,PetscInt e,Vec *auxV,PetscScalar *auxS,PetscInt *nConv);$/;" m struct:_dvdDashboard prefixdir config/configure.py /^ prefixdir = archdir$/;" v prefixdir config/configure.py /^ prefixdir = i.split('=')[1]$/;" v prefixdir config/configure.py /^prefixdir = ''$/;" v primme config/configure.py /^import primme$/;" i primme src/eps/impls/external/primme/primme.c /^ primme_params primme; \/* param struc *\/$/;" m struct:__anon1 file: primmedir config/configure.py /^ primmedir = i.split('=')[1]$/;" v primmedir config/configure.py /^primmedir = ''$/;" v primmelibs config/configure.py /^ primmelibs = i.split('=')[1].split(',')$/;" v primmelibs config/configure.py /^ primmelibs = primme.Check(slepcconf,slepcvars,cmake,tmpdir,primmedir,primmelibs)$/;" v primmelibs config/configure.py /^primmelibs = []$/;" v problem_type include/slepc-private/epsimpl.h /^ EPSProblemType problem_type; \/* which kind of problem to be solved *\/$/;" m struct:_p_EPS problem_type include/slepc-private/qepimpl.h /^ QEPProblemType problem_type; \/* which kind of problem to be solved *\/$/;" m struct:_p_QEP processDir config/generatefortranstubs.py /^def processDir(arg,dirname,names):$/;" f processf90interfaces config/generatefortranstubs.py /^def processf90interfaces(petscdir,verbose):$/;" f prof_data src/eps/impls/davidson/common/davidson.h /^ void* prof_data; \/* profiler data *\/$/;" m struct:_dvdDashboard ps src/eps/impls/davidson/common/davidson.h /^ ps; \/* projected problem with the search subspace *\/$/;" m struct:_dvdDashboard ptr src/eps/impls/davidson/common/davidson.h /^ void *ptr;$/;" m struct:__anon7 publishoptions include/slepc-private/epsimpl.h /^ PetscErrorCode (*publishoptions)(EPS);$/;" m struct:_EPSOps publishoptions include/slepc-private/mfnimpl.h /^ PetscErrorCode (*publishoptions)(MFN);$/;" m struct:_MFNOps publishoptions include/slepc-private/nepimpl.h /^ PetscErrorCode (*publishoptions)(NEP);$/;" m struct:_NEPOps publishoptions include/slepc-private/qepimpl.h /^ PetscErrorCode (*publishoptions)(QEP);$/;" m struct:_QEPOps publishoptions include/slepc-private/svdimpl.h /^ PetscErrorCode (*publishoptions)(SVD);$/;" m struct:_SVDOps qepappendoptionsprefix_ src/qep/interface/ftn-custom/zqepf.c /^#define qepappendoptionsprefix_ /;" d file: qepappendoptionsprefix_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepappendoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f qepcreate_ src/qep/interface/ftn-custom/zqepf.c /^#define qepcreate_ /;" d file: qepcreate_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepcreate_(MPI_Fint *comm,QEP *qep,PetscErrorCode *ierr)$/;" f qepdestroy_ src/qep/interface/ftn-custom/zqepf.c /^#define qepdestroy_ /;" d file: qepdestroy_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepdestroy_(QEP *qep,PetscErrorCode *ierr)$/;" f qepgetconvergedreason_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgetconvergedreason_ /;" d file: qepgetconvergedreason_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgetconvergedreason_(QEP *qep,QEPConvergedReason *reason,PetscErrorCode *ierr)$/;" f qepgetds_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgetds_ /;" d file: qepgetds_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgetds_(QEP *qep,DS *ds,PetscErrorCode *ierr)$/;" f qepgetip_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgetip_ /;" d file: qepgetip_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgetip_(QEP *qep,IP *ip,PetscErrorCode *ierr)$/;" f qepgetoptionsprefix_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgetoptionsprefix_ /;" d file: qepgetoptionsprefix_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgetoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f qepgetproblemtype_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgetproblemtype_ /;" d file: qepgetproblemtype_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgetproblemtype_(QEP *qep,QEPProblemType *type,PetscErrorCode *ierr)$/;" f qepgettype_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgettype_ /;" d file: qepgettype_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgettype_(QEP *qep,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f qepgetwhicheigenpairs_ src/qep/interface/ftn-custom/zqepf.c /^#define qepgetwhicheigenpairs_ /;" d file: qepgetwhicheigenpairs_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepgetwhicheigenpairs_(QEP *qep,QEPWhich *which,PetscErrorCode *ierr)$/;" f qepmonitorall_ src/qep/interface/ftn-custom/zqepf.c /^#define qepmonitorall_ /;" d file: qepmonitorall_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void qepmonitorall_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f qepmonitorconverged_ src/qep/interface/ftn-custom/zqepf.c /^#define qepmonitorconverged_ /;" d file: qepmonitorconverged_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void qepmonitorconverged_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f qepmonitorfirst_ src/qep/interface/ftn-custom/zqepf.c /^#define qepmonitorfirst_ /;" d file: qepmonitorfirst_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void qepmonitorfirst_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f qepmonitorlg_ src/qep/interface/ftn-custom/zqepf.c /^#define qepmonitorlg_ /;" d file: qepmonitorlg_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void qepmonitorlg_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f qepmonitorlgall_ src/qep/interface/ftn-custom/zqepf.c /^#define qepmonitorlgall_ /;" d file: qepmonitorlgall_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void qepmonitorlgall_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f qepmonitorset_ src/qep/interface/ftn-custom/zqepf.c /^#define qepmonitorset_ /;" d file: qepmonitorset_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepmonitorset_(QEP *qep,void (PETSC_STDCALL *monitor)(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr)$/;" f qepsetoptionsprefix_ src/qep/interface/ftn-custom/zqepf.c /^#define qepsetoptionsprefix_ /;" d file: qepsetoptionsprefix_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepsetoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f qepsettype_ src/qep/interface/ftn-custom/zqepf.c /^#define qepsettype_ /;" d file: qepsettype_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepsettype_(QEP *qep,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f qepview_ src/qep/interface/ftn-custom/zqepf.c /^#define qepview_ /;" d file: qepview_ src/qep/interface/ftn-custom/zqepf.c /^PETSC_EXTERN void PETSC_STDCALL qepview_(QEP *qep,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f quoteIfNeeded config/cmakeboot.py /^def quoteIfNeeded(path):$/;" f r_e src/eps/impls/davidson/common/dvd_improvex.c /^ r_s, r_e, \/* the selected eigenpairs to improve *\/$/;" m struct:__anon11 file: r_s src/eps/impls/davidson/common/dvd_improvex.c /^ r_s, r_e, \/* the selected eigenpairs to improve *\/$/;" m struct:__anon11 file: radius src/eps/impls/ciss/ciss.c /^ PetscReal radius; \/* radius of the region (1.0) *\/$/;" m struct:__anon1 file: rand include/slepc-private/epsimpl.h /^ PetscRandom rand; \/* random number generator *\/$/;" m struct:_p_EPS rand include/slepc-private/mfnimpl.h /^ PetscRandom rand; \/* random number generator *\/$/;" m struct:_p_MFN rand include/slepc-private/nepimpl.h /^ PetscRandom rand; \/* random number generator *\/$/;" m struct:_p_NEP rand include/slepc-private/qepimpl.h /^ PetscRandom rand; \/* random number generator *\/$/;" m struct:_p_QEP rand include/slepc-private/svdimpl.h /^ PetscRandom rand; \/* random number generator *\/$/;" m struct:_p_SVD re config/cmakeboot.py /^ import re$/;" i re config/generatefortranstubs.py /^ import re$/;" i re setup.py /^ import re$/;" i real src/eps/impls/external/blopex/petsc-interface.c /^ double real,imag;$/;" m struct:__anon2 file: real_AV src/eps/impls/davidson/common/davidson.h /^ *real_AV, \/* original A*V space *\/$/;" m struct:_dvdDashboard real_BV src/eps/impls/davidson/common/davidson.h /^ *real_BV, \/* original B*V space *\/$/;" m struct:_dvdDashboard real_G src/eps/impls/davidson/common/davidson.h /^ *real_G, \/* original G *\/$/;" m struct:_dvdDashboard real_H src/eps/impls/davidson/common/davidson.h /^ *real_H, \/* original H *\/$/;" m struct:_dvdDashboard real_KZ src/eps/impls/davidson/common/dvd_improvex.c /^ *real_KZ, \/* original KZ *\/$/;" m struct:__anon11 file: real_V src/eps/impls/davidson/common/davidson.h /^ *real_V, \/* original V *\/$/;" m struct:_dvdDashboard real_W src/eps/impls/davidson/common/davidson.h /^ *real_W, \/* original W *\/$/;" m struct:_dvdDashboard real_eigi src/eps/impls/davidson/common/davidson.h /^ *real_eigi; \/* original eigr and eigi *\/$/;" m struct:_dvdDashboard real_eigr src/eps/impls/davidson/common/davidson.h /^ *real_eigr,$/;" m struct:_dvdDashboard real_errest src/eps/impls/davidson/common/davidson.h /^ *real_errest, \/* original errest *\/$/;" m struct:_dvdDashboard real_nBV src/eps/impls/davidson/common/davidson.h /^ *real_nBV; \/* original nBDS, nBV and nBcX *\/$/;" m struct:_dvdDashboard real_nR src/eps/impls/davidson/common/davidson.h /^ *real_nR, \/* original nR *\/$/;" m struct:_dvdDashboard real_nX src/eps/impls/davidson/common/davidson.h /^ *real_nX, \/* original nX *\/$/;" m struct:_dvdDashboard reason include/slepc-private/epsimpl.h /^ EPSConvergedReason reason;$/;" m struct:_p_EPS reason include/slepc-private/mfnimpl.h /^ MFNConvergedReason reason;$/;" m struct:_p_MFN reason include/slepc-private/nepimpl.h /^ NEPConvergedReason reason;$/;" m struct:_p_NEP reason include/slepc-private/qepimpl.h /^ QEPConvergedReason reason;$/;" m struct:_p_QEP reason include/slepc-private/svdimpl.h /^ SVDConvergedReason reason;$/;" m struct:_p_SVD refine_blocksize src/eps/impls/ciss/ciss.c /^ PetscInt refine_blocksize;$/;" m struct:__anon1 file: refine_inner src/eps/impls/ciss/ciss.c /^ PetscInt refine_inner;$/;" m struct:__anon1 file: refine_outer src/eps/impls/ciss/ciss.c /^ PetscInt refine_outer;$/;" m struct:__anon1 file: refined include/slepc-private/dsimpl.h /^ PetscBool refined; \/* get refined vectors instead of regular vectors *\/$/;" m struct:_p_DS relpath config/cmakegen.py /^ def relpath(filename):$/;" f function:pkgsources.compareSourceLists reorthog src/eps/impls/krylov/lanczos/lanczos.c /^ EPSLanczosReorthogType reorthog;$/;" m struct:__anon1 file: reset include/slepc-private/epsimpl.h /^ PetscErrorCode (*reset)(EPS);$/;" m struct:_EPSOps reset include/slepc-private/mfnimpl.h /^ PetscErrorCode (*reset)(MFN);$/;" m struct:_MFNOps reset include/slepc-private/nepimpl.h /^ PetscErrorCode (*reset)(NEP);$/;" m struct:_NEPOps reset include/slepc-private/qepimpl.h /^ PetscErrorCode (*reset)(QEP);$/;" m struct:_QEPOps reset include/slepc-private/stimpl.h /^ PetscErrorCode (*reset)(ST);$/;" m struct:_STOps reset include/slepc-private/svdimpl.h /^ PetscErrorCode (*reset)(SVD);$/;" m struct:_SVDOps restart src/eps/impls/external/trlan/trlanp.h /^ PetscBLASInt restart;$/;" m struct:__anon1 restartV src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*restartV)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard restartV_data src/eps/impls/davidson/common/davidson.h /^ void *restartV_data;$/;" m struct:_dvdDashboard ri include/slepc-private/epsimpl.h /^ PetscScalar *rr,*ri; \/* values computed by user's arbitrary selection function *\/$/;" m struct:_p_EPS rmat include/slepc-private/dsimpl.h /^ PetscReal *rmat[DS_NUM_MAT]; \/* the matrices (real) *\/$/;" m struct:_p_DS rr include/slepc-private/epsimpl.h /^ PetscScalar *rr,*ri; \/* values computed by user's arbitrary selection function *\/$/;" m struct:_p_EPS rstor src/eps/impls/external/blzpack/blzpackp.h /^ PetscReal *rstor;$/;" m struct:__anon1 rtol include/slepc-private/nepimpl.h /^ PetscReal abstol,rtol,stol; \/* user tolerances *\/$/;" m struct:_p_NEP run setup.py /^ def run(self):$/;" m class:cmd_build run setup.py /^ def run(self):$/;" m class:cmd_install rwork include/slepc-private/dsimpl.h /^ PetscReal *rwork;$/;" m struct:_p_DS rwork src/eps/impls/external/arpack/arpackp.h /^ PetscReal *rwork;$/;" m struct:__anon1 s0 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 s0 src/eps/impls/krylov/krylovschur/krylovschur.h /^ shift s0; \/* Initial shift *\/$/;" m struct:_n_SR s1 src/eps/impls/davidson/common/davidson.h /^ PetscInt i0, i1, i2, ld, s0, e0, s1, e1;$/;" m struct:__anon9 sA src/eps/impls/davidson/common/davidson.h /^ MatType_t sA, sB; \/* Matrix specifications *\/$/;" m struct:_dvdDashboard sB src/eps/impls/davidson/common/davidson.h /^ MatType_t sA, sB; \/* Matrix specifications *\/$/;" m struct:_dvdDashboard sEP src/eps/impls/davidson/common/davidson.h /^ EPType_t sEP; \/* Problem specifications *\/$/;" m struct:_dvdDashboard sG src/eps/impls/davidson/common/davidson.h /^ sG; \/* G properties *\/$/;" m struct:_dvdDashboard sH src/eps/impls/davidson/common/davidson.h /^ sH, \/* H properties *\/$/;" m struct:_dvdDashboard sPres src/eps/impls/krylov/krylovschur/krylovschur.h /^ shift sPres; \/* Present shift *\/$/;" m struct:_n_SR sPrev src/eps/impls/krylov/krylovschur/krylovschur.h /^ shift sPrev;$/;" m struct:_n_SR scheme src/eps/impls/davidson/common/davidson.c /^ Method_t scheme; \/* method employed: GD, JD or GD2 *\/$/;" m struct:__anon1 file: script config/cmakeboot.py /^import script$/;" i select src/eps/impls/external/arpack/arpackp.h /^ PetscBool *select;$/;" m struct:__anon1 setfromoptions include/slepc-private/epsimpl.h /^ PetscErrorCode (*setfromoptions)(EPS);$/;" m struct:_EPSOps setfromoptions include/slepc-private/mfnimpl.h /^ PetscErrorCode (*setfromoptions)(MFN);$/;" m struct:_MFNOps setfromoptions include/slepc-private/nepimpl.h /^ PetscErrorCode (*setfromoptions)(NEP);$/;" m struct:_NEPOps setfromoptions include/slepc-private/qepimpl.h /^ PetscErrorCode (*setfromoptions)(QEP);$/;" m struct:_QEPOps setfromoptions include/slepc-private/stimpl.h /^ PetscErrorCode (*setfromoptions)(ST);$/;" m struct:_STOps setfromoptions include/slepc-private/svdimpl.h /^ PetscErrorCode (*setfromoptions)(SVD);$/;" m struct:_SVDOps setfromoptionscalled src/nep/impls/slp/slp.c /^ PetscBool setfromoptionscalled;$/;" m struct:__anon1 file: setfromoptionscalled src/qep/impls/linear/linearp.h /^ PetscBool setfromoptionscalled;$/;" m struct:__anon1 setfromoptionscalled src/svd/impls/cross/cross.c /^ PetscBool setfromoptionscalled;$/;" m struct:__anon1 file: setfromoptionscalled src/svd/impls/cyclic/cyclic.c /^ PetscBool setfromoptionscalled;$/;" m struct:__anon1 file: setmat src/st/impls/precond/precond.c /^ PetscBool setmat;$/;" m struct:__anon1 file: setshift include/slepc-private/stimpl.h /^ PetscErrorCode (*setshift)(ST,PetscScalar);$/;" m struct:_STOps setup config/cmakeboot.py /^ def setup(self):$/;" m class:PETScMaker setup include/slepc-private/epsimpl.h /^ PetscErrorCode (*setup)(EPS);$/;" m struct:_EPSOps setup include/slepc-private/mfnimpl.h /^ PetscErrorCode (*setup)(MFN);$/;" m struct:_MFNOps setup include/slepc-private/nepimpl.h /^ PetscErrorCode (*setup)(NEP);$/;" m struct:_NEPOps setup include/slepc-private/qepimpl.h /^ PetscErrorCode (*setup)(QEP);$/;" m struct:_QEPOps setup include/slepc-private/stimpl.h /^ PetscErrorCode (*setup)(ST);$/;" m struct:_STOps setup include/slepc-private/svdimpl.h /^ PetscErrorCode (*setup)(SVD);$/;" m struct:_SVDOps setup setup.py /^from distutils.core import setup$/;" i setupModules config/cmakeboot.py /^ def setupModules(self):$/;" m class:PETScMaker setupcalled include/slepc-private/epsimpl.h /^ PetscInt setupcalled;$/;" m struct:_p_EPS setupcalled include/slepc-private/mfnimpl.h /^ PetscInt setupcalled;$/;" m struct:_p_MFN setupcalled include/slepc-private/nepimpl.h /^ PetscInt setupcalled;$/;" m struct:_p_NEP setupcalled include/slepc-private/qepimpl.h /^ PetscInt setupcalled;$/;" m struct:_p_QEP setupcalled include/slepc-private/stimpl.h /^ PetscInt setupcalled;$/;" m struct:_p_ST setupcalled include/slepc-private/svdimpl.h /^ PetscInt setupcalled;$/;" m struct:_p_SVD sfactor include/slepc-private/mfnimpl.h /^ PetscScalar sfactor; \/* scaling factor *\/$/;" m struct:_p_MFN sfactor include/slepc-private/qepimpl.h /^ PetscReal sfactor; \/* scaling factor of the quadratic problem *\/$/;" m struct:_p_QEP sfactor src/qep/impls/linear/linearp.h /^ PetscReal sfactor; \/* scaling factor *\/$/;" m struct:__anon1 sfactor_set include/slepc-private/qepimpl.h /^ PetscBool sfactor_set; \/* flag to indicate the user gave sfactor *\/$/;" m struct:_p_QEP shift src/eps/impls/krylov/krylovschur/krylovschur.h /^typedef struct _n_shift *shift;$/;" t typeref:struct:_n_shift shift_matrix include/slepc-private/stimpl.h /^ STMatMode shift_matrix;$/;" m struct:_p_ST shift_type src/eps/impls/power/power.c /^ EPSPowerShiftType shift_type;$/;" m struct:__anon1 file: shlex config/cmakeboot.py /^ import shlex$/;" i shutil config/cmakeboot.py /^ import shutil$/;" i shutil config/cmakegen.py /^ import tempfile, shutil$/;" i shutil config/configure.py /^import shutil$/;" i shutil config/generatefortranstubs.py /^ import shutil$/;" i shutil config/generatefortranstubs.py /^ import shutil$/;" i sigma include/slepc-private/stimpl.h /^ PetscScalar sigma; \/* Value of the shift *\/$/;" m struct:_p_ST sigma include/slepc-private/svdimpl.h /^ PetscReal *sigma; \/* singular values *\/$/;" m struct:_p_SVD sigma src/eps/examples/tutorials/ex9.c /^ PetscScalar alpha,beta,tau1,tau2,sigma;$/;" m struct:__anon1 file: sigma src/eps/impls/ciss/ciss.c /^ PetscReal *sigma; \/* threshold for numerical rank *\/$/;" m struct:__anon1 file: sigma_set include/slepc-private/stimpl.h /^ PetscBool sigma_set; \/* whether the user provided the shift or not *\/$/;" m struct:_p_ST size_AV src/eps/impls/davidson/common/davidson.h /^ size_AV, \/* size of AV *\/$/;" m struct:_dvdDashboard size_BDS src/eps/impls/davidson/common/davidson.h /^ size_BDS, \/* size of BDS *\/$/;" m struct:_dvdDashboard size_BV src/eps/impls/davidson/common/davidson.h /^ size_BV, \/* size of BV *\/$/;" m struct:_dvdDashboard size_BcX src/eps/impls/davidson/common/davidson.h /^ size_BcX, \/* size of BcX *\/$/;" m struct:_dvdDashboard size_D src/eps/impls/davidson/common/davidson.h /^ size_D, \/* active vectors *\/$/;" m struct:_dvdDashboard size_G src/eps/impls/davidson/common/davidson.h /^ size_G, \/* rows and columns in G *\/$/;" m struct:_dvdDashboard size_H src/eps/impls/davidson/common/davidson.h /^ size_H, \/* rows and columns in H *\/$/;" m struct:_dvdDashboard size_KZ src/eps/impls/davidson/common/dvd_improvex.c /^ size_KZ, \/* size of converged KZ *\/$/;" m struct:__anon11 file: size_MT src/eps/impls/davidson/common/davidson.h /^ size_MT, \/* rows in MT *\/$/;" m struct:_dvdDashboard size_V src/eps/impls/davidson/common/davidson.h /^ size_V, \/* real size of V (nev+size_P+mpd) *\/$/;" m struct:__anon6 size_V src/eps/impls/davidson/common/davidson.h /^ PetscInt size_V, \/* size of V *\/$/;" m struct:_dvdDashboard size_W src/eps/impls/davidson/common/davidson.h /^ size_W, \/* size of W *\/$/;" m struct:_dvdDashboard size_X src/eps/impls/davidson/common/dvd_gd2.c /^ PetscInt size_X;$/;" m struct:__anon10 file: size_X src/eps/impls/davidson/common/dvd_improvex.c /^ PetscInt size_X;$/;" m struct:__anon11 file: size_Z src/eps/impls/davidson/common/dvd_gd2.c /^#define size_Z /;" d file: size_Z src/eps/impls/davidson/common/dvd_improvex.c /^#define size_Z /;" d file: size_auxS src/eps/impls/davidson/common/davidson.h /^ size_auxS; \/* max size of auxS *\/$/;" m struct:_dvdDashboard size_auxV src/eps/impls/davidson/common/davidson.h /^ size_auxV, \/* max size of auxV *\/$/;" m struct:_dvdDashboard size_cS src/eps/impls/davidson/common/davidson.h /^ size_cS, \/* dimension of cS *\/$/;" m struct:_dvdDashboard size_cT src/eps/impls/davidson/common/davidson.h /^ size_cT, \/* dimension of cT *\/$/;" m struct:_dvdDashboard size_cX src/eps/impls/davidson/common/davidson.h /^ size_cX, \/* size of cX *\/$/;" m struct:_dvdDashboard size_cX src/eps/impls/davidson/common/dvd_improvex.c /^ size_cX, \/* last value of d->size_cX *\/$/;" m struct:__anon11 file: size_cY src/eps/impls/davidson/common/davidson.h /^ size_cY, \/* size of cY *\/$/;" m struct:_dvdDashboard size_iXKZ src/eps/impls/davidson/common/dvd_improvex.c /^ size_iXKZ, \/* size of iXKZ *\/$/;" m struct:__anon11 file: size_in src/eps/impls/davidson/common/davidson.h /^ PetscInt size_in, \/* size of in *\/$/;" m struct:__anon8 size_oldU src/eps/impls/davidson/common/dvd_updatev.c /^ size_oldU; \/* size of oldU *\/$/;" m struct:__anon13 file: size_ops src/eps/impls/davidson/common/davidson.h /^ size_ops, \/* size of ops *\/$/;" m struct:__anon8 size_out src/eps/impls/davidson/common/davidson.h /^ size_out; \/* size of out *\/$/;" m struct:__anon7 size_real_AV src/eps/impls/davidson/common/davidson.h /^ size_real_AV, \/* original size of AV *\/$/;" m struct:_dvdDashboard size_real_BV src/eps/impls/davidson/common/davidson.h /^ size_real_BV, \/* original size of BV *\/$/;" m struct:_dvdDashboard size_real_KZ src/eps/impls/davidson/common/dvd_improvex.c /^ size_real_KZ, \/* original size of KZ *\/$/;" m struct:__anon11 file: size_real_V src/eps/impls/davidson/common/davidson.h /^ size_real_V, \/* original size of V *\/$/;" m struct:_dvdDashboard size_real_W src/eps/impls/davidson/common/davidson.h /^ size_real_W, \/* original size of W *\/$/;" m struct:_dvdDashboard size_real_eigr src/eps/impls/davidson/common/davidson.h /^ size_real_eigr, \/* size of original eigr, eigi, nR, errest *\/$/;" m struct:_dvdDashboard size_wV src/eps/impls/davidson/common/davidson.c /^ PetscInt size_wV;$/;" m struct:__anon1 file: slepcconf config/configure.py /^ slepcconf = open(os.sep.join([incdir,'slepcconf.h']),'w')$/;" v slepcdir config/configure.py /^ slepcdir = os.environ['SLEPC_DIR']$/;" v slepcdir config/configure.py /^ slepcdir = os.getcwd();$/;" v slepcds src/sys/f90-mod/slepcmod.F /^ module slepcds$/;" m slepcdsdef src/sys/f90-mod/slepcmod.F /^ module slepcdsdef$/;" m slepceps src/sys/f90-mod/slepcmod.F /^ module slepceps$/;" m slepcepsdef src/sys/f90-mod/slepcmod.F /^ module slepcepsdef$/;" m slepcinitialize_ src/sys/ftn-custom/zslepc_start.c /^#define slepcinitialize_ /;" d file: slepcinitializefortran_ src/sys/ftn-custom/zslepc_startf.c /^#define slepcinitializefortran_ /;" d file: slepcinitializefortran_ src/sys/ftn-custom/zslepc_startf.c /^PETSC_EXTERN void PETSC_STDCALL slepcinitializefortran_(PetscErrorCode *info)$/;" f slepcip src/sys/f90-mod/slepcmod.F /^ module slepcip$/;" m slepcipdef src/sys/f90-mod/slepcmod.F /^ module slepcipdef$/;" m slepcmfn src/sys/f90-mod/slepcmod.F /^ module slepcmfn$/;" m slepcmfndef src/sys/f90-mod/slepcmod.F /^ module slepcmfndef$/;" m slepcnep src/sys/f90-mod/slepcmod.F /^ module slepcnep$/;" m slepcnepdef src/sys/f90-mod/slepcmod.F /^ module slepcnepdef$/;" m slepcqep src/sys/f90-mod/slepcmod.F /^ module slepcqep$/;" m slepcqepdef src/sys/f90-mod/slepcmod.F /^ module slepcqepdef$/;" m slepcrules config/configure.py /^ slepcrules = open(os.sep.join([confdir,'slepcrules']),'w')$/;" v slepcst src/sys/f90-mod/slepcmod.F /^ module slepcst$/;" m slepcstdef src/sys/f90-mod/slepcmod.F /^ module slepcstdef$/;" m slepcsvd src/sys/f90-mod/slepcmod.F /^ module slepcsvd$/;" m slepcsvddef src/sys/f90-mod/slepcmod.F /^ module slepcsvddef$/;" m slepcvars config/configure.py /^ slepcvars = open(os.sep.join([confdir,'slepcvariables']),'w')$/;" v slepcversion config/configure.py /^import slepcversion$/;" i slice src/eps/impls/external/blzpack/blzpackp.h /^ PetscBLASInt slice; \/* use spectrum slicing *\/$/;" m struct:__anon1 sn src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscReal sn;$/;" m struct:HRtr file: solve include/slepc-private/dsimpl.h /^ PetscErrorCode (*solve[DS_MAX_SOLVE])(DS,PetscScalar*,PetscScalar*);$/;" m struct:_DSOps solve include/slepc-private/epsimpl.h /^ PetscErrorCode (*solve)(EPS);$/;" m struct:_EPSOps solve include/slepc-private/mfnimpl.h /^ PetscErrorCode (*solve)(MFN,Vec,Vec);$/;" m struct:_MFNOps solve include/slepc-private/nepimpl.h /^ PetscErrorCode (*solve)(NEP);$/;" m struct:_NEPOps solve include/slepc-private/qepimpl.h /^ PetscErrorCode (*solve)(QEP);$/;" m struct:_QEPOps solve include/slepc-private/svdimpl.h /^ PetscErrorCode (*solve)(SVD);$/;" m struct:_SVDOps solver src/eps/examples/tutorials/ex1f90.F90 /^ type(EPS) solver$/;" v program:main solver src/qep/examples/tutorials/ex16f90.F90 /^ type(QEP) solver$/;" v program:main solver_comm_id src/eps/impls/ciss/ciss.c /^ PetscInt solver_comm_id;$/;" m struct:__anon1 file: sort include/slepc-private/dsimpl.h /^ PetscErrorCode (*sort)(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*);$/;" m struct:_DSOps sortRealEigenvalues src/eps/impls/krylov/krylovschur/ks-slice.c /^static PetscErrorCode sortRealEigenvalues(PetscScalar *r,PetscInt *perm,PetscInt nr,PetscBool prev,PetscInt dir)$/;" f file: split include/slepc-private/nepimpl.h /^ PetscBool split; \/* the nonlinear operator has been set in$/;" m struct:_p_NEP spurious_threshold src/eps/impls/ciss/ciss.c /^ PetscReal spurious_threshold; \/* discard spurious eigenpairs *\/$/;" m struct:__anon1 file: sr src/eps/impls/krylov/krylovschur/krylovschur.h /^ SR sr;$/;" m struct:__anon1 st include/slepc-private/epsimpl.h /^ ST st; \/* spectral transformation object *\/$/;" m struct:_p_EPS st include/slepc-private/qepimpl.h /^ ST st; \/* spectral transformation object *\/$/;" m struct:_p_QEP st src/eps/impls/external/blopex/blopex.c /^ ST st;$/;" m struct:__anon1 file: st src/eps/interface/solve.c /^ ST st;$/;" m struct:__anon1 file: st src/qep/interface/qepsolve.c /^ ST st;$/;" m struct:__anon1 file: st src/st/interface/shellmat.c /^ ST st;$/;" m struct:__anon1 file: stages src/eps/impls/davidson/common/dvd_utils.c /^static PetscLogStage stages[6] = {0,0,0,0,0,0};$/;" v file: stappendoptionsprefix_ src/st/interface/ftn-custom/zstf.c /^#define stappendoptionsprefix_ /;" d file: stappendoptionsprefix_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stappendoptionsprefix_(ST *st,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f startList src/eps/impls/davidson/common/davidson.h /^ *startList, \/* starting list *\/$/;" m struct:_dvdDashboard state include/slepc-private/dsimpl.h /^ DSStateType state; \/* the current state *\/$/;" m struct:_p_DS state src/eps/impls/davidson/common/davidson.h /^ PetscInt state; \/* method states:$/;" m struct:__anon6 stcreate_ src/st/interface/ftn-custom/zstf.c /^#define stcreate_ /;" d file: stcreate_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stcreate_(MPI_Fint *comm,ST *newst,PetscErrorCode *ierr)$/;" f stderr config/cmakegen.py /^ from sys import stderr$/;" i stdestroy_ src/st/interface/ftn-custom/zstf.c /^#define stdestroy_ /;" d file: stdestroy_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stdestroy_(ST *st,PetscErrorCode *ierr)$/;" f stgetmatmode_ src/st/interface/ftn-custom/zstf.c /^#define stgetmatmode_ /;" d file: stgetmatmode_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stgetmatmode_(ST *st,STMatMode *mode,PetscErrorCode *ierr)$/;" f stgetoptionsprefix_ src/st/interface/ftn-custom/zstf.c /^#define stgetoptionsprefix_ /;" d file: stgetoptionsprefix_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stgetoptionsprefix_(ST *st,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f stgettype_ src/st/interface/ftn-custom/zstf.c /^#define stgettype_ /;" d file: stgettype_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stgettype_(ST *st,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f stol include/slepc-private/nepimpl.h /^ PetscReal abstol,rtol,stol; \/* user tolerances *\/$/;" m struct:_p_NEP str include/slepc-private/stimpl.h /^ MatStructure str; \/* whether matrices have the same pattern or not *\/$/;" m struct:_p_ST string config/cmakeboot.py /^import os,sys,string$/;" i stripsplit config/cmakegen.py /^ def stripsplit(line):$/;" f function:pkgsources.compareSourceLists stsetoptionsprefix_ src/st/interface/ftn-custom/zstf.c /^#define stsetoptionsprefix_ /;" d file: stsetoptionsprefix_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stsetoptionsprefix_(ST *st,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f stsettype_ src/st/interface/ftn-custom/zstf.c /^#define stsettype_ /;" d file: stsettype_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stsettype_(ST *st,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f stshellgetcontext_ src/st/impls/shell/ftn-custom/zshell.c /^#define stshellgetcontext_ /;" d file: stshellgetcontext_ src/st/impls/shell/ftn-custom/zshell.c /^PETSC_EXTERN void PETSC_STDCALL stshellgetcontext_(ST *st,void **ctx,PetscErrorCode *ierr)$/;" f stshellsetapply_ src/st/impls/shell/ftn-custom/zshell.c /^#define stshellsetapply_ /;" d file: stshellsetapply_ src/st/impls/shell/ftn-custom/zshell.c /^PETSC_EXTERN void PETSC_STDCALL stshellsetapply_(ST *st,void (PETSC_STDCALL *apply)(void*,Vec*,Vec*,PetscErrorCode*),PetscErrorCode *ierr)$/;" f stshellsetapplytranspose_ src/st/impls/shell/ftn-custom/zshell.c /^#define stshellsetapplytranspose_ /;" d file: stshellsetapplytranspose_ src/st/impls/shell/ftn-custom/zshell.c /^PETSC_EXTERN void PETSC_STDCALL stshellsetapplytranspose_(ST *st,void (PETSC_STDCALL *applytranspose)(void*,Vec*,Vec*,PetscErrorCode*),PetscErrorCode *ierr)$/;" f stshellsetbacktransform_ src/st/impls/shell/ftn-custom/zshell.c /^#define stshellsetbacktransform_ /;" d file: stshellsetbacktransform_ src/st/impls/shell/ftn-custom/zshell.c /^PETSC_EXTERN void PETSC_STDCALL stshellsetbacktransform_(ST *st,void (PETSC_STDCALL *backtransform)(void*,PetscScalar*,PetscScalar*,PetscErrorCode*),PetscErrorCode *ierr)$/;" f stview_ src/st/interface/ftn-custom/zstf.c /^#define stview_ /;" d file: stview_ src/st/interface/ftn-custom/zstf.c /^PETSC_EXTERN void PETSC_STDCALL stview_(ST *st,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f svdappendoptionsprefix_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdappendoptionsprefix_ /;" d file: svdappendoptionsprefix_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdappendoptionsprefix_(SVD *svd,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f svdcreate_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdcreate_ /;" d file: svdcreate_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdcreate_(MPI_Fint *comm,SVD *svd,PetscErrorCode *ierr)$/;" f svddestroy_ src/svd/interface/ftn-custom/zsvdf.c /^#define svddestroy_ /;" d file: svddestroy_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svddestroy_(SVD *svd,PetscErrorCode *ierr)$/;" f svdgetconvergedreason_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgetconvergedreason_ /;" d file: svdgetconvergedreason_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgetconvergedreason_(SVD *svd,SVDConvergedReason *reason,PetscErrorCode *ierr)$/;" f svdgetds_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgetds_ /;" d file: svdgetds_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgetds_(SVD *svd,DS *ds,PetscErrorCode *ierr)$/;" f svdgetip_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgetip_ /;" d file: svdgetip_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgetip_(SVD *svd,IP *ip,PetscErrorCode *ierr)$/;" f svdgetoptionsprefix_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgetoptionsprefix_ /;" d file: svdgetoptionsprefix_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgetoptionsprefix_(SVD *svd,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f svdgettransposemode_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgettransposemode_ /;" d file: svdgettransposemode_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgettransposemode_(SVD *svd,SVDTransposeMode *mode,PetscErrorCode *ierr)$/;" f svdgettype_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgettype_ /;" d file: svdgettype_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgettype_(SVD *svd,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f svdgetwhichsingulartriplets_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdgetwhichsingulartriplets_ /;" d file: svdgetwhichsingulartriplets_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdgetwhichsingulartriplets_(SVD *svd,SVDWhich *which,PetscErrorCode *ierr)$/;" f svdmonitorall_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdmonitorall_ /;" d file: svdmonitorall_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void svdmonitorall_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f svdmonitorconverged_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdmonitorconverged_ /;" d file: svdmonitorconverged_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void svdmonitorconverged_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f svdmonitorfirst_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdmonitorfirst_ /;" d file: svdmonitorfirst_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void svdmonitorfirst_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f svdmonitorlg_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdmonitorlg_ /;" d file: svdmonitorlg_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void svdmonitorlg_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f svdmonitorlgall_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdmonitorlgall_ /;" d file: svdmonitorlgall_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void svdmonitorlgall_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)$/;" f svdmonitorset_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdmonitorset_ /;" d file: svdmonitorset_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdmonitorset_(SVD *svd,void (PETSC_STDCALL *monitor)(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode*),PetscErrorCode *ierr)$/;" f svdsetoptionsprefix_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdsetoptionsprefix_ /;" d file: svdsetoptionsprefix_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdsetoptionsprefix_(SVD *svd,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f svdsettype_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdsettype_ /;" d file: svdsettype_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdsettype_(SVD *svd,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))$/;" f svdview_ src/svd/interface/ftn-custom/zsvdf.c /^#define svdview_ /;" d file: svdview_ src/svd/interface/ftn-custom/zsvdf.c /^PETSC_EXTERN void PETSC_STDCALL svdview_(SVD *svd,PetscViewer *viewer,PetscErrorCode *ierr)$/;" f sys config/arpack.py /^import sys$/;" i sys config/blopex.py /^import sys$/;" i sys config/blzpack.py /^import sys$/;" i sys config/check.py /^import sys$/;" i sys config/cmakeboot.py /^import os,sys,string$/;" i sys config/configure.py /^import sys$/;" i sys config/feast.py /^import sys$/;" i sys config/generatefortranstubs.py /^ import sys$/;" i sys config/lapack.py /^import sys$/;" i sys config/log.py /^import sys$/;" i sys config/petscconf.py /^import sys$/;" i sys config/petscversion.py /^import sys$/;" i sys config/primme.py /^import sys$/;" i sys config/slepcversion.py /^import sys$/;" i sys config/trlan.py /^import sys$/;" i sys setup.py /^import sys, os$/;" i t include/slepc-private/dsimpl.h /^ PetscInt t; \/* length of decomposition when it was truncated *\/$/;" m struct:_p_DS t include/slepc-private/epsimpl.h /^ Vec t; \/* template vector *\/$/;" m struct:_p_EPS t include/slepc-private/mfnimpl.h /^ Vec t; \/* template vector *\/$/;" m struct:_p_MFN t include/slepc-private/nepimpl.h /^ Vec t; \/* template vector *\/$/;" m struct:_p_NEP t include/slepc-private/qepimpl.h /^ Vec t; \/* template vector *\/$/;" m struct:_p_QEP tar config/blopex.py /^ tar = tarfile.open(localFile, "r:gz")$/;" v tarball setup.py /^def tarball():$/;" f tarfile config/blopex.py /^ import tarfile$/;" i target include/slepc-private/epsimpl.h /^ PetscScalar target; \/* target value *\/$/;" m struct:_p_EPS target include/slepc-private/nepimpl.h /^ PetscScalar target; \/* target value *\/$/;" m struct:_p_NEP target include/slepc-private/qepimpl.h /^ PetscScalar target; \/* target value *\/$/;" m struct:_p_QEP target src/eps/impls/davidson/common/davidson.h /^ target[2]; \/* target value *\/$/;" m struct:_dvdDashboard target src/eps/impls/external/primme/primme.c /^ PetscReal target; \/* a copy of eps's target *\/$/;" m struct:__anon1 file: tau src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscScalar tau[2];$/;" m struct:HRtr file: tau1 src/eps/examples/tutorials/ex9.c /^ PetscScalar alpha,beta,tau1,tau2,sigma;$/;" m struct:__anon1 file: tau2 src/eps/examples/tutorials/ex9.c /^ PetscScalar alpha,beta,tau1,tau2,sigma;$/;" m struct:__anon1 file: tempfile config/cmakegen.py /^ import tempfile, shutil$/;" i tempfile config/configure.py /^import tempfile$/;" i testConv src/eps/impls/davidson/common/davidson.h /^ PetscBool (*testConv)(struct _dvdDashboard*,PetscScalar eigvr,PetscScalar eigvi,PetscReal res,PetscReal *error);$/;" m struct:_dvdDashboard testConv_data src/eps/impls/davidson/common/davidson.h /^ void *testConv_data;$/;" m struct:_dvdDashboard testruns config/configure.py /^ testruns = testruns.union(set(['C_NoF128']))$/;" v testruns config/configure.py /^ testruns = set(petscconf.TEST_RUNS.split())$/;" v testruns config/configure.py /^ testruns = testruns.intersection(set(['C','F90','Fortran','C_NoComplex','Fortran_NoComplex']))$/;" v theta src/eps/impls/davidson/common/dvd_improvex.c /^ *theta,$/;" m struct:__anon11 file: thetai src/eps/impls/davidson/common/dvd_improvex.c /^ *thetai; \/* the shifts used in the correction eq. *\/$/;" m struct:__anon11 file: time config/configure.py /^import time$/;" i tl include/slepc-private/svdimpl.h /^ Vec tl,tr; \/* template vectors *\/$/;" m struct:_p_SVD tmpdir config/configure.py /^ tmpdir = tempfile.mkdtemp(prefix='slepc-')$/;" v tol include/slepc-private/epsimpl.h /^ PetscReal tol; \/* tolerance *\/$/;" m struct:_p_EPS tol include/slepc-private/mfnimpl.h /^ PetscReal tol; \/* tolerance *\/$/;" m struct:_p_MFN tol include/slepc-private/qepimpl.h /^ PetscReal tol; \/* tolerance *\/$/;" m struct:_p_QEP tol include/slepc-private/svdimpl.h /^ PetscReal tol; \/* tolerance *\/$/;" m struct:_p_SVD tol src/eps/impls/davidson/common/davidson.h /^ PetscReal tol; \/* tolerance *\/$/;" m struct:_dvdDashboard tol src/eps/impls/davidson/common/dvd_improvex.c /^ PetscReal tol, \/* the maximum solution tolerance *\/$/;" m struct:__anon11 file: tol src/eps/impls/external/blopex/blopex.c /^ lobpcg_Tolerance tol;$/;" m struct:__anon1 file: tr include/slepc-private/svdimpl.h /^ Vec tl,tr; \/* template vectors *\/$/;" m struct:_p_SVD trackall include/slepc-private/epsimpl.h /^ PetscBool trackall; \/* whether all the residuals must be computed *\/$/;" m struct:_p_EPS trackall include/slepc-private/nepimpl.h /^ PetscBool trackall; \/* whether all the residuals must be computed *\/$/;" m struct:_p_NEP trackall include/slepc-private/qepimpl.h /^ PetscBool trackall; \/* whether all the residuals must be computed *\/$/;" m struct:_p_QEP trackall include/slepc-private/svdimpl.h /^ PetscBool trackall;$/;" m struct:_p_SVD transharm include/slepc-private/dsimpl.h /^ PetscErrorCode (*transharm)(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*);$/;" m struct:_DSOps transmode include/slepc-private/svdimpl.h /^ SVDTransposeMode transmode; \/* transpose mode *\/$/;" m struct:_p_SVD transrks include/slepc-private/dsimpl.h /^ PetscErrorCode (*transrks)(DS,PetscScalar);$/;" m struct:_DSOps trlan config/configure.py /^import trlan$/;" i trlandir config/configure.py /^ trlandir = i.split('=')[1]$/;" v trlandir config/configure.py /^trlandir = ''$/;" v trlanlibs config/configure.py /^ trlanlibs = i.split('=')[1].split(',')$/;" v trlanlibs config/configure.py /^ trlanlibs = trlan.Check(slepcconf,slepcvars,cmake,tmpdir,trlandir,trlanlibs)$/;" v trlanlibs config/configure.py /^trlanlibs = []$/;" v trueres include/slepc-private/epsimpl.h /^ PetscBool trueres; \/* whether the true residual norm must be computed *\/$/;" m struct:_p_EPS truncate include/slepc-private/dsimpl.h /^ PetscErrorCode (*truncate)(DS,PetscInt);$/;" m struct:_DSOps ttol include/slepc-private/nepimpl.h /^ PetscReal ttol; \/* tolerance used in the convergence criterion *\/$/;" m struct:_p_NEP tv src/eps/examples/tests/test8.c /^static void tv(int nx,const PetscScalar *x,PetscScalar *y)$/;" f file: tv src/eps/examples/tutorials/ex3.c /^static void tv(int nx,const PetscScalar *x,PetscScalar *y)$/;" f file: type src/ds/impls/ghiep/dsghiep_ivit.c /^ PetscInt type;$/;" m struct:HRtr file: u src/eps/impls/davidson/common/dvd_improvex.c /^ *u, \/* new X vectors *\/$/;" m struct:__anon11 file: u src/eps/impls/external/blzpack/blzpackp.h /^ PetscScalar *u;$/;" m struct:__anon1 unexpected config/cmakegen.py /^ def unexpected():$/;" f function:cmakeconditional update include/slepc-private/dsimpl.h /^ PetscErrorCode (*update)(DS);$/;" m struct:_DSOps updateV src/eps/impls/davidson/common/davidson.h /^ PetscErrorCode (*updateV)(struct _dvdDashboard*);$/;" m struct:_dvdDashboard updateV_data src/eps/impls/davidson/common/davidson.h /^ void *updateV_data;$/;" m struct:_dvdDashboard update_omega src/eps/impls/krylov/lanczos/lanczos.c /^static void update_omega(PetscReal *omega,PetscReal *omega_old,PetscInt j,PetscReal *alpha,PetscReal *beta,PetscReal eps1,PetscReal anorm)$/;" f file: url setup.py /^ url='http:\/\/www.grycap.upv.es\/slepc\/',$/;" v urllib config/blopex.py /^import urllib$/;" i urlparse config/blopex.py /^import urlparse$/;" i useconj src/eps/impls/ciss/ciss.c /^ PetscBool useconj;$/;" m struct:__anon1 file: user src/eps/impls/davidson/common/dvd_initv.c /^ user; \/* number of user initial vectors *\/$/;" m struct:__anon12 file: v src/eps/impls/external/blzpack/blzpackp.h /^ PetscScalar *v;$/;" m struct:__anon1 value src/eps/impls/krylov/krylovschur/krylovschur.h /^ PetscReal value;$/;" m struct:_n_shift vectors include/slepc-private/dsimpl.h /^ PetscErrorCode (*vectors)(DS,DSMatType,PetscInt*,PetscReal*);$/;" m struct:_DSOps version setup.py /^ version=version(),$/;" v version setup.py /^def version():$/;" f view include/slepc-private/dsimpl.h /^ PetscErrorCode (*view)(DS,PetscViewer);$/;" m struct:_DSOps view include/slepc-private/epsimpl.h /^ PetscErrorCode (*view)(EPS,PetscViewer);$/;" m struct:_EPSOps view include/slepc-private/fnimpl.h /^ PetscErrorCode (*view)(FN,PetscViewer);$/;" m struct:_FNOps view include/slepc-private/mfnimpl.h /^ PetscErrorCode (*view)(MFN,PetscViewer);$/;" m struct:_MFNOps view include/slepc-private/nepimpl.h /^ PetscErrorCode (*view)(NEP,PetscViewer);$/;" m struct:_NEPOps view include/slepc-private/qepimpl.h /^ PetscErrorCode (*view)(QEP,PetscViewer);$/;" m struct:_QEPOps view include/slepc-private/stimpl.h /^ PetscErrorCode (*view)(ST,PetscViewer);$/;" m struct:_STOps view include/slepc-private/svdimpl.h /^ PetscErrorCode (*view)(SVD,PetscViewer);$/;" m struct:_SVDOps viewer include/slepc-private/slepcimpl.h /^ PetscViewer viewer;$/;" m struct:_n_SlepcConvMonitor vscale src/eps/impls/ciss/ciss.c /^ PetscReal vscale; \/* vertical scale of the region (1.0; 0.1 if spectrum real) *\/$/;" m struct:__anon1 file: w include/slepc-private/stimpl.h /^ Vec w;$/;" m struct:_p_ST w src/eps/impls/external/blopex/blopex.c /^ Vec w;$/;" m struct:__anon1 file: w src/svd/impls/cross/cross.c /^ Vec w,diag;$/;" m struct:__anon1 file: w2 src/st/impls/cayley/cayley.c /^ Vec w2;$/;" m struct:__anon1 file: w2 src/st/impls/fold/fold.c /^ Vec w2;$/;" m struct:__anon1 file: wS src/eps/impls/davidson/common/davidson.c /^ PetscScalar *wS;$/;" m struct:__anon1 file: wV src/eps/impls/davidson/common/davidson.c /^ Vec *wV;$/;" m struct:__anon1 file: wb include/slepc-private/stimpl.h /^ Vec wb; \/* balancing requires an extra work vector *\/$/;" m struct:_p_ST weight src/eps/impls/ciss/ciss.c /^ PetscScalar *weight;$/;" m struct:__anon1 file: which include/slepc-private/epsimpl.h /^ EPSWhich which; \/* which part of the spectrum to be sought *\/$/;" m struct:_p_EPS which include/slepc-private/nepimpl.h /^ NEPWhich which; \/* which part of the spectrum to be sought *\/$/;" m struct:_p_NEP which include/slepc-private/qepimpl.h /^ QEPWhich which; \/* which part of the spectrum to be sought *\/$/;" m struct:_p_QEP which include/slepc-private/svdimpl.h /^ SVDWhich which; \/* which singular values are computed *\/$/;" m struct:_p_SVD which src/eps/impls/davidson/common/davidson.h /^ EPSWhich which; \/* spectrum selection *\/$/;" m struct:_dvdDashboard withTarget src/eps/impls/davidson/common/davidson.h /^ withTarget; \/* if there is a target *\/$/;" m struct:_dvdDashboard withTarget src/eps/impls/davidson/common/dvd_utils.c /^ withTarget;$/;" m struct:__anon17 file: work include/slepc-private/dsimpl.h /^ PetscScalar *work;$/;" m struct:_p_DS work include/slepc-private/epsimpl.h /^ Vec *work;$/;" m struct:_p_EPS work include/slepc-private/ipimpl.h /^ PetscScalar *work;$/;" m struct:_p_IP work include/slepc-private/mfnimpl.h /^ Vec *work;$/;" m struct:_p_MFN work include/slepc-private/nepimpl.h /^ Vec *work;$/;" m struct:_p_NEP work include/slepc-private/qepimpl.h /^ Vec *work;$/;" m struct:_p_QEP work src/eps/impls/external/trlan/trlanp.h /^ PetscReal *work;$/;" m struct:__anon1 work1 src/eps/impls/external/feast/feastp.h /^ PetscScalar *work1,*work2,*Aq,*Bq; \/* workspace *\/$/;" m struct:__anon1 work2 src/eps/impls/external/feast/feastp.h /^ PetscScalar *work1,*work2,*Aq,*Bq; \/* workspace *\/$/;" m struct:__anon1 workd src/eps/impls/external/arpack/arpackp.h /^ PetscScalar *workd;$/;" m struct:__anon1 workev src/eps/impls/external/arpack/arpackp.h /^ PetscScalar *workev;$/;" m struct:__anon1 workl src/eps/impls/external/arpack/arpackp.h /^ PetscScalar *workl;$/;" m struct:__anon1 write config/cmakeboot.py /^ def write(self,str):$/;" m class:StdoutLogger write config/cmakegen.py /^ def write(self,str):$/;" m class:StdoutLogger write config/log.py /^def write(string):$/;" f writePackage config/cmakegen.py /^def writePackage(f,pkg,pkgdeps):$/;" f writeRoot config/cmakegen.py /^def writeRoot(f,petscdir,petscarch):$/;" f written config/cmakegen.py /^ written = True$/;" v x include/slepc-private/vecimplslepc.h /^ Vec *x; \/* the vectors *\/$/;" m struct:__anon3 x src/eps/impls/external/primme/primme.c /^ Vec x,y; \/* auxiliary vectors *\/$/;" m struct:__anon1 file: x1 src/eps/examples/tutorials/ex9.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: x1 src/qep/impls/linear/linearp.h /^ Vec x1,x2,y1,y2; \/* work vectors *\/$/;" m struct:__anon1 x1 src/svd/impls/cyclic/cyclic.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: x2 src/eps/examples/tutorials/ex9.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: x2 src/qep/impls/linear/linearp.h /^ Vec x1,x2,y1,y2; \/* work vectors *\/$/;" m struct:__anon1 x2 src/svd/impls/cyclic/cyclic.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: xid include/slepc-private/ipimpl.h /^ PetscInt xid;$/;" m struct:_p_IP xstate include/slepc-private/ipimpl.h /^ PetscInt xstate;$/;" m struct:_p_IP y src/eps/impls/external/primme/primme.c /^ Vec x,y; \/* auxiliary vectors *\/$/;" m struct:__anon1 file: y1 src/eps/examples/tutorials/ex9.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: y1 src/qep/impls/linear/linearp.h /^ Vec x1,x2,y1,y2; \/* work vectors *\/$/;" m struct:__anon1 y1 src/svd/impls/cyclic/cyclic.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: y2 src/eps/examples/tutorials/ex9.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: y2 src/qep/impls/linear/linearp.h /^ Vec x1,x2,y1,y2; \/* work vectors *\/$/;" m struct:__anon1 y2 src/svd/impls/cyclic/cyclic.c /^ Vec x1,x2,y1,y2;$/;" m struct:__anon1 file: z src/st/interface/shellmat.c /^ Vec z;$/;" m struct:__anon1 file: slepc-3.4.2.dfsg.orig/makefile0000644000175000017500000004567012211062077015147 0ustar gladkgladk# # This is the makefile for installing SLEPc. See the Users Manual # for directions on installing SLEPc. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ALL: all LOCDIR = . DIRS = src include docs # Include the rest of makefiles include ${SLEPC_DIR}/conf/slepc_common # # Basic targets to build SLEPc library all: chk_makej @${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} chk_petscdir chk_slepcdir | tee ${PETSC_ARCH}/conf/make.log @if [ "${SLEPC_BUILD_USING_CMAKE}" != "" ]; then \ if [ "${SLEPC_DESTDIR}" = "${SLEPC_DIR}/${PETSC_ARCH}" ]; then \ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} cmakegen; \ fi; \ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} all-cmake 2>&1 | tee ${PETSC_ARCH}/conf/make.log \ | egrep -v '( --check-build-system |cmake -E | -o CMakeFiles/slepc[[:lower:]]*.dir/| -o lib/libslepc|CMakeFiles/slepc[[:lower:]]*\.dir/(build|depend|requires)|-f CMakeFiles/Makefile2|Dependee .* is newer than depender |provides\.build. is up to date)'; \ else \ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} all-legacy 2>&1 | tee ${PETSC_ARCH}/conf/make.log | ${GREP} -v "has no symbols"; \ fi @egrep -i "( error | error: |no such file or directory)" ${PETSC_ARCH}/conf/make.log | tee ${PETSC_ARCH}/conf/error.log > /dev/null @if test -s ${PETSC_ARCH}/conf/error.log; then \ printf ${PETSC_TEXT_HILIGHT}"*******************************ERROR************************************\n"; \ echo " Error during compile, check ${PETSC_ARCH}/conf/make.log "; \ echo " Send all contents of ${PETSC_ARCH}/conf to slepc-maint@grycap.upv.es ";\ printf "************************************************************************"${PETSC_TEXT_NORMAL}"\n"; \ elif [ "${SLEPC_DESTDIR}" = "${SLEPC_DIR}/${PETSC_ARCH}" ]; then \ echo "Now to check if the library is working do: make test";\ echo "=========================================";\ else \ echo "Now to install the library do:";\ echo "make SLEPC_DIR=${PWD} PETSC_DIR=${PETSC_DIR} PETSC_ARCH=arch-installed-petsc install";\ echo "=========================================";\ fi @if test -s ${PETSC_ARCH}/conf/error.log; then exit 1; fi cmakegen: -@${PYTHON} config/cmakegen.py all-cmake: chk_makej info cmakegen slepc_cmake all-legacy: chk_makej chk_petsc_dir chk_slepc_dir chklib_dir info deletelibs deletemods build slepc_shared # # Prints information about the system and version of SLEPc being compiled # info: chk_makej -@echo "==========================================" -@echo On `date` on `hostname` -@echo Machine characteristics: `uname -a` -@echo "-----------------------------------------" -@echo "Using SLEPc directory: ${SLEPC_DIR}" -@echo "Using PETSc directory: ${PETSC_DIR}" -@echo "Using PETSc arch: ${PETSC_ARCH}" -@echo "-----------------------------------------" -@grep "define SLEPC_VERSION" ${SLEPC_DIR}/include/slepcversion.h | ${SED} "s/........//" -@echo "-----------------------------------------" -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" -@echo "-----------------------------------------" -@echo "Using PETSc configure options: ${CONFIGURE_OPTIONS}" -@echo "Using SLEPc configuration flags:" -@cat ${SLEPC_DIR}/${PETSC_ARCH}/conf/slepcvariables -@grep "\#define " ${SLEPC_DIR}/${PETSC_ARCH}/include/slepcconf.h -@echo "Using PETSc configuration flags:" -@if [ "${PETSC_ARCH}" != "arch-installed-petsc" ]; then \ grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h; \ else \ grep "\#define " ${PETSC_DIR}/include/petscconf.h; \ fi -@echo "-----------------------------------------" -@echo "Using C/C++ include paths: ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES}" -@echo "Using C/C++ compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}" -@if [ "${FC}" != "" ]; then \ echo "Using Fortran include/module paths: ${PETSC_FC_INCLUDES}";\ echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\ fi -@echo "-----------------------------------------" -@echo "Using C/C++ linker: ${PCC_LINKER}" -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" -@if [ "${FC}" != "" ]; then \ echo "Using Fortran linker: ${FC_LINKER}";\ echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ fi -@echo "-----------------------------------------" -@echo "Using libraries: ${SLEPC_LIB}" -@echo "------------------------------------------" -@echo "Using mpiexec: ${MPIEXEC}" -@echo "==========================================" # # Builds the SLEPc library # build: chk_makej -@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES" -@echo "=========================================" -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} ACTION=libfast slepc_tree -@${RANLIB} ${SLEPC_LIB_DIR}/*.${AR_LIB_SUFFIX} > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf; -@echo "Completed building libraries" -@echo "=========================================" # Simple test examples for checking a correct installation check: test test: -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/conf/test.log test_build: -@echo "Running test examples to verify correct installation" -@echo "Using SLEPC_DIR=${SLEPC_DIR}, PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" @cd src/eps/examples/tests; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} testtest10 @if [ "${FC}" != "" ]; then cd src/eps/examples/tests; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} testtest7f; fi; -@if [ "${BLOPEX_LIB}" != "" ]; then cd src/eps/examples/tests; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} testtest5_blopex; fi; -@echo "Completed test examples" # Builds SLEPc test examples for C testexamples: info -@echo "BEGINNING TO COMPILE AND RUN SLEPc TEST EXAMPLES" -@echo "Due to different numerical round-off on certain" -@echo "machines some of the numbers may not match exactly." -@echo "=========================================" -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} \ ACTION=testexamples_C slepc_tree -@echo "Completed compiling and running test examples" -@echo "=========================================" # Builds SLEPc test examples for Fortran testfortran: info -@echo "BEGINNING TO COMPILE AND RUN SLEPc FORTRAN TEST EXAMPLES" -@echo "=========================================" -@echo "Due to different numerical round-off on certain" -@echo "machines or the way Fortran formats numbers" -@echo "some of the results may not match exactly." -@echo "=========================================" -@if [ "${FC}" != "" ]; then \ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} \ ACTION=testexamples_Fortran slepc_tree ; \ echo "Completed compiling and running Fortran test examples"; \ else \ echo "Error: No FORTRAN compiler available"; \ fi -@echo "=========================================" # Test BLOPEX use testblopex: -@echo "BEGINNING TO COMPILE AND RUN SLEPc BLOPEX TEST EXAMPLES" -@echo "=========================================" -@echo "Due to different numerical round-off on certain" -@echo "machines some of the results may not match exactly." -@echo "=========================================" -@if [ "${BLOPEX_LIB}" != "" ]; then \ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} \ ACTION=testexamples_BLOPEX slepc_tree ; \ echo "Completed compiling and running BLOPEX test examples"; \ else \ echo "Error: SLEPc has not been configured with BLOPEX"; \ fi -@echo "=========================================" # Ranlib on the library ranlib: ${RANLIB} ${SLEPC_LIB_DIR}/*.${AR_LIB_SUFFIX} # Deletes SLEPc library deletelibs: chk_makej -${RM} -r ${SLEPC_LIB_DIR}/libslepc*.* deletemods: chk_makej -${RM} -f ${SLEPC_DIR}/${PETSC_ARCH}/include/slepc*.mod # Cleans up build allclean: deletelibs deletemods -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} ACTION=clean slepc_tree # # Check if PETSC_DIR variable specified is valid # chk_petsc_dir: @if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \ printf ${PETSC_TEXT_HILIGHT}"*************************ERROR**************************************\n"; \ echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}! "; \ echo "You need to use / to separate directories, not \\! "; \ echo "Aborting build "; \ printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n"; \ false; fi # # Check if SLEPC_DIR variable specified is valid # chk_slepc_dir: @if [ ! -f ${SLEPC_DIR}/include/slepcversion.h ]; then \ printf ${PETSC_TEXT_HILIGHT}"*************************ERROR**************************************\n"; \ echo "Incorrect SLEPC_DIR specified: ${SLEPC_DIR}! "; \ echo "You need to use / to separate directories, not \\! "; \ echo "Aborting build "; \ printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n"; \ false; fi # # Install relevant files in the prefix directory # install: -@if [ "${PETSC_ARCH}" = "" ]; then \ echo "PETSC_ARCH is undefined";\ elif [ "${SLEPC_DESTDIR}" = "${SLEPC_DIR}/${PETSC_ARCH}" ]; then \ echo "Install directory is current directory; nothing needs to be done";\ else \ echo Installing SLEPc at ${SLEPC_DESTDIR};\ if [ ! -d `dirname ${SLEPC_DESTDIR}` ]; then \ ${MKDIR} `dirname ${SLEPC_DESTDIR}` ; \ fi;\ if [ ! -d ${SLEPC_DESTDIR} ]; then \ ${MKDIR} ${SLEPC_DESTDIR} ; \ fi;\ if [ ! -d ${SLEPC_DESTDIR}/include ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/include ; \ fi;\ cp -f include/*.h ${SLEPC_DESTDIR}/include;\ cp -f ${PETSC_ARCH}/include/*.h ${SLEPC_DESTDIR}/include;\ if [ -f ${PETSC_ARCH}/include/slepceps.mod ]; then \ cp -f ${PETSC_ARCH}/include/*.mod ${SLEPC_DESTDIR}/include;\ fi;\ if [ ! -d ${SLEPC_DESTDIR}/include/finclude ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/include/finclude ; \ fi;\ cp -f include/finclude/*.h* ${SLEPC_DESTDIR}/include/finclude;\ if [ -d include/finclude/ftn-auto ]; then \ if [ ! -d ${SLEPC_DESTDIR}/include/finclude/ftn-auto ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/include/finclude/ftn-auto ; \ fi;\ cp -f include/finclude/ftn-auto/*.h90 ${SLEPC_DESTDIR}/include/finclude/ftn-auto;\ fi;\ if [ ! -d ${SLEPC_DESTDIR}/include/finclude/ftn-custom ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/include/finclude/ftn-custom ; \ fi;\ cp -f include/finclude/ftn-custom/*.h90 ${SLEPC_DESTDIR}/include/finclude/ftn-custom;\ if [ ! -d ${SLEPC_DESTDIR}/include/slepc-private ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/include/slepc-private ; \ fi;\ cp -f include/slepc-private/*.h ${SLEPC_DESTDIR}/include/slepc-private;\ if [ ! -d ${SLEPC_DESTDIR}/conf ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/conf ; \ fi;\ for dir in bin bin/matlab bin/matlab/classes; \ do \ if [ ! -d ${SLEPC_DESTDIR}/$$dir ]; then ${MKDIR} ${SLEPC_DESTDIR}/$$dir; fi;\ done; \ for dir in bin/matlab/classes; \ do \ cp -f $$dir/*.m ${SLEPC_DESTDIR}/$$dir;\ done; \ cp -f bin/matlab/classes/slepcmatlabheader.h ${SLEPC_DESTDIR}/bin/matlab/classes;\ cp -f conf/slepc_* ${SLEPC_DESTDIR}/conf;\ cp -f ${PETSC_ARCH}/conf/slepcvariables ${SLEPC_DESTDIR}/conf;\ cp -f ${PETSC_ARCH}/conf/slepcrules ${SLEPC_DESTDIR}/conf;\ if [ ! -d ${SLEPC_DESTDIR}/lib ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/lib ; \ fi;\ if [ -d ${PETSC_ARCH}/lib ]; then \ if [ -f ${PETSC_ARCH}/lib/libslepc.${AR_LIB_SUFFIX} ]; then \ cp -f ${PETSC_ARCH}/lib/*.${AR_LIB_SUFFIX} ${SLEPC_DESTDIR}/lib; \ ${RANLIB} ${SLEPC_DESTDIR}/lib/*.${AR_LIB_SUFFIX} ; \ ${OMAKE} PETSC_DIR=${PETSC_DIR} PETSC_ARCH="" SLEPC_DIR=${SLEPC_DESTDIR} OTHERSHAREDLIBS="${PETSC_KSP_LIB} ${SLEPC_EXTERNAL_LIB}" shared; \ elif [ -f ${PETSC_ARCH}/lib/libslepc.${SL_LINKER_SUFFIX} ]; then \ cp -f ${PETSC_ARCH}/lib/*.${SL_LINKER_SUFFIX} ${SLEPC_DESTDIR}/lib; \ fi; \ fi;\ if [ ! -d ${SLEPC_DESTDIR}/lib/modules ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/lib/modules ; \ fi;\ if [ -d ${PETSC_ARCH}/lib/modules ]; then \ cp -f ${PETSC_ARCH}/lib/modules/* ${SLEPC_DESTDIR}/lib/modules; \ fi;\ if [ ! -d ${SLEPC_DESTDIR}/lib/pkgconfig ]; then \ ${MKDIR} ${SLEPC_DESTDIR}/lib/pkgconfig ; \ fi;\ if [ -d ${PETSC_ARCH}/lib/pkgconfig ]; then \ cp -f ${PETSC_ARCH}/lib/pkgconfig/SLEPc.pc ${SLEPC_DESTDIR}/lib/pkgconfig; \ fi;\ echo "====================================";\ echo "Install complete.";\ echo "It is usable with SLEPC_DIR=${SLEPC_DESTDIR} PETSC_DIR=${PETSC_DIR} [and no more PETSC_ARCH].";\ echo "Run the following to verify the install (in current directory):";\ echo "make SLEPC_DIR=${SLEPC_DESTDIR} PETSC_DIR=${PETSC_DIR} test";\ echo "====================================";\ fi; # ------------------------------------------------------------------ # # All remaining actions are intended for SLEPc developers only. # SLEPc users should not generally need to use these commands. # # Builds all the documentation alldoc: alldoc1 alldoc2 # Build everything that goes into 'doc' dir except html sources alldoc1: chk_loc deletemanualpages -${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC} -@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap -@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap -${OMAKE} ACTION=slepc_manualpages tree_basic LOC=${LOC} -${PYTHON} ${PETSC_DIR}/bin/maint/wwwindex.py ${SLEPC_DIR} ${LOC} -${OMAKE} ACTION=slepc_manexamples tree_basic LOC=${LOC} # Builds .html versions of the source alldoc2: chk_loc -${OMAKE} ACTION=slepc_html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} cp ${LOC}/docs/manual.htm ${LOC}/docs/index.html # Deletes documentation alldocclean: deletemanualpages allcleanhtml deletemanualpages: chk_loc -@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \ find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\ ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\ fi allcleanhtml: -${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree # Builds Fortran stub files allfortranstubs: -@${RM} -rf include/finclude/ftn-auto/*-tmpdir -@${PYTHON} ${SLEPC_DIR}/config/generatefortranstubs.py ${BFORT} -@${PYTHON} ${SLEPC_DIR}/config/generatefortranstubs.py -merge ${VERBOSE} -@${RM} -rf include/finclude/ftn-auto/*-tmpdir deletefortranstubs: -@find . -type d -name ftn-auto | xargs rm -rf # ------------------------------------------------------------------------------- # # Some macros to check if the Fortran interface is up-to-date. # countfortranfunctions: -@for D in `find ${SLEPC_DIR}/src -name ftn-auto` \ `find ${SLEPC_DIR}/src -name ftn-custom`; do cd $$D; \ egrep '^void' *.c | \ cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f3 | uniq | egrep -v "(^$$|Petsc)" | \ sed "s/_$$//"; done | sort > /tmp/countfortranfunctions countcfunctions: -@ ls ${SLEPC_DIR}/include/*.h | grep -v slepcblaslapack.h | \ xargs grep extern | grep "(" | tr -s ' ' | \ cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ tr 'A-Z' 'a-z' | sort > /tmp/countcfunctions difffortranfunctions: countfortranfunctions countcfunctions -@echo -------------- Functions missing in the Fortran interface --------------------- -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 -@echo ----------------- Functions missing in the C interface ------------------------ -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions checkbadfortranstubs: -@echo "=========================================" -@echo "Functions with MPI_Comm as an Argument" -@echo "=========================================" -@for D in `find ${SLEPC_DIR}/src -name ftn-auto`; do cd $$D; \ grep '^void' *.c | grep 'MPI_Comm' | \ tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3; done -@echo "=========================================" -@echo "Functions with a String as an Argument" -@echo "=========================================" -@for D in `find ${SLEPC_DIR}/src -name ftn-auto`; do cd $$D; \ grep '^void' *.c | grep 'char \*' | \ tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3; done -@echo "=========================================" -@echo "Functions with Pointers to PETSc Objects as Argument" -@echo "=========================================" -@_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ _p_OBJS=`grep _p_ ${SLEPC_DIR}/include/*.h | tr -s ' ' | \ cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ for D in `find ${SLEPC_DIR}/src -name ftn-auto`; do cd $$D; \ for OBJ in $$_p_OBJ $$_p_OBJS; do \ grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ cut -d'(' -f1 | cut -d' ' -f1,4; \ done; done # Generate tags with PETSc's script alletags: -@${PYTHON} ${PETSC_DIR}/bin/maint/generateetags.py -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON slepc-3.4.2.dfsg.orig/README0000644000175000017500000001146612211062077014323 0ustar gladkgladk SLEPc: Scalable Library for Eigenvalue Problem Computations =========================================================== Carmen Campos Jose E. Roman Eloy Romero Andres Tomas Universitat Politecnica de Valencia, Spain VERSION: 3.4 Overview -------- SLEPc, the Scalable Library for Eigenvalue Problem Computations, is a software package for the solution of large sparse eigenvalue problems on parallel computers. It can be used for the solution of problems formulated in either standard or generalized form, as well as other related problems such as the singular value decomposition and the quadratic eigenproblem. The emphasis of the software is on methods and techniques appropriate for problems in which the associated matrices are sparse, for example, those arising after the discretization of partial differential equations. Therefore, most of the methods offered by the library are projection methods or other methods with similar properties. Some of these methods are Krylov-Schur and Jacobi-Davidson, to name a few. SLEPc implements these basic methods as well as more sophisticated algorithms. It also provides built-in support for spectral transformations such as shift-and-invert. SLEPc is a general library in the sense that it covers standard and genralized eigenvalue problems, both Hermitian and non-Hermitian, with either real or complex arithmetic. SLEPc is built on top of PETSc, the Portable Extensible Toolkit for Scientific Computation (http://www.mcs.anl.gov/petsc). It can be considered an extension of PETSc providing all the functionality necessary for the solution of eigenvalue problems. This means that PETSc must be previously installed in order to use SLEPc. PETSc users will find SLEPc very easy to use, since it enforces the same programming paradigm. For those users which are not familiar with PETSc yet, our recommendation is to fully understand its basic concepts before proceeding with SLEPc. Documentation ------------- The Users Manual is included in the SLEPc distribution file. It can be found in directory 'docs' and it contains a general description of the capabilities of the software. The manual does not include detailed reference information about individual SLEPc routines. This information is provided in the form of man pages in HTML format (see 'docs/manual.htm'). The following journal article provides a general description of SLEPc: [1] V. Hernandez, J. E. Roman and V. Vidal (2005), SLEPc: A Scalable and Flexible Toolkit for the Solution of Eigenvalue Problems, ACM Trans. Math. Softw. 31(3), 351-362. Installation ------------ The installation procedure of SLEPc is very similar to that of PETSc. Briefly, the environment variable $SLEPC_DIR must be set, then the script 'configure' is executed and finally the libraries are built with the command 'make'. For this to work correctly, variable $PETSC_DIR must also be set appropriately. More detailed information about installation can be found in the Users Manual or in the SLEPc home page, including instructions for configuring SLEPc to use external libraries such as ARPACK. More Information ---------------- Additional information can be found in the SLEPc home page at the following address: http://www.grycap.upv.es/slepc Among other things, this site includes information about: - How to contact the authors for support. - Software download. - On-line documentation. - Mailing list for announcement of new releases. All questions/comments should be directed to slepc-maint@grycap.upv.es. Acknowledgements ---------------- The development of SLEPc has been partially supported by the following grants: - Oficina de Ciencia i Tecnologia, Generalitat Valenciana, CTIDB/2002/54. - Direccio General d'Investigacio i Transferencia de Tecnologia, Generalitat Valenciana, GV06/091. - Ministerio de Ciencia e Innovacion, TIN2009-07519. Conditions of Use ----------------- Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain SLEPc is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU Lesser General Public License as published by the Free Software Foundation. SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with SLEPc. If not, see . slepc-3.4.2.dfsg.orig/share/0000755000175000017500000000000012214143515014535 5ustar gladkgladkslepc-3.4.2.dfsg.orig/share/slepc/0000755000175000017500000000000012211062077015643 5ustar gladkgladkslepc-3.4.2.dfsg.orig/share/slepc/datafiles/0000755000175000017500000000000012211062077017577 5ustar gladkgladkslepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/0000755000175000017500000000000012211062077021406 5ustar gladkgladkslepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/rdb200.petsc0000644000175000017500000003366012211062077023447 0ustar gladkgladk{PÈÈ`       ! " #$%&'()*+,-./0 1  2 !3  !"4  !#5 "#$6!"#%7"$%&8#$%'9$&':%&';()*<()+=(*+,>)*+-?*,-.@+,-/A,./0B-./1C.012D/013E0234F1235G 2456H!3457I"4678J#5679K$689:L%789;M&8:;N'9:;O(<=>P)<=?Q*<>?@R+=>?AS,>@ABT-?@ACU.@BCDV/ABCEW0BDEFX1CDEGY2DFGHZ3EFGI[4FHIJ\5GHIK]6HJKL^7IJKM_8JLMN`9KLMOa:LNOb;MNOc<PQRd=PQSe>PRSTf?QRSUg@RTUVhASTUWiBTVWXjCUVWYkDVXYZlEWXY[mFXZ[\nGYZ[]oHZ\]^pI[\]_qJ\^_`rK]^_asL^`abtM_`acuN`bcvOabcwPdefxQdegyRdfghzSefgi{Tfhij|Ughik}Vhjkl~WijkmXjlmn€YklmoZlnop‚[mnoqƒ\npqr„]opqs…^prst†_qrsu‡`rtuvˆastuw‰btvwŠcuvw‹dxyzŒexy{fxz{|Žgyz{}hz|}~i{|}‘j|~€’k}~“l~€‚”m€ƒ•n€‚ƒ„–o‚ƒ…—p‚„…†˜qƒ„…‡™r„†‡ˆšs…†‡‰›t†ˆ‰Šœu‡ˆ‰‹vˆŠ‹žw‰Š‹ŸxŒŽ yŒ¡zŒŽ¢{Ž‘£|Ž‘’¤}‘“¥~’“”¦‘’“•§€’”•–¨“”•—©‚”–—˜ªƒ•–—™«„–˜™š¬…—˜™›­†˜š›œ®‡™š›¯ˆšœž°‰›œŸ±ŠœžŸ²‹žŸ³Œ ¡¢´ ¡£µŽ ¢£¤¶¡¢£¥·¢¤¥¦¸‘£¤¥§¹’¤¦§¨º“¥¦§©»”¦¨©ª¼•§¨©«½–¨ª«¬¾—©ª«­¿˜ª¬­®À™«¬­¯Á𬮝°Â›­®¯±Ãœ®°±²Ä¯°±³Åž°²³ÆŸ±²³Ç ´µ¶¡´µ·¢´¶·¸£µ¶·¹¤¶¸¹º¥·¸¹»¦¸º»¼§¹º»½¨º¼½¾©»¼½¿ª¼¾¿À«½¾¿Á¬¾ÀÁ­¿ÀÁîÀÂÃįÁÂÃŰÂÄÅÆ±ÃÄÅÇ²ÄÆÇ³ÅÆÇÀ Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@?þùÛ"Ðå`@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°@ùÛ"Ðå`?þùÛ"Ðå`?þùÛ"Ðå`À Z¬1'@@ùÛ"Ðå`@ùÛ"Ðå`@À3|í‘hr°slepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/speaker107m.petsc0000644000175000017500000005051012211062077024506 0ustar gladkgladk{Pkk¡                      !  !" !"# "#$ #$  !%&  !"%&' !"#&'( "#$'() #$()  !%&*+  !"%&'*+, !"#&'(+,-"#$'(),-.#$()-.%&*+%&'*+,&'(+,-'(),-.()-.  !/045  !"/01456 !"#012567 "#$123678 #$2378  !%&/0459:  !"%&'/014569:; !"#&'(012567:;< "#$'()123678;<= #$()2378<=  !%&*+459:>?  !"%&'*+,4569:;>?@ !"#&'(+,-567:;<?@A"#$'(),-.678;<=@AB#$()-.78<=AB%&*+9:>?%&'*+,9:;>?@&'(+,-:;<?@A'(),-.;<=@AB()-.<=AB !/045CDHI !"/01456CDEHIJ!"#012567DEFIJK"#$123678EFGJKL#$2378FGKL !%&/0459:CDHIMN !"%&'/014569:;CDEHIJMNO!"#&'(012567:;<DEFIJKNOP"#$'()123678;<=EFGJKLOPQ#$()2378<=FGKLPQ !%&*+459:>?HIMNRS !"%&'*+,4569:;>?@HIJMNORST!"#&'(+,-567:;<?@AIJKNOPSTU"#$'(),-.678;<=@ABJKLOPQTUV#$()-.78<=ABKLPQUV%&*+9:>?MNRS%&'*+,9:;>?@MNORST&'(+,-:;<?@ANOPSTU'(),-.;<=@ABOPQTUV()-.<=ABPQUV/045CDHIWX\]/01456CDEHIJWXY\]^012567DEFIJKXYZ]^_123678EFGJKLYZ[^_`2378FGKLZ[_`/0459:CDHIMNWX\]ab/014569:;CDEHIJMNOWXY\]^abc012567:;<DEFIJKNOPXYZ]^_bcd123678;<=EFGJKLOPQYZ[^_`cde2378<=FGKLPQZ[_`de459:>?HIMNRS\]abfg4569:;>?@HIJMNORST\]^abcfgh567:;<?@AIJKNOPSTU]^_bcdghi678;<=@ABJKLOPQTUV^_`cdehij78<=ABKLPQUV_`deij9:>?MNRSabfg9:;>?@MNORSTabcfgh:;<?@ANOPSTUbcdghi;<=@ABOPQTUVcdehij<=ABPQUVdeijCDHIWX\]CDEHIJWXY\]^DEFIJKXYZ]^_EFGJKLYZ[^_`FGKLZ[_`CDHIMNWX\]abCDEHIJMNOWXY\]^abcDEFIJKNOPXYZ]^_bcdEFGJKLOPQYZ[^_`cdeFGKLPQZ[_`deHIMNRS\]abfgHIJMNORST\]^abcfghIJKNOPSTU]^_bcdghiJKLOPQTUV^_`cdehijKLPQUV_`deijMNRSabfgMNORSTabcfghNOPSTUbcdghiOPQTUVcdehijPQUVdeij?ð?ð?ð?ð?ð?ð?ð¾ VÈ^ƒE½ùåúWP£½ø½XµïÀ ½éMë@I½ù)­¯±ýá½êPÿªË6½èÏ’¥|½½Ù_TÚÍEç½ùåúWP£¾L´ñºñʽøUÑ᳎߽éMë@I¾ ‘pmðåb½èBUÓú½êPÿªË6¾ NO5ôª½è=¯%V3½Ù_TÚÍEç½ù’ZÃ[ˆ½Ø1¢M‘ϽøUÑ᳎߾Ï×HAX\½øUÑ᳎߽èBUÓú¾> ’½èBUÓú½è=¯%V3¾·´‹ã㜽è=¯%V3½Ø1¢M‘Ͻ÷-¥ªme½Ø1¢M‘ϽøUÑ᳎߾L´ñºñʽùåúWP£½èBUÓú¾ ‘pmðåb½éMë@I½è=¯%V3¾ NO5ôª½êPÿªË6½Ø1¢M‘Ͻù’ZÃ[ˆ½Ù_TÚÍEç½ùåúWP£¾ VÈ^ƒE½éMë@I½ø½XµïÀ ½êPÿªË6½ù)­¯±ýá½Ù_TÚÍEç½èÏ’¥|½½ø½XµïÀ ½éMë@I¾F,3˜¥{¾jÀìÇ·½øýðM½èýðM½èÏ’¥|½½Ù_TÚÍEç¾Jº¯{ä—½øn«<ÐɽèýðM½ØýðM ½éMë@I¾ ‘pmðåb½èBUÓú¾jÀìÇ·¾({Öë“ ¾'F3 ½èýðM¾ýðM½èýðM½Ù_TÚÍEç½ù’ZÃ[ˆ½Ø1¢M‘Ͻøn«<Ðɾ{2!˜î±½ø"É_z«6½ØýðM ½øýðM½ØýðM ½èBUÓú¾> ’½èBUÓú¾'F3 ¾'æ,p)ö¾'F3 ½èýðM¾ýðM½èýðM½Ø1¢M‘Ͻ÷-¥ªme½Ø1¢M‘ǽø"É_z«6¾áÊE碽ø"É_z«6½ØýðM ½øýðM½ØýðM ½èBUÓú¾ ‘pmðåb½éMë@I¾'F3 ¾({Öë“ ¾jÀìÇ·½èýðM¾ýðM½èýðM½Ø1¢M‘ǽù’ZÃ[ˆ½Ù_TÚÍEç½ø"É_z«6¾{2!˜î±½øn«<ÐɽØýðM ½øýðM½ØýðM ½éMë@I½ø½XµïÀ ¾jÀìÇ·¾F,3˜¥{½èýðM½øýðM½Ù_TÚÍEç½èÏ’¥|½½øn«<ÐܾJº¯{ä—½ØýðM ½èýðM½øýðM½èýðM¾­*aDA¾­*aD-½ø\‘;U½è\‘;B½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q½èýðM¾ýðM½èýðM¾­*aD-¾(­*aD(¾­*aD-½è\‘;B¾\‘;U½è\‘;B½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½èýðM¾ýðM½èýðM¾­*aD-¾(­*aD(¾­*aD-½è\‘;B¾\‘;U½è\‘;B½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½èýðM¾ýðM½èýðM¾­*aD-¾(­*aD(¾­*aD-½è\‘;B¾\‘;U½è\‘;B½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½èýðM½øýðM¾­*aD-¾­*aDA½è\‘;B½ø\‘;U½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½ø\‘;U½è\‘;B¾\‘;U½ø\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½è\‘;B½ø\‘;U½ø\‘;U¾\‘;U½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ù)­¯±ýá½êPÿªË6½èÏ’¥|½½Ù_TÚÍEç¾°þ÷†×]¾ÐíöÏ´¾ÑhíÓô½÷ã¨[ Ïl½ôHÿÓÁ•½ã±:°FÛ½å‰ ˜§P½ÕÆ=òd ½êPÿªË6¾ NO5ôª½è=¯%V3½Ù_TÚÍEç½ù’ZÃ[ˆ½Ø1¢M‘ϾÐíöÏ´¾'ä/ãȨ¾¹C¯q½÷ã¨[ Ïl¾ï +>Õ½÷»Ä<ËÙt½ã±:°FÛ¾ËW¤½çíoË™´:½ÕÆ=òd ½õ÷¢t Xž½×nÁ¶à}½è=¯%V3¾·´‹ã㜽è=¯%V3½Ø1¢M‘Ͻ÷-¥ªme½Ø1¢M‘Ǿ¹C¯q¾'›Lrz×¾¹C¯q½÷»Ä<ËÙt¾05¯Ó5½÷»Ä<ËÙt½çíoË™´:¾ºE1>…{½çíoË™´:½×nÁ¶à}½÷ Áfþ‡ë½×nÁ¶à…½è=¯%V3¾ NO5ôª½êPÿªË6½Ø1¢M‘ǽù’ZÃ[ˆ½Ù_TÚÍEç¾¹C¯q¾'ä/ãȨ¾ÐíöϽ½÷»Ä<ËÙt¾ï +>Õ½÷ã¨[ Ïl½çíoË™´:¾ËW®½ã±:°FÛ½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd½êPÿªË6½ù)­¯±ýá½Ù_TÚÍEç½èÏ’¥|½¾ÐíöϽ¾°þ÷†×]½÷ã¨[ Ïl¾ÑhíÓô½ã±:°FÛ½ôHÿÓÁ•½ÕÆ=òd½å‰ ˜§P½èÏ’¥|½½Ù_TÚÍEç¾Jº¯{ä—½øn«<ÐɽèýðM½ØýðM ¾ÑhíÓô½÷ã¨[ Ïl¾(èSç»Ä¾ 0A‘u‹¾ýðM½øýðM½å‰ ˜§P½ÕÆ=òd ¾tˆó»½÷U'Þòg!½èýðM½ØýðM ½Ù_TÚÍEç½ù’ZÃ[ˆ½Ø1¢M‘Ͻøn«<Ðɾ{2!˜î±½ø"É_z«6½ØýðM ½øýðM½ØýðM ½÷ã¨[ Ïl¾ï +>Õ½÷»Ä<ËÙt¾ 0A‘u‹¾8 öB€ø¾ï!—LG€½øýðM¾ýðM½øýðM½ÕÆ=òd ½õ÷¢t Xž½×nÁ¶à}½÷U'Þòg!¾ypiS]½÷ˆ² ,彨ýðM ½øýðM½ØýðM ½Ø1¢M‘Ͻ÷-¥ªme½Ø1¢M‘Ͻø"É_z«6¾áÊE碽ø"É_z«6½ØýðM ½øýðM½ØýðM ½÷»Ä<ËÙt¾05¯Ó5½÷»Ä<ËÙt¾ï!—LG€¾7Ñ­qN¼d¾ï!—LG€½øýðM¾ýðM½øýðM½×nÁ¶à}½÷ Áfþ‡ë½×nÁ¶à…½÷ˆ² ,å¾S°7kȽ÷ˆ² ,彨ýðM ½øýðM½ØýðM ½Ø1¢M‘Ͻù’ZÃ[ˆ½Ù_TÚÍEç½ø"É_z«6¾{2!˜î±½øn«<ÐܽØýðM ½øýðM½ØýðM ½÷»Ä<ËÙt¾ï +>Õ½÷ã¨[ Ïl¾ï!—LG€¾8 öB€ø¾ 0A‘u‹½øýðM¾ýðM½øýðM½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd½÷ˆ² ,å¾ypiS]½÷U'Þòg!½ØýðM ½øýðM½ØýðM ½Ù_TÚÍEç½èÏ’¥|½½øn«<ÐɾJº¯{ä—½ØýðM ½èýðM½÷ã¨[ Ïl¾ÑhíÓô¾ 0A‘u‹¾(èSç»Ä½øýðM¾ýðM½ÕÆ=òd½å‰ ˜§P½÷U'Þòg!¾tˆó»½ØýðM ½èýðM½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q¾ýðM½øýðM¾(­*aD(¾­*aDA¾\‘;U½ø\‘;U½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD5¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD5¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD5¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½øýðM¾ýðM¾­*aDA¾(­*aD(½ø\‘;U¾\‘;U½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B¾\‘;U½ø\‘;U¾\‘;K¾\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;U¾(\‘;K¾\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;U¾(\‘;K¾\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;U¾(\‘;K¾\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ø\‘;U¾\‘;U¾\‘;U¾\‘;K½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ôHÿÓÁ•½ã±:°FÛ½å‰ ˜§P½ÕÆ=òd ¾uN)L÷¾Ý@üÀÒ=¾Q ê²W½óåÊýk™½ôHÿÓÁ¨½ã±:°FÛ½å‰ ˜§P½ÕÆ=òd½ã±:°FÛ¾ËW¤½çíoË™´:½ÕÆ=òd ½õ÷¢t Xž½×nÁ¶à}¾Ý@üÀÒ=¾$Á˜ëêš¾åâÍ+ܽóåÊýk™¾¤Iô°ÓH½÷‡7¾]¶½ã±:°G¾ËW®½çíoË™´`½ÕÆ=òd½õ÷¢t Xž½×nÁ¶à…½çíoË™´:¾ºE1>…{½çíoË™´:½×nÁ¶à}½÷ Áfþ‡ë½×nÁ¶à…¾åâÍ+ܾ(Þ™„)¾åâÍ+ܽ÷‡7¾]¶¾@bÇ甑½÷‡7¾]¶½çíoË™´:¾ºE1>…{½çíoË™´:½×nÁ¶à…½÷ Áfþ‡ë½×nÁ¶à…½çíoË™´:¾ËW®½ã±:°FÛ½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd¾åâÍ+ܾ$Á˜ëêš¾Ý@üÀÒ=½÷‡7¾]¶¾¤Iô°ÓH½óåÊýk™½çíoË™´:¾ËW®½ã±:°G½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd½ã±:°FÛ½ôHÿÓÁ•½ÕÆ=òd½å‰ ˜§P¾Ý@üÀÒ=¾uN)L÷½óåÊýk™¾Q ê²W½ã±:°G½ôHÿÓÁ¨½ÕÆ=òd½å‰ ˜§P½å‰ ˜§P½ÕÆ=òd ¾tˆó»½÷U'Þòg!½èýðM½ØýðM ¾Q ê²W½óåÊýk™¾'&‰¥u× ¾(óu)¾ýðM½øýðM½å‰ ˜§P½ÕÆ=òd¾tˆó»½÷U'Þòg!½èýðM½ØýðM ½ÕÆ=òd ½õ÷¢t Xž½×nÁ¶à}½÷U'Þòg!¾ypiS]½÷ˆ² ,彨ýðM ½øýðM½ØýðM ½óåÊýk™¾¤Iô°ÓH½÷‡7¾]¶¾(óu)¾7S|`“îþ¾PC®qîO½øýðM¾ýðM½øýðM½ÕÆ=òd½õ÷¢t Xž½×nÁ¶à…½÷U'Þòg!¾ypiS]½÷ˆ² ,彨ýðM ½øýðM½ØýðM ½×nÁ¶à}½÷ Áfþ‡ë½×nÁ¶à…½÷ˆ² ,å¾S°7kȽ÷ˆ² ,彨ýðM ½øýðM½ØýðM ½÷‡7¾]¶¾@bÇ甑½÷‡7¾]¶¾PC®qîO¾6áVÝ0xó¾PC®qîO½øýðM¾ýðM½øýðM½×nÁ¶à…½÷ Áfþ‡ë½×nÁ¶à…½÷ˆ² ,å¾S°7kȽ÷ˆ² ,彨ýðM ½øýðM½ØýðM ½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd½÷ˆ² ,å¾ypiS]½÷U'Þòg!½ØýðM ½øýðM½ØýðM ½÷‡7¾]¶¾¤Iô°ÓH½óåÊýk™¾PC®qîO¾7S|`“îþ¾(óu)½øýðM¾ýðM½øýðM½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd½÷ˆ² ,å¾ypiS]½÷U'Þòg!½ØýðM ½øýðM½ØýðM ½ÕÆ=òd½å‰ ˜§P½÷U'Þòg!¾tˆó»½ØýðM ½èýðM½óåÊýk™¾Q ê²W¾(óu)¾'&‰¥u× ½øýðM¾ýðM½ÕÆ=òd½å‰ ˜§P½÷U'Þòg!¾tˆó»½ØýðM ½èýðM½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q¾ýðM½øýðM¾(­*aD(¾­*aDA¾\‘;K½ø\‘;U½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD(¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD(¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD(¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½øýðM¾ýðM¾­*aDA¾(­*aD(½ø\‘;U¾\‘;K½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B¾\‘;K½ø\‘;U¾\‘;K¾\‘;K½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;K¾(\‘;K¾\‘;K½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;K¾(\‘;K¾\‘;K½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;K¾(\‘;K¾\‘;K½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ø\‘;U¾\‘;K¾\‘;K¾\‘;K½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ôHÿÓÁ¨½ã±:°G½å‰ ˜§P½ÕÆ=òd¾°þ÷†×]¾ÐíöϽ¾ÑhíÓþ½÷ã¨[ Ïl½ù)­¯±ýõ½êPÿªË6½èÏ’¥|½½Ù_TÚÍEö½ã±:°FÛ¾ËW®½çíoË™´:½ÕÆ=òd½õ÷¢t Xž½×nÁ¶à…¾ÐíöϽ¾'ä/ãÈÁ¾¹C¯q½÷ã¨[ Ïl¾ï +>Õ½÷»Ä<ËÙ‡½êPÿªË6¾ NO5ô´½è=¯%V3½Ù_TÚÍEö½ù’ZÃ[ˆ½Ø1¢M‘ϽçíoË™´`¾ºE1>…{½çíoË™´:½×nÁ¶à…½÷ Áfþ‡ë½×nÁ¶à…¾¹C¯q¾'›Lrzï¾¹C¯q½÷»Ä<ËÙ‡¾05¯Óe½÷»Ä<ËÙ‡½è=¯%V3¾·´‹ã㜽è=¯%V3½Ø1¢M‘Ͻ÷-¥ªmx½Ø1¢M‘×½çíoË™´:¾ËW®½ã±:°G½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd¾¹C¯q¾'ä/ãÈÁ¾ÐíöϽ½÷»Ä<ËÙ‡¾ï +>Õ½÷ã¨[ Ïl½è=¯%V3¾ NO5ô´½êPÿªË6½Ø1¢M‘×½ù’ZÃ[ˆ½Ù_TÚÍEï½ã±:°G½ôHÿÓÁ¨½ÕÆ=òd½å‰ ˜§P¾ÐíöϽ¾°þ÷†×]½÷ã¨[ Ïl¾ÑhíÓô½êPÿªË6½ù)­¯±ýá½Ù_TÚÍEï½èÏ’¥|½½å‰ ˜§P½ÕÆ=òd¾tˆó»½÷U'Þòg!½èýðM½ØýðM ¾ÑhíÓþ½÷ã¨[ Ïl¾(èSç»Ä¾ 0A‘u‹¾ýðM½øýðM½èÏ’¥|½½Ù_TÚÍEö¾Jº¯{ä ½øn«<ÐܽèýðM½ØýðM ½ÕÆ=òd½õ÷¢t Xž½×nÁ¶à…½÷U'Þòg!¾ypiS]½÷ˆ² ,彨ýðM ½øýðM½ØýðM ½÷ã¨[ Ïl¾ï +>Õ½÷»Ä<ËÙ‡¾ 0A‘u‹¾8 öB€ø¾ï!—LG€½øýðM¾ýðM½øýðM½Ù_TÚÍEö½ù’ZÃ[ˆ½Ø1¢M‘Ͻøn«<Ðܾ{2!˜î±½ø"É_z«I½ØýðM ½øýðM½ØýðM ½×nÁ¶à…½÷ Áfþ‡ë½×nÁ¶à…½÷ˆ² ,å¾S°7kȽ÷ˆ² ,彨ýðM ½øýðM½ØýðM ½÷»Ä<ËÙ‡¾05¯Óe½÷»Ä<ËÙ‡¾ï!—LG€¾7Ñ­qN¼d¾ï!—LG€½øýðM¾ýðM½øýðM½Ø1¢M‘Ͻ÷-¥ªmx½Ø1¢M‘×½ø"É_z«6¾áÊEç¢@½ø"É_z«I½ØýðM ½øýðM½ØýðM ½×nÁ¶à…½õ÷¢t Xž½ÕÆ=òd½÷ˆ² ,å¾ypiS]½÷U'Þòg!½ØýðM ½øýðM½ØýðM ½÷»Ä<ËÙ‡¾ï +>Õ½÷ã¨[ Ïl¾ï!—LG€¾8 öB€ø¾ 0A‘u‹½øýðM¾ýðM½øýðM½Ø1¢M‘×½ù’ZÃ[ˆ½Ù_TÚÍEï½ø"É_z«I¾{2!˜î±½øn«<ÐܽØýðM ½øýðM½ØýðM ½ÕÆ=òd½å‰ ˜§P½÷U'Þòg!¾tˆó»½ØýðM ½èýðM½÷ã¨[ Ïl¾ÑhíÓô¾ 0A‘u‹¾(èSç»Ä½øýðM¾ýðM½Ù_TÚÍEï½èÏ’¥|½½øn«<ÐܾJº¯{ä—½ØýðM ½èýðM½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q¾ýðM½øýðM¾(­*aD(¾­*aDA¾\‘;U½ø\‘;U½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD5¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD5¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½øýðM¾ýðM½øýðM¾­*aDA¾8­*aD5¾­*aDA½ø\‘;U¾\‘;K½ø\‘;U½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½øýðM¾ýðM¾­*aDA¾(­*aD(½ø\‘;U¾\‘;K½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B¾\‘;U½ø\‘;U¾\‘;K¾\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;U¾(\‘;K¾\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;U¾(\‘;K¾\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;K½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U¾\‘;U¾(\‘;K¾\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ø\‘;U¾\‘;K¾\‘;U¾\‘;K½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½ù)­¯±ýõ½êPÿªË6½èÏ’¥|½½Ù_TÚÍEö¾ VÈ^ƒY½ùåúWP·½ø½XµïÀ³½éMë@I½êPÿªË6¾ NO5ô´½è=¯%V3½Ù_TÚÍEö½ù’ZÃ[ˆ½Ø1¢M‘ϽùåúWP·¾L´ñºñʽøUÑ᳎߽éMë@I¾ ‘pmðål½èBUÓú½è=¯%V3¾·´‹ã㜽è=¯%V3½Ø1¢M‘Ͻ÷-¥ªmx½Ø1¢M‘×½øUÑ᳎߾Ï×HAX\½øUÑ᳎߽èBUÓú¾> œ½èBUÓú½è=¯%V3¾ NO5ô´½êPÿªË6½Ø1¢M‘×½ù’ZÃ[ˆ½Ù_TÚÍEï½øUÑ᳎߾L´ñºñʽùåúWP£½èBUÓú¾ ‘pmðål½éMë@I½êPÿªË6½ù)­¯±ýá½Ù_TÚÍEï½èÏ’¥|½½ùåúWP£¾ VÈ^ƒE½éMë@I½ø½XµïÀ ½èÏ’¥|½½Ù_TÚÍEö¾Jº¯{ä ½øn«<ÐܽèýðM½ØýðM ½ø½XµïÀ³½éMë@I¾F,3˜¥{¾jÀìÇÁ½øýðM½èýðM½Ù_TÚÍEö½ù’ZÃ[ˆ½Ø1¢M‘Ͻøn«<Ðܾ{2!˜î±½ø"É_z«6½ØýðM ½øýðM½ØýðM ½éMë@I¾ ‘pmðål½èBUÓú¾jÀìÇÁ¾({Öë“ ¾'F3½èýðM¾ýðM½èýðM½Ø1¢M‘Ͻ÷-¥ªmx½Ø1¢M‘×½ø"É_z«I¾áÊEç¢@½ø"É_z«I½ØýðM ½øýðM½ØýðM ½èBUÓú¾> œ½èBUÓú¾'F3¾'æ,p)ö¾'F3½èýðM¾ýðM½èýðM½Ø1¢M‘×½ù’ZÃ[ˆ½Ù_TÚÍEï½ø"É_z«I¾{2!˜î±½øn«<ÐܽØýðM ½øýðM½ØýðM ½èBUÓú¾ ‘pmðål½éMë@I¾'F3¾({Öë“ ¾jÀìÇÁ½èýðM¾ýðM½èýðM½Ù_TÚÍEï½èÏ’¥|½½øn«<ÐܾJº¯{ä—½ØýðM ½èýðM½éMë@I½ø½XµïÀ ¾jÀìÇÁ¾F,3˜¥{½èýðM½øýðM½èýðM½ØýðM ¾­*aD-½ø­*aD-½è\‘;B½Ø\‘;Q½øýðM½èýðM¾­*aDA¾­*aD-½ø\‘;U½è\‘;B½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½èýðM¾ýðM½èýðM¾­*aD-¾(­*aD(¾­*aD-½è\‘;B¾\‘;U½è\‘;B½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½èýðM¾ýðM½èýðM¾­*aD-¾(­*aD(¾­*aD-½è\‘;B¾\‘;U½è\‘;B½ØýðM ½øýðM½ØýðM ½ø­*aD-¾­*aDA½ø­*aD-½Ø\‘;Q½ø\‘;U½Ø\‘;Q½èýðM¾ýðM½èýðM¾­*aD-¾(­*aD(¾­*aD-½è\‘;B¾\‘;U½è\‘;B½ØýðM ½èýðM½ø­*aD-¾­*aD-½Ø\‘;Q½è\‘;B½èýðM½øýðM¾­*aD-¾­*aDA½è\‘;B½ø\‘;U½è\‘;B½Ø\‘;Q½ø\‘;U½è\‘;B½ø\‘;U½è\‘;B¾\‘;U½ø\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U½Ø\‘;Q½ø\‘;U½Ø\‘;Q½è\‘;B¾\‘;U½è\‘;B½è\‘;B¾\‘;U½è\‘;B½ø\‘;U¾\‘;K½ø\‘;U½Ø\‘;Q½è\‘;B½è\‘;B½ø\‘;U½è\‘;B½ø\‘;U½ø\‘;U¾\‘;Uslepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/speaker107k.petsc0000644000175000017500000005051012211062077024504 0ustar gladkgladk{Pkk¡                      !  !" !"# "#$ #$  !%&  !"%&' !"#&'( "#$'() #$()  !%&*+  !"%&'*+, !"#&'(+,-"#$'(),-.#$()-.%&*+%&'*+,&'(+,-'(),-.()-.  !/045  !"/01456 !"#012567 "#$123678 #$2378  !%&/0459:  !"%&'/014569:; !"#&'(012567:;< "#$'()123678;<= #$()2378<=  !%&*+459:>?  !"%&'*+,4569:;>?@ !"#&'(+,-567:;<?@A"#$'(),-.678;<=@AB#$()-.78<=AB%&*+9:>?%&'*+,9:;>?@&'(+,-:;<?@A'(),-.;<=@AB()-.<=AB !/045CDHI !"/01456CDEHIJ!"#012567DEFIJK"#$123678EFGJKL#$2378FGKL !%&/0459:CDHIMN !"%&'/014569:;CDEHIJMNO!"#&'(012567:;<DEFIJKNOP"#$'()123678;<=EFGJKLOPQ#$()2378<=FGKLPQ !%&*+459:>?HIMNRS !"%&'*+,4569:;>?@HIJMNORST!"#&'(+,-567:;<?@AIJKNOPSTU"#$'(),-.678;<=@ABJKLOPQTUV#$()-.78<=ABKLPQUV%&*+9:>?MNRS%&'*+,9:;>?@MNORST&'(+,-:;<?@ANOPSTU'(),-.;<=@ABOPQTUV()-.<=ABPQUV/045CDHIWX\]/01456CDEHIJWXY\]^012567DEFIJKXYZ]^_123678EFGJKLYZ[^_`2378FGKLZ[_`/0459:CDHIMNWX\]ab/014569:;CDEHIJMNOWXY\]^abc012567:;<DEFIJKNOPXYZ]^_bcd123678;<=EFGJKLOPQYZ[^_`cde2378<=FGKLPQZ[_`de459:>?HIMNRS\]abfg4569:;>?@HIJMNORST\]^abcfgh567:;<?@AIJKNOPSTU]^_bcdghi678;<=@ABJKLOPQTUV^_`cdehij78<=ABKLPQUV_`deij9:>?MNRSabfg9:;>?@MNORSTabcfgh:;<?@ANOPSTUbcdghi;<=@ABOPQTUVcdehij<=ABPQUVdeijCDHIWX\]CDEHIJWXY\]^DEFIJKXYZ]^_EFGJKLYZ[^_`FGKLZ[_`CDHIMNWX\]abCDEHIJMNOWXY\]^abcDEFIJKNOPXYZ]^_bcdEFGJKLOPQYZ[^_`cdeFGKLPQZ[_`deHIMNRS\]abfgHIJMNORST\]^abcfghIJKNOPSTU]^_bcdghiJKLOPQTUV^_`cdehijKLPQUV_`deijMNRSabfgMNORSTabcfghNOPSTUbcdghiOPQTUVcdehijPQUVdeijAICËxÃ'AR·÷ç¦YATµ÷€ŠcüA\«X;ðŒEA]g0&À£ÿAbH1)§Abûô-Å"¿¥9í¡l2Y?puô뇼9?P$ïWF‰?о_h]— ¿r[kßþÎ?€œzaßé?‚ßé”5¦)?…yˆ|€ó:?puô뇼9¿¶±Ì°*?l3»@[?Š}B«ü7»?[Aæ#a¸?‰UPÚ?A>?‡ä‚ai=¿Š¥4DD-?Š÷·s>ý‡?‡¥^=ˆc6?“Ót ¡Ÿž?‡ˆäÓFÒ?l3»@[¿´bÄ<èø?l3»@[?‰4Ýáð?BF™7Z-?‰4Ýáð?~ìÖˆ‚Ø¿j˜ÑºÉ¬ç?~ìÖˆ‚Ì?ƒK¾í5¥]?¼˜9T‘?ƒK¾í5¥]?l3»@[¿¶±Ì°*?puô뇼9?‰UPÚ?A>?[Aæ#a¸?Š}B«ü7»?Š÷·s>ý‡¿Š¥4DD-?‡ä‚ai=?‡ˆäÓFÒ?“Ót ¡Ÿž?‡¥^=ˆc6?puô뇼9¿¥9í¡l2Y?о_h]— ?P$ïWF‰?€œzaßé¿r[kßþÃ?…yˆ|€ós?‚ßé”5¦.?P$ïWF‰?Š}B«ü7»¿´úu3’cç?}ª/¥À¢\?@R'¾Ík?‰xCÓàD?€ÞX5íúÉ?ƒ6Úa×è’¿€TÄ¢Ób?“ú«klE?„ÓÛ{g?…¼Ç¨n?о_h]— ?[Aæ#a¸?‰4Ýáð?}ª/¥À¢\¿Å$ >'˜è?|+×3Ue?‰xCÓàD?PR'¾Íp?‰xCÓàD?…ä離%?/¢ÀTF?†Þã?ó‡Ê?•0)•üJŒ¿‘1ÿ¥7?•©Åž[?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?‰UPÚ?A>?BF™7Z-?‰UPÚ?A>?|+×3Ue¿Äíë”—¬ë?|+×3Up?‰xCÓàD?PR'¾Íp?‰xCÓàD?ƒ#öÒ¥è&?“‹–¹<ò?ƒ#öÒ¥è&?“’÷ö=»¿Ü*Õ­©?“’÷ö=»?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?‰4Ýáð?[Aæ#a¸?о_h]— ?|+×3Up¿Å$ >'˜è?}ª/¥À¢\?‰xCÓàD?PR'¾Íp?‰xCÓàD?†Þã?ó‡Ê?/¢ÀTF?…ä離%?•©Åž[¿‘1ÿ¥7?•0)•üJŒ?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?Š}B«ü7»?P$ïWF‰?}ª/¥À¢\¿´úu3’cç?‰xCÓàD?@R'¾Ít?ƒ6Úa×è’?€ÞX5íúÉ?“ú«klE¿€TÄ¢Ó]?…¼Ç¨n?„ÓÛ{g?@R'¾Ík?‰xCÓàD¿µ×;ó?{á•©¥'z?@Çs]ê?‰-ŽjW?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þU?”~’Ä?†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?PR'¾Íp?‰xCÓàD?{á•©¥'z¿Å×;û?{á•©¥'z?‰-ŽjW?PÇs]ê?‰-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?PR'¾Íp?‰xCÓàD?{á•©¥'z¿Å×;û?{á•©¥'z?‰-ŽjW?PÇs]ê?‰-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?PR'¾Íp?‰xCÓàD?{á•©¥'z¿Å×;û?{á•©¥'z?‰-ŽjW?PÇs]ê?‰-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?@R'¾Ít?{á•©¥'z¿µ×;ó?‰-ŽjW?@Çs]ê;?…¼Ç¨n?„ÓÛ{g ?”~’Ä¿ýÎZ>þU?…ut¥Ï\?†øõÉÆÿ?@Çs]ê?‰-ŽjW¿¥ut¥Ïj?kÓãöàCŒ?†øõÉÆÿ?…ut¥Ï\¿pàgþ?„{9Ù½P3?‰-ŽjW?PÇs]ê?‰-ŽjW?kÓãöàCŒ¿µut¥Ïj?kÓãöàCŒ?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgþ?„{9Ù½P3?‰-ŽjW?PÇs]ê?‰-ŽjW?kÓãöàCŒ¿µut¥Ïj?kÓãöàCŒ?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgþ?„{9Ù½P3?‰-ŽjW?PÇs]ê?‰-ŽjW?kÓãöàCŒ¿µut¥Ïj?kÓãöàCŒ?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgþ?„{9Ù½P3?‰-ŽjW?@Çs]ê;?kÓãöàCŒ¿¥ut¥Ïj?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ¿r[kßþÎ?‡ä‚ai=?€ÞX5íúÉ?…ä離%¿µ5Hã> 7?~ ”Œr‚h?2%ç'Ù.?˜¶„ýnë—¿tR)$ÞŸ!?‰Ôc¢s?~§pý Ëz?„v ±ÞüB?€œzaß鿊¥4DD-?~ìÖˆ‚Ø?ƒ6Úa×è’?/¢ÀTF?ƒ#öÒ¥è&?~ ”Œr‚h¿Äʳӡk˜?~ÿ&¹â*?™}„³-‡?Qa²DàìI?—2ëôn?…”ñ «¿QÏŬ q?'ª:p‚?†®DXCy:?“mìˆ=K·?ƒ¾Ãké?Š÷·s>ý‡¿j˜ÑºÉ¬ç?Š÷·s>ý‡?†Þã?ó‡Ê?“‹–¹<ò?†Þã?ó‡Ê?~ÿ&¹â*¿ÄõýPg?~ÿ&¹âA?šäY\Qk?yÝßå{2?šäY\Qk?k¾ÅÑeÞ¿‘-ß]’s?k¾ÅÑeÞ?„1º¹ Þa?JøÒþá?„1º¹ Þa?~ìÖˆ‚Ì¿Š¥4DD-?€œzaßé?ƒ#öÒ¥è&?/¢ÀTF?ƒ6Úa×è’?~ÿ&¹âA¿Äʳӡk˜?~ ”Œr‚s?—2ëôn?Qa²Dàëí?™}„³-‡?'ª:p‚¿QÏŬ q?…”ñ «?ƒ¾Ãké?“mìˆ=K·?†®DXCy:?‡ä‚ai=¿r[kßþÃ?…ä離%?€ÞX5íúÉ?~ ”Œr‚s¿µ5Hã> 7?˜¶„ýnë—?2%ç'ÙÒ?‰Ôc¢s¿tR)$ÞŸ!?„v ±ÞüB?~§pý Ëz?‚ßé”5¦)?‡¥^=ˆc6¿€TÄ¢Ób?•0)•üJŒ?„ÓÛ{g?…¼Ç¨n?2%ç'Ù.?™}„³-‡¿Å9?ÈM?ŒE•ãívæ?PR'¾Í~?™xCÓàD?z¤N@~t»?…Ê~ö³q¿¸ÆhýÍî?”õ!Õžô»?„ÓÛ{g?…¼Ç¨n?…yˆ|€ó:?“Ót ¡Ÿž?ƒK¾í5¥]?“ú«klE¿‘1ÿ¥7?“’÷ö=»?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?˜¶„ýnë—?Qa²DàìI?šäY\Qk?ŒE•ãívæ¿Õ6||L²?‰=-mTw?™xCÓàD?`R'¾Ít?™xCÓàD?VÃVß­6?à štÔ?Žþ"¾ Õ?”~û}«Z׿º ×@îØ?”Û"Bü*º?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?‡ˆäÓFÒ?¼˜9T‘?‡ˆäÓFÒ?•©Åž[¿Ü*Õ­©?•©Åž[?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?—2ëôn?yÝßå{2?—2ëôn?‰=-mTw¿ÕgД?‰=-mTw?™xCÓàD?`R'¾Ít?™xCÓàD?z= §®+?Ù€Ãr?z= §®6?‘@sJ ý’¿’v7û©è?‘@sJ ý’?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?ƒK¾í5¥]?“Ót ¡Ÿž?…yˆ|€ós?“’÷ö=»¿‘1ÿ¥7?“ú«klE?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?šäY\Qk?Qa²Dàëí?˜¶„ýnë—?‰=-mTw¿Õ6||L²?ŒE•ãívæ?™xCÓàD?`R'¾Ít?™xCÓàD?Žþ"¾ Õ?à štÔ?VÃVß­6?”Û"Bü*Ö¿º ×@îØ?”~û}«Z×?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?‡¥^=ˆc6?‚ßé”5¦.?•0)•üJŒ¿€TÄ¢Ó]?…¼Ç¨n?„ÓÛ{g ?™}„³-‡?2%ç'ÙÒ?ŒE•ãívæ¿Å9?ÈM?™xCÓàD?PR'¾Ík?…Ê~ö³q?z¤N@~t»?”õ!Õžô»¿¸ÆhýÍî?…¼Ç¨n?„ÓÛ{g?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þU?”~’Ä?†øõÉÆÿ?…ut¥Ï\?PR'¾Í~?™xCÓàD¿Å×;û?‹á•©¥'W?PÇs]ê?™-ŽjW?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þI?”~’Ä?†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Ít?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW8?`Çs]ê6?™-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Ít?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW8?`Çs]ê6?™-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Ít?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW8?`Çs]ê6?™-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?„ÓÛ{g?”~’Ä¿ýÎZ>þU?…ut¥Ï\?†øõÉÆÿ?™xCÓàD?PR'¾Ík?‹á•©¥'W¿Å×;û?™-ŽjW8?PÇs]ê?…¼Ç¨n?„ÓÛ{g ?”~’Ä¿ýÎZ>þI?…ut¥Ï\?†øõÉÆÿ?†øõÉÆÿ?…ut¥Ï\¿pàgþ?„{9Ù½P3?PÇs]ê?™-ŽjW8¿µut¥Ïj?{ÓãöàC€?†øõÉÆÿ?…ut¥Ï\¿pàgþ?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgþ?„{9Ù½P3?™-ŽjW?`Çs]ê6?™-ŽjW8?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgþ?„{9Ù½P3?™-ŽjW?`Çs]ê6?™-ŽjW8?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgþ?„{9Ù½P3?™-ŽjW?`Çs]ê6?™-ŽjW8?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ?™-ŽjW?PÇs]ê?{ÓãöàC€¿µut¥Ïj?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ¿tR)$ÞŸ!?…”ñ «?z¤N@~t»?VÃVß­6¿³äì¼R´ñ?•ð>ªÓwŒ¿s…Yeö4ç?”pšš9i¿tR)$ÞŸ!?…”ñ «?z¤N@~t»?VÃVß­ªÓwŒ¿ÃêrÜδP¿ˆwdÔSàÛ?Ÿvl±^[?c“B>©üí?Ž5ýC#?‰Ôc¢s¿QÏŬ q?k¾ÅÑeÞ?…Ê~ö³q?à štÔ?z= §®6?'ª:p‚¿‘-ß]’s?'ª:p‚?Žþ"¾ Õ?Ù€Ãr?Žþ"¾ Õ¿ˆwdÔSàÛ¿ÍgäÞCš¸¿ˆwdÔSàÛ?£!¯9ÑJu?£ äxŠ¥?£!¯9ÑJu?'ª:p‚¿‘-ß]’?'ª:p‚?Žþ"¾ Õ?Ù€Ãr?Žþ"¾ Õ?k¾ÅÑeÞ¿QÏŬ q?‰Ôc¢s?z= §®6?à štÔ?…Ê~ö³q¿ˆwdÔSàÛ¿ÃêrÜδP?•ð>ªÓw©?Ž5ýC#?c“B>©üí?Ÿvl±^[?k¾ÅÑeÞ¿QÏŬ Ÿ?‰Ôc¢s?z= §®6?à štÔ?…Ê~ö³q?…”ñ «¿tR)$ÞŸ!?VÃVß­6?z¤N@~t»?•ð>ªÓw©¿³äì¼R´ø?”pšš9i¿s…Yeö4ç?…”ñ «¿tR)$ÞŸ!?VÃVß­©üí?£!¯9ÑJu?‘@Ú¤¤ïŽ¿Õ,øÕ4?|{ ñ|Õ?™xCÓàD?`R'¾Í]?™xCÓàD?„v ±ÞüH?“mìˆ=K·?„1º¹ Þg?”õ!Õžô»¿º ×@îØ?‘@sJ ý’?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?ƒ¾Ãké?JøÒþá?ƒ¾Ãké?”Û"Bü*º¿’v7û©è?”Û"Bü*Ö?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?Ž5ýC#?£ äxŠ¥?Ž5ýC#?|{ ñ|Õ¿Ô¬hêäk¹?|{ ñ|Õ?™xCÓàD?`R'¾Í]?™xCÓàD?ƒ¾Ãké"?JøÒþá?ƒ¾Ãké?”Û"Bü*Ö¿’v7û©è?”Û"Bü*Ö?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?„1º¹ Þa?“mìˆ=K·?„v ±ÞüB?‘@sJ ý’¿º ×@îØ?”õ!Õžô»?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?£!¯9ÑJu?c“B>©üí?”pšš9i?|{ ñ|Õ¿Õ,øÕ4?‘@Ú¤¤ïŽ?™xCÓàD?`R'¾Í]?™xCÓàD?„1º¹ Þa?“mìˆ=K·?„v ±ÞüH?‘@sJ ý’¿º ×@îØ?”õ!Õžô»?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?†®DXCy:?~§pý Ëz?”~û}«Z׿¸ÆhýÍî?…¼Ç¨n?„ÓÛ{g ?Ÿvl±^[¿s…Yeö4ç?‘@Ú¤¤ïŽ¿Å4ùÏ“þ?™xCÓàD?PR'¾ÍY?†®DXCy:?~§pý Ëz?”~û}«Z׿¸ÆhýÍî?…¼Ç¨n?„ÓÛ{g?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þI?”~’Ä?†øõÉÆÿ?…ut¥Ï\?PR'¾Íg?™xCÓàD¿Å×;û?‹á•©¥'W?PÇs]ê?™-ŽjW?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þI?”~’Ä?†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Í]?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW?`Çs]ê?™-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Í]?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW?`Çs]ê?™-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Í]?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW?`Çs]ê?™-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?„ÓÛ{g?”~’Ä¿ýÎZ>þI?…ut¥Ï\?†øõÉÆÿ?™xCÓàD?PR'¾ÍY?‹á•©¥'W¿Å×;û?™-ŽjW?PÇs]ê?…¼Ç¨n?„ÓÛ{g ?”~’Ä¿ýÎZ>þI?…ut¥Ï\?†øõÉÆÿ?†øõÉÆÿ?…ut¥Ï\¿pàgþ?„{9Ù½P3?PÇs]ê?™-ŽjW¿µut¥Ïj?{ÓãöàC€?†øõÉÆÿ?…ut¥Ï\¿pàgþ?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?™-ŽjW?`Çs]ê?™-ŽjW?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?™-ŽjW?`Çs]ê?™-ŽjW?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?™-ŽjW?`Çs]ê?™-ŽjW?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ?™-ŽjW?PÇs]ê?{ÓãöàC€¿µut¥Ïj?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ¿tR)$ÞŸ!?‰Ôc¢s?~§pý Ëz?„v ±ÞüH¿µ5Hã> E?~ ”Œr‚Š?2%ç'Ùc?˜¶„ýnë´¿r[kßþÚ?‡ä‚aiw?€ÞX5íúÕ?…ä離%?…”ñ «¿QÏŬ q?'ª:p‚?†®DXCy:?“mìˆ=K·?ƒ¾Ãké"?~ ”Œr‚Š¿Äʳӡk¼?~ÿ&¹â5?™}„³-‡?Qa²Dàì?—2ëôn?€œzaßé ¿Š¥4DD-?~ìÖˆ‚Ì?ƒ6Úa×è?/¢ÀTF?ƒ#öÒ¥è&?k¾ÅÑeÞ¿‘-ß]’?k¾ÅÑeÞ?„1º¹ Þg?JøÒþá?„1º¹ Þa?~ÿ&¹â5¿ÄõýPg?~ÿ&¹â*?šäY\Qk?yÝßå{I?šäY\Qk?Š÷·s>ý‡¿j˜ÑºÉ¬ç?Š÷·s>ý‡?†Þã?ó‡Ê?“‹–¹<ò?†Þã?ó‡Ê?'ª:p‚¿QÏŬ Ÿ?…”ñ «?ƒ¾Ãké?“mìˆ=K·?†®DXCy:?~ÿ&¹â*¿Äʳӡk¼?~ ”Œr‚s?—2ëôn?Qa²Dàì?™}„³-‡?~ìÖˆ‚Ø¿Š¥4DD-?€œzaßé?ƒ#öÒ¥è,?/¢ÀTF?ƒ6Úa×è’?‰Ôc¢s¿tR)$ÞŸ!?„v ±ÞüH?~§pý Ëz?~ ”Œr‚s¿µ5Hã> >?˜¶„ýnë´?2%ç'ÙQ?‡ä‚ai=¿r[kßþÎ?…ä離%?€ÞX5íúÏ?z¤N@~t»?…Ê~ö³q¿¸ÆhýÍî?”õ!Õžô»?„ÓÛ{g?…¼Ç¨n?2%ç'Ùc?™}„³-‡¿Å9?Èq?ŒE•ãívæ?PR'¾Ík?™xCÓàD?‚ßé”5¦4?‡¥^=ˆc6¿€TÄ¢Óh?•0)•üJ©?„ÓÛ{g?…¼Ç¨n?VÃVß­þI?”~’Ä?†øõÉÆÿ?…ut¥Ï\?PR'¾Ík?™xCÓàD¿Å×;û?‹á•©¥'W?PÇs]ê?™-ŽjW8?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þU?”~’Ä?†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Ít?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW8?`Çs]ê?™-ŽjW8?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Ít?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW8?`Çs]ê?™-ŽjW8?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?™xCÓàD?`R'¾Ít?™xCÓàD?‹á•©¥'W¿Õ×;û?‹á•©¥'W?™-ŽjW8?`Çs]ê?™-ŽjW8?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?…¼Ç¨n?„ÓÛ{g?”~’Ä¿ýÎZ>þI?…ut¥Ï\?†øõÉÆÿ?™xCÓàD?PR'¾Íg?‹á•©¥'W¿Å×;û?™-ŽjW8?PÇs]ê?…¼Ç¨n?„ÓÛ{g?”~’Ä¿ýÎZ>þU?…ut¥Ï\?†øõÉÆÿ?†øõÉÆÿ?…ut¥Ï\¿pàgþ?„{9Ù½P3?PÇs]ê?™-ŽjW8¿µut¥Ïj?{ÓãöàC€?†øõÉÆÿ?…ut¥Ï\¿pàg ?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?™-ŽjW8?`Çs]ê?™-ŽjW8?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àg?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?™-ŽjW8?`Çs]ê?™-ŽjW8?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àg?„{9Ù½P3?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àgù?„{9Ù½P3?™-ŽjW8?`Çs]ê?™-ŽjW8?{ÓãöàC€¿Åut¥Ïr?{ÓãöàC€?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àg?„{9Ù½P3?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ?™-ŽjW8?PÇs]ê?{ÓãöàC€¿µut¥Ïj?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ¿r[kßþÚ?€œzaßé ?‚ßé”5¦4?…yˆ|€ós¿¥9í¡l2h?puô뇼E?P$ïWF‰?о_h]— ?‡ä‚aiw¿Š¥4DD-?Š÷·s>ý‡?‡¥^=ˆc6?“Ót ¡Ÿž?‡ˆäÓFÒ?puô뇼E¿¶±Ì°*?l3»@[?Š}B«ü7»?[Aæ#a¸?‰UPÚ?A>?~ìÖˆ‚Ì¿j˜ÑºÉ¬ç?~ìÖˆ‚Ø?ƒK¾í5¥c?¼˜9T‘?ƒK¾í5¥c?l3»@[¿´bÄ<èÿ?l3»@[?‰4Ýáð?BF™7Z[?‰4Ýáð?Š÷·s>ý‡¿Š¥4DD-?‡ä‚ai=?‡ˆäÓFÒ?“Ót ¡Ÿž?‡¥^=ˆc6?l3»@[¿¶±Ì°*?puô뇼E?‰UPÚ?A>?[Aæ#a¸?Š}B«ü7»?€œzaßé¿r[kßþÎ?…yˆ|€ós?‚ßé”5¦.?puô뇼E¿¥9í¡l2Y?о_h]— ?P$ïWFˆþ?€ÞX5íúÕ?ƒ6Úa×è¿€TÄ¢Óh?“ú«kla?„ÓÛ{g?…¼Ç¨n?P$ïWF‰?Š}B«ü7»¿´úu3’cî?}ª/¥À¢g?@R'¾Í?‰xCÓàD?…ä離%?/¢ÀTF?†Þã?ó‡Ê?•0)•üJ©¿‘1ÿ¥T?•©Åž[?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?о_h]— ?[Aæ#a¸?‰4Ýáð?}ª/¥À¢g¿Å$ >'˜è?|+×3Up?‰xCÓàD?PR'¾Í?‰xCÓàD?ƒ#öÒ¥è&?“‹–¹<ò?ƒ#öÒ¥è,?“’÷ö=»¿Ü*Õ­©?“’÷ö=»?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?‰UPÚ?A>?BF™7Z[?‰UPÚ?A>?|+×3Up¿Äíë”—¬ë?|+×3Up?‰xCÓàD?PR'¾Í?‰xCÓàD?†Þã?ó‡Ê?/¢ÀTF?…ä離%?•©Åž[¿‘1ÿ¥T?•0)•üJŒ?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?‰4Ýáð?[Aæ#a¸?о_h]— ?|+×3Up¿Å$ >'˜è?}ª/¥À¢g?‰xCÓàD?PR'¾Í?‰xCÓàD?ƒ6Úa×è’?€ÞX5íúÏ?“ú«kla¿€TÄ¢Ób?…¼Ç¨n?„ÓÛ{g?Š}B«ü7»?P$ïWFˆþ?}ª/¥À¢g¿´úu3’cî?‰xCÓàD?@R'¾Í?„ÓÛ{g?…¼Ç¨n¿ýÎZ>þU?”~’Ä?†øõÉÆÿ?…ut¥Ï\?@R'¾Í?‰xCÓàD¿µ×;ó?{á•©¥'z?@Çs]êM?‰-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?PR'¾Í?‰xCÓàD?{á•©¥'z¿Å×;û?{á•©¥'z?‰-ŽjW?PÇs]êM?‰-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?PR'¾Í?‰xCÓàD?{á•©¥'z¿Å×;û?{á•©¥'z?‰-ŽjW?PÇs]êM?‰-ŽjW?…¼Ç¨n?‘„ÓÛ{g?…¼Ç¨n?”~’Ä¿ýÎZ>þU?”~’Ä?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?‰xCÓàD?PR'¾Í?‰xCÓàD?{á•©¥'z¿Å×;û?{á•©¥'z?‰-ŽjW?PÇs]êM?‰-ŽjW?…¼Ç¨n?„ÓÛ{g?”~’Ä¿ýÎZ>þU?…ut¥Ï\?†øõÉÆÿ?‰xCÓàD?@R'¾Í?{á•©¥'z¿µ×;ó?‰-ŽjW?@Çs]ê)?†øõÉÆÿ?…ut¥Ï\¿pàg ?„{9Ù½P3?@Çs]êM?‰-ŽjW¿¥ut¥Ïj?kÓãöàCŒ?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àg?„{9Ù½P3?‰-ŽjW?PÇs]êM?‰-ŽjW?kÓãöàCŒ¿µut¥Ïj?kÓãöàCŒ?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àg?„{9Ù½P3?‰-ŽjW?PÇs]êM?‰-ŽjW?kÓãöàCŒ¿µut¥Ïj?kÓãöàCŒ?…ut¥Ï\?‘†øõÉÆÿ?…ut¥Ï\?„{9Ù½P3¿€àg?„{9Ù½P3?‰-ŽjW?PÇs]êM?‰-ŽjW?kÓãöàCŒ¿µut¥Ïj?kÓãöàCŒ?…ut¥Ï\?†øõÉÆÿ?„{9Ù½P3¿pàgþ?‰-ŽjW?@Çs]ê)?kÓãöàCŒ¿¥ut¥Ïjslepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/readme0000644000175000017500000000077512211062077022577 0ustar gladkgladk SLEPc example matrices ---------------------- Saved in MATMPIAIJ format with a PetscViewerBinary. File Name Description ---------------------------------------------------------------------------- rdb200 Brusselator real unsymmetric, 200 by 200, 1120 entries bfw62a Waveguide real unsymmetric, 62 by 62, 450 entries bfw62b real symmetric indefinite, 62 by 62, 342 entries speaker107m Speaker quadratic eigenvalue problem speaker107c speaker107k slepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/bfw62a.petsc0000644000175000017500000001304012211062077023533 0ustar gladkgladk{P>>        !# "$!%'  !()  !#%&'()+-/  "&,.0 #%&'-/13 (+-45 %)+-1348: &*,.279; /138= 2679<!#"$! " !() "*!# "$!#%'"$& #%'-/ $&.0#%' () ()+- *,. )+-45 *,.6 %)+-/ &*,.0 %-/13&.02 /138: 029; /13 +45 +458 ,679 679 158: 2679; 18:= 29;< ;< :=?èZ±&~ ?Ä3H+輿ÏXÑRm‹?‹6¿y'¿ãY–tK+w?‹6¿y'¿ÏXÑRm‹?èZ±&~ ?À†ŠÁX?´3H+輿ÓY–tK+w¿ßXÑRm‹?‹6¿y'¿ÓY–tK+w?‹6¿y'?À†ŠÁX?øZ¯xþï_?À†ŠÁX?{6!z#1³?Ä3H+è¼?‹6¿y'¿ßXÑRm‹¿ãY–tK+w¿ßXÑRm‹?‹6¿y'?‹6¿y'?‹6¿y'¿ãY–tK+w?‹6¿y'?Ä3H+è¼?øZ¯xþï_?Ä3H+è¼?‹6¿y'¿ßXÑRm‹¿ãY–tK+w?‹6¿y'¿ßXÑRm‹?‹6¿y'¿ãY–tK+w?‹6¿y'?À†ŠÁX?èZ±\-þ@?{6!z#1³?´3H+è¼?‹6¿y'¿ßXÑRm‹¿ÓY–tK+w?‹6¿y'?‹6¿y'¿ÓY–tK+w?´3H+è¼?Íã+³âðü?ú$½º Ri¿‚f-[‚Ý•¿¾îéWG²?ÑýˆV{6Ø?‹6¿y'¿ÓY–tK+w¿í zg¥*Ç?°Ÿb0vÀ?ÞîîË$V!?‹6¿y'¿ñÇG„#?‹6¿y'?Øžavؤ?Íã+³âðü?À b?9@ ]¢r†/Z¿‚f-[‚Ý•?¹g‡Î•ú©?Þ•·U?‹6¿y'?‹6¿y'¿Þ^ª°BR‹¿Þîí‰öà¿ø1…H©¼ý¿í zg¥*Ç?°Ÿb0vÀ?ÞîîË$V!?‹6¿y'?‹6¿y'¿×´$_ZÙj?‹6¿y'¿ý¡-w1Å?‹6¿y'?Ä3H+è¼@²ù‡?úÂ?Ø þé6?‹6¿y'?‹6¿y'¿ë g‡Î•û¿ãY–tK+w¿ë g‡Î•û?‹6¿y'¿÷´$_ZÙj?‹6¿y'?Ó‘t|©Ÿ?À b?9?¾îî_Ä‹¶@KC•%?¹g‡Î•ú©?È ý¦‰l%?‹6¿y'¿Þ^ª°BR‹¿Þîí‰öà¿ó["Ðå`B?‹6¿y'¿×´$_ZÙj?‹6¿y'¿ç´&x9Í?È ý¦‰l%?{6!z#1³?ÿ8›R}Ô?Ó  8Bf­?‹6¿y'¿ç´&x9Í¿ó333333?‹6¿y'¿ç´&x9Í?‹6¿y'?Ø þé6?{6!z#1³?Ó  8Bf­@8›R}Ô?Ó  8Bf­?‹6¿y'?‹6¿y'¿ó333333¿÷´$_ZÙj¿ó333333?‹6¿y'?‹6¿y'¿÷´$_ZÙj?‹6¿y'?Ø þé6@8›R}Ô?Ø þé6?‹6¿y'?‹6¿y'¿ó333333¿÷´$_ZÙj¿ó333333?‹6¿y'¿÷´$_ZÙj?‹6¿y'?È ý¦‰l%?Ó  8Bf­?ÿ8›R}Ô?‹6¿y'¿ó333333¿ç´&x9Í?‹6¿y'¿ç´&x9Í?Ø þé6?ÿ8›R}Ô?‹6¿y'?‹6¿y'¿ã333333¿÷´$_ZÙj¿ã333333¿ÓY–tK+w?ïŸ;.ª7w¿á_Éÿ’ò¶?‹6¿y'¿á_Éÿ’ò¶?ÿŸ6&,ºs¿å ùã†L¶¿á_Éÿ’ò¶?‹6¿y'?ÿŸ6&,ºs¿å ùã†L¶¿å ùã†L¶¿á_Éÿ’ò¶¿ÏXÑRm‹¿å ùã†L¶?ïŸ;.ª7w¿ßXÑRm‹¿ßXÑRm‹?‹6¿y'¿å ùã†L¶?ÿŸ6&,ºs¿«6"ѼÖ¿«6"ѼÖ¿å ùã†L¶?‹6¿y'¿ßXÑRm‹¿å ùã†L¶?ÿŸ6&,ºs¿«6"ѼÖ¿å ùã†L¶?‹6¿y'¿ãY–tK+w¿á_Éÿ’ò¶¿«6"ѼÖ?ÿŸ6&,ºs¿á_Éÿ’ò¶¿ãY–tK+w¿ãY–tK+w¿á_Éÿ’ò¶¿«6"ѼÖ?ÿŸ6&,ºs¿á_Éÿ’ò¶¿«6"ѼÖ?‹6¿y'¿á_Éÿ’ò¶?ÿŸ6&,ºs¿å ùã†L¶¿á_Éÿ’ò¶?‹6¿y'¿á_Éÿ’ò¶?ÿŸ6&,ºs¿å ùã†L¶¿å ùã†L¶¿ÏXÑRm‹?‹6¿y'¿«6"ѼÖ¿å ùã†L¶?ïŸ;.ª7w¿ßXÑRm‹¿ßXÑRm‹?‹6¿y'¿å ùã†L¶?ÿŸ6&,ºs¿«6"ѼÖ¿«6"ѼÖ¿å ùã†L¶¿ßXÑRm‹?‹6¿y'¿å ùã†L¶?ÿŸ6&,ºs¿«6"ѼÖ¿å ùã†L¶?‹6¿y'¿ÓY–tK+w¿á_Éÿ’ò¶¿«6"ѼÖ?ïŸ;.ª7w¿ÓY–tK+w?‹6¿y'¿ÓY–tK+w¿«6"ѼÖ?ïŸ;.ª7w¿á_Éÿ’ò¶?‹6¿y'?‹6¿y'¿å ùã†L¶¿á_Éÿ’ò¶?ÿŸ6&,ºs¿å ùã†L¶¿á_Éÿ’ò¶?‹6¿y'¿å ùã†L¶?ÿŸ6&,ºs¿å ùã†L¶¿á_Éÿ’ò¶?ívS®Ó½‚¿Þ^ª°BR‹?°Ÿb0vÀ?ÞîîË$V!?ØÖí·þßÀÇü¹#¢œ@yÈÉ2 ™¿ýã*cÇP¿ég‡Î•ú©À3õ/Âek?‹6¿y'¿ë g‡Î•û¿å ùã†L¶@ È!laR¿«6"ѼÖ¿øØ/×^ ¿ãY–tK+w?‹6¿y'?‹6¿y'¿ãY–tK+w¿«6"ѼÖ¿á_Éÿ’ò¶¿«6"ѼÖ?ÿŸ6&,ºs¿á_Éÿ’ò¶¿ãY–tK+w¿ãY–tK+w¿«6"ѼÖ¿á_Éÿ’ò¶¿«6"ѼÖ?ÿŸ6&,ºs¿á_Éÿ’ò¶?‹6¿y'?‹6¿y'¿å ùã†L¶¿á_Éÿ’ò¶?ÿŸ6&,ºs¿å ùã†L¶¿á_Éÿ’ò¶?‹6¿y'¿å ùã†L¶¿á_Éÿ’ò¶?ÿŸ6&,ºs¿å ùã†L¶?ívS®Ó½‚¿Þ^ª°BR‹¿Þîí‰öà?°Ÿb0vÀ?ØÖí·þßÀÇü¹#¢œ@yÈÉ2 ™¿ýã*cÇP¿ég‡Î•ú©À3õ/Âek¿ë g‡Î•û?‹6¿y'¿å ùã†L¶@ È!laR¿«6"ѼÖ¿øØ/×^ ¿ÓY–tK+w?‹6¿y'¿ÓY–tK+w¿á_Éÿ’ò¶¿«6"ѼÖ?ïŸ;.ª7w¿ç´&x9Í?‹6¿y'¿ç´&x9Í¿«6"ѼÖ@™ý6÷ãÒ¿ô 篷é?‹6¿y'?‹6¿y'¿øØ/×^ ¿ô 篷é@™ú—á2µ¿øØ/×^ ¿ô 篷é?‹6¿y'¿øØ/×^ @™ú—á2µ¿øØ/×^ ¿ô 篷é?‹6¿y'¿ó333333¿ó333333¿øØ/×^ @™ú—á2µ¿«6"ѼÖ¿«6"ѼÖ¿øØ/×^ ?‹6¿y'¿ó333333¿øØ/×^ @™ú—á2µ¿«6"ѼÖ¿øØ/×^ ¿÷´$_ZÙj?‹6¿y'?‹6¿y'¿÷´$_ZÙj¿«6"ѼÖ¿ô 篷鿫6"ѼÖ@™ú—á2µ¿ô 篷é¿÷´$_ZÙj¿÷´$_ZÙj¿«6"ѼÖ¿ô 篷鿫6"ѼÖ@™ú—á2µ¿ô 篷é?‹6¿y'?‹6¿y'¿øØ/×^ ¿ô 篷é@™ú—á2µ¿øØ/×^ ¿ô 篷é?‹6¿y'¿øØ/×^ ¿ô 篷é@™ú—á2µ¿øØ/×^ ?‹6¿y'¿ó333333¿ó333333¿øØ/×^ @™ú—á2µ¿«6"ѼÖ¿«6"ѼÖ¿øØ/×^ ¿ó333333?‹6¿y'¿øØ/×^ @™ú—á2µ¿«6"ѼÖ¿øØ/×^ ¿ç´&x9Í?‹6¿y'¿ç´&x9Í¿ô 篷鿫6"ѼÖ@™ý6÷ãÒ¿ç´&x9Í?‹6¿y'¿«6"ѼÖ@™ý6÷ãÒ¿ô 篷é?‹6¿y'¿øØ/×^ ¿ô 篷é@™ú—á2µ¿ô 篷é?‹6¿y'¿øØ/×^ @™ú—á2µ¿øØ/×^ ¿ô 篷é?‹6¿y'¿ã333333¿øØ/×^ @™ý6÷ãÒ¿«6"ѼÖ¿÷´$_ZÙj?‹6¿y'¿«6"ѼÖ¿ô 篷é@™ú—á2µ¿ô 篷é¿÷´$_ZÙj¿÷´$_ZÙj¿«6"ѼÖ¿ô 篷鿫6"ѼÖ@™ú—á2µ¿ô 篷é?‹6¿y'¿øØ/×^ ¿ô 篷é@™ú—á2µ¿ô 篷é?‹6¿y'¿øØ/×^ ¿ô 篷é@™ú—á2µ¿øØ/×^ ¿ã333333¿øØ/×^ @™ý6÷ãÒ¿ç´&x9Í¿ô 篷é@™ý6÷ãÒslepc-3.4.2.dfsg.orig/share/slepc/datafiles/matrices/speaker107c.petsc0000644000175000017500000003361412211062077024502 0ustar gladkgladk{Pkk|RRRRRRR  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij  $%)*+,-./0123489=>?@ABCDEFGHLMQRSTUVWXYZ[\]^_`abcdefghij?/ â-=¿!ÎÑ ç3¿ÁñÆvk¿!ÎÑ çì?/ â-/?IŽû §Ì?Rlpl;w?^Â-ѧÆ?Rlpl;w?IŽû §ú?LÙ•\Z@?U 3¶Ä»?a÷aõñ?U 3¶Ä»?LÙ•\Ze¿$ €ªhf¿W¯5F­·â¿`H’³\+¿W¯5F­·â¿$ €ªhA?7¡åS—lÕ¿^B«šß^ ¿d‹P‚®A¿^B«šß^i?7¡åS—lè?ju]4z?ju]4¨?n½2¤–?n½2¤Ä¿P+·©®=¿‚s÷Br©¿¿ŠŠÓ‰› ¿‚s÷Br©Å¿P+·©®/?MqsêÂíï¿[²Íb Ü¿hÄ<%,M¿[²Íb f?MqsêÂî0?teÊ? }?teÊ? }.?xçuSÛ?xçuSý¿Y5–Ñg²¢¿ŒÃj¨TÛ¿”¤ÃN¿ŒÃj¨TÛ¿Y5–Ñg²t?L0áõä¿F0°„Ï¿R9ÿC‚6F¿F0°„š?L0áö$?j7P¢;u?j7P¢;»?nÐP,íE?nÐP,ís¿WÖÁœ¿„‡ÃÆȱ¿ŒÇ|®·Å·¿„‡ÃÆÈw¿WÖÁ??9á_ÑÑÃ?=7™\P î?>…£›?=7™\P €?9á_ÑÑú?EæÌÃTA’?JÒ|¤[ñ?XUGW[×»?JÒ|¤[ñ?EæÌÃTB?O,§o?Wž—ø(ê&?c)ú‡ø\*?Wž—ø(éø?O,§o׿<`5;?P†¿`5„yÂû¿dÈvQ7¿`5„yÂû¿<`5;?P*?*JñéÀÔ¿DgÄE^Íh¼sdËCxÅ%?DgÄE^Ì/¿*JñéÁh?W㌚ @¿/s*ô7Ä&ï.?Có¢á×â¿Csä2Sê¿V'S]ñ?Àæ)6Z™¿L:ÁUꢢ?Àæ)6V¿V'S]ñ¿w©Š“É'þ¿w©Š“É'ç¿vÎïéú¿vÎïé׿S³Ä–¹?c¼ú©>?-?y¹Ú.¿:¨02Ìlç¿:¨02ÌkÀ¿B¬¶´?qºè°íòD?z¶ýUÙ ?qºè°íòg?U¯>B¬¶X?C޼©~6i?b•ä×!ó?mý}C?b•ä×"8?C޼©~5g?&>v ‹¨?R¡®IPþž?`™·ð/¸?R¡®IPÿ(?&>v ‹¨C¿PÂFAÓ¿„O™âRÛ˜¿Zc¦W¿„O™âRÛ^¿PÂFAÓ.?fâ žùA ?fâ žù??Y{¬Ód¨B?Y{¬Ód¤?La`³²p¶?u›“ bû?³Èˆ% ?u›“ cW?La`³²p?C b­ž:3¿z²w79t‹¿‹¹^ÊÙTÙ¿z²w79t?C b­ž:j?që”þ²Ê?që”þ±©?fVû§ßŽõ?fVû§ßŒp?AË)zx£Ã?të ǽŔ?‚ïŽV þ?të ǽÆ?AË)zx£§?X‘(œOùt¿T)ÊN” Z¿lÕkRŒ¶ß¿T)ÊN” ?X‘(œOú·?aŸ›»0S?aŸ›»/÷?Ué`Ê¢½ø?Ué`Ê¢¼Y¿WìÑ•Ü ¿YÞ€ëšö¿Àª¨(˦¿YÞ€ë™W¿WìÑ•ÜT?TUÀf;?deñ>Ý–&?eÞ螎…Ö?deñ>Ý–=?TUÀf;Õ?Qw„yÚZØ?t;dl6‰?ì MhòÃ?t;dl6 ?Qw„yÚ[í?VGüƒ‡Sä?v¯S–mné?€¥ S+?v¯S–mné?VGüƒ‡Tœ¿K'íèç¿N¸ù~–âø¿4f¼çzªÚ¿N¸ù~–â7¿K'íèåÔ? ò‰ýœ…‚?Rì¤Ý·‰¼a³ñ¤«{¿Rì¤Ý·‰z¿ ò‰ýœ…‚¿MÒ´‘ˆÉ?ZM0ñŠë<ž »€Ú¿ZM0ñŠe?MÒ´‘Š1¿L¬â#2IÏ?[iuß„8<‘çƒDkjå¿[iuß‚È?L¬â#2Jl>úTz¨ß­?M°™ÏSnÎ<€•V¢XË¿M°™ÏSm¾úTz¨ß¨x¿8‰$·‰ƒ?m¯ïj²Qz¼ª*·<×ÞÓ¿m¯ïj²Sº?8‰$·‡È¿€eÞý–f?€eÞý–‰¿€qùÈPÂâ?€qùÈPÂó¿D%a„?c— ¿ù§<¡‡¯Ó9¿c— ¿ùe?D%aÃ3?5û]°á!ñ?nÕ¤ã‚X¡¼¢´l·È•Û¿nÕ¤ã‚Y¶¿5û]°á ¿)Xdß”?)XdßÍ¿‚,+,/{ë?‚,+,/|?é1?mîžBÖ’¢<¢Ê·Ì«<¿mîžBÖ‘_¿é/+?eHÁùÝ?ftq™ºŒA<Ç9aÕ¿ftq™º‹‰¿eHÁù<¿1bÆŸ«?1bÆŸ¯1¿TPð˜å†Í?TPð˜å‡…?`Hˆùƒj1?eAø’>s§¼GƯ‹èt ¿eAø’>t1¿`Hˆùƒj¥?Y¥ý ªàG?0~યÄK<‰ðr–·Ë¿0~ય½ô¿Y¥ý ªß?cÝZ¤Å¨¿.ȤÔú›<ûì.ylM?.ȤÕŒ¿cÝZ¤Å‘?[ ÌH¿@yiBЏ´<”å0+`ý?@yiBмN¿[ ÌH”?U'¯ÛîbX?6: 6ºY§¼r¶~¤ø9¿6: 6º\÷¿U'¯Ûîbâ?/ â-=?*JñéÀÔ?4C´¦Øe¿ ±U!F?¾Ô$|^i±¿H[]WÂ? ò‰ýœ…‚¿!ÎÑ ç3¿DgÄE^Íh?caÙŒ©É×?H'”§˜ž?E‰ý@³ï¿S¿¸ ª?Rì¤Ý·‰¿ÁñÆvk¼sdËCxÅ%?bðÅ­kgõ?Nô¬à~?SÛ:ÿóö`¿P·øéðš÷¼a³ñ¤«{¿!ÎÑ çì?DgÄE^Ì/?caÙŒ©Éî?H'”§˜ž?E‰ý@´&¿S¿¸ N¿Rì¤Ý·‰z?/ â-/¿*JñéÁh?4C´¦Ø¿ ±U!F?¾Ô$|^f0¿H[]WŽ¿ ò‰ýœ…‚?IŽû §Ì?W㌚ @¿Q3«é“¿=OÀ2éÉì?X†Ï?Š‹z?U¯>B¬¶´¿MÒ´‘ˆÉ?Rlpl;w¿/s*ô7Ä&¿3¤x§¯Û©?n³¶ñð?†"ÇçÁ‡Š?qºè°íòD?ZM0ñŠë?^Â-ѧÆB¬¶X?MÒ´‘Š1?LÙ•\Z@?W½Z µó§¿PªÓY(,¿2$ó0 ?WØ”…w?C޼©~6i¿L¬â#2IÏ?U 3¶Ä»¿¢õÕp D¿AFA–̃Ñ?pSE©Ö?…^¢ÁµX?b•ä×!ó?[iuß„8?a÷aõñv ‹¨>úTz¨ß­¿W¯5F­·â¿"n¾%¨ÛD¿9ýã’#v?Có¢áØ?Y˜ËØ©ç?R¡®IPþž?M°™ÏSnο`H’³\+»ÿ…¸iÙ ¿A•ÄÅ™ þ?DñÅr>ï.?awÝD•?`™·ð/¸<€•V¢XË¿W¯5F­·â?"n¾%¨Ûi¿9ýã’"ã?Có¢á×â?Y˜ËØ©ç?R¡®IPÿ(¿M°™ÏSm¿$ €ªhA¿4õ½Å Š¿3ªU›D˜¾¿Csä2Sê?)uFLs1?&>v ‹¨C¾úTz¨ß¨x?7¡åS—lÕ?T'–6Û?I¨bƄ˿V'S]ñ¿]Þ„(cã¿PÂFAÓ¿8‰$·‰ƒ¿^B«šß^ ¿dšpð.ê?ƒ‰¬Õôï6?Àæ)6Z™¿z ‘vz¿„O™âRÛ˜?m¯ïj²Qz¿d‹P‚®A¼—o¯6}eé?ˆ¸²9à¿L:ÁUꢢ¿„iÏp¹è\¿Zc¦W¼ª*·<×ÞÓ¿^B«šß^i?dšpð-¾?ƒ‰¬ÕôïS?Àæ)6V¿z ‘vc¿„O™âRÛ^¿m¯ïj²Sº?7¡åS—lè¿T'–7 ?I¨bƃä¿V'S]ñ¿]Þ„(cã¿PÂFAÓ.?8‰$·‡È?ju]4z?}·ð7ÓÍû¿xN+Uóﲿw©Š“É'þ¿fÝЭ•±T?fâ žùA ¿€eÞý–f?ju]4¨¿}·ð7ÓÍ“¿xN+Uóð_¿w©Š“É'ç¿fÝЭ•±™?fâ žù??€eÞý–‰?n½2¤–?|zä”Ù‚¿t°šQiä¿vÎïéú¿fâ¬:³ý?Y{¬Ód¨B¿€qùÈPÂâ?n½2¤Ä¿|zä”Ù¿t°šQiœ¿vÎïé׿fâ¬:³B?Y{¬Ód¤?€qùÈPÂó¿P+·©®=?X^bå׿Uý 8Ê¿S³Ä–¹¿lÕkRŒ¶ß<Ç9aÕ¿F0°„š?gù7ž“º?ŒJ#÷-]X¿w@XÒ^ýñ?c¼ú©>¿T)ÊN” ¿ftq™º‹‰?L0áö$¿h‰^"ï›?c[+çß½R¿hd”²²”?-?y¹Ú.?X‘(œOú·¿eHÁùs§¿ŒÇ|®·Å·t1¿WÖÁ?¿ha`ÇÙkh¿fsŒz0¿KBÚ{ü?@ÙÚ~vÝ¿WìÑ•ÜT¿`Hˆùƒj¥?9á_ÑÑÃ?Sðß92?RÑѪ1Š*¿AgATÙ5î¿2é6·3¶?TUÀf;?Y¥ý ªàG?=7™\P î¿P<,@@Ž‚?qÕÛ¿¢åÒ?Ë¿HÞ_h9GŽ?deñ>Ý–&?0~યÄK?>…£›¼Ší×eX?oþ‹Ü`´?A$[‹ÿóL¿P…V¬)T?eÞ螎…Ö<‰ðr–·Ë?=7™\P €?P<,@@d?qÕò¿¢åÒ?ËÈ¿HÞ_h9G{?deñ>Ý–=¿0~ય½ô?9á_ÑÑú¿Sðß92q?RÑѪ1‰ü¿AgATÙ68¿2é6·3G?TUÀf;Õ¿Y¥ý ªß?EæÌÃTA’?kÝr+PÌ¿WȺlžþ˜?DÁá“™À¿TS%äƒí?Qw„yÚZØ?cÝZ¤Å¨?JÒ|¤[ñ¿O±¾:"¬¿YMzÚx¦?ƒ@wéšä“¿x+Ïü®Á&?t;dl6‰¿.ȤÔú›?XUGW[×»>V   # $!% !) '(+/ ,0 #-1 -5 %)34: &*7; /8 26!#"$! " !() "*!# "$!#%'"$& #%'-/ $&.0#%'() ()+- *,.)+-45*,.6 %)+-/&*,.0 %-/13&.02/138: 029; /13 +45 +458 ,679 679 158:2679; 18:= 29;<;<:=¾è5Ô¹…>µfF‹QE>ÅfF‹QE>ÅfF‹QE¾è5Ô¹…>µfF‹QE>¥fF‹QE>ÅfF‹QE>ÅfF‹QE>µfF‹QE¾ø5Ô¹…>µfF‹QE>µfF‹QE>µfF‹QE>ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>µfF‹QE¾ø5Ô¹…>µfF‹QE>ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>µfF‹QE¾è5Ô¹…>µfF‹QE>¥fF‹QE>ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>¥fF‹QE>µfF‹QE¾ñÚò.ÓÚ>Âuº ò>º6âëC->ÅfF‹QE>ÅfF‹QE>Ú6âëC->µfF‹QE>µfF‹QE>Âuº ò¿ã±µ*>Âuº ò>Ê6âëC->Ê6âëC->ÅfF‹QE>ÅfF‹QE>ÅfF‹QE>Ú6âëC->Ú6âëC->Ú6âëC->µfF‹QE¿ã±µ*>Ê6âëC->ÅfF‹QE>ÅfF‹QE>Ú6âëC->Ú6âëC->¥fF‹QE>Âuº ò¾÷¬UD;T{>Ê6âëC->º6âëC->ÅfF‹QE>Ú6âëC->Ú6âëC->º6âëC->Ê6âëC-¾ý}¿HË’>Ê6âëC->Ú6âëC->Ú6âëC->Ú6âëC->Ê6âëC->Ê6âëC->Ê6âëC-¿ }¿HË’>Ê6âëC->Ú6âëC->Ú6âëC->Ú6âëC->Ú6âëC->Ú6âëC->Ê6âëC-¿ }¿HË’>Ê6âëC->Ú6âëC->Ú6âëC->Ú6âëC->Ú6âëC->º6âëC->Ê6âëC-¾ý}¿HË’>Ú6âëC->Ú6âëC->Ê6âëC-¾ý}¿HË’>Ú6âëC->Ú6âëC-¾õfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt¾õfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¾õfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¾õfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¾õfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE>Ú6âëC-¾åfHÓ;Mt¿uª\ôó¾åfHÓ;Mt¾ú6âëC-¾ú6âëC->ÅfF‹QE¾åfHÓ;Mt¿uª\ôó¾åfHÓ;Mt¾ú6âëC->ÅfF‹QE>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt>ÅfF‹QE>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt¾åfHÓ;Mt>ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¿fEcŸR9¾åfHÓ;Mt>ÅfF‹QE>Ú6âëC-¾åfHÓ;Mt¿uª\ôó¾åfHÓ;Mt¾ú6âëC-¾ú6âëC->Ú6âëC-¾åfHÓ;Mt¿uª\ôó¾ú6âëC-¾ú6âëC->ÅfF‹QE¾åfHÓ;Mt¾åfHÓ;Mt¾õfHÓ;Mt>Ú6âëC-¾ú6âëC-¿ 6âëC-¾ú6âëC->Ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC->Ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿ 6âëC->Ú6âëC-¾ú6âëC-¿ 6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¿ 6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC->Ú6âëC-¾ú6âëC-¾ú6âëC-¿6âëC-¾ú6âëC-¾ú6âëC-¿ 6âëC-¾ú6âëC-¿ 6âëC-slepc-3.4.2.dfsg.orig/docs/0000755000175000017500000000000012214143515014363 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/faq.htm0000644000175000017500000000610212211062077015643 0ustar gladkgladk FAQ

 

 

A longer list of frequently asked questions can be found here.
 

Where should I send SLEPc bug reports and questions?

Send all maintenance requests to the SLEPc developers via the email address slepc-maint@grycap.upv.es.

 

How can I subscribe to the SLEPc users mailing list?

You can join the SLEPc users mailing list by following the instructions in the Contact section. We will update users regarding new releases, changes, etc. through this mailing list.

 

Apart from PETSc, is it necessary to install other software to use SLEPc?

No, the only requirement to use SLEPc is to have PETSc installed in your system. Additionally, if you want to have access to eigensolvers not included in SLEPc, then you will have to install other libraries (e.g. ARPACK).

 

Which is the recommended way of learning SLEPc?

Possibly, the best way of learning to use SLEPc is to follow these steps:

  • First of all, get acquainted with PETSc if you are not already familiar with it (see the PETSc tutorials page).
  • Read through the entire SLEPc Users Manual. In a first reading, one may skip the "advanced usage" sections.
  • Follow the steps provided by the hands-on exercises, trying the examples in an available SLEPc installation.
  • Use the example programs available in src/examples as a basis for your own programs.
  • Use the on-line manual pages for reference for individual routines.

 

slepc-3.4.2.dfsg.orig/docs/manualpages/0000755000175000017500000000000012214143515016660 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/DS/0000755000175000017500000000000012214143515017166 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetOptionsPrefix.html0000644000175000017500000000270512211062077023560 0ustar gladkgladk DSGetOptionsPrefix

DSGetOptionsPrefix

Gets the prefix used for searching for all DS options in the database.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetOptionsPrefix(DS ds,const char *prefix[])
Not Collective

Input Parameters

ds - the direct solver context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

DSSetOptionsPrefix(), DSAppendOptionsPrefix()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetRefined.html0000644000175000017500000000345112211062077022336 0ustar gladkgladk DSSetRefined

DSSetRefined

Sets a flag to indicate that refined vectors must be computed.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetRefined(DS ds,PetscBool ref)
Logically Collective on DS

Input Parameter

ds - the direct solver context
ref - a boolean flag

Notes

Normally the vectors returned in DS_MAT_X are eigenvectors of the projected matrix. With this flag activated, DSVectors() will return the right singular vector of the smallest singular value of matrix \tilde{A}-theta*I, where \tilde{A} is the extended (n+1)xn matrix and theta is the Ritz value. This is used in the refined Ritz approximation.

The default is PETSC_FALSE.

See Also

DSVectors(), DSGetRefined()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSRegisterAll.html0000644000175000017500000000147712211062077022531 0ustar gladkgladk DSRegisterAll

DSRegisterAll

Registers all of the direct solvers in the DS package.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSRegisterAll(void)
Not Collective

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSNormalize.html0000644000175000017500000000332612211062077022247 0ustar gladkgladk DSNormalize

DSNormalize

Normalize a column or all the columns of a matrix. Considers the case when the columns represent the real and the imaginary part of a vector.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSNormalize(DS ds,DSMatType mat,PetscInt col)
Logically Collective on DS

Input Parameter

ds - the direct solver context
mat - the matrix to be modified
col - the column to normalize or -1 to normalize all of them

Notes

The columns are normalized with respect to the 2-norm.

If col and col+1 (or col-1 and col) represent the real and the imaginary part of a vector, both columns are scaled.

See Also

DSMatType

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetNumFN.html0000644000175000017500000000230112211062077021722 0ustar gladkgladk DSGetNumFN

DSGetNumFN

Returns the number of functions stored internally by the DS.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetNumFN(DS ds,PetscInt *n)
Not collective

Input Parameter

ds - the direct solver context

Output Parameters

n - the number of functions passed in DSSetFN()

See Also

DSSetFN()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSInitializePackage.html0000644000175000017500000000217212211062077023662 0ustar gladkgladk DSInitializePackage

DSInitializePackage

This function initializes everything in the DS package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to DSCreate() when using static libraries.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSInitializePackage()

See Also

SlepcInitialize()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetFunctionMethod.html0000644000175000017500000000227412211062077023676 0ustar gladkgladk DSGetFunctionMethod

DSGetFunctionMethod

Gets the method currently used to compute a matrix function.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetFunctionMethod(DS ds,PetscInt *meth)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

meth - identifier of the function method

See Also

DSSetFunctionMethod()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetArrayReal.html0000644000175000017500000000311612211062077022626 0ustar gladkgladk DSGetArrayReal

DSGetArrayReal

Returns a pointer to one of the internal arrays used to represent real matrices. You MUST call DSRestoreArray() when you no longer need to access the array.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetArrayReal(DS ds,DSMatType m,PetscReal *a[])
Not Collective

Input Parameters

ds - the direct solver context
m - the requested matrix

Output Parameter

a - pointer to the values

See Also

DSRestoreArrayReal(), DSGetArray()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetFunctionMethod.html0000644000175000017500000000254512211062077023713 0ustar gladkgladk DSSetFunctionMethod

DSSetFunctionMethod

Selects the method to be used to compute a matrix function.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetFunctionMethod(DS ds,PetscInt meth)
Logically Collective on DS

Input Parameter

ds - the direct solver context
meth - an index indentifying the function method

See Also

DSGetFunctionMethod()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetExtraRow.html0000644000175000017500000000212412211062077022515 0ustar gladkgladk DSGetExtraRow

DSGetExtraRow

Gets the extra row flag.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetExtraRow(DS ds,PetscBool *ext)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

ext - the flag

See Also

DSSetExtraRow()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetCompact.html0000644000175000017500000000315512211062077022351 0ustar gladkgladk DSSetCompact

DSSetCompact

Switch to compact storage of matrices.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetCompact(DS ds,PetscBool comp)
Logically Collective on DS

Input Parameter

ds - the direct solver context
comp - a boolean flag

Notes

Compact storage is used in some DS types such as DSHEP when the matrix is tridiagonal. This flag can be used to indicate whether the user provides the matrix entries via the compact form (the tridiagonal DS_MAT_T) or the non-compact one (DS_MAT_A).

The default is PETSC_FALSE.

See Also

DSGetCompact()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetFN.html0000644000175000017500000000401512211062077021262 0ustar gladkgladk DSSetFN

DSSetFN

Sets a number of functions to be used internally by DS.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetFN(DS ds,PetscInt n,FN f[])
Collective on DS and FN

Input Parameters

ds - the direct solver context
n - number of functions
f - array of functions

Notes

In the basic usage, only one function is used, for instance to evaluate a function of the projected matrix. In the context of nonlinear eigensolvers, there are as many functions as terms in the split nonlinear operator T(lambda) = sum_i A_i*f_i(lambda).

This function must be called before DSAllocate(). Then DSAllocate() will allocate an extra matrix per each function.

See Also

DSGetFN(), DSGetFN(), DSAllocate()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSType.html0000644000175000017500000000231012211062077021220 0ustar gladkgladk DSType

DSType

String with the name of the type of direct solver. Roughly, there are as many types as problem types are available within SLEPc.

Synopsis

typedef const char* DSType;
#define DSHEP             "hep"
#define DSNHEP            "nhep"
#define DSGHEP            "ghep"
#define DSGHIEP           "ghiep"
#define DSGNHEP           "gnhep"
#define DSSVD             "svd"
#define DSQEP             "qep"
#define DSNEP             "nep"

See Also

DSSetType(), DS

Location: src/ds/../../include/slepcds.h
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetArray.html0000644000175000017500000000307312211062077022024 0ustar gladkgladk DSGetArray

DSGetArray

Returns a pointer to one of the internal arrays used to represent matrices. You MUST call DSRestoreArray() when you no longer need to access the array.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetArray(DS ds,DSMatType m,PetscScalar *a[])
Not Collective

Input Parameters

ds - the direct solver context
m - the requested matrix

Output Parameter

a - pointer to the values

See Also

DSRestoreArray(), DSGetArrayReal()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSTranslateRKS.html0000644000175000017500000000342712211062077022626 0ustar gladkgladk DSTranslateRKS

DSTranslateRKS

Computes a modification of the dense system corresponding to an update of the shift in a rational Krylov method.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSTranslateRKS(DS ds,PetscScalar alpha)
Logically Collective on DS

Input Parameters

ds - the direct solver context
alpha - the translation amount

Notes

This function is intended for use in the context of Krylov methods only. It takes the leading (k+1,k) submatrix of A, containing the truncated Rayleigh quotient of a Krylov-Schur relation computed from a shift sigma1 and transforms it to obtain a Krylov relation as if computed from a different shift sigma2. The new matrix is computed as 1.0/alpha*(eye(k)-Q*inv(R)), where [Q,R]=qr(eye(k)-alpha*A) and alpha = sigma1-sigma2.

Matrix Q is placed in DS_MAT_Q so that it can be used to update the Krylov basis.

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSDestroy.html0000644000175000017500000000212412211062077021733 0ustar gladkgladk DSDestroy

DSDestroy

Destroys DS context that was created with DSCreate().

Synopsis

#include "slepcds.h" 
PetscErrorCode DSDestroy(DS *ds)
Collective on DS

Input Parameter

ds - the direct solver context

See Also

DSCreate()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSCreate.html0000644000175000017500000000256312211062077021514 0ustar gladkgladk DSCreate

DSCreate

Creates a DS context.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSCreate(MPI_Comm comm,DS *newds)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

newds - location to put the DS context

Note

DS objects are not intended for normal users but only for advanced user that for instance implement their own solvers.

See Also

DSDestroy(), DS

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetState.html0000644000175000017500000000211012211062077022015 0ustar gladkgladk DSGetState

DSGetState

Returns the current state.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetState(DS ds,DSStateType *state)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

state - current state

See Also

DSSetState()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetFromOptions.html0000644000175000017500000000207012211062077023235 0ustar gladkgladk DSSetFromOptions

DSSetFromOptions

Sets DS options from the options database.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetFromOptions(DS ds)
Collective on DS

Input Parameters

ds - the direct solver context

Notes

To see all options, run your program with the -help option.

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetState.html0000644000175000017500000000324712211062077022045 0ustar gladkgladk DSSetState

DSSetState

Change the state of the DS object.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetState(DS ds,DSStateType state)
Logically Collective on DS

Input Parameters

ds - the direct solver context
state - the new state

Notes

The state indicates that the dense system is in an initial state (raw), in an intermediate state (such as tridiagonal, Hessenberg or Hessenberg-triangular), in a condensed state (such as diagonal, Schur or generalized Schur), or in a truncated state.

This function is normally used to return to the raw state when the condensed structure is destroyed.

See Also

DSGetState()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetEigenvalueComparison.html0000644000175000017500000000615512211062077025105 0ustar gladkgladk DSSetEigenvalueComparison

DSSetEigenvalueComparison

Specifies the eigenvalue comparison function to be used for sorting.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetEigenvalueComparison(DS ds,PetscErrorCode (*fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)
Logically Collective on DS

Input Parameters

ds - the direct solver context
fun - a pointer to the comparison function
ctx - a context pointer (the last parameter to the comparison function)

Calling Sequence of fun

 func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

ar - real part of the 1st eigenvalue
ai - imaginary part of the 1st eigenvalue
br - real part of the 2nd eigenvalue
bi - imaginary part of the 2nd eigenvalue
res - result of comparison
ctx - optional context, as set by DSSetEigenvalueComparison()

Note

The returning parameter 'res' can be
negative - if the 1st eigenvalue is preferred to the 2st one
zero - if both eigenvalues are equally preferred
positive - if the 2st eigenvalue is preferred to the 1st one

See Also

DSSort()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSolve.html0000644000175000017500000000325112211062077021374 0ustar gladkgladk DSSolve

DSSolve

Solves the problem.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSolve(DS ds,PetscScalar *eigr,PetscScalar *eigi)
Logically Collective on DS

Input Parameters

ds - the direct solver context
eigr - array to store the computed eigenvalues (real part)
eigi - array to store the computed eigenvalues (imaginary part)

Note

This call brings the dense system to condensed form. No ordering of the eigenvalues is enforced (for this, call DSSort() afterwards).

See Also

DSSort(), DSStateType

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DS.html0000644000175000017500000000173212211062077020365 0ustar gladkgladk DS

DS

Direct solver (or dense system), to represent low-dimensional eigenproblems that must be solved within iterative solvers. This is an auxiliary object and is not normally needed by application programmers.

Synopsis

typedef struct _p_DS* DS;

See Also

DSCreate()

Location: src/ds/../../include/slepcds.h
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSCond.html0000644000175000017500000000236412211062077021173 0ustar gladkgladk DSCond

DSCond

Compute the inf-norm condition number of the first matrix as cond(A) = norm(A)*norm(inv(A)).

Synopsis

#include "slepcds.h" 
PetscErrorCode DSCond(DS ds,PetscReal *cond)
Not Collective

Input Parameters

ds - the direct solver context
cond - the computed condition number

See Also

DSSolve()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetFN.html0000644000175000017500000000266112211062077021253 0ustar gladkgladk DSGetFN

DSGetFN

Gets the functions associated with this DS.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetFN(DS ds,PetscInt k,FN *f)
Not collective, though parallel FNs are returned if the DS is parallel

Input Parameter

ds - the direct olver context
k - the index of the requested function (starting in 0)

Output Parameter

f - the function

See Also

DSSetFN()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSAllocate.html0000644000175000017500000000305112211062077022026 0ustar gladkgladk DSAllocate

DSAllocate

Allocates memory for internal storage or matrices in DS.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSAllocate(DS ds,PetscInt ld)
Logically Collective on DS

Input Parameters

ds - the direct solver context
ld - leading dimension (maximum allowed dimension for the matrices, including the extra row if present)

See Also

DSGetLeadingDimension(), DSSetDimensions(), DSSetExtraRow()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSTranslateHarmonic.html0000644000175000017500000000471312211062077023726 0ustar gladkgladk DSTranslateHarmonic

DSTranslateHarmonic

Computes a translation of the dense system.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSTranslateHarmonic(DS ds,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *g,PetscReal *gamma)
Logically Collective on DS

Input Parameters

ds - the direct solver context
tau - the translation amount
beta - last component of vector b
recover - boolean flag to indicate whether to recover or not

Output Parameters

g - the computed vector (optional)
gamma - scale factor (optional)

Notes

This function is intended for use in the context of Krylov methods only. It computes a translation of a Krylov decomposition in order to extract eigenpair approximations by harmonic Rayleigh-Ritz. The matrix is updated as A + g*b' where g = (A-tau*eye(n))'\b and vector b is assumed to be beta*e_n^T.

The gamma factor is defined as sqrt(1+g'*g) and can be interpreted as the factor by which the residual of the Krylov decomposition is scaled.

If the recover flag is activated, the computed translation undoes the translation done previously. In that case, parameter tau is ignored.

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSAppendOptionsPrefix.html0000644000175000017500000000321012211062077024240 0ustar gladkgladk DSAppendOptionsPrefix

DSAppendOptionsPrefix

Appends to the prefix used for searching for all DS options in the database.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSAppendOptionsPrefix(DS ds,const char *prefix)
Logically Collective on DS

Input Parameters

ds - the direct solver context
prefix - the prefix string to prepend to all DS option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

DSSetOptionsPrefix()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/index.html0000644000175000017500000001165612211062077021174 0ustar gladkgladk Direct Solver (or Dense System) - DS

Direct Solver (or Dense System) - DS

The DS package provides auxiliary routines that are internally used by the different SLEPc solvers. It is used to represent low-dimensional eigenproblems that must be solved within iterative solvers with direct methods. It can be seen as a structured wrapper to LAPACK functionality.

These routines are usually not needed by application programmers.

Beginner - Basic usage
DS DSDestroy DSView
DSCreate DSSetFromOptions
Intermediate - Setting options for algorithms and data structures
DSAllocate DSGetType DSSolve
DSComputeFunction DSSetDimensions DSSort
DSGetDimensions DSSetFunctionMethod DSVectors
DSGetFunctionMethod DSSetMethod
DSGetMethod DSSetType
Advanced - Setting more advanced options and customization
DSAppendOptionsPrefix DSGetState DSSetExtraRow
DSCond DSMatType DSSetOptionsPrefix
DSGetArray DSNormalize DSSetRefined
DSGetArrayReal DSRegister DSSetState
DSGetCompact DSRegisterAll DSStateType
DSGetExtraRow DSReset DSTruncate
DSGetLeadingDimension DSRestoreArray DSType
DSGetOptionsPrefix DSRestoreArrayReal DSUpdateExtraRow
DSGetRefined DSSetCompact
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
DSFinalizePackage DSGetNumFN DSSetFN
DSGetEigenvalueComparison DSInitializePackage DSTranslateHarmonic
DSGetFN DSSetEigenvalueComparison DSTranslateRKS
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetMethod.html0000644000175000017500000000220712211062077022164 0ustar gladkgladk DSGetMethod

DSGetMethod

Gets the method currently used in the DS.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetMethod(DS ds,PetscInt *meth)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

meth - identifier of the method

See Also

DSSetMethod()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSTruncate.html0000644000175000017500000000314012211062077022066 0ustar gladkgladk DSTruncate

DSTruncate

Truncates the system represented in the DS object.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSTruncate(DS ds,PetscInt n)
Logically Collective on DS

Input Parameters

ds - the direct solver context
n - the new size

Note

The new size is set to n. In cases where the extra row is meaningful, the first n elements are kept as the extra row for the new system.

See Also

DSSetDimensions(), DSSetExtraRow(), DSStateType

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetMethod.html0000644000175000017500000000243412211062077022202 0ustar gladkgladk DSSetMethod

DSSetMethod

Selects the method to be used to solve the problem.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetMethod(DS ds,PetscInt meth)
Logically Collective on DS

Input Parameter

ds - the direct solver context
meth - an index indentifying the method

See Also

DSGetMethod()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetRefined.html0000644000175000017500000000212312211062077022315 0ustar gladkgladk DSGetRefined

DSGetRefined

Gets the refined vectors flag.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetRefined(DS ds,PetscBool *ref)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

ref - the flag

See Also

DSSetRefined()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSFinalizePackage.html0000644000175000017500000000205012211062077023315 0ustar gladkgladk DSFinalizePackage

DSFinalizePackage

This function destroys everything in the SLEPc interface to the DS package. It is called from SlepcFinalize().

Synopsis

#include "slepcds.h" 
PetscErrorCode DSFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSRestoreArrayReal.html0000644000175000017500000000275412211062077023541 0ustar gladkgladk DSRestoreArrayReal

DSRestoreArrayReal

Restores the matrix after DSGetArrayReal() was called.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSRestoreArrayReal(DS ds,DSMatType m,PetscReal *a[])
Not Collective

Input Parameters

ds - the direct solver context
m - the requested matrix
a - pointer to the values

See Also

DSGetArrayReal(), DSGetArray()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSStateType.html0000644000175000017500000000173012211062077022226 0ustar gladkgladk DSStateType

DSStateType

Indicates in which state the direct solver is

Synopsis

typedef enum { DS_STATE_RAW,
               DS_STATE_INTERMEDIATE,
               DS_STATE_CONDENSED,
               DS_STATE_TRUNCATED } DSStateType;

See Also

DSSetState()

Location: src/ds/../../include/slepcds.h
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetLeadingDimension.html0000644000175000017500000000240612211062077024156 0ustar gladkgladk DSGetLeadingDimension

DSGetLeadingDimension

Returns the leading dimension of the allocated matrices.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetLeadingDimension(DS ds,PetscInt *ld)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

ld - leading dimension (maximum allowed dimension for the matrices)

See Also

DSAllocate(), DSSetDimensions()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSView.html0000644000175000017500000000355312211062077021223 0ustar gladkgladk DSView

DSView

Prints the DS data structure.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSView(DS ds,PetscViewer viewer)
Collective on DS

Input Parameters

ds - the direct solver context
viewer - optional visualization context

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

PetscViewerASCIIOpen()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSUpdateExtraRow.html0000644000175000017500000000223212211062077023220 0ustar gladkgladk DSUpdateExtraRow

DSUpdateExtraRow

Performs all necessary operations so that the extra row gets up-to-date after a call to DSSolve().

Synopsis

#include "slepcds.h" 
PetscErrorCode DSUpdateExtraRow(DS ds)
Not Collective

Input Parameters

ds - the direct solver context

See Also

DSSolve(), DSSetExtraRow()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSRegister.html0000644000175000017500000000277612211062077022103 0ustar gladkgladk DSRegister

DSRegister

Adds a direct solver to the DS package.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSRegister(const char *name,PetscErrorCode (*function)(DS))
Not collective

Input Parameters

name - name of a new user-defined DS
routine_create - routine to create context

Notes

DSRegister() may be called multiple times to add several user-defined direct solvers.

See Also

DSRegisterAll()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSReset.html0000644000175000017500000000203112211062077021361 0ustar gladkgladk DSReset

DSReset

Resets the DS context to the initial state.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSReset(DS ds)
Collective on DS

Input Parameter

ds - the direct solver context

See Also

DSDestroy()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSComputeFunction.html0000644000175000017500000000303212211062077023423 0ustar gladkgladk DSComputeFunction

DSComputeFunction

Computes a matrix function.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSComputeFunction(DS ds,SlepcFunction f)
Logically Collective on DS

Input Parameters

ds - the direct solver context
f - the function to evaluate

Note

This function evaluates F = f(A), where the input and the result matrices are stored in DS_MAT_A and DS_MAT_F, respectively.

See Also

DSSetFunctionMethod(), DSMatType, SlepcFunction

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetDimensions.html0000644000175000017500000000374512211062077023064 0ustar gladkgladk DSGetDimensions

DSGetDimensions

Returns the current dimensions.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetDimensions(DS ds,PetscInt *n,PetscInt *m,PetscInt *l,PetscInt *k,PetscInt *t)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

n - the current size
m - the current column size (only for DSSVD)
l - number of locked (inactive) leading columns
k - intermediate dimension (e.g., position of arrow)
t - truncated length

Note

The t parameter makes sense only if DSTruncate() has been called. Otherwise its value equals n.

See Also

DSSetDimensions(), DSTruncate()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSRestoreArray.html0000644000175000017500000000272212211062077022730 0ustar gladkgladk DSRestoreArray

DSRestoreArray

Restores the matrix after DSGetArray() was called.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSRestoreArray(DS ds,DSMatType m,PetscScalar *a[])
Not Collective

Input Parameters

ds - the direct solver context
m - the requested matrix
a - pointer to the values

See Also

DSGetArray(), DSGetArrayReal()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSMatType.html0000644000175000017500000000711112211062077021666 0ustar gladkgladk DSMatType

DSMatType

Used to refer to one of the matrices stored internally in DS

Synopsis

typedef enum { DS_MAT_A,
               DS_MAT_B,
               DS_MAT_C,
               DS_MAT_T,
               DS_MAT_D,
               DS_MAT_F,
               DS_MAT_Q,
               DS_MAT_Z,
               DS_MAT_X,
               DS_MAT_Y,
               DS_MAT_U,
               DS_MAT_VT,
               DS_MAT_W,
               DS_MAT_E0,
               DS_MAT_E1,
               DS_MAT_E2,
               DS_MAT_E3,
               DS_MAT_E4,
               DS_MAT_E5,
               DS_MAT_E6,
               DS_MAT_E7,
               DS_MAT_E8,
               DS_MAT_E9,
               DS_NUM_MAT } DSMatType;

Notes

The matrices preferently refer to
DS_MAT_A - first matrix of eigenproblem/singular value problem
DS_MAT_B - second matrix of a generalized eigenproblem
DS_MAT_C - third matrix of a quadratic eigenproblem
DS_MAT_T - tridiagonal matrix
DS_MAT_D - diagonal matrix
DS_MAT_F - result of matrix function
DS_MAT_Q - orthogonal matrix of (right) Schur vectors
DS_MAT_Z - orthogonal matrix of left Schur vectors
DS_MAT_X - right eigenvectors
DS_MAT_Y - left eigenvectors
DS_MAT_U - left singular vectors
DS_MAT_VT - right singular vectors
DS_MAT_W - workspace matrix
DS_MAT_Ex - extra matrices (x=0,..,9)

All matrices can have space to hold ld x ld elements, except for DS_MAT_T that has space for 3 x ld elements (ld = leading dimension) and DS_MAT_D that has space for just ld elements.

See Also

DSAllocate(), DSGetArray(), DSGetArrayReal(), DSVectors()

Location: src/ds/../../include/slepcds.h
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetEigenvalueComparison.html0000644000175000017500000000624312211062077025067 0ustar gladkgladk DSGetEigenvalueComparison

DSGetEigenvalueComparison

Gets the eigenvalue comparison function used for sorting.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetEigenvalueComparison(DS ds,PetscErrorCode (**fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void** ctx)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameters

fun - a pointer to the comparison function
ctx - a context pointer (the last parameter to the comparison function)

Calling Sequence of fun

 func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

ar - real part of the 1st eigenvalue
ai - imaginary part of the 1st eigenvalue
br - real part of the 2nd eigenvalue
bi - imaginary part of the 2nd eigenvalue
res - result of comparison
ctx - optional context, as set by DSSetEigenvalueComparison()

Note

The returning parameter 'res' can be
negative - if the 1st eigenvalue is preferred to the 2st one
zero - if both eigenvalues are equally preferred
positive - if the 2st eigenvalue is preferred to the 1st one

See Also

DSSort(), DSSetEigenvalueComparison()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSort.html0000644000175000017500000000552212211062077021236 0ustar gladkgladk DSSort

DSSort

Sorts the result of DSSolve() according to a given sorting criterion.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSort(DS ds,PetscScalar *eigr,PetscScalar *eigi,PetscScalar *rr,PetscScalar *ri,PetscInt *k)
Logically Collective on DS

Input Parameters

ds - the direct solver context
eigr - array containing the computed eigenvalues (real part)
eigi - array containing the computed eigenvalues (imaginary part)
rr - (optional) array containing auxiliary values (real part)
ri - (optional) array containing auxiliary values (imaginary part)

Input/Output Parameter

k - (optional) number of elements in the leading group

Notes

This routine sorts the arrays provided in eigr and eigi, and also sorts the dense system stored inside ds (assumed to be in condensed form). The sorting criterion is specified with DSSetEigenvalueComparison().

If arrays rr and ri are provided, then a (partial) reordering based on these values rather than on the eigenvalues is performed. In symmetric problems a total order is obtained (parameter k is ignored), but otherwise the result is sorted only partially. In this latter case, it is only guaranteed that all the first k elements satisfy the comparison with any of the last n-k elements. The output value of parameter k is the final number of elements in the first set.

See Also

DSSolve(), DSSetEigenvalueComparison()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetType.html0000644000175000017500000000240712211062077021703 0ustar gladkgladk DSSetType

DSSetType

Selects the type for the DS object.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetType(DS ds,DSType type)
Logically Collective on DS

Input Parameter

ds - the direct solver context
type - a known type

See Also

DSGetType()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetCompact.html0000644000175000017500000000212512211062077022331 0ustar gladkgladk DSGetCompact

DSGetCompact

Gets the compact storage flag.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetCompact(DS ds,PetscBool *comp)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

comp - the flag

See Also

DSSetCompact()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSVectors.html0000644000175000017500000000456212211062077021737 0ustar gladkgladk DSVectors

DSVectors

Compute vectors associated to the dense system such as eigenvectors.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSVectors(DS ds,DSMatType mat,PetscInt *j,PetscReal *rnorm)
Logically Collective on DS

Input Parameters

ds - the direct solver context
mat - the matrix, used to indicate which vectors are required

Input/Output Parameter

j - (optional) index of vector to be computed

Output Parameter

rnorm - (optional) computed residual norm

Notes

Allowed values for mat are DS_MAT_X, DS_MAT_Y, DS_MAT_U and DS_MAT_VT, to compute right or left eigenvectors, or left or right singular vectors, respectively.

If NULL is passed in argument j then all vectors are computed, otherwise j indicates which vector must be computed. In real non-symmetric problems, on exit the index j will be incremented when a complex conjugate pair is found.

This function can be invoked after the dense problem has been solved, to get the residual norm estimate of the associated Ritz pair. In that case, the relevant information is returned in rnorm.

For computing eigenvectors, LAPACK's _trevc is used so the matrix must be in (quasi-)triangular form, or call DSSolve() first.

See Also

DSSolve()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetExtraRow.html0000644000175000017500000000342712211062077022540 0ustar gladkgladk DSSetExtraRow

DSSetExtraRow

Sets a flag to indicate that the matrix has one extra row.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetExtraRow(DS ds,PetscBool ext)
Logically Collective on DS

Input Parameter

ds - the direct solver context
ext - a boolean flag

Notes

In Krylov methods it is useful that the matrix representing the direct solver has one extra row, i.e., has dimension (n+1) x n. If this flag is activated, all transformations applied to the right of the matrix also affect this additional row. In that case, (n+1) must be less or equal than the leading dimension.

The default is PETSC_FALSE.

See Also

DSSolve(), DSAllocate(), DSGetExtraRow()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetDimensions.html0000644000175000017500000000364212211062077023074 0ustar gladkgladk DSSetDimensions

DSSetDimensions

Resize the matrices in the DS object.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetDimensions(DS ds,PetscInt n,PetscInt m,PetscInt l,PetscInt k)
Logically Collective on DS

Input Parameters

ds - the direct solver context
n - the new size
m - the new column size (only for DSSVD)
l - number of locked (inactive) leading columns
k - intermediate dimension (e.g., position of arrow)

Notes

The internal arrays are not reallocated.

The value m is not used except in the case of DSSVD, pass 0 otherwise.

See Also

DSGetDimensions(), DSAllocate()

Location: src/ds/interface/dsops.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSGetType.html0000644000175000017500000000224612211062077021670 0ustar gladkgladk DSGetType

DSGetType

Gets the DS type name (as a string) from the DS context.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSGetType(DS ds,DSType *type)
Not Collective

Input Parameter

ds - the direct solver context

Output Parameter

name - name of the direct solver

See Also

DSSetType()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/DS/DSSetOptionsPrefix.html0000644000175000017500000000317712211062077023600 0ustar gladkgladk DSSetOptionsPrefix

DSSetOptionsPrefix

Sets the prefix used for searching for all DS options in the database.

Synopsis

#include "slepcds.h" 
PetscErrorCode DSSetOptionsPrefix(DS ds,const char *prefix)
Logically Collective on DS

Input Parameters

ds - the direct solver context
prefix - the prefix string to prepend to all DS option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

DSAppendOptionsPrefix()

Location: src/ds/interface/dsbasic.c
Index of all DS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/singleindex.html0000644000175000017500000014374112211062077022071 0ustar gladkgladk Subroutine Index

| D | E | F | I | M | N | Q | S | V |

DS DSGetNumFN DSSetFromOptions
DSAllocate DSGetOptionsPrefix DSSetFunctionMethod
DSAppendOptionsPrefix DSGetRefined DSSetMethod
DSComputeFunction DSGetState DSSetOptionsPrefix
DSCond DSGetType DSSetRefined
DSCreate DSInitializePackage DSSetState
DSDestroy DSMatType DSSetType
DSFinalizePackage DSNormalize DSSolve
DSGetArray DSRegister DSSort
DSGetArrayReal DSRegisterAll DSStateType
DSGetCompact DSReset DSTranslateHarmonic
DSGetDimensions DSRestoreArray DSTranslateRKS
DSGetEigenvalueComparison DSRestoreArrayReal DSTruncate
DSGetExtraRow DSSetCompact DSType
DSGetFN DSSetDimensions DSUpdateExtraRow
DSGetFunctionMethod DSSetEigenvalueComparison DSVectors
DSGetLeadingDimension DSSetExtraRow DSView
DSGetMethod DSSetFN

| D | E | F | I | M | N | Q | S | V |

EPS EPSGetErrorEstimate EPSMonitorFirst
EPSAppendOptionsPrefix EPSGetErrorEstimateLeft EPSMonitorSet
EPSArnoldiGetDelayed EPSGetExtraction EPSOrthType
EPSArnoldiSetDelayed EPSGetIP EPSPRIMMEGetBlockSize
EPSBalance EPSGetInterval EPSPRIMMEGetMethod
EPSBlzpackSetBlockSize EPSGetInvariantSubspace EPSPRIMMEMethod
EPSBlzpackSetNSteps EPSGetInvariantSubspaceLeft EPSPRIMMESetBlockSize
EPSCISSGetRefinement EPSGetIterationNumber EPSPRIMMESetMethod
EPSCISSGetRegion EPSGetLeftVectorsWanted EPSPowerGetShiftType
EPSCISSGetSizes EPSGetMatrixNorms EPSPowerSetShiftType
EPSCISSGetThreshold EPSGetMonitorContext EPSPowerShiftType
EPSCISSSetRefinement EPSGetOperationCounters EPSPrintSolution
EPSCISSSetRegion EPSGetOperators EPSProblemType
EPSCISSSetSizes EPSGetOptionsPrefix EPSRQCGGetReset
EPSCISSSetThreshold EPSGetProblemType EPSRQCGSetReset
EPSCompareEigenvalues EPSGetST EPSRegister
EPSComputeRelativeError EPSGetStartVector EPSRegisterAll
EPSComputeRelativeErrorLeft EPSGetStartVectorLeft EPSRemoveDeflationSpace
EPSComputeResidualNorm EPSGetTarget EPSReset
EPSComputeResidualNormLeft EPSGetTolerances EPSSetArbitrarySelection
EPSConv EPSGetTrackAll EPSSetBalance
EPSConvergedReason EPSGetTrueResidual EPSSetConvergenceTest
EPSCreate EPSGetType EPSSetConvergenceTestFunction
EPSDestroy EPSGetWhichEigenpairs EPSSetDS
EPSExtraction EPSInitializePackage EPSSetDeflationSpace
EPSFEASTGetNumPoints EPSIsGeneralized EPSSetDimensions
EPSFEASTSetNumPoints EPSIsHermitian EPSSetEigenvalueComparison
EPSFinalizePackage EPSIsPositive EPSSetExtraction
EPSGDGetBOrth EPSJDGetBOrth EPSSetFromOptions
EPSGDGetBlockSize EPSJDGetBlockSize EPSSetIP
EPSGDGetDoubleExpansion EPSJDGetConstCorrectionTol EPSSetInitialSpace
EPSGDGetInitialSize EPSJDGetFix EPSSetInitialSpaceLeft
EPSGDGetKrylovStart EPSJDGetInitialSize EPSSetInterval
EPSGDGetRestart EPSJDGetKrylovStart EPSSetLeftVectorsWanted
EPSGDGetWindowSizes EPSJDGetRestart EPSSetMatrixNorms
EPSGDSetBOrth EPSJDGetWindowSizes EPSSetOperators
EPSGDSetBlockSize EPSJDSetBOrth EPSSetOptionsPrefix
EPSGDSetDoubleExpansion EPSJDSetBlockSize EPSSetProblemType
EPSGDSetInitialSize EPSJDSetConstCorrectionTol EPSSetST
EPSGDSetKrylovStart EPSJDSetFix EPSSetTarget
EPSGDSetRestart EPSJDSetInitialSize EPSSetTolerances
EPSGDSetWindowSizes EPSJDSetKrylovStart EPSSetTrackAll
EPSGetBalance EPSJDSetRestart EPSSetTrueResidual
EPSGetConverged EPSJDSetWindowSizes EPSSetType
EPSGetConvergedReason EPSKrylovSchurGetRestart EPSSetUp
EPSGetConvergenceTest EPSKrylovSchurSetRestart EPSSetWhichEigenpairs
EPSGetDS EPSLanczosGetReorthog EPSSetWorkVecs
EPSGetDimensions EPSLanczosReorthogType EPSSolve
EPSGetEigenpair EPSLanczosSetReorthog EPSSortEigenvalues
EPSGetEigenvalue EPSMonitorAll EPSType
EPSGetEigenvector EPSMonitorCancel EPSView
EPSGetEigenvectorLeft EPSMonitorConverged EPSWhich

| D | E | F | I | M | N | Q | S | V |

FN FNGetOptionsPrefix FNSetOptionsPrefix
FNAppendOptionsPrefix FNGetParameters FNSetParameters
FNCreate FNGetType FNSetType
FNDestroy FNInitializePackage FNType
FNEvaluateDerivative FNRegister FNView
FNEvaluateFunction FNRegisterAll
FNFinalizePackage FNSetFromOptions

| D | E | F | I | M | N | Q | S | V |

IP IPInitializePackage IPPseudoOrthogonalize
IPAppendOptionsPrefix IPInnerProduct IPQRDecomposition
IPApplyMatrix IPInnerProductBegin IPRegister
IPBOrthogonalize IPInnerProductEnd IPRegisterAll
IPBiOrthogonalize IPMInnerProduct IPReset
IPCreate IPMInnerProductBegin IPResetOperationCounters
IPDestroy IPMInnerProductEnd IPSetFromOptions
IPFinalizePackage IPNorm IPSetMatrix
IPGetMatrix IPNormBegin IPSetOptionsPrefix
IPGetOperationCounters IPNormEnd IPSetOrthogonalization
IPGetOptionsPrefix IPOrthogRefineType IPSetType
IPGetOrthogonalization IPOrthogType IPType
IPGetType IPOrthogonalize IPView

| D | E | F | I | M | N | Q | S | V |

MFN MFNGetOperator MFNSetErrorIfNotConverged
MFNAppendOptionsPrefix MFNGetOptionsPrefix MFNSetFromOptions
MFNConvergedReason MFNGetScaleFactor MFNSetFunction
MFNCreate MFNGetTolerances MFNSetIP
MFNDestroy MFNGetType MFNSetOperator
MFNFinalizePackage MFNInitializePackage MFNSetOptionsPrefix
MFNGetConvergedReason MFNMonitorCancel MFNSetScaleFactor
MFNGetDS MFNMonitorDefault MFNSetTolerances
MFNGetDimensions MFNMonitorSet MFNSetType
MFNGetErrorIfNotConverged MFNRegister MFNSetUp
MFNGetFunction MFNRegisterAll MFNSolve
MFNGetIP MFNReset MFNType
MFNGetIterationNumber MFNSetDS MFNView
MFNGetMonitorContext MFNSetDimensions

| D | E | F | I | M | N | Q | S | V |

NEP NEPGetLagPreconditioner NEPSetDS
NEPAppendOptionsPrefix NEPGetMonitorContext NEPSetDimensions
NEPApplyFunction NEPGetOperationCounters NEPSetFromOptions
NEPApplyJacobian NEPGetOptionsPrefix NEPSetFunction
NEPCompareEigenvalues NEPGetSplitOperatorInfo NEPSetIP
NEPComputeFunction NEPGetSplitOperatorTerm NEPSetInitialSpace
NEPComputeJacobian NEPGetTarget NEPSetJacobian
NEPComputeRelativeError NEPGetTolerances NEPSetKSP
NEPComputeResidualNorm NEPGetTrackAll NEPSetLagPreconditioner
NEPConvergedReason NEPGetType NEPSetOptionsPrefix
NEPCreate NEPGetWhichEigenpairs NEPSetSplitOperator
NEPDestroy NEPInitializePackage NEPSetTarget
NEPFinalizePackage NEPMonitorAll NEPSetTolerances
NEPGetConstCorrectionTol NEPMonitorCancel NEPSetTrackAll
NEPGetConverged NEPMonitorConverged NEPSetType
NEPGetConvergedReason NEPMonitorFirst NEPSetUp
NEPGetDS NEPMonitorSet NEPSetWhichEigenpairs
NEPGetDimensions NEPProjectOperator NEPSetWorkVecs
NEPGetEigenpair NEPRegister NEPSolve
NEPGetErrorEstimate NEPRegisterAll NEPSortEigenvalues
NEPGetFunction NEPReset NEPType
NEPGetIP NEPSLPGetEPS NEPView
NEPGetIterationNumber NEPSLPSetEPS NEPWhich
NEPGetJacobian NEPSetConstCorrectionTol
NEPGetKSP NEPSetConvergenceTest

| D | E | F | I | M | N | Q | S | V |

QEP QEPGetScaleFactor QEPSetDS
QEPAppendOptionsPrefix QEPGetTarget QEPSetDimensions
QEPCompareEigenvalues QEPGetTolerances QEPSetFromOptions
QEPComputeRelativeError QEPGetTrackAll QEPSetIP
QEPComputeResidualNorm QEPGetType QEPSetInitialSpace
QEPConvergedReason QEPGetWhichEigenpairs QEPSetInitialSpaceLeft
QEPCreate QEPInitializePackage QEPSetLeftVectorsWanted
QEPDestroy QEPLinearGetCompanionForm QEPSetOperators
QEPFinalizePackage QEPLinearGetEPS QEPSetOptionsPrefix
QEPGetConverged QEPLinearGetExplicitMatrix QEPSetProblemType
QEPGetConvergedReason QEPLinearSetCompanionForm QEPSetST
QEPGetDS QEPLinearSetEPS QEPSetScaleFactor
QEPGetDimensions QEPLinearSetExplicitMatrix QEPSetTarget
QEPGetEigenpair QEPMonitorAll QEPSetTolerances
QEPGetErrorEstimate QEPMonitorCancel QEPSetTrackAll
QEPGetIP QEPMonitorConverged QEPSetType
QEPGetIterationNumber QEPMonitorFirst QEPSetUp
QEPGetLeftVectorsWanted QEPMonitorSet QEPSetWhichEigenpairs
QEPGetMonitorContext QEPPrintSolution QEPSetWorkVecs
QEPGetOperationCounters QEPProblemType QEPSolve
QEPGetOperators QEPRegister QEPSortEigenvalues
QEPGetOptionsPrefix QEPRegisterAll QEPType
QEPGetProblemType QEPReset QEPView
QEPGetST QEPSetConvergenceTest QEPWhich

| D | E | F | I | M | N | Q | S | V |

ST STSetOptionsPrefix SVDMonitorConverged
STAppendOptionsPrefix STSetShift SVDMonitorFirst
STApply STSetType SVDMonitorSet
STApplyTranspose STSetUp SVDPrintSolution
STBackTransform STShellGetContext SVDRegister
STCayleyGetAntishift STShellSetApply SVDRegisterAll
STCayleySetAntishift STShellSetApplyTranspose SVDReset
STCheckNullSpace STShellSetBackTransform SVDSetDS
STComputeExplicitOperator STShellSetContext SVDSetDimensions
STCreate STType SVDSetFromOptions
STDestroy STView SVDSetIP
STFinalizePackage SVD SVDSetInitialSpace
STGetBalanceMatrix SVDAppendOptionsPrefix SVDSetInitialSpaceLeft
STGetBilinearForm SVDComputeRelativeError SVDSetOperator
STGetKSP SVDComputeResidualNorms SVDSetOptionsPrefix
STGetMatMode SVDConvergedReason SVDSetTolerances
STGetMatStructure SVDCreate SVDSetTrackAll
STGetNumMatrices SVDCrossGetEPS SVDSetTransposeMode
STGetOperationCounters SVDCrossSetEPS SVDSetType
STGetOperators SVDCyclicGetEPS SVDSetUp
STGetOptionsPrefix SVDCyclicGetExplicitMatrix SVDSetWhichSingularTriplets
STGetShift SVDCyclicSetEPS SVDSolve
STGetType SVDCyclicSetExplicitMatrix SVDTRLanczosGetOneSide
STInitializePackage SVDDestroy SVDTRLanczosSetOneSide
STMatMode SVDFinalizePackage SVDTransposeMode
STMatMult SVDGetConverged SVDType
STMatMultTranspose SVDGetConvergedReason SVDView
STMatSolve SVDGetDS SVDWhich
STMatSolveTranspose SVDGetDimensions SlepcCheckOrthogonality
STPostSolve SVDGetIP SlepcFinalize
STPrecondGetKSPHasMat SVDGetIterationNumber SlepcGetVersion
STPrecondGetMatForPC SVDGetMonitorContext SlepcInitialize
STPrecondSetKSPHasMat SVDGetOperationCounters SlepcInitializeFortran
STPrecondSetMatForPC SVDGetOperator SlepcInitializeNoArguments
STRegister SVDGetOptionsPrefix SlepcInitialized
STRegisterAll SVDGetSingularTriplet SlepcMatConvertSeqDense
STReset SVDGetTolerances SlepcMatGetVecsTemplate
STResetOperationCounters SVDGetTrackAll SlepcMatTile
STSHELL SVDGetTransposeMode SlepcSNPrintfScalar
STSetBalanceMatrix SVDGetType SlepcUpdateStrideVectors
STSetDefaultShift SVDGetWhichSingularTriplets SlepcUpdateVectors
STSetFromOptions SVDInitializePackage SlepcVecMAXPBY
STSetKSP SVDLanczosGetOneSide SlepcVecNormalize
STSetMatMode SVDLanczosSetOneSide SlepcVecSetRandom
STSetMatStructure SVDMonitorAll SlepcVecSetTemplate
STSetOperators SVDMonitorCancel

| D | E | F | I | M | N | Q | S | V |

VecCompGetSubVecs VecCreateComp
VecCompSetSubVecs VecCreateCompWithVecs
slepc-3.4.2.dfsg.orig/docs/manualpages/IP/0000755000175000017500000000000012214143515017170 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPOrthogonalize.html0000644000175000017500000000604312211062077023136 0ustar gladkgladk IPOrthogonalize

IPOrthogonalize

Orthogonalize a vector with respect to a set of vectors.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPOrthogonalize(IP ip,PetscInt nds,Vec *defl,PetscInt n,PetscBool *which,Vec *V,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
Collective on IP and Vec

Input Parameters

ip - the inner product (IP) context
nds - number of columns of defl
defl - first set of vectors
n - number of columns of V
which - logical array indicating columns of V to be used
V - second set of vectors

Input/Output Parameter

v - (input) vector to be orthogonalized and (output) result of orthogonalization

Output Parameter

H - coefficients computed during orthogonalization with V
norm - norm of the vector after being orthogonalized
lindep - flag indicating that refinement did not improve the quality of orthogonalization

Notes

This function applies an orthogonal projector to project vector v onto the orthogonal complement of the span of the columns of defl and V. The columns of defl and V are assumed to be mutually orthonormal.

On exit, v = v0 - V*H, where v0 is the original vector v.

This routine does not normalize the resulting vector.

See Also

IPSetOrthogonalization(), IPBiOrthogonalize()

Location: src/ip/iporthog.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPDestroy.html0000644000175000017500000000210012211062077021731 0ustar gladkgladk IPDestroy

IPDestroy

Destroys IP context that was created with IPCreate().

Synopsis

#include "slepcip.h" 
PetscErrorCode IPDestroy(IP *ip)
Collective on IP

Input Parameter

ip - the inner product context

See Also

IPCreate()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPNorm.html0000644000175000017500000000371612211062077021231 0ustar gladkgladk IPNorm

IPNorm

Computes the norm of a vector as the square root of the inner product (x,x) as defined by IPInnerProduct().

Synopsis

#include "slepcip.h" 
PetscErrorCode IPNorm(IP ip,Vec x,PetscReal *norm)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - input vector

Output Parameter

norm - the computed norm

Notes

This function will usually compute the 2-norm of a vector, ||x||_2. But this behaviour may be different if using a non-standard inner product changed via IPSetMatrix(). For example, if using the B-inner product for positive definite B, (x,y)_B=y^H Bx, then the computed norm is ||x||_B = sqrt(x^H Bx).

In an indefinite inner product, matrix B is indefinite and the norm is defined as s*sqrt(abs(x^H Bx)), where s = sign(x^H Bx).

See Also

IPInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPAppendOptionsPrefix.html0000644000175000017500000000316412211062077024254 0ustar gladkgladk IPAppendOptionsPrefix

IPAppendOptionsPrefix

Appends to the prefix used for searching for all IP options in the database.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPAppendOptionsPrefix(IP ip,const char *prefix)
Logically Collective on IP

Input Parameters

ip - the inner product context
prefix - the prefix string to prepend to all IP option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

IPSetOptionsPrefix()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPSetOrthogonalization.html0000644000175000017500000000556412211062077024507 0ustar gladkgladk IPSetOrthogonalization

IPSetOrthogonalization

Specifies the type of orthogonalization technique to be used (classical or modified Gram-Schmidt with or without refinement).

Synopsis

#include "slepcip.h" 
PetscErrorCode IPSetOrthogonalization(IP ip,IPOrthogType type,IPOrthogRefineType refine,PetscReal eta)
Logically Collective on IP

Input Parameters

ip - the inner product context
type - the type of orthogonalization technique
refine - type of refinement
eta - parameter for selective refinement

Options Database Keys

-orthog_type <type> - Where <type> is cgs for Classical Gram-Schmidt orthogonalization (default) or mgs for Modified Gram-Schmidt orthogonalization
-orthog_refine <type> - Where <type> is one of never, ifneeded (default) or always
-orthog_eta <eta> - For setting the value of eta

Notes

The default settings work well for most problems.

The parameter eta should be a real value between 0 and 1 (or PETSC_DEFAULT). The value of eta is used only when the refinement type is "ifneeded".

When using several processors, MGS is likely to result in bad scalability.

See Also

IPOrthogonalize(), IPGetOrthogonalization(), IPOrthogType,
IPOrthogRefineType

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPRegisterAll.html0000644000175000017500000000145312211062077022527 0ustar gladkgladk IPRegisterAll

IPRegisterAll

Registers all of the inner products in the IP package.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPRegisterAll(void)
Not Collective

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPSetMatrix.html0000644000175000017500000000332212211062077022227 0ustar gladkgladk IPSetMatrix

IPSetMatrix

Specifies the matrix representation of the inner product.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPSetMatrix(IP ip,Mat mat)
Collective on IP

Input Parameters

ip - the inner product context
mat - the matrix (may be NULL)

Notes

A NULL has the same effect as if the identity matrix was passed.

This function is called by EPSSetProblemType() and usually need not be called by the user.

See Also

IPGetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType()

Location: src/ip/ipform.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPGetOptionsPrefix.html0000644000175000017500000000266112211062077023565 0ustar gladkgladk IPGetOptionsPrefix

IPGetOptionsPrefix

Gets the prefix used for searching for all IP options in the database.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPGetOptionsPrefix(IP ip,const char *prefix[])
Not Collective

Input Parameters

ip - the inner product context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

IPSetOptionsPrefix(), IPAppendOptionsPrefix()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPInnerProduct.html0000644000175000017500000000371312211062077022727 0ustar gladkgladk IPInnerProduct

IPInnerProduct

Computes the inner product of two vectors.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPInnerProduct(IP ip,Vec x,Vec y,PetscScalar *p)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - input vector
y - input vector

Output Parameter

p - result of the inner product

Notes

This function will usually compute the standard dot product of vectors x and y, (x,y)=y^H x. However this behaviour may be different if changed via IPSetMatrix(). This allows use of other inner products such as the indefinite product y^T x for complex symmetric problems or the B-inner product for positive definite B, (x,y)_B=y^H Bx.

See Also

IPSetMatrix(), VecDot(), IPMInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPFinalizePackage.html0000644000175000017500000000202412211062077023322 0ustar gladkgladk IPFinalizePackage

IPFinalizePackage

This function destroys everything in the Slepc interface to the IP package. It is called from SlepcFinalize().

Synopsis

#include "slepcip.h" 
PetscErrorCode IPFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPNormEnd.html0000644000175000017500000000361312211062077021654 0ustar gladkgladk IPNormEnd

IPNormEnd

Ends a split phase norm computation.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPNormEnd(IP ip,Vec x,PetscReal *norm)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - input vector

Output Parameter

norm - the computed norm

Notes

Each call to IPNormBegin() should be paired with a call to IPNormEnd().

See Also

IPNormBegin(), IPNorm(), IPInnerProduct(), IPMInnerProduct(),
IPInnerProductBegin(), IPInnerProductEnd()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPSetFromOptions.html0000644000175000017500000000204412211062077023242 0ustar gladkgladk IPSetFromOptions

IPSetFromOptions

Sets IP options from the options database.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPSetFromOptions(IP ip)
Collective on IP

Input Parameters

ip - the inner product context

Notes

To see all options, run your program with the -help option.

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IP.html0000644000175000017500000000163112211062077020367 0ustar gladkgladk IP

IP

Abstraction of a vector inner product, that can be defined in different ways. Using this object is not required for application programmers.

Synopsis

typedef struct _p_IP* IP;

See Also

IPCreate()

Location: src/ip/../../include/slepcip.h
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPInnerProductEnd.html0000644000175000017500000000407412211062077023357 0ustar gladkgladk IPInnerProductEnd

IPInnerProductEnd

Ends a split phase inner product computation.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPInnerProductEnd(IP ip,Vec x,Vec y,PetscScalar *p)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - the first vector
y - the second vector

Output Parameter

p - result of the inner product

Notes

Each call to IPInnerProductBegin() should be paired with a call to IPInnerProductEnd().

See Also

IPInnerProductBegin(), IPInnerProduct(), IPNorm(), IPNormBegin(),
IPNormEnd(), IPMInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPReset.html0000644000175000017500000000200512211062077021366 0ustar gladkgladk IPReset

IPReset

Resets the IP context to the initial state.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPReset(IP ip)
Collective on IP

Input Parameter

ip - the inner product context

See Also

IPDestroy()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPResetOperationCounters.html0000644000175000017500000000223112211062077024773 0ustar gladkgladk IPResetOperationCounters

IPResetOperationCounters

Resets the counters for inner product operations made by of the IP object.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPResetOperationCounters(IP ip)
Logically Collective on IP

Input Parameter

ip - the inner product context

See Also

IPGetOperationCounters()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPMInnerProductBegin.html0000644000175000017500000000432312211062077024007 0ustar gladkgladk IPMInnerProductBegin

IPMInnerProductBegin

Starts a split phase multiple inner product computation.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPMInnerProductBegin(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - the first input vector
n - number of vectors in y
y - array of vectors
p - where the result will go

Notes

Each call to IPMInnerProductBegin() should be paired with a call to IPMInnerProductEnd().

See Also

IPMInnerProductEnd(), IPMInnerProduct(), IPNorm(), IPNormBegin(),
IPNormEnd(), IPInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPCreate.html0000644000175000017500000000254012211062077021513 0ustar gladkgladk IPCreate

IPCreate

Creates an IP context.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPCreate(MPI_Comm comm,IP *newip)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

newip - location to put the IP context

Note

IP objects are not intended for normal users but only for advanced user that for instance implement their own solvers.

See Also

IPDestroy(), IP

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPType.html0000644000175000017500000000245712211062077021240 0ustar gladkgladk IPType

IPType

String with the name of the inner product. For complex scalars, it is possible to choose between a sesquilinear form (x,y)=x^H*M*y (the default) or a bilinear form (x,y)=x^T*M*y (without complex conjugation). In the case of real scalars, only the bilinear form (x,y)=x^T*M*y is available. Apart form these, there is also an indefinite inner product, defined by and indefinite matrix M.

Synopsis

typedef const char* IPType;
#define IPBILINEAR     "bilinear"
#define IPSESQUILINEAR "sesquilinear"
#define IPINDEFINITE   "indefinite"

See Also

IPSetType(), IP

Location: src/ip/../../include/slepcip.h
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPPseudoOrthogonalize.html0000644000175000017500000000616512211062077024323 0ustar gladkgladk IPPseudoOrthogonalize

IPPseudoOrthogonalize

Orthogonalize a vector with respect to two set of vectors in the sense of a pseudo-inner product.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPPseudoOrthogonalize(IP ip,PetscInt n,Vec *V,PetscReal *omega,Vec v,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
Collective on IP and Vec

Input Parameters

ip - the inner product (IP) context
n - number of columns of V
V - set of vectors
omega - set of signs that define a signature matrix

Input/Output Parameter

v - (input) vector to be orthogonalized and (output) result of orthogonalization

Output Parameter

H - coefficients computed during orthogonalization
norm - norm of the vector after being orthogonalized
lindep - flag indicating that refinement did not improve the quality of orthogonalization

Notes

This function is the analogue of IPOrthogonalize, but for the indefinite case. When using an indefinite IP the norm is not well defined, so we take the convention of having negative norms in such cases. The orthogonalization is then defined by a set of vectors V satisfying V'*B*V=Omega, where Omega is a signature matrix diag([+/-1,...,+/-1]).

On exit, v = v0 - V*Omega*H, where v0 is the original vector v.

This routine does not normalize the resulting vector. The output argument 'norm' may be negative.

See Also

IPSetOrthogonalization(), IPOrthogonalize()

Location: src/ip/ipbiorthog.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/index.html0000644000175000017500000001017512211062077021171 0ustar gladkgladk Inner Product - IP

Inner Product - IP

The IP package provides auxiliary routines that are internally used by the different SLEPc solvers. It provides an abstraction of a vector inner product that can be defined in different ways, and it includes important operations such as Gram-Schmidt orthogonalization.

These routines are usually not needed by application programmers.

Beginner - Basic usage
IP IPDestroy IPView
IPCreate IPSetFromOptions
Intermediate - Setting options for algorithms and data structures
IPGetOperationCounters IPResetOperationCounters
Advanced - Setting more advanced options and customization
IPAppendOptionsPrefix IPOrthogType IPSetOrthogonalization
IPGetOptionsPrefix IPRegister IPSetType
IPGetOrthogonalization IPRegisterAll IPType
IPGetType IPReset
IPOrthogRefineType IPSetOptionsPrefix
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
IPApplyMatrix IPInnerProductBegin IPNormEnd
IPBOrthogonalize IPInnerProductEnd IPOrthogonalize
IPBiOrthogonalize IPMInnerProduct IPPseudoOrthogonalize
IPFinalizePackage IPMInnerProductBegin IPQRDecomposition
IPGetMatrix IPMInnerProductEnd IPSetMatrix
IPInitializePackage IPNorm
IPInnerProduct IPNormBegin
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPGetType.html0000644000175000017500000000222212211062077021666 0ustar gladkgladk IPGetType

IPGetType

Gets the IP type name (as a string) from the IP context.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPGetType(IP ip,IPType *type)
Not Collective

Input Parameter

ip - the inner product context

Output Parameter

name - name of the inner product

See Also

IPSetType()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPOrthogRefineType.html0000644000175000017500000000231212211062077023542 0ustar gladkgladk IPOrthogRefineType

IPOrthogRefineType

Determines what type of refinement to use during orthogonalization

Synopsis

typedef enum { IP_ORTHOG_REFINE_NEVER,
               IP_ORTHOG_REFINE_IFNEEDED,
               IP_ORTHOG_REFINE_ALWAYS } IPOrthogRefineType;

See Also

IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize()

Location: src/ip/../../include/slepcip.h
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPApplyMatrix.html0000644000175000017500000000327612211062077022571 0ustar gladkgladk IPApplyMatrix

IPApplyMatrix

Multiplies a vector by the matrix representing the IP.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPApplyMatrix(IP ip,Vec x,Vec y)
Neighbor-wise Collective on IP and Vec

Input Parameters

ip - the inner product context
x - the vector

Output Parameter

y - the result

Note

If no matrix was specified this function copies the vector.

See Also

IPSetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType()

Location: src/ip/ipform.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPGetOperationCounters.html0000644000175000017500000000235712211062077024441 0ustar gladkgladk IPGetOperationCounters

IPGetOperationCounters

Gets the total number of inner product operations made by the IP object.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPGetOperationCounters(IP ip,PetscInt *dots)
Not Collective

Input Parameter

ip - the inner product context

Output Parameter

dots - number of inner product operations

See Also

IPResetOperationCounters()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPRegister.html0000644000175000017500000000274512211062077022103 0ustar gladkgladk IPRegister

IPRegister

Adds an inner product to the IP package.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPRegister(const char *name,PetscErrorCode (*function)(IP))
Not collective

Input Parameters

name - name of a new user-defined IP
function - routine to create context

Notes

IPRegister() may be called multiple times to add several user-defined inner products.

See Also

IPRegisterAll()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPSetOptionsPrefix.html0000644000175000017500000000315312211062077023576 0ustar gladkgladk IPSetOptionsPrefix

IPSetOptionsPrefix

Sets the prefix used for searching for all IP options in the database.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPSetOptionsPrefix(IP ip,const char *prefix)
Logically Collective on IP

Input Parameters

ip - the inner product context
prefix - the prefix string to prepend to all IP option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

IPAppendOptionsPrefix()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPInnerProductBegin.html0000644000175000017500000000407512211062077023676 0ustar gladkgladk IPInnerProductBegin

IPInnerProductBegin

Starts a split phase inner product computation.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPInnerProductBegin(IP ip,Vec x,Vec y,PetscScalar *p)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - the first vector
y - the second vector
p - where the result will go

Notes

Each call to IPInnerProductBegin() should be paired with a call to IPInnerProductEnd().

See Also

IPInnerProductEnd(), IPInnerProduct(), IPNorm(), IPNormBegin(),
IPNormEnd(), IPMInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPView.html0000644000175000017500000000370112211062077021222 0ustar gladkgladk IPView

IPView

Prints the IP data structure.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPView(IP ip,PetscViewer viewer)
Collective on IP

Input Parameters

ip - the inner product context
viewer - optional visualization context

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

EPSView(), SVDView(), PetscViewerASCIIOpen()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPMInnerProductEnd.html0000644000175000017500000000432212211062077023470 0ustar gladkgladk IPMInnerProductEnd

IPMInnerProductEnd

Ends a split phase multiple inner product computation.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPMInnerProductEnd(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - the first input vector
n - number of vectors in y
y - array of vectors

Output Parameter

p - result of the inner products

Notes

Each call to IPMInnerProductBegin() should be paired with a call to IPMInnerProductEnd().

See Also

IPMInnerProductBegin(), IPMInnerProduct(), IPNorm(), IPNormBegin(),
IPNormEnd(), IPInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPQRDecomposition.html0000644000175000017500000000453112211062077023371 0ustar gladkgladk IPQRDecomposition

IPQRDecomposition

Compute the QR factorization of a set of vectors.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPQRDecomposition(IP ip,Vec *V,PetscInt m,PetscInt n,PetscScalar *R,PetscInt ldr)
Collective on IP and Vec

Input Parameters

ip - the eigenproblem solver context
V - set of vectors
m - starting column
n - ending column
ldr - leading dimension of R

Output Parameter

R - triangular matrix of QR factorization

Notes

This routine orthonormalizes the columns of V so that V'*V=I up to working precision. It assumes that the first m columns (from 0 to m-1) are already orthonormal. The coefficients of the orthogonalization are stored in R so that V*R is equal to the original V.

In some cases, this routine makes V B-orthonormal, that is, V'*B*V=I.

If one of the vectors is linearly dependent wrt the rest (at working precision) then it is replaced by a random vector.

See Also

IPOrthogonalize(), IPNorm(), IPInnerProduct().

Location: src/ip/iporthog.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPNormBegin.html0000644000175000017500000000362612211062077022176 0ustar gladkgladk IPNormBegin

IPNormBegin

Starts a split phase norm computation.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPNormBegin(IP ip,Vec x,PetscReal *norm)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - input vector
norm - where the result will go

Notes

Each call to IPNormBegin() should be paired with a call to IPNormEnd().

See Also

IPNormEnd(), IPNorm(), IPInnerProduct(), IPMInnerProduct(),
IPInnerProductBegin(), IPInnerProductEnd()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPSetType.html0000644000175000017500000000350212211062077021704 0ustar gladkgladk IPSetType

IPSetType

Selects the type for the IP object.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPSetType(IP ip,IPType type)
Logically Collective on IP

Input Parameter

ip - the inner product context
type - a known type

Notes

Three types are available: IPBILINEAR, IPSESQUILINEAR, and IPINDEFINITE.

For complex scalars, the default is a sesquilinear form (x,y)=x^H*M*y and it is also possible to choose a bilinear form (x,y)=x^T*M*y (without complex conjugation). The latter could be useful e.g. in complex-symmetric eigensolvers.

In the case of real scalars, only the bilinear form (x,y)=x^T*M*y is available.

The indefinite inner product is reserved for the case of an indefinite matrix M. This is used for instance in symmetric-indefinite eigenproblems.

See Also

IPGetType()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPInitializePackage.html0000644000175000017500000000215212211062077023664 0ustar gladkgladk IPInitializePackage

IPInitializePackage

This function initializes everything in the IP package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to IPCreate() when using static libraries.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPInitializePackage(void)

See Also

SlepcInitialize()

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPMInnerProduct.html0000644000175000017500000000422312211062077023041 0ustar gladkgladk IPMInnerProduct

IPMInnerProduct

Computes the inner products a vector x with a set of vectors (columns of Y).

Synopsis

#include "slepcip.h" 
PetscErrorCode IPMInnerProduct(IP ip,Vec x,PetscInt n,const Vec y[],PetscScalar *p)
Collective on IP and Vec

Input Parameters

ip - the inner product context
x - the first input vector
n - number of vectors in y
y - array of vectors

Output Parameter

p - result of the inner products

Notes

This function will usually compute the standard dot product of x and y_i, (x,y_i)=y_i^H x, for each column of Y. However this behaviour may be different if changed via IPSetMatrix(). This allows use of other inner products such as the indefinite product y_i^T x for complex symmetric problems or the B-inner product for positive definite B, (x,y_i)_B=y_i^H Bx.

See Also

IPSetMatrix(), VecMDot(), IPInnerProduct()

Location: src/ip/ipdot.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPGetMatrix.html0000644000175000017500000000255112211062077022216 0ustar gladkgladk IPGetMatrix

IPGetMatrix

Retrieves the matrix representation of the inner product.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPGetMatrix(IP ip,Mat* mat)
Not collective, though a parallel Mat may be returned

Input Parameter

ip - the inner product context

Output Parameter

mat - the matrix of the inner product (may be NULL)

See Also

IPSetMatrix(), IPInnerProduct(), IPNorm(), EPSSetProblemType()

Location: src/ip/ipform.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPGetOrthogonalization.html0000644000175000017500000000347312211062077024470 0ustar gladkgladk IPGetOrthogonalization

IPGetOrthogonalization

Gets the orthogonalization settings from the IP object.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPGetOrthogonalization(IP ip,IPOrthogType *type,IPOrthogRefineType *refine,PetscReal *eta)
Not Collective

Input Parameter

ip - inner product context

Output Parameter

type - type of orthogonalization technique
refine - type of refinement
eta - parameter for selective refinement

See Also

IPOrthogonalize(), IPSetOrthogonalization(), IPOrthogType,
IPOrthogRefineType

Location: src/ip/ipbasic.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPBiOrthogonalize.html0000644000175000017500000000464512211062077023417 0ustar gladkgladk IPBiOrthogonalize

IPBiOrthogonalize

Bi-orthogonalize a vector with respect to a set of vectors.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPBiOrthogonalize(IP ip,PetscInt n,Vec *V,Vec *W,Vec v,PetscScalar *H,PetscReal *norm)
Collective on IP and Vec

Input Parameters

ip - the inner product context
n - number of columns of V
V - set of vectors
W - set of vectors

Input/Output Parameter

v - vector to be orthogonalized

Output Parameter

H - coefficients computed during orthogonalization
norm - norm of the vector after being orthogonalized

Notes

This function applies an oblique projector to project vector v onto the span of the columns of V along the orthogonal complement of the column space of W.

On exit, v0 = [V v]*H, where v0 is the original vector v.

This routine does not normalize the resulting vector.

See Also

IPSetOrthogonalization(), IPOrthogonalize()

Location: src/ip/ipbiorthog.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPBOrthogonalize.html0000644000175000017500000000727712211062077023252 0ustar gladkgladk IPBOrthogonalize

IPBOrthogonalize

B-Orthogonalize a vector with respect to two set of vectors.

Synopsis

#include "slepcip.h" 
PetscErrorCode IPBOrthogonalize(IP ip,PetscInt nds,Vec *defl,Vec *BDS,PetscReal *BDSnorms,PetscInt n,PetscBool *which,Vec *V,Vec *BV,PetscReal *BVnorms,Vec v,Vec Bv,PetscScalar *H,PetscReal *norm,PetscBool *lindep)
Collective on IP

Input Parameters

ip - the inner product (IP) context
nds - number of columns of defl
defl - first set of vectors
BDS - B * defl
BDSnorms - DS_i' * B * DS_i
n - number of columns of V
which - logical array indicating columns of V to be used
V - second set of vectors
BV - B * V
BVnorms - V_i' * B * V_i

Input/Output Parameter

v - (input) vector to be orthogonalized and (output) result of orthogonalization
Bv - (input/output) B * v

Output Parameter

H - coefficients computed during orthogonalization with V, of size nds+n if norm == NULL, and nds+n+1 otherwise.
norm - norm of the vector after being orthogonalized
lindep - flag indicating that refinement did not improve the quality of orthogonalization

Notes

This function applies an orthogonal projector to project vector v onto the orthogonal complement of the span of the columns of defl and V.

On exit, v0 = [V v]*H, where v0 is the original vector v.

This routine does not normalize the resulting vector.

See Also

IPSetOrthogonalization(), IPBiOrthogonalize()

Location: src/ip/ipborthog.c
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/IP/IPOrthogType.html0000644000175000017500000000214312211062077022413 0ustar gladkgladk IPOrthogType

IPOrthogType

Determines what type of orthogonalization to use

Synopsis

typedef enum { IP_ORTHOG_MGS,
               IP_ORTHOG_CGS } IPOrthogType;

See Also

IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize()

Location: src/ip/../../include/slepcip.h
Index of all IP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/0000755000175000017500000000000012211062077017476 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcVecSetTemplate.html0000644000175000017500000000231012211062077024234 0ustar gladkgladk SlepcVecSetTemplate

SlepcVecSetTemplate

Sets a vector as a template for contiguous storage.

Synopsis

#include "slepcvec.h" 
#include "petscvec.h" 
PetscErrorCode SlepcVecSetTemplate(Vec v)
Collective on Vec

Input Parameters

v - the vector

Note

Once this function is called, subsequent calls to VecDuplicateVecs() with this vector will use a special version that generates vectors with contiguous storage, that is, the array of values of V[1] immediately follows the array of V[0], and so on.

Location: src/vec/contiguous.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/VecCompSetSubVecs.html0000644000175000017500000000257512211062077023700 0ustar gladkgladk VecCompSetSubVecs

VecCompSetSubVecs

Resets the number of subvectors defining a compound vector, of replaces the subvectors

Synopsis

#include "slepcvec.h" 
PetscErrorCode VecCompSetSubVecs(Vec win,PetscInt n,Vec *x)
Collective on Vec

Input Parameters

win - compound vector
n - number of child vectors
x - array of child vectors

See Also

VecCreateComp()

Location: src/vec/veccomp.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcInitialize.html0000644000175000017500000000620212211062077023454 0ustar gladkgladk SlepcInitialize

SlepcInitialize

Initializes the SLEPc library. SlepcInitialize() calls PetscInitialize() if that has not been called yet, so this routine should always be called near the beginning of your program.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcInitialize(int *argc,char ***args,const char file[],const char help[])
Collective on MPI_COMM_WORLD or PETSC_COMM_WORLD if it has been set

Input Parameters

argc - count of number of command line arguments
args - the command line arguments
file - [optional] PETSc database file, defaults to ~username/.petscrc (use NULL for default)
help - [optional] Help message to print, use NULL for no message

Fortran Note

Fortran syntax is very similar to that of PetscInitialize()

See Also

SlepcFinalize(), PetscInitialize()

Location: src/sys/slepcinit.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcUpdateVectors.html0000644000175000017500000000516712211062077024154 0ustar gladkgladk SlepcUpdateVectors

SlepcUpdateVectors

Update a set of vectors V as V(:,s:e-1) = V*Q(:,s:e-1).

Synopsis

#include "slepcvec.h" 
#include "petscvec.h" 
PetscErrorCode SlepcUpdateVectors(PetscInt n,Vec *V,PetscInt s,PetscInt e,const PetscScalar *Q,PetscInt ldq,PetscBool qtrans)
Not Collective

Input parameters

n - number of vectors in V
s - first column of V to be overwritten
e - first column of V not to be overwritten
Q - matrix containing the coefficients of the update
ldq - leading dimension of Q
qtrans - flag indicating if Q is to be transposed

Input/Output parameter

V - set of vectors

Notes

This function computes V(:,s:e-1) = V*Q(:,s:e-1), that is, given a set of vectors V, columns from s to e-1 are overwritten with columns from s to e-1 of the matrix-matrix product V*Q.

Matrix V is represented as an array of Vec, whereas Q is represented as a column-major dense array of leading dimension ldq. Only columns s to e-1 of Q are referenced.

If qtrans=PETSC_TRUE, the operation is V*Q'.

This routine is implemented with a call to BLAS, therefore V is an array of Vec which have the data stored contiguously in memory as a Fortran matrix. PETSc does not create such arrays by default.

See Also

SlepcUpdateStrideVectors()

Location: src/vec/contiguous.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcMatTile.html0000644000175000017500000000432012211062077022711 0ustar gladkgladk SlepcMatTile

SlepcMatTile

Explicitly build a matrix from four blocks, G = [ a*A b*B; c*C d*D ].

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcMatTile(PetscScalar a,Mat A,PetscScalar b,Mat B,PetscScalar c,Mat C,PetscScalar d,Mat D,Mat *G)
Collective on Mat

Input parameters

A - matrix for top-left block
a - scaling factor for block A
B - matrix for top-right block
b - scaling factor for block B
C - matrix for bottom-left block
c - scaling factor for block C
D - matrix for bottom-right block
d - scaling factor for block D

Output parameter

G - the resulting matrix

Notes

In the case of a parallel matrix, a permuted version of G is returned. The permutation is a perfect shuffle such that the local parts of A, B, C, D remain in the local part of G for the same process.

Matrix G must be destroyed by the user.

Location: src/sys/slepcutil.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/VecCreateComp.html0000644000175000017500000000416012211062077023045 0ustar gladkgladk VecCreateComp

VecCreateComp

Creates a new vector containing several subvectors, each stored separately

Synopsis

#include "slepcvec.h" 
PetscErrorCode VecCreateComp(MPI_Comm comm,PetscInt *Nx,PetscInt n,VecType t,Vec Vparent,Vec *V)
Collective on Vec

Input Parameter

comm - communicator for the new Vec
Nx - array of (initial) global sizes of child vectors
n - number of child vectors
t - type of the child vectors
Vparent - (optional) template vector

Output Parameter

V - new vector

Notes

This is similar to PETSc's VecNest but customized for SLEPc's needs. In particular, the number of child vectors can be modified dynamically, with VecCompSetSubVecs().

See Also

VecCreateCompWithVecs(), VecCompSetSubVecs()

Location: src/vec/veccomp.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcMatGetVecsTemplate.html0000644000175000017500000000360712211062077025057 0ustar gladkgladk SlepcMatGetVecsTemplate

SlepcMatGetVecsTemplate

Get vectors compatible with a matrix, i.e. with the same parallel layout, and mark them as templates for contiguous storage.

Synopsis

#include "slepcvec.h" 
#include "petscvec.h" 
PetscErrorCode SlepcMatGetVecsTemplate(Mat mat,Vec *right,Vec *left)
Collective on Mat

Input Parameter

mat - the matrix

Output Parameters

right - (optional) vector that the matrix can be multiplied against
left - (optional) vector that the matrix vector product can be stored in

Options Database Keys

-slepc_non_contiguous - Disable contiguous vector storage

Notes

Use -slepc_non_contiguous to disable contiguous storage throughout SLEPc. Contiguous storage is currently also disabled in AIJCUSP matrices.

See Also

SlepcVecSetTemplate()

Location: src/vec/contiguous.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcInitializeNoArguments.html0000644000175000017500000000216412211062077025642 0ustar gladkgladk SlepcInitializeNoArguments

SlepcInitializeNoArguments

Calls SlepcInitialize() from C/C++ without the command line arguments.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcInitializeNoArguments(void)
Collective

See Also

SlepcInitialize(), SlepcInitializeFortran()

Location: src/sys/slepcinit.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/VecCompGetSubVecs.html0000644000175000017500000000255412211062077023661 0ustar gladkgladk VecCompGetSubVecs

VecCompGetSubVecs

Returns the entire array of vectors defining a compound vector

Synopsis

#include "slepcvec.h" 
PetscErrorCode VecCompGetSubVecs(Vec win,PetscInt *n,const Vec **x)
Collective on Vec

Input Parameter

win - compound vector

Output Parameter

n - number of child vectors
x - array of child vectors

See Also

VecCreateComp()

Location: src/vec/veccomp.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcMatConvertSeqDense.html0000644000175000017500000000230312211062077025063 0ustar gladkgladk SlepcMatConvertSeqDense

SlepcMatConvertSeqDense

Converts a parallel matrix to another one in sequential dense format replicating the values in every processor.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcMatConvertSeqDense(Mat mat,Mat *newmat)
Collective on Mat

Input parameters

A - the source matrix
B - the target matrix

Location: src/sys/slepcutil.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcGetVersion.html0000644000175000017500000000210312211062077023434 0ustar gladkgladk SlepcGetVersion

SlepcGetVersion

Gets the SLEPc version information in a string.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcGetVersion(char version[],size_t len)

Input Parameter

len - length of the string

Output Parameter

version - version string

Fortran Note

This routine is not supported in Fortran.

Location: src/sys/slepcinit.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcVecMAXPBY.html0000644000175000017500000000364512211062077023021 0ustar gladkgladk SlepcVecMAXPBY

SlepcVecMAXPBY

Computes y = beta*y + sum alpha*a[j]*x[j]

Synopsis

#include "slepcvec.h" 
#include "petscvec.h" 
PetscErrorCode SlepcVecMAXPBY(Vec y,PetscScalar beta,PetscScalar alpha,PetscInt nv,PetscScalar a[],Vec x[])
Logically Collective on Vec

Input parameters

beta - scalar beta
alpha - scalar alpha
nv - number of vectors in x and scalars in a
a - array of scalars
x - set of vectors

Input/Output parameter

y - the vector to update

Notes

If x are Vec's with contiguous storage, then the operation is done through a call to BLAS. Otherwise, VecMAXPY() is called.

See Also

SlepcVecSetTemplate()

Location: src/vec/contiguous.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcFinalize.html0000644000175000017500000000421312211062077023114 0ustar gladkgladk SlepcFinalize

SlepcFinalize

Checks for options to be called at the conclusion of the SLEPc program and calls PetscFinalize().

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcFinalize(void)
Collective on PETSC_COMM_WORLD

See Also

SlepcInitialize(), PetscFinalize()

Location: src/sys/slepcinit.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcVecSetRandom.html0000644000175000017500000000270112211062077023705 0ustar gladkgladk SlepcVecSetRandom

SlepcVecSetRandom

Sets all components of a vector to random numbers.

Synopsis

#include "slepcvec.h" 
PetscErrorCode SlepcVecSetRandom(Vec x,PetscRandom rctx)
Logically Collective on Vec

Input/Output Parameter

x - the vector

Input Parameter

rctx - the random number context, formed by PetscRandomCreate(), or NULL and it will create one internally.

Note

This operation is equivalent to VecSetRandom - the difference is that the vector generated by SlepcVecSetRandom is the same irrespective of the size of the communicator (if all processes pass a PetscRandom context initialized with the same seed).

Location: src/vec/vecutil.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcCheckOrthogonality.html0000644000175000017500000000463012211062077025156 0ustar gladkgladk SlepcCheckOrthogonality

SlepcCheckOrthogonality

Checks (or prints) the level of orthogonality of a set of vectors.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcCheckOrthogonality(Vec *V,PetscInt nv,Vec *W,PetscInt nw,Mat B,PetscViewer viewer,PetscReal *lev)
Collective on Vec

Input parameters

V - a set of vectors
nv - number of V vectors
W - an alternative set of vectors (optional)
nw - number of W vectors
B - matrix defining the inner product (optional)
viewer - optional visualization context

Output parameter

lev - level of orthogonality (optional)

Notes

This function computes W'*V and prints the result. It is intended to check the level of bi-orthogonality of the vectors in the two sets. If W is equal to NULL then V is used, thus checking the orthogonality of the V vectors.

If matrix B is provided then the check uses the B-inner product, W'*B*V.

If lev is not NULL, it will contain the maximum entry of matrix W'*V - I (in absolute value). Otherwise, the matrix W'*V is printed.

Location: src/sys/slepcutil.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/sys/index.html0000644000175000017500000000613312211062077021476 0ustar gladkgladk SLEPc System Routines

SLEPc System routines

SLEPc provides a variety of "system" level routines. These routines are generally tools used by other SLEPc routines and are not intended for application programmers (except the basic SlepcInitialize() / SlepcFinalize()).

Useful tools for application programmers can be found in PETSc's system routines, including parallel file access, synchronized printing to screen, and many other programming aids.

Beginner - Basic usage
SlepcFinalize SlepcInitializeFortran
SlepcInitialize SlepcInitialized
No intermediate routines
Advanced - Setting more advanced options and customization
SlepcInitializeNoArguments
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
SlepcCheckOrthogonality SlepcUpdateStrideVectors VecCompGetSubVecs
SlepcGetVersion SlepcUpdateVectors VecCompSetSubVecs
SlepcMatConvertSeqDense SlepcVecMAXPBY VecCreateComp
SlepcMatGetVecsTemplate SlepcVecNormalize VecCreateCompWithVecs
SlepcMatTile SlepcVecSetRandom
SlepcSNPrintfScalar SlepcVecSetTemplate
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcSNPrintfScalar.html0000644000175000017500000000270612211062077024211 0ustar gladkgladk SlepcSNPrintfScalar

SlepcSNPrintfScalar

Prints a PetscScalar variable to a string of given length.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcSNPrintfScalar(char *str,size_t len,PetscScalar val,PetscBool exp)
Not Collective

Input Parameters

str - the string to print to
len - the length of str
val - scalar value to be printed
exp - to be used within an expression, print leading sign and parentheses in case of nonzero imaginary part

Location: src/sys/slepcutil.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/VecCreateCompWithVecs.html0000644000175000017500000000300312211062077024515 0ustar gladkgladk VecCreateCompWithVecs

VecCreateCompWithVecs

Creates a new vector containing several subvectors, each stored separately, from an array of Vecs

Synopsis

#include "slepcvec.h" 
PetscErrorCode VecCreateCompWithVecs(Vec *x,PetscInt n,Vec Vparent,Vec *V)
Collective on Vec

Input Parameter

x - array of Vecs
n - number of child vectors
Vparent - (optional) template vector

Output Parameter

V - new vector

See Also

VecCreateComp()

Location: src/vec/veccomp.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcUpdateStrideVectors.html0000644000175000017500000000535212211062077025323 0ustar gladkgladk SlepcUpdateStrideVectors

SlepcUpdateStrideVectors

Update a set of vectors V as V(:,s:d:e-1) = V*Q(:,s:e-1).

Synopsis

#include "slepcvec.h" 
#include "petscvec.h" 
PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscBool qtrans)
Not Collective

Input parameters

n - number of vectors in V
s - first column of V to be overwritten
d - stride
e - first column of V not to be overwritten
Q - matrix containing the coefficients of the update
ldq - leading dimension of Q
qtrans - flag indicating if Q is to be transposed

Input/Output parameter

V - set of vectors

Notes

This function computes V(:,s:d:e-1) = V*Q(:,s:e-1), that is, given a set of vectors V, columns from s to e-1 are overwritten with columns from s to e-1 of the matrix-matrix product V*Q.

Matrix V is represented as an array of Vec, whereas Q is represented as a column-major dense array of leading dimension ldq. Only columns s to e-1 of Q are referenced.

If qtrans=PETSC_TRUE, the operation is V*Q'.

This routine is implemented with a call to BLAS, therefore V is an array of Vec which have the data stored contiguously in memory as a Fortran matrix. PETSc does not create such arrays by default.

See Also

SlepcUpdateVectors()

Location: src/vec/contiguous.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcVecNormalize.html0000644000175000017500000000301712211062077023752 0ustar gladkgladk SlepcVecNormalize

SlepcVecNormalize

Normalizes a possibly complex vector by the 2-norm.

Synopsis

#include "slepcvec.h" 
PetscErrorCode SlepcVecNormalize(Vec xr,Vec xi,PetscBool iscomplex,PetscReal *norm)
Collective on Vec

Input parameters

xr - the real part of the vector (overwritten on output)
xi - the imaginary part of the vector (not referenced if iscomplex is false)
iscomplex - a flag that indicating if the vector is complex

Output parameter

norm - the vector norm before normalization (can be set to NULL)

Location: src/vec/vecutil.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcInitialized.html0000644000175000017500000000177012211062077023625 0ustar gladkgladk SlepcInitialized

SlepcInitialized

Determine whether SLEPc is initialized.

Synopsis

#include "slepcsys.h" 
PetscErrorCode SlepcInitialized(PetscBool *isInitialized)

See Also

SlepcInitialize(), SlepcInitializeFortran()

Location: src/sys/slepcinit.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/sys/SlepcInitializeFortran.html0000644000175000017500000000326512211062077025016 0ustar gladkgladk SlepcInitializeFortran

SlepcInitializeFortran

Routine that should be called from C after the call to SlepcInitialize() if one is using a C main program that calls Fortran routines that in turn call SLEPc routines.

Synopsis

PetscErrorCode SlepcInitializeFortran(void)
Collective on PETSC_COMM_WORLD

Notes

SlepcInitializeFortran() initializes some of the default SLEPc variables for use in Fortran if a user's main program is written in C. SlepcInitializeFortran() is NOT needed if a user's main program is written in Fortran; in this case, just calling SlepcInitialize() in the main (Fortran) program is sufficient.

See Also

SlepcInitialize()

Location: src/sys/ftn-custom/zslepc_startf.c
Index of all sys routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/0000755000175000017500000000000012214143515017307 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetOperators.html0000644000175000017500000000323512211062077023166 0ustar gladkgladk EPSGetOperators

EPSGetOperators

Gets the matrices associated with the eigensystem.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetOperators(EPS eps,Mat *A,Mat *B)
Collective on EPS and Mat

Input Parameter

eps - the EPS context

Output Parameters

A - the matrix associated with the eigensystem
B - the second matrix in the case of generalized eigenproblems

See Also

EPSSolve(), EPSGetST(), STGetOperators(), STSetOperators()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetInitialSpace.html0000644000175000017500000000554612211062077023600 0ustar gladkgladk EPSSetInitialSpace

EPSSetInitialSpace

Specify a basis of vectors that constitute the initial space, that is, the subspace from which the solver starts to iterate.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetInitialSpace(EPS eps,PetscInt n,Vec *is)
Collective on EPS and Vec

Input Parameter

eps - the eigenproblem solver context
n - number of vectors
is - set of basis vectors of the initial space

Notes

Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored.

In contrast to EPSSetDeflationSpace(), these vectors do not persist from one EPSSolve() call to the other, so the initial space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster.

See Also

EPSSetInitialSpaceLeft(), EPSSetDeflationSpace()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex18.c.html
src/eps/examples/tutorials/ex19.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetWindowSizes.html0000644000175000017500000000403512211062077023723 0ustar gladkgladk EPSGDSetWindowSizes

EPSGDSetWindowSizes

Sets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
pwindow - number of converged vectors in the projector
qwindow - number of converged vectors in the projected problem

Options Database Keys

-eps_gd_pwindow - set the number of converged vectors in the projector
-eps_gd_qwindow - set the number of converged vectors in the projected problem

See Also

EPSGDGetWindowSizes()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSGetRegion.html0000644000175000017500000000306412211062077023115 0ustar gladkgladk EPSCISSGetRegion

EPSCISSGetRegion

Gets the parameters that define the region where eigenvalues must be computed.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSGetRegion(EPS eps,PetscScalar *center,PetscReal *radius,PetscReal *vscale)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

center - center of the region
radius - radius of the region
vscale - vertical scale of the region

See Also

EPSCISSSetRegion()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetConverged.html0000644000175000017500000000363412211062077023127 0ustar gladkgladk EPSGetConverged

EPSGetConverged

Gets the number of converged eigenpairs.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetConverged(EPS eps,PetscInt *nconv)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

nconv - number of converged eigenpairs

Note

This function should be called after EPSSolve() has finished.

See Also

EPSSetDimensions(), EPSSolve()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex19.c.html
src/eps/examples/tutorials/ex1f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetInitialSize.html0000644000175000017500000000375112211062077023655 0ustar gladkgladk EPSJDGetInitialSize

EPSJDGetInitialSize

Returns the initial size of the searching space.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

initialsize - number of vectors of the initial searching subspace

Notes

If EPSJDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSJDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors.

See Also

EPSJDSetInitialSize(), EPSJDGetKrylovStart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSIsHermitian.html0000644000175000017500000000263112211062077022763 0ustar gladkgladk EPSIsHermitian

EPSIsHermitian

Ask if the EPS object corresponds to a Hermitian eigenvalue problem.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSIsHermitian(EPS eps,PetscBool* is)
Not collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

is - the answer

See Also

EPSIsGeneralized(), EPSIsPositive()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex7.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSConv.html0000644000175000017500000000210712211062077021452 0ustar gladkgladk EPSConv

EPSConv

Determines the convergence test

Synopsis

typedef enum { EPS_CONV_ABS=1,
               EPS_CONV_EIG,
               EPS_CONV_NORM,
               EPS_CONV_USER } EPSConv;

See Also

EPSSetConvergenceTest(), EPSSetConvergenceTestFunction()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetKrylovStart.html0000644000175000017500000000304512211062077023745 0ustar gladkgladk EPSJDSetKrylovStart

EPSJDSetKrylovStart

Activates or deactivates starting the searching subspace with a Krylov basis.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
krylovstart - boolean flag

Options Database Key

-eps_jd_krylov_start - Activates starting the searching subspace with a Krylov basis

See Also

EPSJDGetKrylovStart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetEigenpair.html0000644000175000017500000000714512211062077023117 0ustar gladkgladk EPSGetEigenpair

EPSGetEigenpair

Gets the i-th solution of the eigenproblem as computed by EPSSolve(). The solution consists in both the eigenvalue and the eigenvector.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetEigenpair(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi)
Logically Collective on EPS

Input Parameters

eps - eigensolver context
i - index of the solution

Output Parameters

eigr - real part of eigenvalue
eigi - imaginary part of eigenvalue
Vr - real part of eigenvector
Vi - imaginary part of eigenvector

Notes

If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is configured with complex scalars the eigenvalue is stored directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is set to zero).

The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs().

The 2-norm of the eigenvector is one unless the problem is generalized Hermitian. In this case the eigenvector is normalized with respect to the norm defined by the B matrix.

See Also

EPSGetEigenvalue(), EPSGetEigenvector(), EPSGetEigenvectorLeft(), EPSSolve(),
EPSGetConverged(), EPSSetWhichEigenpairs(), EPSGetInvariantSubspace()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex19.c.html
src/eps/examples/tutorials/ex1f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetDimensions.html0000644000175000017500000000557112211062077023325 0ustar gladkgladk EPSGetDimensions

EPSGetDimensions

Gets the number of eigenvalues to compute and the dimension of the subspace.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetDimensions(EPS eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameters

nev - number of eigenvalues to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Notes

The user can specify NULL for any parameter that is not needed.

See Also

EPSSetDimensions()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetProblemType.html0000644000175000017500000001037512211062077023471 0ustar gladkgladk EPSSetProblemType

EPSSetProblemType

Specifies the type of the eigenvalue problem.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetProblemType(EPS eps,EPSProblemType type)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
type - a known type of eigenvalue problem

Options Database Keys

-eps_hermitian - Hermitian eigenvalue problem
-eps_gen_hermitian - generalized Hermitian eigenvalue problem
-eps_non_hermitian - non-Hermitian eigenvalue problem
-eps_gen_non_hermitian - generalized non-Hermitian eigenvalue problem
-eps_pos_gen_non_hermitian - generalized non-Hermitian eigenvalue problem with positive semi-definite B

Notes

Allowed values for the problem type are: Hermitian (EPS_HEP), non-Hermitian (EPS_NHEP), generalized Hermitian (EPS_GHEP), generalized non-Hermitian (EPS_GNHEP), generalized non-Hermitian with positive semi-definite B (EPS_PGNHEP), and generalized Hermitian-indefinite (EPS_GHIEP).

This function must be used to instruct SLEPc to exploit symmetry. If no problem type is specified, by default a non-Hermitian problem is assumed (either standard or generalized). If the user knows that the problem is Hermitian (i.e. A=A^H) or generalized Hermitian (i.e. A=A^H, B=B^H, and B positive definite) then it is recommended to set the problem type so that eigensolver can exploit these properties.

See Also

EPSSetOperators(), EPSSetType(), EPSGetProblemType(), EPSProblemType

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
src/eps/examples/tutorials/ex19.c.html
src/eps/examples/tutorials/ex1f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetRestart.html0000644000175000017500000000304012211062077023041 0ustar gladkgladk EPSGDGetRestart

EPSGDGetRestart

Gets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

minv - number of vectors of the searching subspace after restarting
plusk - number of vectors saved from the previous iteration

See Also

EPSGDSetRestart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSView.html0000644000175000017500000000421012211062077021454 0ustar gladkgladk EPSView

EPSView

Prints the EPS data structure.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSView(EPS eps,PetscViewer viewer)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context
viewer - optional visualization context

Options Database Key

-eps_view - Calls EPSView() at end of EPSSolve()

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

STView(), PetscViewerASCIIOpen()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetConvergedReason.html0000644000175000017500000000407012211062077024272 0ustar gladkgladk EPSGetConvergedReason

EPSGetConvergedReason

Gets the reason why the EPSSolve() iteration was stopped.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetConvergedReason(EPS eps,EPSConvergedReason *reason)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

reason - negative value indicates diverged, positive value converged

Possible values for reason

EPS_CONVERGED_TOL - converged up to tolerance
EPS_DIVERGED_ITS - required more than its to reach convergence
EPS_DIVERGED_BREAKDOWN - generic breakdown in method

Note

Can only be called after the call to EPSSolve() is complete.

See Also

EPSSetTolerances(), EPSSolve(), EPSConvergedReason

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetRestart.html0000644000175000017500000000304012211062077023044 0ustar gladkgladk EPSJDGetRestart

EPSJDGetRestart

Gets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

minv - number of vectors of the searching subspace after restarting
plusk - number of vectors saved from the previous iteration

See Also

EPSJDSetRestart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetDS.html0000644000175000017500000000225112211062077021513 0ustar gladkgladk EPSGetDS

EPSGetDS

Obtain the direct solver object associated to the eigensolver object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetDS(EPS eps,DS *ds)
Not Collective

Input Parameters

eps - eigensolver context obtained from EPSCreate()

Output Parameter

ds - direct solver context

See Also

EPSSetDS()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSSetRefinement.html0000644000175000017500000000434212211062077024002 0ustar gladkgladk EPSCISSSetRefinement

EPSCISSSetRefinement

Sets the values of various refinement parameters in the CISS solver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSSetRefinement(EPS eps,PetscInt inner,PetscInt outer,PetscInt blsize)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
inner - number of iterative refinement iterations (inner loop)
outer - number of iterative refinement iterations (outer loop)
blsize - number of iterative refinement iterations (blocksize loop)

Options Database Keys

-eps_ciss_refine_inner - Sets number of inner iterations
-eps_ciss_refine_outer - Sets number of outer iterations
-eps_ciss_refine_blocksize - Sets number of blocksize iterations

See Also

EPSCISSGetRefinement()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetDS.html0000644000175000017500000000300112211062077021521 0ustar gladkgladk EPSSetDS

EPSSetDS

Associates a direct solver object to the eigensolver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetDS(EPS eps,DS ds)
Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
ds - the direct solver object

Note

Use EPSGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations).

See Also

EPSGetDS()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSComputeRelativeError.html0000644000175000017500000000434512211062077024675 0ustar gladkgladk EPSComputeRelativeError

EPSComputeRelativeError

Computes the relative error bound associated with the i-th computed eigenpair.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSComputeRelativeError(EPS eps,PetscInt i,PetscReal *error)
Collective on EPS

Input Parameter

eps - the eigensolver context
i - the solution index

Output Parameter

error - the relative error bound, computed as ||Ax-kBx||_2/||kx||_2 where k is the eigenvalue and x is the eigenvector. If k=0 the relative error is computed as ||Ax||_2/||x||_2.

See Also

EPSSolve(), EPSComputeResidualNorm(), EPSGetErrorEstimate()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex19.c.html
src/eps/examples/tutorials/ex1f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSInitializePackage.html0000644000175000017500000000220612211062077024122 0ustar gladkgladk EPSInitializePackage

EPSInitializePackage

This function initializes everything in the EPS package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to EPSCreate() when using static libraries.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSInitializePackage()

See Also

SlepcInitialize()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetEigenvector.html0000644000175000017500000000572012211062077023463 0ustar gladkgladk EPSGetEigenvector

EPSGetEigenvector

Gets the i-th right eigenvector as computed by EPSSolve().

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetEigenvector(EPS eps,PetscInt i,Vec Vr,Vec Vi)
Logically Collective on EPS

Input Parameters

eps - eigensolver context
i - index of the solution

Output Parameters

Vr - real part of eigenvector
Vi - imaginary part of eigenvector

Notes

If the corresponding eigenvalue is real, then Vi is set to zero. If PETSc is configured with complex scalars the eigenvector is stored directly in Vr (Vi is set to zero).

The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs().

The 2-norm of the eigenvector is one unless the problem is generalized Hermitian. In this case the eigenvector is normalized with respect to the norm defined by the B matrix.

See Also

EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(),
EPSGetEigenpair(), EPSGetEigenvectorLeft()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetMatrixNorms.html0000644000175000017500000000545112211062077023511 0ustar gladkgladk EPSSetMatrixNorms

EPSSetMatrixNorms

Gives the reference values of the matrix norms and specifies whether these values should be improved adaptively.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetMatrixNorms(EPS eps,PetscReal nrma,PetscReal nrmb,PetscBool adaptive)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
nrma - a reference value for the norm of matrix A
nrmb - a reference value for the norm of matrix B
adaptive - whether matrix norms are improved adaptively

Options Database Keys

-eps_norm_a <nrma> - norm of A
-eps_norm_b <nrma> - norm of B
-eps_norms_adaptive <boolean> - Sets/resets the boolean flag 'adaptive'

Notes

If the user sets adaptive=PETSC_FALSE then the solver uses the values of nrma and nrmb for the matrix norms, and these values do not change throughout the iteration.

If the user sets adaptive=PETSC_TRUE then the solver tries to adaptively improve the supplied values, with the numerical information generated during the iteration. This option is not available in all solvers.

If a passed value is PETSC_DEFAULT, the corresponding norm will be set to 1. If a passed value is PETSC_DETERMINE, the corresponding norm will be computed as the NORM_INFINITY with MatNorm().

See Also

EPSGetMatrixNorms()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSArnoldiSetDelayed.html0000644000175000017500000000343312211062077024104 0ustar gladkgladk EPSArnoldiSetDelayed

EPSArnoldiSetDelayed

Activates or deactivates delayed reorthogonalization in the Arnoldi iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSArnoldiSetDelayed(EPS eps,PetscBool delayed)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
delayed - boolean flag

Options Database Key

-eps_arnoldi_delayed - Activates delayed reorthogonalization in Arnoldi

Note

Delayed reorthogonalization is an aggressive optimization for the Arnoldi eigensolver than may provide better scalability, but sometimes makes the solver converge less than the default algorithm.

See Also

EPSArnoldiGetDelayed()

Location: src/eps/impls/krylov/arnoldi/arnoldi.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSComputeResidualNormLeft.html0000644000175000017500000000423312211062077025323 0ustar gladkgladk EPSComputeResidualNormLeft

EPSComputeResidualNormLeft

Computes the norm of the residual vector associated with the i-th computed left eigenvector (only available in two-sided eigensolvers).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSComputeResidualNormLeft(EPS eps,PetscInt i,PetscReal *norm)
Collective on EPS

Input Parameter

eps - the eigensolver context
i - the solution index

Output Parameter

norm - the residual norm, computed as ||y'A-ky'B||_2 where k is the eigenvalue and y is the left eigenvector. If k=0 then the residual norm is computed as ||y'A||_2.

Notes

The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs().

See Also

EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSMonitorConverged.html0000644000175000017500000000457612211062077024045 0ustar gladkgladk EPSMonitorConverged

EPSMonitorConverged

Print the approximate values and error estimates as they converge.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSMonitorConverged(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
Collective on EPS

Input Parameters

eps - eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context

Note

The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

See Also

EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorAll()

Location: src/eps/interface/monitor.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetConvergenceTestFunction.html0000644000175000017500000000610312211062077026025 0ustar gladkgladk EPSSetConvergenceTestFunction

EPSSetConvergenceTestFunction

Sets a function to compute the error estimate used in the convergence test.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetConvergenceTestFunction(EPS eps,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
func - a pointer to the convergence test function
ctx - a context pointer (the last parameter to the convergence test function)

Calling Sequence of func

  func(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)

eps - eigensolver context obtained from EPSCreate()
eigr - real part of the eigenvalue
eigi - imaginary part of the eigenvalue
res - residual norm associated to the eigenpair
errest - (output) computed error estimate
ctx - optional context, as set by EPSSetConvergenceTest()

Note

If the error estimate returned by the convergence test function is less than the tolerance, then the eigenvalue is accepted as converged.

See Also

EPSSetConvergenceTest(),EPSSetTolerances()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetOperators.html0000644000175000017500000000626312211062077023206 0ustar gladkgladk EPSSetOperators

EPSSetOperators

Sets the matrices associated with the eigenvalue problem.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetOperators(EPS eps,Mat A,Mat B)
Collective on EPS and Mat

Input Parameters

eps - the eigenproblem solver context
A - the matrix associated with the eigensystem
B - the second matrix in the case of generalized eigenproblems

Notes

To specify a standard eigenproblem, use NULL for parameter B.

It must be called after EPSSetUp(). If it is called again after EPSSetUp() then the EPS object is reset.

See Also

EPSSolve(), EPSSetUp(), EPSReset(), EPSGetST(), STGetOperators()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetKrylovStart.html0000644000175000017500000000244012211062077023724 0ustar gladkgladk EPSGDGetKrylovStart

EPSGDGetKrylovStart

Returns a flag indicating if the search subspace is started with a Krylov basis.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

krylovstart - boolean flag indicating if the search subspace is started with a Krylov basis

See Also

EPSGDGetKrylovStart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetConstCorrectionTol.html0000644000175000017500000000340412211062077025235 0ustar gladkgladk EPSJDSetConstCorrectionTol

EPSJDSetConstCorrectionTol

If true, deactivates the dynamic stopping criterion (also called Newton) that sets the KSP relative tolerance to 0.5**i, where i is the number of EPS iterations from the last converged value.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetConstCorrectionTol(EPS eps,PetscBool constant)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
constant - if false, the KSP relative tolerance is set to 0.5**i.

Options Database Key

-eps_jd_const_correction_tol - Deactivates the dynamic stopping criterion.

See Also

EPSJDGetConstCorrectionTol()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetFromOptions.html0000644000175000017500000000457112211062077023507 0ustar gladkgladk EPSSetFromOptions

EPSSetFromOptions

Sets EPS options from the options database. This routine must be called before EPSSetUp() if the user is to be allowed to set the solver type.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetFromOptions(EPS eps)
Collective on EPS

Input Parameters

eps - the eigensolver context

Notes

To see all options, run your program with the -help option.

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSFEASTGetNumPoints.html0000644000175000017500000000244612211062077023732 0ustar gladkgladk EPSFEASTGetNumPoints

EPSFEASTGetNumPoints

Gets the number of contour integration points for the FEAST package.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSFEASTGetNumPoints(EPS eps,PetscInt *npoints)
Collective on EPS

Input Parameter

eps - the eigenproblem solver context

Output Parameter

npoints - number of contour integration points

See Also

EPSFEASTSetNumPoints()

Location: src/eps/impls/external/feast/feast.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetOptionsPrefix.html0000644000175000017500000000413212211062077024032 0ustar gladkgladk EPSSetOptionsPrefix

EPSSetOptionsPrefix

Sets the prefix used for searching for all EPS options in the database.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetOptionsPrefix(EPS eps,const char *prefix)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
prefix - the prefix string to prepend to all EPS option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

For example, to distinguish between the runtime options for two different EPS contexts, one could call

      EPSSetOptionsPrefix(eps1,"eig1_")
      EPSSetOptionsPrefix(eps2,"eig2_")

See Also

EPSAppendOptionsPrefix(), EPSGetOptionsPrefix()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetWhichEigenpairs.html0000644000175000017500000001466312211062077024304 0ustar gladkgladk EPSSetWhichEigenpairs

EPSSetWhichEigenpairs

Specifies which portion of the spectrum is to be sought.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetWhichEigenpairs(EPS eps,EPSWhich which)
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
which - the portion of the spectrum to be sought

Possible values

The parameter 'which' can have one of these values

EPS_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
EPS_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
EPS_LARGEST_REAL - largest real parts
EPS_SMALLEST_REAL - smallest real parts
EPS_LARGEST_IMAGINARY - largest imaginary parts
EPS_SMALLEST_IMAGINARY - smallest imaginary parts
EPS_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
EPS_TARGET_REAL - eigenvalues with real part closest to target
EPS_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target
EPS_ALL - all eigenvalues contained in a given interval
EPS_WHICH_USER - user defined ordering set with EPSSetEigenvalueComparison()

Options Database Keys

-eps_largest_magnitude - Sets largest eigenvalues in magnitude
-eps_smallest_magnitude - Sets smallest eigenvalues in magnitude
-eps_largest_real - Sets largest real parts
-eps_smallest_real - Sets smallest real parts
-eps_largest_imaginary - Sets largest imaginary parts
-eps_smallest_imaginary - Sets smallest imaginary parts
-eps_target_magnitude - Sets eigenvalues closest to target
-eps_target_real - Sets real parts closest to target
-eps_target_imaginary - Sets imaginary parts closest to target
-eps_all - Sets all eigenvalues in an interval

Notes

Not all eigensolvers implemented in EPS account for all the possible values stated above. Also, some values make sense only for certain types of problems. If SLEPc is compiled for real numbers EPS_LARGEST_IMAGINARY and EPS_SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection.

The target is a scalar value provided with EPSSetTarget().

The criterion EPS_TARGET_IMAGINARY is available only in case PETSc and SLEPc have been built with complex scalars.

EPS_ALL is intended for use in combination with an interval (see EPSSetInterval()), when all eigenvalues within the interval are requested. In that case, the number of eigenvalues is unknown, so the nev parameter has a different sense, see EPSSetDimensions().

See Also

EPSGetWhichEigenpairs(), EPSSetTarget(), EPSSetInterval(),
EPSSetDimensions(), EPSSetEigenvalueComparison(), EPSSortEigenvalues(), EPSWhich

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex19.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSRegisterAll.html0000644000175000017500000000170512211062077022765 0ustar gladkgladk EPSRegisterAll

EPSRegisterAll

Registers all the eigenvalue solvers in the EPS package.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSRegisterAll(void)
Not Collective

See Also

EPSRegister()

Location: src/eps/interface/itregis.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetTolerances.html0000644000175000017500000000440112211062077023317 0ustar gladkgladk EPSSetTolerances

EPSSetTolerances

Sets the tolerance and maximum iteration count used by the EPS convergence tests.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetTolerances(EPS eps,PetscReal tol,PetscInt maxits)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
tol - the convergence tolerance
maxits - maximum number of iterations to use

Options Database Keys

-eps_tol <tol> - Sets the convergence tolerance
-eps_max_it <maxits> - Sets the maximum number of iterations allowed

Notes

Pass 0 for an argument that need not be changed.

Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method.

See Also

EPSGetTolerances()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex19.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSWhich.html0000644000175000017500000000251612211062077021613 0ustar gladkgladk EPSWhich

EPSWhich

Determines which part of the spectrum is requested

Synopsis

typedef enum { EPS_LARGEST_MAGNITUDE=1,
               EPS_SMALLEST_MAGNITUDE,
               EPS_LARGEST_REAL,
               EPS_SMALLEST_REAL,
               EPS_LARGEST_IMAGINARY,
               EPS_SMALLEST_IMAGINARY,
               EPS_TARGET_MAGNITUDE,
               EPS_TARGET_REAL,
               EPS_TARGET_IMAGINARY,
               EPS_ALL,
               EPS_WHICH_USER } EPSWhich;

See Also

EPSSetWhichEigenpairs(), EPSGetWhichEigenpairs()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetErrorEstimate.html0000644000175000017500000000332212211062077023772 0ustar gladkgladk EPSGetErrorEstimate

EPSGetErrorEstimate

Returns the error estimate associated to the i-th computed eigenpair.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetErrorEstimate(EPS eps,PetscInt i,PetscReal *errest)
Not Collective

Input Parameter

eps - eigensolver context
i - index of eigenpair

Output Parameter

errest - the error estimate

Notes

This is the error estimate used internally by the eigensolver. The actual error bound can be computed with EPSComputeRelativeError(). See also the users manual for details.

See Also

EPSComputeRelativeError()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetWindowSizes.html0000644000175000017500000000310612211062077023710 0ustar gladkgladk EPSJDGetWindowSizes

EPSJDGetWindowSizes

Gets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

pwindow - number of converged vectors in the projector
qwindow - number of converged vectors in the projected problem

See Also

EPSJDSetWindowSizes()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetIP.html0000644000175000017500000000225112211062077021515 0ustar gladkgladk EPSGetIP

EPSGetIP

Obtain the inner product object associated to the eigensolver object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetIP(EPS eps,IP *ip)
Not Collective

Input Parameters

eps - eigensolver context obtained from EPSCreate()

Output Parameter

ip - inner product context

See Also

EPSSetIP()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetTarget.html0000644000175000017500000000232412211062077022434 0ustar gladkgladk EPSGetTarget

EPSGetTarget

Gets the value of the target.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetTarget(EPS eps,PetscScalar* target)
Not Collective

Input Parameter

eps - eigensolver context

Output Parameter

target - the value of the target

Note

If the target was not set by the user, then zero is returned.

See Also

EPSSetTarget()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetKrylovStart.html0000644000175000017500000000244612211062077023735 0ustar gladkgladk EPSJDGetKrylovStart

EPSJDGetKrylovStart

Returns a flag indicating if the searching subspace is started with a Krylov basis.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscBool *krylovstart)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

krylovstart - boolean flag indicating if the searching subspace is started with a Krylov basis

See Also

EPSJDGetKrylovStart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetInitialSize.html0000644000175000017500000000444612211062077023673 0ustar gladkgladk EPSJDSetInitialSize

EPSJDSetInitialSize

Sets the initial size of the searching space.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
initialsize - number of vectors of the initial searching subspace

Options Database Key

-eps_jd_initial_size - number of vectors of the initial searching subspace

Notes

If EPSJDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSJDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors.

See Also

EPSJDGetInitialSize(), EPSJDGetKrylovStart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetProblemType.html0000644000175000017500000000244512211062077023454 0ustar gladkgladk EPSGetProblemType

EPSGetProblemType

Gets the problem type from the EPS object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetProblemType(EPS eps,EPSProblemType *type)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

type - name of EPS problem type

See Also

EPSSetProblemType(), EPSProblemType

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSKrylovSchurGetRestart.html0000644000175000017500000000240712211062077025050 0ustar gladkgladk EPSKrylovSchurGetRestart

EPSKrylovSchurGetRestart

Gets the restart parameter used in the Krylov-Schur method.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSKrylovSchurGetRestart(EPS eps,PetscReal *keep)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

keep - the restart parameter

See Also

EPSKrylovSchurSetRestart()

Location: src/eps/impls/krylov/krylovschur/krylovschur.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetInvariantSubspaceLeft.html0000644000175000017500000000437012211062077025445 0ustar gladkgladk EPSGetInvariantSubspaceLeft

EPSGetInvariantSubspaceLeft

Gets an orthonormal basis of the computed left invariant subspace (only available in two-sided eigensolvers).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetInvariantSubspaceLeft(EPS eps,Vec *v)
Not Collective, but vectors are shared by all processors that share the EPS

Input Parameter

eps - the eigensolver context

Output Parameter

v - an array of vectors

Notes

This function should be called after EPSSolve() has finished.

The user should provide in v an array of nconv vectors, where nconv is the value returned by EPSGetConverged().

The first k vectors returned in v span a left invariant subspace associated with the first k computed eigenvalues (note that this is not true if the k-th eigenvalue is complex and matrix A is real; in this case the first k+1 vectors should be used). A left invariant subspace Y of A satisfies y'A in Y for all y in Y (a similar definition applies for generalized eigenproblems).

See Also

EPSGetEigenpair(), EPSGetConverged(), EPSSolve(), EPSGetInvariantSubspace

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetType.html0000644000175000017500000000456212211062077022135 0ustar gladkgladk EPSGetType

EPSGetType

Gets the EPS type as a string from the EPS object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetType(EPS eps,EPSType *type)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

name - name of EPS method

See Also

EPSSetType()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSProblemType.html0000644000175000017500000000214012211062077023004 0ustar gladkgladk EPSProblemType

EPSProblemType

Determines the type of eigenvalue problem

Synopsis

typedef enum { EPS_HEP=1,
               EPS_GHEP,
               EPS_NHEP,
               EPS_GNHEP,
               EPS_PGNHEP,
               EPS_GHIEP } EPSProblemType;

See Also

EPSSetProblemType(), EPSGetProblemType()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetMonitorContext.html0000644000175000017500000000245212211062077024204 0ustar gladkgladk EPSGetMonitorContext

EPSGetMonitorContext

Gets the monitor context, as set by EPSMonitorSet() for the FIRST monitor only.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetMonitorContext(EPS eps,void **ctx)
Not Collective

Input Parameter

eps - eigensolver context obtained from EPSCreate()

Output Parameter

ctx - monitor context

See Also

EPSMonitorSet()

Location: src/eps/interface/monitor.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSLanczosGetReorthog.html0000644000175000017500000000255512211062077024337 0ustar gladkgladk EPSLanczosGetReorthog

EPSLanczosGetReorthog

Gets the type of reorthogonalization used during the Lanczos iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSLanczosGetReorthog(EPS eps,EPSLanczosReorthogType *reorthog)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

reorthog - the type of reorthogonalization

See Also

EPSLanczosSetReorthog(), EPSLanczosReorthogType

Location: src/eps/impls/krylov/lanczos/lanczos.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetWindowSizes.html0000644000175000017500000000403512211062077023726 0ustar gladkgladk EPSJDSetWindowSizes

EPSJDSetWindowSizes

Sets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetWindowSizes(EPS eps,PetscInt pwindow,PetscInt qwindow)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
pwindow - number of converged vectors in the projector
qwindow - number of converged vectors in the projected problem

Options Database Keys

-eps_jd_pwindow - set the number of converged vectors in the projector
-eps_jd_qwindow - set the number of converged vectors in the projected problem

See Also

EPSJDGetWindowSizes()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSGetRefinement.html0000644000175000017500000000324312211062077023765 0ustar gladkgladk EPSCISSGetRefinement

EPSCISSGetRefinement

Gets the values of various refinement parameters in the CISS solver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSGetRefinement(EPS eps, PetscInt *inner, PetscInt *outer,PetscInt *blsize)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

inner - number of iterative refinement iterations (inner loop)
outer - number of iterative refinement iterations (outer loop)
blsize - number of iterative refinement iterations (blocksize loop)

See Also

EPSCISSSetRefinement()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSRQCGGetReset.html0000644000175000017500000000223112211062077022742 0ustar gladkgladk EPSRQCGGetReset

EPSRQCGGetReset

Gets the reset parameter used in the RQCG method.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSRQCGGetReset(EPS eps,PetscInt *nrest)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

nrest - the reset parameter

See Also

EPSRQCGSetReset()

Location: src/eps/impls/cg/rqcg/rqcg.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSComputeRelativeErrorLeft.html0000644000175000017500000000403512211062077025504 0ustar gladkgladk EPSComputeRelativeErrorLeft

EPSComputeRelativeErrorLeft

Computes the relative error bound associated with the i-th computed eigenvalue and left eigenvector (only available in two-sided eigensolvers).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSComputeRelativeErrorLeft(EPS eps,PetscInt i,PetscReal *error)
Collective on EPS

Input Parameter

eps - the eigensolver context
i - the solution index

Output Parameter

error - the relative error bound, computed as ||y'A-ky'B||_2/||ky||_2 where k is the eigenvalue and y is the left eigenvector. If k=0 the relative error is computed as ||y'A||_2/||y||_2.

See Also

EPSSolve(), EPSComputeResidualNormLeft(), EPSGetErrorEstimateLeft()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSRegister.html0000644000175000017500000000354112211062077022334 0ustar gladkgladk EPSRegister

EPSRegister

Adds a method to the eigenproblem solver package.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSRegister(const char *name,PetscErrorCode (*function)(EPS))
Not Collective

Input Parameters

name - name of a new user-defined solver
function - routine to create the solver context

Notes

EPSRegister() may be called multiple times to add several user-defined solvers.

Sample usage

   EPSRegister("my_solver",MySolverCreate);

Then, your solver can be chosen with the procedural interface via

    EPSSetType(eps,"my_solver")
or at runtime via the option
    -eps_type my_solver

See Also

EPSRegisterAll()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSLanczosSetReorthog.html0000644000175000017500000000334612211062077024352 0ustar gladkgladk EPSLanczosSetReorthog

EPSLanczosSetReorthog

Sets the type of reorthogonalization used during the Lanczos iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSLanczosSetReorthog(EPS eps,EPSLanczosReorthogType reorthog)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
reorthog - the type of reorthogonalization

Options Database Key

-eps_lanczos_reorthog - Sets the reorthogonalization type (either 'local', 'selective', 'periodic', 'partial', 'full' or 'delayed')

See Also

EPSLanczosGetReorthog(), EPSLanczosReorthogType

Location: src/eps/impls/krylov/lanczos/lanczos.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetConvergenceTest.html0000644000175000017500000000271312211062077024306 0ustar gladkgladk EPSGetConvergenceTest

EPSGetConvergenceTest

Gets the method used to compute the error estimate used in the convergence test.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv)
Not Collective

Input Parameters

eps - eigensolver context obtained from EPSCreate()

Output Parameters

conv - the type of convergence test

See Also

EPSSetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSMonitorFirst.html0000644000175000017500000000441712211062077023212 0ustar gladkgladk EPSMonitorFirst

EPSMonitorFirst

Print the first approximate value and error estimate at each iteration of the eigensolver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSMonitorFirst(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
Collective on EPS

Input Parameters

eps - eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

EPSMonitorSet(), EPSMonitorAll(), EPSMonitorConverged()

Location: src/eps/interface/monitor.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetInvariantSubspace.html0000644000175000017500000000427512211062077024636 0ustar gladkgladk EPSGetInvariantSubspace

EPSGetInvariantSubspace

Gets an orthonormal basis of the computed invariant subspace.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetInvariantSubspace(EPS eps,Vec *v)
Not Collective, but vectors are shared by all processors that share the EPS

Input Parameter

eps - the eigensolver context

Output Parameter

v - an array of vectors

Notes

This function should be called after EPSSolve() has finished.

The user should provide in v an array of nconv vectors, where nconv is the value returned by EPSGetConverged().

The first k vectors returned in v span an invariant subspace associated with the first k computed eigenvalues (note that this is not true if the k-th eigenvalue is complex and matrix A is real; in this case the first k+1 vectors should be used). An invariant subspace X of A satisfies Ax in X for all x in X (a similar definition applies for generalized eigenproblems).

See Also

EPSGetEigenpair(), EPSGetConverged(), EPSSolve(), EPSGetInvariantSubspaceLeft()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetIP.html0000644000175000017500000000300212211062077021524 0ustar gladkgladk EPSSetIP

EPSSetIP

Associates an inner product object to the eigensolver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetIP(EPS eps,IP ip)
Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
ip - the inner product object

Note

Use EPSGetIP() to retrieve the inner product context (for example, to free it at the end of the computations).

See Also

EPSGetIP()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPowerShiftType.html0000644000175000017500000000215612211062077023505 0ustar gladkgladk EPSPowerShiftType

EPSPowerShiftType

determines the type of shift used in the Power iteration

Synopsis

typedef enum { EPS_POWER_SHIFT_CONSTANT,
               EPS_POWER_SHIFT_RAYLEIGH,
               EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType;

See Also

EPSPowerSetShiftType(), EPSPowerGetShiftType()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetFix.html0000644000175000017500000000323612211062077022171 0ustar gladkgladk EPSJDSetFix

EPSJDSetFix

Sets the threshold for changing the target in the correction equation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
fix - threshold for changing the target

Options Database Key

-eps_jd_fix - the fix value

Note

The target in the correction equation is fixed at the first iterations. When the norm of the residual vector is lower than the fix value, the target is set to the corresponding eigenvalue.

See Also

EPSJDGetFix()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetMatrixNorms.html0000644000175000017500000000322712211062077023474 0ustar gladkgladk EPSGetMatrixNorms

EPSGetMatrixNorms

Returns the value of the matrix norms (either set by the user or estimated by the solver) and the flag indicating whether the norms are being adaptively improved.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetMatrixNorms(EPS eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameters

nrma - the norm of matrix A
nrmb - the norm of matrix B
adaptive - whether matrix norms are improved adaptively

See Also

EPSSetMatrixNorms()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetBalance.html0000644000175000017500000000334512211062077022537 0ustar gladkgladk EPSGetBalance

EPSGetBalance

Gets the balancing type used by the EPS object, and the associated parameters.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetBalance(EPS eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameters

bal - the balancing method
its - number of iterations of the balancing algorithm
cutoff - cutoff value

Note

The user can specify NULL for any parameter that is not needed.

See Also

EPSSetBalance(), EPSBalance

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetDoubleExpansion.html0000644000175000017500000000305312211062077024534 0ustar gladkgladk EPSGDSetDoubleExpansion

EPSGDSetDoubleExpansion

Activate a variant where the search subspace is expanded with K*[A*x B*x] (double expansion) instead of the classic K*r, where K is the preconditioner, x the selected approximate eigenvector and r its associated residual vector.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool use_gd2)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
use_gd2 - the boolean flag

Options Database Keys

-eps_gd_double_expansion - activate the double-expansion variant of GD

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSRemoveDeflationSpace.html0000644000175000017500000000213412211062077024604 0ustar gladkgladk EPSRemoveDeflationSpace

EPSRemoveDeflationSpace

Removes the deflation space.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSRemoveDeflationSpace(EPS eps)
Collective on EPS

Input Parameter

eps - the eigenproblem solver context

See Also

EPSSetDeflationSpace()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetTrackAll.html0000644000175000017500000000343312211062077022721 0ustar gladkgladk EPSSetTrackAll

EPSSetTrackAll

Specifies if the solver must compute the residual norm of all approximate eigenpairs or not.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetTrackAll(EPS eps,PetscBool trackall)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
trackall - whether to compute all residuals or not

Notes

If the user sets trackall=PETSC_TRUE then the solver computes (or estimates) the residual norm for each eigenpair approximation. Computing the residual is usually an expensive operation and solvers commonly compute only the residual associated to the first unconverged eigenpair.

The options '-eps_monitor_all' and '-eps_monitor_lg_all' automatically activate this option.

See Also

EPSGetTrackAll()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSExtraction.html0000644000175000017500000000230012211062077022660 0ustar gladkgladk EPSExtraction

EPSExtraction

Determines the type of extraction technique employed by the eigensolver

Synopsis

typedef enum { EPS_RITZ=1,
               EPS_HARMONIC,
               EPS_HARMONIC_RELATIVE,
               EPS_HARMONIC_RIGHT,
               EPS_HARMONIC_LARGEST,
               EPS_REFINED,
               EPS_REFINED_HARMONIC } EPSExtraction;

See Also

EPSSetExtraction(), EPSGetExtraction()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/index.html0000644000175000017500000003342612211062077021314 0ustar gladkgladk Eigenvalue Problem Solver - EPS

Eigenvalue Problem Solver - EPS: Examples

The Eigenvalue Problem Solver (EPS) is the object provided by SLEPc for specifying an eigenvalue problem, either in standard or generalized form. It provides uniform and efficient access to all of the eigensolvers included in the package.

Conceptually, the level of abstraction occupied by EPS is similar to other solvers in PETSc such as SNES for solving non-linear systems of equations.

EPS users can set various options at runtime via the options database (e.g., -eps_nev 4 -eps_type arnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., EPSSetDimensions() / EPSSetType()).

Beginner - Basic usage
EPS EPSGetConverged EPSSetFromOptions
EPSComputeRelativeError EPSGetEigenpair EPSSetOperators
EPSComputeRelativeErrorLeft EPSGetEigenvalue EPSSetProblemType
EPSComputeResidualNorm EPSGetEigenvector EPSSetTarget
EPSComputeResidualNormLeft EPSGetEigenvectorLeft EPSSolve
EPSConvergedReason EPSGetST EPSType
EPSCreate EPSGetTarget EPSView
EPSDestroy EPSProblemType
EPSExtraction EPSSetExtraction
Intermediate - Setting options for algorithms and data structures
EPSBalance EPSGetProblemType EPSSetBalance
EPSConv EPSGetTolerances EPSSetConvergenceTest
EPSGetBalance EPSGetTrackAll EPSSetDeflationSpace
EPSGetConvergedReason EPSGetTrueResidual EPSSetDimensions
EPSGetConvergenceTest EPSGetType EPSSetInitialSpace
EPSGetDimensions EPSGetWhichEigenpairs EPSSetInitialSpaceLeft
EPSGetExtraction EPSIsGeneralized EPSSetInterval
EPSGetInterval EPSIsHermitian EPSSetLeftVectorsWanted
EPSGetInvariantSubspace EPSIsPositive EPSSetMatrixNorms
EPSGetInvariantSubspaceLeft EPSMonitorAll EPSSetTolerances
EPSGetIterationNumber EPSMonitorCancel EPSSetTrackAll
EPSGetLeftVectorsWanted EPSMonitorConverged EPSSetTrueResidual
EPSGetMatrixNorms EPSMonitorFirst EPSSetType
EPSGetMonitorContext EPSMonitorSet EPSSetWhichEigenpairs
EPSGetOperationCounters EPSPrintSolution EPSWhich
EPSGetOperators EPSRemoveDeflationSpace
Advanced - Setting more advanced options and customization
EPSAppendOptionsPrefix EPSGDSetKrylovStart EPSLanczosGetReorthog
EPSArnoldiGetDelayed EPSGDSetRestart EPSLanczosReorthogType
EPSArnoldiSetDelayed EPSGDSetWindowSizes EPSLanczosSetReorthog
EPSBlzpackSetBlockSize EPSGetDS EPSOrthType
EPSBlzpackSetNSteps EPSGetErrorEstimate EPSPRIMMEGetBlockSize
EPSCISSGetRefinement EPSGetErrorEstimateLeft EPSPRIMMEGetMethod
EPSCISSGetRegion EPSGetIP EPSPRIMMEMethod
EPSCISSGetSizes EPSGetOptionsPrefix EPSPRIMMESetBlockSize
EPSCISSGetThreshold EPSJDGetBOrth EPSPRIMMESetMethod
EPSCISSSetRefinement EPSJDGetBlockSize EPSPowerGetShiftType
EPSCISSSetRegion EPSJDGetConstCorrectionTol EPSPowerSetShiftType
EPSCISSSetSizes EPSJDGetFix EPSPowerShiftType
EPSCISSSetThreshold EPSJDGetInitialSize EPSRQCGGetReset
EPSFEASTGetNumPoints EPSJDGetKrylovStart EPSRQCGSetReset
EPSFEASTSetNumPoints EPSJDGetRestart EPSRegister
EPSGDGetBOrth EPSJDGetWindowSizes EPSRegisterAll
EPSGDGetBlockSize EPSJDSetBOrth EPSReset
EPSGDGetDoubleExpansion EPSJDSetBlockSize EPSSetArbitrarySelection
EPSGDGetInitialSize EPSJDSetConstCorrectionTol EPSSetConvergenceTestFunction
EPSGDGetKrylovStart EPSJDSetFix EPSSetDS
EPSGDGetRestart EPSJDSetInitialSize EPSSetEigenvalueComparison
EPSGDGetWindowSizes EPSJDSetKrylovStart EPSSetIP
EPSGDSetBOrth EPSJDSetRestart EPSSetOptionsPrefix
EPSGDSetBlockSize EPSJDSetWindowSizes EPSSetUp
EPSGDSetDoubleExpansion EPSKrylovSchurGetRestart
EPSGDSetInitialSize EPSKrylovSchurSetRestart
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
EPSCompareEigenvalues EPSGetStartVectorLeft EPSSetWorkVecs
EPSFinalizePackage EPSInitializePackage EPSSortEigenvalues
EPSGetStartVector EPSSetST
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSFinalizePackage.html0000644000175000017500000000206012211062077023560 0ustar gladkgladk EPSFinalizePackage

EPSFinalizePackage

This function destroys everything in the SLEPc interface to the EPS package. It is called from SlepcFinalize().

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetBOrth.html0000644000175000017500000000505112211062077022453 0ustar gladkgladk EPSGDSetBOrth

EPSGDSetBOrth

Selects the orthogonalization that will be used in the search subspace in case of generalized Hermitian problems.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetBOrth(EPS eps,EPSOrthType borth)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
borth - the kind of orthogonalization

Possible values

The parameter 'borth' can have one of these values

EPS_ORTH_I - orthogonalization of the search subspace
EPS_ORTH_B - B-orthogonalization of the search subspace
EPS_ORTH_BOPT - B-orthogonalization of the search subspace with an alternative method

Options Database Key

-eps_gd_borth - Set the orthogonalization used in the search subspace

Notes

If borth is EPS_ORTH_B, the solver uses a variant of Gram-Schmidt (selected in IP associated to the EPS) with the inner product defined by the matrix problem B. If borth is EPS_ORTH_BOPT, it uses another variant of Gram-Schmidt that only performs one matrix-vector product although more than one reorthogonalization would be done.

See Also

EPSGDGetBOrth()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetExtraction.html0000644000175000017500000000554712211062077023354 0ustar gladkgladk EPSSetExtraction

EPSSetExtraction

Specifies the type of extraction technique to be employed by the eigensolver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetExtraction(EPS eps,EPSExtraction extr)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
extr - a known type of extraction

Options Database Keys

-eps_ritz - Rayleigh-Ritz extraction
-eps_harmonic - harmonic Ritz extraction
-eps_harmonic_relative - harmonic Ritz extraction relative to the eigenvalue
-eps_harmonic_right - harmonic Ritz extraction for rightmost eigenvalues
-eps_harmonic_largest - harmonic Ritz extraction for largest magnitude (without target)
-eps_refined - refined Ritz extraction
-eps_refined_harmonic - refined harmonic Ritz extraction

Notes

Not all eigensolvers support all types of extraction. See the SLEPc Users Manual for details.

By default, a standard Rayleigh-Ritz extraction is used. Other extractions may be useful when computing interior eigenvalues.

Harmonic-type extractions are used in combination with a 'target'.

See Also

EPSSetTarget(), EPSGetExtraction(), EPSExtraction

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSOrthType.html0000644000175000017500000000201212211062077022316 0ustar gladkgladk EPSOrthType

EPSOrthType

determines the orthogonalization used in the search subspace

Synopsis

typedef enum { EPS_ORTH_I=1,
               EPS_ORTH_B,
               EPS_ORTH_BOPT } EPSOrthType;

See Also

EPSGDSetBOrth(), EPSJDSetBOrth()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSConvergedReason.html0000644000175000017500000000246712211062077023642 0ustar gladkgladk EPSConvergedReason

EPSConvergedReason

Reason an eigensolver was said to have converged or diverged

Synopsis

typedef enum {/* converged */
              EPS_CONVERGED_TOL                =  2,
              /* diverged */
              EPS_DIVERGED_ITS                 = -3,
              EPS_DIVERGED_BREAKDOWN           = -4,
              EPS_CONVERGED_ITERATING          =  0} EPSConvergedReason;

See Also

EPSSolve(), EPSGetConvergedReason(), EPSSetTolerances()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetArbitrarySelection.html0000644000175000017500000001001612211062077025024 0ustar gladkgladk EPSSetArbitrarySelection

EPSSetArbitrarySelection

Specifies a function intended to look for eigenvalues according to an arbitrary selection criterion. This criterion can be based on a computation involving the current eigenvector approximation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetArbitrarySelection(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,Vec,Vec,PetscScalar*,PetscScalar*,void*),void* ctx)
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
func - a pointer to the evaluation function
ctx - a context pointer (the last parameter to the evaluation function)

Calling Sequence of func

  func(PetscScalar er,PetscScalar ei,Vec xr,Vec xi,PetscScalar *rr,PetscScalar *ri,void *ctx)

er - real part of the current eigenvalue approximation
ei - imaginary part of the current eigenvalue approximation
xr - real part of the current eigenvector approximation
xi - imaginary part of the current eigenvector approximation
rr - result of evaluation (real part)
ri - result of evaluation (imaginary part)
ctx - optional context, as set by EPSSetArbitrarySelection()

Note

This provides a mechanism to select eigenpairs by evaluating a user-defined function. When a function has been provided, the default selection based on sorting the eigenvalues is replaced by the sorting of the results of this function (with the same sorting criterion given in EPSSortEigenvalues()).

For instance, suppose you want to compute those eigenvectors that maximize a certain computable expression. Then implement the computation using the arguments xr and xi, and return the result in rr. Then set the standard sorting by magnitude so that the eigenpair with largest value of rr is selected.

The result of func is expressed as a complex number so that it is possible to use the standard eigenvalue sorting functions, but normally only rr is used. Set ri to zero unless it is meaningful in your application.

See Also

EPSSetWhichEigenpairs(), EPSSortEigenvalues()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSolve.html0000644000175000017500000000611212211062077021635 0ustar gladkgladk EPSSolve

EPSSolve

Solves the eigensystem.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSolve(EPS eps)
Collective on EPS

Input Parameter

eps - eigensolver context obtained from EPSCreate()

Options Database Keys

-eps_view - print information about the solver used
-eps_view_mat0 binary - save the first matrix (A) to the default binary viewer
-eps_view_mat1 binary - save the second matrix (B) to the default binary viewer
-eps_plot_eigs - plot computed eigenvalues

See Also

EPSCreate(), EPSSetUp(), EPSDestroy(), EPSSetTolerances()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSIsPositive.html0000644000175000017500000000245612211062077022652 0ustar gladkgladk EPSIsPositive

EPSIsPositive

Ask if the EPS object corresponds to an eigenvalue problem type that requires a positive (semi-) definite matrix B.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSIsPositive(EPS eps,PetscBool* is)
Not collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

is - the answer

See Also

EPSIsGeneralized(), EPSIsHermitian()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetBlockSize.html0000644000175000017500000000240112211062077023302 0ustar gladkgladk EPSGDGetBlockSize

EPSGDGetBlockSize

Returns the number of vectors to be added to the searching space in every iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

blocksize - number of vectors added to the search space in every iteration

See Also

EPSGDSetBlockSize()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPRIMMEMethod.html0000644000175000017500000000304012211062077022674 0ustar gladkgladk EPSPRIMMEMethod

EPSPRIMMEMethod

determines the method selected in the PRIMME library

Synopsis

typedef enum { EPS_PRIMME_DYNAMIC,
               EPS_PRIMME_DEFAULT_MIN_TIME,
               EPS_PRIMME_DEFAULT_MIN_MATVECS,
               EPS_PRIMME_ARNOLDI,
               EPS_PRIMME_GD,
               EPS_PRIMME_GD_PLUSK,
               EPS_PRIMME_GD_OLSEN_PLUSK,
               EPS_PRIMME_JD_OLSEN_PLUSK,
               EPS_PRIMME_RQI,
               EPS_PRIMME_JDQR,
               EPS_PRIMME_JDQMR,
               EPS_PRIMME_JDQMR_ETOL,
               EPS_PRIMME_SUBSPACE_ITERATION,
               EPS_PRIMME_LOBPCG_ORTHOBASIS,
               EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod;

See Also

EPSPRIMMESetMethod(), EPSPRIMMEGetMethod()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetKrylovStart.html0000644000175000017500000000304512211062077023742 0ustar gladkgladk EPSGDSetKrylovStart

EPSGDSetKrylovStart

Activates or deactivates starting the searching subspace with a Krylov basis.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
krylovstart - boolean flag

Options Database Key

-eps_gd_krylov_start - Activates starting the searching subspace with a Krylov basis

See Also

EPSGDGetKrylovStart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetBOrth.html0000644000175000017500000000265112211062077022442 0ustar gladkgladk EPSGDGetBOrth

EPSGDGetBOrth

Returns the orthogonalization used in the search subspace in case of generalized Hermitian problems.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetBOrth(EPS eps,EPSOrthType *borth)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

borth - the kind of orthogonalization

Notes

See EPSGDSetBOrth() for possible values of 'borth'.

See Also

EPSGDSetBOrth(), EPSOrthType

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetWorkVecs.html0000644000175000017500000000257012211062077022770 0ustar gladkgladk EPSSetWorkVecs

EPSSetWorkVecs

Sets a number of work vectors into a EPS object

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetWorkVecs(EPS eps,PetscInt nw)
Collective on EPS

Input Parameters

eps - eigensolver context
nw - number of work vectors to allocate

Developers Note

This is PETSC_EXTERN because it may be required by user plugin EPS implementations.

Location: src/eps/interface/default.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSortEigenvalues.html0000644000175000017500000000402112211062077023661 0ustar gladkgladk EPSSortEigenvalues

EPSSortEigenvalues

Sorts a list of eigenvalues according to the criterion specified via EPSSetWhichEigenpairs().

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSortEigenvalues(EPS eps,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)
Not Collective

Input Parameters

eps - the eigensolver context
n - number of eigenvalues in the list
eigr - pointer to the array containing the eigenvalues
eigi - imaginary part of the eigenvalues (only when using real numbers)

Output Parameter

perm - resulting permutation

Note

The result is a list of indices in the original eigenvalue array corresponding to the first nev eigenvalues sorted in the specified criterion.

See Also

EPSSetWhichEigenpairs()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetTrackAll.html0000644000175000017500000000224512211062077022705 0ustar gladkgladk EPSGetTrackAll

EPSGetTrackAll

Returns the flag indicating whether all residual norms must be computed or not.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetTrackAll(EPS eps,PetscBool *trackall)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

trackall - the returned flag

See Also

EPSSetTrackAll()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetLeftVectorsWanted.html0000644000175000017500000000404012211062077024622 0ustar gladkgladk EPSSetLeftVectorsWanted

EPSSetLeftVectorsWanted

Specifies which eigenvectors are required.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetLeftVectorsWanted(EPS eps,PetscBool leftvecs)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
leftvecs - whether left eigenvectors are required or not

Options Database Keys

-eps_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'

Notes

If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of the algorithm that computes both right and left eigenvectors. This is usually much more costly. This option is not available in all solvers.

See Also

EPSGetLeftVectorsWanted(), EPSGetEigenvectorLeft()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetTrueResidual.html0000644000175000017500000000230612211062077023616 0ustar gladkgladk EPSGetTrueResidual

EPSGetTrueResidual

Returns the flag indicating whether true residuals must be computed explicitly or not.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetTrueResidual(EPS eps,PetscBool *trueres)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

trueres - the returned flag

See Also

EPSSetTrueResidual()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSRQCGSetReset.html0000644000175000017500000000303012211062077022754 0ustar gladkgladk EPSRQCGSetReset

EPSRQCGSetReset

Sets the reset parameter of the RQCG iteration. Every nrest iterations, the solver performs a Rayleigh-Ritz projection step.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSRQCGSetReset(EPS eps,PetscInt nrest)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
nrest - the number of iterations between resets

Options Database Key

-eps_rqcg_reset - Sets the reset parameter

See Also

EPSRQCGGetReset()

Location: src/eps/impls/cg/rqcg/rqcg.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSMonitorAll.html0000644000175000017500000000442112211062077022626 0ustar gladkgladk EPSMonitorAll

EPSMonitorAll

Print the current approximate values and error estimates at each iteration of the eigensolver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSMonitorAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
Collective on EPS

Input Parameters

eps - eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorConverged()

Location: src/eps/interface/monitor.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetDoubleExpansion.html0000644000175000017500000000235412211062077024523 0ustar gladkgladk EPSGDGetDoubleExpansion

EPSGDGetDoubleExpansion

Gets a flag indicating whether the double expansion variant has been activated or not.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *flg)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

flg - the flag

See Also

EPSGDSetDoubleExpansion()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetTarget.html0000644000175000017500000000341712211062077022454 0ustar gladkgladk EPSSetTarget

EPSSetTarget

Sets the value of the target.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetTarget(EPS eps,PetscScalar target)
Logically Collective on EPS

Input Parameters

eps - eigensolver context
target - the value of the target

Notes

The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with EPSSetWhichEigenpairs().

See Also

EPSGetTarget(), EPSSetWhichEigenpairs()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex13.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetLeftVectorsWanted.html0000644000175000017500000000242512211062077024613 0ustar gladkgladk EPSGetLeftVectorsWanted

EPSGetLeftVectorsWanted

Returns the flag indicating whether left eigenvectors are required or not.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetLeftVectorsWanted(EPS eps,PetscBool *leftvecs)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

leftvecs - the returned flag

See Also

EPSSetLeftVectorsWanted(), EPSWhich

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPowerSetShiftType.html0000644000175000017500000000425012211062077024156 0ustar gladkgladk EPSPowerSetShiftType

EPSPowerSetShiftType

Sets the type of shifts used during the power iteration. This can be used to emulate the Rayleigh Quotient Iteration (RQI) method.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPowerSetShiftType(EPS eps,EPSPowerShiftType shift)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
shift - the type of shift

Options Database Key

-eps_power_shift_type - Sets the shift type (either 'constant' or 'rayleigh' or 'wilkinson')

Notes

By default, shifts are constant (EPS_POWER_SHIFT_CONSTANT) and the iteration is the simple power method (or inverse iteration if a shift-and-invert transformation is being used).

A variable shift can be specified (EPS_POWER_SHIFT_RAYLEIGH or EPS_POWER_SHIFT_WILKINSON). In this case, the iteration behaves rather like a cubic converging method as RQI. See the users manual for details.

See Also

EPSPowerGetShiftType(), STSetShift(), EPSPowerShiftType

Location: src/eps/impls/power/power.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetFix.html0000644000175000017500000000262012211062077022151 0ustar gladkgladk EPSJDGetFix

EPSJDGetFix

Returns the threshold for changing the target in the correction equation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

fix - threshold for changing the target

Note

The target in the correction equation is fixed at the first iterations. When the norm of the residual vector is lower than the fix value, the target is set to the corresponding eigenvalue.

See Also

EPSJDSetFix()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPS.html0000644000175000017500000000205012211062077020621 0ustar gladkgladk EPS

EPS

Abstract SLEPc object that manages all the eigenvalue problem solvers.

Synopsis

typedef struct _p_EPS* EPS;

See Also

EPSCreate(), ST

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetConvergenceTest.html0000644000175000017500000000562512211062077024327 0ustar gladkgladk EPSSetConvergenceTest

EPSSetConvergenceTest

Specifies how to compute the error estimate used in the convergence test.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv)
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
conv - the type of convergence test

Options Database Keys

-eps_conv_abs - Sets the absolute convergence test
-eps_conv_eig - Sets the convergence test relative to the eigenvalue
-eps_conv_norm - Sets the convergence test relative to the matrix norms

Note

The parameter 'conv' can have one of these values
EPS_CONV_ABS - absolute error ||r||
EPS_CONV_EIG - error relative to the eigenvalue l, ||r||/|l|
EPS_CONV_NORM - error relative to the matrix norms, ||r||/(||A||+|l|*||B||)
EPS_CONV_USER - function set by EPSSetConvergenceTestFunction()

See Also

EPSGetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetInterval.html0000644000175000017500000000443012211062077023006 0ustar gladkgladk EPSSetInterval

EPSSetInterval

Defines the computational interval for spectrum slicing.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetInterval(EPS eps,PetscReal inta,PetscReal intb)
Logically Collective on EPS

Input Parameters

eps - eigensolver context
inta - left end of the interval
intb - right end of the interval

Options Database Key

-eps_interval <a,b> - set [a,b] as the interval of interest

Notes

Spectrum slicing is a technique employed for computing all eigenvalues of symmetric eigenproblems in a given interval. This function provides the interval to be considered. It must be used in combination with EPS_ALL, see EPSSetWhichEigenpairs().

In the command-line option, two values must be provided. For an open interval, one can give an infinite, e.g., -eps_interval 1.0,inf or -eps_interval -inf,1.0. An open interval in the programmatic interface can be specified with PETSC_MAX_REAL and -PETSC_MAX_REAL.

See Also

EPSGetInterval(), EPSSetWhichEigenpairs()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSSetThreshold.html0000644000175000017500000000357012211062077023644 0ustar gladkgladk EPSCISSSetThreshold

EPSCISSSetThreshold

Sets the values of various threshold parameters in the CISS solver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSSetThreshold(EPS eps,PetscReal delta,PetscReal spur)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
delta - threshold for numerical rank
spur - spurious threshold (to discard spurious eigenpairs)

Options Database Keys

-eps_ciss_delta - Sets the delta
-eps_ciss_spurious_threshold - Sets the spurious threshold

See Also

EPSCISSGetThreshold()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetBlockSize.html0000644000175000017500000000240112211062077023305 0ustar gladkgladk EPSJDGetBlockSize

EPSJDGetBlockSize

Returns the number of vectors to be added to the searching space in every iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

blocksize - number of vectors added to the search space in every iteration

See Also

EPSJDSetBlockSize()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetWindowSizes.html0000644000175000017500000000310612211062077023705 0ustar gladkgladk EPSGDGetWindowSizes

EPSGDGetWindowSizes

Gets the number of converged vectors in the projected problem (or Rayleigh quotient) and in the projector employed in the correction equation.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetWindowSizes(EPS eps,PetscInt *pwindow,PetscInt *qwindow)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

pwindow - number of converged vectors in the projector
qwindow - number of converged vectors in the projected problem

See Also

EPSGDSetWindowSizes()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetST.html0000644000175000017500000000274312211062077021541 0ustar gladkgladk EPSGetST

EPSGetST

Obtain the spectral transformation (ST) object associated to the eigensolver object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetST(EPS eps,ST *st)
Not Collective

Input Parameters

eps - eigensolver context obtained from EPSCreate()

Output Parameter

st - spectral transformation context

See Also

EPSSetST()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex13.c.html
src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetInitialSpaceLeft.html0000644000175000017500000000505412211062077024405 0ustar gladkgladk EPSSetInitialSpaceLeft

EPSSetInitialSpaceLeft

Specify a basis of vectors that constitute the initial left space, that is, the subspace from which the solver starts to iterate for building the left subspace (in methods that work with two subspaces).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetInitialSpaceLeft(EPS eps,PetscInt n,Vec *is)
Collective on EPS and Vec

Input Parameter

eps - the eigenproblem solver context
n - number of vectors
is - set of basis vectors of the initial left space

Notes

Some solvers start to iterate on a single vector (initial left vector). In that case, the other vectors are ignored.

In contrast to EPSSetDeflationSpace(), these vectors do not persist from one EPSSolve() call to the other, so the initial left space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted left eigenspace. Then, convergence may be faster.

See Also

EPSSetInitialSpace(), EPSSetDeflationSpace()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPRIMMEGetMethod.html0000644000175000017500000000336012211062077023341 0ustar gladkgladk EPSPRIMMEGetMethod

EPSPRIMMEGetMethod

Gets the method for the PRIMME library.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPRIMMEGetMethod(EPS eps,EPSPRIMMEMethod *method)
Mon Collective on EPS

Input Parameters

eps - the eigenproblem solver context

Output Parameters

method - method that will be used by PRIMME. It must be one of: EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL), EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI, EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION, EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW

See Also

EPSPRIMMESetMethod(), EPSPRIMMEMethod

Location: src/eps/impls/external/primme/primme.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetStartVector.html0000644000175000017500000000473112211062077023472 0ustar gladkgladk EPSGetStartVector

EPSGetStartVector

Gets a suitable vector to be used as the starting vector for the recurrence that builds the right subspace.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetStartVector(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown)
Collective on EPS and Vec

Input Parameters

eps - the eigensolver context
i - iteration number

Output Parameters

vec - the start vector
breakdown - flag indicating that a breakdown has occurred

Notes

The start vector is computed from another vector: for the first step (i=0), the first initial vector is used (see EPSSetInitialSpace()); otherwise a random vector is created. Then this vector is forced to be in the range of OP (only for generalized definite problems) and orthonormalized with respect to all V-vectors up to i-1.

The flag breakdown is set to true if either i=0 and the vector belongs to the deflation space, or i>0 and the vector is linearly dependent with respect to the V-vectors.

The caller must pass a vector already allocated with dimensions conforming to the initial vector. This vector is overwritten.

See Also

EPSSetInitialSpace()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSSetRegion.html0000644000175000017500000000405512211062077023132 0ustar gladkgladk EPSCISSSetRegion

EPSCISSSetRegion

Sets the parameters defining the region where eigenvalues must be computed.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSSetRegion(EPS eps,PetscScalar center,PetscReal radius,PetscReal vscale)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
center - center of the region
radius - radius of the region
vscale - vertical scale of the region

Options Database Keys

-eps_ciss_center - Sets the center
-eps_ciss_radius - Sets the radius
-eps_ciss_vscale - Sets the vertical scale

See Also

EPSCISSGetRegion()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetExtraction.html0000644000175000017500000000237512211062077023334 0ustar gladkgladk EPSGetExtraction

EPSGetExtraction

Gets the extraction type used by the EPS object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetExtraction(EPS eps,EPSExtraction *extr)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

extr - name of extraction type

See Also

EPSSetExtraction(), EPSExtraction

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetBalance.html0000644000175000017500000000657512211062077022563 0ustar gladkgladk EPSSetBalance

EPSSetBalance

Specifies the balancing technique to be employed by the eigensolver, and some parameters associated to it.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetBalance(EPS eps,EPSBalance bal,PetscInt its,PetscReal cutoff)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
bal - the balancing method, one of EPS_BALANCE_NONE, EPS_BALANCE_ONESIDE, EPS_BALANCE_TWOSIDE, or EPS_BALANCE_USER
its - number of iterations of the balancing algorithm
cutoff - cutoff value

Options Database Keys

-eps_balance <method> - the balancing method, where <method> is one of 'none', 'oneside', 'twoside', or 'user'
-eps_balance_its <its> - number of iterations
-eps_balance_cutoff <cutoff> - cutoff value

Notes

When balancing is enabled, the solver works implicitly with matrix DAD^-1, where D is an appropriate diagonal matrix. This improves the accuracy of the computed results in some cases. See the SLEPc Users Manual for details.

Balancing makes sense only for non-Hermitian problems when the required precision is high (i.e. a small tolerance such as 1e-15).

By default, balancing is disabled. The two-sided method is much more effective than the one-sided counterpart, but it requires the system matrices to have the MatMultTranspose operation defined.

The parameter 'its' is the number of iterations performed by the method. The cutoff value is used only in the two-side variant. Pass 0 for an argument that need not be changed. Use PETSC_DECIDE to assign a reasonably good value.

User-defined balancing is allowed provided that the corresponding matrix is set via STSetBalanceMatrix.

See Also

EPSGetBalance(), EPSBalance, STSetBalanceMatrix()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSBlzpackSetBlockSize.html0000644000175000017500000000256112211062077024421 0ustar gladkgladk EPSBlzpackSetBlockSize

EPSBlzpackSetBlockSize

Sets the block size for the BLZPACK package.

Synopsis

#include "slepceps.h" 
#include "slepcst.h" 
PetscErrorCode EPSBlzpackSetBlockSize(EPS eps,PetscInt bs)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context
bs - block size

Options Database Key

-eps_blzpack_block_size - Sets the value of the block size

Location: src/eps/impls/external/blzpack/blzpack.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSDestroy.html0000644000175000017500000000457012211062077022204 0ustar gladkgladk EPSDestroy

EPSDestroy

Destroys the EPS context.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSDestroy(EPS *eps)
Collective on EPS

Input Parameter

eps - eigensolver context obtained from EPSCreate()

See Also

EPSCreate(), EPSSetUp(), EPSSolve()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetBlockSize.html0000644000175000017500000000311412211062077023320 0ustar gladkgladk EPSGDSetBlockSize

EPSGDSetBlockSize

Sets the number of vectors to be added to the searching space in every iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
blocksize - number of vectors added to the search space in every iteration

Options Database Key

-eps_gd_blocksize - number of vectors added to the search space in every iteration

See Also

EPSGDSetKrylovStart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetInterval.html0000644000175000017500000000275512211062077023002 0ustar gladkgladk EPSGetInterval

EPSGetInterval

Gets the computational interval for spectrum slicing.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetInterval(EPS eps,PetscReal* inta,PetscReal* intb)
Not Collective

Input Parameter

eps - eigensolver context

Output Parameters

inta - left end of the interval
intb - right end of the interval

Note

If the interval was not set by the user, then zeros are returned.

See Also

EPSSetInterval()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetUp.html0000644000175000017500000000356312211062077021614 0ustar gladkgladk EPSSetUp

EPSSetUp

Sets up all the internal data structures necessary for the execution of the eigensolver. Then calls STSetUp() for any set-up operations associated to the ST object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetUp(EPS eps)
Collective on EPS

Input Parameter

eps - eigenproblem solver context

Notes

This function need not be called explicitly in most cases, since EPSSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time.

See Also

EPSCreate(), EPSSolve(), EPSDestroy(), STSetUp(), EPSSetInitialSpace()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex19.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetST.html0000644000175000017500000000304012211062077021544 0ustar gladkgladk EPSSetST

EPSSetST

Associates a spectral transformation object to the eigensolver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetST(EPS eps,ST st)
Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
st - the spectral transformation object

Note

Use EPSGetST() to retrieve the spectral transformation context (for example, to free it at the end of the computations).

See Also

EPSGetST()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSArnoldiGetDelayed.html0000644000175000017500000000243612211062077024072 0ustar gladkgladk EPSArnoldiGetDelayed

EPSArnoldiGetDelayed

Gets the type of reorthogonalization used during the Arnoldi iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSArnoldiGetDelayed(EPS eps,PetscBool *delayed)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Input Parameter

delayed - boolean flag indicating if delayed reorthogonalization has been enabled

See Also

EPSArnoldiSetDelayed()

Location: src/eps/impls/krylov/arnoldi/arnoldi.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetStartVectorLeft.html0000644000175000017500000000471512211062077024307 0ustar gladkgladk EPSGetStartVectorLeft

EPSGetStartVectorLeft

Gets a suitable vector to be used as the starting vector in the recurrence that builds the left subspace (in methods that work with two subspaces).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetStartVectorLeft(EPS eps,PetscInt i,Vec vec,PetscBool *breakdown)
Collective on EPS and Vec

Input Parameters

eps - the eigensolver context
i - iteration number

Output Parameter

vec - the start vector
breakdown - flag indicating that a breakdown has occurred

Notes

The start vector is computed from another vector: for the first step (i=0), the first left initial vector is used (see EPSSetInitialSpaceLeft()); otherwise a random vector is created. Then this vector is forced to be in the range of OP' and orthonormalized with respect to all W-vectors up to i-1.

The flag breakdown is set to true if i>0 and the vector is linearly dependent with respect to the W-vectors.

The caller must pass a vector already allocated with dimensions conforming to the left initial vector. This vector is overwritten.

See Also

EPSSetInitialSpaceLeft()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetBOrth.html0000644000175000017500000000505112211062077022456 0ustar gladkgladk EPSJDSetBOrth

EPSJDSetBOrth

Selects the orthogonalization that will be used in the search subspace in case of generalized Hermitian problems.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetBOrth(EPS eps,EPSOrthType borth)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
borth - the kind of orthogonalization

Possible values

The parameter 'borth' can have one of these values

EPS_ORTH_I - orthogonalization of the search subspace
EPS_ORTH_B - B-orthogonalization of the search subspace
EPS_ORTH_BOPT - B-orthogonalization of the search subspace with an alternative method

Options Database Key

-eps_jd_borth - Set the orthogonalization used in the search subspace

Notes

If borth is EPS_ORTH_B, the solver uses a variant of Gram-Schmidt (selected in IP associated to the EPS) with the inner product defined by the matrix problem B. If borth is EPS_ORTH_BOPT, it uses another variant of Gram-Schmidt that only performs one matrix-vector product although more than one reorthogonalization would be done.

See Also

EPSJDGetBOrth()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSSetSizes.html0000644000175000017500000000612212211062077023001 0ustar gladkgladk EPSCISSSetSizes

EPSCISSSetSizes

Sets the values of various size parameters in the CISS solver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSSetSizes(EPS eps,PetscInt ip,PetscInt bs,PetscInt ms,PetscInt npart,PetscInt bsmax,PetscBool isreal)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
ip - number of integration points
bs - block size
ms - moment size
npart - number of partitions when splitting the communicator
bsmax - max block size
isreal - A and B are real

Options Database Keys

-eps_ciss_integration_points - Sets the number of integration points
-eps_ciss_blocksize - Sets the block size
-eps_ciss_moments - Sets the moment size
-eps_ciss_partitions - Sets the number of partitions
-eps_ciss_maxblocksize - Sets the maximum block size
-eps_ciss_realmats - A and B are real

Note

The default number of partitions is 1. This means the internal KSP object is shared among all processes of the EPS communicator. Otherwise, the communicator is split into npart communicators, so that npart KSP solves proceed simultaneously.

See Also

EPSCISSGetSizes()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPRIMMESetMethod.html0000644000175000017500000000414012211062077023352 0ustar gladkgladk EPSPRIMMESetMethod

EPSPRIMMESetMethod

Sets the method for the PRIMME library.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPRIMMESetMethod(EPS eps,EPSPRIMMEMethod method)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context
method - method that will be used by PRIMME. It must be one of: EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL), EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI, EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION, EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW

Options Database Key

-eps_primme_set_method - Sets the method for the PRIMME library.

Note

If not set, the method defaults to EPS_PRIMME_DEFAULT_MIN_TIME.

See Also

EPSPRIMMEGetMethod(), EPSPRIMMEMethod

Location: src/eps/impls/external/primme/primme.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetWhichEigenpairs.html0000644000175000017500000000277112211062077024265 0ustar gladkgladk EPSGetWhichEigenpairs

EPSGetWhichEigenpairs

Returns which portion of the spectrum is to be sought.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetWhichEigenpairs(EPS eps,EPSWhich *which)
Not Collective

Input Parameter

eps - eigensolver context obtained from EPSCreate()

Output Parameter

which - the portion of the spectrum to be sought

Notes

See EPSSetWhichEigenpairs() for possible values of 'which'.

See Also

EPSSetWhichEigenpairs(), EPSWhich

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPrintSolution.html0000644000175000017500000000533412211062077023403 0ustar gladkgladk EPSPrintSolution

EPSPrintSolution

Prints the computed eigenvalues.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPrintSolution(EPS eps,PetscViewer viewer)
Collective on EPS

Input Parameters

eps - the eigensolver context
viewer - optional visualization context

Options Database Key

-eps_terse - print only minimal information

Note

By default, this function prints a table with eigenvalues and associated relative errors. With -eps_terse only the eigenvalues are printed.

See Also

PetscViewerASCIIOpen()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
src/eps/examples/tutorials/ex1f90.F90.html
src/eps/examples/tutorials/ex6f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetTrueResidual.html0000644000175000017500000000421212211062077023630 0ustar gladkgladk EPSSetTrueResidual

EPSSetTrueResidual

Specifies if the solver must compute the true residual explicitly or not.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetTrueResidual(EPS eps,PetscBool trueres)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
trueres - whether true residuals are required or not

Options Database Keys

-eps_true_residual <boolean> - Sets/resets the boolean flag 'trueres'

Notes

If the user sets trueres=PETSC_TRUE then the solver explicitly computes the true residual for each eigenpair approximation, and uses it for convergence testing. Computing the residual is usually an expensive operation. Some solvers (e.g., Krylov solvers) can avoid this computation by using a cheap estimate of the residual norm, but this may sometimes give inaccurate results (especially if a spectral transform is being used). On the contrary, preconditioned eigensolvers (e.g., Davidson solvers) do rely on computing the true residual, so this option is irrelevant for them.

See Also

EPSGetTrueResidual()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSMonitorCancel.html0000644000175000017500000000271312211062077023305 0ustar gladkgladk EPSMonitorCancel

EPSMonitorCancel

Clears all monitors for an EPS object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSMonitorCancel(EPS eps)
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()

Options Database Key

-eps_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to EPSMonitorSet(), but does not cancel those set via the options database.

See Also

EPSMonitorSet()

Location: src/eps/interface/monitor.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetRestart.html0000644000175000017500000000376112211062077023072 0ustar gladkgladk EPSJDSetRestart

EPSJDSetRestart

Sets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
minv - number of vectors of the searching subspace after restarting
plusk - number of vectors saved from the previous iteration

Options Database Keys

-eps_jd_minv - number of vectors of the searching subspace after restarting
-eps_jd_plusk - number of vectors saved from the previous iteration

See Also

EPSJDGetRestart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetDimensions.html0000644000175000017500000000657112211062077023342 0ustar gladkgladk EPSSetDimensions

EPSSetDimensions

Sets the number of eigenvalues to compute and the dimension of the subspace.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetDimensions(EPS eps,PetscInt nev,PetscInt ncv,PetscInt mpd)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
nev - number of eigenvalues to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Options Database Keys

-eps_nev <nev> - Sets the number of eigenvalues
-eps_ncv <ncv> - Sets the dimension of the subspace
-eps_mpd <mpd> - Sets the maximum projected dimension

Notes

Pass 0 to retain the previous value of any parameter.

Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method.

The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and (b) in cases where nev is large, the user sets mpd.

The value of ncv should always be between nev and (nev+mpd), typically ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise a smaller value should be used.

When computing all eigenvalues in an interval, see EPSSetInterval(), the meaning of nev changes. In that case, the number of eigenvalues in the interval is not known a priori; the meaning of nev is then the number of eigenvalues that are computed at a time when sweeping the interval from one end to the other. The value of nev in this case may have an impact on overall performance. The value of ncv should not be assigned in this case.

See Also

EPSGetDimensions(), EPSSetInterval()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetOperationCounters.html0000644000175000017500000000436212211062077024675 0ustar gladkgladk EPSGetOperationCounters

EPSGetOperationCounters

Gets the total number of operator applications, inner product operations and linear iterations used by the ST object during the last EPSSolve() call.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetOperationCounters(EPS eps,PetscInt* ops,PetscInt* dots,PetscInt* lits)
Not Collective

Input Parameter

eps - EPS context

Output Parameter

ops - number of operator applications
dots - number of inner product operations
lits - number of linear iterations

Notes

When the eigensolver algorithm invokes STApply() then a linear system must be solved (except in the case of standard eigenproblems and shift transformation). The number of iterations required in this solve is accumulated into a counter whose value is returned by this function.

These counters are reset to zero at each successive call to EPSSolve().

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex7.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetConstCorrectionTol.html0000644000175000017500000000301112211062077025213 0ustar gladkgladk EPSJDGetConstCorrectionTol

EPSJDGetConstCorrectionTol

Returns a flag indicating if the dynamic stopping is being used for solving the correction equation. If the flag is false the KSP relative tolerance is set to 0.5**i, where i is the number of EPS iterations from the last converged value.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetConstCorrectionTol(EPS eps,PetscBool *constant)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

constant - boolean flag indicating if the dynamic stopping criterion is not being used.

See Also

EPSJDGetConstCorrectionTol()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSLanczosReorthogType.html0000644000175000017500000000244512211062077024537 0ustar gladkgladk EPSLanczosReorthogType

EPSLanczosReorthogType

determines the type of reorthogonalization used in the Lanczos method

Synopsis

typedef enum { EPS_LANCZOS_REORTHOG_LOCAL,
               EPS_LANCZOS_REORTHOG_FULL,
               EPS_LANCZOS_REORTHOG_SELECTIVE,
               EPS_LANCZOS_REORTHOG_PERIODIC,
               EPS_LANCZOS_REORTHOG_PARTIAL,
               EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType;

See Also

EPSLanczosSetReorthog(), EPSLanczosGetReorthog()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDGetBOrth.html0000644000175000017500000000265112211062077022445 0ustar gladkgladk EPSJDGetBOrth

EPSJDGetBOrth

Returns the orthogonalization used in the search subspace in case of generalized Hermitian problems.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDGetBOrth(EPS eps,EPSOrthType *borth)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

borth - the kind of orthogonalization

Notes

See EPSJDSetBOrth() for possible values of 'borth'.

See Also

EPSJDSetBOrth(), EPSOrthType

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSFEASTSetNumPoints.html0000644000175000017500000000302512211062077023740 0ustar gladkgladk EPSFEASTSetNumPoints

EPSFEASTSetNumPoints

Sets the number of contour integration points for the FEAST package.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSFEASTSetNumPoints(EPS eps,PetscInt npoints)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context
npoints - number of contour integration points

Options Database Key

-eps_feast_num_points - Sets the number of points

See Also

EPSFEASTGetNumPoints()

Location: src/eps/impls/external/feast/feast.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPRIMMESetBlockSize.html0000644000175000017500000000362012211062077024021 0ustar gladkgladk EPSPRIMMESetBlockSize

EPSPRIMMESetBlockSize

The maximum block size the code will try to use. The user should set this based on the architecture specifics of the target computer, as well as any a priori knowledge of multiplicities. The code does NOT require BlockSize > 1 to find multiple eigenvalues. For some methods, keeping BlockSize = 1 yields the best overall performance.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context
bs - block size

Options Database Key

-eps_primme_block_size - Sets the max allowed block size value

Notes

If the block size is not set, the value established by primme_initialize is used.

See Also

EPSPRIMMEGetBlockSize()

Location: src/eps/impls/external/primme/primme.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSReset.html0000644000175000017500000000222612211062077021631 0ustar gladkgladk EPSReset

EPSReset

Resets the EPS context to the setupcalled=0 state and removes any allocated objects.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSReset(EPS eps)
Collective on EPS

Input Parameter

eps - eigensolver context obtained from EPSCreate()

See Also

EPSDestroy()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSJDSetBlockSize.html0000644000175000017500000000311412211062077023323 0ustar gladkgladk EPSJDSetBlockSize

EPSJDSetBlockSize

Sets the number of vectors to be added to the searching space in every iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
blocksize - number of vectors added to the search space in every iteration

Options Database Key

-eps_jd_blocksize - number of vectors added to the searching space every iteration

See Also

EPSJDSetKrylovStart()

Location: src/eps/impls/davidson/jd/jd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetEigenvalue.html0000644000175000017500000000505012211062077023271 0ustar gladkgladk EPSGetEigenvalue

EPSGetEigenvalue

Gets the i-th eigenvalue as computed by EPSSolve().

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetEigenvalue(EPS eps,PetscInt i,PetscScalar *eigr,PetscScalar *eigi)
Not Collective

Input Parameters

eps - eigensolver context
i - index of the solution

Output Parameters

eigr - real part of eigenvalue
eigi - imaginary part of eigenvalue

Notes

If the eigenvalue is real, then eigi is set to zero. If PETSc is configured with complex scalars the eigenvalue is stored directly in eigr (eigi is set to zero).

The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs().

See Also

EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(),
EPSGetEigenpair()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetType.html0000644000175000017500000000431412211062077022144 0ustar gladkgladk EPSSetType

EPSSetType

Selects the particular solver to be used in the EPS object.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetType(EPS eps,EPSType type)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
type - a known method

Options Database Key

-eps_type <method> - Sets the method; use -help for a list of available methods

Notes

See "slepc/include/slepceps.h" for available methods. The default is EPSKRYLOVSCHUR.

Normally, it is best to use the EPSSetFromOptions() command and then set the EPS type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The EPSSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database.

See Also

STSetType(), EPSType

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetTolerances.html0000644000175000017500000000451212211062077023306 0ustar gladkgladk EPSGetTolerances

EPSGetTolerances

Gets the tolerance and maximum iteration count used by the EPS convergence tests.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetTolerances(EPS eps,PetscReal *tol,PetscInt *maxits)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameters

tol - the convergence tolerance
maxits - maximum number of iterations

Notes

The user can specify NULL for any parameter that is not needed.

See Also

EPSSetTolerances()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex19.c.html
src/eps/examples/tutorials/ex1f.F.html
src/eps/examples/tutorials/ex6f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetEigenvalueComparison.html0000644000175000017500000000724112211062077025344 0ustar gladkgladk EPSSetEigenvalueComparison

EPSSetEigenvalueComparison

Specifies the eigenvalue comparison function when EPSSetWhichEigenpairs() is set to EPS_WHICH_USER.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetEigenvalueComparison(EPS eps,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
func - a pointer to the comparison function
ctx - a context pointer (the last parameter to the comparison function)

Calling Sequence of func

  func(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

ar - real part of the 1st eigenvalue
ai - imaginary part of the 1st eigenvalue
br - real part of the 2nd eigenvalue
bi - imaginary part of the 2nd eigenvalue
res - result of comparison
ctx - optional context, as set by EPSSetEigenvalueComparison()

Note

The returning parameter 'res' can be

negative - if the 1st eigenvalue is preferred to the 2st one
zero - if both eigenvalues are equally preferred
positive - if the 2st eigenvalue is preferred to the 1st one

See Also

EPSSetWhichEigenpairs(), EPSSortEigenvalues(), EPSWhich

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCompareEigenvalues.html0000644000175000017500000000526212211062077024330 0ustar gladkgladk EPSCompareEigenvalues

EPSCompareEigenvalues

Compares two (possibly complex) eigenvalues according to a certain criterion.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCompareEigenvalues(EPS eps,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)
Not Collective

Input Parameters

eps - the eigensolver context
ar - real part of the 1st eigenvalue
ai - imaginary part of the 1st eigenvalue
br - real part of the 2nd eigenvalue
bi - imaginary part of the 2nd eigenvalue

Output Parameter

res - result of comparison

Notes

The returning parameter 'res' can be

negative - if the 1st eigenvalue is preferred to the 2st one
zero - if both eigenvalues are equally preferred
positive - if the 2st eigenvalue is preferred to the 1st one

The criterion of comparison is related to the 'which' parameter set with EPSSetWhichEigenpairs().

See Also

EPSSortEigenvalues(), EPSSetWhichEigenpairs()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetIterationNumber.html0000644000175000017500000000514212211062077024316 0ustar gladkgladk EPSGetIterationNumber

EPSGetIterationNumber

Gets the current iteration number. If the call to EPSSolve() is complete, then it returns the number of iterations carried out by the solution method.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetIterationNumber(EPS eps,PetscInt *its)
Not Collective

Input Parameter

eps - the eigensolver context

Output Parameter

its - number of iterations

Note

During the i-th iteration this call returns i-1. If EPSSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call EPSGetConvergedReason() to determine if the solver converged or failed and why.

See Also

EPSGetConvergedReason(), EPSSetTolerances()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex19.c.html
src/eps/examples/tutorials/ex1f.F.html
src/eps/examples/tutorials/ex6f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPRIMMEGetBlockSize.html0000644000175000017500000000236712211062077024014 0ustar gladkgladk EPSPRIMMEGetBlockSize

EPSPRIMMEGetBlockSize

Get the maximum block size the code will try to use.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context

Output Parameters

bs - returned block size

See Also

EPSPRIMMESetBlockSize()

Location: src/eps/impls/external/primme/primme.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetInitialSize.html0000644000175000017500000000444612211062077023670 0ustar gladkgladk EPSGDSetInitialSize

EPSGDSetInitialSize

Sets the initial size of the searching space.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
initialsize - number of vectors of the initial searching subspace

Options Database Key

-eps_gd_initial_size - number of vectors of the initial searching subspace

Notes

If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors.

See Also

EPSGDGetInitialSize(), EPSGDGetKrylovStart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDSetRestart.html0000644000175000017500000000376112211062077023067 0ustar gladkgladk EPSGDSetRestart

EPSGDSetRestart

Sets the number of vectors of the searching space after restarting and the number of vectors saved from the previous iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
minv - number of vectors of the searching subspace after restarting
plusk - number of vectors saved from the previous iteration

Options Database Keys

-eps_gd_minv - number of vectors of the searching subspace after restarting
-eps_gd_plusk - number of vectors saved from the previous iteration

See Also

EPSGDSetRestart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSBlzpackSetNSteps.html0000644000175000017500000000263412211062077023751 0ustar gladkgladk EPSBlzpackSetNSteps

EPSBlzpackSetNSteps

Sets the maximum number of steps per run for the BLZPACK package.

Synopsis

#include "slepceps.h" 
#include "slepcst.h" 
PetscErrorCode EPSBlzpackSetNSteps(EPS eps,PetscInt nsteps)
Collective on EPS

Input Parameters

eps - the eigenproblem solver context
nsteps - maximum number of steps

Options Database Key

-eps_blzpack_nsteps - Sets the maximum number of steps per run

Location: src/eps/impls/external/blzpack/blzpack.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSIsGeneralized.html0000644000175000017500000000240412211062077023272 0ustar gladkgladk EPSIsGeneralized

EPSIsGeneralized

Ask if the EPS object corresponds to a generalized eigenvalue problem.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSIsGeneralized(EPS eps,PetscBool* is)
Not collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

is - the answer

See Also

EPSIsHermitian(), EPSIsPositive()

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetErrorEstimateLeft.html0000644000175000017500000000345712211062077024616 0ustar gladkgladk EPSGetErrorEstimateLeft

EPSGetErrorEstimateLeft

Returns the left error estimate associated to the i-th computed eigenpair (only available in two-sided eigensolvers).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetErrorEstimateLeft(EPS eps,PetscInt i,PetscReal *errest)
Not Collective

Input Parameter

eps - eigensolver context
i - index of eigenpair

Output Parameter

errest - the left error estimate

Notes

This is the error estimate used internally by the eigensolver. The actual error bound can be computed with EPSComputeRelativeErrorLeft(). See also the users manual for details.

See Also

EPSComputeRelativeErrorLeft()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCreate.html0000644000175000017500000000513312211062077021752 0ustar gladkgladk EPSCreate

EPSCreate

Creates the default EPS context.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCreate(MPI_Comm comm,EPS *outeps)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

eps - location to put the EPS context

Note

The default EPS type is EPSKRYLOVSCHUR

See Also

EPSSetUp(), EPSSolve(), EPSDestroy(), EPS

Location: src/eps/interface/basic.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex1.c.html
src/eps/examples/tutorials/ex2.c.html
src/eps/examples/tutorials/ex3.c.html
src/eps/examples/tutorials/ex4.c.html
src/eps/examples/tutorials/ex5.c.html
src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex9.c.html
src/eps/examples/tutorials/ex11.c.html
src/eps/examples/tutorials/ex12.c.html
src/eps/examples/tutorials/ex13.c.html
src/eps/examples/tutorials/ex18.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSComputeResidualNorm.html0000644000175000017500000000412112211062077024504 0ustar gladkgladk EPSComputeResidualNorm

EPSComputeResidualNorm

Computes the norm of the residual vector associated with the i-th computed eigenpair.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSComputeResidualNorm(EPS eps,PetscInt i,PetscReal *norm)
Collective on EPS

Input Parameter

eps - the eigensolver context
i - the solution index

Output Parameter

norm - the residual norm, computed as ||Ax-kBx||_2 where k is the eigenvalue and x is the eigenvector. If k=0 then the residual norm is computed as ||Ax||_2.

Notes

The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs().

See Also

EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSPowerGetShiftType.html0000644000175000017500000000243012211062077024140 0ustar gladkgladk EPSPowerGetShiftType

EPSPowerGetShiftType

Gets the type of shifts used during the power iteration.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSPowerGetShiftType(EPS eps,EPSPowerShiftType *shift)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Input Parameter

shift - the type of shift

See Also

EPSPowerSetShiftType(), EPSPowerShiftType

Location: src/eps/impls/power/power.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSSetDeflationSpace.html0000644000175000017500000000504612211062077024107 0ustar gladkgladk EPSSetDeflationSpace

EPSSetDeflationSpace

Specify a basis of vectors that constitute the deflation space.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSSetDeflationSpace(EPS eps,PetscInt n,Vec *v)
Collective on EPS and Vec

Input Parameter

eps - the eigenproblem solver context
n - number of vectors
v - set of basis vectors of the deflation space

Notes

When a deflation space is given, the eigensolver seeks the eigensolution in the restriction of the problem to the orthogonal complement of this space. This can be used for instance in the case that an invariant subspace is known beforehand (such as the nullspace of the matrix).

Basis vectors set by a previous call to EPSSetDeflationSpace() are replaced.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

These vectors persist from one EPSSolve() call to the other, use EPSRemoveDeflationSpace() to eliminate them.

See Also

EPSRemoveDeflationSpace()

Location: src/eps/interface/setup.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex7.c.html
src/eps/examples/tutorials/ex11.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSAppendOptionsPrefix.html0000644000175000017500000000336412211062077024514 0ustar gladkgladk EPSAppendOptionsPrefix

EPSAppendOptionsPrefix

Appends to the prefix used for searching for all EPS options in the database.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSAppendOptionsPrefix(EPS eps,const char *prefix)
Logically Collective on EPS

Input Parameters

eps - the eigensolver context
prefix - the prefix string to prepend to all EPS option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

EPSSetOptionsPrefix(), EPSGetOptionsPrefix()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSType.html0000644000175000017500000000257112211062077021473 0ustar gladkgladk EPSType

EPSType

String with the name of a SLEPc eigensolver

Synopsis

typedef const char* EPSType;
#define EPSPOWER       "power"
#define EPSSUBSPACE    "subspace"
#define EPSARNOLDI     "arnoldi"
#define EPSLANCZOS     "lanczos"
#define EPSKRYLOVSCHUR "krylovschur"
#define EPSGD          "gd"
#define EPSJD          "jd"
#define EPSRQCG        "rqcg"
#define EPSCISS        "ciss"
#define EPSLAPACK      "lapack"
#define EPSARPACK      "arpack"
#define EPSBLZPACK     "blzpack"
#define EPSTRLAN       "trlan"
#define EPSBLOPEX      "blopex"
#define EPSPRIMME      "primme"
#define EPSFEAST       "feast"

See Also

EPSSetType(), EPS

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetOptionsPrefix.html0000644000175000017500000000272412211062077024023 0ustar gladkgladk EPSGetOptionsPrefix

EPSGetOptionsPrefix

Gets the prefix used for searching for all EPS options in the database.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetOptionsPrefix(EPS eps,const char *prefix[])
Not Collective

Input Parameters

eps - the eigensolver context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

EPSSetOptionsPrefix(), EPSAppendOptionsPrefix()

Location: src/eps/interface/opts.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSGetSizes.html0000644000175000017500000000357212211062077022773 0ustar gladkgladk EPSCISSGetSizes

EPSCISSGetSizes

Gets the values of various size parameters in the CISS solver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSGetSizes(EPS eps,PetscInt *ip,PetscInt *bs,PetscInt *ms,PetscInt *npart,PetscInt *bsmax,PetscBool *isreal)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

ip - number of integration points
bs - block size
ms - moment size
npart - number of partitions when splitting the communicator
bsmax - max block size
isreal - A and B are real

See Also

EPSCISSSetSizes()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSBalance.html0000644000175000017500000000175612211062077022103 0ustar gladkgladk EPSBalance

EPSBalance

The type of balancing used for non-Hermitian problems

Synopsis

typedef enum { EPS_BALANCE_NONE=1,
               EPS_BALANCE_ONESIDE,
               EPS_BALANCE_TWOSIDE,
               EPS_BALANCE_USER } EPSBalance;

See Also

EPSSetBalance()

Location: src/eps/../../include/slepceps.h
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSMonitorSet.html0000644000175000017500000001152512211062077022654 0ustar gladkgladk EPSMonitorSet

EPSMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSMonitorSet(EPS eps,PetscErrorCode (*monitor)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Logically Collective on EPS

Input Parameters

eps - eigensolver context obtained from EPSCreate()
monitor - pointer to function (if this is NULL, it turns off monitoring)
mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired)
monitordestroy - [optional] routine that frees monitor context (may be NULL)

Calling Sequence of monitor

    monitor (EPS eps, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx)

eps - eigensolver context obtained from EPSCreate()
its - iteration number
nconv - number of converged eigenpairs
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - relative error estimates for each eigenpair
nest - number of error estimates
mctx - optional monitoring context, as set by EPSMonitorSet()

Options Database Keys

-eps_monitor - print only the first error estimate
-eps_monitor_all - print error estimates at each iteration
-eps_monitor_conv - print the eigenvalue approximations only when convergence has been reached
-eps_monitor_lg - sets line graph monitor for the first unconverged approximate eigenvalue
-eps_monitor_lg_all - sets line graph monitor for all unconverged approximate eigenvalues
-eps_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to EPSMonitorSet(), but does not cancel those set via the options database.

Notes

Several different monitoring routines may be set by calling EPSMonitorSet() multiple times; all will be called in the order in which they were set.

See Also

EPSMonitorFirst(), EPSMonitorAll(), EPSMonitorCancel()

Location: src/eps/interface/monitor.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSKrylovSchurSetRestart.html0000644000175000017500000000340212211062077025060 0ustar gladkgladk EPSKrylovSchurSetRestart

EPSKrylovSchurSetRestart

Sets the restart parameter for the Krylov-Schur method, in particular the proportion of basis vectors that must be kept after restart.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSKrylovSchurSetRestart(EPS eps,PetscReal keep)
Logically Collective on EPS

Input Parameters

eps - the eigenproblem solver context
keep - the number of vectors to be kept at restart

Options Database Key

-eps_krylovschur_restart - Sets the restart parameter

Notes

Allowed values are in the range [0.1,0.9]. The default is 0.5.

See Also

EPSKrylovSchurGetRestart()

Location: src/eps/impls/krylov/krylovschur/krylovschur.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGetEigenvectorLeft.html0000644000175000017500000000534412211062077024300 0ustar gladkgladk EPSGetEigenvectorLeft

EPSGetEigenvectorLeft

Gets the i-th left eigenvector as computed by EPSSolve() (only available in two-sided eigensolvers).

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGetEigenvectorLeft(EPS eps,PetscInt i,Vec Wr,Vec Wi)
Logically Collective on EPS

Input Parameters

eps - eigensolver context
i - index of the solution

Output Parameters

Wr - real part of eigenvector
Wi - imaginary part of eigenvector

Notes

If the corresponding eigenvalue is real, then Wi is set to zero. If PETSc is configured with complex scalars the eigenvector is stored directly in Wr (Wi is set to zero).

The index i should be a value between 0 and nconv-1 (see EPSGetConverged()). Eigenpairs are indexed according to the ordering criterion established with EPSSetWhichEigenpairs().

See Also

EPSSolve(), EPSGetConverged(), EPSSetWhichEigenpairs(),
EPSGetEigenpair(), EPSGetEigenvector()

Location: src/eps/interface/solve.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex12.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSGDGetInitialSize.html0000644000175000017500000000375112211062077023652 0ustar gladkgladk EPSGDGetInitialSize

EPSGDGetInitialSize

Returns the initial size of the searching space.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameter

initialsize - number of vectors of the initial searching subspace

Notes

If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with EPSSetInitialSpace(), up to initialsize vectors will be used; and if the provided vectors are not enough, the solver completes the subspace with random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver gets the first vector provided by the user or, if not available, a random vector, and expands the Krylov basis up to initialsize vectors.

See Also

EPSGDSetInitialSize(), EPSGDGetKrylovStart()

Location: src/eps/impls/davidson/gd/gd.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/EPS/EPSCISSGetThreshold.html0000644000175000017500000000273212211062077023627 0ustar gladkgladk EPSCISSGetThreshold

EPSCISSGetThreshold

Gets the values of various threshold parameters in the CISS solver.

Synopsis

#include "slepceps.h" 
PetscErrorCode EPSCISSGetThreshold(EPS eps,PetscReal *delta,PetscReal *spur)
Not Collective

Input Parameter

eps - the eigenproblem solver context

Output Parameters

delta - threshold for numerical rank
spur - spurious threshold (to discard spurious eigenpairs)

See Also

EPSCISSSetThreshold()

Location: src/eps/impls/ciss/ciss.c
Index of all EPS routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/0000755000175000017500000000000012214143515017163 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNEvaluateDerivative.html0000644000175000017500000000271012211062077024066 0ustar gladkgladk FNEvaluateDerivative

FNEvaluateDerivative

Computes the value of the derivative f'(x) for a given x.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNEvaluateDerivative(FN fn,PetscScalar x,PetscScalar *y)
Logically Collective on FN

Input Parameters

fn - the math function context
x - the value where the derivative must be evaluated

Output Parameter

y - the result of f'(x)

See Also

FNEvaluateFunction()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNInitializePackage.html0000644000175000017500000000215212211062077023652 0ustar gladkgladk FNInitializePackage

FNInitializePackage

This function initializes everything in the FN package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to FNCreate() when using static libraries.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNInitializePackage(void)

See Also

SlepcInitialize()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNAppendOptionsPrefix.html0000644000175000017500000000316412211062077024242 0ustar gladkgladk FNAppendOptionsPrefix

FNAppendOptionsPrefix

Appends to the prefix used for searching for all FN options in the database.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNAppendOptionsPrefix(FN fn,const char *prefix)
Logically Collective on FN

Input Parameters

fn - the math function context
prefix - the prefix string to prepend to all FN option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

FNSetOptionsPrefix()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNGetType.html0000644000175000017500000000222212211062077021654 0ustar gladkgladk FNGetType

FNGetType

Gets the FN type name (as a string) from the FN context.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNGetType(FN fn,FNType *type)
Not Collective

Input Parameter

fn - the math function context

Output Parameter

name - name of the math function

See Also

FNSetType()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNRegister.html0000644000175000017500000000276012211062077022066 0ustar gladkgladk FNRegister

FNRegister

See Adds a mathematical function to the FN package.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNRegister(const char *name,PetscErrorCode (*function)(FN))
Not collective

Input Parameters

name - name of a new user-defined FN
function - routine to create context

Notes

FNRegister() may be called multiple times to add several user-defined inner products.

See Also

FNRegisterAll()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNType.html0000644000175000017500000000173512211062077021224 0ustar gladkgladk FNType

FNType

String with the name of the mathematical function.

Synopsis

typedef const char* FNType;
#define FNRATIONAL "rational"
#define FNEXP      "exp"
#define FNLOG      "log"
#define FNPHI      "phi"

See Also

FNSetType(), FN

Location: src/fn/../../include/slepcfn.h
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNSetOptionsPrefix.html0000644000175000017500000000315312211062077023564 0ustar gladkgladk FNSetOptionsPrefix

FNSetOptionsPrefix

Sets the prefix used for searching for all FN options in the database.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNSetOptionsPrefix(FN fn,const char *prefix)
Logically Collective on FN

Input Parameters

fn - the math function context
prefix - the prefix string to prepend to all FN option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

FNAppendOptionsPrefix()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNRegisterAll.html0000644000175000017500000000145312211062077022515 0ustar gladkgladk FNRegisterAll

FNRegisterAll

Registers all of the math functions in the FN package.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNRegisterAll(void)
Not Collective

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNDestroy.html0000644000175000017500000000233312211062077021727 0ustar gladkgladk FNDestroy

FNDestroy

Destroys FN context that was created with FNCreate().

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNDestroy(FN *fn)
Collective on FN

Input Parameter

fn - the math function context

See Also

FNCreate()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNGetParameters.html0000644000175000017500000000331512211062077023042 0ustar gladkgladk FNGetParameters

FNGetParameters

Returns the parameters that define the matematical function.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNGetParameters(FN fn,PetscInt *na,PetscScalar *alpha[],PetscInt *nb,PetscScalar *beta[])
Not Collective

Input Parameter

fn - the math function context

Output Parameters

na - number of parameters in the first group
alpha - first group of parameters (array of scalar values)
nb - number of parameters in the second group
beta - second group of parameters (array of scalar values)

See Also

FNSetParameters()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNFinalizePackage.html0000644000175000017500000000202412211062077023310 0ustar gladkgladk FNFinalizePackage

FNFinalizePackage

This function destroys everything in the Slepc interface to the FN package. It is called from SlepcFinalize().

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/index.html0000644000175000017500000000464712211062077021173 0ustar gladkgladk Mathematical Function - FN

Mathematical Function - FN

The FN package provides the functionality to represent a simple mathematical function such as an exponential, a polynomial or a rational function. This is used as a building block for defining the function associated to the nonlinear eigenproblem.

Beginner - Basic usage
FN FNDestroy FNType
FNCreate FNSetFromOptions FNView
Intermediate - Setting options for algorithms and data structures
FNEvaluateDerivative FNGetParameters FNSetParameters
FNEvaluateFunction FNGetType FNSetType
Advanced - Setting more advanced options and customization
FNAppendOptionsPrefix FNRegister FNSetOptionsPrefix
FNGetOptionsPrefix FNRegisterAll
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
FNFinalizePackage FNInitializePackage
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNSetFromOptions.html0000644000175000017500000000204412211062077023230 0ustar gladkgladk FNSetFromOptions

FNSetFromOptions

Sets FN options from the options database.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNSetFromOptions(FN fn)
Collective on FN

Input Parameters

fn - the math function context

Notes

To see all options, run your program with the -help option.

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNCreate.html0000644000175000017500000000246612211062077021510 0ustar gladkgladk FNCreate

FNCreate

Creates an FN context.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNCreate(MPI_Comm comm,FN *newfn)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

newfn - location to put the FN context

See Also

FNDestroy(), FN

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNView.html0000644000175000017500000000341012211062077021205 0ustar gladkgladk FNView

FNView

Prints the FN data structure.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNView(FN fn,PetscViewer viewer)
Collective on FN

Input Parameters

fn - the math function context
viewer - optional visualization context

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNEvaluateFunction.html0000644000175000017500000000270012211062077023550 0ustar gladkgladk FNEvaluateFunction

FNEvaluateFunction

Computes the value of the function f(x) for a given x.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNEvaluateFunction(FN fn,PetscScalar x,PetscScalar *y)
Logically Collective on FN

Input Parameters

fn - the math function context
x - the value where the function must be evaluated

Output Parameter

y - the result of f(x)

See Also

FNEvaluateDerivative()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FN.html0000644000175000017500000000146412211062077020361 0ustar gladkgladk FN

FN

Abstraction of a mathematical function.

Synopsis

typedef struct _p_FN* FN;

See Also

FNCreate()

Location: src/fn/../../include/slepcfn.h
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNGetOptionsPrefix.html0000644000175000017500000000266112211062077023553 0ustar gladkgladk FNGetOptionsPrefix

FNGetOptionsPrefix

Gets the prefix used for searching for all FN options in the database.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNGetOptionsPrefix(FN fn,const char *prefix[])
Not Collective

Input Parameters

fn - the math function context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

FNSetOptionsPrefix(), FNAppendOptionsPrefix()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNSetType.html0000644000175000017500000000310712211062077021673 0ustar gladkgladk FNSetType

FNSetType

Selects the type for the FN object.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNSetType(FN fn,FNType type)
Logically Collective on FN

Input Parameter

fn - the math function context
type - a known type

Notes

The default is FNRATIONAL, which includes polynomials as a particular case as well as simple functions such as f(x)=x and f(x)=constant.

See Also

FNGetType()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/FN/FNSetParameters.html0000644000175000017500000000464012211062077023060 0ustar gladkgladk FNSetParameters

FNSetParameters

Sets the parameters that define the matematical function.

Synopsis

#include "slepcfn.h" 
PetscErrorCode FNSetParameters(FN fn,PetscInt na,PetscScalar *alpha,PetscInt nb,PetscScalar *beta)
Logically Collective on FN

Input Parameters

fn - the math function context
na - number of parameters in the first group
alpha - first group of parameters (array of scalar values)
nb - number of parameters in the second group
beta - second group of parameters (array of scalar values)

Notes

In a rational function r(x) = p(x)/q(x), where p(x) and q(x) are polynomials, the parameters alpha and beta represent the coefficients of p(x) and q(x), respectively. Hence, p(x) is of degree na-1 and q(x) of degree nb-1. If nb is zero, then the function is assumed to be polynomial, r(x) = p(x).

In other functions the parameters have other meanings.

In polynomials, high order coefficients are stored in the first positions of the array, e.g. to represent x^2-3 use {1,0,-3}.

See Also

FNGetParameters()

Location: src/fn/fnbasic.c
Index of all FN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/0000755000175000017500000000000012214143515017206 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetMatMode.html0000644000175000017500000000236112211062077022333 0ustar gladkgladk STGetMatMode

STGetMatMode

Gets a flag that indicates how the matrix is being shifted in the shift-and-invert and Cayley spectral transformations.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetMatMode(ST st,STMatMode *mode)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

mode - the mode flag

See Also

STSetMatMode(), STMatMode

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STShellGetContext.html0000644000175000017500000000271612211062077023425 0ustar gladkgladk STShellGetContext

STShellGetContext

Returns the user-provided context associated with a shell ST

Synopsis

#include "slepcst.h" 
PetscErrorCode STShellGetContext(ST st,void **ctx)
Not Collective

Input Parameter

st - spectral transformation context

Output Parameter

ctx - the user provided context

Notes

This routine is intended for use within various shell routines

See Also

STShellSetContext()

Location: src/st/impls/shell/shell.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STApply.html0000644000175000017500000000273112211062077021433 0ustar gladkgladk STApply

STApply

Applies the spectral transformation operator to a vector, for instance (A - sB)^-1 B in the case of the shift-and-invert tranformation and generalized eigenproblem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STApply(ST st,Vec x,Vec y)
Collective on ST and Vec

Input Parameters

st - the spectral transformation context
x - input vector

Output Parameter

y - output vector

See Also

STApplyTranspose()

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetMatStructure.html0000644000175000017500000000304112211062077023443 0ustar gladkgladk STGetMatStructure

STGetMatStructure

Gets the internal MatStructure attribute to indicate which is the relation of the sparsity pattern of the two matrices A and B constituting the generalized eigenvalue problem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetMatStructure(ST st,MatStructure *str)
Not Collective

Input Parameters

st - the spectral transformation context

Output Parameters

str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN or SUBSET_NONZERO_PATTERN

Note

This function has no effect in the case of standard eigenproblems.

See Also

STSetMatStructure(), STSetOperators(), MatAXPY()

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STCheckNullSpace.html0000644000175000017500000000337312211062077023175 0ustar gladkgladk STCheckNullSpace

STCheckNullSpace

Given a set of vectors, this function tests each of them to be a nullspace vector of the coefficient matrix of the associated KSP object. All these nullspace vectors are passed to the KSP object.

Synopsis

#include "slepcst.h" 
PetscErrorCode STCheckNullSpace(ST st,PetscInt n,const Vec V[])
Collective on ST

Input Parameters

st - the spectral transformation context
n - number of vectors
V - vectors to be checked

Note

This function allows to handle singular pencils and to solve some problems in which the nullspace is important (see the users guide for details).

See Also

EPSSetDeflationSpace()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STPrecondSetMatForPC.html0000644000175000017500000000350012211062077023743 0ustar gladkgladk STPrecondSetMatForPC

STPrecondSetMatForPC

Sets the matrix that must be used to build the preconditioner.

Synopsis

#include "slepcst.h" 
PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat)
Logically Collective on ST and Mat

Input Parameter

st - the spectral transformation context
mat - the matrix that will be used in constructing the preconditioner

Notes

This matrix will be passed to the KSP object (via KSPSetOperators) as the matrix to be used when constructing the preconditioner. If no matrix is set or mat is set to NULL, A - sigma*B will be used to build the preconditioner, being sigma the value set by STSetShift().

See Also

STPrecondSetMatForPC(), STSetShift()

Location: src/st/impls/precond/precond.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STPrecondSetKSPHasMat.html0000644000175000017500000000337012211062077024070 0ustar gladkgladk STPrecondSetKSPHasMat

STPrecondSetKSPHasMat

Sets a flag indicating that during STSetUp the coefficient matrix of the KSP linear system (A) must be set to be the same matrix as the preconditioner (P).

Synopsis

#include "slepcst.h" 
PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat)
Collective on ST

Input Parameter

st - the spectral transformation context
setmat - the flag

Notes

In most cases, the preconditioner matrix is used only in the PC object, but in external solvers this matrix must be provided also as the A-matrix in the KSP object.

See Also

STPrecondGetKSPHasMat(), STSetShift()

Location: src/st/impls/precond/precond.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STReset.html0000644000175000017500000000205612211062077021430 0ustar gladkgladk STReset

STReset

Resets the ST context and removes any allocated objects.

Synopsis

#include "slepcst.h" 
PetscErrorCode STReset(ST st)
Collective on ST

Input Parameter

st - the spectral transformation context

See Also

STDestroy()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STMatSolveTranspose.html0000644000175000017500000000245012211062077023775 0ustar gladkgladk STMatSolveTranspose

STMatSolveTranspose

Solves T[k]' x = b, where T[k] is the k-th matrix of the spectral transformation, using a KSP object stored internally.

Synopsis

#include "slepcst.h" 
PetscErrorCode STMatSolveTranspose(ST st,PetscInt k,Vec b,Vec x)
Collective on ST

Input Parameters

st - the spectral transformation context
b - right hand side vector

Output Parameter

x - computed solution

See Also

STMatSolve()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetFromOptions.html0000644000175000017500000000214712211062077023302 0ustar gladkgladk STSetFromOptions

STSetFromOptions

Sets ST options from the options database. This routine must be called before STSetUp() if the user is to be allowed to set the type of transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetFromOptions(ST st)
Collective on ST

Input Parameter

st - the spectral transformation context

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetShift.html0000644000175000017500000000201612211062077022057 0ustar gladkgladk STGetShift

STGetShift

Gets the shift associated with the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetShift(ST st,PetscScalar* shift)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

shift - the value of the shift

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STApplyTranspose.html0000644000175000017500000000273412211062077023335 0ustar gladkgladk STApplyTranspose

STApplyTranspose

Applies the transpose of the operator to a vector, for instance B^T(A - sB)^-T in the case of the shift-and-invert tranformation and generalized eigenproblem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STApplyTranspose(ST st,Vec x,Vec y)
Collective on ST and Vec

Input Parameters

st - the spectral transformation context
x - input vector

Output Parameter

y - output vector

See Also

STApply()

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STCayleySetAntishift.html0000644000175000017500000000347712211062077024132 0ustar gladkgladk STCayleySetAntishift

STCayleySetAntishift

Sets the value of the anti-shift for the Cayley spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STCayleySetAntishift(ST st,PetscScalar nu)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
nu - the anti-shift

Options Database Key

-st_cayley_antishift - Sets the value of the anti-shift

Note

In the generalized Cayley transform, the operator can be expressed as OP = inv(A - sigma B)*(A + nu B). This function sets the value of nu. Use STSetShift() for setting sigma.

See Also

STSetShift(), STCayleyGetAntishift()

Location: src/st/impls/cayley/cayley.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetKSP.html0000644000175000017500000000232712211062077021444 0ustar gladkgladk STGetKSP

STGetKSP

Gets the KSP object associated with the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetKSP(ST st,KSP* ksp)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

ksp - the linear system context

Notes

On output, the value of ksp can be NULL if the combination of eigenproblem type and selected transformation does not require to solve a linear system of equations.

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetBilinearForm.html0000644000175000017500000000235512211062077023361 0ustar gladkgladk STGetBilinearForm

STGetBilinearForm

Returns the matrix used in the bilinear form with a generalized problem with semi-definite B.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetBilinearForm(ST st,Mat *B)
Not collective, though a parallel Mat may be returned

Input Parameters

st - the spectral transformation context

Output Parameter

B - output matrix

Notes

The output matrix B must be destroyed after use. It will be NULL in case of standard eigenproblems.

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STRegisterAll.html0000644000175000017500000000167712211062077022573 0ustar gladkgladk STRegisterAll

STRegisterAll

Registers all of the spectral transformations in the ST package.

Synopsis

#include "slepcst.h"   
PetscErrorCode STRegisterAll(void)
Not Collective

See Also

STRegister()

Location: src/st/interface/stregis.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetOperators.html0000644000175000017500000000360212211062077022776 0ustar gladkgladk STSetOperators

STSetOperators

Sets the matrices associated with the eigenvalue problem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetOperators(ST st,PetscInt n,Mat A[])
Collective on ST and Mat

Input Parameters

st - the spectral transformation context
n - number of matrices in array A
A - the array of matrices associated with the eigensystem

Notes

It must be called before STSetUp(). If it is called again after STSetUp() then the ST object is reset.

See Also

STGetOperators(), STGetNumMatrices(), STSetUp(), STReset()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STType.html0000644000175000017500000000204512211062077021265 0ustar gladkgladk STType

STType

String with the name of a SLEPc spectral transformation

Synopsis

typedef const char* STType;
#define STSHELL     "shell"
#define STSHIFT     "shift"
#define STSINVERT   "sinvert"
#define STCAYLEY    "cayley"
#define STFOLD      "fold"
#define STPRECOND   "precond"

See Also

STSetType(), ST

Location: src/st/../../include/slepcst.h
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSHELL.html0000644000175000017500000000345712211062077021223 0ustar gladkgladk STSHELL

STSHELL

Creates a new spectral transformation class. This is intended to provide a simple class to use with EPS. You should not use this if you plan to make a complete class.

Usage

            PetscErrorCode (*apply)(void*,Vec,Vec);
            PetscErrorCode (*applytrans)(void*,Vec,Vec);
            PetscErrorCode (*backtr)(void*,PetscScalar*,PetscScalar*);
            STCreate(comm,&st);
            STSetType(st,STSHELL);
            STShellSetApply(st,apply);
            STShellSetApplyTranspose(st,applytrans);
            STShellSetBackTransform(st,backtr);    (optional)

Location: src/st/impls/shell/shell.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetOperators.html0000644000175000017500000000331512211062077022763 0ustar gladkgladk STGetOperators

STGetOperators

Gets the matrices associated with the original eigensystem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetOperators(ST st,PetscInt k,Mat *A)
Not collective, though parallel Mats are returned if the ST is parallel

Input Parameter

st - the spectral transformation context
k - the index of the requested matrix (starting in 0)

Output Parameters

A - the requested matrix

See Also

STSetOperators(), STGetNumMatrices()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetDefaultShift.html0000644000175000017500000000237212211062077023405 0ustar gladkgladk STSetDefaultShift

STSetDefaultShift

Sets the value of the shift that should be employed if the user did not specify one.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetDefaultShift(ST st,PetscScalar defaultshift)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
defaultshift - the default value of the shift

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetMatMode.html0000644000175000017500000000565212211062077022355 0ustar gladkgladk STSetMatMode

STSetMatMode

Sets a flag to indicate how the matrix is being shifted in the shift-and-invert and Cayley spectral transformations.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetMatMode(ST st,STMatMode mode)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
mode - the mode flag, one of ST_MATMODE_COPY, ST_MATMODE_INPLACE or ST_MATMODE_SHELL

Options Database Key

-st_matmode <mode> - Indicates the mode flag, where <mode> is one of 'copy', 'inplace' or 'shell' (see explanation below).

Notes

By default (ST_MATMODE_COPY), a copy of matrix A is made and then this copy is shifted explicitly, e.g. A <- (A - s B).

With ST_MATMODE_INPLACE, the original matrix A is shifted at STSetUp() and unshifted at the end of the computations. With respect to the previous one, this mode avoids a copy of matrix A. However, a backdraw is that the recovered matrix might be slightly different from the original one (due to roundoff).

With ST_MATMODE_SHELL, the solver works with an implicit shell matrix that represents the shifted matrix. This mode is the most efficient in creating the shifted matrix but it places serious limitations to the linear solves performed in each iteration of the eigensolver (typically, only interative solvers with Jacobi preconditioning can be used).

In the case of generalized problems, in the two first modes the matrix A - s B has to be computed explicitly. The efficiency of this computation can be controlled with STSetMatStructure().

See Also

STSetOperators(), STSetMatStructure(), STGetMatMode(), STMatMode

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STFinalizePackage.html0000644000175000017500000000204612211062077023362 0ustar gladkgladk STFinalizePackage

STFinalizePackage

This function destroys everything in the Slepc interface to the ST package. It is called from SlepcFinalize().

Synopsis

#include "slepcst.h" 
PetscErrorCode STFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STAppendOptionsPrefix.html0000644000175000017500000000335112211062077024306 0ustar gladkgladk STAppendOptionsPrefix

STAppendOptionsPrefix

Appends to the prefix used for searching for all ST options in the database.

Synopsis

#include "slepcst.h" 
PetscErrorCode STAppendOptionsPrefix(ST st,const char *prefix)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
prefix - the prefix string to prepend to all ST option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

STSetOptionsPrefix(), STGetOptionsPrefix()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STCreate.html0000644000175000017500000000237512211062077021555 0ustar gladkgladk STCreate

STCreate

Creates a spectral transformation context.

Synopsis

#include "slepcst.h" 
PetscErrorCode STCreate(MPI_Comm comm,ST *newst)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

st - location to put the spectral transformation context

See Also

STSetUp(), STApply(), STDestroy(), ST

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetUp.html0000644000175000017500000000216612211062077021410 0ustar gladkgladk STSetUp

STSetUp

Prepares for the use of a spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetUp(ST st)
Collective on ST

Input Parameter

st - the spectral transformation context

See Also

STCreate(), STApply(), STDestroy()

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STShellSetApply.html0000644000175000017500000000432712211062077023102 0ustar gladkgladk STShellSetApply

STShellSetApply

Sets routine to use as the application of the operator to a vector in the user-defined spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec))
Logically Collective on ST

Input Parameters

st - the spectral transformation context
apply - the application-provided transformation routine

Calling sequence of apply

   PetscErrorCode apply (ST st,Vec xin,Vec xout)

st - the spectral transformation context
xin - input vector
xout - output vector

See Also

STShellSetBackTransform(), STShellSetApplyTranspose()

Location: src/st/impls/shell/shell.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STPrecondGetKSPHasMat.html0000644000175000017500000000252312211062077024053 0ustar gladkgladk STPrecondGetKSPHasMat

STPrecondGetKSPHasMat

Returns the flag indicating if the coefficient matrix of the KSP linear system (A) is set to be the same matrix as the preconditioner (P).

Synopsis

#include "slepcst.h" 
PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

setmat - the flag

See Also

STPrecondSetKSPHasMat(), STSetShift()

Location: src/st/impls/precond/precond.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STShellSetApplyTranspose.html0000644000175000017500000000414112211062077024773 0ustar gladkgladk STShellSetApplyTranspose

STShellSetApplyTranspose

Sets routine to use as the application of the transposed operator to a vector in the user-defined spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec))
Logically Collective on ST

Input Parameters

st - the spectral transformation context
applytrans - the application-provided transformation routine

Calling sequence of apply

   PetscErrorCode applytrans (ST st,Vec xin,Vec xout)

st - the spectral transformation context
xin - input vector
xout - output vector

See Also

STShellSetApply(), STShellSetBackTransform()

Location: src/st/impls/shell/shell.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetType.html0000644000175000017500000000227312211062077021730 0ustar gladkgladk STGetType

STGetType

Gets the ST type name (as a string) from the ST context.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetType(ST st,STType *type)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

name - name of the spectral transformation

See Also

STSetType()

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetBalanceMatrix.html0000644000175000017500000000344412211062077023536 0ustar gladkgladk STSetBalanceMatrix

STSetBalanceMatrix

Sets the diagonal matrix to be used for balancing.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetBalanceMatrix(ST st,Vec D)
Collective on ST and Vec

Input Parameters

st - the spectral transformation context
D - the diagonal matrix (represented as a vector)

Notes

If this matrix is set, STApply will effectively apply D*OP*D^{-1}.

Balancing is usually set via EPSSetBalance, but the advanced user may use this function to bypass the usual balancing methods.

See Also

EPSSetBalance(), STApply(), STGetBalanceMatrix()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STPostSolve.html0000644000175000017500000000220712211062077022302 0ustar gladkgladk STPostSolve

STPostSolve

Optional post-solve phase, intended for any actions that must be performed on the ST object after the eigensolver has finished.

Synopsis

#include "slepcst.h" 
PetscErrorCode STPostSolve(ST st)
Collective on ST

Input Parameters

st - the spectral transformation context

See Also

EPSSolve()

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STInitializePackage.html0000644000175000017500000000217412211062077023724 0ustar gladkgladk STInitializePackage

STInitializePackage

This function initializes everything in the ST package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to STCreate() when using static libraries.

Synopsis

#include "slepcst.h" 
PetscErrorCode STInitializePackage(void)

See Also

SlepcInitialize()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/index.html0000644000175000017500000001440712211062077021211 0ustar gladkgladk Spectral Transformation - ST

Spectral Transformation - ST: Examples

The Spectral Transformation (ST) class encapsulates the functionality required for acceleration techniques based on the transformation of the spectrum. As explained in the SLEPc Users Manual, the eigensolvers implemented in EPS work by applying an operator to a set of vectors and this operator can adopt different forms. The ST object handles all the different possibilities in a uniform way, so that the solver can proceed without knowing which transformation has been selected.

The type of spectral transformation can be specified at run time (e.g., -st_type sinvert) as well as several parameters such as the value of the shift (e.g., -st_shift 1.5).

ST objects are always related to EPS objects. Users should not create a standalone ST object. ST options can also be set directly in application codes by first extracting the ST context from the EPS context via EPSGetST() and then directly calling the ST routines (e.g., STSetType() / STSetShift()).

Beginner - Basic usage
ST STGetShift STType
STCreate STSetFromOptions STView
STDestroy STSetShift
Intermediate - Setting options for algorithms and data structures
STCayleyGetAntishift STGetOperationCounters STSetMatMode
STCayleySetAntishift STGetOperators STSetOperators
STGetKSP STGetType STSetType
STGetMatMode STMatMode
STGetNumMatrices STResetOperationCounters
Advanced - Setting more advanced options and customization
STAppendOptionsPrefix STRegister STSetOptionsPrefix
STComputeExplicitOperator STRegisterAll STSetUp
STGetMatStructure STReset STShellGetContext
STGetOptionsPrefix STSHELL STShellSetContext
STPrecondGetMatForPC STSetKSP
STPrecondSetMatForPC STSetMatStructure
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
STApply STInitializePackage STPrecondSetKSPHasMat
STApplyTranspose STMatMult STSetBalanceMatrix
STBackTransform STMatMultTranspose STSetDefaultShift
STCheckNullSpace STMatSolve STShellSetApply
STFinalizePackage STMatSolveTranspose STShellSetApplyTranspose
STGetBalanceMatrix STPostSolve STShellSetBackTransform
STGetBilinearForm STPrecondGetKSPHasMat
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetOptionsPrefix.html0000644000175000017500000000334012211062077023630 0ustar gladkgladk STSetOptionsPrefix

STSetOptionsPrefix

Sets the prefix used for searching for all ST options in the database.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetOptionsPrefix(ST st,const char *prefix)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
prefix - the prefix string to prepend to all ST option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

STAppendOptionsPrefix(), STGetOptionsPrefix()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/ST.html0000644000175000017500000000210112211062077020414 0ustar gladkgladk ST

ST

Abstract SLEPc object that manages spectral transformations. This object is accessed only in advanced applications.

Synopsis

typedef struct _p_ST* ST;

See Also

STCreate(), EPS

Location: src/st/../../include/slepcst.h
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetBalanceMatrix.html0000644000175000017500000000260312211062077023516 0ustar gladkgladk STGetBalanceMatrix

STGetBalanceMatrix

Gets the balance matrix used by the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetBalanceMatrix(ST st,Vec *D)
Not collective, but vector is shared by all processors that share the ST

Input Parameter

st - the spectral transformation context

Output Parameter

D - the diagonal matrix (represented as a vector)

Note

If the matrix was not set, a null pointer will be returned.

See Also

STSetBalanceMatrix()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STDestroy.html0000644000175000017500000000222012211062077021770 0ustar gladkgladk STDestroy

STDestroy

Destroys ST context that was created with STCreate().

Synopsis

#include "slepcst.h" 
PetscErrorCode STDestroy(ST *st)
Collective on ST

Input Parameter

st - the spectral transformation context

See Also

STCreate(), STSetUp()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STComputeExplicitOperator.html0000644000175000017500000000315712211062077025203 0ustar gladkgladk STComputeExplicitOperator

STComputeExplicitOperator

Computes the explicit operator associated to the eigenvalue problem with the specified spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STComputeExplicitOperator(ST st,Mat *mat)
Collective on ST

Input Parameter

st - the spectral transform context

Output Parameter

mat - the explicit operator

Notes

This routine builds a matrix containing the explicit operator. For example, in generalized problems with shift-and-invert spectral transformation the result would be matrix (A - s B)^-1 B.

This computation is done by applying the operator to columns of the identity matrix. This is analogous to MatComputeExplicitOperator().

See Also

STApply()

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetType.html0000644000175000017500000000414412211062077021743 0ustar gladkgladk STSetType

STSetType

Builds ST for a particular spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetType(ST st,STType type)
Logically Collective on ST

Input Parameter

st - the spectral transformation context.
type - a known type

Options Database Key

-st_type <type> - Sets ST type

Use -help for a list of available transformations

Notes

See "slepc/include/slepcst.h" for available transformations

Normally, it is best to use the EPSSetFromOptions() command and then set the ST type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the many different transformations.

See Also

EPSSetType()

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex13.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STMatMultTranspose.html0000644000175000017500000000305612211062077023631 0ustar gladkgladk STMatMultTranspose

STMatMultTranspose

Computes the matrix-vector product y = T[k]' x, where T[k] is the k-th matrix of the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STMatMultTranspose(ST st,PetscInt k,Vec x,Vec y)
Collective on ST

Input Parameters

st - the spectral transformation context
k - index of matrix to use
x - the vector to be multiplied

Output Parameter

y - the result

See Also

STMatMult()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetMatStructure.html0000644000175000017500000000422312211062077023462 0ustar gladkgladk STSetMatStructure

STSetMatStructure

Sets an internal MatStructure attribute to indicate which is the relation of the sparsity pattern of the two matrices A and B constituting the generalized eigenvalue problem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetMatStructure(ST st,MatStructure str)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
str - either SAME_NONZERO_PATTERN, DIFFERENT_NONZERO_PATTERN or SUBSET_NONZERO_PATTERN

Options Database Key

-st_matstructure <str> - Indicates the structure flag, where <str> is one of 'same' (A and B have the same nonzero pattern), 'different' (A and B have different nonzero pattern) or 'subset' (B's nonzero pattern is a subset of A's).

Notes

By default, the sparsity patterns are assumed to be different. If the patterns are equal or a subset then it is recommended to set this attribute for efficiency reasons (in particular, for internal MatAXPY() operations).

This function has no effect in the case of standard eigenproblems.

See Also

STSetOperators(), MatAXPY()

Location: src/st/interface/stset.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STView.html0000644000175000017500000000411412211062077021255 0ustar gladkgladk STView

STView

Prints the ST data structure.

Synopsis

#include "slepcst.h" 
PetscErrorCode STView(ST st,PetscViewer viewer)
Collective on ST

Input Parameters

st - the ST context
viewer - optional visualization context

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization contexts with PetscViewerASCIIOpen() (output to a specified file).

See Also

EPSView(), PetscViewerASCIIOpen()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetNumMatrices.html0000644000175000017500000000237612211062077023242 0ustar gladkgladk STGetNumMatrices

STGetNumMatrices

Returns the number of matrices stored in the ST.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetNumMatrices(ST st,PetscInt *n)
Not collective

Input Parameter

st - the spectral transformation context

Output Parameters

n - the number of matrices passed in STSetOperators()

See Also

STSetOperators()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STResetOperationCounters.html0000644000175000017500000000235712211062077025040 0ustar gladkgladk STResetOperationCounters

STResetOperationCounters

Resets the counters for operator applications, inner product operations and total number of linear iterations used by the ST object.

Synopsis

#include "slepcst.h" 
PetscErrorCode STResetOperationCounters(ST st)
Logically Collective on ST

Input Parameter

st - the spectral transformation context

See Also

STGetOperationCounters()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STBackTransform.html0000644000175000017500000000217612211062077023105 0ustar gladkgladk STBackTransform

STBackTransform

Back-transformation phase, intended for spectral transformations which require to transform the computed eigenvalues back to the original eigenvalue problem.

Synopsis

#include "slepcst.h" 
PetscErrorCode STBackTransform(ST st,PetscInt n,PetscScalar* eigr,PetscScalar* eigi)
Not Collective

Input Parameters

st - the spectral transformation context eigr - real part of a computed eigenvalue eigi - imaginary part of a computed eigenvalue

Location: src/st/interface/stsolve.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetKSP.html0000644000175000017500000000223412211062077021455 0ustar gladkgladk STSetKSP

STSetKSP

Sets the KSP object associated with the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetKSP(ST st,KSP ksp)
Collective on ST

Input Parameters

st - the spectral transformation context
ksp - the linear system context

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STShellSetContext.html0000644000175000017500000000314512211062077023436 0ustar gladkgladk STShellSetContext

STShellSetContext

Sets the context for a shell ST

Synopsis

#include "slepcst.h" 
PetscErrorCode STShellSetContext(ST st,void *ctx)
Logically Collective on ST

Input Parameters

st - the shell ST
ctx - the context

Fortran Notes: The context can only be an integer or a PetscObject; unfortunately it cannot be a Fortran array or derived type.

See Also

STShellGetContext()

Location: src/st/impls/shell/shell.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STCayleyGetAntishift.html0000644000175000017500000000241412211062077024104 0ustar gladkgladk STCayleyGetAntishift

STCayleyGetAntishift

Gets the value of the anti-shift used in the Cayley spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STCayleyGetAntishift(ST st,PetscScalar *nu)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

nu - the anti-shift

See Also

STGetShift(), STCayleySetAntishift()

Location: src/st/impls/cayley/cayley.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STMatMult.html0000644000175000017500000000304412211062077021727 0ustar gladkgladk STMatMult

STMatMult

Computes the matrix-vector product y = T[k] x, where T[k] is the k-th matrix of the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STMatMult(ST st,PetscInt k,Vec x,Vec y)
Collective on ST

Input Parameters

st - the spectral transformation context
k - index of matrix to use
x - the vector to be multiplied

Output Parameter

y - the result

See Also

STMatMultTranspose()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STMatSolve.html0000644000175000017500000000306712211062077022103 0ustar gladkgladk STMatSolve

STMatSolve

Solves T[k] x = b, where T[k] is the k-th matrix of the spectral transformation, using a KSP object stored internally.

Synopsis

#include "slepcst.h" 
PetscErrorCode STMatSolve(ST st,PetscInt k,Vec b,Vec x)
Collective on ST

Input Parameters

st - the spectral transformation context
k - index of matrix to use
b - right hand side vector

Output Parameter

x - computed solution

See Also

STMatSolveTranspose()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STRegister.html0000644000175000017500000000354112211062077022132 0ustar gladkgladk STRegister

STRegister

Adds a method to the spectral transformation package.

Synopsis

#include "slepcst.h" 
PetscErrorCode STRegister(const char *name,PetscErrorCode (*function)(ST))
Not collective

Input Parameters

name - name of a new user-defined transformation
function - routine to create method context

Notes

STRegister() may be called multiple times to add several user-defined spectral transformations.

Sample usage

   STRegister("my_solver",MySolverCreate);

Then, your solver can be chosen with the procedural interface via

    STSetType(st,"my_solver")
or at runtime via the option
    -st_type my_solver

See Also

STRegisterAll()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetOptionsPrefix.html0000644000175000017500000000271612211062077023622 0ustar gladkgladk STGetOptionsPrefix

STGetOptionsPrefix

Gets the prefix used for searching for all ST options in the database.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetOptionsPrefix(ST st,const char *prefix[])
Not Collective

Input Parameters

st - the spectral transformation context

Output Parameters

prefix - pointer to the prefix string used, is returned

Notes: On the Fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

STSetOptionsPrefix(), STAppendOptionsPrefix()

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STPrecondGetMatForPC.html0000644000175000017500000000300412211062077023726 0ustar gladkgladk STPrecondGetMatForPC

STPrecondGetMatForPC

Returns the matrix previously set by STPrecondSetMatForPC().

Synopsis

#include "slepcst.h" 
PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat)
Not Collective, but the Mat is shared by all processors that share the ST

Input Parameter

st - the spectral transformation context

Output Parameter

mat - the matrix that will be used in constructing the preconditioner or NULL if no matrix was set by STPrecondSetMatForPC().

See Also

STPrecondSetMatForPC()

Location: src/st/impls/precond/precond.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STShellSetBackTransform.html0000644000175000017500000000454012211062077024546 0ustar gladkgladk STShellSetBackTransform

STShellSetBackTransform

Sets the routine to be called after the eigensolution process has finished in order to transform back the computed eigenvalues.

Synopsis

#include "slepcst.h" 
PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*))
Logically Collective on ST

Input Parameters

st - the spectral transformation context
backtr - the application-provided backtransform routine

Calling sequence of backtr

   PetscErrorCode backtr(ST st,PetscScalar *eigr,PetscScalar *eigi)

st - the spectral transformation context
eigr - pointer ot the real part of the eigenvalue to transform back
eigi - pointer ot the imaginary part

See Also

STShellSetApply(), STShellSetApplyTranspose()

Location: src/st/impls/shell/shell.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/st/examples/tutorials/ex10.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STSetShift.html0000644000175000017500000000253712211062077022103 0ustar gladkgladk STSetShift

STSetShift

Sets the shift associated with the spectral transformation.

Synopsis

#include "slepcst.h" 
PetscErrorCode STSetShift(ST st,PetscScalar shift)
Logically Collective on ST

Input Parameters

st - the spectral transformation context
shift - the value of the shift

Note

In some spectral transformations, changing the shift may have associated a lot of work, for example recomputing a factorization.

Location: src/st/interface/stfunc.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STMatMode.html0000644000175000017500000000204012211062077021665 0ustar gladkgladk STMatMode

STMatMode

Determines how to handle the coefficient matrix associated to the spectral transformation

Synopsis

typedef enum { ST_MATMODE_COPY,
               ST_MATMODE_INPLACE,
               ST_MATMODE_SHELL } STMatMode;

See Also

STSetMatMode(), STGetMatMode()

Location: src/st/../../include/slepcst.h
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/ST/STGetOperationCounters.html0000644000175000017500000000320512211062077024466 0ustar gladkgladk STGetOperationCounters

STGetOperationCounters

Gets the total number of operator applications and linear solver iterations used by the ST object.

Synopsis

#include "slepcst.h" 
PetscErrorCode STGetOperationCounters(ST st,PetscInt* ops,PetscInt* lits)
Not Collective

Input Parameter

st - the spectral transformation context

Output Parameter

ops - number of operator applications
lits - number of linear solver iterations

Notes

Any output parameter may be NULL on input if not needed.

See Also

STResetOperationCounters()

Location: src/st/interface/stsles.c
Index of all ST routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/0000755000175000017500000000000012214143515017305 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPComputeResidualNorm.html0000644000175000017500000000415112211062077024503 0ustar gladkgladk QEPComputeResidualNorm

QEPComputeResidualNorm

Computes the norm of the residual vector associated with the i-th computed eigenpair.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPComputeResidualNorm(QEP qep,PetscInt i,PetscReal *norm)
Collective on QEP

Input Parameter

qep - the quadratic eigensolver context
i - the solution index

Output Parameter

norm - the residual norm, computed as ||(l^2*M+l*C+K)x||_2 where l is the eigenvalue and x is the eigenvector. If l=0 then the residual norm is computed as ||Kx||_2.

Notes

The index i should be a value between 0 and nconv-1 (see QEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with QEPSetWhichEigenpairs().

See Also

QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetProblemType.html0000644000175000017500000000246512211062077023452 0ustar gladkgladk QEPGetProblemType

QEPGetProblemType

Gets the problem type from the QEP object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetProblemType(QEP qep,QEPProblemType *type)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameter

type - name of QEP problem type

See Also

QEPSetProblemType(), QEPProblemType

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPLinearSetEPS.html0000644000175000017500000000257512211062077023010 0ustar gladkgladk QEPLinearSetEPS

QEPLinearSetEPS

Associate an eigensolver object (EPS) to the quadratic eigenvalue solver.

Synopsis

#include "slepcqep.h" 
#include "slepceps.h" 
PetscErrorCode QEPLinearSetEPS(QEP qep,EPS eps)
Collective on QEP

Input Parameters

qep - quadratic eigenvalue solver
eps - the eigensolver object

See Also

QEPLinearGetEPS()

Location: src/qep/impls/linear/linear.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetST.html0000644000175000017500000000234712211062077021535 0ustar gladkgladk QEPGetST

QEPGetST

Obtain the spectral transformation (ST) object associated to the eigensolver object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetST(QEP qep,ST *st)
Not Collective

Input Parameters

qep - eigensolver context obtained from QEPCreate()

Output Parameter

st - spectral transformation context

See Also

QEPSetST()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetTrackAll.html0000644000175000017500000000340712211062077022716 0ustar gladkgladk QEPSetTrackAll

QEPSetTrackAll

Specifies if the solver must compute the residual of all approximate eigenpairs or not.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetTrackAll(QEP qep,PetscBool trackall)
Logically Collective on QEP

Input Parameters

qep - the eigensolver context
trackall - whether compute all residuals or not

Notes

If the user sets trackall=PETSC_TRUE then the solver explicitly computes the residual for each eigenpair approximation. Computing the residual is usually an expensive operation and solvers commonly compute the associated residual to the first unconverged eigenpair. The options '-qep_monitor_all' and '-qep_monitor_lg_all' automatically activate this option.

See Also

QEPGetTrackAll()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetTarget.html0000644000175000017500000000317212211062077022446 0ustar gladkgladk QEPSetTarget

QEPSetTarget

Sets the value of the target.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetTarget(QEP qep,PetscScalar target)
Logically Collective on QEP

Input Parameters

qep - eigensolver context
target - the value of the target

Notes

The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with QEPSetWhichEigenpairs().

See Also

QEPGetTarget(), QEPSetWhichEigenpairs()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPRegister.html0000644000175000017500000000356112211062077022332 0ustar gladkgladk QEPRegister

QEPRegister

Adds a method to the quadratic eigenproblem solver package.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPRegister(const char *name,PetscErrorCode (*function)(QEP))
Not Collective

Input Parameters

name - name of a new user-defined solver
function - routine to create the solver context

Notes

QEPRegister() may be called multiple times to add several user-defined solvers.

Sample usage

   QEPRegister("my_solver",MySolverCreate);

Then, your solver can be chosen with the procedural interface via

    QEPSetType(qep,"my_solver")
or at runtime via the option
    -qep_type my_solver

See Also

QEPRegisterAll()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPType.html0000644000175000017500000000174012211062077021464 0ustar gladkgladk QEPType

QEPType

String with the name of a quadratic eigensolver

Synopsis

typedef const char* QEPType;
#define QEPLINEAR    "linear"
#define QEPQARNOLDI  "qarnoldi"
#define QEPQLANCZOS  "qlanczos"

See Also

QEPSetType(), QEP

Location: src/qep/../../include/slepcqep.h
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPReset.html0000644000175000017500000000223412211062077021624 0ustar gladkgladk QEPReset

QEPReset

Resets the QEP context to the setupcalled=0 state and removes any allocated objects.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPReset(QEP qep)
Collective on QEP

Input Parameter

qep - eigensolver context obtained from QEPCreate()

See Also

QEPDestroy()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetWhichEigenpairs.html0000644000175000017500000000277712211062077024267 0ustar gladkgladk QEPGetWhichEigenpairs

QEPGetWhichEigenpairs

Returns which portion of the spectrum is to be sought.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetWhichEigenpairs(QEP qep,QEPWhich *which)
Not Collective

Input Parameter

qep - eigensolver context obtained from QEPCreate()

Output Parameter

which - the portion of the spectrum to be sought

Notes

See QEPSetWhichEigenpairs() for possible values of 'which'.

See Also

QEPSetWhichEigenpairs(), QEPWhich

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetConvergenceTest.html0000644000175000017500000000571312211062077024321 0ustar gladkgladk QEPSetConvergenceTest

QEPSetConvergenceTest

Sets a function to compute the error estimate used in the convergence test.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetConvergenceTest(QEP qep,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)
Logically Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()
func - a pointer to the convergence test function
ctx - a context pointer (the last parameter to the convergence test function)

Calling Sequence of func

  func(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal* errest,void *ctx)

qep - eigensolver context obtained from QEPCreate()
eigr - real part of the eigenvalue
eigi - imaginary part of the eigenvalue
res - residual norm associated to the eigenpair
errest - (output) computed error estimate
ctx - optional context, as set by QEPSetConvergenceTest()

Note

If the error estimate returned by the convergence test function is less than the tolerance, then the eigenvalue is accepted as converged.

See Also

QEPSetTolerances()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetType.html0000644000175000017500000000311012211062077022115 0ustar gladkgladk QEPGetType

QEPGetType

Gets the QEP type as a string from the QEP object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetType(QEP qep,QEPType *type)
Not Collective

Input Parameter

qep - the eigensolver context

Output Parameter

name - name of QEP method

See Also

QEPSetType()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPMonitorFirst.html0000644000175000017500000000445512211062077023210 0ustar gladkgladk QEPMonitorFirst

QEPMonitorFirst

Print the first unconverged approximate value and error estimate at each iteration of the quadratic eigensolver.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
Collective on QEP

Input Parameters

qep - quadratic eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

QEPMonitorSet(), QEPMonitorAll(), QEPMonitorConverged()

Location: src/qep/interface/qepmon.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPLinearGetEPS.html0000644000175000017500000000235512211062077022770 0ustar gladkgladk QEPLinearGetEPS

QEPLinearGetEPS

Retrieve the eigensolver object (EPS) associated to the quadratic eigenvalue solver.

Synopsis

#include "slepcqep.h" 
#include "slepceps.h" 
PetscErrorCode QEPLinearGetEPS(QEP qep,EPS *eps)
Not Collective

Input Parameter

qep - quadratic eigenvalue solver

Output Parameter

eps - the eigensolver object

See Also

QEPLinearSetEPS()

Location: src/qep/impls/linear/linear.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetInitialSpaceLeft.html0000644000175000017500000000432212211062077024376 0ustar gladkgladk QEPSetInitialSpaceLeft

QEPSetInitialSpaceLeft

Specify a basis of vectors that constitute the initial left space, that is, the subspace from which the solver starts to iterate for building the left subspace (in methods that work with two subspaces).

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetInitialSpaceLeft(QEP qep,PetscInt n,Vec *is)
Collective on QEP and Vec

Input Parameter

qep - the quadratic eigensolver context
n - number of vectors
is - set of basis vectors of the initial left space

Notes

Some solvers start to iterate on a single vector (initial left vector). In that case, the other vectors are ignored.

These vectors do not persist from one QEPSolve() call to the other, so the initial left space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted left eigenspace. Then, convergence may be faster.

See Also

QEPSetInitialSpace()

Location: src/qep/interface/qepsetup.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSortEigenvalues.html0000644000175000017500000000404112211062077023657 0ustar gladkgladk QEPSortEigenvalues

QEPSortEigenvalues

Sorts a list of eigenvalues according to the criterion specified via QEPSetWhichEigenpairs().

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSortEigenvalues(QEP qep,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)
Not Collective

Input Parameters

qep - the quadratic eigensolver context
n - number of eigenvalues in the list
eigr - pointer to the array containing the eigenvalues
eigi - imaginary part of the eigenvalues (only when using real numbers)

Output Parameter

perm - resulting permutation

Note

The result is a list of indices in the original eigenvalue array corresponding to the first nev eigenvalues sorted in the specified criterion.

See Also

QEPSetWhichEigenpairs()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPLinearGetExplicitMatrix.html0000644000175000017500000000252012211062077025301 0ustar gladkgladk QEPLinearGetExplicitMatrix

QEPLinearGetExplicitMatrix

Returns the flag indicating if the matrices A and B for the linearization of the quadratic problem are built explicitly.

Synopsis

#include "slepcqep.h" 
#include "slepceps.h" 
PetscErrorCode QEPLinearGetExplicitMatrix(QEP qep,PetscBool *explicitmatrix)
Not Collective

Input Parameter

qep - quadratic eigenvalue solver

Output Parameter

explicitmatrix - the mode flag

See Also

QEPLinearSetExplicitMatrix()

Location: src/qep/impls/linear/linear.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetConverged.html0000644000175000017500000000256112211062077023121 0ustar gladkgladk QEPGetConverged

QEPGetConverged

Gets the number of converged eigenpairs.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetConverged(QEP qep,PetscInt *nconv)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameter

nconv - number of converged eigenpairs

Note

This function should be called after QEPSolve() has finished.

See Also

QEPSetDimensions(), QEPSolve()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetFromOptions.html0000644000175000017500000000313112211062077023472 0ustar gladkgladk QEPSetFromOptions

QEPSetFromOptions

Sets QEP options from the options database. This routine must be called before QEPSetUp() if the user is to be allowed to set the solver type.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetFromOptions(QEP qep)
Collective on QEP

Input Parameters

qep - the quadratic eigensolver context

Notes

To see all options, run your program with the -help option.

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetDS.html0000644000175000017500000000227112211062077021511 0ustar gladkgladk QEPGetDS

QEPGetDS

Obtain the direct solver object associated to the quadratic eigensolver object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetDS(QEP qep,DS *ds)
Not Collective

Input Parameters

qep - eigensolver context obtained from QEPCreate()

Output Parameter

ds - direct solver context

See Also

QEPSetDS()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetScaleFactor.html0000644000175000017500000000340012211062077023400 0ustar gladkgladk QEPSetScaleFactor

QEPSetScaleFactor

Sets the scaling factor to be used for scaling the quadratic problem before attempting to solve.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetScaleFactor(QEP qep,PetscReal alpha)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
alpha - the scaling factor

Options Database Keys

-qep_scale <alpha> - Sets the scaling factor

Notes

For the problem (l^2*M + l*C + K)*x = 0, the effect of scaling is to work with matrices (alpha^2*M, alpha*C, K), then scale the computed eigenvalue.

The default is to scale with alpha = norm(K)/norm(M).

See Also

QEPGetScaleFactor()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPMonitorSet.html0000644000175000017500000001153512211062077022651 0ustar gladkgladk QEPMonitorSet

QEPMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPMonitorSet(QEP qep,PetscErrorCode (*monitor)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Logically Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()
monitor - pointer to function (if this is NULL, it turns off monitoring)
mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired)
monitordestroy - [optional] routine that frees monitor context (may be NULL)

Calling Sequence of monitor

    monitor (QEP qep, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx)

qep - quadratic eigensolver context obtained from QEPCreate()
its - iteration number
nconv - number of converged eigenpairs
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - relative error estimates for each eigenpair
nest - number of error estimates
mctx - optional monitoring context, as set by QEPMonitorSet()

Options Database Keys

-qep_monitor - print only the first error estimate
-qep_monitor_all - print error estimates at each iteration
-qep_monitor_conv - print the eigenvalue approximations only when convergence has been reached
-qep_monitor_lg - sets line graph monitor for the first unconverged approximate eigenvalue
-qep_monitor_lg_all - sets line graph monitor for all unconverged approximate eigenvalues
-qep_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to QEPMonitorSet(), but does not cancel those set via the options database.

Notes

Several different monitoring routines may be set by calling QEPMonitorSet() multiple times; all will be called in the order in which they were set.

See Also

QEPMonitorFirst(), QEPMonitorAll(), QEPMonitorCancel()

Location: src/qep/interface/qepmon.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPCreate.html0000644000175000017500000000345412211062077021752 0ustar gladkgladk QEPCreate

QEPCreate

Creates the default QEP context.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPCreate(MPI_Comm comm,QEP *outqep)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

qep - location to put the QEP context

Note

The default QEP type is QEPLINEAR

See Also

QEPSetUp(), QEPSolve(), QEPDestroy(), QEP

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPMonitorCancel.html0000644000175000017500000000271012211062077023276 0ustar gladkgladk QEPMonitorCancel

QEPMonitorCancel

Clears all monitors for a QEP object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPMonitorCancel(QEP qep)
Logically Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()

Options Database Key

-qep_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to QEPMonitorSet(), but does not cancel those set via the options database.

See Also

QEPMonitorSet()

Location: src/qep/interface/qepmon.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEP.html0000644000175000017500000000202112211062077020613 0ustar gladkgladk QEP

QEP

Abstract SLEPc object that manages all the quadratic eigenvalue problem solvers.

Synopsis

typedef struct _p_QEP* QEP;

See Also

QEPCreate()

Location: src/qep/../../include/slepcqep.h
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetErrorEstimate.html0000644000175000017500000000334212211062077023770 0ustar gladkgladk QEPGetErrorEstimate

QEPGetErrorEstimate

Returns the error estimate associated to the i-th computed eigenpair.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetErrorEstimate(QEP qep,PetscInt i,PetscReal *errest)
Not Collective

Input Parameter

qep - quadratic eigensolver context
i - index of eigenpair

Output Parameter

errest - the error estimate

Notes

This is the error estimate used internally by the eigensolver. The actual error bound can be computed with QEPComputeRelativeError(). See also the users manual for details.

See Also

QEPComputeRelativeError()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetDimensions.html0000644000175000017500000000551512211062077023333 0ustar gladkgladk QEPSetDimensions

QEPSetDimensions

Sets the number of eigenvalues to compute and the dimension of the subspace.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetDimensions(QEP qep,PetscInt nev,PetscInt ncv,PetscInt mpd)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
nev - number of eigenvalues to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Options Database Keys

-qep_nev <nev> - Sets the number of eigenvalues
-qep_ncv <ncv> - Sets the dimension of the subspace
-qep_mpd <mpd> - Sets the maximum projected dimension

Notes

Pass 0 to retain the previous value of any parameter.

Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method.

The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and (b) in cases where nev is large, the user sets mpd.

The value of ncv should always be between nev and (nev+mpd), typically ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise a smaller value should be used.

See Also

QEPGetDimensions()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPLinearGetCompanionForm.html0000644000175000017500000000247512211062077025113 0ustar gladkgladk QEPLinearGetCompanionForm

QEPLinearGetCompanionForm

Returns the number of the companion form that will be used for the linearization of the quadratic problem.

Synopsis

#include "slepcqep.h" 
#include "slepceps.h" 
PetscErrorCode QEPLinearGetCompanionForm(QEP qep,PetscInt *cform)
Not Collective

Input Parameter

qep - quadratic eigenvalue solver

Output Parameter

cform - the companion form number (1 or 2)

See Also

QEPLinearSetCompanionForm()

Location: src/qep/impls/linear/linear.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetLeftVectorsWanted.html0000644000175000017500000000234512211062077024610 0ustar gladkgladk QEPGetLeftVectorsWanted

QEPGetLeftVectorsWanted

Returns the flag indicating whether left eigenvectors are required or not.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetLeftVectorsWanted(QEP qep,PetscBool *leftvecs)
Not Collective

Input Parameter

qep - the eigensolver context

Output Parameter

leftvecs - the returned flag

See Also

QEPSetLeftVectorsWanted()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetTolerances.html0000644000175000017500000000353512211062077023306 0ustar gladkgladk QEPGetTolerances

QEPGetTolerances

Gets the tolerance and maximum iteration count used by the QEP convergence tests.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetTolerances(QEP qep,PetscReal *tol,PetscInt *maxits)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameters

tol - the convergence tolerance
maxits - maximum number of iterations

Notes

The user can specify NULL for any parameter that is not needed.

See Also

QEPSetTolerances()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetTarget.html0000644000175000017500000000233212211062077022427 0ustar gladkgladk QEPGetTarget

QEPGetTarget

Gets the value of the target.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetTarget(QEP qep,PetscScalar* target)
Not Collective

Input Parameter

qep - eigensolver context

Output Parameter

target - the value of the target

Note

If the target was not set by the user, then zero is returned.

See Also

QEPSetTarget()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetIP.html0000644000175000017500000000302212211062077021522 0ustar gladkgladk QEPSetIP

QEPSetIP

Associates an inner product object to the quadratic eigensolver.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetIP(QEP qep,IP ip)
Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()
ip - the inner product object

Note

Use QEPGetIP() to retrieve the inner product context (for example, to free it at the end of the computations).

See Also

QEPGetIP()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPWhich.html0000644000175000017500000000242612211062077021607 0ustar gladkgladk QEPWhich

QEPWhich

Determines which part of the spectrum is requested

Synopsis

typedef enum { QEP_LARGEST_MAGNITUDE=1,
               QEP_SMALLEST_MAGNITUDE,
               QEP_LARGEST_REAL,
               QEP_SMALLEST_REAL,
               QEP_LARGEST_IMAGINARY,
               QEP_SMALLEST_IMAGINARY,
               QEP_TARGET_MAGNITUDE,
               QEP_TARGET_REAL,
               QEP_TARGET_IMAGINARY} QEPWhich;

See Also

QEPSetWhichEigenpairs(), QEPGetWhichEigenpairs()

Location: src/qep/../../include/slepcqep.h
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetTrackAll.html0000644000175000017500000000225312211062077022700 0ustar gladkgladk QEPGetTrackAll

QEPGetTrackAll

Returns the flag indicating whether all residual norms must be computed or not.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetTrackAll(QEP qep,PetscBool *trackall)
Not Collective

Input Parameter

qep - the eigensolver context

Output Parameter

trackall - the returned flag

See Also

QEPSetTrackAll()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetWhichEigenpairs.html0000644000175000017500000001066412211062077024275 0ustar gladkgladk QEPSetWhichEigenpairs

QEPSetWhichEigenpairs

Specifies which portion of the spectrum is to be sought.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetWhichEigenpairs(QEP qep,QEPWhich which)
Logically Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()
which - the portion of the spectrum to be sought

Possible values

The parameter 'which' can have one of these values

QEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
QEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
QEP_LARGEST_REAL - largest real parts
QEP_SMALLEST_REAL - smallest real parts
QEP_LARGEST_IMAGINARY - largest imaginary parts
QEP_SMALLEST_IMAGINARY - smallest imaginary parts
QEP_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
QEP_TARGET_REAL - eigenvalues with real part closest to target
QEP_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target

Options Database Keys

-qep_largest_magnitude - Sets largest eigenvalues in magnitude
-qep_smallest_magnitude - Sets smallest eigenvalues in magnitude
-qep_largest_real - Sets largest real parts
-qep_smallest_real - Sets smallest real parts
-qep_largest_imaginary - Sets largest imaginary parts
-qep_smallest_imaginary - Sets smallest imaginary parts
-qep_target_magnitude - Sets eigenvalues closest to target
-qep_target_real - Sets real parts closest to target
-qep_target_imaginary - Sets imaginary parts closest to target

Notes

Not all eigensolvers implemented in QEP account for all the possible values stated above. If SLEPc is compiled for real numbers QEP_LARGEST_IMAGINARY and QEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection.

See Also

QEPGetWhichEigenpairs(), QEPWhich

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetOptionsPrefix.html0000644000175000017500000000274412211062077024021 0ustar gladkgladk QEPGetOptionsPrefix

QEPGetOptionsPrefix

Gets the prefix used for searching for all QEP options in the database.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetOptionsPrefix(QEP qep,const char *prefix[])
Not Collective

Input Parameters

qep - the quadratic eigensolver context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

QEPSetOptionsPrefix(), QEPAppendOptionsPrefix()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetOperators.html0000644000175000017500000000421412211062077023174 0ustar gladkgladk QEPSetOperators

QEPSetOperators

Sets the matrices associated with the quadratic eigenvalue problem.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetOperators(QEP qep,Mat M,Mat C,Mat K)
Collective on QEP and Mat

Input Parameters

qep - the eigenproblem solver context
M - the first coefficient matrix
C - the second coefficient matrix
K - the third coefficient matrix

Notes

The quadratic eigenproblem is defined as (l^2*M + l*C + K)*x = 0, where l is the eigenvalue and x is the eigenvector.

See Also

QEPSolve(), QEPGetOperators()

Location: src/qep/interface/qepsetup.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetDS.html0000644000175000017500000000302112211062077021517 0ustar gladkgladk QEPSetDS

QEPSetDS

Associates a direct solver object to the quadratic eigensolver.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetDS(QEP qep,DS ds)
Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()
ds - the direct solver object

Note

Use QEPGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations).

See Also

QEPGetDS()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetConvergedReason.html0000644000175000017500000000411012211062077024261 0ustar gladkgladk QEPGetConvergedReason

QEPGetConvergedReason

Gets the reason why the QEPSolve() iteration was stopped.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetConvergedReason(QEP qep,QEPConvergedReason *reason)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameter

reason - negative value indicates diverged, positive value converged

Possible values for reason

QEP_CONVERGED_TOL - converged up to tolerance
QEP_DIVERGED_ITS - required more than its to reach convergence
QEP_DIVERGED_BREAKDOWN - generic breakdown in method

Note

Can only be called after the call to QEPSolve() is complete.

See Also

QEPSetTolerances(), QEPSolve(), QEPConvergedReason

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPFinalizePackage.html0000644000175000017500000000206612211062077023562 0ustar gladkgladk QEPFinalizePackage

QEPFinalizePackage

This function destroys everything in the Slepc interface to the QEP package. It is called from SlepcFinalize().

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetType.html0000644000175000017500000000424512211062077022143 0ustar gladkgladk QEPSetType

QEPSetType

Selects the particular solver to be used in the QEP object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetType(QEP qep,QEPType type)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
type - a known method

Options Database Key

-qep_type <method> - Sets the method; use -help for a list of available methods

Notes

See "slepc/include/slepcqep.h" for available methods. The default is QEPLINEAR.

Normally, it is best to use the QEPSetFromOptions() command and then set the QEP type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The QEPSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database.

See Also

QEPType

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPMonitorAll.html0000644000175000017500000000444312211062077022626 0ustar gladkgladk QEPMonitorAll

QEPMonitorAll

Print the current approximate values and error estimates at each iteration of the quadratic eigensolver.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
Collective on QEP

Input Parameters

qep - quadratic eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorConverged()

Location: src/qep/interface/qepmon.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetInitialSpace.html0000644000175000017500000000415412211062077023566 0ustar gladkgladk QEPSetInitialSpace

QEPSetInitialSpace

Specify a basis of vectors that constitute the initial space, that is, the subspace from which the solver starts to iterate.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetInitialSpace(QEP qep,PetscInt n,Vec *is)
Collective on QEP and Vec

Input Parameter

qep - the quadratic eigensolver context
n - number of vectors
is - set of basis vectors of the initial space

Notes

Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored.

These vectors do not persist from one QEPSolve() call to the other, so the initial space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster.

See Also

QEPSetInitialSpaceLeft()

Location: src/qep/interface/qepsetup.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPComputeRelativeError.html0000644000175000017500000000345112211062077024666 0ustar gladkgladk QEPComputeRelativeError

QEPComputeRelativeError

Computes the relative error bound associated with the i-th computed eigenpair.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPComputeRelativeError(QEP qep,PetscInt i,PetscReal *error)
Collective on QEP

Input Parameter

qep - the quadratic eigensolver context
i - the solution index

Output Parameter

error - the relative error bound, computed as ||(l^2*M+l*C+K)x||_2/||lx||_2 where l is the eigenvalue and x is the eigenvector. If l=0 the relative error is computed as ||Kx||_2/||x||_2.

See Also

QEPSolve(), QEPComputeResidualNorm(), QEPGetErrorEstimate()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/index.html0000644000175000017500000001616012211062077021306 0ustar gladkgladk Quadratic Eigenvalue Problem Solvers - QEP

Quadratic Eigenvalue Problem Solvers - QEP: Examples

The Quadratic Eigenvalue Problem (QEP) solver is the object provided by SLEPc for specifying a quadratic eigenvalue problem. Apart from the specific solvers for this type of problems, there is an EPS-based solver, i.e., it uses a solver from EPS to solve a generalized eigenproblem obtained after linearization.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -qep_nev 4 -qep_type linear). Options can also be set directly in application codes by calling the corresponding routines (e.g., QEPSetDimensions() / QEPSetType()).

Beginner - Basic usage
QEP QEPGetConverged QEPSetTarget
QEPComputeRelativeError QEPGetEigenpair QEPSolve
QEPComputeResidualNorm QEPGetST QEPType
QEPConvergedReason QEPGetTarget QEPView
QEPCreate QEPSetFromOptions
QEPDestroy QEPSetOperators
Intermediate - Setting options for algorithms and data structures
QEPGetConvergedReason QEPGetType QEPSetInitialSpaceLeft
QEPGetDimensions QEPGetWhichEigenpairs QEPSetLeftVectorsWanted
QEPGetIterationNumber QEPMonitorAll QEPSetProblemType
QEPGetLeftVectorsWanted QEPMonitorCancel QEPSetScaleFactor
QEPGetMonitorContext QEPMonitorConverged QEPSetTolerances
QEPGetOperationCounters QEPMonitorFirst QEPSetTrackAll
QEPGetOperators QEPMonitorSet QEPSetType
QEPGetProblemType QEPPrintSolution QEPSetWhichEigenpairs
QEPGetScaleFactor QEPProblemType QEPWhich
QEPGetTolerances QEPSetDimensions
QEPGetTrackAll QEPSetInitialSpace
Advanced - Setting more advanced options and customization
QEPAppendOptionsPrefix QEPLinearGetExplicitMatrix QEPSetConvergenceTest
QEPGetDS QEPLinearSetCompanionForm QEPSetDS
QEPGetErrorEstimate QEPLinearSetEPS QEPSetIP
QEPGetIP QEPLinearSetExplicitMatrix QEPSetOptionsPrefix
QEPGetOptionsPrefix QEPRegister QEPSetUp
QEPLinearGetCompanionForm QEPRegisterAll
QEPLinearGetEPS QEPReset
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
QEPCompareEigenvalues QEPInitializePackage QEPSetWorkVecs
QEPFinalizePackage QEPSetST QEPSortEigenvalues
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetDimensions.html0000644000175000017500000000413112211062077023310 0ustar gladkgladk QEPGetDimensions

QEPGetDimensions

Gets the number of eigenvalues to compute and the dimension of the subspace.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetDimensions(QEP qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameters

nev - number of eigenvalues to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Notes

The user can specify NULL for any parameter that is not needed.

See Also

QEPSetDimensions()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPAppendOptionsPrefix.html0000644000175000017500000000340412211062077024503 0ustar gladkgladk QEPAppendOptionsPrefix

QEPAppendOptionsPrefix

Appends to the prefix used for searching for all QEP options in the database.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPAppendOptionsPrefix(QEP qep,const char *prefix)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
prefix - the prefix string to prepend to all QEP option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

QEPSetOptionsPrefix(), QEPGetOptionsPrefix()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetScaleFactor.html0000644000175000017500000000265212211062077023374 0ustar gladkgladk QEPGetScaleFactor

QEPGetScaleFactor

Gets the factor used for scaling the quadratic eigenproblem.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetScaleFactor(QEP qep,PetscReal *alpha)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameters

alpha - the scaling factor

Notes

If the user did not specify a scaling factor, then after QEPSolve() the default value is returned.

See Also

QEPSetScaleFactor(), QEPSolve()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetLeftVectorsWanted.html0000644000175000017500000000346612211062077024631 0ustar gladkgladk QEPSetLeftVectorsWanted

QEPSetLeftVectorsWanted

Specifies which eigenvectors are required.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetLeftVectorsWanted(QEP qep,PetscBool leftvecs)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
leftvecs - whether left eigenvectors are required or not

Options Database Keys

-qep_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'

Notes

If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of the algorithm that computes both right and left eigenvectors. This is usually much more costly. This option is not available in all solvers.

See Also

QEPGetLeftVectorsWanted()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPLinearSetExplicitMatrix.html0000644000175000017500000000325312211062077025321 0ustar gladkgladk QEPLinearSetExplicitMatrix

QEPLinearSetExplicitMatrix

Indicate if the matrices A and B for the linearization of the quadratic problem must be built explicitly.

Synopsis

#include "slepcqep.h" 
#include "slepceps.h" 
PetscErrorCode QEPLinearSetExplicitMatrix(QEP qep,PetscBool explicitmatrix)
Logically Collective on QEP

Input Parameters

qep - quadratic eigenvalue solver
explicit - boolean flag indicating if the matrices are built explicitly

Options Database Key

-qep_linear_explicitmatrix <boolean> - Indicates the boolean flag

See Also

QEPLinearGetExplicitMatrix()

Location: src/qep/impls/linear/linear.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetIterationNumber.html0000644000175000017500000000400212211062077024304 0ustar gladkgladk QEPGetIterationNumber

QEPGetIterationNumber

Gets the current iteration number. If the call to QEPSolve() is complete, then it returns the number of iterations carried out by the solution method.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetIterationNumber(QEP qep,PetscInt *its)
Not Collective

Input Parameter

qep - the quadratic eigensolver context

Output Parameter

its - number of iterations

Note

During the i-th iteration this call returns i-1. If QEPSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call QEPGetConvergedReason() to determine if the solver converged or failed and why.

See Also

QEPGetConvergedReason(), QEPSetTolerances()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex17.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetWorkVecs.html0000644000175000017500000000261012211062077022757 0ustar gladkgladk QEPSetWorkVecs

QEPSetWorkVecs

Sets a number of work vectors into a QEP object

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetWorkVecs(QEP qep,PetscInt nw)
Collective on QEP

Input Parameters

qep - quadratic eigensolver context
nw - number of work vectors to allocate

Developers Note

This is PETSC_EXTERN because it may be required by user plugin QEP implementations.

Location: src/qep/interface/qepdefault.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPDestroy.html0000644000175000017500000000311612211062077022173 0ustar gladkgladk QEPDestroy

QEPDestroy

Destroys the QEP context.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPDestroy(QEP *qep)
Collective on QEP

Input Parameter

qep - eigensolver context obtained from QEPCreate()

See Also

QEPCreate(), QEPSetUp(), QEPSolve()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetOperators.html0000644000175000017500000000317512211062077023165 0ustar gladkgladk QEPGetOperators

QEPGetOperators

Gets the matrices associated with the quadratic eigensystem.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetOperators(QEP qep,Mat *M,Mat *C,Mat *K)
Collective on QEP and Mat

Input Parameter

qep - the QEP context

Output Parameters

M - the first coefficient matrix
C - the second coefficient matrix
K - the third coefficient matrix

See Also

QEPSolve(), QEPSetOperators()

Location: src/qep/interface/qepsetup.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPProblemType.html0000644000175000017500000000217712211062077023012 0ustar gladkgladk QEPProblemType

QEPProblemType

Determines the type of the quadratic eigenproblem

Synopsis

typedef enum { QEP_GENERAL=1,
               QEP_HERMITIAN,   /* M, C, K  Hermitian */
               QEP_GYROSCOPIC   /* M, K  Hermitian, M>0, C skew-Hermitian */
             } QEPProblemType;

See Also

QEPSetProblemType(), QEPGetProblemType()

Location: src/qep/../../include/slepcqep.h
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPView.html0000644000175000017500000000414712211062077021461 0ustar gladkgladk QEPView

QEPView

Prints the QEP data structure.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPView(QEP qep,PetscViewer viewer)
Collective on QEP

Input Parameters

qep - the quadratic eigenproblem solver context
viewer - optional visualization context

Options Database Key

-qep_view - Calls QEPView() at end of QEPSolve()

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

PetscViewerASCIIOpen()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetIP.html0000644000175000017500000000227112211062077021513 0ustar gladkgladk QEPGetIP

QEPGetIP

Obtain the inner product object associated to the quadratic eigensolver object.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetIP(QEP qep,IP *ip)
Not Collective

Input Parameters

qep - eigensolver context obtained from QEPCreate()

Output Parameter

ip - inner product context

See Also

QEPSetIP()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetTolerances.html0000644000175000017500000000416612211062077023323 0ustar gladkgladk QEPSetTolerances

QEPSetTolerances

Sets the tolerance and maximum iteration count used by the QEP convergence tests.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetTolerances(QEP qep,PetscReal tol,PetscInt maxits)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
tol - the convergence tolerance
maxits - maximum number of iterations to use

Options Database Keys

-qep_tol <tol> - Sets the convergence tolerance
-qep_max_it <maxits> - Sets the maximum number of iterations allowed

Notes

Pass 0 for an argument that need not be changed.

Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method.

See Also

QEPGetTolerances()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetOptionsPrefix.html0000644000175000017500000000415412211062077024032 0ustar gladkgladk QEPSetOptionsPrefix

QEPSetOptionsPrefix

Sets the prefix used for searching for all QEP options in the database.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetOptionsPrefix(QEP qep,const char *prefix)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
prefix - the prefix string to prepend to all QEP option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

For example, to distinguish between the runtime options for two different QEP contexts, one could call

      QEPSetOptionsPrefix(qep1,"qeig1_")
      QEPSetOptionsPrefix(qep2,"qeig2_")

See Also

QEPAppendOptionsPrefix(), QEPGetOptionsPrefix()

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetUp.html0000644000175000017500000000272412211062077021606 0ustar gladkgladk QEPSetUp

QEPSetUp

Sets up all the internal data structures necessary for the execution of the QEP solver.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetUp(QEP qep)
Collective on QEP

Input Parameter

qep - solver context

Notes

This function need not be called explicitly in most cases, since QEPSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time.

See Also

QEPCreate(), QEPSolve(), QEPDestroy()

Location: src/qep/interface/qepsetup.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPPrintSolution.html0000644000175000017500000000365012211062077023376 0ustar gladkgladk QEPPrintSolution

QEPPrintSolution

Prints the computed eigenvalues.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPPrintSolution(QEP qep,PetscViewer viewer)
Collective on QEP

Input Parameters

qep - the eigensolver context
viewer - optional visualization context

Options Database Key

-qep_terse - print only minimal information

Note

By default, this function prints a table with eigenvalues and associated relative errors. With -qep_terse only the eigenvalues are printed.

See Also

PetscViewerASCIIOpen()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetOperationCounters.html0000644000175000017500000000344212211062077024667 0ustar gladkgladk QEPGetOperationCounters

QEPGetOperationCounters

Gets the total number of matrix-vector products, dot products, and linear solve iterations used by the QEP object during the last QEPSolve() call.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetOperationCounters(QEP qep,PetscInt* matvecs,PetscInt* dots,PetscInt* lits)
Not Collective

Input Parameter

qep - quadratic eigensolver context

Output Parameter

matvecs - number of matrix-vector product operations
dots - number of dot product operations
lits - number of linear iterations

Notes

These counters are reset to zero at each successive call to QEPSolve().

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSolve.html0000644000175000017500000000470512211062077021637 0ustar gladkgladk QEPSolve

QEPSolve

Solves the quadratic eigensystem.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSolve(QEP qep)
Collective on QEP

Input Parameter

qep - eigensolver context obtained from QEPCreate()

Options Database Keys

-qep_view - print information about the solver used
-qep_view_mat0 binary - save the first matrix (M) to the default binary viewer
-qep_view_mat1 binary - save the second matrix (C) to the default binary viewer
-qep_view_mat2 binary - save the third matrix (K) to the default binary viewer
-qep_plot_eigs - plot computed eigenvalues

See Also

QEPCreate(), QEPSetUp(), QEPDestroy(), QEPSetTolerances()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex17.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPInitializePackage.html0000644000175000017500000000222012211062077024112 0ustar gladkgladk QEPInitializePackage

QEPInitializePackage

This function initializes everything in the QEP package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to QEPCreate() when using static libraries.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPInitializePackage(void)

See Also

SlepcInitialize()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPMonitorConverged.html0000644000175000017500000000460612211062077024033 0ustar gladkgladk QEPMonitorConverged

QEPMonitorConverged

Print the approximate values and error estimates as they converge.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
Collective on QEP

Input Parameters

qep - quadratic eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eigr - real part of the eigenvalues
eigi - imaginary part of the eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context

Note

The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

See Also

QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorAll()

Location: src/qep/interface/qepmon.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetProblemType.html0000644000175000017500000000556012211062077023465 0ustar gladkgladk QEPSetProblemType

QEPSetProblemType

Specifies the type of the quadratic eigenvalue problem.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetProblemType(QEP qep,QEPProblemType type)
Logically Collective on QEP

Input Parameters

qep - the quadratic eigensolver context
type - a known type of quadratic eigenvalue problem

Options Database Keys

-qep_general - general problem with no particular structure
-qep_hermitian - problem whose coefficient matrices are Hermitian
-qep_gyroscopic - problem with Hamiltonian structure

Notes

Allowed values for the problem type are: general (QEP_GENERAL), Hermitian (QEP_HERMITIAN), and gyroscopic (QEP_GYROSCOPIC).

This function is used to instruct SLEPc to exploit certain structure in the quadratic eigenproblem. By default, no particular structure is assumed.

If the problem matrices are Hermitian (symmetric in the real case) or Hermitian/skew-Hermitian then the solver can exploit this fact to perform less operations or provide better stability.

See Also

QEPSetOperators(), QEPSetType(), QEPGetProblemType(), QEPProblemType

Location: src/qep/interface/qepopts.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/qep/examples/tutorials/ex16.c.html
src/qep/examples/tutorials/ex16f90.F90.html
slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPLinearSetCompanionForm.html0000644000175000017500000000315012211062077025116 0ustar gladkgladk QEPLinearSetCompanionForm

QEPLinearSetCompanionForm

Choose between the two companion forms available for the linearization of the quadratic problem.

Synopsis

#include "slepcqep.h" 
#include "slepceps.h" 
PetscErrorCode QEPLinearSetCompanionForm(QEP qep,PetscInt cform)
Logically Collective on QEP

Input Parameters

qep - quadratic eigenvalue solver
cform - 1 or 2 (first or second companion form)

Options Database Key

-qep_linear_cform <int> - Choose the companion form

See Also

QEPLinearGetCompanionForm()

Location: src/qep/impls/linear/linear.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPConvergedReason.html0000644000175000017500000000246712211062077023636 0ustar gladkgladk QEPConvergedReason

QEPConvergedReason

Reason an eigensolver was said to have converged or diverged

Synopsis

typedef enum {/* converged */
              QEP_CONVERGED_TOL                =  2,
              /* diverged */
              QEP_DIVERGED_ITS                 = -3,
              QEP_DIVERGED_BREAKDOWN           = -4,
              QEP_CONVERGED_ITERATING          =  0} QEPConvergedReason;

See Also

QEPSolve(), QEPGetConvergedReason(), QEPSetTolerances()

Location: src/qep/../../include/slepcqep.h
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetMonitorContext.html0000644000175000017500000000247512211062077024205 0ustar gladkgladk QEPGetMonitorContext

QEPGetMonitorContext

Gets the monitor context, as set by QEPMonitorSet() for the FIRST monitor only.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetMonitorContext(QEP qep,void **ctx)
Not Collective

Input Parameter

qep - eigensolver context obtained from QEPCreate()

Output Parameter

ctx - monitor context

See Also

QEPMonitorSet(), QEPDefaultMonitor()

Location: src/qep/interface/qepmon.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPSetST.html0000644000175000017500000000304612211062077021546 0ustar gladkgladk QEPSetST

QEPSetST

Associates a spectral transformation object to the eigensolver.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPSetST(QEP qep,ST st)
Collective on QEP

Input Parameters

qep - eigensolver context obtained from QEPCreate()
st - the spectral transformation object

Note

Use QEPGetST() to retrieve the spectral transformation context (for example, to free it at the end of the computations).

See Also

QEPGetST()

Location: src/qep/interface/qepbasic.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPCompareEigenvalues.html0000644000175000017500000000452512211062077024325 0ustar gladkgladk QEPCompareEigenvalues

QEPCompareEigenvalues

Compares two (possibly complex) eigenvalues according to a certain criterion.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPCompareEigenvalues(QEP qep,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)
Not Collective

Input Parameters

qep - the quadratic eigensolver context
ar - real part of the 1st eigenvalue
ai - imaginary part of the 1st eigenvalue
br - real part of the 2nd eigenvalue
bi - imaginary part of the 2nd eigenvalue

Output Parameter

res - result of comparison

Notes

Returns an integer less than, equal to, or greater than zero if the first eigenvalue is considered to be respectively less than, equal to, or greater than the second one.

The criterion of comparison is related to the 'which' parameter set with QEPSetWhichEigenpairs().

See Also

QEPSortEigenvalues(), QEPSetWhichEigenpairs()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPGetEigenpair.html0000644000175000017500000000536012211062077023110 0ustar gladkgladk QEPGetEigenpair

QEPGetEigenpair

Gets the i-th solution of the eigenproblem as computed by QEPSolve(). The solution consists in both the eigenvalue and the eigenvector.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPGetEigenpair(QEP qep,PetscInt i,PetscScalar *eigr,PetscScalar *eigi,Vec Vr,Vec Vi)
Logically Collective on EPS

Input Parameters

qep - quadratic eigensolver context
i - index of the solution

Output Parameters

eigr - real part of eigenvalue
eigi - imaginary part of eigenvalue
Vr - real part of eigenvector
Vi - imaginary part of eigenvector

Notes

If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is configured with complex scalars the eigenvalue is stored directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is set to zero).

The index i should be a value between 0 and nconv-1 (see QEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with QEPSetWhichEigenpairs().

See Also

QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs()

Location: src/qep/interface/qepsolve.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/QEP/QEPRegisterAll.html0000644000175000017500000000167412211062077022766 0ustar gladkgladk QEPRegisterAll

QEPRegisterAll

Registers all the solvers in the QEP package.

Synopsis

#include "slepcqep.h" 
PetscErrorCode QEPRegisterAll(void)
Not Collective

See Also

QEPRegister()

Location: src/qep/interface/qepregis.c
Index of all QEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/0000755000175000017500000000000012214143515017302 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPWhich.html0000644000175000017500000000242612211062077021601 0ustar gladkgladk NEPWhich

NEPWhich

Determines which part of the spectrum is requested

Synopsis

typedef enum { NEP_LARGEST_MAGNITUDE=1,
               NEP_SMALLEST_MAGNITUDE,
               NEP_LARGEST_REAL,
               NEP_SMALLEST_REAL,
               NEP_LARGEST_IMAGINARY,
               NEP_SMALLEST_IMAGINARY,
               NEP_TARGET_MAGNITUDE,
               NEP_TARGET_REAL,
               NEP_TARGET_IMAGINARY} NEPWhich;

See Also

NEPSetWhichEigenpairs(), NEPGetWhichEigenpairs()

Location: src/nep/../../include/slepcnep.h
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPApplyJacobian.html0000644000175000017500000000503512211062077023252 0ustar gladkgladk NEPApplyJacobian

NEPApplyJacobian

Applies the nonlinear Jacobian T'(lambda) to a given vector.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPApplyJacobian(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,MatStructure *flg)
Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
lambda - scalar argument
x - vector to be multiplied against
v - workspace vector

Output Parameters

y - result vector
A - Jacobian matrix
flg - flag indicating matrix structure (see MatStructure enum)

Note

If the nonlinear operator is represented in split form, the result y = T'(lambda)*x is computed without building T'(lambda) explicitly. In that case, parameters A and flg are not used. Otherwise, the matrix T'(lambda) is built and the effect is the same as a call to NEPComputeJacobian() followed by a MatMult().

See Also

NEPSetSplitOperator(), NEPComputeJacobian()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPInitializePackage.html0000644000175000017500000000222012211062077024104 0ustar gladkgladk NEPInitializePackage

NEPInitializePackage

This function initializes everything in the NEP package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to NEPCreate() when using static libraries.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPInitializePackage(void)

See Also

SlepcInitialize()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPMonitorFirst.html0000644000175000017500000000422212211062077023172 0ustar gladkgladk NEPMonitorFirst

NEPMonitorFirst

Print the first unconverged approximate value and error estimate at each iteration of the nonlinear eigensolver.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPMonitorFirst(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
Collective on NEP

Input Parameters

nep - nonlinear eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eig - eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

NEPMonitorSet(), NEPMonitorAll(), NEPMonitorConverged()

Location: src/nep/interface/nepmon.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetSplitOperatorInfo.html0000644000175000017500000000344212211062077024621 0ustar gladkgladk NEPGetSplitOperatorInfo

NEPGetSplitOperatorInfo

Returns the number of terms of the split form of the nonlinear operator, as well as the structure flag for matrices.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetSplitOperatorInfo(NEP nep,PetscInt *n,MatStructure *str)
Not collective

Input Parameter

nep - the nonlinear eigensolver context

Output Parameters

n - the number of terms passed in NEPSetSplitOperator()
str - the matrix structure flag passed in NEPSetSplitOperator()

See Also

NEPSetSplitOperator(), NEPGetSplitOperatorTerm()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetDS.html0000644000175000017500000000302112211062077021511 0ustar gladkgladk NEPSetDS

NEPSetDS

Associates a direct solver object to the nonlinear eigensolver.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetDS(NEP nep,DS ds)
Collective on NEP

Input Parameters

nep - eigensolver context obtained from NEPCreate()
ds - the direct solver object

Note

Use NEPGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations).

See Also

NEPGetDS()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetConstCorrectionTol.html0000644000175000017500000000341612211062077025010 0ustar gladkgladk NEPSetConstCorrectionTol

NEPSetConstCorrectionTol

Sets a flag to keep the tolerance used in the linear solver constant.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetConstCorrectionTol(NEP nep,PetscBool cct)
Logically Collective on NEP

Input Parameters

nep - the NEP context
cct - a boolean value

Options Database Keys

-nep_const_correction_tol <cct> - Notes: By default, an exponentially decreasing tolerance is set in the KSP used within the nonlinear iteration, so that each Newton iteration requests better accuracy than the previous one. The constant correction tolerance flag stops this behaviour.

See Also

NEPGetConstCorrectionTol()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPComputeJacobian.html0000644000175000017500000000404512211062077023601 0ustar gladkgladk NEPComputeJacobian

NEPComputeJacobian

Computes the Jacobian matrix T'(lambda) that has been set with NEPSetJacobian().

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPComputeJacobian(NEP nep,PetscScalar lambda,Mat *A,MatStructure *flg)
Collective on NEP and Mat

Input Parameters

nep - the NEP context
lambda - the scalar argument

Output Parameters

A - Jacobian matrix
flg - flag indicating matrix structure (see MatStructure enum)

Notes

Most users should not need to explicitly call this routine, as it is used internally within the nonlinear eigensolvers.

See Also

NEPSetJacobian(), NEPGetJacobian()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetErrorEstimate.html0000644000175000017500000000327312211062077023765 0ustar gladkgladk NEPGetErrorEstimate

NEPGetErrorEstimate

Returns the error estimate associated to the i-th computed eigenpair.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetErrorEstimate(NEP nep,PetscInt i,PetscReal *errest)
Not Collective

Input Parameter

nep - nonlinear eigensolver context
i - index of eigenpair

Output Parameter

errest - the error estimate

Notes

This is the error estimate used internally by the eigensolver. The actual error bound can be computed with NEPComputeRelativeError().

See Also

NEPComputeRelativeError()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetDS.html0000644000175000017500000000227112211062077021503 0ustar gladkgladk NEPGetDS

NEPGetDS

Obtain the direct solver object associated to the nonlinear eigensolver object.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetDS(NEP nep,DS *ds)
Not Collective

Input Parameters

nep - eigensolver context obtained from NEPCreate()

Output Parameter

ds - direct solver context

See Also

NEPSetDS()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetFunction.html0000644000175000017500000000356512211062077022771 0ustar gladkgladk NEPGetFunction

NEPGetFunction

Returns the Function matrix and optionally the user provided context for evaluating the Function.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetFunction(NEP nep,Mat *A,Mat *B,PetscErrorCode (**fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void **ctx)
Not Collective, but Mat object will be parallel if NEP object is

Input Parameter

nep - the nonlinear eigensolver context

Output Parameters

A - location to stash Function matrix (or NULL)
B - location to stash preconditioner matrix (or NULL)
fun - location to put Function function (or NULL)
ctx - location to stash Function context (or NULL)

See Also

NEPSetFunction()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSLPSetEPS.html0000644000175000017500000000254212211062077022220 0ustar gladkgladk NEPSLPSetEPS

NEPSLPSetEPS

Associate a linear eigensolver object (EPS) to the nonlinear eigenvalue solver.

Synopsis

#include "slepcnep.h" 
#include "slepceps.h" 
PetscErrorCode NEPSLPSetEPS(NEP nep,EPS eps)
Collective on NEP

Input Parameters

nep - nonlinear eigenvalue solver
eps - the eigensolver object

See Also

NEPSLPGetEPS()

Location: src/nep/impls/slp/slp.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPMonitorAll.html0000644000175000017500000000421012211062077022610 0ustar gladkgladk NEPMonitorAll

NEPMonitorAll

Print the current approximate values and error estimates at each iteration of the nonlinear eigensolver.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPMonitorAll(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
Collective on NEP

Input Parameters

nep - nonlinear eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eig - eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

NEPMonitorSet(), NEPMonitorFirst(), NEPMonitorConverged()

Location: src/nep/interface/nepmon.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetConverged.html0000644000175000017500000000333612211062077023114 0ustar gladkgladk NEPGetConverged

NEPGetConverged

Gets the number of converged eigenpairs.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetConverged(NEP nep,PetscInt *nconv)
Not Collective

Input Parameter

nep - the nonlinear eigensolver context

Output Parameter

nconv - number of converged eigenpairs

Note

This function should be called after NEPSolve() has finished.

See Also

NEPSetDimensions(), NEPSolve()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEP.html0000644000175000017500000000250312211062077020612 0ustar gladkgladk NEP

NEP

Abstract SLEPc object that manages all solvers for nonlinear eigenvalue problems.

Synopsis

typedef struct _p_NEP* NEP;

See Also

NEPCreate()

Location: src/nep/../../include/slepcnep.h
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/eps/examples/tutorials/ex6f.F.html
src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetDimensions.html0000644000175000017500000000612112211062077023317 0ustar gladkgladk NEPSetDimensions

NEPSetDimensions

Sets the number of eigenvalues to compute and the dimension of the subspace.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetDimensions(NEP nep,PetscInt nev,PetscInt ncv,PetscInt mpd)
Logically Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
nev - number of eigenvalues to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Options Database Keys

-nep_nev <nev> - Sets the number of eigenvalues
-nep_ncv <ncv> - Sets the dimension of the subspace
-nep_mpd <mpd> - Sets the maximum projected dimension

Notes

Pass 0 to retain the previous value of any parameter.

Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method.

The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nev is small, the user sets ncv (a reasonable default is 2*nev); and (b) in cases where nev is large, the user sets mpd.

The value of ncv should always be between nev and (nev+mpd), typically ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise a smaller value should be used.

See Also

NEPGetDimensions()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetLagPreconditioner.html0000644000175000017500000000233412211062077024605 0ustar gladkgladk NEPGetLagPreconditioner

NEPGetLagPreconditioner

Indicates how often the preconditioner is rebuilt.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetLagPreconditioner(NEP nep,PetscInt *lag)
Not Collective

Input Parameter

nep - the NEP context

Output Parameter

lag - the lag parameter

See Also

NEPSetLagPreconditioner()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPRegisterAll.html0000644000175000017500000000167412211062077022760 0ustar gladkgladk NEPRegisterAll

NEPRegisterAll

Registers all the solvers in the NEP package.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPRegisterAll(void)
Not Collective

See Also

NEPRegister()

Location: src/nep/interface/nepregis.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetTolerances.html0000644000175000017500000000610712211062077023312 0ustar gladkgladk NEPSetTolerances

NEPSetTolerances

Sets various parameters used in convergence tests.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetTolerances(NEP nep,PetscReal abstol,PetscReal rtol,PetscReal stol,PetscInt maxit,PetscInt maxf)
Logically Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
abstol - absolute convergence tolerance
rtol - relative convergence tolerance
stol - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x ||
maxit - maximum number of iterations
maxf - maximum number of function evaluations

Options Database Keys

-nep_atol <abstol> - Sets abstol
-nep_rtol <rtol> - Sets rtol
-nep_stol <stol> - Sets stol
-nep_max_it <maxit> - Sets maxit
-nep_max_funcs <maxf> - Sets maxf

Notes

Pass 0 for an argument that need not be changed.

Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method.

See Also

NEPGetTolerances()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetSplitOperatorTerm.html0000644000175000017500000000364712211062077024644 0ustar gladkgladk NEPGetSplitOperatorTerm

NEPGetSplitOperatorTerm

Gets the matrices and functions associated with the nonlinear operator in split form.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetSplitOperatorTerm(NEP nep,PetscInt k,Mat *A,FN *f)
Not collective, though parallel Mats and FNs are returned if the NEP is parallel

Input Parameter

nep - the nonlinear eigensolver context
k - the index of the requested term (starting in 0)

Output Parameters

A - the matrix of the requested term
f - the function of the requested term

See Also

NEPSetSplitOperator(), NEPGetSplitOperatorInfo()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetKSP.html0000644000175000017500000000303512211062077021645 0ustar gladkgladk NEPSetKSP

NEPSetKSP

Associates a linear solver object to the nonlinear eigensolver.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetKSP(NEP nep,KSP ksp)
Collective on NEP

Input Parameters

nep - eigensolver context obtained from NEPCreate()
ksp - the linear solver object

Note

Use NEPGetKSP() to retrieve the linear solver context (for example, to free it at the end of the computations).

See Also

NEPGetKSP()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetOptionsPrefix.html0000644000175000017500000000274412211062077024013 0ustar gladkgladk NEPGetOptionsPrefix

NEPGetOptionsPrefix

Gets the prefix used for searching for all NEP options in the database.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetOptionsPrefix(NEP nep,const char *prefix[])
Not Collective

Input Parameters

nep - the nonlinear eigensolver context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

NEPSetOptionsPrefix(), NEPAppendOptionsPrefix()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetIterationNumber.html0000644000175000017500000000432412211062077024305 0ustar gladkgladk NEPGetIterationNumber

NEPGetIterationNumber

Gets the current iteration number. If the call to NEPSolve() is complete, then it returns the number of iterations carried out by the solution method.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetIterationNumber(NEP nep,PetscInt *its)
Not Collective

Input Parameter

nep - the nonlinear eigensolver context

Output Parameter

its - number of iterations

Note

During the i-th iteration this call returns i-1. If NEPSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call NEPGetConvergedReason() to determine if the solver converged or failed and why.

See Also

NEPGetConvergedReason(), NEPSetTolerances()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSLPGetEPS.html0000644000175000017500000000232312211062077022201 0ustar gladkgladk NEPSLPGetEPS

NEPSLPGetEPS

Retrieve the linear eigensolver object (EPS) associated to the nonlinear eigenvalue solver.

Synopsis

#include "slepcnep.h" 
#include "slepceps.h" 
PetscErrorCode NEPSLPGetEPS(NEP nep,EPS *eps)
Not Collective

Input Parameter

nep - nonlinear eigenvalue solver

Output Parameter

eps - the eigensolver object

See Also

NEPSLPSetEPS()

Location: src/nep/impls/slp/slp.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPRegister.html0000644000175000017500000000356112211062077022324 0ustar gladkgladk NEPRegister

NEPRegister

Adds a method to the quadratic eigenproblem solver package.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPRegister(const char *name,PetscErrorCode (*function)(NEP))
Not Collective

Input Parameters

name - name of a new user-defined solver
function - routine to create the solver context

Notes

NEPRegister() may be called multiple times to add several user-defined solvers.

Sample usage

   NEPRegister("my_solver",MySolverCreate);

Then, your solver can be chosen with the procedural interface via

    NEPSetType(qep,"my_solver")
or at runtime via the option
    -qep_type my_solver

See Also

NEPRegisterAll()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetConvergenceTest.html0000644000175000017500000000621112211062077024305 0ustar gladkgladk NEPSetConvergenceTest

NEPSetConvergenceTest

Sets the function to be used to test convergence of the nonlinear iterative solution.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetConvergenceTest(NEP nep,PetscErrorCode (*func)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void* ctx,PetscErrorCode (*destroy)(void*))
Logically Collective on NEP

Input Parameters

nep - the NEP context
func - a pointer to the convergence test function
ctx - [optional] context for private data for the convergence routine (may be NULL)
destroy - [optional] destructor for the context (may be NULL; PETSC_NULL_FUNCTION in Fortran)

Calling Sequence of func

  func(NEP nep,PetscInt it,PetscReal xnorm,PetscReal snorm,PetscReal fnorm,NEPConvergedReason reason*,void *fctx)

nep - the NEP context
it - iteration number
xnorm - norm of the current solution
snorm - norm of the step (difference between two consecutive solutions)
fnorm - norm of the function (residual)
reason - (output) result of the convergence test
fctx - optional context, as set by NEPSetConvergenceTest()

See Also

NEPSetTolerances()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetTarget.html0000644000175000017500000000317212211062077022440 0ustar gladkgladk NEPSetTarget

NEPSetTarget

Sets the value of the target.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetTarget(NEP nep,PetscScalar target)
Logically Collective on NEP

Input Parameters

nep - eigensolver context
target - the value of the target

Notes

The target is a scalar value used to determine the portion of the spectrum of interest. It is used in combination with NEPSetWhichEigenpairs().

See Also

NEPGetTarget(), NEPSetWhichEigenpairs()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetUp.html0000644000175000017500000000272412211062077021600 0ustar gladkgladk NEPSetUp

NEPSetUp

Sets up all the internal data structures necessary for the execution of the NEP solver.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetUp(NEP nep)
Collective on NEP

Input Parameter

nep - solver context

Notes

This function need not be called explicitly in most cases, since NEPSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time.

See Also

NEPCreate(), NEPSolve(), NEPDestroy()

Location: src/nep/interface/nepsetup.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPCreate.html0000644000175000017500000000325712211062077021745 0ustar gladkgladk NEPCreate

NEPCreate

Creates the default NEP context.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPCreate(MPI_Comm comm,NEP *outnep)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

nep - location to put the NEP context

See Also

NEPSetUp(), NEPSolve(), NEPDestroy(), NEP

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetIP.html0000644000175000017500000000302212211062077021514 0ustar gladkgladk NEPSetIP

NEPSetIP

Associates an inner product object to the nonlinear eigensolver.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetIP(NEP nep,IP ip)
Collective on NEP

Input Parameters

nep - eigensolver context obtained from NEPCreate()
ip - the inner product object

Note

Use NEPGetIP() to retrieve the inner product context (for example, to free it at the end of the computations).

See Also

NEPGetIP()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetOperationCounters.html0000644000175000017500000000342012211062077024655 0ustar gladkgladk NEPGetOperationCounters

NEPGetOperationCounters

Gets the total number of function evaluations, dot products, and linear solve iterations used by the NEP object during the last NEPSolve() call.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetOperationCounters(NEP nep,PetscInt* nfuncs,PetscInt* dots,PetscInt* lits)
Not Collective

Input Parameter

nep - nonlinear eigensolver context

Output Parameter

nfuncs - number of function evaluations
dots - number of dot product operations
lits - number of linear iterations

Notes

These counters are reset to zero at each successive call to NEPSolve().

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPApplyFunction.html0000644000175000017500000000522512211062077023332 0ustar gladkgladk NEPApplyFunction

NEPApplyFunction

Applies the nonlinear function T(lambda) to a given vector.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPApplyFunction(NEP nep,PetscScalar lambda,Vec x,Vec v,Vec y,Mat *A,Mat *B,MatStructure *flg)
Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
lambda - scalar argument
x - vector to be multiplied against
v - workspace vector

Output Parameters

y - result vector
A - Function matrix
B - optional preconditioning matrix
flg - flag indicating matrix structure (see MatStructure enum)

Note

If the nonlinear operator is represented in split form, the result y = T(lambda)*x is computed without building T(lambda) explicitly. In that case, parameters A, B and flg are not used. Otherwise, the matrix T(lambda) is built and the effect is the same as a call to NEPComputeFunction() followed by a MatMult().

See Also

NEPSetSplitOperator(), NEPComputeFunction()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPAppendOptionsPrefix.html0000644000175000017500000000340412211062077024475 0ustar gladkgladk NEPAppendOptionsPrefix

NEPAppendOptionsPrefix

Appends to the prefix used for searching for all NEP options in the database.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPAppendOptionsPrefix(NEP nep,const char *prefix)
Logically Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
prefix - the prefix string to prepend to all NEP option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

NEPSetOptionsPrefix(), NEPGetOptionsPrefix()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPMonitorSet.html0000644000175000017500000001125312211062077022640 0ustar gladkgladk NEPMonitorSet

NEPMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested eigenpair.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPMonitorSet(NEP nep,PetscErrorCode (*monitor)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Logically Collective on NEP

Input Parameters

nep - eigensolver context obtained from NEPCreate()
monitor - pointer to function (if this is NULL, it turns off monitoring)
mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired)
monitordestroy - [optional] routine that frees monitor context (may be NULL)

Calling Sequence of monitor

    monitor (NEP nep, int its, int nconv, PetscScalar *eig, PetscReal* errest, int nest, void *mctx)

nep - nonlinear eigensolver context obtained from NEPCreate()
its - iteration number
nconv - number of converged eigenpairs
eig - eigenvalues
errest - error estimates for each eigenpair
nest - number of error estimates
mctx - optional monitoring context, as set by NEPMonitorSet()

Options Database Keys

-nep_monitor - print only the first error estimate
-nep_monitor_all - print error estimates at each iteration
-nep_monitor_conv - print the eigenvalue approximations only when convergence has been reached
-nep_monitor_lg - sets line graph monitor for the first unconverged approximate eigenvalue
-nep_monitor_lg_all - sets line graph monitor for all unconverged approximate eigenvalues
-nep_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to NEPMonitorSet(), but does not cancel those set via the options database.

Notes

Several different monitoring routines may be set by calling NEPMonitorSet() multiple times; all will be called in the order in which they were set.

See Also

NEPMonitorFirst(), NEPMonitorAll(), NEPMonitorCancel()

Location: src/nep/interface/nepmon.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPType.html0000644000175000017500000000173012211062077021455 0ustar gladkgladk NEPType

NEPType

String with the name of a nonlinear eigensolver

Synopsis

typedef const char* NEPType;
#define NEPRII       "rii"
#define NEPSLP       "slp"
#define NEPNARNOLDI  "narnoldi"

See Also

NEPSetType(), NEP

Location: src/nep/../../include/slepcnep.h
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPComputeResidualNorm.html0000644000175000017500000000406312211062077024477 0ustar gladkgladk NEPComputeResidualNorm

NEPComputeResidualNorm

Computes the norm of the residual vector associated with the i-th computed eigenpair.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPComputeResidualNorm(NEP nep,PetscInt i,PetscReal *norm)
Collective on NEP

Input Parameter

nep - the nonlinear eigensolver context
i - the solution index

Output Parameter

norm - the residual norm, computed as ||T(lambda)x||_2 where lambda is the eigenvalue and x is the eigenvector.

Notes

The index i should be a value between 0 and nconv-1 (see NEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with NEPSetWhichEigenpairs().

See Also

NEPSolve(), NEPGetConverged(), NEPSetWhichEigenpairs()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPComputeRelativeError.html0000644000175000017500000000425212211062077024660 0ustar gladkgladk NEPComputeRelativeError

NEPComputeRelativeError

Computes the relative error bound associated with the i-th computed eigenpair.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPComputeRelativeError(NEP nep,PetscInt i,PetscReal *error)
Collective on NEP

Input Parameter

nep - the nonlinear eigensolver context
i - the solution index

Output Parameter

error - the relative error bound, computed as ||T(lambda)x||_2/||lambda*x||_2 where lambda is the eigenvalue and x is the eigenvector. If lambda=0 the relative error is computed as ||T(lambda)x||_2/||x||_2.

See Also

NEPSolve(), NEPComputeResidualNorm(), NEPGetErrorEstimate()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSolve.html0000644000175000017500000000375112211062077021631 0ustar gladkgladk NEPSolve

NEPSolve

Solves the nonlinear eigensystem.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSolve(NEP nep)
Collective on NEP

Input Parameter

nep - eigensolver context obtained from NEPCreate()

Options Database Keys

-nep_view - print information about the solver used
-nep_plot_eigs - plot computed eigenvalues

See Also

NEPCreate(), NEPSetUp(), NEPDestroy(), NEPSetTolerances()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/index.html0000644000175000017500000001616512211062077021310 0ustar gladkgladk Nonlinear Eigenvalue Problem Solvers - NEP

Nonlinear Eigenvalue Problem Solvers - NEP: Examples

The Nonlinear Eigenvalue Problem (NEP) solver is the object provided by SLEPc for specifying an eigenvalue problem that is nonlinear with respect to the eigenvalue (not the eigenvector). This is intended for genuinely nonlinear problems (rather than polynomial eigenproblems) described as T(λ)x=0.

As in the other solver objects, users can set various options at runtime via the options database (e.g., -nep_nev 4 -nep_type narnoldi). Options can also be set directly in application codes by calling the corresponding routines (e.g., NEPSetDimensions() / NEPSetType()).

Beginner - Basic usage
NEP NEPGetConverged NEPSetJacobian
NEPComputeRelativeError NEPGetEigenpair NEPSetTarget
NEPComputeResidualNorm NEPGetKSP NEPSolve
NEPConvergedReason NEPGetTarget NEPType
NEPCreate NEPSetFromOptions NEPView
NEPDestroy NEPSetFunction
Intermediate - Setting options for algorithms and data structures
NEPGetConstCorrectionTol NEPGetTrackAll NEPSetInitialSpace
NEPGetConvergedReason NEPGetType NEPSetLagPreconditioner
NEPGetDimensions NEPGetWhichEigenpairs NEPSetSplitOperator
NEPGetIterationNumber NEPMonitorAll NEPSetTolerances
NEPGetLagPreconditioner NEPMonitorCancel NEPSetTrackAll
NEPGetMonitorContext NEPMonitorConverged NEPSetType
NEPGetOperationCounters NEPMonitorFirst NEPSetWhichEigenpairs
NEPGetSplitOperatorInfo NEPMonitorSet NEPWhich
NEPGetSplitOperatorTerm NEPSetConstCorrectionTol
NEPGetTolerances NEPSetDimensions
Advanced - Setting more advanced options and customization
NEPAppendOptionsPrefix NEPGetOptionsPrefix NEPSetConvergenceTest
NEPGetDS NEPRegister NEPSetDS
NEPGetErrorEstimate NEPRegisterAll NEPSetIP
NEPGetFunction NEPReset NEPSetOptionsPrefix
NEPGetIP NEPSLPGetEPS NEPSetUp
NEPGetJacobian NEPSLPSetEPS
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
NEPApplyFunction NEPComputeJacobian NEPSetKSP
NEPApplyJacobian NEPFinalizePackage NEPSetWorkVecs
NEPCompareEigenvalues NEPInitializePackage NEPSortEigenvalues
NEPComputeFunction NEPProjectOperator
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPReset.html0000644000175000017500000000223412211062077021616 0ustar gladkgladk NEPReset

NEPReset

Resets the NEP context to the setupcalled=0 state and removes any allocated objects.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPReset(NEP nep)
Collective on NEP

Input Parameter

nep - eigensolver context obtained from NEPCreate()

See Also

NEPDestroy()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetTrackAll.html0000644000175000017500000000225312211062077022672 0ustar gladkgladk NEPGetTrackAll

NEPGetTrackAll

Returns the flag indicating whether all residual norms must be computed or not.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetTrackAll(NEP nep,PetscBool *trackall)
Not Collective

Input Parameter

nep - the eigensolver context

Output Parameter

trackall - the returned flag

See Also

NEPSetTrackAll()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPMonitorConverged.html0000644000175000017500000000435312211062077024024 0ustar gladkgladk NEPMonitorConverged

NEPMonitorConverged

Print the approximate values and error estimates as they converge.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPMonitorConverged(NEP nep,PetscInt its,PetscInt nconv,PetscScalar *eig,PetscReal *errest,PetscInt nest,void *monctx)
Collective on NEP

Input Parameters

nep - nonlinear eigensolver context
its - iteration number
nconv - number of converged eigenpairs so far
eig - eigenvalues
errest - error estimates
nest - number of error estimates to display
monctx - monitor context

Note

The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

See Also

NEPMonitorSet(), NEPMonitorFirst(), NEPMonitorAll()

Location: src/nep/interface/nepmon.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetKSP.html0000644000175000017500000000253212211062077021632 0ustar gladkgladk NEPGetKSP

NEPGetKSP

Obtain the linear solver (KSP) object associated to the eigensolver object.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetKSP(NEP nep,KSP *ksp)
Not Collective

Input Parameters

nep - eigensolver context obtained from NEPCreate()

Output Parameter

ksp - linear solver context

See Also

NEPSetKSP()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex21.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPCompareEigenvalues.html0000644000175000017500000000401012211062077024304 0ustar gladkgladk NEPCompareEigenvalues

NEPCompareEigenvalues

Compares two eigenvalues according to a certain criterion.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPCompareEigenvalues(NEP nep,PetscScalar a,PetscScalar b,PetscInt *result)
Not Collective

Input Parameters

nep - the nonlinear eigensolver context
a - the 1st eigenvalue
b - the 2nd eigenvalue

Output Parameter

res - result of comparison

Notes

Returns an integer less than, equal to, or greater than zero if the first eigenvalue is considered to be respectively less than, equal to, or greater than the second one.

The criterion of comparison is related to the 'which' parameter set with NEPSetWhichEigenpairs().

See Also

NEPSortEigenvalues(), NEPSetWhichEigenpairs()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetJacobian.html0000644000175000017500000000334512211062077022706 0ustar gladkgladk NEPGetJacobian

NEPGetJacobian

Returns the Jacobian matrix and optionally the user provided context for evaluating the Jacobian.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetJacobian(NEP nep,Mat *A,PetscErrorCode (**jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void **ctx)
Not Collective, but Mat object will be parallel if NEP object is

Input Parameter

nep - the nonlinear eigensolver context

Output Parameters

A - location to stash Jacobian matrix (or NULL)
jac - location to put Jacobian function (or NULL)
ctx - location to stash Jacobian context (or NULL)

See Also

NEPSetJacobian()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetTrackAll.html0000644000175000017500000000340712211062077022710 0ustar gladkgladk NEPSetTrackAll

NEPSetTrackAll

Specifies if the solver must compute the residual of all approximate eigenpairs or not.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetTrackAll(NEP nep,PetscBool trackall)
Logically Collective on NEP

Input Parameters

nep - the eigensolver context
trackall - whether compute all residuals or not

Notes

If the user sets trackall=PETSC_TRUE then the solver explicitly computes the residual for each eigenpair approximation. Computing the residual is usually an expensive operation and solvers commonly compute the associated residual to the first unconverged eigenpair. The options '-nep_monitor_all' and '-nep_monitor_lg_all' automatically activate this option.

See Also

NEPGetTrackAll()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetConvergedReason.html0000644000175000017500000000546312211062077024267 0ustar gladkgladk NEPGetConvergedReason

NEPGetConvergedReason

Gets the reason why the NEPSolve() iteration was stopped.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetConvergedReason(NEP nep,NEPConvergedReason *reason)
Not Collective

Input Parameter

nep - the nonlinear eigensolver context

Output Parameter

reason - negative value indicates diverged, positive value converged

Possible values for reason

NEP_CONVERGED_FNORM_ABS - function norm satisfied absolute tolerance
NEP_CONVERGED_FNORM_RELATIVE - function norm satisfied relative tolerance
NEP_CONVERGED_SNORM_RELATIVE - step norm satisfied relative tolerance
NEP_DIVERGED_LINEAR_SOLVE - inner linear solve failed
NEP_DIVERGED_FUNCTION_COUNT - reached maximum allowed function evaluations
NEP_DIVERGED_MAX_IT - required more than its to reach convergence
NEP_DIVERGED_BREAKDOWN - generic breakdown in method
NEP_DIVERGED_FNORM_NAN - Inf or NaN detected in function evaluation

Note

Can only be called after the call to NEPSolve() is complete.

See Also

NEPSetTolerances(), NEPSolve(), NEPConvergedReason

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetWhichEigenpairs.html0000644000175000017500000000277712211062077024261 0ustar gladkgladk NEPGetWhichEigenpairs

NEPGetWhichEigenpairs

Returns which portion of the spectrum is to be sought.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetWhichEigenpairs(NEP nep,NEPWhich *which)
Not Collective

Input Parameter

nep - eigensolver context obtained from NEPCreate()

Output Parameter

which - the portion of the spectrum to be sought

Notes

See NEPSetWhichEigenpairs() for possible values of 'which'.

See Also

NEPSetWhichEigenpairs(), NEPWhich

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPProjectOperator.html0000644000175000017500000000404512211062077023660 0ustar gladkgladk NEPProjectOperator

NEPProjectOperator

Computes the projection of the nonlinear operator.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPProjectOperator(NEP nep,PetscInt j0,PetscInt j1,Vec f)
Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
j0 - initial index
j1 - final index
f - workspace vector

Notes

This is available for split operator only.

The nonlinear operator T(lambda) is projected onto span(V), where V is an orthonormal basis built internally by the solver. The projected operator is equal to sum_i V'*A_i*V*f_i(lambda), so this function computes all matrices Ei = V'*A_i*V, and stores them in the extra matrices inside DS. Only rows/columns in the range [j0,j1-1] are computed, the previous ones are assumed to be available already.

See Also

NEPSetSplitOperator()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetJacobian.html0000644000175000017500000000506712211062077022725 0ustar gladkgladk NEPSetJacobian

NEPSetJacobian

Sets the function to compute Jacobian T'(lambda) as well as the location to store the matrix.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetJacobian(NEP nep,Mat A,PetscErrorCode (*jac)(NEP,PetscScalar,Mat*,MatStructure*,void*),void *ctx)
Logically Collective on NEP and Mat

Input Parameters

nep - the NEP context
A - Jacobian matrix
jac - Jacobian evaluation routine (if NULL then NEP retains any previously set value)
ctx - [optional] user-defined context for private data for the Jacobian evaluation routine (may be NULL) (if NULL then NEP retains any previously set value)

Notes

The routine jac() takes Mat* as the matrix arguments rather than Mat. This allows the Jacobian evaluation routine to replace A with a completely new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations.

See Also

NEPSetFunction(), NEPGetJacobian()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetTolerances.html0000644000175000017500000000434012211062077023273 0ustar gladkgladk NEPGetTolerances

NEPGetTolerances

Gets the tolerance and maximum iteration count used by the NEP convergence tests.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetTolerances(NEP nep,PetscReal *abstol,PetscReal *rtol,PetscReal *stol,PetscInt *maxit,PetscInt *maxf)
Not Collective

Input Parameter

nep - the nonlinear eigensolver context

Output Parameters

abstol - absolute convergence tolerance
rtol - relative convergence tolerance
stol - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x ||
maxit - maximum number of iterations
maxf - maximum number of function evaluations

Notes

The user can specify NULL for any parameter that is not needed.

See Also

NEPSetTolerances()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetInitialSpace.html0000644000175000017500000000415612211062077023562 0ustar gladkgladk NEPSetInitialSpace

NEPSetInitialSpace

Specify a basis of vectors that constitute the initial space, that is, the subspace from which the solver starts to iterate.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetInitialSpace(NEP nep,PetscInt n,Vec *is)
Collective on NEP and Vec

Input Parameter

nep - the nonlinear eigensolver context
n - number of vectors
is - set of basis vectors of the initial space

Notes

Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored.

These vectors do not persist from one NEPSolve() call to the other, so the initial space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted eigenspace. Then, convergence may be faster.

Location: src/nep/interface/nepsetup.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPDestroy.html0000644000175000017500000000310412211062077022162 0ustar gladkgladk NEPDestroy

NEPDestroy

Destroys the NEP context.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPDestroy(NEP *nep)
Collective on NEP

Input Parameter

nep - eigensolver context obtained from NEPCreate()

See Also

NEPCreate(), NEPSetUp(), NEPSolve()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetIP.html0000644000175000017500000000227112211062077021505 0ustar gladkgladk NEPGetIP

NEPGetIP

Obtain the inner product object associated to the nonlinear eigensolver object.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetIP(NEP nep,IP *ip)
Not Collective

Input Parameters

nep - eigensolver context obtained from NEPCreate()

Output Parameter

ip - inner product context

See Also

NEPSetIP()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetType.html0000644000175000017500000000307612211062077022122 0ustar gladkgladk NEPGetType

NEPGetType

Gets the NEP type as a string from the NEP object.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetType(NEP nep,NEPType *type)
Not Collective

Input Parameter

nep - the eigensolver context

Output Parameter

name - name of NEP method

See Also

NEPSetType()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPMonitorCancel.html0000644000175000017500000000271012211062077023270 0ustar gladkgladk NEPMonitorCancel

NEPMonitorCancel

Clears all monitors for a NEP object.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPMonitorCancel(NEP nep)
Logically Collective on NEP

Input Parameters

nep - eigensolver context obtained from NEPCreate()

Options Database Key

-nep_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to NEPMonitorSet(), but does not cancel those set via the options database.

See Also

NEPMonitorSet()

Location: src/nep/interface/nepmon.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetConstCorrectionTol.html0000644000175000017500000000235512211062077024775 0ustar gladkgladk NEPGetConstCorrectionTol

NEPGetConstCorrectionTol

Returns the constant tolerance flag.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetConstCorrectionTol(NEP nep,PetscBool *cct)
Not Collective

Input Parameter

nep - the NEP context

Output Parameter

cct - the value of the constant tolerance flag

See Also

NEPSetConstCorrectionTol()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetFromOptions.html0000644000175000017500000000311712211062077023470 0ustar gladkgladk NEPSetFromOptions

NEPSetFromOptions

Sets NEP options from the options database. This routine must be called before NEPSetUp() if the user is to be allowed to set the solver type.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetFromOptions(NEP nep)
Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context

Notes

To see all options, run your program with the -help option.

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetSplitOperator.html0000644000175000017500000000537312211062077024026 0ustar gladkgladk NEPSetSplitOperator

NEPSetSplitOperator

Sets the operator of the nonlinear eigenvalue problem in split form.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetSplitOperator(NEP nep,PetscInt n,Mat A[],FN f[],MatStructure str)
Collective on NEP, Mat and FN

Input Parameters

nep - the nonlinear eigensolver context
n - number of terms in the split form
A - array of matrices
f - array of functions
str - structure flag for matrices

Notes

The nonlinear operator is written as T(lambda) = sum_i A_i*f_i(lambda), for i=1,...,n. The derivative T'(lambda) can be obtained using the derivatives of f_i.

The structure flag provides information about A_i's nonzero pattern (see MatStructure enum). If all matrices have the same pattern, then use SAME_NONZERO_PATTERN. If the patterns are different but contained in the pattern of the first one, then use SUBSET_NONZERO_PATTERN. Otherwise use DIFFERENT_NONZERO_PATTERN.

This function must be called before NEPSetUp(). If it is called again after NEPSetUp() then the NEP object is reset.

See Also

NEPGetSplitOperatorTerm(), NEPGetSplitOperatorInfo()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPComputeFunction.html0000644000175000017500000000437312211062077023664 0ustar gladkgladk NEPComputeFunction

NEPComputeFunction

Computes the function matrix T(lambda) that has been set with NEPSetFunction().

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPComputeFunction(NEP nep,PetscScalar lambda,Mat *A,Mat *B,MatStructure *flg)
Collective on NEP and Mat

Input Parameters

nep - the NEP context
lambda - the scalar argument

Output Parameters

A - Function matrix
B - optional preconditioning matrix
flg - flag indicating matrix structure (see MatStructure enum)

Notes

NEPComputeFunction() is typically used within nonlinear eigensolvers implementations, so most users would not generally call this routine themselves.

See Also

NEPSetFunction(), NEPGetFunction()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetWorkVecs.html0000644000175000017500000000261012211062077022751 0ustar gladkgladk NEPSetWorkVecs

NEPSetWorkVecs

Sets a number of work vectors into a NEP object

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetWorkVecs(NEP nep,PetscInt nw)
Collective on NEP

Input Parameters

nep - nonlinear eigensolver context
nw - number of work vectors to allocate

Developers Note

This is PETSC_EXTERN because it may be required by user plugin NEP implementations.

Location: src/nep/interface/nepdefault.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetWhichEigenpairs.html0000644000175000017500000001066412211062077024267 0ustar gladkgladk NEPSetWhichEigenpairs

NEPSetWhichEigenpairs

Specifies which portion of the spectrum is to be sought.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetWhichEigenpairs(NEP nep,NEPWhich which)
Logically Collective on NEP

Input Parameters

nep - eigensolver context obtained from NEPCreate()
which - the portion of the spectrum to be sought

Possible values

The parameter 'which' can have one of these values

NEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
NEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
NEP_LARGEST_REAL - largest real parts
NEP_SMALLEST_REAL - smallest real parts
NEP_LARGEST_IMAGINARY - largest imaginary parts
NEP_SMALLEST_IMAGINARY - smallest imaginary parts
NEP_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
NEP_TARGET_REAL - eigenvalues with real part closest to target
NEP_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target

Options Database Keys

-nep_largest_magnitude - Sets largest eigenvalues in magnitude
-nep_smallest_magnitude - Sets smallest eigenvalues in magnitude
-nep_largest_real - Sets largest real parts
-nep_smallest_real - Sets smallest real parts
-nep_largest_imaginary - Sets largest imaginary parts
-nep_smallest_imaginary - Sets smallest imaginary parts
-nep_target_magnitude - Sets eigenvalues closest to target
-nep_target_real - Sets real parts closest to target
-nep_target_imaginary - Sets imaginary parts closest to target

Notes

Not all eigensolvers implemented in NEP account for all the possible values stated above. If SLEPc is compiled for real numbers NEP_LARGEST_IMAGINARY and NEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part for eigenvalue selection.

See Also

NEPGetWhichEigenpairs(), NEPWhich

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetOptionsPrefix.html0000644000175000017500000000415412211062077024024 0ustar gladkgladk NEPSetOptionsPrefix

NEPSetOptionsPrefix

Sets the prefix used for searching for all NEP options in the database.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetOptionsPrefix(NEP nep,const char *prefix)
Logically Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
prefix - the prefix string to prepend to all NEP option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

For example, to distinguish between the runtime options for two different NEP contexts, one could call

      NEPSetOptionsPrefix(nep1,"neig1_")
      NEPSetOptionsPrefix(nep2,"neig2_")

See Also

NEPAppendOptionsPrefix(), NEPGetOptionsPrefix()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPConvergedReason.html0000644000175000017500000000311112211062077023613 0ustar gladkgladk NEPConvergedReason

NEPConvergedReason

Reason a nonlinear eigensolver was said to have converged or diverged

Synopsis

typedef enum {/* converged */
              NEP_CONVERGED_FNORM_ABS          =  2,
              NEP_CONVERGED_FNORM_RELATIVE     =  3,
              NEP_CONVERGED_SNORM_RELATIVE     =  4,
              /* diverged */
              NEP_DIVERGED_LINEAR_SOLVE        = -1,
              NEP_DIVERGED_FUNCTION_COUNT      = -2,
              NEP_DIVERGED_MAX_IT              = -3,
              NEP_DIVERGED_BREAKDOWN           = -4,
              NEP_DIVERGED_FNORM_NAN           = -5,
              NEP_CONVERGED_ITERATING          =  0} NEPConvergedReason;

See Also

NEPSolve(), NEPGetConvergedReason(), NEPSetTolerances()

Location: src/nep/../../include/slepcnep.h
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetType.html0000644000175000017500000000421312211062077022130 0ustar gladkgladk NEPSetType

NEPSetType

Selects the particular solver to be used in the NEP object.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetType(NEP nep,NEPType type)
Logically Collective on NEP

Input Parameters

nep - the nonlinear eigensolver context
type - a known method

Options Database Key

-nep_type <method> - Sets the method; use -help for a list of available methods

Notes

See "slepc/include/slepcnep.h" for available methods.

Normally, it is best to use the NEPSetFromOptions() command and then set the NEP type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The NEPSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database.

See Also

NEPType

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPView.html0000644000175000017500000000414712211062077021453 0ustar gladkgladk NEPView

NEPView

Prints the NEP data structure.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPView(NEP nep,PetscViewer viewer)
Collective on NEP

Input Parameters

nep - the nonlinear eigenproblem solver context
viewer - optional visualization context

Options Database Key

-nep_view - Calls NEPView() at end of NEPSolve()

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

PetscViewerASCIIOpen()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetFunction.html0000644000175000017500000000533712211062077023004 0ustar gladkgladk NEPSetFunction

NEPSetFunction

Sets the function to compute the nonlinear Function T(lambda) as well as the location to store the matrix.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetFunction(NEP nep,Mat A,Mat B,PetscErrorCode (*fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void *ctx)
Logically Collective on NEP and Mat

Input Parameters

nep - the NEP context
A - Function matrix
B - preconditioner matrix (usually same as the Function)
fun - Function evaluation routine (if NULL then NEP retains any previously set value)
ctx - [optional] user-defined context for private data for the Function evaluation routine (may be NULL) (if NULL then NEP retains any previously set value)

Notes

The routine fun() takes Mat* as the matrix arguments rather than Mat. This allows the Function evaluation routine to replace A and/or B with a completely new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations.

See Also

NEPGetFunction(), NEPSetJacobian()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetMonitorContext.html0000644000175000017500000000247512211062077024177 0ustar gladkgladk NEPGetMonitorContext

NEPGetMonitorContext

Gets the monitor context, as set by NEPMonitorSet() for the FIRST monitor only.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetMonitorContext(NEP nep,void **ctx)
Not Collective

Input Parameter

nep - eigensolver context obtained from NEPCreate()

Output Parameter

ctx - monitor context

See Also

NEPMonitorSet(), NEPDefaultMonitor()

Location: src/nep/interface/nepmon.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetEigenpair.html0000644000175000017500000000552612211062077023106 0ustar gladkgladk NEPGetEigenpair

NEPGetEigenpair

Gets the i-th solution of the eigenproblem as computed by NEPSolve(). The solution consists in both the eigenvalue and the eigenvector.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetEigenpair(NEP nep,PetscInt i,PetscScalar *eig,Vec V)
Logically Collective on NEP

Input Parameters

nep - nonlinear eigensolver context
i - index of the solution

Output Parameters

eig - eigenvalue
V - eigenvector

Notes

If PETSc is configured with real scalars, then complex eigenpairs cannot be obtained. Users should use a complex-scalar configuration. This behaviour is different to other SLEPc solvers such as EPS.

The index i should be a value between 0 and nconv-1 (see NEPGetConverged()). Eigenpairs are indexed according to the ordering criterion established with NEPSetWhichEigenpairs().

See Also

NEPSolve(), NEPGetConverged(), NEPSetWhichEigenpairs()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSortEigenvalues.html0000644000175000017500000000356212211062077023660 0ustar gladkgladk NEPSortEigenvalues

NEPSortEigenvalues

Sorts a list of eigenvalues according to the criterion specified via NEPSetWhichEigenpairs().

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSortEigenvalues(NEP nep,PetscInt n,PetscScalar *eig,PetscInt *perm)
Not Collective

Input Parameters

nep - the nonlinear eigensolver context
n - number of eigenvalues in the list
eig - pointer to the array containing the eigenvalues

Output Parameter

perm - resulting permutation

Note

The result is a list of indices in the original eigenvalue array corresponding to the first nev eigenvalues sorted in the specified criterion.

See Also

NEPSetWhichEigenpairs()

Location: src/nep/interface/nepsolve.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetTarget.html0000644000175000017500000000233212211062077022421 0ustar gladkgladk NEPGetTarget

NEPGetTarget

Gets the value of the target.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetTarget(NEP nep,PetscScalar* target)
Not Collective

Input Parameter

nep - eigensolver context

Output Parameter

target - the value of the target

Note

If the target was not set by the user, then zero is returned.

See Also

NEPSetTarget()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPGetDimensions.html0000644000175000017500000000411712211062077023306 0ustar gladkgladk NEPGetDimensions

NEPGetDimensions

Gets the number of eigenvalues to compute and the dimension of the subspace.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPGetDimensions(NEP nep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
Not Collective

Input Parameter

nep - the nonlinear eigensolver context

Output Parameters

nev - number of eigenvalues to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Notes

The user can specify NULL for any parameter that is not needed.

See Also

NEPSetDimensions()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPFinalizePackage.html0000644000175000017500000000206612211062077023554 0ustar gladkgladk NEPFinalizePackage

NEPFinalizePackage

This function destroys everything in the Slepc interface to the NEP package. It is called from SlepcFinalize().

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/nep/interface/nepbasic.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/NEP/NEPSetLagPreconditioner.html0000644000175000017500000000401312211062077024615 0ustar gladkgladk NEPSetLagPreconditioner

NEPSetLagPreconditioner

Determines when the preconditioner is rebuilt in the nonlinear solve.

Synopsis

#include "slepcnep.h" 
PetscErrorCode NEPSetLagPreconditioner(NEP nep,PetscInt lag)
Logically Collective on NEP

Input Parameters

nep - the NEP context
lag - 0 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within the nonlinear iteration, 2 means every second time the Jacobian is built, etc.

Options Database Keys

-nep_lag_preconditioner <lag> - Notes: The default is 1. The preconditioner is ALWAYS built in the first iteration of a nonlinear solve.

See Also

NEPGetLagPreconditioner()

Location: src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex22.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/0000755000175000017500000000000012214143515017300 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetDimensions.html0000644000175000017500000000254112211062077023301 0ustar gladkgladk MFNGetDimensions

MFNGetDimensions

Gets the dimension of the subspace used by the solver.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetDimensions(MFN mfn,PetscInt *ncv)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameter

ncv - the maximum dimension of the subspace to be used by the solver

See Also

MFNSetDimensions()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNCreate.html0000644000175000017500000000312012211062077021726 0ustar gladkgladk MFNCreate

MFNCreate

Creates the default MFN context.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNCreate(MPI_Comm comm,MFN *outmfn)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

mfn - location to put the MFN context

Note

The default MFN type is MFNKRYLOV

See Also

MFNSetUp(), MFNSolve(), MFNDestroy(), MFN

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetIterationNumber.html0000644000175000017500000000377412211062077024311 0ustar gladkgladk MFNGetIterationNumber

MFNGetIterationNumber

Gets the current iteration number. If the call to MFNSolve() is complete, then it returns the number of iterations carried out by the solution method.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetIterationNumber(MFN mfn,PetscInt *its)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameter

its - number of iterations

Note

During the i-th iteration this call returns i-1. If MFNSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call MFNGetConvergedReason() to determine if the solver converged or failed and why.

See Also

MFNGetConvergedReason(), MFNSetTolerances()

Location: src/mfn/interface/mfnsolve.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetFromOptions.html0000644000175000017500000000256712211062077023474 0ustar gladkgladk MFNSetFromOptions

MFNSetFromOptions

Sets MFN options from the options database. This routine must be called before MFNSetUp() if the user is to be allowed to set the solver type.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetFromOptions(MFN mfn)
Collective on MFN

Input Parameters

mfn - the matrix function context

Notes

To see all options, run your program with the -help option.

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetOptionsPrefix.html0000644000175000017500000000273612211062077024010 0ustar gladkgladk MFNGetOptionsPrefix

MFNGetOptionsPrefix

Gets the prefix used for searching for all MFN options in the database.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetOptionsPrefix(MFN mfn,const char *prefix[])
Not Collective

Input Parameters

mfn - the matrix function context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

MFNSetOptionsPrefix(), MFNAppendOptionsPrefix()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNInitializePackage.html0000644000175000017500000000222012211062077024100 0ustar gladkgladk MFNInitializePackage

MFNInitializePackage

This function initializes everything in the MFN package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to MFNCreate() when using static libraries.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNInitializePackage(void)

See Also

SlepcInitialize()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetScaleFactor.html0000644000175000017500000000322012211062077023366 0ustar gladkgladk MFNSetScaleFactor

MFNSetScaleFactor

Sets the scale factor to multiply the matrix (the argument of the function).

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetScaleFactor(MFN mfn,PetscScalar alpha)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
alpha - the scaling factor

Options Database Keys

-mfn_scale <alpha> - Sets the scaling factor

Notes

The computed result is f(alpha*A)*b. The default is alpha=1.0.

See Also

MFNGetScaleFactor(), MFNSolve()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNType.html0000644000175000017500000000166012211062077021453 0ustar gladkgladk MFNType

MFNType

String with the name of a method for computing matrix functions.

Synopsis

typedef const char* MFNType;
#define MFNKRYLOV   "krylov"

See Also

MFNSetType(), MFN

Location: src/mfn/../../include/slepcmfn.h
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetType.html0000644000175000017500000000232512211062077022112 0ustar gladkgladk MFNGetType

MFNGetType

Gets the MFN type as a string from the MFN object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetType(MFN mfn,MFNType *type)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameter

name - name of MFN method

See Also

MFNSetType()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNReset.html0000644000175000017500000000224012211062077021607 0ustar gladkgladk MFNReset

MFNReset

Resets the MFN context to the setupcalled=0 state and removes any allocated objects.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNReset(MFN mfn)
Collective on MFN

Input Parameter

mfn - matrix function context obtained from MFNCreate()

See Also

MFNDestroy()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNConvergedReason.html0000644000175000017500000000250412211062077023614 0ustar gladkgladk MFNConvergedReason

MFNConvergedReason

reason a matrix function iteration was said to have converged or diverged

Synopsis

typedef enum {/* converged */
              MFN_CONVERGED_TOL                =  2,
              /* diverged */
              MFN_DIVERGED_ITS                 = -3,
              MFN_DIVERGED_BREAKDOWN           = -4,
              MFN_CONVERGED_ITERATING          =  0} MFNConvergedReason;

See Also

MFNSolve(), MFNGetConvergedReason(), MFNSetTolerances()

Location: src/mfn/../../include/slepcmfn.h
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetType.html0000644000175000017500000000422612211062077022130 0ustar gladkgladk MFNSetType

MFNSetType

Selects the particular solver to be used in the MFN object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetType(MFN mfn,MFNType type)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
type - a known method

Options Database Key

-mfn_type <method> - Sets the method; use -help for a list of available methods

Notes

See "slepc/include/slepcmfn.h" for available methods. The default is MFNKRYLOV

Normally, it is best to use the MFNSetFromOptions() command and then set the MFN type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The MFNSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database.

See Also

MFNType

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetFunction.html0000644000175000017500000000331712211062077022774 0ustar gladkgladk MFNSetFunction

MFNSetFunction

Specifies the function to be computed.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetFunction(MFN mfn,SlepcFunction fun)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
fun - a known function

Options Database Keys

-mfn_exp - matrix exponential

See Also

MFNSetOperator(), MFNSetType(), MFNGetFunction(), SlepcFunction

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNMonitorSet.html0000644000175000017500000000716212211062077022640 0ustar gladkgladk MFNMonitorSet

MFNMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor convergence.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNMonitorSet(MFN mfn,PetscErrorCode (*monitor)(MFN,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Logically Collective on MFN

Input Parameters

mfn - matrix function context obtained from MFNCreate()
monitor - pointer to function (if this is NULL, it turns off monitoring)
mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired)
monitordestroy - [optional] routine that frees monitor context (may be NULL)

Calling Sequence of monitor

    monitor (MFN mfn, int its, PetscReal errest, void *mctx)

mfn - matrix function context obtained from MFNCreate()
its - iteration number
errest - error estimate
mctx - optional monitoring context, as set by MFNMonitorSet()

Options Database Keys

-mfn_monitor - print the error estimate
-mfn_monitor_lg - sets line graph monitor for the error estimate
-mfn_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to MFNMonitorSet(), but does not cancel those set via the options database.

Notes

Several different monitoring routines may be set by calling MFNMonitorSet() multiple times; all will be called in the order in which they were set.

See Also

MFNMonitorFirst(), MFNMonitorAll(), MFNMonitorCancel()

Location: src/mfn/interface/mfnmon.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNDestroy.html0000644000175000017500000000256612211062077022171 0ustar gladkgladk MFNDestroy

MFNDestroy

Destroys the MFN context.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNDestroy(MFN *mfn)
Collective on MFN

Input Parameter

mfn - matrix function context obtained from MFNCreate()

See Also

MFNCreate(), MFNSetUp(), MFNSolve()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetTolerances.html0000644000175000017500000000441312211062077023304 0ustar gladkgladk MFNSetTolerances

MFNSetTolerances

Sets the tolerance and maximum iteration count used by the MFN convergence tests.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetTolerances(MFN mfn,PetscReal tol,PetscInt maxits)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
tol - the convergence tolerance
maxits - maximum number of iterations to use

Options Database Keys

-mfn_tol <tol> - Sets the convergence tolerance
-mfn_max_it <maxits> - Sets the maximum number of iterations allowed

Notes

Pass 0 for an argument that need not be changed.

Use PETSC_DECIDE for maxits to assign a reasonably good value, which is dependent on the solution method.

See Also

MFNGetTolerances()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetDS.html0000644000175000017500000000302612211062077021512 0ustar gladkgladk MFNSetDS

MFNSetDS

Associates a direct solver object to the matrix function solver.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetDS(MFN mfn,DS ds)
Collective on MFN

Input Parameters

mfn - matrix function context obtained from MFNCreate()
ds - the direct solver object

Note

Use MFNGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations).

See Also

MFNGetDS()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFN.html0000644000175000017500000000153612211062077020613 0ustar gladkgladk MFN

MFN

SLEPc object that encapsulates functionality for matrix functions.

Synopsis

typedef struct _p_MFN* MFN;

See Also

MFNCreate()

Location: src/mfn/../../include/slepcmfn.h
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetUp.html0000644000175000017500000000270712211062077021575 0ustar gladkgladk MFNSetUp

MFNSetUp

Sets up all the internal data structures necessary for the execution of the matrix function solver.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetUp(MFN mfn)
Collective on MFN

Input Parameter

mfn - matrix function context

Notes

This function need not be called explicitly in most cases, since MFNSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time.

See Also

MFNCreate(), MFNSolve(), MFNDestroy()

Location: src/mfn/interface/mfnsetup.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetIP.html0000644000175000017500000000302712211062077021515 0ustar gladkgladk MFNSetIP

MFNSetIP

Associates an inner product object to the matrix function solver.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetIP(MFN mfn,IP ip)
Collective on MFN

Input Parameters

mfn - matrix function context obtained from MFNCreate()
ip - the inner product object

Note

Use MFNGetIP() to retrieve the inner product context (for example, to free it at the end of the computations).

See Also

MFNGetIP()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetOptionsPrefix.html0000644000175000017500000000414412211062077024017 0ustar gladkgladk MFNSetOptionsPrefix

MFNSetOptionsPrefix

Sets the prefix used for searching for all MFN options in the database.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetOptionsPrefix(MFN mfn,const char *prefix)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
prefix - the prefix string to prepend to all MFN option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

For example, to distinguish between the runtime options for two different MFN contexts, one could call

      MFNSetOptionsPrefix(mfn1,"fun1_")
      MFNSetOptionsPrefix(mfn2,"fun2_")

See Also

MFNAppendOptionsPrefix(), MFNGetOptionsPrefix()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetErrorIfNotConverged.html0000644000175000017500000000253512211062077025062 0ustar gladkgladk MFNGetErrorIfNotConverged

MFNGetErrorIfNotConverged

Return a flag indicating whether MFNSolve() will generate an error if the solver does not converge.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetErrorIfNotConverged(MFN mfn,PetscBool *flag)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameter

flag - PETSC_TRUE if it will generate an error, else PETSC_FALSE

See Also

MFNSetErrorIfNotConverged()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSolve.html0000644000175000017500000000614012211062077021620 0ustar gladkgladk MFNSolve

MFNSolve

Solves the matrix function problem. Given a vector b, the vector x = f(alpha*A)*b is returned.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSolve(MFN mfn,Vec b,Vec x)
Collective on MFN

Input Parameters

mfn - matrix function context obtained from MFNCreate()
b - the right hand side vector

Output Parameter

x - the solution

Options Database Keys

-mfn_view - print information about the solver used
-mfn_view_mat binary - save the matrix to the default binary viewer
-mfn_view_rhs binary - save right hand side vector to the default binary viewer
-mfn_view_solution binary - save computed solution vector to the default binary viewer

Notes

The matrix A is specified with MFNSetOperator(). The function f is specified with MFNSetFunction(). The scalar alpha is specified with MFNSetScaleFactor().

See Also

MFNCreate(), MFNSetUp(), MFNDestroy(), MFNSetTolerances(),
MFNSetOperator(), MFNSetFunction(), MFNSetScaleFactor()

Location: src/mfn/interface/mfnsolve.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNAppendOptionsPrefix.html0000644000175000017500000000337612211062077024501 0ustar gladkgladk MFNAppendOptionsPrefix

MFNAppendOptionsPrefix

Appends to the prefix used for searching for all MFN options in the database.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNAppendOptionsPrefix(MFN mfn,const char *prefix)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
prefix - the prefix string to prepend to all MFN option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

MFNSetOptionsPrefix(), MFNGetOptionsPrefix()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetIP.html0000644000175000017500000000226312211062077021502 0ustar gladkgladk MFNGetIP

MFNGetIP

Obtain the inner product object associated to the eigensolver object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetIP(MFN mfn,IP *ip)
Not Collective

Input Parameters

mfn - matrix function context obtained from MFNCreate()

Output Parameter

ip - inner product context

See Also

MFNSetIP()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/index.html0000644000175000017500000001030312211062077021272 0ustar gladkgladk Matrix Function - MFN

Matrix Function - MFN: Examples

Matrix Function (MFN) is the object provided by SLEPc for computing the action of a matrix function on a vector. Given a matrix A and a vector b, the call MFNSolve(mfn,b,x) computes x=f(A)b, where f is a function such as the exponential.

Beginner - Basic usage
MFN MFNSetFromOptions MFNType
MFNConvergedReason MFNSetFunction MFNView
MFNCreate MFNSetOperator
MFNDestroy MFNSolve
Intermediate - Setting options for algorithms and data structures
MFNGetConvergedReason MFNGetOperator MFNMonitorSet
MFNGetDimensions MFNGetScaleFactor MFNSetDimensions
MFNGetErrorIfNotConverged MFNGetTolerances MFNSetErrorIfNotConverged
MFNGetFunction MFNGetType MFNSetScaleFactor
MFNGetIterationNumber MFNMonitorCancel MFNSetTolerances
MFNGetMonitorContext MFNMonitorDefault MFNSetType
Advanced - Setting more advanced options and customization
MFNAppendOptionsPrefix MFNRegister MFNSetIP
MFNGetDS MFNRegisterAll MFNSetOptionsPrefix
MFNGetIP MFNReset MFNSetUp
MFNGetOptionsPrefix MFNSetDS
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
MFNFinalizePackage MFNInitializePackage
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetTolerances.html0000644000175000017500000000334412211062077023272 0ustar gladkgladk MFNGetTolerances

MFNGetTolerances

Gets the tolerance and maximum iteration count used by the MFN convergence tests.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetTolerances(MFN mfn,PetscReal *tol,PetscInt *maxits)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameters

tol - the convergence tolerance
maxits - maximum number of iterations

Notes

The user can specify NULL for any parameter that is not needed.

See Also

MFNSetTolerances()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetDS.html0000644000175000017500000000226712211062077021504 0ustar gladkgladk MFNGetDS

MFNGetDS

Obtain the direct solver object associated to the matrix function object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetDS(MFN mfn,DS *ds)
Not Collective

Input Parameters

mfn - matrix function context obtained from MFNCreate()

Output Parameter

ds - direct solver context

See Also

MFNSetDS()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNRegisterAll.html0000644000175000017500000000170512211062077022747 0ustar gladkgladk MFNRegisterAll

MFNRegisterAll

Registers all the matrix functions in the MFN package.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNRegisterAll(void)
Not Collective

See Also

MFNRegister()

Location: src/mfn/interface/mfnregis.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetFunction.html0000644000175000017500000000225012211062077022753 0ustar gladkgladk MFNGetFunction

MFNGetFunction

Gets the function from the MFN object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetFunction(MFN mfn,SlepcFunction *fun)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameter

fun - function

See Also

MFNSetFunction(), SlepcFunction

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetScaleFactor.html0000644000175000017500000000256212211062077023362 0ustar gladkgladk MFNGetScaleFactor

MFNGetScaleFactor

Gets the factor used for scaling the matrix.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetScaleFactor(MFN mfn,PetscScalar *alpha)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameters

alpha - the scaling factor

See Also

MFNSetScaleFactor(), MFNSolve()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetOperator.html0000644000175000017500000000250512211062077022764 0ustar gladkgladk MFNGetOperator

MFNGetOperator

Gets the matrix associated with the MFN object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetOperator(MFN mfn,Mat *A)
Collective on MFN and Mat

Input Parameter

mfn - the MFN context

Output Parameters

A - the matrix for which the matrix function is to be computed

See Also

MFNSolve(), MFNSetOperator()

Location: src/mfn/interface/mfnsetup.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNMonitorDefault.html0000644000175000017500000000314412211062077023465 0ustar gladkgladk MFNMonitorDefault

MFNMonitorDefault

Print the error estimate of the current approximation at each iteration of the matrix function solver.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNMonitorDefault(MFN mfn,PetscInt its,PetscReal errest,void *monctx)
Collective on MFN

Input Parameters

mfn - matrix function context
its - iteration number
errest - error estimate
monctx - monitor context (contains viewer, can be NULL)

See Also

MFNMonitorSet()

Location: src/mfn/interface/mfnmon.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNRegister.html0000644000175000017500000000355212211062077022320 0ustar gladkgladk MFNRegister

MFNRegister

Adds a method to the matrix function solver package.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNRegister(const char *name,PetscErrorCode (*function)(MFN))
Not Collective

Input Parameters

name - name of a new user-defined solver
function - routine to create the solver context

Notes

MFNRegister() may be called multiple times to add several user-defined solvers.

Sample usage

   MFNRegister("my_solver",MySolverCreate);

Then, your solver can be chosen with the procedural interface via

    MFNSetType(mfn,"my_solver")
or at runtime via the option
    -mfn_type my_solver

See Also

MFNRegisterAll()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetOperator.html0000644000175000017500000000350012211062077022774 0ustar gladkgladk MFNSetOperator

MFNSetOperator

Sets the matrix for which the matrix function is to be computed.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetOperator(MFN mfn,Mat A)
Collective on MFN and Mat

Input Parameters

mfn - the matrix function context
A - the problem matrix

Notes

It must be called after MFNSetUp(). If it is called again after MFNSetUp() then the MFN object is reset.

See Also

MFNSolve(), MFNSetUp(), MFNReset()

Location: src/mfn/interface/mfnsetup.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetDimensions.html0000644000175000017500000000322312211062077023313 0ustar gladkgladk MFNSetDimensions

MFNSetDimensions

Sets the dimension of the subspace to be used by the solver.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetDimensions(MFN mfn,PetscInt ncv)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
ncv - the maximum dimension of the subspace to be used by the solver

Options Database Keys

-mfn_ncv <ncv> - Sets the dimension of the subspace

Notes

Use PETSC_DECIDE for ncv to assign a reasonably good value, which is dependent on the solution method.

See Also

MFNGetDimensions()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetConvergedReason.html0000644000175000017500000000451012211062077024253 0ustar gladkgladk MFNGetConvergedReason

MFNGetConvergedReason

Gets the reason why the MFNSolve() iteration was stopped.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetConvergedReason(MFN mfn,MFNConvergedReason *reason)
Not Collective

Input Parameter

mfn - the matrix function context

Output Parameter

reason - negative value indicates diverged, positive value converged

Possible values for reason

MFN_CONVERGED_TOL - converged up to tolerance
MFN_DIVERGED_ITS - required more than its to reach convergence
MFN_DIVERGED_BREAKDOWN - generic breakdown in method

Note

Can only be called after the call to MFNSolve() is complete.

See Also

MFNSetTolerances(), MFNSolve(), MFNConvergedReason, MFNSetErrorIfNotConverged()

Location: src/mfn/interface/mfnsolve.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mfn/examples/tutorials/ex23.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNSetErrorIfNotConverged.html0000644000175000017500000000367212211062077025101 0ustar gladkgladk MFNSetErrorIfNotConverged

MFNSetErrorIfNotConverged

Causes MFNSolve() to generate an error if the solver has not converged.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNSetErrorIfNotConverged(MFN mfn,PetscBool flg)
Logically Collective on MFN

Input Parameters

mfn - the matrix function context
flg - PETSC_TRUE indicates you want the error generated

Options Database Keys

-mfn_error_if_not_converged - this takes an optional truth value (0/1/no/yes/true/false)

Note

Normally SLEPc continues if the solver fails to converge, you can call MFNGetConvergedReason() after a MFNSolve() to determine if it has converged.

See Also

MFNGetErrorIfNotConverged()

Location: src/mfn/interface/mfnopts.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNGetMonitorContext.html0000644000175000017500000000245412211062077024170 0ustar gladkgladk MFNGetMonitorContext

MFNGetMonitorContext

Gets the monitor context, as set by MFNMonitorSet() for the FIRST monitor only.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNGetMonitorContext(MFN mfn,void **ctx)
Not Collective

Input Parameter

mfn - matrix function context obtained from MFNCreate()

Output Parameter

ctx - monitor context

See Also

MFNMonitorSet()

Location: src/mfn/interface/mfnmon.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNView.html0000644000175000017500000000414012211062077021440 0ustar gladkgladk MFNView

MFNView

Prints the MFN data structure.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNView(MFN mfn,PetscViewer viewer)
Collective on MFN

Input Parameters

mfn - the matrix function solver context
viewer - optional visualization context

Options Database Key

-mfn_view - Calls MFNView() at end of MFNSolve()

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

PetscViewerASCIIOpen()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNMonitorCancel.html0000644000175000017500000000271512211062077023271 0ustar gladkgladk MFNMonitorCancel

MFNMonitorCancel

Clears all monitors for an MFN object.

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNMonitorCancel(MFN mfn)
Logically Collective on MFN

Input Parameters

mfn - matrix function context obtained from MFNCreate()

Options Database Key

-mfn_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to MFNMonitorSet(), but does not cancel those set via the options database.

See Also

MFNMonitorSet()

Location: src/mfn/interface/mfnmon.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/MFN/MFNFinalizePackage.html0000644000175000017500000000206612211062077023550 0ustar gladkgladk MFNFinalizePackage

MFNFinalizePackage

This function destroys everything in the SLEPc interface to the MFN package. It is called from SlepcFinalize().

Synopsis

#include "slepcmfn.h" 
PetscErrorCode MFNFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/mfn/interface/mfnbasic.c
Index of all MFN routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/0000755000175000017500000000000012214143515017314 5ustar gladkgladkslepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetTrackAll.html0000644000175000017500000000226512211062077022721 0ustar gladkgladk SVDGetTrackAll

SVDGetTrackAll

Returns the flag indicating whether all residual norms must be computed or not.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetTrackAll(SVD svd,PetscBool *trackall)
Not Collective

Input Parameter

svd - the singular value solver context

Output Parameter

trackall - the returned flag

See Also

SVDSetTrackAll()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetIP.html0000644000175000017500000000230312211062077021525 0ustar gladkgladk SVDGetIP

SVDGetIP

Obtain the inner product object associated to the singular value solver object.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetIP(SVD svd,IP *ip)
Not Collective

Input Parameters

svd - singular value solver context obtained from SVDCreate()

Output Parameter

ip - inner product context

See Also

SVDSetIP()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetFromOptions.html0000644000175000017500000000336012211062077023514 0ustar gladkgladk SVDSetFromOptions

SVDSetFromOptions

Sets SVD options from the options database. This routine must be called before SVDSetUp() if the user is to be allowed to set the solver type.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetFromOptions(SVD svd)
Collective on SVD

Input Parameters

svd - the singular value solver context

Notes

To see all options, run your program with the -help option.

See Also


Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetMonitorContext.html0000644000175000017500000000246212211062077024217 0ustar gladkgladk SVDGetMonitorContext

SVDGetMonitorContext

Gets the monitor context, as set by SVDMonitorSet() for the FIRST monitor only.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetMonitorContext(SVD svd,void **ctx)
Not Collective

Input Parameter

svd - singular value solver context obtained from SVDCreate()

Output Parameter

ctx - monitor context

See Also

SVDMonitorSet()

Location: src/svd/interface/svdmon.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCreate.html0000644000175000017500000000361212211062077021764 0ustar gladkgladk SVDCreate

SVDCreate

Creates the default SVD context.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDCreate(MPI_Comm comm,SVD *outsvd)
Collective on MPI_Comm

Input Parameter

comm - MPI communicator

Output Parameter

svd - location to put the SVD context

Note

The default SVD type is SVDCROSS

See Also

SVDSetUp(), SVDSolve(), SVDDestroy(), SVD

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDRegister.html0000644000175000017500000000355112211062077022347 0ustar gladkgladk SVDRegister

SVDRegister

Adds a method to the singular value solver package.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDRegister(const char *name,PetscErrorCode (*function)(SVD))
Not Collective

Input Parameters

name - name of a new user-defined solver
function - routine to create the solver context

Notes

SVDRegister() may be called multiple times to add several user-defined solvers.

Sample usage

   SVDRegister("my_solver",MySolverCreate);

Then, your solver can be chosen with the procedural interface via

    SVDSetType(svd,"my_solver")
or at runtime via the option
    -svd_type my_solver

See Also

SVDRegisterAll()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDAppendOptionsPrefix.html0000644000175000017500000000340412211062077024521 0ustar gladkgladk SVDAppendOptionsPrefix

SVDAppendOptionsPrefix

Appends to the prefix used for searching for all SVD options in the database.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDAppendOptionsPrefix(SVD svd,const char *prefix)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
prefix - the prefix string to prepend to all SVD option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

See Also

SVDSetOptionsPrefix(), SVDGetOptionsPrefix()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCrossGetEPS.html0000644000175000017500000000232612211062077022663 0ustar gladkgladk SVDCrossGetEPS

SVDCrossGetEPS

Retrieve the eigensolver object (EPS) associated to the singular value solver.

Synopsis

#include "slepcsvd.h" 
#include "slepceps.h" 
PetscErrorCode SVDCrossGetEPS(SVD svd,EPS *eps)
Not Collective

Input Parameter

svd - singular value solver

Output Parameter

eps - the eigensolver object

See Also

SVDCrossSetEPS()

Location: src/svd/impls/cross/cross.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetWhichSingularTriplets.html0000644000175000017500000000307512211062077025522 0ustar gladkgladk SVDGetWhichSingularTriplets

SVDGetWhichSingularTriplets

Returns which singular triplets are to be sought.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetWhichSingularTriplets(SVD svd,SVDWhich *which)
Not Collective

Input Parameter

svd - singular value solver context obtained from SVDCreate()

Output Parameter

which - which singular triplets are to be sought

Notes

See SVDSetWhichSingularTriplets() for possible values of which

See Also

SVDSetWhichSingularTriplets(), SVDWhich

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDView.html0000644000175000017500000000422012211062077021467 0ustar gladkgladk SVDView

SVDView

Prints the SVD data structure.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDView(SVD svd,PetscViewer viewer)
Collective on SVD

Input Parameters

svd - the singular value solver context
viewer - optional visualization context

Options Database Key

-svd_view - Calls SVDView() at end of SVDSolve()

Note

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - standard output (default)
PETSC_VIEWER_STDOUT_WORLD - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

The user can open an alternative visualization context with PetscViewerASCIIOpen() - output to a specified file.

See Also

STView(), PetscViewerASCIIOpen()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDRegisterAll.html0000644000175000017500000000171312211062077022776 0ustar gladkgladk SVDRegisterAll

SVDRegisterAll

Registers all the singular value solvers in the SVD package.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDRegisterAll(void)
Not Collective

See Also

SVDRegister()

Location: src/svd/interface/svdregis.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetIterationNumber.html0000644000175000017500000000376512211062077024341 0ustar gladkgladk SVDGetIterationNumber

SVDGetIterationNumber

Gets the current iteration number. If the call to SVDSolve() is complete, then it returns the number of iterations carried out by the solution method.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetIterationNumber(SVD svd,PetscInt *its)
Not Collective

Input Parameter

svd - the singular value solver context

Output Parameter

its - number of iterations

Notes

During the i-th iteration this call returns i-1. If SVDSolve() is complete, then parameter "its" contains either the iteration number at which convergence was successfully reached, or failure was detected. Call SVDGetConvergedReason() to determine if the solver converged or failed and why.

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCyclicSetEPS.html0000644000175000017500000000256112211062077023015 0ustar gladkgladk SVDCyclicSetEPS

SVDCyclicSetEPS

Associate an eigensolver object (EPS) to the singular value solver.

Synopsis

#include "slepcsvd.h" 
#include "slepceps.h" 
PetscErrorCode SVDCyclicSetEPS(SVD svd,EPS eps)
Collective on SVD

Input Parameters

svd - singular value solver
eps - the eigensolver object

See Also

SVDCyclicGetEPS()

Location: src/svd/impls/cyclic/cyclic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDTRLanczosSetOneSide.html0000644000175000017500000000351512211062077024365 0ustar gladkgladk SVDTRLanczosSetOneSide

SVDTRLanczosSetOneSide

Indicate if the variant of the Lanczos method to be used is one-sided or two-sided.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDTRLanczosSetOneSide(SVD svd,PetscBool oneside)
Logically Collective on SVD

Input Parameters

svd - singular value solver
oneside - boolean flag indicating if the method is one-sided or not

Options Database Key

-svd_trlanczos_oneside <boolean> - Indicates the boolean flag

Note

By default, a two-sided variant is selected, which is sometimes slightly more robust. However, the one-sided variant is faster because it avoids the orthogonalization associated to left singular vectors.

See Also

SVDLanczosSetOneSide()

Location: src/svd/impls/trlanczos/trlanczos.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDComputeResidualNorms.html0000644000175000017500000000436612211062077024714 0ustar gladkgladk SVDComputeResidualNorms

SVDComputeResidualNorms

Computes the norms of the residual vectors associated with the i-th computed singular triplet.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDComputeResidualNorms(SVD svd,PetscInt i,PetscReal *norm1,PetscReal *norm2)
Collective on SVD

Input Parameters

svd - the singular value solver context
i - the solution index

Output Parameters

norm1 - the norm ||A*v-sigma*u||_2 where sigma is the singular value, u and v are the left and right singular vectors.
norm2 - the norm ||A^T*u-sigma*v||_2 with the same sigma, u and v

Note

The index i should be a value between 0 and nconv-1 (see SVDGetConverged()). Both output parameters can be NULL on input if not needed.

See Also

SVDSolve(), SVDGetConverged(), SVDComputeRelativeError()

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetInitialSpaceLeft.html0000644000175000017500000000402312211062077024412 0ustar gladkgladk SVDSetInitialSpaceLeft

SVDSetInitialSpaceLeft

Specify a basis of vectors that constitute the initial left space, that is, a rough approximation to the left singular subspace from which the solver starts to iterate.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetInitialSpaceLeft(SVD svd,PetscInt n,Vec *is)
Collective on SVD and Vec

Input Parameter

svd - the singular value solver context
n - number of vectors
is - set of basis vectors of the initial space

Notes

Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored.

These vectors do not persist from one SVDSolve() call to the other, so the initial space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted singular space. Then, convergence may be faster.

Location: src/svd/interface/svdsetup.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetType.html0000644000175000017500000000311212211062077022135 0ustar gladkgladk SVDGetType

SVDGetType

Gets the SVD type as a string from the SVD object.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetType(SVD svd,SVDType *type)
Not Collective

Input Parameter

svd - the singular value solver context

Output Parameter

name - name of SVD method

See Also

SVDSetType()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDReset.html0000644000175000017500000000224612211062077021645 0ustar gladkgladk SVDReset

SVDReset

Resets the SVD context to the setupcalled=0 state and removes any allocated objects.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDReset(SVD svd)
Collective on SVD

Input Parameter

svd - singular value solver context obtained from SVDCreate()

See Also

SVDDestroy()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetDS.html0000644000175000017500000000230312211062077021523 0ustar gladkgladk SVDGetDS

SVDGetDS

Obtain the direct solver object associated to the singular value solver object.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetDS(SVD svd,DS *ds)
Not Collective

Input Parameters

svd - singular value solver context obtained from SVDCreate()

Output Parameter

ds - direct solver context

See Also

SVDSetDS()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDConvergedReason.html0000644000175000017500000000250112211062077023641 0ustar gladkgladk SVDConvergedReason

SVDConvergedReason

Reason a singular value solver was said to have converged or diverged

Synopsis

typedef enum {/* converged */
              SVD_CONVERGED_TOL                =  2,
              /* diverged */
              SVD_DIVERGED_ITS                 = -3,
              SVD_DIVERGED_BREAKDOWN           = -4,
              SVD_CONVERGED_ITERATING          =  0 } SVDConvergedReason;

See Also

SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances()

Location: src/svd/../../include/slepcsvd.h
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDMonitorAll.html0000644000175000017500000000422312211062077022640 0ustar gladkgladk SVDMonitorAll

SVDMonitorAll

Print the current approximate values and error estimates at each iteration of the singular value solver.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDMonitorAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
Collective on SVD

Input Parameters

svd - singular value solver context
its - iteration number
nconv - number of converged singular triplets so far
sigma - singular values
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorConverged()

Location: src/svd/interface/svdmon.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetSingularTriplet.html0000644000175000017500000000521012211062077024345 0ustar gladkgladk SVDGetSingularTriplet

SVDGetSingularTriplet

Gets the i-th triplet of the singular value decomposition as computed by SVDSolve(). The solution consists in the singular value and its left and right singular vectors.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetSingularTriplet(SVD svd,PetscInt i,PetscReal *sigma,Vec u,Vec v)
Not Collective, but vectors are shared by all processors that share the SVD

Input Parameters

svd - singular value solver context
i - index of the solution

Output Parameters

sigma - singular value
u - left singular vector
v - right singular vector

Note

The index i should be a value between 0 and nconv-1 (see SVDGetConverged()). Both U or V can be NULL if singular vectors are not required.

See Also

SVDSolve(), SVDGetConverged()

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetTrackAll.html0000644000175000017500000000347112211062077022735 0ustar gladkgladk SVDSetTrackAll

SVDSetTrackAll

Specifies if the solver must compute the residual norm of all approximate singular value or not.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetTrackAll(SVD svd,PetscBool trackall)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
trackall - whether to compute all residuals or not

Notes

If the user sets trackall=PETSC_TRUE then the solver computes (or estimates) the residual norm for each singular value approximation. Computing the residual is usually an expensive operation and solvers commonly compute only the residual associated to the first unconverged singular value.

The options '-svd_monitor_all' and '-svd_monitor_lg_all' automatically activate this option.

See Also

SVDGetTrackAll()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDLanczosSetOneSide.html0000644000175000017500000000360112211062077024113 0ustar gladkgladk SVDLanczosSetOneSide

SVDLanczosSetOneSide

Indicate if the variant of the Lanczos method to be used is one-sided or two-sided.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDLanczosSetOneSide(SVD svd,PetscBool oneside)
Logically Collective on SVD

Input Parameters

svd - singular value solver
oneside - boolean flag indicating if the method is one-sided or not

Options Database Key

-svd_lanczos_oneside <boolean> - Indicates the boolean flag

Note

By default, a two-sided variant is selected, which is sometimes slightly more robust. However, the one-sided variant is faster because it avoids the orthogonalization associated to left singular vectors. It also saves the memory required for storing such vectors.

See Also

SVDTRLanczosSetOneSide()

Location: src/svd/impls/lanczos/gklanczos.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDTRLanczosGetOneSide.html0000644000175000017500000000243512211062077024351 0ustar gladkgladk SVDTRLanczosGetOneSide

SVDTRLanczosGetOneSide

Gets if the variant of the Lanczos method to be used is one-sided or two-sided.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDTRLanczosGetOneSide(SVD svd,PetscBool *oneside)
Not Collective

Input Parameters

svd - singular value solver

Output Parameters

oneside - boolean flag indicating if the method is one-sided or not

See Also

SVDTRLanczosSetOneSide()

Location: src/svd/impls/trlanczos/trlanczos.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetInitialSpace.html0000644000175000017500000000400712211062077023601 0ustar gladkgladk SVDSetInitialSpace

SVDSetInitialSpace

Specify a basis of vectors that constitute the initial (right) space, that is, a rough approximation to the right singular subspace from which the solver starts to iterate.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetInitialSpace(SVD svd,PetscInt n,Vec *is)
Collective on SVD and Vec

Input Parameter

svd - the singular value solver context
n - number of vectors
is - set of basis vectors of the initial space

Notes

Some solvers start to iterate on a single vector (initial vector). In that case, the other vectors are ignored.

These vectors do not persist from one SVDSolve() call to the other, so the initial space should be set every time.

The vectors do not need to be mutually orthonormal, since they are explicitly orthonormalized internally.

Common usage of this function is when the user can provide a rough approximation of the wanted singular space. Then, convergence may be faster.

Location: src/svd/interface/svdsetup.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetUp.html0000644000175000017500000000271412211062077021623 0ustar gladkgladk SVDSetUp

SVDSetUp

Sets up all the internal data structures necessary for the execution of the singular value solver.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetUp(SVD svd)
Collective on SVD

Input Parameter

svd - singular value solver context

Notes

This function need not be called explicitly in most cases, since SVDSolve() calls it. It can be useful when one wants to measure the set-up time separately from the solve time.

See Also

SVDCreate(), SVDSolve(), SVDDestroy()

Location: src/svd/interface/svdsetup.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetTransposeMode.html0000644000175000017500000000477612211062077024034 0ustar gladkgladk SVDSetTransposeMode

SVDSetTransposeMode

Sets how to handle the transpose of the matrix associated with the singular value problem.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetTransposeMode(SVD svd,SVDTransposeMode mode)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
mode - how to compute the transpose, one of SVD_TRANSPOSE_EXPLICIT or SVD_TRANSPOSE_IMPLICIT (see notes below)

Options Database Key

-svd_transpose_mode <mode> - Indicates the mode flag, where <mode> is one of 'explicit' or 'implicit'.

Notes

In the SVD_TRANSPOSE_EXPLICIT mode, the transpose of the matrix is explicitly built.

The option SVD_TRANSPOSE_IMPLICIT does not build the transpose, but handles it implicitly via MatMultTranspose() (or MatMultHermitianTranspose() in the complex case) operations. This is likely to be more inefficient than SVD_TRANSPOSE_EXPLICIT, both in sequential and in parallel, but requires less storage.

The default is SVD_TRANSPOSE_EXPLICIT if the matrix has defined the MatTranspose operation, and SVD_TRANSPOSE_IMPLICIT otherwise.

See Also

SVDGetTransposeMode(), SVDSolve(), SVDSetOperator(),
SVDGetOperator(), SVDTransposeMode

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetOperationCounters.html0000644000175000017500000000321612211062077024704 0ustar gladkgladk SVDGetOperationCounters

SVDGetOperationCounters

Gets the total number of matrix vector and dot products used by the SVD object during the last SVDSolve() call.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetOperationCounters(SVD svd,PetscInt* matvecs,PetscInt* dots)
Not Collective

Input Parameter

svd - SVD context

Output Parameter

matvecs - number of matrix vector product operations
dots - number of dot product operations

Notes

These counters are reset to zero at each successive call to SVDSolve().

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/index.html0000644000175000017500000001472512211062077021322 0ustar gladkgladk Singular Value Decomposition Solvers - SVD

Singular Value Decomposition Solvers - SVD: Examples

The Singular Value Decomposition Solver (SVD) is very similar to the EPS object, but intended for the computation of the partial SVD of a rectangular matrix. With this type of object, the user can specify an SVD problem and solve it with any of the different solvers encapsulated by the package. Some of these solvers are actually implemented through calls to EPS eigensolvers.

The user interface is very similar to that of EPS, both for the options database (e.g., -svd_nsv 4 -svd_type lanczos), and for the programmatic interface (e.g., SVDSetDimensions() / SVDSetType()).

Beginner - Basic usage
SVD SVDDestroy SVDSolve
SVDComputeRelativeError SVDGetConverged SVDType
SVDComputeResidualNorms SVDGetSingularTriplet SVDView
SVDConvergedReason SVDSetFromOptions
SVDCreate SVDSetOperator
Intermediate - Setting options for algorithms and data structures
SVDGetConvergedReason SVDGetWhichSingularTriplets SVDSetInitialSpace
SVDGetDimensions SVDMonitorAll SVDSetInitialSpaceLeft
SVDGetIterationNumber SVDMonitorCancel SVDSetTolerances
SVDGetMonitorContext SVDMonitorConverged SVDSetTrackAll
SVDGetOperationCounters SVDMonitorFirst SVDSetType
SVDGetTolerances SVDMonitorSet SVDSetWhichSingularTriplets
SVDGetTrackAll SVDPrintSolution SVDWhich
SVDGetType SVDSetDimensions
Advanced - Setting more advanced options and customization
SVDAppendOptionsPrefix SVDGetOperator SVDSetIP
SVDCrossGetEPS SVDGetOptionsPrefix SVDSetOptionsPrefix
SVDCrossSetEPS SVDGetTransposeMode SVDSetTransposeMode
SVDCyclicGetEPS SVDLanczosGetOneSide SVDSetUp
SVDCyclicGetExplicitMatrix SVDLanczosSetOneSide SVDTRLanczosGetOneSide
SVDCyclicSetEPS SVDRegister SVDTRLanczosSetOneSide
SVDCyclicSetExplicitMatrix SVDRegisterAll SVDTransposeMode
SVDGetDS SVDReset
SVDGetIP SVDSetDS
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
SVDFinalizePackage SVDInitializePackage
No deprecated routines

Table of Contents slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetTolerances.html0000644000175000017500000000414712211062077023340 0ustar gladkgladk SVDSetTolerances

SVDSetTolerances

Sets the tolerance and maximum iteration count used by the default SVD convergence testers.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetTolerances(SVD svd,PetscReal tol,PetscInt maxits)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
tol - the convergence tolerance
maxits - maximum number of iterations to use

Options Database Keys

-svd_tol <tol> - Sets the convergence tolerance
-svd_max_it <maxits> - Sets the maximum number of iterations allowed (use PETSC_DECIDE to compute an educated guess based on basis and matrix sizes)

Notes

Pass 0 to retain the previous value of any parameter.

See Also

SVDGetTolerances()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVD.html0000644000175000017500000000200312211062077020631 0ustar gladkgladk SVD

SVD

Abstract SLEPc object that manages all the singular value problem solvers.

Synopsis

typedef struct _p_SVD* SVD;

See Also

SVDCreate()

Location: src/svd/../../include/slepcsvd.h
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDInitializePackage.html0000644000175000017500000000222012211062077024130 0ustar gladkgladk SVDInitializePackage

SVDInitializePackage

This function initializes everything in the SVD package. It is called from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to SVDCreate() when using static libraries.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDInitializePackage(void)

See Also

SlepcInitialize()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCrossSetEPS.html0000644000175000017500000000254612211062077022703 0ustar gladkgladk SVDCrossSetEPS

SVDCrossSetEPS

Associate an eigensolver object (EPS) to the singular value solver.

Synopsis

#include "slepcsvd.h" 
#include "slepceps.h" 
PetscErrorCode SVDCrossSetEPS(SVD svd,EPS eps)
Collective on SVD

Input Parameters

svd - singular value solver
eps - the eigensolver object

See Also

SVDCrossGetEPS()

Location: src/svd/impls/cross/cross.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDMonitorFirst.html0000644000175000017500000000423712211062077023224 0ustar gladkgladk SVDMonitorFirst

SVDMonitorFirst

Print the first unconverged approximate values and error estimates at each iteration of the singular value solver.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDMonitorFirst(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
Collective on SVD

Input Parameters

svd - singular value solver context
its - iteration number
nconv - number of converged singular triplets so far
sigma - singular values
errest - error estimates
nest - number of error estimates to display
monctx - monitor context (contains viewer, can be NULL)

See Also

SVDMonitorSet(), SVDMonitorAll(), SVDMonitorConverged()

Location: src/svd/interface/svdmon.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDType.html0000644000175000017500000000205312211062077021500 0ustar gladkgladk SVDType

SVDType

String with the name of a SLEPc singular value solver

Synopsis

typedef const char* SVDType;
#define SVDCROSS       "cross"
#define SVDCYCLIC      "cyclic"
#define SVDLAPACK      "lapack"
#define SVDLANCZOS     "lanczos"
#define SVDTRLANCZOS   "trlanczos"

See Also

SVDSetType(), SVD

Location: src/svd/../../include/slepcsvd.h
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetWhichSingularTriplets.html0000644000175000017500000000455412211062077025541 0ustar gladkgladk SVDSetWhichSingularTriplets

SVDSetWhichSingularTriplets

Specifies which singular triplets are to be sought.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetWhichSingularTriplets(SVD svd,SVDWhich which)
Logically Collective on SVD

Input Parameter

svd - singular value solver context obtained from SVDCreate()

Output Parameter

which - which singular triplets are to be sought

Possible values

The parameter 'which' can have one of these values

SVD_LARGEST - largest singular values
SVD_SMALLEST - smallest singular values

Options Database Keys

-svd_largest - Sets largest singular values
-svd_smallest - Sets smallest singular values

See Also

SVDGetWhichSingularTriplets(), SVDWhich

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDMonitorConverged.html0000644000175000017500000000436612211062077024054 0ustar gladkgladk SVDMonitorConverged

SVDMonitorConverged

Print the approximate values and error estimates as they converge.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDMonitorConverged(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
Collective on SVD

Input Parameters

svd - singular value solver context
its - iteration number
nconv - number of converged singular triplets so far
sigma - singular values
errest - error estimates
nest - number of error estimates to display
monctx - monitor context

Note

The monitor context must contain a struct with a PetscViewer and a PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.

See Also

SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorAll()

Location: src/svd/interface/svdmon.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetOptionsPrefix.html0000644000175000017500000000415212211062077024046 0ustar gladkgladk SVDSetOptionsPrefix

SVDSetOptionsPrefix

Sets the prefix used for searching for all SVD options in the database.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetOptionsPrefix(SVD svd,const char *prefix)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
prefix - the prefix string to prepend to all SVD option requests

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

For example, to distinguish between the runtime options for two different SVD contexts, one could call

      SVDSetOptionsPrefix(svd1,"svd1_")
      SVDSetOptionsPrefix(svd2,"svd2_")

See Also

SVDAppendOptionsPrefix(), SVDGetOptionsPrefix()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDComputeRelativeError.html0000644000175000017500000000406112211062077024702 0ustar gladkgladk SVDComputeRelativeError

SVDComputeRelativeError

Computes the relative error bound associated with the i-th singular triplet.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDComputeRelativeError(SVD svd,PetscInt i,PetscReal *error)
Collective on SVD

Input Parameter

svd - the singular value solver context
i - the solution index

Output Parameter

error - the relative error bound, computed as sqrt(n1^2+n2^2)/sigma where n1 = ||A*v-sigma*u||_2 , n2 = ||A^T*u-sigma*v||_2 , sigma is the singular value, u and v are the left and right singular vectors. If sigma is too small the relative error is computed as sqrt(n1^2+n2^2).

See Also

SVDSolve(), SVDComputeResidualNorms()

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDDestroy.html0000644000175000017500000000326712211062077022220 0ustar gladkgladk SVDDestroy

SVDDestroy

Destroys the SVD context.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDDestroy(SVD *svd)
Collective on SVD

Input Parameter

svd - singular value solver context obtained from SVDCreate()

See Also

SVDCreate(), SVDSetUp(), SVDSolve()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetDimensions.html0000644000175000017500000000603512211062077023347 0ustar gladkgladk SVDSetDimensions

SVDSetDimensions

Sets the number of singular values to compute and the dimension of the subspace.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetDimensions(SVD svd,PetscInt nsv,PetscInt ncv,PetscInt mpd)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
nsv - number of singular values to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Options Database Keys

-svd_nsv <nsv> - Sets the number of singular values
-svd_ncv <ncv> - Sets the dimension of the subspace
-svd_mpd <mpd> - Sets the maximum projected dimension

Notes

Pass 0 to retain the previous value of any parameter.

Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is dependent on the solution method and the number of singular values required.

The parameters ncv and mpd are intimately related, so that the user is advised to set one of them at most. Normal usage is that (a) in cases where nsv is small, the user sets ncv (a reasonable default is 2*nsv); and (b) in cases where nsv is large, the user sets mpd.

The value of ncv should always be between nsv and (nsv+mpd), typically ncv=nsv+mpd. If nev is not too large, mpd=nsv is a reasonable choice, otherwise a smaller value should be used.

See Also

SVDGetDimensions()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetType.html0000644000175000017500000000465212211062077022163 0ustar gladkgladk SVDSetType

SVDSetType

Selects the particular solver to be used in the SVD object.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetType(SVD svd,SVDType type)
Logically Collective on SVD

Input Parameters

svd - the singular value solver context
type - a known method

Options Database Key

-svd_type <method> - Sets the method; use -help for a list of available methods

Notes

See "slepc/include/slepcsvd.h" for available methods. The default is SVDCROSS.

Normally, it is best to use the SVDSetFromOptions() command and then set the SVD type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods. The SVDSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database.

See Also

SVDType

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetOperator.html0000644000175000017500000000354612211062077023036 0ustar gladkgladk SVDSetOperator

SVDSetOperator

Set the matrix associated with the singular value problem.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetOperator(SVD svd,Mat mat)
Collective on SVD and Mat

Input Parameters

svd - the singular value solver context
A - the matrix associated with the singular value problem

See Also

SVDSolve(), SVDGetOperator()

Location: src/svd/interface/svdsetup.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetConverged.html0000644000175000017500000000305512211062077023136 0ustar gladkgladk SVDGetConverged

SVDGetConverged

Gets the number of converged singular values.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetConverged(SVD svd,PetscInt *nconv)
Not Collective

Input Parameter

svd - the singular value solver context

Output Parameter

nconv - number of converged singular values

Note

This function should be called after SVDSolve() has finished.

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetDimensions.html0000644000175000017500000000412212211062077023326 0ustar gladkgladk SVDGetDimensions

SVDGetDimensions

Gets the number of singular values to compute and the dimension of the subspace.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetDimensions(SVD svd,PetscInt *nsv,PetscInt *ncv,PetscInt *mpd)
Not Collective

Input Parameter

svd - the singular value context

Output Parameters

nsv - number of singular values to compute
ncv - the maximum dimension of the subspace to be used by the solver
mpd - the maximum dimension allowed for the projected problem

Notes

The user can specify NULL for any parameter that is not needed.

See Also

SVDSetDimensions()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetConvergedReason.html0000644000175000017500000000417512211062077024312 0ustar gladkgladk SVDGetConvergedReason

SVDGetConvergedReason

Gets the reason why the SVDSolve() iteration was stopped.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetConvergedReason(SVD svd,SVDConvergedReason *reason)
Not Collective

Input Parameter

svd - the singular value solver context

Output Parameter

reason - negative value indicates diverged, positive value converged (see SVDConvergedReason)

Possible values for reason

SVD_CONVERGED_TOL - converged up to tolerance
SVD_DIVERGED_ITS - required more than its to reach convergence
SVD_DIVERGED_BREAKDOWN - generic breakdown in method

Notes: Can only be called after the call to SVDSolve() is complete.

See Also

SVDSetTolerances(), SVDSolve(), SVDConvergedReason

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCyclicGetExplicitMatrix.html0000644000175000017500000000240312211062077025313 0ustar gladkgladk SVDCyclicGetExplicitMatrix

SVDCyclicGetExplicitMatrix

Returns the flag indicating if H(A) is built explicitly

Synopsis

#include "slepcsvd.h" 
#include "slepceps.h" 
PetscErrorCode SVDCyclicGetExplicitMatrix(SVD svd,PetscBool *explicitmatrix)
Not Collective

Input Parameter

svd - singular value solver

Output Parameter

explicit - the mode flag

See Also

SVDCyclicSetExplicitMatrix()

Location: src/svd/impls/cyclic/cyclic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetOptionsPrefix.html0000644000175000017500000000274412211062077024037 0ustar gladkgladk SVDGetOptionsPrefix

SVDGetOptionsPrefix

Gets the prefix used for searching for all SVD options in the database.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetOptionsPrefix(SVD svd,const char *prefix[])
Not Collective

Input Parameters

svd - the singular value solver context

Output Parameters

prefix - pointer to the prefix string used is returned

Notes: On the fortran side, the user should pass in a string 'prefix' of sufficient length to hold the prefix.

See Also

SVDSetOptionsPrefix(), SVDAppendOptionsPrefix()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetDS.html0000644000175000017500000000303312211062077021540 0ustar gladkgladk SVDSetDS

SVDSetDS

Associates a direct solver object to the singular value solver.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetDS(SVD svd,DS ds)
Collective on SVD

Input Parameters

svd - singular value solver context obtained from SVDCreate()
ds - the direct solver object

Note

Use SVDGetDS() to retrieve the direct solver context (for example, to free it at the end of the computations).

See Also

SVDGetDS()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetOperator.html0000644000175000017500000000251212211062077023012 0ustar gladkgladk SVDGetOperator

SVDGetOperator

Get the matrix associated with the singular value problem.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetOperator(SVD svd,Mat *A)
Not collective, though parallel Mats are returned if the SVD is parallel

Input Parameter

svd - the singular value solver context

Output Parameters

A - the matrix associated with the singular value problem

See Also

SVDSolve(), SVDSetOperator()

Location: src/svd/interface/svdsetup.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDLanczosGetOneSide.html0000644000175000017500000000241312211062077024077 0ustar gladkgladk SVDLanczosGetOneSide

SVDLanczosGetOneSide

Gets if the variant of the Lanczos method to be used is one-sided or two-sided.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDLanczosGetOneSide(SVD svd,PetscBool *oneside)
Not Collective

Input Parameters

svd - singular value solver

Output Parameters

oneside - boolean flag indicating if the method is one-sided or not

See Also

SVDLanczosSetOneSide()

Location: src/svd/impls/lanczos/gklanczos.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetTolerances.html0000644000175000017500000000370612211062077023324 0ustar gladkgladk SVDGetTolerances

SVDGetTolerances

Gets the tolerance and maximum iteration count used by the default SVD convergence tests.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetTolerances(SVD svd,PetscReal *tol,PetscInt *maxits)
Not Collective

Input Parameter

svd - the singular value solver context

Output Parameters

tol - the convergence tolerance
maxits - maximum number of iterations

Notes

The user can specify NULL for any parameter that is not needed.

See Also

SVDSetTolerances()

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDPrintSolution.html0000644000175000017500000000334212211062077023412 0ustar gladkgladk SVDPrintSolution

SVDPrintSolution

Prints the computed singular values.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDPrintSolution(SVD svd,PetscViewer viewer)
Collective on SVD

Input Parameters

svd - the singular value solver context
viewer - optional visualization context

Options Database Key

-svd_terse - print only minimal information

Note

By default, this function prints a table with singular values and associated relative errors. With -svd_terse only the singular values are printed.

See Also

PetscViewerASCIIOpen()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex14.c.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCyclicSetExplicitMatrix.html0000644000175000017500000000321412211062077025330 0ustar gladkgladk SVDCyclicSetExplicitMatrix

SVDCyclicSetExplicitMatrix

Indicate if the eigensolver operator H(A) = [ 0 A ; A^T 0 ] must be computed explicitly.

Synopsis

#include "slepcsvd.h" 
#include "slepceps.h" 
PetscErrorCode SVDCyclicSetExplicitMatrix(SVD svd,PetscBool explicitmatrix)
Logically Collective on SVD

Input Parameters

svd - singular value solver
explicit - boolean flag indicating if H(A) is built explicitly

Options Database Key

-svd_cyclic_explicitmatrix <boolean> - Indicates the boolean flag

See Also

SVDCyclicGetExplicitMatrix()

Location: src/svd/impls/cyclic/cyclic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDWhich.html0000644000175000017500000000210412211062077021616 0ustar gladkgladk SVDWhich

SVDWhich

Determines whether largest or smallest singular triplets are to be computed

Synopsis

typedef enum { SVD_LARGEST,
               SVD_SMALLEST } SVDWhich;

See Also

SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets()

Location: src/svd/../../include/slepcsvd.h
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSolve.html0000644000175000017500000000404612211062077021653 0ustar gladkgladk SVDSolve

SVDSolve

Solves the singular value problem.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSolve(SVD svd)
Collective on SVD

Input Parameter

svd - singular value solver context obtained from SVDCreate()

Options Database Keys

-svd_view - print information about the solver used
-svd_view_mat binary - save the matrix to the default binary viewer

See Also

SVDCreate(), SVDSetUp(), SVDDestroy()

Location: src/svd/interface/svdsolve.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/svd/examples/tutorials/ex8.c.html
src/svd/examples/tutorials/ex14.c.html
src/svd/examples/tutorials/ex15.c.html
src/svd/examples/tutorials/ex15f.F.html
slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDMonitorSet.html0000644000175000017500000001111512211062077022661 0ustar gladkgladk SVDMonitorSet

SVDMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the error estimates for each requested singular triplet.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDMonitorSet(SVD svd,PetscErrorCode (*monitor)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Collective on SVD

Input Parameters

svd - singular value solver context obtained from SVDCreate()
monitor - pointer to function (if this is NULL, it turns off monitoring)
mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired)

Calling Sequence of monitor

    monitor (SVD svd, PetscInt its, PetscInt nconv, PetscReal *sigma, PetscReal* errest, PetscInt nest, void *mctx)

svd - singular value solver context obtained from SVDCreate()
its - iteration number
nconv - number of converged singular triplets
sigma - singular values
errest - relative error estimates for each singular triplet
nest - number of error estimates
mctx - optional monitoring context, as set by SVDMonitorSet()

Options Database Keys

-svd_monitor - print only the first error estimate
-svd_monitor_all - print error estimates at each iteration
-svd_monitor_conv - print the singular value approximations only when convergence has been reached
-svd_monitor_lg - sets line graph monitor for the first unconverged approximate singular value
-svd_monitor_lg_all - sets line graph monitor for all unconverged approximate singular values
-svd_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to SVDMonitorSet(), but does not cancel those set via the options database.

Notes

Several different monitoring routines may be set by calling SVDMonitorSet() multiple times; all will be called in the order in which they were set.

See Also

SVDMonitorFirst(), SVDMonitorAll(), SVDMonitorCancel()

Location: src/svd/interface/svdmon.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDCyclicGetEPS.html0000644000175000017500000000234112211062077022775 0ustar gladkgladk SVDCyclicGetEPS

SVDCyclicGetEPS

Retrieve the eigensolver object (EPS) associated to the singular value solver.

Synopsis

#include "slepcsvd.h" 
#include "slepceps.h" 
PetscErrorCode SVDCyclicGetEPS(SVD svd,EPS *eps)
Not Collective

Input Parameter

svd - singular value solver

Output Parameter

eps - the eigensolver object

See Also

SVDCyclicSetEPS()

Location: src/svd/impls/cyclic/cyclic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDTransposeMode.html0000644000175000017500000000206212211062077023342 0ustar gladkgladk SVDTransposeMode

SVDTransposeMode

Determines how to handle the transpose of the matrix

Synopsis

typedef enum { SVD_TRANSPOSE_EXPLICIT,
               SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;

See Also

SVDSetTransposeMode(), SVDGetTransposeMode()

Location: src/svd/../../include/slepcsvd.h
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDSetIP.html0000644000175000017500000000303412211062077021543 0ustar gladkgladk SVDSetIP

SVDSetIP

Associates an inner product object to the singular value solver.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDSetIP(SVD svd,IP ip)
Collective on SVD

Input Parameters

svd - singular value solver context obtained from SVDCreate()
ip - the inner product object

Note

Use SVDGetIP() to retrieve the inner product context (for example, to free it at the end of the computations).

See Also

SVDGetIP()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDMonitorCancel.html0000644000175000017500000000271112211062077023315 0ustar gladkgladk SVDMonitorCancel

SVDMonitorCancel

Clears all monitors for an SVD object.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDMonitorCancel(SVD svd)
Collective on SVD

Input Parameters

svd - singular value solver context obtained from SVDCreate()

Options Database Key

-svd_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to SVDMonitorSet(), but does not cancel those set via the options database.

See Also

SVDMonitorSet()

Location: src/svd/interface/svdmon.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDFinalizePackage.html0000644000175000017500000000206612211062077023600 0ustar gladkgladk SVDFinalizePackage

SVDFinalizePackage

This function destroys everything in the Slepc interface to the SVD package. It is called from SlepcFinalize().

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDFinalizePackage(void)

See Also

SlepcFinalize()

Location: src/svd/interface/svdbasic.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/manualpages/SVD/SVDGetTransposeMode.html0000644000175000017500000000311312211062077024000 0ustar gladkgladk SVDGetTransposeMode

SVDGetTransposeMode

Gets the mode used to compute the transpose of the matrix associated with the singular value problem.

Synopsis

#include "slepcsvd.h" 
PetscErrorCode SVDGetTransposeMode(SVD svd,SVDTransposeMode *mode)
Not Collective

Input Parameter

svd - the singular value solver context

Output paramter

mode - how to compute the transpose, one of SVD_TRANSPOSE_EXPLICIT or SVD_TRANSPOSE_IMPLICIT

See Also

SVDSetTransposeMode(), SVDSolve(), SVDSetOperator(),
SVDGetOperator(), SVDTransposeMode

Location: src/svd/interface/svdopts.c
Index of all SVD routines
Table of Contents for all manual pages
Index of all manual pages slepc-3.4.2.dfsg.orig/docs/makefile0000644000175000017500000000215012211062077016061 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # CFLAGS = FFLAGS = SOURCEC = SOURCEF = SOURCEH = DOCS = LIBBASE = libslepc LINCLUDE = ${SOURCEH} DIRS = LOCDIR = docs/ include ${SLEPC_DIR}/conf/slepc_common runexamples: slepc-3.4.2.dfsg.orig/docs/makefile.html0000644000175000017500000000365712211062077017041 0ustar gladkgladk

#
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#  SLEPc - Scalable Library for Eigenvalue Problem Computations
#  Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain
#
#  This file is part of SLEPc.
#     
#  SLEPc is free software: you can redistribute it and/or modify it under  the
#  terms of version 3 of the GNU Lesser General Public License as published by
#  the Free Software Foundation.
#
#  SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
#  WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
#  FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
#  more details.
#
#  You  should have received a copy of the GNU Lesser General  Public  License
#  along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#

CFLAGS   =
FFLAGS   =
SOURCEC  =
SOURCEF  =
SOURCEH  = 
DOCS     = 
LIBBASE  = libslepc
LINCLUDE = ${SOURCEH}
DIRS     = 
LOCDIR   = docs/

include ${SLEPC_DIR}/conf/slepc_common

runexamples:

slepc-3.4.2.dfsg.orig/docs/index.html0000644000175000017500000000500712211062077016362 0ustar gladkgladk manual
[ Manual | Installation | Changes | FAQ | Contact ]

SLEPc is based on PETSc and therefore users are recommended to use this documentation together with the one provided with PETSc. Application programmers can easily begin to use SLEPc from a high level (starting from the tutorial examples) and then gradually learn more details according to their needs.

SLEPc Manual Pages

The manual pages are split into four categories; we recommend that you begin with basic functionality and then gradually explore more sophisticated library features.

  • Beginner - Basic usage
  • Intermediate - Setting options for algorithms and data structures
  • Advanced - Setting more advanced options and customization
  • Developer - Interfaces intended primarily for library developers, not for typical applications programmers

PETSc Manual Pages

PETSc Documentation: [PETSc website]

Additional Documentation

Additional documentation including hands-on exercises and SLEPc Technical Reports can be found at the [SLEPc website]. slepc-3.4.2.dfsg.orig/docs/changes.htm0000644000175000017500000006324312211062077016515 0ustar gladkgladk SLEPc - Changes

[ Manual | Installation | Changes | FAQ | Contact ]

 

 

The following table lists the versions of SLEPc and shows the correspondence between SLEPc and PETSc releases. Versions marked as major releases are those which incorporate some new functionality. The rest are just adaptations required for a new PETSc release and may also include bug fixes.

 

SLEPc version PETSc versions Major Release date
2.1.0 2.1.0 * Not released
2.1.1 2.1.1, 2.1.2, 2.1.3 Dec 2002
2.1.5 2.1.5, 2.1.6 May 2003
2.2.0 2.2.0 * Apr 2004
2.2.1 2.2.1 * Aug 2004
2.3.0 2.3.0 * Jun 2005
2.3.1 2.3.1 Mar 2006
2.3.2 2.3.1, 2.3.2 * Oct 2006
2.3.3 2.3.3 * Jun 2007
3.0.0 3.0.0 * Feb 2009
3.1 3.1 * Aug 2010
3.2 3.2 * Oct 2011
3.3 3.3 * Aug 2012
3.4 3.4 * Jul 2013

 

Changes in Version 3.4

  • Added new class of solvers NEP for the nonlinear eigenvalue problem.
  • Added new class of solvers MFN for computing the action of a matrix function on a vector.
  • New EPS solver: Contour integral spectrum slice (CISS). Allows to compute all eigenvalues inside a region.
  • New QEP solver: Q-Lanczos is a specialized variant of Q-Arnoldi for problems with symmetric matrices.
  • Added support for shift-and-invert in QEP.
  • Added a new auxiliary class FN: Mathematical Function, to be used in the definition of nonlinear eigenproblems.
  • Changed options -xxx_monitor_draw to -xxx_monitor_lg, and similarly for -xxx_monitor_draw_all.

Changes in Version 3.3

  • New EPS solver: Rayleigh quotient conjugate gradient (RQCG). This is the first CG-type eigensolver in SLEPc. It can be used for computing smallest eigenvalues of symmetric-definite matrix pairs without inverting any matrix (a preconditioner can be used instead).
  • Added a customizable parameter to specify how to restart in Krylov-Schur, see EPSKrylovSchurSetRestart. Tunning this parameter may speed up convergence significantly in some cases.
  • Added support for generalized symmetric-indefinite eigenproblems in Krylov-Schur and the Davidson solvers. To use this, set the problem type to EPS_GHIEP.
  • New variant of Generalized Davidson for generalized eigenproblems that expands the subspace with two vectors (GD2). It can be activated with -eps_gd_double_expansion.
  • Added experimental support for arbitrary selection of eigenpairs, where the solver chooses the most wanted ones based on a user-defined function of the eigenvectors rather than simply sorting the eigenvalues.
  • Added a new auxiliary class DS: Direct Solver (or Dense System), which is intended for developers rather than normal users.

Changes in Version 3.2

  • Computational intervals for symmetric eigenproblems, that activate a spectrum slicing mechanism to obtain all eigenvalues in a given interval, see EPSSetInterval.
  • Partial support (experimental) for GPU computing via PETSc's VECCUSP and MATAIJCUSP.
  • Improved performance and robustness of GD and JD solvers in (generalized) Hermitian problems.
  • Performance improvement of solvers with explicit matrix such as SVDCYCLIC and QEPLINEAR (now use matrix preallocation).
  • Added Matlab interface.
  • Added support for parallel builds with CMake.
  • Added support for quad precision (configure PETSc --with-precision=__float128 with gcc-4.6 or later).
  • Interface changes: now all XXXDestroy() routines take a pointer to the object.

Changes in Version 3.1

  • New EPS solvers: Generalized Davidson (GD) and Jacobi-Davidson (JD). These are the first eigensolvers in SLEPc that belong to the class of preconditioned eigensolvers.
  • Added a new instance of ST called STPRECOND. This is not really a spectral transformation but rather a convenient way of handling the preconditioners in the new eigensolvers.
  • Added a new class QEP for solving quadratic eigenvalue problems. Currently, it contains two solvers: the Q-Arnoldi method and another one that provides a linearization of the problem and then invokes an eigensolver from EPS.
  • Added support for balancing of non-Hermitian problems, see EPSSetBalance.
  • Improved sorting of eigenvalues, now with the possibility of sorting with respect to a target value. With shift-and-invert, now the ordering of eigenvalues is the expected one, relative to the target. Also added support for user-defined orderings. For details, see EPSSetWhichEigenpairs.
  • Added support for user-defined convergence tests, see EPSSetConvergenceTest. Several predefined convergence criteria are available. Also, there is a new flag for computing the true residual for the convergence test, see EPSSetTrueResidual.
  • Monitors have been reorganized and now more possibilities are available. See the Users Manual for details.
  • Changes in user interface: EPSAttachDeflationSpace has been renamed to EPSSetDeflationSpace, EPSSetLeftVectorsWanted replaces EPSSetClass for requesting left eigenvectors; Change in arguments: EPSSetDeflationSpace; Deprecated function: EPSSetInitialVector, replaced by EPSSetInitialSpace; STSINV has been renamed to STSINVERT.

Changes in Version 3.0.0

  • Released under GNU LGPL license.
  • Improved support for the case that many eigenpairs are to be computed. This is especially so in the default eigensolver (Krylov-Schur) for symmetric problems, as well as for SVD computations. The user can control the behaviour of the solver with a new parameter, mpd (see EPSSetDimensions).
  • Support for harmonic projection in the default eigensolver (Krylov-Schur), see EPSSetExtraction. This can be useful for computing interior or rightmost eigenvalues without the need of a spectral transformation.
  • Memory usage has been optimized in most solvers. In some cases, memory requirements have been halved with respect to the previous versions.
  • In the spectral transformations (ST) the linear solver used internally has been changed to a direct solver by default. The user can still employ an iterative linear solver by setting the appropriate options.
  • Added better support for Fortran 90.
  • Improved support for 'make install', see the Users Manual for details.

Changes in Version 2.3.3

  • A new solver class, SVD, has been introduced for computing the singular value decomposition of a rectangular matrix. The structure of this new type is very similar to that of EPS, and it simplifies the computation of singular values and vectors. A complete chapter in the users manual is devoted to SVD.
  • Better support for generalized problems. Eigenvector purification has been added to improve accuracy in the case of generalized eigenproblems with singular B. Also, a new problem type (EPS_PGNHEP) has been added for better addressing generalized problems in which A is non-Hermitian but B is Hermitian and positive definite.
  • Now 'make install' is available thus facilitating system-wide installation.

Changes in Version 2.3.2

  • A new 'krylovschur' eigensolver has been added, that implements the Krylov-Schur method. This method is related to the Arnoldi and Lanczos algorithms, but incorporates a new restarting scheme that makes it competitive with respect to implicit restart. This eigensolver is now the default for both symmetric and non-symmetric problems.
  • A new wrapper has been developed to interface with the PRIMME library. This library provides Davidson-type eigensolvers.
  • The 'lanczos' solver has been improved, in particular, the different reorthogonalization strategies are now more robust.
  • Now the 'arnoldi' eigensolver supports the computation of eigenvalues other than those of largest magnitude.
  • EPSGetLinearIterations has been replaced with EPSGetOperationCounters, providing more statistics about the solution process.
  • EPSGetIterationNumber now returns the number corresponding to outer iterations.
  • The 'lobpcg' wrapper has been renamed to 'blopex'.
  • The 'planso' wrapper has been removed since PLANSO is no longer being distributed.

Changes in Version 2.3.1

  • New variant of the Arnoldi method added to the 'arnoldi' eigensolver (with delayed reorthogonalization, see EPSArnoldiSetDelayed).
  • Several optimizations for improving performance and scalability, in particular the orthogonalization steps.

Changes in Version 2.3.0

  • New 'lanczos' eigensolver, an explicitly restarted version of the Lanczos method for symmetric eigenproblems. Allows the user to choose among 5 reorthogonalization strategies.
  • New spectrum folding spectral transformation.
  • New configuration system, similar to PETSc's configure.py.
  • New interface to an external eigensolver: LOBPCG implemented in Hypre.
  • Added graphical convergence monitor (with -eps_xmonitor).
  • Improvement of Arnoldi solver in terms of efficiency and robustness.
  • Now the 'lapack' solver uses specific Lapack routines for symmetric and generalized problems.
  • Bug fix in the ARPACK interface.


Changes in Version 2.2.1

  • The 'power' eigensolver has been replaced by a simpler implementation.
  • The 'rqi' eigensolver has been removed. Now the Rayleigh Quotient Iteration is embedded in the 'power' method.
  • The 'subspace' eigensolver has been rewritten. Now it follows the SRRIT implementation, which is much faster than the old one.
  • The 'arnoldi' eigensolver has been re-implemented as well. The new implementation is much more robust and efficient.
  • A new Spectral Tranformation (ST) has been added: the generalized Cayley transform.
  • Support for user-provided deflation subspaces has been added (see EPSAttachDeflationSpace).
  • Support for preservation of symmetry in eigensolvers. For this feature, the user must explicitly call EPSSetProblemType in symmetric problems.
  • The two types of monitors (error estimates and values) have been merged in a single one.
  • New function EPSGetInvariantSubspace.
  • Better support for spectrum slicing in 'blzpack'.


Changes in Version 2.2.0

  • EPSSolve does not return the number of iterations. Use EPSGetIterationNumber for this purpose.
  • EPSGetSolution has been replaced by EPSGetEigenpair with a cleaner interface.
  • EPSComputeError has been replaced by EPSComputeRelativeError and EPSComputeResidualNorm with better error computing for zero eigenvalues. These functions now are oriented to single eigenpairs, as well as EPSGetErrorEstimate.
  • The possibilities of EPSSetWhichEigenpairs have been reduced and now are more coherent across problem types.
  • Removed STNONE spectral transformation. The default of STSHIFT with 0 shift is equivalent.
  • Added STSinvertSetMatStructure to optimize performance of MatAXPY in shift-and-invert transformation.
  • Classical and modified Gram-Schmidt orthogonalization use iterative refinement, with user options for parameter adjustment.


Changes in Version 2.1.5

  • Added call to MatGetInertia in BLZPACK interface.

 

slepc-3.4.2.dfsg.orig/docs/manual.htm0000644000175000017500000000500712211062077016354 0ustar gladkgladk manual
[ Manual | Installation | Changes | FAQ | Contact ]

SLEPc is based on PETSc and therefore users are recommended to use this documentation together with the one provided with PETSc. Application programmers can easily begin to use SLEPc from a high level (starting from the tutorial examples) and then gradually learn more details according to their needs.

SLEPc Manual Pages

The manual pages are split into four categories; we recommend that you begin with basic functionality and then gradually explore more sophisticated library features.

  • Beginner - Basic usage
  • Intermediate - Setting options for algorithms and data structures
  • Advanced - Setting more advanced options and customization
  • Developer - Interfaces intended primarily for library developers, not for typical applications programmers

PETSc Manual Pages

PETSc Documentation: [PETSc website]

Additional Documentation

Additional documentation including hands-on exercises and SLEPc Technical Reports can be found at the [SLEPc website]. slepc-3.4.2.dfsg.orig/docs/mail_list.htm0000644000175000017500000000306612211062077017057 0ustar gladkgladk mailing list

[ Manual | Installation | Changes | FAQ | Contact ]

 

 

SLEPc home: http://www.grycap.upv.es/slepc

We will update users regarding new releases, changes, etc. through a mailing list. This is a low traffic mailing list, with messages sent only from time to time. We encourage all the users to subscribe to this mailing list. The number of subscribed users is also a feedback for us indicating how many users are interested in SLEPc.


For subscription and other information related to the mailing list follow this link: http://www.grycap.upv.es/slepc/contact/mail_list.htm.

slepc-3.4.2.dfsg.orig/docs/instal.htm0000644000175000017500000002102712211062077016371 0ustar gladkgladk installation
[ Manual | Installation | Changes | FAQ | Contact ]

 

 

Basic Installation Instructions

The following is a quick-start guide for installing SLEPc. For further details, the user is referred to the SLEPc Users Manual.

Previously to the installation of SLEPc, the system must have an appropriate version of PETSc installed (see the PETSc installation documentation for details). Check the Changes section for a list of SLEPc versions and their corresponding PETSc versions.

The installation process for SLEPc is very similar to PETSc, with two main stages: configuration and compilation. SLEPc configuration is much simpler because most of the configuration information is taken from PETSc, including compiler options and scalar type (real or complex). Several configurations can coexist in the same directory tree, being selected by different values of PETSC_ARCH, so that one can, for instance, have a SLEPc compiled with real scalars and another one with complex scalars.

The main steps for the installation are:

  1. Unbundle the distribution file slepc-3.4.0.tgz with a usual command such as tar xzf slepc-3.4.0.tgz. This will create a directory and unpack the software there.
  2. Set the environment variable SLEPC_DIR to the full path of the SLEPc home directory, for example,
    export SLEPC_DIR=/home/username/slepc-3.4.0
    In addition to this variable, PETSC_DIR and PETSC_ARCH must also be set appropriately.
  3. In the SLEPc directory, execute
    ./configure
    Note that in order to enable external packages (see below), this command must be run with appropiate options. To see all available options use ./configure --help
  4. In the SLEPc home directory, type
    make
  5. Optionally, if an installation directory has been specified during configuration (with option --prefix in step 3 above), then type
    make install
    This is useful for building as a regular user and then copying the libraries and include files to the system directories as root.
  6. If the installation went smoothly, then try running some test examples with
    make test
    Examine the output for any obvious errors or problems.

 

Optional Software

SLEPc provides an interface to several software packages. These should be installed before installing SLEPc. These packages are not developed, maintained, or supported by the SLEPc team; we merely provide an interface to them. To integrate one of these libraries in SLEPc:

  • First install the external package following its instructions. Make sure you use the same compilers and MPI that you plan to use with PETSc/SLEPc.
  • Enable the utilization of the external software from SLEPc by adding specific command-line parameters when executing configure. For example, to use ARPACK, specify the following options (with the appropriate paths):

        ./configure --with-arpack-dir=/usr/software/ARPACK
                    --with-arpack-flags=-lparpack,-larpack
  • Build the SLEPc libraries.

SLEPc currently interfaces to the following libraries:

  • ARPACK (Implicitly Restarted Arnoldi/Lanczos solver).
  • PRIMME (PReconditioned Iterative MultiMethod Eigensolver).
  • BLZPACK (Block Lanczos with selective and partial reorthogonalization).
  • TRLAN (Dynamic Thick Restart Lanczos solver).
  • BLOPEX (Block Locally Optimal Preconditioned Eigenvalue Xolvers).
  • FEAST eigensolver.

Additional information about these packages can be found in the SLEPc Users Manual.

 

 

slepc-3.4.2.dfsg.orig/conf/0000755000175000017500000000000012214143515014360 5ustar gladkgladkslepc-3.4.2.dfsg.orig/conf/slepc_rules0000644000175000017500000002250412211062077016626 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # chk_slepcdir: @mypwd=`pwd`; cd ${SLEPC_DIR} 2>&1 > /dev/null; true_SLEPC_DIR=`pwd`; cd $${mypwd} 2>&1 >/dev/null; \ newpwd=`echo $${mypwd} | sed "s+$${true_SLEPC_DIR}+DUMMY+g"`;\ hasslepc=`echo $${mypwd} | sed "s+slepc-+DUMMY+g"`;\ if [ $${mypwd} = $${newpwd} -a $${hasslepc} != $${mypwd} ]; then \ printf ${PETSC_TEXT_HILIGHT}"*********************Warning*************************\n" ; \ echo "Your SLEPC_DIR may not match the directory you are in";\ echo "SLEPC_DIR " $${true_SLEPC_DIR} "Current directory" $${mypwd};\ printf "******************************************************"${PETSC_TEXT_NORMAL}"\n" ; \ fi slepc_manualpages: -@if [ "${MANSEC}" != "" ] ; then \ DOCTEXT_PATH=${PETSC_DIR}/src/docs/tex/doctext; export DOCTEXT_PATH; \ ${DOCTEXT} -html \ -mpath ${LOC}/docs/manualpages/${MANSEC} -heading SLEPc \ -defn ${SLEPC_DIR}/src/docs/tex/doctext/html.def \ -locdir ${LOCDIR} -mapref ${LOC}/docs/manualpages/manualpages.cit \ ${SOURCEC} ${SOURCEH}; \ chmod -f g+w ${LOC}/docs/manualpages/${MANSEC}/* ; fi slepc_manexamples: -@base=`basename ${LOCDIR}`; \ if [ "$${base}" = "tutorials" ] ; then \ echo "Generating manual example links" ; \ for i in ${EXAMPLESC} ${EXAMPLESF} foo ; do \ if [ "$$i" != "foo" ] ; then \ a=`cat $$i | ${MAPNAMES} -map ${LOC}/docs/manualpages/manualpages.cit \ -printmatch -o /dev/null | sort | uniq` ; \ for j in $$a ; do \ b=`ls ${LOC}/docs/manualpages/*/$${j}.html | cut -f9` ; \ l=`grep tutorials $${b} | wc -l`; \ if [ $$l -le 10 ] ; then \ if [ $$l -eq 0 ] ; then \ echo "

Examples

" >> $$b; \ fi; \ echo "BB
" | sed s?BB?${LOCDIR}$$i.html?g >> $$b; \ grep -v /BODY $$b > ltmp; \ echo "" >> ltmp; \ mv -f ltmp $$b; \ fi; \ done; \ fi; \ done; \ fi slepc_html: -@sed -e s?man+../?man+ROOT/docs/manualpages/? ${LOC}/docs/manualpages/manualpages.cit > /tmp/$$USER.htmlmap -@cat ${PETSC_DIR}/src/docs/mpi.www.index >> /tmp/$$USER.htmlmap -@ROOT=`echo ${LOCDIR} | sed -e s?/[a-z]*?/..?g -e s?src/??g -e s?include/??g` ;\ loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; \ ${MKDIR} -p $${loc} ;\ for i in ${SOURCEC} ${SOURCEF} ${SOURCEH} ${EXAMPLESC} ${EXAMPLESF} ${EXAMPLESCH} ${EXAMPLESFH} ${EXAMPLESMATLAB} foo ; do\ if [ -f $$i ]; then \ iroot=`echo $$i | sed -e "s?[a-z.]*/??g"`;\ IROOT=`echo $${i} | sed -e s?[.][.]??g` ;\ if [ "$${IROOT}" != "$${i}" ] ; then \ IROOT=".."; \ else \ IROOT=$${ROOT};\ fi;\ ${RM} $${loc}/$$i.html; \ echo "
Actual source code: $${iroot}

" > $${loc}/$$i.html; \ sed -e "s/CHKERRQ(ierr);//g" -e "s/PetscFunctionReturn(0)/return(0)/g" \ -e "s/ierr [ ]*= //g" $$i | ${C2HTML} -n | ${PETSC_DIR}/bin/maint/fixinclude $$i $${ROOT} | \ egrep -v '(PetscValid|PetscFunctionBegin|PetscCheck|PetscErrorCode ierr;|#if !defined\(__|#define __|#undef __|EXTERN_C )' | \ ${MAPNAMES} -map /tmp/$$USER.htmlmap -inhtml | sed -e s?ROOT?$${IROOT}?g >> $${loc}/$$i.html ; \ fi; \ done -@ROOT=`echo ${LOCDIR} | sed -e s?/[a-z]*?/..?g -e s?src/??g -e s?include/??g` ;\ loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; ${RM} $${loc}/index.html; \ cat ${SLEPC_DIR}/src/docs/manualpages-sec/header_${MANSEC} | sed -e "s?Examples?Manual pages?g" -e "s?PETSC_DIR?$${ROOT}/?g"> $${loc}/index.html; \ echo "

" >> $${loc}/index.html -@loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`;\ if [ "${EXAMPLESC}" != "" ] ; then \ for file in ${EXAMPLESC} foo ; do \ if [ -f $$file ]; then \ cmess=`grep "static char help" $${file} | cut -d\" -f2 | cut -d\. -f1`; \ echo "$${file}: $${cmess}
" >> $${loc}/index.html;\ fi; \ done ;\ else \ for file in ${DIRS} foo; do \ if [ -d $$file ]; then \ echo "$${file}/
" >> $${loc}/index.html; \ fi; \ done; \ echo " " >> $${loc}/index.html; \ for file in ${SOURCEH} ${SOURCEC} ${SOURCEF} foo ; do \ if [ -f $$file ]; then \ echo "$${file}
" >> $${loc}/index.html; \ fi; \ done; \ fi ;\ echo " " >> $${loc}/index.html; \ echo "makefile
" >> $${loc}/index.html -@loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; \ cat makefile | ${C2HTML} | ${MAPNAMES} -map /tmp/$$USER.htmlmap -inhtml > $${loc}/makefile.html -@${RM} /tmp/$$USER.htmlmap tmp slepc_tree: ${ACTION} -@for dir in ${DIRS} ftn-auto ftn-custom f90-custom; do \ if [ -d $$dir ]; then \ if [ "${PETSC_ARCH}" = "arch-installed-petsc" ]; then \ PETSCCONF="${PETSC_DIR}/include/petscconf.h" ; \ else \ PETSCCONF="${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h" ; \ fi; \ r=`grep -w requirespackage $$dir/makefile`; \ if [ "$$?" = 0 ]; then \ PKGFLG=`echo $$r | cut -d \' -f2`;\ grep -w "#define $${PKGFLG}" $${PETSCCONF} > /dev/null; \ if [ "$$?" = 1 ]; then \ continue; \ fi; \ fi; \ r=`grep -w requiresfunction $$dir/makefile`; \ if [ "$$?" = 0 ]; then \ PKGFLG=`echo $$r | cut -d \' -f2`;\ grep -w "#define $${PKGFLG}" $${PETSCCONF} > /dev/null; \ if [ "$$?" = 1 ]; then \ continue; \ fi; \ fi; \ r=`grep -w requiresdefine $$dir/makefile`; \ if [ "$$?" = 0 ]; then \ PKGFLG=`echo $$r | cut -d \' -f2`;\ grep -w "#define $${PKGFLG}" ${SLEPC_DIR}/${PETSC_ARCH}/include/slepcconf.h > /dev/null; \ if [ "$$?" = 1 ]; then \ grep -w "#define $${PKGFLG}" $${PETSCCONF} > /dev/null; \ if [ "$$?" = 1 ]; then \ continue; \ fi; \ fi; \ fi; \ r=`grep -w requireslanguage $$dir/makefile`; \ if [ "$$?" = 0 ]; then \ echo $$r | grep -w ${PETSC_LANGUAGE} > /dev/null; \ if [ "$$?" = 1 ]; then \ continue; \ fi; \ fi; \ r=`grep -w requiresscalar $$dir/makefile`; \ if [ "$$?" = 0 ]; then \ echo $$r | grep -w ${PETSC_SCALAR} > /dev/null; \ if [ "$$?" = 1 ]; then \ continue; \ fi; \ fi; \ r=`grep -w requiresprecision $$dir/makefile`; \ if [ "$$?" = 0 ]; then \ echo $$r | grep -w ${PETSC_PRECISION} > /dev/null; \ if [ "$$?" = 1 ]; then \ continue; \ fi; \ fi; \ else \ continue; \ fi; \ (cd $$dir ; \ echo ${ACTION} in: `pwd`; \ ${OMAKE} slepc_tree ACTION=${ACTION} PETSC_ARCH=${PETSC_ARCH} LOC=${LOC} DATAFILESPATH=${DATAFILESPATH} BASE_DIR=${BASE_DIR});\ done # builds the SLEPc shared library slepc_shared: chk_makej -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} SLEPC_DIR=${SLEPC_DIR} OTHERSHAREDLIBS="${PETSC_KSP_LIB} ${SLEPC_EXTERNAL_LIB}" shared_nomesg # uses the cmake infrastructure to build/rebuild the libraries slepc_cmake: chk_makej @echo "Building SLEPc using CMake with ${MAKE_NP} build threads" @echo "==========================================" @cd ${SLEPC_DIR}/${PETSC_ARCH} && ${OMAKE} -j ${MAKE_NP} VERBOSE=1 @echo "=========================================" include ${PETSC_DIR}/conf/rules include ${SLEPC_DIR}/${PETSC_ARCH}/conf/slepcrules slepc-3.4.2.dfsg.orig/conf/slepc_common0000644000175000017500000000252212211062077016762 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # # SLEPc uses the portable makefile system provided by the PETSc library. # The following include files set customized site, optimization, and version # options. Do NOT remove any of these include files! # # # a dummy target which does nothing - just in case # 'ALL: get mapped into this file' # all_dummy: -@true include ${SLEPC_DIR}/conf/slepc_variables include ${SLEPC_DIR}/conf/slepc_rules include ${SLEPC_DIR}/conf/slepc_test slepc-3.4.2.dfsg.orig/conf/slepc_test0000644000175000017500000000262312211062077016453 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # include ${PETSC_DIR}/conf/test testexamples_BLOPEX: ${TESTEXAMPLES_BLOPEX} testexamples_C_NoF128: ${TESTEXAMPLES_C_NOF128} buildexamples_BLOPEX: -@${OMAKE} testexamples_BLOPEX TESTEXAMPLES_BLOPEX=`echo ${TESTEXAMPLES_BLOPEX} | sed s/runex[0-9]*[a-z0-9_]*//g` buildexamples_C_NoF128: -@${OMAKE} testexamples_C_NoF128 TESTEXAMPLES_C_NOF128=`echo ${TESTEXAMPLES_C_NOF128} | sed s/runex[0-9]*[a-z0-9_]*//g` slepc_alltests: alltests @[ `grep Possible ${PETSC_ARCH}/conf/alltests.log | wc -l` -le 4 ] slepc-3.4.2.dfsg.orig/conf/slepc_variables0000644000175000017500000000334112211062077017442 0ustar gladkgladk# # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # SLEPc - Scalable Library for Eigenvalue Problem Computations # Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain # # This file is part of SLEPc. # # SLEPc is free software: you can redistribute it and/or modify it under the # terms of version 3 of the GNU Lesser General Public License as published by # the Free Software Foundation. # # SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for # more details. # # You should have received a copy of the GNU Lesser General Public License # along with SLEPc. If not, see . # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # include ${PETSC_DIR}/conf/variables include ${SLEPC_DIR}/${PETSC_ARCH}/conf/slepcvariables SLEPC_LIB_DIR = ${SLEPC_DIR}/${PETSC_ARCH}/lib SLEPC_INCLUDE = -I${SLEPC_DIR} -I${SLEPC_DIR}/${PETSC_ARCH}/include -I${SLEPC_DIR}/include CC_INCLUDES = ${PETSC_INCLUDE} ${SLEPC_INCLUDE} FC_INCLUDES = ${PETSC_INCLUDE} ${SLEPC_INCLUDE} SLEPC_EXTERNAL_LIB = ${ARPACK_LIB} ${BLZPACK_LIB} ${TRLAN_LIB} ${PRIMME_LIB} ${BLOPEX_LIB} ${FEAST_LIB} INSTALL_LIB_DIR = ${SLEPC_LIB_DIR} CCPPFLAGS = ${PETSC_CCPPFLAGS} ${SLEPC_INCLUDE} FCPPFLAGS = ${PETSC_FCPPFLAGS} ${SLEPC_INCLUDE} SLEPC_LIB = ${CC_LINKER_SLFLAG}${SLEPC_LIB_DIR} -L${SLEPC_LIB_DIR} -lslepc ${SLEPC_EXTERNAL_LIB} ${PETSC_KSP_LIB} # no longer required SLEPC_FORTRAN_LIB = SHLIBS = libslepc LIBNAME = ${INSTALL_LIB_DIR}/${LIBBASE}.${AR_LIB_SUFFIX} slepc-3.4.2.dfsg.orig/COPYING0000644000175000017500000010451312211062077014472 0ustar gladkgladk GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .